Class PreferenceAccessInjector
- java.lang.Object
-
- org.openbravo.role.inheritance.access.AccessTypeInjector
-
- org.openbravo.role.inheritance.access.PreferenceAccessInjector
-
- All Implemented Interfaces:
Comparable<AccessTypeInjector>
public class PreferenceAccessInjector extends AccessTypeInjector
AccessTypeInjector for the Preference class
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openbravo.role.inheritance.access.AccessTypeInjector
AccessTypeInjector.Qualifier, AccessTypeInjector.Selector
-
-
Constructor Summary
Constructors Constructor Description PreferenceAccessInjector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addEntityWhereClause(String whereClause)
Includes in the where clause some filtering needed for same cases.void
checkAccessExistence(InheritedAccessEnabled access)
Checks if a particular access already exists<T extends BaseOBObject>
voiddoEntityParameterReplacement(OBQuery<T> query)
Performs the needed parameter substitution according to the entity represented by the injector.InheritedAccessEnabled
findAccess(InheritedAccessEnabled access, String roleId)
Role
getRole(InheritedAccessEnabled access)
Returns the role which the access given as parameter is assigned to.String
getRoleProperty()
Returns the role property related to the entity represented by the injector.String
getSecuredElementGetter()
Returns the secured object.String
getSecuredElementIdentifier(InheritedAccessEnabled access)
Returns the id of the secured object for the given inheritable access.String
getSecuredElementName()
Returns the secured element name.List<String>
getSkippedProperties()
Retrieves the properties of the entity related to the injector that will not be copied when updating an access by propagation.boolean
isInheritable(InheritedAccessEnabled access)
Determines if a particular access can be inherited according to this injectorvoid
setParent(InheritedAccessEnabled newAccess, InheritedAccessEnabled parentAccess, Role role)
Sets the parent for an inheritable access object.-
Methods inherited from class org.openbravo.role.inheritance.access.AccessTypeInjector
clearInheritedFromField, clearInheritedFromField, clearInheritFromFieldInChilds, compareTo, getAccessList, getClassName, getPriority, removeReferenceInParentList
-
-
-
-
Method Detail
-
getSecuredElementGetter
public String getSecuredElementGetter()
Description copied from class:AccessTypeInjector
Returns the secured object.- Specified by:
getSecuredElementGetter
in classAccessTypeInjector
- Returns:
- a String with the name of the method to retrieve the secured element
-
getSecuredElementName
public String getSecuredElementName()
Description copied from class:AccessTypeInjector
Returns the secured element name.- Specified by:
getSecuredElementName
in classAccessTypeInjector
- Returns:
- a String with the name of the secured element
-
isInheritable
public boolean isInheritable(InheritedAccessEnabled access)
Description copied from class:AccessTypeInjector
Determines if a particular access can be inherited according to this injector- Overrides:
isInheritable
in classAccessTypeInjector
- Parameters:
access
- the permission to decide whether is inheritable or not- Returns:
- true if the access is inheritable, false otherwise
-
getRole
public Role getRole(InheritedAccessEnabled access)
Description copied from class:AccessTypeInjector
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.- Overrides:
getRole
in classAccessTypeInjector
- Parameters:
access
- An inheritable access- Returns:
- the Role owner of the access
-
getRoleProperty
public String getRoleProperty()
Description copied from class:AccessTypeInjector
Returns the role property related to the entity represented by the injector.- Overrides:
getRoleProperty
in classAccessTypeInjector
- Returns:
- the role property that can be retrieved according to the entity of the injector.
-
setParent
public void setParent(InheritedAccessEnabled newAccess, InheritedAccessEnabled parentAccess, Role role)
Description copied from class:AccessTypeInjector
Sets the parent for an inheritable access object.- Overrides:
setParent
in classAccessTypeInjector
- Parameters:
newAccess
- Access whose parent object will be setparentAccess
- Access that is used in some cases to find the correct parentrole
- Parent role to set directly when applies
-
addEntityWhereClause
public String addEntityWhereClause(String whereClause)
Description copied from class:AccessTypeInjector
Includes in the where clause some filtering needed for same cases.- Overrides:
addEntityWhereClause
in classAccessTypeInjector
- Parameters:
whereClause
- The initial where clause- Returns:
- Entity where clause with the filtering included
-
doEntityParameterReplacement
public <T extends BaseOBObject> void doEntityParameterReplacement(OBQuery<T> query)
Description copied from class:AccessTypeInjector
Performs the needed parameter substitution according to the entity represented by the injector.- Overrides:
doEntityParameterReplacement
in classAccessTypeInjector
- Parameters:
query
- The query where to perform the parameter substitution
-
getSecuredElementIdentifier
public String getSecuredElementIdentifier(InheritedAccessEnabled access)
Description copied from class:AccessTypeInjector
Returns the id of the secured object for the given inheritable access.- Overrides:
getSecuredElementIdentifier
in classAccessTypeInjector
- 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
-
findAccess
public InheritedAccessEnabled findAccess(InheritedAccessEnabled access, String roleId)
- Overrides:
findAccess
in classAccessTypeInjector
- Parameters:
access
- The access with the secured element to be foundroleId
- Id of the role owner of the access to be found- Returns:
- The searched access or null if not found
-
getSkippedProperties
public List<String> getSkippedProperties()
Description copied from class:AccessTypeInjector
Retrieves the properties of the entity related to the injector that will not be copied when updating an access by propagation.- Overrides:
getSkippedProperties
in classAccessTypeInjector
- Returns:
- the list of the properties that will not be copied
-
checkAccessExistence
public void checkAccessExistence(InheritedAccessEnabled access)
Description copied from class:AccessTypeInjector
Checks if a particular access already exists- Overrides:
checkAccessExistence
in classAccessTypeInjector
- Parameters:
access
- the permission to decide whether exists or not
-
-