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:

  1. 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.

  2. Initialize SetAccessScope to FALSE.

  3. 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.

  4. Initialize a Collection<Tuple<long ObjectId,IpamObjectType ObjectType>> impactedChildObjects.

  5. Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:

    1. Param_objectId set to Param_objectId.

    2. Param_objectType set to Param_objectType.

  6. After the return from the procedure, do the following steps:

    1. Assign Param_inheritanceId to oldInheritanceId.

    2. Assign Param_accessScopeId to oldAccessScopeId.

  7. If SetAccessScope is TRUE, then perform following actions:

    1. Call UpdateAssociationEntry procedure with following parameter assignments:

      1. Param_objectId set to Param_objectId.

      2. Param_objectType set to Param_objectType.

      3. Param_inheritanceId set to AssociationId.

      4. Param_accessScopeId set to AccessScopeId.

      5. Set Param_isInheriting to FALSE.

    2. 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.

    3. If impactedChildObjects collection is not empty, then for each of the item impactedChildObject in the collection impactedChildObjects, do the following steps:

      1. Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:

        1. Param_objectId set to impactedChildObject.Object.RecordId.

        2. Param_objectType set to impactedChildObject.ObjectType.

      2. After the return from the procedure, validate the following:

        1. Param_inheritanceId is equal to oldInheritanceId.

        2. Param_accessScopeId is equal to oldAccessScopeId.

    4. If both the previous conditions are TRUE, then call the UpdateAssociationEntry procedure with the following parameter assignments:

      1. Param_objectId set to impactedChildObject.object.RecordId.

      2. Param_objectType set to impactedChildObject.ObjectType.

      3. Param_inheritanceId set to AssociationId.

      4. Param_accessScopeId set to AccessScopeId.

      5. Set Param_isInheriting set to TRUE.

  8. If SetAccessScope is FALSE, perform following actions:

    1. Compute the ParentObjectId and ParentObjectType for the specified object by calling procedure GetParentForObject of ADM_AccessScopeAssociationTable by passing the following parameters:

      1. Param_objectId is set to Param_objectId.

      2. Param_objectType is set to Param_objectType.

      3. Param_ParentObjectId.

      4. Param_ParentObjectType.

    2. Process the output of the procedure and assign Param_ParentObjectId to ParentObjectId, assign Param_ParentObjectType to ParentObjectType.

    3. If ParentObjectId and ParentObjectType are not NULL, do the following:

      1. Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:

        1. Param_objectId set to ParentObjectId.

        2. Param_objectType set to ParentObjectType.

      2. After the return from the procedure, assign the following:

        1. Param_inheritanceId to InheritanceId.

        2. Param_accessScopeId to AccessScopeId.

    4. If ParentObjectId is NULL, then do the following:

      1. InheritanceId is set to AssociationId for this row.

      2. AccessScopeId is set to 1 which maps to default Global access scope.

  9. 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.

  10. Call UpdateAssociationEntry procedure with the following parameter assignments:

    1. Param_objectId set to Param_objectId.

    2. Param_objectType set to Param_objectType.

    3. Param_inheritanceId set to InheritanceId.

    4. Param_accessScopeId set to AccessScopeId.

    5. Set Param_isInheriting to TRUE.

  11. If impactedChildObjects collection is not empty, then for each item impactedChildObject in the collection impactedChildObjects, do the following steps:

    1. Call the procedure GetAccessScopeForObjectIdAndType with the following parameter assignments:

      1. Param_objectId set to impactedChildObject.Object.RecordId.

      2. Param_objectType set to impactedChildObject.ObjectType.

  12. After the return from the procedure, validate the following:

    1. Param_inheritanceId is equal to oldInheritanceId.

    2. Param_accessScopeId is equal to oldAccessScopeId.

  13. If both the previous conditions are TRUE, then call UpdateAssociationEntry procedure with the following parameter assignments:

    1. Param_objectId set to impactedChildObject.object.RecordId.

    2. Param_objectType set to impactedChildObject.ObjectType.

    3. Param_inheritanceId set to AssociationId.

    4. Param_accessScopeId set to AccessScopeId.

    5. Set Param_isInheriting set to TRUE.

  14. Return from the procedure.