3.1.1.1.43.2.5 SetOrResetAssociation
The SetOrResetAssociation procedure sets or resets an access scope association with an IpamObjectType object identified by its object ID.
The following input parameters are used in this procedure:
Param_objectId: A signed 64-bit integer that specifies the RecordId of the corresponding object for which the association entry needs to be updated.
Param_objectType: An IpamObjectType that identifies the object type of the entity for which the association entry needs to be updated.
Param_accessScopeId: A signed 64-bit integer that specifies the AccessScope.AccessScopeId to which the association MUST be done.
There is no output parameter from this procedure.
The following are the processing steps involved:
Look up for the row in the ADM_AccessScopeAssociationTable that have ObjectId as Param_objectId and ObjectType as Param_objectType. If there is no such row, then don’t do any action and return from the procedure.
Initialize SetAccessScope to FALSE.
If Param_accessScopeId is not NULL, then this procedure has been called to override with a new AccessScope on the object. Assign SetAccessScope to TRUE.
Initialize a Collection<Tuple<long ObjectId,IpamObjectType ObjectType>> impactedChildObjects.
Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:
Param_objectId set to Param_objectId.
Param_objectType set to Param_objectType.
After the return from the procedure, do the following steps:
Assign Param_inheritanceId to oldInheritanceId.
Assign Param_accessScopeId to oldAccessScopeId.
If SetAccessScope is TRUE, then perform following actions:
Call UpdateAssociationEntry procedure with following parameter assignments:
Param_objectId set to Param_objectId.
Param_objectType set to Param_objectType.
Param_inheritanceId set to AssociationId.
Param_accessScopeId set to AccessScopeId.
Set Param_isInheriting to FALSE.
Compute all the Child Object Id and Object types that map to the current object under processing. Call procedure GetChildrensForObject by passing Param_objectId and Param_objectType as parameters. Process the result from the procedure Result_childObjects. Assign Result_childObjects to impactedChildObjects.
If impactedChildObjects collection is not empty, then for each of the item impactedChildObject in the collection impactedChildObjects, do the following steps:
Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:
Param_objectId set to impactedChildObject.Object.RecordId.
Param_objectType set to impactedChildObject.ObjectType.
After the return from the procedure, validate the following:
Param_inheritanceId is equal to oldInheritanceId.
Param_accessScopeId is equal to oldAccessScopeId.
If both the previous conditions are TRUE, then call the UpdateAssociationEntry procedure with the following parameter assignments:
Param_objectId set to impactedChildObject.object.RecordId.
Param_objectType set to impactedChildObject.ObjectType.
Param_inheritanceId set to AssociationId.
Param_accessScopeId set to AccessScopeId.
Set Param_isInheriting set to TRUE.
If SetAccessScope is FALSE, perform following actions:
Compute the ParentObjectId and ParentObjectType for the specified object by calling procedure GetParentForObject of ADM_AccessScopeAssociationTable by passing the following parameters:
Param_objectId is set to Param_objectId.
Param_objectType is set to Param_objectType.
Param_ParentObjectId.
Param_ParentObjectType.
Process the output of the procedure and assign Param_ParentObjectId to ParentObjectId, assign Param_ParentObjectType to ParentObjectType.
If ParentObjectId and ParentObjectType are not NULL, do the following:
Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:
Param_objectId set to ParentObjectId.
Param_objectType set to ParentObjectType.
After the return from the procedure, assign the following:
Param_inheritanceId to InheritanceId.
Param_accessScopeId to AccessScopeId.
If ParentObjectId is NULL, then do the following:
InheritanceId is set to AssociationId for this row.
AccessScopeId is set to 1 which maps to default Global access scope.
Compute all the Child Object Id and Object types that map to the current object under processing. Call procedure GetChildrensForObject by passing Param_objectId and Param_objectType as parameters. Process the result from the procedure Result_childObjects. Assign Result_childObjects to impactedChildObjects.
Call UpdateAssociationEntry procedure with the following parameter assignments:
Param_objectId set to Param_objectId.
Param_objectType set to Param_objectType.
Param_inheritanceId set to InheritanceId.
Param_accessScopeId set to AccessScopeId.
Set Param_isInheriting to TRUE.
If impactedChildObjects collection is not empty, then for each item impactedChildObject in the collection impactedChildObjects, do the following steps:
Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:
Param_objectId set to impactedChildObject.Object.RecordId.
Param_objectType set to impactedChildObject.ObjectType.
After the return from the procedure, validate the following:
Param_inheritanceId is equal to oldInheritanceId.
Param_accessScopeId is equal to oldAccessScopeId.
If both the previous conditions are TRUE, then call UpdateAssociationEntry procedure with the following parameter assignments:
Param_objectId set to impactedChildObject.object.RecordId.
Param_objectType set to impactedChildObject.ObjectType.
Param_inheritanceId set to AssociationId.
Param_accessScopeId set to AccessScopeId.
Set Param_isInheriting set to TRUE.
Return from the procedure.