Hello all!
I try to consolidate the equal (copies) objects by script, and I use method "ObjDefObjectMaster.Consolidate (ObjDef[] SlaveObjcts, true)".
After that, the objects consolidated, their copies vanished from group, but did not vanished from model.
Tell me please, how can I consolidate the objects to vanished their copies from group and model.
May I ask why you would want to remove occurrences from models?
Don't the occurrences belong into those models?
The entire point of consolidation, is to allow your ObjDefMaster to take over any occurrences of your slave objects.
It's meant to be used in cases like the following:
You have a widely used IT system, which is used in many models. Then you get a new modeler, who doesn't know this IT system exists, so he/she creates a new IT system and uses this IT system in their models.
Now, to consolidate the data basis (aka the object definition) you can use the ARIS "consolidate" functionality, which allows your widely used IT system to take over all of the occurrences of the falsely created new IT system. The new modeler wanted to see that IT system in their models after all. All you want however is that changes to this IT system are reflected database wide (e. g. to pass around the information that the system will be down for maintenance, or that it will be deprecated soon).
It doesn't make any sense to use consolidate in combination with deletion, because consolidation already removes the falsely created object definition and there shouldn't be anything else to delete. Occurrences of the falsely created object definition rightfully become occurrences of the master definition, therefore you shouldn't delete them.
Maybe your use-case is not actually consolidation? Could you describe your initial situation and what you're trying to achieve? Maybe there is another way to realize what you want to achieve.
There is a group "Directories", in the subfolders of which there are environment objects of functions (registry of environment objects).
When a model variant is created, these objects in it are created as copy-instances (links).
All other objects (functions, events, rules) are created in the version as copy-definitions.
In the process of creating variants and completing models, users sometimes do not follow the rules.
They create environment objects in folders with models, instead of using these objects from the Catalogs group.
When adjusting the model, these objects are transferred from folders with models in subfolders of the "Directories" folder.
Because of this, we get the same objects, to eliminate which the "Consolidation" method is used. There weren’t many such objects before, the consolidation process was performed manually. Now there are much more objects a software solution to this problem was required.
Ok, but which step of this process requires you to delete occurrences/why do you want to remove occurrences anywhere?
Users clearly want to use the environment(s) in question in their models. That's why they created occurrences of environment(s) (all be it maybe ones with the wrong object definition) in their model.
If you were to perform consolidation the right way, the following would happen:
- The report takes the occurrences of the wrong object definition and performs the ".ReplaceObjDef(...)" method on them to re-map the occurrence to the correct object definition found in "Directories"
(it's worth looking that method up in the ARIS Script help, it can be found in the ObjOcc Report class).
After this the models should be fine - the used environments are associated with the object definition found within "Directories". - The report deletes the leftover wrong object definition, which can't possibly have any more occurrences, because all the occurrences of the wrong object definition were taken over by the "Directories" object definition.
Those two steps are the essential steps that were compressed into a single "Consolidate(...)" method. There is a bit more to it (e. g. the report will also try to merge the attribute values of the object definitions in question), but the two steps above are the essential things "Consolidate(...)" performs.
Edit: Maybe one more thing to look out for: by default "Consolidate(slaveObjDefs, true)" will try to merge attribute values, which may lead to undesirable results in case you are ordered to maintain the status-quo of the "Directories" objects at all costs. If you want to disable attribute merging, "Consolidate(slaveObjDefs, true, false)" is the thing to use.