addAssociation

suspend fun addAssociation(association: UtilityAssociation): Result<Unit>

Adds an association between two utility elements in this utility network. Adding an association may also update the features that participate in the association.

Use UtilityNetwork.canAddAssociation to determine if you can successfully add this association.

This method requires that:

  • The association type is supported by the utility network schema. Note that UtilityNetworkDefinition.schemaVersion less than 4 does not support the following association types: * UtilityAssociationType.JunctionEdgeObjectConnectivityFromSide * UtilityAssociationType.JunctionEdgeObjectConnectivityMidspan * UtilityAssociationType.JunctionEdgeObjectConnectivityToSide

  • The association elements are accessible. Use UtilityElement.isValid to check feature accessibility to ensure it has not been filtered out.

  • The UtilityAssociation.fromElement has the necessary role for the association type. An UtilityAssociationRole.Container can participate in a containment association or an UtilityAssociationRole.Structure can participate in a structural attachment association.

  • If the association's type is UtilityAssociationType.Connectivity, the UtilityElement.terminal must be set for elements with more than one terminal available in the UtilityTerminalConfiguration.terminals

  • The association is supported by a utility rule. Use UtilityNetworkDefinition.getRules to determine if the UtilityAssociation.associationType can be made between the UtilityAssociation.fromElement and UtilityAssociation.toElement using their corresponding UtilityElement.assetType.

Return

A Result containing no value. One of the following error codes may be set: * ErrorType.CommonInvalidCall, if this method is called on a utility network schema version that does not support the association type. * ErrorType.GeodatabaseDatabaseClosed, if this method is called after the geodatabase is closed. * ErrorType.CommonInvalidArgument, when the specified association: * includes an element that is not accessible or does not belong in this utility network. * has an UtilityAssociation.fromElement that lacks the necessary role for the association type. * type is connectivity and includes an element without a terminal or its default terminal could not be determined. * is not supported by any utility rule.

Since

200.5.0

Parameters

association

The association to add.

See also