1 package org.simantics.document.linking.ge;
3 import org.simantics.browsing.ui.model.tests.Test;
4 import org.simantics.db.ReadGraph;
5 import org.simantics.db.Resource;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.db.layer0.variable.Variable;
8 import org.simantics.document.DocumentResource;
9 import org.simantics.document.linking.ontology.DocumentLink;
10 import org.simantics.document.linking.utils.SourceLinkUtil;
12 public class SourceReferenceOldTest implements Test {
14 public SourceReferenceOldTest() {
19 public boolean isCompatible(Class<?> contentType) {
20 return contentType == Variable.class;
24 public boolean test(ReadGraph graph, Object content)
25 throws DatabaseException {
26 Variable variable = (Variable)content;
27 Resource res = variable.getPossibleRepresents(graph);
30 DocumentLink sl = DocumentLink.getInstance(graph);
31 DocumentResource doc = DocumentResource.getInstance(graph);
32 if (graph.isInstanceOf(res, sl.Source)) {
33 Resource ref = SourceLinkUtil.getReferredDocument(graph, res);
35 return graph.hasStatement(ref, doc.HasNewerVersion);