Skip to content

Powerfactory: object link references#3875

Open
marqueslanauja wants to merge 3 commits intomainfrom
powerfactory_object_link_references
Open

Powerfactory: object link references#3875
marqueslanauja wants to merge 3 commits intomainfrom
powerfactory_object_link_references

Conversation

@marqueslanauja
Copy link
Copy Markdown
Contributor

@marqueslanauja marqueslanauja commented Apr 15, 2026

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • A PR or issue has been opened in all impacted repositories (if any)

Does this PR already have an issue describing the problem?

Fixes #3867

What kind of change does this PR introduce?

What is the current behavior?

Object link references are not supported

What is the new behavior (if this is a feature change)?

Object link references are now supported.
They can be specified in two ways:
By providing the Id of the referenced object in the pointer object.
By providing ##foreignKey, where foreignKey corresponds to the for_name of the referenced object.

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

The DgsHandler void onObjectValue(String attributeName, long id) method has been deprecated and is no longer used.
void onObjectValue(String attributeName, String objectReference) must be used now by passing the id argument as a string onObjectValue(attributeName, String.valueOf(id))

The DGsHandler void onObjectVectorValue(String attributeName, List<Long> ids) method has been deprecated and is no longer used. void onObjectVectorValue(String attributeName, List<String> objectReferences) must be used now by passing ids as a List of String.

Other information:

The following methods in the DataObject class have been preserved:
setObjectAttributeValue(String name, Long id)
setObjectVectorAttributeValue(String name, List<Long> ids)

as they are used when the model is directly imported from the PowerFactory database. No changes have been made in this case, assuming that the id can always be used as a reference.

Additionally, I’ve added the following methods:

setObjectAttributeValue(String name, String foreignKey)
setObjectVectorAttributeValueByForeignKey(String name, List<String> foreignKeys)

to be used when a dgs file is imported and foreign keys are used as object link referencess

Signed-off-by: marquesja1 <marquesja@aia.es>
Signed-off-by: marquesja1 <marquesja@aia.es>
Signed-off-by: marquesja1 <marquesja@aia.es>
@sonarqubecloud
Copy link
Copy Markdown

@marqueslanauja marqueslanauja added Deprecated Methods have been deprecated PowerFactory labels Apr 15, 2026
@marqueslanauja marqueslanauja marked this pull request as ready for review April 15, 2026 11:03
@marqueslanauja
Copy link
Copy Markdown
Contributor Author

marqueslanauja commented Apr 15, 2026

It is also possible to deprecate and remove the Long methods

setObjectAttributeValue(String name, Long id)
setObjectVectorAttributeValue(String name, List<Long> ids)

and instead use only the String ones

setObjectAttributeValue(String name, String foreignKey)
setObjectVectorAttributeValue(String name, List<String> foreignKeys)

by converting the Long values to Strings when the case is directly imported from the PowerFactory database.

The method setObjectVectorAttributeValue(String name, List<Long> ids) cannot be overloaded with a String version, so the method name must be changed. Do you want to keep or remove the Long methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deprecated Methods have been deprecated PowerFactory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerFactory ## object link references

1 participant