org.umlg.embeddedtest.TestOrderedEnumeration Maven / Gradle / Ivy
The newest version!
package org.umlg.embeddedtest;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.umlg.concretetest.God;
import org.umlg.runtime.adaptor.TransactionThreadEntityVar;
import org.umlg.runtime.adaptor.UMLG;
import org.umlg.runtime.adaptor.UmlgLabelConverterFactory;
import org.umlg.runtime.adaptor.UmlgTmpIdManager;
import org.umlg.runtime.collection.Filter;
import org.umlg.runtime.collection.Qualifier;
import org.umlg.runtime.collection.UmlgCollection;
import org.umlg.runtime.collection.UmlgRuntimeProperty;
import org.umlg.runtime.collection.UmlgSequence;
import org.umlg.runtime.collection.UmlgSet;
import org.umlg.runtime.collection.memory.UmlgMemorySequence;
import org.umlg.runtime.collection.memory.UmlgMemorySet;
import org.umlg.runtime.collection.persistent.PropertyTree;
import org.umlg.runtime.collection.persistent.UmlgSequenceImpl;
import org.umlg.runtime.collection.persistent.UmlgSetImpl;
import org.umlg.runtime.domain.BaseUmlgCompositionNode;
import org.umlg.runtime.domain.CompositionNode;
import org.umlg.runtime.domain.DataTypeEnum;
import org.umlg.runtime.domain.UmlgNode;
import org.umlg.runtime.util.ObjectMapperFactory;
import org.umlg.runtime.util.UmlgFormatter;
import org.umlg.runtime.validation.UmlgConstraintViolation;
import org.umlg.runtime.validation.UmlgConstraintViolationException;
import org.umlg.runtime.validation.UmlgValidation;
public class TestOrderedEnumeration extends BaseUmlgCompositionNode implements CompositionNode {
static final public long serialVersionUID = 1L;
private UmlgSet god;
private UmlgSequence testOrderedEnumBug;
private UmlgSet testEnumLiteralDuplicateName;
private String tmpId; // tmpId is only used the umlg restlet gui. It is never persisted. Its value is generated by the gui.
/**
* constructor for TestOrderedEnumeration
*
* @param compositeOwner
*/
public TestOrderedEnumeration(God compositeOwner) {
super(true);
compositeOwner.addToTestOrderedEnumeration(this);
}
/**
* constructor for TestOrderedEnumeration
*
* @param id
*/
public TestOrderedEnumeration(Object id) {
super(id);
}
/**
* constructor for TestOrderedEnumeration
*
* @param vertex
*/
public TestOrderedEnumeration(Vertex vertex) {
super(vertex);
}
/**
* default constructor for TestOrderedEnumeration
*/
public TestOrderedEnumeration() {
this(true);
}
/**
* constructor for TestOrderedEnumeration
*
* @param persistent
*/
public TestOrderedEnumeration(Boolean persistent) {
super(persistent);
}
public void addToGod(God god) {
if ( god != null ) {
if ( !this.god.isEmpty() ) {
throw new RuntimeException("Property umlgtest::org::umlg::concretetest::god_testOrderedEnumeration_1::god is a one and already has a value!");
}
this.god.add(god);
}
}
public void addToGodIgnoreInverse(God god) {
if ( god != null ) {
if ( !this.god.isEmpty() ) {
throw new RuntimeException("Property umlgtest::org::umlg::concretetest::god_testOrderedEnumeration_1::god is a one and already has a value!");
}
this.god.addIgnoreInverse(god);
}
}
public void addToTestEnumLiteralDuplicateName(TestEnumLiteralDuplicateName testEnumLiteralDuplicateName) {
if ( testEnumLiteralDuplicateName != null ) {
List violations = validateTestEnumLiteralDuplicateName(testEnumLiteralDuplicateName);
if ( violations.isEmpty() ) {
this.testEnumLiteralDuplicateName.add(testEnumLiteralDuplicateName);
} else {
throw new UmlgConstraintViolationException(violations);
}
}
}
public void addToTestEnumLiteralDuplicateName(UmlgSet testEnumLiteralDuplicateName) {
if ( !testEnumLiteralDuplicateName.isEmpty() ) {
this.testEnumLiteralDuplicateName.addAll(testEnumLiteralDuplicateName);
}
}
public void addToTestEnumLiteralDuplicateNameIgnoreInverse(TestEnumLiteralDuplicateName testEnumLiteralDuplicateName) {
if ( testEnumLiteralDuplicateName != null ) {
List violations = validateTestEnumLiteralDuplicateName(testEnumLiteralDuplicateName);
if ( violations.isEmpty() ) {
this.testEnumLiteralDuplicateName.addIgnoreInverse(testEnumLiteralDuplicateName);
} else {
throw new UmlgConstraintViolationException(violations);
}
}
}
public void addToTestOrderedEnumBug(TestOrderedEnumBug testOrderedEnumBug) {
if ( testOrderedEnumBug != null ) {
List violations = validateTestOrderedEnumBug(testOrderedEnumBug);
if ( violations.isEmpty() ) {
this.testOrderedEnumBug.add(testOrderedEnumBug);
} else {
throw new UmlgConstraintViolationException(violations);
}
}
}
public void addToTestOrderedEnumBug(UmlgSequence testOrderedEnumBug) {
if ( !testOrderedEnumBug.isEmpty() ) {
this.testOrderedEnumBug.addAll(testOrderedEnumBug);
}
}
public void addToTestOrderedEnumBug(int index, TestOrderedEnumBug testOrderedEnumBug) {
if ( testOrderedEnumBug != null ) {
List violations = validateTestOrderedEnumBug(testOrderedEnumBug);
if ( violations.isEmpty() ) {
this.testOrderedEnumBug.add(index, testOrderedEnumBug);
} else {
throw new UmlgConstraintViolationException(violations);
}
}
}
public void addToTestOrderedEnumBug(int index, UmlgSequence testOrderedEnumBug) {
if ( !testOrderedEnumBug.isEmpty() ) {
this.testOrderedEnumBug.addAll(testOrderedEnumBug);
}
}
public void addToTestOrderedEnumBugIgnoreInverse(TestOrderedEnumBug testOrderedEnumBug) {
if ( testOrderedEnumBug != null ) {
List violations = validateTestOrderedEnumBug(testOrderedEnumBug);
if ( violations.isEmpty() ) {
this.testOrderedEnumBug.addIgnoreInverse(testOrderedEnumBug);
} else {
throw new UmlgConstraintViolationException(violations);
}
}
}
static public UmlgSet extends TestOrderedEnumeration> allInstances(Filter filter) {
UmlgSet result = new UmlgMemorySet();
result.addAll(UMLG.get().allInstances(TestOrderedEnumeration.class.getName(), filter));
return result;
}
static public UmlgSet extends TestOrderedEnumeration> allInstances() {
UmlgSet result = new UmlgMemorySet();
result.addAll(UMLG.get().allInstances(TestOrderedEnumeration.class.getName()));
return result;
}
@Override
public List checkClassConstraints() {
List result = new ArrayList();
return result;
}
public void clearGod() {
this.god.clear();
}
public void clearTestEnumLiteralDuplicateName() {
this.testEnumLiteralDuplicateName.clear();
}
public void clearTestOrderedEnumBug() {
this.testOrderedEnumBug.clear();
}
@Override
public void delete() {
this.god.clear();
TransactionThreadEntityVar.remove(this);
this.vertex.remove();
}
@Override
public void fromJson(Map propertyMap) {
fromJsonDataTypeAndComposite(propertyMap);
fromJsonNonCompositeOne(propertyMap);
fromJsonNonCompositeRequiredMany(propertyMap);
}
@Override
public void fromJson(String json) {
ObjectMapper mapper = ObjectMapperFactory.INSTANCE.getObjectMapper();
try {
@SuppressWarnings( "unchecked")
Map propertyMap = mapper.readValue(json, Map.class);
fromJson(propertyMap);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void fromJsonDataTypeAndComposite(Map propertyMap) {
if ( propertyMap.containsKey("testEnumLiteralDuplicateName") ) {
if ( propertyMap.get("testEnumLiteralDuplicateName") != null ) {
Collection testEnumLiteralDuplicateName = (Collection)propertyMap.get("testEnumLiteralDuplicateName");
clearTestEnumLiteralDuplicateName();
for ( String enumLiteral : testEnumLiteralDuplicateName ) {
addToTestEnumLiteralDuplicateName(TestEnumLiteralDuplicateName.valueOf(enumLiteral));
}
} else {
setTestEnumLiteralDuplicateName(null);
}
}
if ( propertyMap.containsKey("testOrderedEnumBug") ) {
if ( propertyMap.get("testOrderedEnumBug") != null ) {
Collection testOrderedEnumBug = (Collection)propertyMap.get("testOrderedEnumBug");
clearTestOrderedEnumBug();
for ( String enumLiteral : testOrderedEnumBug ) {
addToTestOrderedEnumBug(TestOrderedEnumBug.valueOf(enumLiteral));
}
} else {
setTestOrderedEnumBug(null);
}
}
if ( propertyMap.containsKey("tmpId") ) {
if ( propertyMap.get("tmpId") != null ) {
this.tmpId = (String)propertyMap.get("tmpId");
UmlgTmpIdManager.INSTANCE.put(this.tmpId, getId());
} else {
this.tmpId = null;
}
}
}
@Override
public void fromJsonNonCompositeOne(Map propertyMap) {
}
@Override
public void fromJsonNonCompositeRequiredMany(Map propertyMap) {
}
public God getGod() {
UmlgSet tmp = this.god;
if ( !tmp.isEmpty() ) {
return tmp.iterator().next();
} else {
return null;
}
}
@Override
public String getMetaDataAsJson() {
return TestOrderedEnumeration.TestOrderedEnumerationRuntimePropertyEnum.asJson();
}
@Override
public UmlgNode getOwningObject() {
UmlgNode result;
if ( getGod() != null ) {
result = getGod();
} else {
result = null;
}
return result;
}
@Override
public String getQualifiedName() {
return "umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration";
}
/**
* getQualifiers is called from the collection in order to update the index used to implement the qualifier
*
* @param tumlRuntimeProperty
* @param node
* @param inverse
*/
@Override
public List getQualifiers(UmlgRuntimeProperty tumlRuntimeProperty, UmlgNode node, boolean inverse) {
List result = Collections.emptyList();
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName());
} else {
runtimeProperty = TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName());
}
if ( runtimeProperty != null && result.isEmpty() ) {
switch ( runtimeProperty ) {
default:
result = Collections.emptyList();
}
}
return result;
}
/**
* getSize is called from the BaseCollection.addInternal in order to save the size of the inverse collection to update the edge's sequence order
*
* @param inverse
* @param tumlRuntimeProperty
*/
@Override
public int getSize(boolean inverse, UmlgRuntimeProperty tumlRuntimeProperty) {
int result = 0;
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName());
} else {
runtimeProperty = TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName());
}
if ( runtimeProperty != null && result == 0 ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
result = testEnumLiteralDuplicateName.size();
break;
case testOrderedEnumBug:
result = testOrderedEnumBug.size();
break;
case god:
result = god.size();
break;
default:
result = 0;
}
}
return result;
}
public UmlgSet getTestEnumLiteralDuplicateName() {
return this.testEnumLiteralDuplicateName;
}
public UmlgSequence getTestOrderedEnumBug() {
return this.testOrderedEnumBug;
}
@Override
public String getUid() {
String uid;
if ( !this.vertex.property("uid").isPresent() && this.vertex.property("uid").value() != null ) {
uid=UUID.randomUUID().toString();
this.vertex.property("uid", uid);
} else {
uid=this.vertex.value("uid");
}
return uid;
}
@Override
public boolean hasOnlyOneCompositeParent() {
int result = 0;
result = result + (getGod() != null ? 1 : 0);
return result == 1;
}
public void initDataTypeVariablesWithDefaultValues() {
}
public void initVariables() {
}
/**
* boolean properties' default values are initialized in the constructor via z_internalBooleanProperties
*
* @param loaded
*/
@Override
public void initialiseProperties(boolean loaded) {
this.testEnumLiteralDuplicateName = new UmlgSetImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.testEnumLiteralDuplicateName), loaded);
this.testOrderedEnumBug = new UmlgSequenceImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.testOrderedEnumBug), loaded);
this.god = new UmlgSetImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.god), loaded);
}
@Override
public void initialiseProperty(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse, boolean loaded) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()));
} else {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName()));
}
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
this.testEnumLiteralDuplicateName = new UmlgSetImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.testEnumLiteralDuplicateName), loaded);
break;
case testOrderedEnumBug:
this.testOrderedEnumBug = new UmlgSequenceImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.testOrderedEnumBug), loaded);
break;
case god:
this.god = new UmlgSetImpl(this, PropertyTree.from(TestOrderedEnumerationRuntimePropertyEnum.god), loaded);
break;
}
}
}
@Override
public UmlgRuntimeProperty inverseAdder(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse, UmlgNode umlgNode) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()));
} else {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName()));
}
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case god:
this.god.inverseAdder((God)umlgNode);
break;
}
return runtimeProperty;
} else {
return null;
}
}
@Override
public boolean isTinkerRoot() {
return false;
}
public void removeFromGod(God god) {
if ( god != null ) {
this.god.remove(god);
}
}
public void removeFromGod(UmlgSet god) {
if ( !god.isEmpty() ) {
this.god.removeAll(god);
}
}
public void removeFromTestEnumLiteralDuplicateName(TestEnumLiteralDuplicateName testEnumLiteralDuplicateName) {
if ( testEnumLiteralDuplicateName != null ) {
this.testEnumLiteralDuplicateName.remove(testEnumLiteralDuplicateName);
}
}
public void removeFromTestEnumLiteralDuplicateName(UmlgSet testEnumLiteralDuplicateName) {
if ( !testEnumLiteralDuplicateName.isEmpty() ) {
this.testEnumLiteralDuplicateName.removeAll(testEnumLiteralDuplicateName);
}
}
public void removeFromTestOrderedEnumBug(TestOrderedEnumBug testOrderedEnumBug) {
if ( testOrderedEnumBug != null ) {
this.testOrderedEnumBug.remove(testOrderedEnumBug);
}
}
public void removeFromTestOrderedEnumBug(UmlgSequence testOrderedEnumBug) {
if ( !testOrderedEnumBug.isEmpty() ) {
this.testOrderedEnumBug.removeAll(testOrderedEnumBug);
}
}
public void setGod(God god) {
clearGod();
addToGod(god);
}
public void setTestEnumLiteralDuplicateName(UmlgSet testEnumLiteralDuplicateName) {
clearTestEnumLiteralDuplicateName();
if ( testEnumLiteralDuplicateName != null ) {
addToTestEnumLiteralDuplicateName(testEnumLiteralDuplicateName);
}
}
public void setTestOrderedEnumBug(UmlgSequence testOrderedEnumBug) {
clearTestOrderedEnumBug();
if ( testOrderedEnumBug != null ) {
addToTestOrderedEnumBug(testOrderedEnumBug);
}
}
/**
* deep indicates that components also be serialized.
*
* @param deep
*/
@Override
public String toJson(Boolean deep) {
StringBuilder sb = new StringBuilder();
if ( this.tmpId != null ) {
sb.append("\"tmpId\": \"" + this.tmpId + "\", ");
}
sb.append("\"id\": \"" + getId() + "\", ");
sb.append("\"testEnumLiteralDuplicateName\": " + (getTestEnumLiteralDuplicateName() == null ? null : getTestEnumLiteralDuplicateName().toJson()));
sb.append(", ");
sb.append("\"testOrderedEnumBug\": " + (getTestOrderedEnumBug() == null ? null : getTestOrderedEnumBug().toJson()));
sb.append(", ");
if ( getGod() != null ) {
if ( UmlgTmpIdManager.INSTANCE.get(getGod().getId()) != null ) {
sb.append("\"god\": " + "{\"id\": \"" + getGod().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getGod().getId()) + "\",\"displayName\": \"" + getGod().getName() + "\"}" + "");
} else {
sb.append("\"god\": " + "{\"id\": \"" + getGod().getId() + "\", \"displayName\": \"" + getGod().getName() + "\"}" + "");
}
} else {
sb.append("\"god\": " + "{\"id\": " + null + ", \"displayName\": " + null + "}");
}
sb.append(", ");
sb.append("\"qualifiedName\": \"" + getQualifiedName() + "\"");
sb.append(", ");
//PlaceHolder for restful
sb.append("\"uri\": {}");
sb.insert(0, "{");
sb.append("}");
return sb.toString();
}
@Override
public String toJson() {
return toJson(false);
}
/**
* deep indicates that components also be serialized.
*
* @param deep
*/
@Override
public String toJsonWithoutCompositeParent(Boolean deep) {
StringBuilder sb = new StringBuilder();
if ( this.tmpId != null ) {
sb.append("\"tmpId\": \"" + this.tmpId + "\", ");
}
sb.append("\"id\": \"" + getId() + "\", ");
sb.append("\"testEnumLiteralDuplicateName\": " + (getTestEnumLiteralDuplicateName() == null ? null : getTestEnumLiteralDuplicateName().toJson()));
sb.append(", ");
sb.append("\"testOrderedEnumBug\": " + (getTestOrderedEnumBug() == null ? null : getTestOrderedEnumBug().toJson()));
sb.append(", ");
sb.append("\"qualifiedName\": \"" + getQualifiedName() + "\"");
sb.append(", ");
//PlaceHolder for restful
sb.append("\"uri\": {}");
sb.insert(0, "{");
sb.append("}");
return sb.toString();
}
@Override
public String toJsonWithoutCompositeParent() {
return toJsonWithoutCompositeParent(false);
}
@Override
public List validateMultiplicities() {
List result = new ArrayList();
if ( getGod() == null ) {
result.add(new UmlgConstraintViolation("multiplicity", "umlgtest::org::umlg::concretetest::god_testOrderedEnumeration_1::god", "lower multiplicity is 1"));
}
return result;
}
public List validateTestEnumLiteralDuplicateName(TestEnumLiteralDuplicateName testEnumLiteralDuplicateName) {
List result = new ArrayList();
return result;
}
public List validateTestOrderedEnumBug(TestOrderedEnumBug testOrderedEnumBug) {
List result = new ArrayList();
return result;
}
@Override
public void z_internalAddPersistentValueToCollection(UmlgRuntimeProperty umlgRuntimeProperty, Object umlgNode) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(umlgRuntimeProperty.getQualifiedName()));
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
for ( String s : (String[])umlgNode ) {
this.testEnumLiteralDuplicateName.z_internalAdder(TestEnumLiteralDuplicateName.valueOf(s));
}
break;
case testOrderedEnumBug:
for ( String s : (String[])umlgNode ) {
this.testOrderedEnumBug.z_internalAdder(TestOrderedEnumBug.valueOf(s));
}
break;
case god:
this.god.z_internalAdder((God)umlgNode);
break;
}
}
}
@Override
public void z_internalAddToCollection(UmlgRuntimeProperty umlgRuntimeProperty, Object umlgNode) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(umlgRuntimeProperty.getQualifiedName()));
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
for ( TestEnumLiteralDuplicateName s : (TestEnumLiteralDuplicateName[])umlgNode ) {
this.testEnumLiteralDuplicateName.z_internalAdder(s);
}
break;
case testOrderedEnumBug:
for ( TestOrderedEnumBug s : (TestOrderedEnumBug[])umlgNode ) {
this.testOrderedEnumBug.z_internalAdder(s);
}
break;
case god:
this.god.z_internalAdder((God)umlgNode);
break;
}
}
}
@Override
public Set z_internalBooleanProperties() {
Set result = new HashSet();
return result;
}
public void z_internalClearGod() {
this.god.z_internalClear();
}
public void z_internalClearTestEnumLiteralDuplicateName() {
this.testEnumLiteralDuplicateName.z_internalClear();
}
public void z_internalClearTestOrderedEnumBug() {
this.testOrderedEnumBug.z_internalClear();
}
@Override
public Set z_internalDataTypeProperties() {
Set result = new HashSet();
result.add(TestOrderedEnumerationRuntimePropertyEnum.testEnumLiteralDuplicateName);
result.add(TestOrderedEnumerationRuntimePropertyEnum.testOrderedEnumBug);
return result;
}
@Override
public Map z_internalDataTypePropertiesWithDefaultValues() {
Map result = new HashMap();
return result;
}
@Override
public UmlgCollection extends Object> z_internalGetCollectionFor(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse) {
UmlgCollection extends Object> result = null;
if ( result == null ) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()));
} else {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName()));
}
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
result = this.testEnumLiteralDuplicateName;
break;
case testOrderedEnumBug:
result = this.testOrderedEnumBug;
break;
case god:
result = this.god;
break;
}
}
}
return result;
}
@Override
public UmlgRuntimeProperty z_internalInverseAdder(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse, UmlgNode umlgNode) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
if ( !inverse ) {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()));
} else {
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName()));
}
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case god:
this.god.z_internalAdder((God)umlgNode);
break;
}
return runtimeProperty;
} else {
return null;
}
}
@Override
public void z_internalMarkCollectionLoaded(UmlgRuntimeProperty umlgRuntimeProperty, boolean loaded) {
TestOrderedEnumerationRuntimePropertyEnum runtimeProperty;
runtimeProperty = (TestOrderedEnumerationRuntimePropertyEnum.fromQualifiedName(umlgRuntimeProperty.getQualifiedName()));
if ( runtimeProperty != null ) {
switch ( runtimeProperty ) {
case testEnumLiteralDuplicateName:
this.testEnumLiteralDuplicateName.setLoaded(loaded);
break;
case testOrderedEnumBug:
this.testOrderedEnumBug.setLoaded(loaded);
break;
case god:
this.god.setLoaded(loaded);
break;
}
}
}
static public enum TestOrderedEnumerationRuntimePropertyEnum implements UmlgRuntimeProperty {
testEnumLiteralDuplicateName(/* qualifiedName */ "umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration::testEnumLiteralDuplicateName",/* persistentName */ "testEnumLiteralDuplicateName",/* inverseName */ "testOrderedEnumeration",/* inverseQualifiedName */ "umlgtest::org::umlg::embeddedtest::testOrderedEnumeration_testEnumLiteralDuplicateName_1::testOrderedEnumeration",/* isAssociationClassOne */ false,/* isMemberEndOfAssociationClass */ false,/* associationClassPropertyNameField */ "null",/* inverseAssociationClassPropertyNameField */ "null",/* isAssociationClassProperty */ false,/* isOnePrimitivePropertyOfAssociationClass */ false,/* isOnePrimitive */ false,/* isReadOnly */ false,/* dataTypeEnum */ null,/* validations */ Collections.emptyList(),/* isManyPrimitive */ false,/* oneEnumeration */ false,/* manyEnumeration */ true,/* isControllingSide */ true,/* isComposite */ false,/* isInverseComposite */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("testOrderedEnumeration_testEnumLiteralDuplicateName_1"),/* isOneToOne */ false,/* isOneToMany */ true,/* isManyToOne */ false,/* isManyToMany */ false,/* upper */ -1,/* lower */ 0,/* inverseUpper */ 1,/* isQualified */ false,/* isInverseQualified */ false,/* isOrdered */ false,/* isInverseOrdered */ false,/* isUnique */ true,/* isInverseUnique */ true,/* isDerived */ false,/* isNavigable */ true,/* propertyType */ TestEnumLiteralDuplicateName.class,/* json */ "{\"name\": \"testEnumLiteralDuplicateName\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration::testEnumLiteralDuplicateName\", \"persistentName\": \"testEnumLiteralDuplicateName\", \"inverseName\": \"testOrderedEnumeration\", \"inverseQualifiedName\": \"umlgtest::org::umlg::embeddedtest::testOrderedEnumeration_testEnumLiteralDuplicateName_1::testOrderedEnumeration\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": true, \"controllingSide\": true, \"composite\": false, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": true, \"manyToOne\": false, \"manyToMany\": false, \"upper\": -1, \"lower\": 0, \"inverseUpper\": 1, \"label\": \"testOrderedEnumeration_testEnumLiteralDuplicateName_1\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": true, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false),
testOrderedEnumBug(/* qualifiedName */ "umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration::testOrderedEnumBug",/* persistentName */ "testOrderedEnumBug",/* inverseName */ "testOrderedEnumeration",/* inverseQualifiedName */ "umlgtest::org::umlg::embeddedtest::testOrderedEnumeration_testOrderedEnumBug_1::testOrderedEnumeration",/* isAssociationClassOne */ false,/* isMemberEndOfAssociationClass */ false,/* associationClassPropertyNameField */ "null",/* inverseAssociationClassPropertyNameField */ "null",/* isAssociationClassProperty */ false,/* isOnePrimitivePropertyOfAssociationClass */ false,/* isOnePrimitive */ false,/* isReadOnly */ false,/* dataTypeEnum */ null,/* validations */ Collections.emptyList(),/* isManyPrimitive */ false,/* oneEnumeration */ false,/* manyEnumeration */ true,/* isControllingSide */ true,/* isComposite */ false,/* isInverseComposite */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("testOrderedEnumeration_testOrderedEnumBug_1"),/* isOneToOne */ false,/* isOneToMany */ true,/* isManyToOne */ false,/* isManyToMany */ false,/* upper */ -1,/* lower */ 0,/* inverseUpper */ 1,/* isQualified */ false,/* isInverseQualified */ false,/* isOrdered */ true,/* isInverseOrdered */ false,/* isUnique */ false,/* isInverseUnique */ true,/* isDerived */ false,/* isNavigable */ true,/* propertyType */ TestOrderedEnumBug.class,/* json */ "{\"name\": \"testOrderedEnumBug\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration::testOrderedEnumBug\", \"persistentName\": \"testOrderedEnumBug\", \"inverseName\": \"testOrderedEnumeration\", \"inverseQualifiedName\": \"umlgtest::org::umlg::embeddedtest::testOrderedEnumeration_testOrderedEnumBug_1::testOrderedEnumeration\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": true, \"controllingSide\": true, \"composite\": false, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": true, \"manyToOne\": false, \"manyToMany\": false, \"upper\": -1, \"lower\": 0, \"inverseUpper\": 1, \"label\": \"testOrderedEnumeration_testOrderedEnumBug_1\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": true, \"inverseOrdered\": false, \"unique\": false, \"inverseUnique\": true, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false),
god(/* qualifiedName */ "umlgtest::org::umlg::concretetest::god_testOrderedEnumeration_1::god",/* persistentName */ "god",/* inverseName */ "testOrderedEnumeration",/* inverseQualifiedName */ "umlgtest::org::umlg::concretetest::God::testOrderedEnumeration",/* isAssociationClassOne */ false,/* isMemberEndOfAssociationClass */ false,/* associationClassPropertyNameField */ "null",/* inverseAssociationClassPropertyNameField */ "null",/* isAssociationClassProperty */ false,/* isOnePrimitivePropertyOfAssociationClass */ false,/* isOnePrimitive */ false,/* isReadOnly */ false,/* dataTypeEnum */ null,/* validations */ Collections.emptyList(),/* isManyPrimitive */ false,/* oneEnumeration */ false,/* manyEnumeration */ false,/* isControllingSide */ false,/* isComposite */ false,/* isInverseComposite */ true,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("god_testOrderedEnumeration_1"),/* isOneToOne */ false,/* isOneToMany */ false,/* isManyToOne */ true,/* isManyToMany */ false,/* upper */ 1,/* lower */ 1,/* inverseUpper */ -1,/* isQualified */ false,/* isInverseQualified */ false,/* isOrdered */ false,/* isInverseOrdered */ false,/* isUnique */ true,/* isInverseUnique */ true,/* isDerived */ false,/* isNavigable */ true,/* propertyType */ God.class,/* json */ "{\"name\": \"god\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"umlgtest::org::umlg::concretetest::god_testOrderedEnumeration_1::god\", \"persistentName\": \"god\", \"inverseName\": \"testOrderedEnumeration\", \"inverseQualifiedName\": \"umlgtest::org::umlg::concretetest::God::testOrderedEnumeration\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": false, \"controllingSide\": false, \"composite\": false, \"inverseComposite\": true, \"oneToOne\": false, \"oneToMany\": false, \"manyToOne\": true, \"manyToMany\": false, \"upper\": 1, \"lower\": 1, \"inverseUpper\": -1, \"label\": \"god_testOrderedEnumeration_1\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": true, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false);
private String _qualifiedName;
private String _persistentName;
private String _inverseName;
private String _inverseQualifiedName;
private boolean _associationClassOne;
private boolean _memberEndOfAssociationClass;
private String _associationClassPropertyName;
private String _inverseAssociationClassPropertyName;
private boolean _associationClassProperty;
private boolean _onePrimitivePropertyOfAssociationClass;
private boolean _onePrimitive;
private Boolean _readOnly;
private DataTypeEnum dataTypeEnum;
private List validations;
private boolean _manyPrimitive;
private boolean _oneEnumeration;
private boolean _manyEnumeration;
private boolean _controllingSide;
private boolean _composite;
private boolean _inverseComposite;
private String _label;
private boolean _oneToOne;
private boolean _oneToMany;
private boolean _manyToOne;
private boolean _manyToMany;
private int _upper;
private int _lower;
private int _inverseUpper;
private boolean _qualified;
private boolean _inverseQualified;
private boolean _ordered;
private boolean _inverseOrdered;
private boolean _unique;
private boolean _inverseUnique;
private boolean _derived;
private boolean _navigability;
private Class _propertyType;
private String _json;
private boolean _changeListener;
/**
* constructor for TestOrderedEnumerationRuntimePropertyEnum
*
* @param _qualifiedName
* @param _persistentName
* @param _inverseName
* @param _inverseQualifiedName
* @param _associationClassOne
* @param _memberEndOfAssociationClass
* @param _associationClassPropertyName
* @param _inverseAssociationClassPropertyName
* @param _associationClassProperty
* @param _onePrimitivePropertyOfAssociationClass
* @param _onePrimitive
* @param _readOnly
* @param dataTypeEnum
* @param validations
* @param _manyPrimitive
* @param _oneEnumeration
* @param _manyEnumeration
* @param _controllingSide
* @param _composite
* @param _inverseComposite
* @param _label
* @param _oneToOne
* @param _oneToMany
* @param _manyToOne
* @param _manyToMany
* @param _upper
* @param _lower
* @param _inverseUpper
* @param _qualified
* @param _inverseQualified
* @param _ordered
* @param _inverseOrdered
* @param _unique
* @param _inverseUnique
* @param _derived
* @param _navigability
* @param _propertyType
* @param _json
* @param _changeListener
*/
private TestOrderedEnumerationRuntimePropertyEnum(String _qualifiedName, String _persistentName, String _inverseName, String _inverseQualifiedName, boolean _associationClassOne, boolean _memberEndOfAssociationClass, String _associationClassPropertyName, String _inverseAssociationClassPropertyName, boolean _associationClassProperty, boolean _onePrimitivePropertyOfAssociationClass, boolean _onePrimitive, Boolean _readOnly, DataTypeEnum dataTypeEnum, List validations, boolean _manyPrimitive, boolean _oneEnumeration, boolean _manyEnumeration, boolean _controllingSide, boolean _composite, boolean _inverseComposite, String _label, boolean _oneToOne, boolean _oneToMany, boolean _manyToOne, boolean _manyToMany, int _upper, int _lower, int _inverseUpper, boolean _qualified, boolean _inverseQualified, boolean _ordered, boolean _inverseOrdered, boolean _unique, boolean _inverseUnique, boolean _derived, boolean _navigability, Class _propertyType, String _json, boolean _changeListener) {
this._qualifiedName = _qualifiedName;
this._persistentName = _persistentName;
this._inverseName = _inverseName;
this._inverseQualifiedName = _inverseQualifiedName;
this._associationClassOne = _associationClassOne;
this._memberEndOfAssociationClass = _memberEndOfAssociationClass;
this._associationClassPropertyName = _associationClassPropertyName;
this._inverseAssociationClassPropertyName = _inverseAssociationClassPropertyName;
this._associationClassProperty = _associationClassProperty;
this._onePrimitivePropertyOfAssociationClass = _onePrimitivePropertyOfAssociationClass;
this._onePrimitive = _onePrimitive;
this._readOnly = _readOnly;
this.dataTypeEnum = dataTypeEnum;
this.validations = validations;
this._manyPrimitive = _manyPrimitive;
this._oneEnumeration = _oneEnumeration;
this._manyEnumeration = _manyEnumeration;
this._controllingSide = _controllingSide;
this._composite = _composite;
this._inverseComposite = _inverseComposite;
this._label = _label;
this._oneToOne = _oneToOne;
this._oneToMany = _oneToMany;
this._manyToOne = _manyToOne;
this._manyToMany = _manyToMany;
this._upper = _upper;
this._lower = _lower;
this._inverseUpper = _inverseUpper;
this._qualified = _qualified;
this._inverseQualified = _inverseQualified;
this._ordered = _ordered;
this._inverseOrdered = _inverseOrdered;
this._unique = _unique;
this._inverseUnique = _inverseUnique;
this._derived = _derived;
this._navigability = _navigability;
this._propertyType = _propertyType;
this._json = _json;
this._changeListener = _changeListener;
}
static public String asJson() {
int count = 1;
StringBuilder sb = new StringBuilder();;
sb.append("{\"name\": \"TestOrderedEnumeration\", ");
sb.append("\"qualifiedName\": \"umlgtest::org::umlg::embeddedtest::TestOrderedEnumeration\", ");
sb.append("\"uri\": \"TODO\", ");
sb.append("\"properties\": [");
for ( TestOrderedEnumerationRuntimePropertyEnum l : TestOrderedEnumerationRuntimePropertyEnum.values() ) {
sb.append(l.toJson());
if ( count < TestOrderedEnumerationRuntimePropertyEnum.values().length ) {
count++;
sb.append(",");
}
}
sb.append("]}");
return sb.toString();
}
static public TestOrderedEnumerationRuntimePropertyEnum fromInverseQualifiedName(String inverseQualifiedName) {
if ( god.getInverseQualifiedName().equals(inverseQualifiedName) ) {
return god;
}
if ( testOrderedEnumBug.getInverseQualifiedName().equals(inverseQualifiedName) ) {
return testOrderedEnumBug;
}
if ( testEnumLiteralDuplicateName.getInverseQualifiedName().equals(inverseQualifiedName) ) {
return testEnumLiteralDuplicateName;
}
return null;
}
static public TestOrderedEnumerationRuntimePropertyEnum fromLabel(String _label) {
if ( god.getLabel().equals(_label) ) {
return god;
}
if ( testOrderedEnumBug.getLabel().equals(_label) ) {
return testOrderedEnumBug;
}
if ( testEnumLiteralDuplicateName.getLabel().equals(_label) ) {
return testEnumLiteralDuplicateName;
}
return null;
}
static public TestOrderedEnumerationRuntimePropertyEnum fromQualifiedName(String qualifiedName) {
if ( god.getQualifiedName().equals(qualifiedName) ) {
return god;
}
if ( testOrderedEnumBug.getQualifiedName().equals(qualifiedName) ) {
return testOrderedEnumBug;
}
if ( testEnumLiteralDuplicateName.getQualifiedName().equals(qualifiedName) ) {
return testEnumLiteralDuplicateName;
}
return null;
}
public String getAssociationClassPropertyName() {
return this._associationClassPropertyName;
}
public DataTypeEnum getDataTypeEnum() {
return this.dataTypeEnum;
}
public String getInverseAssociationClassPropertyName() {
return this._inverseAssociationClassPropertyName;
}
public String getInverseName() {
return this._inverseName;
}
public String getInverseQualifiedName() {
return this._inverseQualifiedName;
}
public int getInverseUpper() {
return this._inverseUpper;
}
public String getJson() {
return this._json;
}
public String getLabel() {
return this._label;
}
public int getLower() {
return this._lower;
}
public String getPersistentName() {
return this._persistentName;
}
public Class getPropertyType() {
return this._propertyType;
}
public String getQualifiedName() {
return this._qualifiedName;
}
public Boolean getReadOnly() {
return this._readOnly;
}
public int getUpper() {
return this._upper;
}
public List getValidations() {
return this.validations;
}
public boolean isAssociationClassOne() {
return this._associationClassOne;
}
public boolean isAssociationClassProperty() {
return this._associationClassProperty;
}
public boolean isChangeListener() {
return this._changeListener;
}
public boolean isComposite() {
return this._composite;
}
public boolean isControllingSide() {
return this._controllingSide;
}
public boolean isDerived() {
return this._derived;
}
public boolean isInverseComposite() {
return this._inverseComposite;
}
public boolean isInverseOrdered() {
return this._inverseOrdered;
}
public boolean isInverseQualified() {
return this._inverseQualified;
}
public boolean isInverseUnique() {
return this._inverseUnique;
}
public boolean isManyEnumeration() {
return this._manyEnumeration;
}
public boolean isManyPrimitive() {
return this._manyPrimitive;
}
public boolean isManyToMany() {
return this._manyToMany;
}
public boolean isManyToOne() {
return this._manyToOne;
}
public boolean isMemberEndOfAssociationClass() {
return this._memberEndOfAssociationClass;
}
public boolean isNavigability() {
return this._navigability;
}
public boolean isOneEnumeration() {
return this._oneEnumeration;
}
public boolean isOnePrimitive() {
return this._onePrimitive;
}
public boolean isOnePrimitivePropertyOfAssociationClass() {
return this._onePrimitivePropertyOfAssociationClass;
}
public boolean isOneToMany() {
return this._oneToMany;
}
public boolean isOneToOne() {
return this._oneToOne;
}
public boolean isOrdered() {
return this._ordered;
}
public boolean isQualified() {
return this._qualified;
}
public boolean isUnique() {
return this._unique;
}
@Override
public boolean isValid(int elementCount) {
if ( isQualified() ) {
return elementCount >= getLower();
} else {
return (getUpper() == -1 || elementCount <= getUpper()) && elementCount >= getLower();
}
}
@Override
public String toJson() {
return getJson();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy