1 import "Simantics/Ontologies"
2 import "Simantics/Model"
5 toDiagrams composites = map (flip singleObject MOD.CompositeToDiagram) composites
8 importJava "org.simantics.modeling.typicals.SyncTypicalTemplatesToInstances" where
9 syncTypicals :: Boolean -> [Resource] -> [Resource] -> <WriteGraph> ()
12 syncAllTypicals False currentModel
14 Synchronizes all typical master diagrams in the specified model with all
15 instances of the found typical master diagrams.
17 The first argument controls whether a log of the synchronization will be
18 stored in the database, in the model's Documents folder.
20 syncAllTypicals :: Boolean -> Resource -> <Proc> ()
21 syncAllTypicals log model = syncInstancesOfTypicalMasters log masterComposites
23 masterComposites = lift2Read searchByTypeShallow model MOD.MasterTypicalCompositeType
26 syncInstancesOfTypicalMasters False [aMasterTypicalComposite]
28 Synchronizes all instances of the specified typical master diagram(s).
30 The first argument controls whether a log of the synchronization will be
31 stored in the database, in the model's Documents folder.
33 The second argument expects diagram configuration composite resources.
35 syncInstancesOfTypicalMasters :: Boolean -> [Resource] -> <Proc> ()
36 syncInstancesOfTypicalMasters log typicalMasterComposites = syncWrite (\_ -> syncTypicals log masterDiagrams [])
38 masterDiagrams = lift1Read toDiagrams typicalMasterComposites
41 syncTypicalInstances False [aTypicalInstance]
43 Synchronizes the specified typical instance diagram(s) with their master
46 The first argument controls whether a log of the synchronization will be
47 stored in the database, in the model's Documents folder.
49 The second argument expects diagram configuration composite resources.
51 syncTypicalInstances :: Boolean -> [Resource] -> <Proc> ()
52 syncTypicalInstances log typicalInstanceComposites = let
53 instanceDiagrams = lift1Read toDiagrams typicalInstanceComposites
55 syncWrite (\_ -> syncTypicals log [] instanceDiagrams)