]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/scl/Simantics/Entity.scl
Fixed Simantics/Diagram/setElements to resolve attachment relations
[simantics/platform.git] / bundles / org.simantics.modeling / scl / Simantics / Entity.scl
1 include "Simantics/DB"
2 import "http://www.simantics.org/Layer0-1.1" as L0
3
4 @deprecated
5 toResource :: Resource -> Resource
6 toResource = id
7
8 @deprecated
9 fromResource :: Resource -> Resource
10 fromResource = id
11
12 labelOf :: Resource -> <ReadGraph> String
13 labelOf entity = relatedValue2 entity L0.HasLabel
14
15 """Renames an entity."""
16 rename :: Resource -> String -> <ReadGraph,WriteGraph> ()
17 rename entity newName = do
18     oldName = (nameOf entity)
19     claimRelatedValue entity L0.HasName newName
20     addCommentMetadata ("Renamed " + oldName + " to " + newName)
21
22 importJava "org.simantics.db.layer0.util.RemoverUtil" where
23     """Removes a given entity."""
24     @JavaName remove
25     remove :: Resource -> <WriteGraph> ()
26
27 @deprecated
28 remove_ :: Resource -> <WriteGraph> ()
29 remove_ = remove