Class RightsModelUtil
java.lang.Object
com._1c.g5.v8.dt.rights.model.util.RightsModelUtil
Rights model util.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass>Supported right all Md objectEClass'esstatic final com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass>Supported right top Md objectEClass'es -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidchangeObjectRight(RightValue newValue, RightValue defaultRightValue, ObjectRights objectRights, Right right) Changes object right.static voidfillObjectsToRightsMap(RoleDescription roleDescription, List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap) Reads rights and itsEObjectand stores it to the list.static Collection<Right>filterCheckDependeces(Right right, Collection<Right> rights) Filters check right dependences.static ObjectRightfilterObjectRightByRight(Right right, List<ObjectRight> objectRights) Filters object right by right.static ObjectRightsfilterObjectRightsByEObject(List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap, org.eclipse.emf.ecore.EObject eObject) Filters object rights by eObject.static ObjectRightsfilterObjectRightsByEObject(org.eclipse.emf.ecore.EObject eObject, List<ObjectRights> objectRights) Filters object rights by theEObject.static ObjectRightsfilterObjectRightsByEObjectFastly(org.eclipse.emf.ecore.EObject eObject, RoleDescription roleDescription) Filters object rights by theEObjectfastly.static Collection<ObjectRights>filterObjectRightsByEObjects(List<org.eclipse.emf.ecore.EObject> eObjects, List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap) Filters object righs by eObjectsstatic Collection<Right>filterUncheckDependeces(Right right, Collection<Right> rights) Filters uncheck right dependences.static booleangetBooleanRightValue(RightValue rightValue) Gets the boolean from the givenRightValue.getCheckDependeces(Right right) Returns all check dependeces right names for the given right.static RightValuegetDefaultRightValue(org.eclipse.emf.ecore.EObject object, Role role) Gets the object default right value.static org.eclipse.emf.ecore.EClassgetEClass(org.eclipse.emf.ecore.EObject eObject) Gets eObject EClass.static List<ObjectRight>getObjectRight(RoleDescription roleDescription, org.eclipse.emf.ecore.EClass eClass, String rightName) static List<Pair<org.eclipse.emf.ecore.EObject,ObjectRights>> getObjectsToRightsMap(RoleDescription roleDescription) Reads rights and its e-object and stores it to the list.static ObjectRightsgetOrCreateObjectRights(org.eclipse.emf.ecore.EObject eObject, RoleDescription roleDescription) Gets or creates object rights by eObject from role description.static RolegetOwner(RoleDescription roleDescription, IBmModel bmModel) Returns the owner of the givenroleDescription.static org.eclipse.emf.ecore.EObjectgetOwnerEObject(org.eclipse.emf.ecore.EObject eObject) Gets the owner of the givenEObject;static RightValuegetRightValue(boolean rightValue) GetsRightValuefrom the boolean value.static Set<org.eclipse.emf.ecore.EClass>getSubobjectEClasses(org.eclipse.emf.ecore.EObject eObject) Gets eObject subobject eClases.static intCounts template parameters.static Map<org.eclipse.emf.ecore.EObject,Pair<ObjectRights, Boolean>> getTopObjectsToRightsMap(RoleDescription roleDescription, org.eclipse.emf.ecore.EObject objectContext) Reads rights and its e-object and stores top objects to the map.static Map<org.eclipse.emf.ecore.EObject,Pair<ObjectRights, Boolean>> getTopObjectsToRightsMap(RoleDescription roleDescription, org.eclipse.emf.ecore.EObject objectContext, String topObjectFqn) Reads rights and its e-object and stores top objects to the map.getUncheckDependeces(Right right) Returns all uncheck dependeces right names for the given right.static booleanisAdoptedMdObject(org.eclipse.emf.ecore.EObject object) Checks whether the given object or its container is an adopted model object.static booleanisMdObjectHasRights(Object mdObject) Is object has rights.static booleanisRightContains(Right right, Collection<Right> rights) Checks is right contains in right collection, compares right by name.static booleanisRightsContainsEObjectRls(ObjectRights objectRights) Is role description contains RLS on selected e-object.static booleanisSameObject(org.eclipse.emf.ecore.EObject object1, org.eclipse.emf.ecore.EObject object2) Determines whether two possibly-null objects are same.static booleanisSameRights(Right right1, Right right2) Compares two rights by name.static booleanisSubobject(org.eclipse.emf.ecore.EObject eObject) Is subobject.static booleanisSubobjectEClassHasRights(org.eclipse.emf.ecore.EObject eParent, org.eclipse.emf.ecore.EClass eSubobjectEClass) Is subobject e-class has rights.static voidremoveEmptyObjectRights(RoleDescription roleDescription, ObjectRights objectRights) Removes empty object rights from model.static booleanuseSetRightsForAttributesAndTabularSectionsByDefault(org.eclipse.emf.ecore.EClass eClass) Tells whether to use "Set rights for attributes and tabular sections by default" flag to define right values by default for the specifiedEClassstatic booleanuseSetRightsForAttributesAndTabularSectionsByDefault(org.eclipse.emf.ecore.EObject eObject) Tells whether to use "Set rights for attributes and tabular sections by default" flag to define right values by default for the specified object.
-
Field Details
-
SUPPORTED_RIGHT_ECLASSES
public static final com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> SUPPORTED_RIGHT_ECLASSESSupported right top Md objectEClass'es -
ALL_SUPPORTED_RIGHT_ECLASSES
public static final com.google.common.collect.ImmutableSet<org.eclipse.emf.ecore.EClass> ALL_SUPPORTED_RIGHT_ECLASSESSupported right all Md objectEClass'es
-
-
Constructor Details
-
RightsModelUtil
public RightsModelUtil()
-
-
Method Details
-
changeObjectRight
public static void changeObjectRight(RightValue newValue, RightValue defaultRightValue, ObjectRights objectRights, Right right) Changes object right.- Parameters:
newValue- the new right valuedefaultRightValue- the default right valueaffectedObjects- the affected objectsobjectRights- the object rights, can not benullright- the right, can not benull
-
filterCheckDependeces
Filters check right dependences.- Parameters:
right- the checked right, can not benullrights- the all rights, can not benull- Returns:
- the depended on check rights, can not be
null
-
filterObjectRightByRight
Filters object right by right.- Parameters:
right- the right, can not benullobjectRights- the object rights, can not benull- Returns:
- the object right or
nullif not found
-
filterObjectRightsByEObjectFastly
public static ObjectRights filterObjectRightsByEObjectFastly(org.eclipse.emf.ecore.EObject eObject, RoleDescription roleDescription) Filters object rights by theEObjectfastly.- Parameters:
eObject- theEObject, can not benullroleDescription- the role description, can not benull- Returns:
- the object rights or
nullif not found
-
filterObjectRightsByEObject
public static ObjectRights filterObjectRightsByEObject(org.eclipse.emf.ecore.EObject eObject, List<ObjectRights> objectRights) Filters object rights by theEObject.- Parameters:
eObject- theEObject, can not benullobjectRights- the object rights, can not benull- Returns:
- the object rights or
nullif not found
-
filterObjectRightsByEObject
public static ObjectRights filterObjectRightsByEObject(List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap, org.eclipse.emf.ecore.EObject eObject) Filters object rights by eObject.- Parameters:
objectsToRightsMap- the mapping from objects to their rights for the specific role description, can not benulleObject- the eObject, can not benull- Returns:
- the object rights or
nullif not found
-
filterObjectRightsByEObjects
public static Collection<ObjectRights> filterObjectRightsByEObjects(List<org.eclipse.emf.ecore.EObject> eObjects, List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap) Filters object righs by eObjects- Parameters:
eObjects- the eObjects, can not benullobjectsToRightsMap- the mapping from objects to their rights for the specific role description, can not benull- Returns:
- the object rights collections, can not be
null
-
filterUncheckDependeces
Filters uncheck right dependences.- Parameters:
right- the unchecked right, can not benullrights- the all rights, can not benull- Returns:
- the depended on uncheck rights, can not be
null
-
getDefaultRightValue
Gets the object default right value.- Parameters:
object- the object to get default right value for, cannot benullrole- the role, cannot benull- Returns:
- the default value, cannot be
null
-
getEClass
public static org.eclipse.emf.ecore.EClass getEClass(org.eclipse.emf.ecore.EObject eObject) Gets eObject EClass. If eObject is proxy EClass detects from proxy URI fragment.- Parameters:
eObject- the eObject, can't benull- Returns:
- the EClass
-
getOrCreateObjectRights
public static ObjectRights getOrCreateObjectRights(org.eclipse.emf.ecore.EObject eObject, RoleDescription roleDescription) Gets or creates object rights by eObject from role description.- Parameters:
eObject- the eObject, can not benullroleDescription- the role description, can not benull- Returns:
- the object rights, can not be
null
-
getSubobjectEClasses
public static Set<org.eclipse.emf.ecore.EClass> getSubobjectEClasses(org.eclipse.emf.ecore.EObject eObject) Gets eObject subobject eClases.- Parameters:
eObject- the eObject, can not benull- Returns:
- the subobject eClases, can not be
null
-
getTemplateParametersCount
Counts template parameters.- Parameters:
template- the template, can not benull- Returns:
- the count parameters
-
isMdObjectHasRights
Is object has rights.- Parameters:
mdObject- the object, can not benull- Returns:
- true if has rights
-
isRightContains
Checks is right contains in right collection, compares right by name.- Parameters:
right- the right, can not benullrights- the right collection, can not benull- Returns:
- true if contains
-
isRightsContainsEObjectRls
Is role description contains RLS on selected e-object.- Parameters:
objectRights- the rights of the e-object, may benull- Returns:
- true is contains
-
isSameObject
public static boolean isSameObject(org.eclipse.emf.ecore.EObject object1, org.eclipse.emf.ecore.EObject object2) Determines whether two possibly-null objects are same.- Returns
falseifobject1orobject2is null. - else if
object1andobject2are both proxy returnstrueif their proxy URI's are identical, returnsfalseotherwise; - else returns
trueifobject1andobject2are both non-null and they are equal according toObject.equals(Object). - Returns
falsein all other situations.
- Parameters:
object1- the first instance, may benullobject2- the second instance, may benull
- Returns
-
isSameRights
Compares two rights by name.- Parameters:
right1- the first rights, may benullright2- the second rights, may benull- Returns:
- true if equals
-
isSubobject
public static boolean isSubobject(org.eclipse.emf.ecore.EObject eObject) Is subobject.- Parameters:
eObject- the eObject, can not benull- Returns:
- is eObject is subobject
-
isSubobjectEClassHasRights
public static boolean isSubobjectEClassHasRights(org.eclipse.emf.ecore.EObject eParent, org.eclipse.emf.ecore.EClass eSubobjectEClass) Is subobject e-class has rights.- Parameters:
eParent- the parent object, can not benulleSubobjectEClass- the subobject e-class, can not benull- Returns:
trueis subobject e-class has rights
-
removeEmptyObjectRights
public static void removeEmptyObjectRights(RoleDescription roleDescription, ObjectRights objectRights) Removes empty object rights from model.- Parameters:
roleDescription- the role description, can not benullobjectRights- the object rights, may benull
-
getObjectsToRightsMap
public static List<Pair<org.eclipse.emf.ecore.EObject,ObjectRights>> getObjectsToRightsMap(RoleDescription roleDescription) Reads rights and its e-object and stores it to the list.- Parameters:
roleDescription- the role description, can not benull- Returns:
- the list of pairs if rights and its e-object, can not be
null
-
fillObjectsToRightsMap
public static void fillObjectsToRightsMap(RoleDescription roleDescription, List<Pair<org.eclipse.emf.ecore.EObject, ObjectRights>> objectsToRightsMap) Reads rights and itsEObjectand stores it to the list.- Parameters:
roleDescription- the role description, can not benullobjectsToRightsMap- the mapping from objects to their rights for the specific role description, can not benull
-
getTopObjectsToRightsMap
public static Map<org.eclipse.emf.ecore.EObject,Pair<ObjectRights, getTopObjectsToRightsMapBoolean>> (RoleDescription roleDescription, org.eclipse.emf.ecore.EObject objectContext) Reads rights and its e-object and stores top objects to the map.- Parameters:
roleDescription- the role description, can not benullobjectContext- the context object whose resource set is used for the resolve, can not benull- Returns:
- the mapping from a top object to its rights, can not be
null
-
getTopObjectsToRightsMap
public static Map<org.eclipse.emf.ecore.EObject,Pair<ObjectRights, getTopObjectsToRightsMapBoolean>> (RoleDescription roleDescription, org.eclipse.emf.ecore.EObject objectContext, String topObjectFqn) Reads rights and its e-object and stores top objects to the map.- Parameters:
roleDescription- the role description, can not benullobjectContext- the context object whose resource set is used for the resolve, can not benulltopObjectFqn- the FQN of the top object that rights will be found for, may benull; if the FQN isnullthen rights will be found for all objects for the given role description- Returns:
- the mapping from a top object to its rights, can not be
null
-
getOwnerEObject
public static org.eclipse.emf.ecore.EObject getOwnerEObject(org.eclipse.emf.ecore.EObject eObject) Gets the owner of the givenEObject;- Parameters:
eObject- the givenEObject, can not benull- Returns:
- the owner of the given
EObject, may benull
-
getRightValue
GetsRightValuefrom the boolean value.- Parameters:
rightValue- the boolean right value- Returns:
RightValue, can not benull
-
getBooleanRightValue
Gets the boolean from the givenRightValue.- Parameters:
rightValue- the givenRightValue, can not benull- Returns:
trueif the givebRightValueisRightValue#SET SETandfalseotherwise
-
isAdoptedMdObject
public static boolean isAdoptedMdObject(org.eclipse.emf.ecore.EObject object) Checks whether the given object or its container is an adopted model object.- Parameters:
object- the object, can not benull- Returns:
trueif the object or its container is an adopted model object,falseotherwise
-
getOwner
Returns the owner of the givenroleDescription.- Parameters:
roleDescription- theRoleDescriptioninstance, cannot benullbmModel- the BM model, can not benull- Returns:
- the owner of the given
roleDescription
-
getCheckDependeces
Returns all check dependeces right names for the given right.- Parameters:
right- the right to get check dependeces for, cannot benull- Returns:
- check dependeces, never
null
-
getUncheckDependeces
Returns all uncheck dependeces right names for the given right.- Parameters:
right- the right to get uncheck dependeces for, cannot benull- Returns:
- uncheck dependeces, never
null
-
getObjectRight
public static List<ObjectRight> getObjectRight(RoleDescription roleDescription, org.eclipse.emf.ecore.EClass eClass, String rightName) - Parameters:
roleDescription-RoleDescriptionfor gettingObjectRight, cannot benulleClass-EClassofObjectRights.getObject()for gettinObjectRight, cannot benullrightName- name of theRightinObjectRight, cannot benull- Returns:
- list of all
ObjectRightfromRoleDescriptionfor concreteEClassobject and concrete name ofRight, nevernull
-
useSetRightsForAttributesAndTabularSectionsByDefault
public static boolean useSetRightsForAttributesAndTabularSectionsByDefault(org.eclipse.emf.ecore.EObject eObject) Tells whether to use "Set rights for attributes and tabular sections by default" flag to define right values by default for the specified object.- Parameters:
eObject- the sepcified object to define right values by default, cannot benull- Returns:
trueif need to use "Set rights for attributes and tabular sections by default" flag to define right values by default,falseif need to use "Set rights for new objects" flag to define right values by default
-
useSetRightsForAttributesAndTabularSectionsByDefault
public static boolean useSetRightsForAttributesAndTabularSectionsByDefault(org.eclipse.emf.ecore.EClass eClass) Tells whether to use "Set rights for attributes and tabular sections by default" flag to define right values by default for the specifiedEClass- Parameters:
eClass- the sepcifiedEClassto define right values by default, cannot benull- Returns:
trueif need to use "Set rights for attributes and tabular sections by default" flag to define right values by default,falseif need to use "Set rights for new objects" flag to define right values by default
-