X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.objmap2%2Fsrc%2Forg%2Fsimantics%2Fobjmap%2Fgraph%2Fschema%2FMappingSchemas.java;h=b863fbadca0d1b2924433edef63266abfa632b8c;hb=d08b28566d477295d9f14023f36de9f7406cdb5d;hp=6a7d940f626251e1e0e96b7d4949a632bc9f67dd;hpb=87b3241ec277ba3d8e414b26186a032c9cdcaeed;p=simantics%2F3d.git diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java index 6a7d940f..b863fbad 100644 --- a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java +++ b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2012, 2013 Association for Decentralized Information Management in + * Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ package org.simantics.objmap.graph.schema; import java.lang.annotation.Annotation; @@ -17,6 +28,8 @@ import org.simantics.objmap.graph.annotations.HasCollectionAdder; import org.simantics.objmap.graph.annotations.HasCollectionRemover; import org.simantics.objmap.graph.annotations.HasSetter; import org.simantics.objmap.graph.annotations.OptionalRelatedElements; +import org.simantics.objmap.graph.annotations.OrderedElementsGet; +import org.simantics.objmap.graph.annotations.OrderedSetType; import org.simantics.objmap.graph.annotations.RelatedElements; import org.simantics.objmap.graph.annotations.RelatedElementsGet; import org.simantics.objmap.graph.annotations.RelatedGetObj; @@ -26,6 +39,7 @@ import org.simantics.objmap.graph.annotations.RelatedValue; import org.simantics.objmap.graph.annotations.UpdateMethod; import org.simantics.objmap.graph.annotations.factories.CompoundRelatedGetSetValueRuleFactory; import org.simantics.objmap.graph.annotations.factories.OptionalRelatedElementsRuleFactory; +import org.simantics.objmap.graph.annotations.factories.OrderedElementsRuleFactory; import org.simantics.objmap.graph.annotations.factories.RelatedElementsRuleFactory; import org.simantics.objmap.graph.annotations.factories.RelatedElementsRuleFactory2; import org.simantics.objmap.graph.annotations.factories.RelatedGetSetObjRuleFactory; @@ -69,6 +83,13 @@ public class MappingSchemas { return new DynamicSimpleLinkType(g.getResource(dynamicType.value()), clazz, rules); } + OrderedSetType orderedSetType = clazz.getAnnotation(OrderedSetType.class); + if (orderedSetType != null) { + ArrayList> rules = new ArrayList>(); + collectRulesFromAnnotations(g, clazz, rules); + + return new OrderedSetSimpleLinkType(g.getResource(orderedSetType.value()), clazz, rules); + } throw new IllegalArgumentException("Class " + clazz.toString() + " does not contain annotations."); } @@ -217,6 +238,8 @@ public class MappingSchemas { public static ICollectionRuleFactory createCollectionRuleFactory(ReadGraph g, Annotation annotation, Method getter) { if (annotation.annotationType().equals(RelatedElementsGet.class)) return new RelatedElementsRuleFactory2(); + if (annotation.annotationType().equals(OrderedElementsGet.class)) + return new OrderedElementsRuleFactory(); return null; }