Interface ResourceDataService

    • Method Detail

      • isMemberOfAnyEntity

        boolean isMemberOfAnyEntity​(String resourceId)
      • validateEdit

        Response validateEdit​(Resource resource)
        Validate if the resource can be created
        Parameters:
        resource - - the Resource
        Returns:
      • deleteResource

        Response deleteResource​(String resourceId)
        Deletes a Resoruce
        Parameters:
        resourceId - - the resource id
        Returns:
      • saveResource

        Response saveResource​(Resource resource)
        Add a new resource from a transient resource object and sets resourceId in the returned object.
        Parameters:
        resource -
        Returns:
      • getResource

        Resource getResource​(String resourceId)
        Find a resource.
        Parameters:
        resourceId - the resource id
        Returns:
        resource
      • suggestById

        Resource suggestById​(String resourceId)
        Find a resource in Elasticsearch. Significantly faster than going to the database. Use this method when performance is important and/or data integrity is not 100% required, as the database and ES may be out of sync for a period of time
        Parameters:
        resourceId - the resource id
        Returns:
        resource
      • isIndexed

        boolean isIndexed​(String resourceId)
        Checks if a Reource has been indexed in the search engine (currently ElasticSearch)
        Parameters:
        resourceId -
        Returns:
      • getAllResourceTypes

        List<ResourceType> getAllResourceTypes()
        Find all resource types.
        Returns:
        the all resource types
      • findBeans

        ResourceListResponse findBeans​(ResourceSearchBean searchBean,
                                       EntitlementsCollection[] dependants,
                                       int from,
                                       int size)
        Search a Resource
        Parameters:
        searchBean - - search bean, containing search parameters
        dependants - - collection instead of deep copy flag
        from - - where to start
        size - - how many to return
        Returns:
        - the search results
      • getUserApplicationCategories

        List<Resource> getUserApplicationCategories​(String userId,
                                                    String rootResourceId)
        Method is user to get Application categories for given user id. since v4.1.8 users should be authorized to see categories. If in PROPERTY_FILE_VALUES PROPERTY 'org.openiam.authorization.create.request.disabled' is set to 'true' (default) the old behavior should be expected. All categories will be visible. otherwise User will see categories that he is authorized to. The common OpenIAM RBAC approach is used.
        Parameters:
        userId - - User Id
        Returns:
        List Of resouces with type "APPLICATION CATEGORY";
      • count

        int count​(ResourceSearchBean searchBean)
        count the number of resources based on the searchBean
        Parameters:
        searchBean -
        Returns:
      • addChildResource

        Response addChildResource​(String resourceId,
                                  String memberResourceId,
                                  Set<String> rights,
                                  Date startDate,
                                  Date endDate)
        add a child resource to a parent
        Parameters:
        resourceId - - the parent resource ID
        memberResourceId - - the child resource ID
        Returns:
        a Response Object, with details about the result of the operation
      • deleteChildResource

        Response deleteChildResource​(String resourceId,
                                     String memberResourceIdd)
        Removes a child resource from a parent
        Parameters:
        resourceId - - the parent resource ID
        memberResourceId -
        Returns:
        a Response Object, with details about the result of the operation
      • addGroupToResource

        Response addGroupToResource​(String resourceId,
                                    String groupId,
                                    Set<String> rightIds,
                                    Date startDate,
                                    Date endDate)
        Entitles a Group to a Resource
        Parameters:
        resourceId - - the resource ID
        groupId - - the group ID
        Returns:
        a Response Object, with details about the result of the operation
      • removeGroupToResource

        Response removeGroupToResource​(String resourceId,
                                       String groupId)
        Disentitles a Group from a Resource
        Parameters:
        resourceId - - the resource ID
        groupId - - the group ID
        Returns:
        a Response Object, with details about the result of the operation
      • addRoleToResource

        Response addRoleToResource​(String resourceId,
                                   String roleId,
                                   Set<String> rightIds,
                                   Date startDate,
                                   Date endDate)
        entitle a Role to a Resource
        Parameters:
        resourceId - - the resource ID
        roleId - - the role ID
        Returns:
        a Response Object, with details about the result of the operation
      • bulkEntitlementsRequest

        Response bulkEntitlementsRequest​(MembershipsRequest request)
        entitle a Groups / Roles / Child resources to a Resource
        Parameters:
        request - - the MembershipsRequest object with resource and group/roles/childs ids
        Returns:
        a Response Object, with details about the result of the operation
      • removeRoleToResource

        Response removeRoleToResource​(String resourceId,
                                      String roleId)
        Disentitles a Resource from a Role
        Parameters:
        resourceId - - the Resource ID
        roleId - - the Role ID
        Returns:
        a Response Object, with details about the result of the operation
      • canAddUserToResource

        Response canAddUserToResource​(String userId,
                                      String resourceId)
        Tells the caller if the user can be entitled to this resource
        Parameters:
        userId - - the User ID
        resourceId - - the Resource ID
        Returns:
        a Response Object, with details about the result of the operation
      • canRemoveUserFromResource

        Response canRemoveUserFromResource​(String userId,
                                           String resourceId)
        Tells the caller if the user can be disentitled from this resource
        Parameters:
        userId - - the User ID
        resourceId - - the Resource ID
        Returns:
        a Response Object, with details about the result of the operation
      • deleteResourceType

        Response deleteResourceType​(String resourceTypeId)
      • deleteQuestionnaire

        Response deleteQuestionnaire​(String questionnaireId)
      • getQuestionnairesForResources

        QuestionnairesResponse getQuestionnairesForResources​(List<String> resourceIdList,
                                                             boolean isDeepCopy)
        Search for questionnaires by using resources Ids list.
        Parameters:
        resourceIdList - Id list of resources
        isDeepCopy - if true answers are fetched
        Returns:
        Response with questionnaires that related to given resources
      • getAllResourceIds

        List<String> getAllResourceIds()
        Method to get all Resource IDs This method should not be called at run-time. It is here only for testing purpose.

        At the time of writing, this method is called by the ui-test/stress-test module.

        Returns:
      • reindexResource

        Response reindexResource​(String id)
        Parameters:
        id - - Resource id for reindex
        Returns:
      • selectAccess

        ResourceSelectAccess selectAccess​(Set<String> resourceIds,
                                          String searchFilter,
                                          int size)
        Method will return the list of resource for given resource ids. as a separate objects it will return roles mapped by role id and groups mapped by group id. roles and groups are filtered by entitlementsSearchFilter, if it not empty.
        Parameters:
        resourceIds - - set if requested resource ids
        searchFilter - - filter roles and groups by name (contains match type)
        Returns:
        ResourceSelectAccess
      • getOneLevelAccess

        ResourceEntitlementsListResponse getOneLevelAccess​(String userId,
                                                           String resourceSearchQuery,
                                                           UserCollection[] accessTypes,
                                                           int from,
                                                           int size)
        Method is used to retrieve all user's applications (content provider, managed systems, manual managed systems, auth providers) with User's roles/groups/organizations (based on accessTypes param)
        Parameters:
        userId - - userId of user for whom we are looking the apps
        resourceSearchQuery - - search by KeyNameDTO.getName(), IMPORTANT, not Resource#getCoorelatedName()
        accessTypes - - arrays of entitlement types that bring access to enduser (so if ROLES are set that it will return all apps that are linked to user only based on user's roles). Values that are lister: ROLES,GROUPS,ORGANIZATINS
        from - - paging - index of 1st result
        size - - max results size
        Returns:
        ResourceEntitlementsListResponse response with ResourceEntitlementsListResponse#getList() where all apps are listed using ResourceAccess object.
      • getOneLevelAccessWithResourceTypes

        ResourceEntitlementsListResponse getOneLevelAccessWithResourceTypes​(String userId,
                                                                            String resourceSearchQuery,
                                                                            UserCollection[] accessTypes,
                                                                            Set<String> includeResourceTypeIds,
                                                                            Set<String> excludeResourceTypeIds,
                                                                            int from,
                                                                            int size)
        Method is used to retrieve all user's resources based on resource types defined as #includeResourceTypes and #excludeResourceTypes with User's roles/groups/organizations/resources (based on accessTypes param)
        Parameters:
        userId - - userId of user for whom we are looking the apps
        resourceSearchQuery - - filter for resources (MatchType is Contains)
        accessTypes - - arrays of entitlement types that bring access to enduser (so if ROLES are set that it will return all apps that are linked to user only based on user's roles). Values that are lister: UserCollection.ROLES,UserCollection.GROUPS,UserCollection.ORGANIZATIONS, UserCollection.RESOURCES (UserCollection.RESOURCES - is used to show Direct User's resources)
        includeResourceTypeIds - - resource Types that have to be included in the search
        excludeResourceTypeIds - - resource Types that have to be excluded from the search
        from - - paging - index of 1st result
        size - - max results size
        Returns:
        ResourceEntitlementsListResponse response with ResourceEntitlementsListResponse#getList() where all apps are listed using ResourceAccess object.
      • getBulkUsersCommonOneLevelAccess

        ResourceEntitlementsListResponse getBulkUsersCommonOneLevelAccess​(List<String> userIds,
                                                                          String resourceSearchQuery,
                                                                          UserCollection[] accessTypes,
                                                                          int from,
                                                                          int size)
        Method is used to retrieve bulk users common applications (content provider, managed systems, manual managed systems, auth providers) with User's roles/groups/organizations (based on accessTypes param)
        Parameters:
        userIds - - List of userId of users for whom we are looking the apps
        resourceSearchQuery - - search by KeyNameDTO.getName(), IMPORTANT, not Resource#getCoorelatedName()
        accessTypes - - arrays of entitlement types that bring access to enduser (so if ROLES are set that it will return all apps that are linked to user only based on user's roles). Values that are lister: ROLES,GROUPS,ORGANIZATINS
        from - - paging - index of 1st result
        size - - max results size
        Returns:
        ResourceEntitlementsListResponse response with ResourceEntitlementsListResponse#getList() where all apps are listed using ResourceAccess object.