Copy Structure Attributes

Copy structure attributes

The basic idea of the Request Handler handling the copying of the structure attributes is to

  • search if the structure attribute already exists in the target structure

  • if not copy the structure attribute

  • return the mapping of structure attribtue proxy in the source structure to the structure attribute proxy in the target structure and the mapping of the source structure attribute identifier to the target structure attribute identifier (to be able to substitute these values in further processes like the copying of structure groups)

images/download/attachments/44040578/CopyStructureAttribute.png

When is the given structure attribute considered to exist in the target structure?

Part of the input is a name and a language (usually the feature key language). It will be searched for an structure attribute with the given name in the given language in the target structure. If found this structure attributes proxy will be returned for the given sourceAttribute.

Note that neither names or other field values of the sourceAttribute are checked against the found target structure attribute nor is checked if the given name really belongs to the given source structure attribute

Creating the copy

For copying the structure attribute createItemDataGraph() and createItem() of the structureAttribtueManager is used together with the StructureEDataObjectCopyService.

This means all field values except id, identifier, structureProxy, deletionDate and logs are copied.

Afterwards the structureValues in the subentity StructureFeaturePresetValueType are substituted according to the given oldToNewValues map.

What happens if a structureAttribute references a structure value as preset value?

When copying a structure attribute (in another structure) the structure value proxies of the preset values need to be substituted. Therefore the given oldToNewStructureValues map will be searched for the source structure value proxy.
If not found, the CopyStructureValueToNewStructure command will be called and a new structure value will be created in the target structure.

The new identifier

Compared to PIM 7 the creation of the identifier for a new structure Attribute changed.

If the identifier of the source structure attribute isn't already taken in the target structure, the copy will get the identifier of the source structure attribute.

Otherwise it will get a new identifier. A new identifier will have the format: <generatedId>_<identifier of the source structure attribute>. This identifier will be cut on the right hand side to fit the max length of the identifier field.