Copy Structures and/or StructureGroups
/*<![CDATA[*/ div.rbtoc1659621429330 {padding: 0px;} div.rbtoc1659621429330 ul {list-style: disc;margin-left: 0px;} div.rbtoc1659621429330 li {margin-left: 0px;padding-left: 0px;} /*]]>*/
PIM 8
This page and its subpages explain the copy process of structures and structure groups. There are three usecases to distinguish:
copy a complete structure with all its structure groups, structure attributes and structure values
copy a structure group with all its subgroups into another structure
(All structure attributes and structure values referenced from the copied structure groups and children need to be copied into the other structure if not already present.)copy a structure group with all its subgroups within the same structure
There used to be different implementations for these cases before. We refactored the code to always use the same basic workflow to copy structure groups, attributes and values.
Copy Structures
Copy structures is a bit of a special case because not everything is handled by the unified workflow. Additionally we have the structure object itself which need to be copied. As you can see in the picture below this step is handled by the StructureCopyModel.
Workflow
Structures of which structure types can be copied?
StructureType of Source |
Can be copied |
StructurType of Copy |
Primary Maintenance |
|
Secondary Maintenance |
Secondary Maintenance |
|
Secondary Maintenance |
Output |
|
Output |
Material group system |
|
Material group system |
classification system |
|
classification system |
Structure Object Rights/ACLs
Acls are copied. This means the values of the fields StructureType.AclFlag and StructureType.AclProxy are copied from the sourceStructure.
What else is copied, what is not?
Copied:
StructureType.Type (Except for primary maintenance structures which are copied. The copy will become a secondary maintenance structure.)
StructureType.MappingType
StructureType.MappingLevel
StructureType.GroupIdentifierPattern
StructureType.Levels
StructureType.UnitSystem
StructureDetail.DisplayOrder
StructureType.Revision
language specific data (for all languages)
StructureLangType.FullName
StructureLangType.Description
Not copied:
subentity StructureLogType
StructureType.IsIdentifierHierarchical (probably not used anymore) - Will have database default value: true
StructureType.IsBalanced (probably not used anymore) - Will have database default value: false
StructureType.LastModified
StructureType.UserId
StructureType.DeletionDate
StructureType.Status
Adjusted:
StructureType.Type (Except for primary maintenance structures which are copied. The copy will become a secondary maintenance structure.)
StructureType.Identifier - copyOf_<30 chars of the identifier of the sourceStructure>_<currentTimeMillis> shortened to 75 chars
StructureLangType.Name - <"Copy of" in the according language of the EDataObject> <name of the source structure in the according language>
Copy StructureGroups - General Workflow
The general workflow in all three use cases is the same:
find the things which need to be copied (e.g. structure attributes, structure values, structure groups)
copy the things which need to be copied
maybe handle assigned items/variants/products and their attributes
What varies is only the way the things which need to be copied are found. And this variing behaviour was therefore encapsulated in a special implementation of the interface CopyStructureGroupStrategy. There are static methods in the StructureGroupCopyProcessor to obtain the strategy object for your copy process. Note that this might change in the future!
To copy structure attributes, structure values, ASMs and AASGAMs requestHandler on the server side are used. There is no RequestHandler to copy a structureGroup at the moment. Note that this might change in the future. At the moment the structureGroups are copied in the StructureGroupCopyProcessor.
If the target structure is a maintenance structure no item/variant/product assigments and attribute assignments will be copied, no matter what the preferences say.
Workflow
Visit subpages to learn more about how a specific object is copied.
Strategies
CopyAllStructureGroupsOfStructure
findStructureValues returns all structure values of the source structure (in the given revision)
findStructureAttributes returns all structure values of the source structure (in the given revision)
findStructureGroups returns all top level structure groups of the source structure (in the given revision). Child groups will be copied automatically by the copyStructureGroups method.
returned value is the EntityProxy of the copied structure
CopyStructureGroup (within one structure)
findStructureValues returns nothing. We copy a structure group within one structure so all values and attributes which are referenced by the structure group (and its children) are already present in the structure. the copied structuregroups reference the same objects.
findStructureAttributes returns nothing. We copy a structure group within one structure so all values and attributes which are referenced by the structure group (and its children) are already present in the structure. the copied structuregroups reference the same objects.
findStructureGroups returns the top level structure group the user selected to be copied. Child groups will be copied automatically by the copyStructureGroups method.
the returned value is the EntityProxy of the copied structure group
CopyStructureGroupInOtherStructure
findStructureValues traverses the preset values of all structure group attributes of the given structure group and recursively all its child groups and collects their referenced structureValues.
findStructureAttributes traverses all structure group attributes of the given structure group and recursively all its child groups and collects their referenced structureAttributes.
findStructureGroups returns the top level structureGroup the user selected to be copied. Child groups will be copied automatically by the copyStructureGroups method.
the returned value is the EntityProxy of the copied structure group