Class ResourceTypeUtil

  • public class ResourceTypeUtil
    extends java.lang.Object
    • Field Detail


        protected static final java.util.Map<java.lang.Integer,​java.lang.Class<? extends java.lang.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​(java.lang.Integer resourceTypeId,
                                                         Resource[] resources)
        true in case the resource with the provided resourceTypeId is contained by the specified list
      • getPermissionEnums

        public static java.util.Map<java.lang.Integer,​java.lang.Class<? extends java.lang.Enum<? extends Permission>>> getPermissionEnums()
      • getPermissionsByResourceType

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

        public static Permission getPermissionByNameAndResourceType​(java.lang.String permissionName,
                                                                    int resourceType)
        Currently used only in the Rest API Returns a Permission based on the specified permissionName and resourceType
        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.