Class ResourceTypeUtil


  • public class ResourceTypeUtil
    extends Object
    • Field Detail

      • PERMISSION_ENUMS

        protected static final Map<Integer,​Class<? extends Enum<? extends Permission>>> PERMISSION_ENUMS
        A map containing all Resources as a key and the respective Permission Enum class for this resource.

        NOTE: In case of new Permission Enum class, please adjust the map accordingly

    • Constructor Detail

      • ResourceTypeUtil

        public ResourceTypeUtil()
    • Method Detail

      • resourceIsContainedInArray

        public static boolean resourceIsContainedInArray​(Integer resourceTypeId,
                                                         Resource[] resources)
        Returns:
        true in case the resource with the provided resourceTypeId is contained by the specified list
      • getPermissionsByResourceType

        public static Permission[] getPermissionsByResourceType​(int givenResourceType)
        Retrieves the Permission array based on the predifined PERMISSION_ENUMS
      • getPermissionByNameAndResourceType

        public static Permission getPermissionByNameAndResourceType​(String permissionName,
                                                                    int resourceType)
        Currently used only in the Rest API Returns a Permission based on the specified permissionName and resourceType
        Throws:
        BadUserRequestException - in case the permission is not valid for the specified resource type
      • getResourceByType

        public static Resource getResourceByType​(int resourceType)
        Iterates over the Resources and returns either the resource with specified resourceType or null.