-
- public static P3DScriptNodeMap load(final Resource root) throws DatabaseException {
- try {
- ControlPointFactory.preloadCache();
- ComponentUtils.preloadCache();
- } catch (Exception e) {
- throw new DatabaseException(e);
- }
- return Simantics.getSession().syncRequest(new Read<P3DScriptNodeMap>() {
- @Override
- public P3DScriptNodeMap perform(ReadGraph graph) throws DatabaseException {
- PipingRules.setEnabled(false);
- IMappingSchema<Resource, Object> schema = SchemaBuilder.getSchema(graph);
- IMapping mapping = Mappings.createWithListening(schema);
- P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root);
- try {
- P3DUtil.finalizeDBLoad(rootNode);
- } catch (Exception e) {
- throw new DatabaseException(e);
- }
- P3DScriptNodeMap nodeMap = new P3DScriptNodeMap(Simantics.getSession(), mapping, rootNode);
- return nodeMap;
-
- }
- });
-
- }
-
- public static P3DRootNode loadReadOnly(final Resource root) throws DatabaseException {
- try {
- ControlPointFactory.preloadCache();
- ComponentUtils.preloadCache();
- } catch (Exception e) {
- throw new DatabaseException(e);
- }
- return Simantics.getSession().syncRequest(new Read<P3DRootNode>() {
- @Override
- public P3DRootNode perform(ReadGraph graph) throws DatabaseException {
- PipingRules.setEnabled(false);
- IMappingSchema<Resource, Object> schema = SchemaBuilder.getSchema(graph);
- IMapping mapping = Mappings.createWithoutListening(schema);
- P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root);
- try {
- P3DUtil.finalizeDBLoad(rootNode);
- } catch (Exception e) {
- throw new DatabaseException(e);
- }
- return rootNode;
-
- }
- });
- }
+
+ public static P3DScriptNodeMap load(final Resource root) throws DatabaseException {
+ try {
+ ControlPointFactory.preloadCache();
+ ComponentUtils.preloadCache();
+ } catch (Exception e) {
+ throw new DatabaseException(e);
+ }
+ return Simantics.getSession().syncRequest(new Read<P3DScriptNodeMap>() {
+ @Override
+ public P3DScriptNodeMap perform(ReadGraph graph) throws DatabaseException {
+ PipingRules.setEnabled(false);
+ IMappingSchema<Resource, Object> schema = SchemaBuilder.getSchema(graph);
+ IMapping mapping = Mappings.createWithListening(schema);
+ P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root);
+ try {
+ P3DUtil.finalizeDBLoad(rootNode);
+ } catch (Exception e) {
+ throw new DatabaseException(e);
+ }
+ P3DScriptNodeMap nodeMap = new P3DScriptNodeMap(Simantics.getSession(), mapping, rootNode);
+ return nodeMap;
+
+ }
+ });
+
+ }
+
+ public static P3DRootNode loadReadOnly(final Resource root) throws DatabaseException {
+ try {
+ ControlPointFactory.preloadCache();
+ ComponentUtils.preloadCache();
+ } catch (Exception e) {
+ throw new DatabaseException(e);
+ }
+ return Simantics.getSession().syncRequest(new Read<P3DRootNode>() {
+ @Override
+ public P3DRootNode perform(ReadGraph graph) throws DatabaseException {
+ PipingRules.setEnabled(false);
+ IMappingSchema<Resource, Object> schema = SchemaBuilder.getSchema(graph);
+ IMapping mapping = Mappings.createWithoutListening(schema);
+ P3DRootNode rootNode = (P3DRootNode)mapping.map(graph, root);
+ try {
+ P3DUtil.finalizeDBLoad(rootNode);
+ } catch (Exception e) {
+ throw new DatabaseException(e);
+ }
+ return rootNode;
+
+ }
+ });
+ }