import org.simantics.objmap.graph.annotations.CompoundRelatedGetValue;\r
import org.simantics.objmap.graph.annotations.CompoundRelatedSetValue;\r
import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
import org.simantics.objmap.graph.rules.domain.CompoundValueAccessor;\r
import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
import org.simantics.objmap.graph.rules.range.CompoundGetSetValueAccessor;\r
import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
\r
return new MappedElementsRule<Resource, Range>(\r
new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
annotation.composition()),\r
- new FieldAccessorWithDefault<Range,Collection<Range>>(field, (Collection<Range>)Collections.emptyList())\r
+ new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
);\r
}\r
\r
try {\r
Layer0 l0 = Layer0.getInstance(g);\r
LOGGER.info(" CompoundValueAccessor.set");\r
+ @SuppressWarnings("unchecked")\r
Map<String,Object> values = (Map<String, Object>)v;\r
\r
Collection<Statement> coll = g.getStatements(element, objRelation);\r
@Override\r
public T get(Range element) throws MappingException {\r
try {\r
- T result = (T)field.get(element);\r
+ @SuppressWarnings("unchecked")\r
+ T result = (T)field.get(element);\r
\r
if(LOGGER.isInfoEnabled())\r
LOGGER.info(" FieldAccessor.get " +\r
public ILinkType<Resource,Object> linkTypeOfRangeType(Class<?> clazz) {\r
ILinkType<Resource,Object> type = rangeLinkTypes.get(clazz);\r
if(type == null) {\r
+ // FIXME: c is not referenced at all, should it be?\r
+ // TODO: should this method take inheritance into account ?\r
for (Class<?> c : clazz.getInterfaces()) {\r
type = rangeLinkTypes.get(clazz);\r
if (type != null)\r
public Resource createDomainElement(WriteGraph g, Range rangeElement)\r
throws MappingException {\r
try {\r
- String typeUri = (String)typeGetter.invoke(rangeElement, null);\r
+ String typeUri = (String)typeGetter.invoke(rangeElement, (Object[]) null);\r
if(LOGGER.isInfoEnabled())\r
LOGGER.info("SimpleLinkType.createDomainElement " +\r
rangeElement.toString()\r
return new MappedElementsRule<StructuralResource, Range>(\r
new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
annotation.composition(),false),\r
- new FieldAccessorWithDefault<Range,Collection<Range>>(field, (Collection<Range>)Collections.emptyList())\r
+ new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
);\r
}\r
\r
\r
Resource res = getServiceResource(g, element);\r
if (res == null)\r
- return Collections.EMPTY_LIST;\r
+ return Collections.emptyList();\r
Collection<Resource> coll = g.getObjects(res, relation);\r
List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r
for (Resource r : coll) {\r
LOGGER.info(" RelatedOrderedSetElementsAccessor.get");\r
Resource res = getServiceResource(g, element);\r
if (res == null)\r
- return Collections.EMPTY_LIST;\r
+ return Collections.emptyList();\r
List<Resource> list = OrderedSetUtils.toList(g, res);\r
List<StructuralResource> result = new ArrayList<StructuralResource>(list.size());\r
for (Resource r : list) {\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
import org.simantics.objmap.exceptions.MappingException;\r
import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
import org.simantics.objmap.graph.rules.domain.MappingUtils;\r
import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
\r
\r
public class StructuralRelatedObjectsAccessor implements IDomainAccessor<StructuralResource,Collection<StructuralResource>> {\r
LOGGER.info(" RelatedObjectsAccessor.get");\r
\r
if (!element.isStructural())\r
- return Collections.EMPTY_LIST;\r
+ return Collections.emptyList();\r
\r
// Structural instance\r
Resource instance = StructuralUtils.getContainingInstance(element);\r
Resource publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
\r
if (publicRelation == null)\r
- return Collections.EMPTY_LIST;\r
+ return Collections.emptyList();\r
\r
Collection<Resource> coll = g.getObjects(instance, publicRelation);\r
List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r