3.1.1.1.43.2.3 CreateAssociationEntry

The CreateAssociationEntry procedure creates an appropriate association entry for the objects on which access scope associations can be done.

The procedure uses the following input parameters:

Param_objectId: Of type signed 64-bit integer that specifies the RecordId of the corresponding object for which the association entry needs to be done.

Param_objectType: This is of type IpamObjectType and identifies the object type of the entity for which the association entry needs to be done.

The following is the output parameter from this procedure.

Result_recordId: Of type signed 64-bit integer that specifies the AssociationId of the row that has been added to the table for this entry.

The following processing steps are performed:

  1. Look up all the rows in the ADM_AccessScopeAssociationTable that have ObjectId as Param_objectId and ObjectType as Param_objectType. If there is such a row, take no action and return NULL.

  2. Initialize a Collection<Tuple<long ObjectId,IpamObjectType ObjectType>> impactedChildObjects. The collection SHOULD be empty.

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

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

  5. If ParentObjectId and ParentObjectType are not NULL, do 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.

  6. If ParentObjectId is NULL, 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.

    3. Compute all the Child Object Id and Object types that map to the current object under processing. Initialize an instance of Collection<Tuple<long ObjectId,IpamObjectType ObjectType>> impactedChildObjects. Call procedure GetChildrensForObject by passing Param_objectId and Param_objectType as parameters. 

    4. Process the result from the procedure Result_childObjects. Assign Result_childObjects to impactedChildObjects.

  7. Set IsInheriting to TRUE.

  8. Add the corresponding row in the table and assign the AssociationId to Result_recordId.

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

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

    1. Param_objectId set to impactedChildObject.ObjectId.

    2. Param_objectType set to impactedChildObject.ObjectType.

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

    1. Param_inheritanceId is equal to InheritanceId.

    2. Param_accessScopeId is equal to AccessScopeId.

  12. If both the previous conditions are TRUE, 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. Param_isInheriting set to TRUE.

  13. Return the Result_recordId from the procedure.