Loading plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/transform/AbstractTranslator.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,10 @@ public abstract class AbstractTranslator { return getTypeFor(getCleanName(name), tdlPackage.Literals.SIMPLE_DATA_INSTANCE); return getTypeFor(getCleanName(name), tdlPackage.Literals.SIMPLE_DATA_INSTANCE); } } protected SimpleDataInstance getEnumDataInstanceFor(String name, EnumDataType type) { return getContentWithName(getCleanName(name), type, tdlPackage.Literals.SIMPLE_DATA_INSTANCE); } protected StructuredDataType getStructuredDataTypeFor(String name) { protected StructuredDataType getStructuredDataTypeFor(String name) { return getTypeFor(getCleanName(name), tdlPackage.Literals.STRUCTURED_DATA_TYPE); return getTypeFor(getCleanName(name), tdlPackage.Literals.STRUCTURED_DATA_TYPE); } } Loading Loading @@ -234,13 +238,16 @@ public abstract class AbstractTranslator { comment.setBody(body); comment.setBody(body); } } protected void constrainWith(final DataType generatedType, String constraintName) { protected Constraint constrainWith(final DataType generatedType, String constraintName) { ConstraintType constraintType = getTypeFor(getCleanName(constraintName), tdlPackage.Literals.CONSTRAINT_TYPE); ConstraintType constraintType = getTypeFor(getCleanName(constraintName), tdlPackage.Literals.CONSTRAINT_TYPE); if (!generatedType.getConstraint().stream().anyMatch(a->a.getType()==constraintType)) { if (!generatedType.getConstraint().stream().anyMatch(a->a.getType()==constraintType)) { Constraint constraint = tdlFactory.eINSTANCE.createConstraint(); Constraint constraint = tdlFactory.eINSTANCE.createConstraint(); constraint.setType(constraintType); constraint.setType(constraintType); generatedType.getConstraint().add(constraint); generatedType.getConstraint().add(constraint); return constraint; } } //TODO: return existing constraint? return null; } } protected DataElementMapping addDataElementMapping(String uri, DataType dataType, String tag) { protected DataElementMapping addDataElementMapping(String uri, DataType dataType, String tag) { Loading Loading
plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/transform/AbstractTranslator.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -82,6 +82,10 @@ public abstract class AbstractTranslator { return getTypeFor(getCleanName(name), tdlPackage.Literals.SIMPLE_DATA_INSTANCE); return getTypeFor(getCleanName(name), tdlPackage.Literals.SIMPLE_DATA_INSTANCE); } } protected SimpleDataInstance getEnumDataInstanceFor(String name, EnumDataType type) { return getContentWithName(getCleanName(name), type, tdlPackage.Literals.SIMPLE_DATA_INSTANCE); } protected StructuredDataType getStructuredDataTypeFor(String name) { protected StructuredDataType getStructuredDataTypeFor(String name) { return getTypeFor(getCleanName(name), tdlPackage.Literals.STRUCTURED_DATA_TYPE); return getTypeFor(getCleanName(name), tdlPackage.Literals.STRUCTURED_DATA_TYPE); } } Loading Loading @@ -234,13 +238,16 @@ public abstract class AbstractTranslator { comment.setBody(body); comment.setBody(body); } } protected void constrainWith(final DataType generatedType, String constraintName) { protected Constraint constrainWith(final DataType generatedType, String constraintName) { ConstraintType constraintType = getTypeFor(getCleanName(constraintName), tdlPackage.Literals.CONSTRAINT_TYPE); ConstraintType constraintType = getTypeFor(getCleanName(constraintName), tdlPackage.Literals.CONSTRAINT_TYPE); if (!generatedType.getConstraint().stream().anyMatch(a->a.getType()==constraintType)) { if (!generatedType.getConstraint().stream().anyMatch(a->a.getType()==constraintType)) { Constraint constraint = tdlFactory.eINSTANCE.createConstraint(); Constraint constraint = tdlFactory.eINSTANCE.createConstraint(); constraint.setType(constraintType); constraint.setType(constraintType); generatedType.getConstraint().add(constraint); generatedType.getConstraint().add(constraint); return constraint; } } //TODO: return existing constraint? return null; } } protected DataElementMapping addDataElementMapping(String uri, DataType dataType, String tag) { protected DataElementMapping addDataElementMapping(String uri, DataType dataType, String tag) { Loading