Class AccessTypeInjector

    • Constructor Detail

      • AccessTypeInjector

        public AccessTypeInjector()
    • Method Detail

      • getClassName

        public String getClassName()
        Returns the name of the inheritable class.
        Returns:
        A String with the class name
      • getSecuredElementGetter

        protected abstract String getSecuredElementGetter()
        Returns the secured object.
        Returns:
        a String with the name of the method to retrieve the secured element
      • getSecuredElementName

        protected abstract String getSecuredElementName()
        Returns the secured element name.
        Returns:
        a String with the name of the secured element
      • getPriority

        public int getPriority()
        Returns the priority of this injector. It is used to determine the order when adding, updating or removing a particular access, if needed.
        Returns:
        an integer that represents the priority of this injector
      • compareTo

        public int compareTo​(AccessTypeInjector accessType)
        Allows the comparison between AccessTypeInjector classes. The getPriority() method is used to determine the comparison result.
        Specified by:
        compareTo in interface Comparable<AccessTypeInjector>
        Returns:
        a negative integer, zero, or a positive integer as this object priority is less than, equal to, or greater than the priority of the specified AccessTypeInjector object.
      • isInheritable

        public boolean isInheritable​(InheritedAccessEnabled access)
        Determines if a particular access can be inherited according to this injector
        Parameters:
        access - the permission to decide whether is inheritable or not
        Returns:
        true if the access is inheritable, false otherwise
      • checkAccessExistence

        public void checkAccessExistence​(InheritedAccessEnabled access)
        Checks if a particular access already exists
        Parameters:
        access - the permission to decide whether exists or not
      • setParent

        public void setParent​(InheritedAccessEnabled newAccess,
                              InheritedAccessEnabled parentAccess,
                              Role role)
        Sets the parent for an inheritable access object.
        Parameters:
        newAccess - Access whose parent object will be set
        parentAccess - Access that is used in some cases to find the correct parent
        role - Parent role to set directly when applies
      • getRole

        public Role getRole​(InheritedAccessEnabled access)
        Returns the role which the access given as parameter is assigned to. In general, the most part of inheritable accesses have Role as their parent entity. If not, this method must be overridden to retrieve the Role property for their particular case.
        Parameters:
        access - An inheritable access
        Returns:
        the Role owner of the access
      • getRoleProperty

        public String getRoleProperty()
        Returns the role property related to the entity represented by the injector.
        Returns:
        the role property that can be retrieved according to the entity of the injector.
      • getSecuredElementIdentifier

        protected String getSecuredElementIdentifier​(InheritedAccessEnabled access)
        Returns the id of the secured object for the given inheritable access.
        Parameters:
        access - An object of an inheritable class,i.e., a class that implements InheritedAccessEnabled.
        Returns:
        A String with the id of the secured object
      • getAccessList

        public <T extends BaseOBObjectList<? extends InheritedAccessEnabled> getAccessList​(Role role)
        Returns the list of accesses of a particular type for the Role given as parameter.
        Parameters:
        role - The role whose list of accesses of a particular type will be retrieved
        Returns:
        a list of accesses
      • addEntityWhereClause

        public String addEntityWhereClause​(String whereClause)
        Includes in the where clause some filtering needed for same cases.
        Parameters:
        whereClause - The initial where clause
        Returns:
        Entity where clause with the filtering included
      • doEntityParameterReplacement

        public <T extends BaseOBObject> void doEntityParameterReplacement​(OBQuery<T> query)
        Performs the needed parameter substitution according to the entity represented by the injector.
        Parameters:
        query - The query where to perform the parameter substitution
      • getSkippedProperties

        public List<String> getSkippedProperties()
        Retrieves the properties of the entity related to the injector that will not be copied when updating an access by propagation.
        Returns:
        the list of the properties that will not be copied
      • clearInheritFromFieldInChilds

        public void clearInheritFromFieldInChilds​(InheritedAccessEnabled access,
                                                  boolean clearAll)
        Sets to null the Inherited From field to child elements when applies (for example, this is used for TabAccess and FieldAccess). This allows the cascade deletion of these elements when removing an inherited Window Access or Tab Access.
        Parameters:
        access - The access to be removed from the parent list
        clearAll - Flag to indicate if the Inherited From field should be nullified in every child inherited access or not
      • removeReferenceInParentList

        public void removeReferenceInParentList​(InheritedAccessEnabled access)
        Removes references to child elements from the parent list. Using this method prevents the "deleted object would be re-saved by cascade" error. This can happen, for example, after deleting an inherited TabAccess or FieldAccess.
        Parameters:
        access - The access to be removed from the parent list
      • clearInheritedFromField

        protected void clearInheritedFromField​(InheritedAccessEnabled access)
        Sets to null the Inherited From field of an inherited access.
        Parameters:
        access - The access with the Inherit From field to be nullified
      • clearInheritedFromField

        protected void clearInheritedFromField​(InheritedAccessEnabled access,
                                               String roleId)
        Sets to null the Inherited From field of an access whenever the value of the field is equal to the entered role id.
        Parameters:
        access - The access with the Inherit From field to be nullified
        roleId - The id of the role used to decide whether the field should be nullified or not