Class ResourceAccess

java.lang.Object
com.primavera.integration.client.BOBase
com.primavera.integration.client.bo.BusinessObject
com.primavera.integration.client.bo.object.ResourceAccess

public class ResourceAccess extends BusinessObject

Resource access allows you to restrict a user's ability to access resources. If the User.AllResourceAccessFlag is True, the user has access to all resources and resource access does not apply. If the User.AllResourceAccessFlag is False, the user has restricted resource access. In this case, the user is assigned to a resource in the resource hierarchy and that resource becomes the user's root resource access node. The position of the user's root resource access node in the hierarchy determines the user's resource access. The user has access to that root resource access node and all of its children, but no other resources above in the hierarchy. If the user is not assigned to any resources, that user does not have access to resources. Admin Superusers always have all resource access.

Note that project access overrides resource access. If a user can access a project, the user is able to see all resources assigned to that project. The user can then assign these resources anywhere but will only be able to edit them if the user has resource access to them.

Resource Access business objects may not be updated. To change the values on a Resource Access object, create a new object with the desired values and delete the old object.

Note that this business object has a multi-part object ID; its object ID is a combination of its user object ID and its resource object ID. The method createObjectId() can be used to create the multi-part object ID from the individual IDs.

See Also:   Quick reference of ResourceAccess fields

  • Constructor Details

    • ResourceAccess

      public ResourceAccess(Session session)
      Class constructor specifying the Session. This constructor is most commonly used when create() is intended to be called on this object.
      Parameters:
      session - the Session
    • ResourceAccess

      public ResourceAccess(Session session, ObjectId objId) throws BusinessObjectException
      Class constructor specifying the Session and ObjectId of the object. For this particular object, the ObjectId is multi-part, created from the UserObjectId and ResourceObjectId field values. If you do not have the multi-part ObjectId already, it would be simpler to instead use the constructor that has multiple key parameters.
      Parameters:
      session - the Session
      objId - the ObjectId
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • ResourceAccess

      public ResourceAccess(Session session, ObjectId userObjectId, ObjectId resourceObjectId) throws BusinessObjectException
      Class constructor specifying the Session and the individual components of the multi-part key: UserObjectId and ResourceObjectId.
      Parameters:
      session - the Session
      userObjectId - the first ObjectId in the key
      resourceObjectId - the second ObjectId in the key
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • ResourceAccess

      public ResourceAccess(Session session, com.primavera.infr.db.PrmRowSet rowSet, int iIndex) throws BusinessObjectException
      Class constructor called internally after objects are retrieved from the server. Client code should use one of the other constructors for this class.
      Parameters:
      session - the Session
      rowSet - the PrmRowSet retrieved from the server
      iIndex - the row index in the PrmRowSet associated with this business object
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
  • Method Details

    • loadResource

      public Resource loadResource(String[] fields) throws ServerException, NetworkException, BusinessObjectException
      Loads an associated Resource object from the database.
      Parameters:
      fields - fields to load
      Returns:
      Resource the Resource object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • loadUser

      Loads an associated User object from the database.
      Parameters:
      fields - fields to load
      Returns:
      User the User object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getUserObjectId

      public ObjectId getUserObjectId() throws BusinessObjectException
      Gets the unique ID of the associated user. This field is automatically loaded by default whenever this type of business object is loaded from the database. This field must contain a valid value in order to create this type of business object in the database.
      Returns:
      the value in the field UserObjectId
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • setUserObjectId

      public void setUserObjectId(ObjectId o) throws BusinessObjectException
      Sets the unique ID of the associated user. This field is automatically loaded by default whenever this type of business object is loaded from the database. This field must contain a valid value in order to create this type of business object in the database.
      Parameters:
      o - the value to set this field to
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getResourceObjectId

      public ObjectId getResourceObjectId() throws BusinessObjectException
      Gets the unique ID of the associated resource. This field is automatically loaded by default whenever this type of business object is loaded from the database. This field must contain a valid value in order to create this type of business object in the database.
      Returns:
      the value in the field ResourceObjectId
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • setResourceObjectId

      public void setResourceObjectId(ObjectId o) throws BusinessObjectException
      Sets the unique ID of the associated resource. This field is automatically loaded by default whenever this type of business object is loaded from the database. This field must contain a valid value in order to create this type of business object in the database.
      Parameters:
      o - the value to set this field to
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getResourceId

      public String getResourceId() throws BusinessObjectException
      Gets the short code that uniquely identifies the resource.
      Returns:
      the value in the field ResourceId
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getResourceName

      public String getResourceName() throws BusinessObjectException
      Gets the name of the resource.
      Returns:
      the value in the field ResourceName
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getUserName

      public String getUserName() throws BusinessObjectException
      Gets the user's login name.
      Returns:
      the value in the field UserName
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getCreateDate

      public Date getCreateDate() throws BusinessObjectException
      Gets the date this resource security was created.
      Returns:
      the value in the field CreateDate
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getSequenceNumber

      public int getSequenceNumber() throws BusinessObjectException
      Gets the sequence number for sorting.
      Returns:
      the value in the field SequenceNumber
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • setSequenceNumber

      public void setSequenceNumber(int i) throws BusinessObjectException
      Sets the sequence number for sorting.
      Parameters:
      i - the value to set this field to
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getLastUpdateDate

      public Date getLastUpdateDate() throws BusinessObjectException
      Gets the date this resource security was last updated.
      Returns:
      the value in the field LastUpdateDate
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getCreateUser

      public String getCreateUser() throws BusinessObjectException
      Gets the name of the user that created this resource security.
      Returns:
      the value in the field CreateUser
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getLastUpdateUser

      public String getLastUpdateUser() throws BusinessObjectException
      Gets the name of the user that last updated this resource security.
      Returns:
      the value in the field LastUpdateUser
      Throws:
      BusinessObjectException - if a problem occurred in the client-side business objects
    • getAllResourceAccessFlag

      public boolean getAllResourceAccessFlag() throws BusinessObjectException
      Throws:
      BusinessObjectException
    • setAllResourceAccessFlag

      public void setAllResourceAccessFlag(boolean b) throws BusinessObjectException
      Throws:
      BusinessObjectException
    • getRequiredCreateFields

      public static String[] getRequiredCreateFields()
      Gets all fields that must be set before calling create() on this business object. Generally the array will contain one field in each position, but if this business object requires either one field or another field to be set, both of those fields will appear in an element of the returned array separated by '|'. For example, if this business object requires field A to always be set, and field B or field C to be set, one element in the returned array will contain A, and one element will contain B|C.
      Returns:
      String[] an array of required create fields
    • getFilterableFields

      public static String[] getFilterableFields()
      Gets all fields that can be filtered.
      Returns:
      String[] an array of filterable fields
    • getInternalDefaultLoadFields

      public static String[] getInternalDefaultLoadFields()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getAllFields

      public static String[] getAllFields()
      Gets all fields for this business object.
      Returns:
      String[] an array of all fields
    • getInternalAllFields

      public static String[] getInternalAllFields()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getInternalAllFieldsSet

      public static Set<String> getInternalAllFieldsSet()
      An internal method that should not be called directly by client code.
      Returns:
      String[] an internal array
    • getWritableFields

      public static String[] getWritableFields()
      Gets all writable fields for this business object.
      Returns:
      String[] an array of writable fields
    • getDefaultXMLExportFields

      @Deprecated public static String[] getDefaultXMLExportFields()
      Deprecated.
      Gets the fields that are exported by the hierarchical XML exporter when no fields are specified. This method is no longer relevant since the hierarchical XML exporter has been replaced by the flat XML exporter.
      Returns:
      String[] an array of field names
    • getMinimumXMLExportFields

      public static String[] getMinimumXMLExportFields()
      Gets all fields that are always exported at a minimum by the new flat XML exporter
      Returns:
      String[] an array of exported fields
    • toString

      public String toString()
      Returns a string representation of the object. The output is in XML.
      Overrides:
      toString in class Object
      Returns:
      String a string representation of the object.
    • createObjectId

      public static ObjectId createObjectId(ObjectId userObjectId, ObjectId resourceObjectId) throws InvalidValueException
      Creates a multi-part ObjectId from two individual ObjectIds.
      Parameters:
      userObjectId - the ObjectId of the associated user object.
      resourceObjectId - the ObjectId of the associated resource object.
      Returns:
      ObjectId the multi-part ObjectId
      Throws:
      InvalidValueException - if one of the input parameters was invalid.
      IllegalArgumentException - if one of the input parameters was null.
    • getObjectId

      public ObjectId getObjectId() throws BusinessObjectException
      Gets the ObjectId for this object. The ObjectId field serves as the primary key for the associated table in the database. For this object, the ObjectId is multi-part, consisting internally of the UserObjectId and ResourceObjectId fields.
      Overrides:
      getObjectId in class BusinessObject
      Returns:
      ObjectId the multi-part ObjectId of this object
      Throws:
      BusinessObjectException - if the ObjectId fields were not loaded.
    • create

      Creates this ResourceAccess object in the database.
      Returns:
      ObjectId the unique ID of the newly created ResourceAccess object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • create

      public static ObjectId[] create(Session session, ResourceAccess[] resourceaccess) throws ServerException, NetworkException, BusinessObjectException
      Creates multiple ResourceAccess objects in the database.
      Parameters:
      session - the Session object
      resourceaccess - array of ResourceAccess objects to create
      Returns:
      ObjectId[] the array of unique IDs of newly created ResourceAccess objects
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • load

      public static ResourceAccess load(Session session, String[] fields, ObjectId objId) throws ServerException, NetworkException, BusinessObjectException
      Loads a single ResourceAccess object from the database.
      Parameters:
      session - the Session object
      fields - fields to load
      objId - unique ID of the ResourceAccess object
      Returns:
      ResourceAccess the ResourceAccess object
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • load

      public static BOIterator<ResourceAccess> load(Session session, String[] fields, ObjectId[] objIds) throws ServerException, NetworkException, BusinessObjectException
      Loads multiple ResourceAccess objects from the database.
      Parameters:
      session - the Session object
      fields - fields to load
      objIds - object ids of the ResourceAccess objects
      Returns:
      BOIterator a business object iterator used to get the results of the load request
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • delete

      Deletes this ResourceAccess object from the database.
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects
    • delete

      public static void delete(Session session, ResourceAccess[] resourceaccess) throws ServerException, NetworkException, BusinessObjectException
      Deletes multiple ResourceAccess objects from the database.
      Parameters:
      session - the Session object
      resourceaccess - array of ResourceAccess objects to delete
      Throws:
      ServerException - if a problem occurred on the server-side
      NetworkException - if a problem occurred in the network layer
      BusinessObjectException - if a problem occurred in the client-side business objects