com.ibm.openpages.api.service

Interface IResourceService



  • public interface IResourceService
     Gateway to resource instance data.
     Use this service to perform CRUD operations on Resource.
    --- Snippet Code to create Resource---- // Create Resource Service IResourceService rs = serviceFactory.createResourceService(); // Create MetaDate Service IMetaDataService mss = serviceFactory.creatMetaDataService(); // Get the Resource Factory IResourceFactory rss = rss.getResourceFactory(); // Get the type Definition of the Object being created ITypeDefinition objectTypeDef = mss.getType(type); // Create AutoNamed Child Object IGRCObject newObject = rss.createAutoNamedGRCObject(objectTypeDef); //Set Description newObject.setDescription(childDescription); //Set Parent Association newObject.setPrimaryParent(parentObject.getId()); //Create the Object newObject = rss.saveResource(newObject);
    ResourceUtil.setFieldValue( com.ibm.openpages.api.resource.IField, java.lang.Object)
    See Also:
    IResource, IServiceFactory, IField, ITypeDefinition, GRCObjectFilter, FolderFilter, IFolder
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void associate(Id grcObject, java.util.List<Id> parents, java.util.List<Id> children)
      Associate a list of parents, children to a given object.
      boolean canCreate(ITypeDefinition intendedTypeToCreate, Id intendedFolder, Id intendedParent)
      Checks if the current user has the permissions to create a GRC Object.
      java.util.List<Id> canCreateObjectsForTypes(Id userId, java.util.List<Id> typesToCreate)
      Considers Folder based security, Role based security and Rule based security globally to check for a list of potential object types which ones the user may have access to create.
      java.util.List<Id> canCreateObjectsForTypes(java.util.List<Id> typesToCreate, Id intendedParentObject)
      Considers Folder based security, Role based security and Rule based security to check for a list of potential object types which ones the current user may have access to create for a specific intended parent GRC Object.
      void deleteResource(Id resourceId)
      Delete a resource by id and all its associated primary children resources as well.
      void deleteResource(IResource resource)
      Deletes a resource by object and all its associated primary children resources as well.
      java.lang.String determineDefaultFolder(ITypeDefinition typeToCreate, IGRCObject intendedParent, boolean createFolders)
      Determines the correct default folder for a new GRC Object to be created as a child of an intended parent GRC Object.
      void dissociate(Id grcObject, java.util.List<Id> parents, java.util.List<Id> children)
      Dissociate a list of parents, children to a given object.
      boolean exists(Id parentFolderId, java.lang.String resourcName, boolean defaultSuffix)
      Checks whether a resource with the name already exists in the folder.
      java.util.List<IDeletedResource> findDeletedResources(DeletedResourceFilter filter)
      Get a list of deleted GRC objects.
      IResourcePermission getEffectivePermissions(Id userOrGroup, Id resourceToCheck)
      Retrieves the effective resource permissions, read, write, delete, and associate that a user has for a specific OpenPages resource.
      IFolder getFolder(Id id)
      Get a Folder object by Id for the current period.
      IFolder getFolder(Id id, FolderFilter filter)
      Get a Folder object by Id.
      IFolder getFolder(java.lang.String path)
      Get a Folder object by path for the current period.
      IFolder getFolder(java.lang.String path, FolderFilter filter)
      Get a Folder object by path.
      IGRCObject getGRCObject(Id id)
      Get a GRC object by Id for the the current period including all fields and no associations.
      IGRCObject getGRCObject(Id id, GRCObjectFilter filter)
      Get a GRC object by ID with specified filter for fields and associations.
      IGRCObject getGRCObject(java.lang.String path)
      Get a GRC object by path for the current period including all fields and no associations.
      IGRCObject getGRCObject(java.lang.String path, GRCObjectFilter filter)
      Get a GRC object by path with specified filter for fields and associations.
      Id getIdForPath(java.lang.String fullPath)
      Retrieves just the Id for a GRC Object or Folder given a full path without retrieving the entire object.
      IResourceFactory getResourceFactory()
      Returns the factory for creating in memory instances of objects.
      void overwriteProperties(Id id, java.util.List<Id> fieldDefinitionIds, java.lang.String newValue)
      Overwrite text properties of a object with a specific value.
      void purgeResource(Id id)
      Fully removes all references to the object from the system, including past versions, audit trail, OpenPages storage and records from reporting periods.
      <T extends IResource>
      T
      saveResource(T resource)
      Save a resource.
    • Method Detail

      • getResourceFactory

        IResourceFactory getResourceFactory()
        Returns the factory for creating in memory instances of objects.
        Returns:
        IResourceFactory The factory for creating in memory instances of objects.
      • getGRCObject

        IGRCObject getGRCObject(java.lang.String path,
                                GRCObjectFilter filter)
        Get a GRC object by path with specified filter for fields and associations.
        Parameters:
        path - (required) The path to the object to retrieve
        filter - (required) GRCObjectFilter
        Returns:
        IGRCObject GRCObject instance if it exists, otherwise null
      • getGRCObject

        IGRCObject getGRCObject(java.lang.String path)
        Get a GRC object by path for the current period including all fields and no associations.
        Parameters:
        path - (required) The path to the object to retrieve
        Returns:
        IGRCObject GRCObject instance if it exists, otherwise null. The object returned is for the current period and includes all fields and associations
      • getGRCObject

        IGRCObject getGRCObject(Id id,
                                GRCObjectFilter filter)
        Get a GRC object by ID with specified filter for fields and associations.
        Parameters:
        id - (required)The Id of the object to retrieve
        filter - (required) GRCObjectFilter
        Returns:
        IGRCObject A GRCObject instance if it exists, otherwise null
      • getGRCObject

        IGRCObject getGRCObject(Id id)
        Get a GRC object by Id for the the current period including all fields and no associations.
        Parameters:
        id - (required) The Id of the object to retrieve
        Returns:
        IGRCObject GRCObject instance if it exists, otherwise null. The object returned is for the current period and includes all fields and associations
      • getIdForPath

        Id getIdForPath(java.lang.String fullPath)
        Retrieves just the Id for a GRC Object or Folder given a full path without retrieving the entire object.
        Parameters:
        fullPath - the full path for the GRC Object or Folder
        Returns:
        the Id of the GRC Object or Folder for the specified full path
      • getFolder

        IFolder getFolder(java.lang.String path,
                          FolderFilter filter)
        Get a Folder object by path.
        Parameters:
        path - (required) The path to the object to retrieve
        filter - (required) a filter
        Returns:
        IFolder Folder object instance if it exists, otherwise null
      • getFolder

        IFolder getFolder(java.lang.String path)
        Get a Folder object by path for the current period.
        Parameters:
        path - (required) The path to the object to retrieve
        Returns:
        IFolder Folder object instance if it exists, otherwise null
      • getFolder

        IFolder getFolder(Id id,
                          FolderFilter filter)
        Get a Folder object by Id.
        Parameters:
        id - (required) The Id of the object to retrieve
        filter - (required) A filter
        Returns:
        IFolder Folder instance if it exists, otherwise null
      • getFolder

        IFolder getFolder(Id id)
        Get a Folder object by Id for the current period.
        Parameters:
        id - (required) The Id of the object to retrieve
        Returns:
        IFolder Folder instance if it exists, otherwise null
      • saveResource

        <T extends IResource> T saveResource(T resource)
        Save a resource. The save will only be allowed when the user performing this operation has the required access permissions in OpenPages through Role-based security or Security Rules.
        Parameters:
        resource - (required) The resource to save
        Returns:
        IResource The refreshed resource or an object of type resource
        See Also:
        canCreate(ITypeDefinition, Id, Id)
      • deleteResource

        void deleteResource(IResource resource)
        Deletes a resource by object and all its associated primary children resources as well. If the IResource is an instance of a GRC object then will use the setting "/OpenPages/Common/Cascade Delete/Include Object Types" to determine which Types of associated resources are deleted. If the IResource is an instance of a folder then all resources contained by the folder will be deleted as well.
        Parameters:
        resource - (required) The resource to delete
      • deleteResource

        void deleteResource(Id resourceId)
        Delete a resource by id and all its associated primary children resources as well. If the IResource is an instance of a GRC object then will use the setting "/OpenPages/Common/Cascade Delete/Include Object Types" to determine which Types of associated resources are deleted. If the IResource is an instance of a folder then all resources contained by the folder will be deleted as well.
        Parameters:
        resourceId - (required) The id of the resource to delete
      • associate

        void associate(Id grcObject,
                       java.util.List<Id> parents,
                       java.util.List<Id> children)
        Associate a list of parents, children to a given object.
        Parameters:
        grcObject - (required) Id of the target object
        parents - (required) List of Parent Ids
        children - (required)List of Children Ids
      • dissociate

        void dissociate(Id grcObject,
                        java.util.List<Id> parents,
                        java.util.List<Id> children)
        Dissociate a list of parents, children to a given object.
        Parameters:
        grcObject - (required) Id of the target object
        parents - (required) List of Parent Ids
        children - (required) List of Children Ids
      • getEffectivePermissions

        IResourcePermission getEffectivePermissions(Id userOrGroup,
                                                    Id resourceToCheck)
        Retrieves the effective resource permissions, read, write, delete, and associate that a user has for a specific OpenPages resource.
        Parameters:
        user - (required) User to check permissions for
        resourceToCheck - (required) Id of the Resource to check permissions on
        Returns:
        Resource Permissions
      • canCreate

        boolean canCreate(ITypeDefinition intendedTypeToCreate,
                          Id intendedFolder,
                          Id intendedParent)

        Checks if the current user has the permissions to create a GRC Object. This evaluates the Security Rules to check if user has create permission as well as with required Role-based Security.

        The permissions required to create an object are read and write on the intended folder and read and associate on the intended parent.

        Parameters:
        intendedTypeToCreate - (required) the type to check if can create
        intendedFolderId - (optional) the folder location where the new object will be created or null to use the default folder location for the parent and type.
        intendedParent - (optional) the parent that the new object will be associated to as a child or null if orphaned
        Returns:
        true if the user has the permissions to create the GRC Object for intended parameters
      • canCreateObjectsForTypes

        java.util.List<Id> canCreateObjectsForTypes(Id userId,
                                                    java.util.List<Id> typesToCreate)

        Considers Folder based security, Role based security and Rule based security globally to check for a list of potential object types which ones the user may have access to create. Role-based

        This considers whether a user has Read, Write permissions at any context for each type. Restrict rules are not evaluated, extend rules will be OR'd to the folder and role based permissions for each type.

        For the special case of Signature objects, additional checks are made that if the user has required access permissions for the Signature object type, then he/she must also be in the correct user groups to have the signoff capability for at least one type, as defined by the OpenPages Settings under 'setting '/OpenPages/Applications/GRCM/Signature/Permission'. Refer to the Administrators Guide for more information on Signature permissions.

        Parameters:
        userId - (required) User to check permissions for
        typesToCreate - (required) List of ITypeDefinition Ids for Object Types that will checked for the user's ability to create instances of them
        Returns:
        List of type Ids that the user can possibly create
      • canCreateObjectsForTypes

        java.util.List<Id> canCreateObjectsForTypes(java.util.List<Id> typesToCreate,
                                                    Id intendedParentObject)

        Considers Folder based security, Role based security and Rule based security to check for a list of potential object types which ones the current user may have access to create for a specific intended parent GRC Object.

        This evaluates the Security Rules to check if user has create permission as well as with required Role-based Security.

        For the special case of Signature objects, additional checks are made that if the user has required access permissions for the Signature object type, then he/she must also be in the correct user groups to have the signoff capability for at least one type, as defined by the OpenPages Settings under 'setting '/OpenPages/Applications/GRCM/Signature/Permission'. Refer to the Administrators Guide for more information on Signature permissions.

        Parameters:
        typesToCreate - (required) List of ITypeDefinition Ids for Object Types that will checked for the user's ability to create instances of them
        intendedParentObject - (required) Id of intended parent if known, null if not known.
        Returns:
        List of type Ids that the user can possibly create
      • determineDefaultFolder

        java.lang.String determineDefaultFolder(ITypeDefinition typeToCreate,
                                                IGRCObject intendedParent,
                                                boolean createFolders)
        Determines the correct default folder for a new GRC Object to be created as a child of an intended parent GRC Object.
        Parameters:
        typeToCreate - type of the child that is to be created
        intendedParent - the parent GRC Object to create the child from
        createFolders - if the folders in the path should be created if they do not exist currently
        Returns:
        Full Path of the folder that the object can be created in by default
      • exists

        boolean exists(Id parentFolderId,
                       java.lang.String resourcName,
                       boolean defaultSuffix)
        Checks whether a resource with the name already exists in the folder.
        Parameters:
        parentFolderID -
        resourcename -
        defaultSuffix - true to append .txt to the resource name
        Returns:
        true if resource with same name exists
      • findDeletedResources

        java.util.List<IDeletedResource> findDeletedResources(DeletedResourceFilter filter)
        Get a list of deleted GRC objects.

        Permissions:

        The operation can only be performed by a super user.

        Parameters:
        filter - (optional) The path to the object to retrieve
        Returns:
        List A list of deleted resources found

        Example The following code snippet illustrates a search for deleted resources of a specific conditions


                 DeletedResourceFilter filter = new DeletedResourceFilter();
                 List resources;
                 Id userId = currentUserId;
        
                 filter.getConditions()
                         .add(new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_RESOURCE_TYPE, DeletedResourceFilter.OPERATOR_EQUAL_TO, 1));
                 filter.getConditions().add(new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_DESCRIPTION, DeletedResourceFilter.OPERATOR_LIKE,
                         "%" + descriptionAll + "%"));
                 filter.getConditions().add(new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_LOCATION, DeletedResourceFilter.OPERATOR_LIKE,
                         "/_op_sox/Project/Default%"));
                 filter.getConditions().add(new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_LAST_MODIFICATION_DATE,
                         DeletedResourceFilter.OPERATOR_GREATER_THAN_OR_EQUAL, createdtDate));
                 filter.getConditions().add(
                         new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_LAST_MODIFIED_BY, DeletedResourceFilter.OPERATOR_EQUAL_TO, userId));
                 filter.getConditions().add(new DeletedResourceFilter.FilterCondition(DeletedResourceFilter.FIELD_CONTENT_TYPE_ID,
                         DeletedResourceFilter.OPERATOR_EQUAL_TO, busEntityType.getId()));
                 filter.setStartRow(1);
                 filter.setEndRow(1000);
                 resources = resourceService.findDeletedResources(filter);
                 
        Since:
        8.0.0.1
        See Also:
        DeletedResourceFilter
      • purgeResource

        void purgeResource(Id id)
        Fully removes all references to the object from the system, including past versions, audit trail, OpenPages storage and records from reporting periods.

        Permissions:

        The operation can only be performed by a super user.

        Parameters:
        id - (required)The Id of the object to purge. The id can be an object id or a soft deleted object id.
        Since:
        8.0.0.1

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2020. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.