import org.simantics.db.Statement;
import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
+import org.simantics.db.WriteOnlyGraph;
import org.simantics.db.common.Indexing;
import org.simantics.db.common.NamedResource;
import org.simantics.db.common.QueryMemoryWatcher;
import org.simantics.db.common.request.PossibleIndexRoot;
import org.simantics.db.common.request.ReadRequest;
import org.simantics.db.common.request.ResourceRead2;
+import org.simantics.db.common.request.WriteOnlyRequest;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.common.request.WriteResultRequest;
import org.simantics.db.common.utils.ListUtils;
-import org.simantics.db.common.utils.Logger;
import org.simantics.db.common.utils.NameUtils;
import org.simantics.db.common.utils.OrderedSetUtils;
import org.simantics.db.common.utils.VersionInfo;
import org.simantics.db.layer0.util.TransferableGraphConfiguration2;
import org.simantics.db.layer0.variable.Variable;
import org.simantics.db.layer0.variable.Variables;
-import org.simantics.db.request.Read;
import org.simantics.db.service.ClusterControl;
import org.simantics.db.service.CollectionSupport;
import org.simantics.db.service.GraphChangeListenerSupport;
import org.simantics.utils.datastructures.Triple;
import org.simantics.utils.datastructures.hints.HintContext;
import org.simantics.utils.ui.dialogs.ListDialog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Hannu Niemistö
*/
public class ModelingUtils {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModelingUtils.class);
+
private ReadGraph g;
private WriteGraph wg;
public Layer0 b;
} catch (Exception e) {
- Logger.defaultLogError(e);
+ LOGGER.error("Model import failed", e);
}
}
}
public static void untrackDependencies() {
- untrackDependencies(Simantics.getSession());
+ Session s = Simantics.peekSession();
+ if (s != null)
+ untrackDependencies(s);
}
public static void untrackDependencies(RequestProcessor processor) {
});
} catch (DatabaseException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("untrackDependenices failed", e);
}
}
});
} catch (DatabaseException e) {
- Logger.defaultLogError(e);
+ LOGGER.error("trackDependenices failed", e);
}
}
return advisor.getRoot();
} catch (Throwable t) {
- Logger.defaultLogError("Unexpected exception while importing diagram template.", t);
+ LOGGER.error("Unexpected exception while importing diagram template.", t);
} finally {
}
Variant draftStatus = dc.metadata.get(DraftStatusBean.EXTENSION_KEY);
return MigrationUtils.importSharedOntology(Simantics.getSession(), tg, draftStatus == null);
} catch (Exception e) {
- Logger.defaultLogError(e);
+ LOGGER.error("importSharedOntologyWithResult failed", e);
throw e;
}
}
return DiagramGraphUtil.getModelingRules(graph, diagramResource, null);
}
+ //-------------------------------------------------------------------------
+
+ private static final String VG_CHANGE_INFORMATION = "changeInformation"; //$NON-NLS-1$
+
public static void markChanged(WriteGraph graph, Resource r) throws DatabaseException {
- VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
- VirtualGraph vg = support.getWorkspacePersistent("changeInformation");
- graph.syncRequest(new WriteRequest(vg) {
+ VirtualGraph vg = Simantics.getSession().getService(VirtualGraphSupport.class)
+ .getWorkspacePersistent(VG_CHANGE_INFORMATION);
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ graph.syncRequest(new WriteOnlyRequest(vg) {
@Override
- public void perform(WriteGraph graph) throws DatabaseException {
- ModelingResources MOD = ModelingResources.getInstance(graph);
+ public void perform(WriteOnlyGraph graph) throws DatabaseException {
graph.claim(r, MOD.changed, MOD.changed, r);
}
});
}
-
+
+ public static void markChanged(RequestProcessor processor, Iterable<Resource> rs) throws DatabaseException {
+ VirtualGraph vg = Simantics.getSession().getService(VirtualGraphSupport.class)
+ .getWorkspacePersistent(VG_CHANGE_INFORMATION);
+ ModelingResources MOD = ModelingResources.getInstance(processor);
+ processor.syncRequest(new WriteOnlyRequest(vg) {
+ @Override
+ public void perform(WriteOnlyGraph graph) throws DatabaseException {
+ for (Resource r : rs) {
+ graph.claim(r, MOD.changed, MOD.changed, r);
+ }
+ }
+ });
+ }
+
}