import "Simantics/Ontologies" import "Simantics/Model" @private toDiagrams composites = map (flip singleObject MOD.CompositeToDiagram) composites @private importJava "org.simantics.modeling.typicals.SyncTypicalTemplatesToInstances" where syncTypicals :: Boolean -> [Resource] -> [Resource] -> () """ syncAllTypicals False currentModel Synchronizes all typical master diagrams in the specified model with all instances of the found typical master diagrams. The first argument controls whether a log of the synchronization will be stored in the database, in the model's Documents folder. """ syncAllTypicals :: Boolean -> Resource -> () syncAllTypicals log model = syncInstancesOfTypicalMasters log masterComposites where masterComposites = lift2Read searchByTypeShallow model MOD.MasterTypicalCompositeType """ syncInstancesOfTypicalMasters False [aMasterTypicalComposite] Synchronizes all instances of the specified typical master diagram(s). The first argument controls whether a log of the synchronization will be stored in the database, in the model's Documents folder. The second argument expects diagram configuration composite resources. """ syncInstancesOfTypicalMasters :: Boolean -> [Resource] -> () syncInstancesOfTypicalMasters log typicalMasterComposites = syncWrite (\_ -> syncTypicals log masterDiagrams []) where masterDiagrams = lift1Read toDiagrams typicalMasterComposites """ syncTypicalInstances False [aTypicalInstance] Synchronizes the specified typical instance diagram(s) with their master diagrams. The first argument controls whether a log of the synchronization will be stored in the database, in the model's Documents folder. The second argument expects diagram configuration composite resources. """ syncTypicalInstances :: Boolean -> [Resource] -> () syncTypicalInstances log typicalInstanceComposites = let instanceDiagrams = lift1Read toDiagrams typicalInstanceComposites in syncWrite (\_ -> syncTypicals log [] instanceDiagrams)