All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.testocl.OclTestCollection Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package org.umlg.testocl;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.tinkerpop.gremlin.structure.Vertex;
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.UmlgRuntimeProperty;
import org.umlg.runtime.collection.UmlgSet;
import org.umlg.runtime.collection.memory.UmlgMemorySet;
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.UmlgMetaNode;
import org.umlg.runtime.domain.UmlgNode;
import org.umlg.runtime.util.ObjectMapperFactory;
import org.umlg.runtime.validation.UmlgConstraintViolation;
import org.umlg.runtime.validation.UmlgConstraintViolationException;
import org.umlg.runtime.validation.UmlgValidation;
import org.umlg.testocl.OclTestCollection2.OclTestCollection2RuntimePropertyEnum;
import org.umlg.testocl.meta.OclTestCollectionMeta;

public class OclTestCollection extends BaseUmlgCompositionNode implements CompositionNode {
	static final public long serialVersionUID = 1L;
	private UmlgSet name;
	private UmlgSet oclTestCollection2;
	private UmlgSet oclTest1;
	private UmlgSet oclTest2;
	private String tmpId;	// tmpId is only used the umlg restlet gui. It is never persisted. Its value is generated by the gui.

	/**
	 * constructor for OclTestCollection
	 * 
	 * @param id 
	 */
	public OclTestCollection(Object id)  {
		super(id);
	}
	
	/**
	 * constructor for OclTestCollection
	 * 
	 * @param compositeOwner 
	 */
	public OclTestCollection(OclTest1 compositeOwner)  {
		super(true);
		compositeOwner.addToOclTestCollection(this);
	}
	
	/**
	 * constructor for OclTestCollection
	 * 
	 * @param vertex 
	 */
	public OclTestCollection(Vertex vertex)  {
		super(vertex);
	}
	
	/**
	 * default constructor for OclTestCollection
	 */
	public OclTestCollection()  {
		this(true);
	}
	
	/**
	 * constructor for OclTestCollection
	 * 
	 * @param persistent 
	 */
	public OclTestCollection(Boolean persistent)  {
		super(persistent);
	}

	public void addToName(String name) {
		if ( !this.name.isEmpty() ) {
			throw new RuntimeException("Property is a one and already has value, first clear it before adding!");
		}
		if ( name != null ) {
			List violations = validateName(name);
			if ( violations.isEmpty() ) {
				this.name.add(name);
			} else {
				throw new UmlgConstraintViolationException(violations);
			}
		}
	}
	
	public void addToNameIgnoreInverse(String name) {
		if ( !this.name.isEmpty() ) {
			throw new RuntimeException("Property is a one and already has value, first clear it before adding!");
		}
		if ( name != null ) {
			List violations = validateName(name);
			if ( violations.isEmpty() ) {
				this.name.add(name);
			} else {
				throw new UmlgConstraintViolationException(violations);
			}
		}
	}
	
	public void addToOclTest1(OclTest1 oclTest1) {
		if ( oclTest1 != null ) {
			if ( !this.oclTest1.isEmpty() ) {
				throw new RuntimeException("Property testoclmodel::org::umlg::testocl::A__::oclTest1is a one and already has a value!");
			}
			this.oclTest1.add(oclTest1);
		}
	}
	
	public void addToOclTest1IgnoreInverse(OclTest1 oclTest1) {
		if ( oclTest1 != null ) {
			if ( !this.oclTest1.isEmpty() ) {
				throw new RuntimeException("Property testoclmodel::org::umlg::testocl::A__::oclTest1is a one and already has a value!");
			}
			this.oclTest1.addIgnoreInverse(oclTest1);
		}
	}
	
	public void addToOclTest2(OclTest2 oclTest2) {
		if ( oclTest2 != null ) {
			if ( !this.oclTest2.isEmpty() ) {
				throw new RuntimeException("Property testoclmodel::org::umlg::testocl::A__::oclTest2is a one and already has a value!");
			}
			this.oclTest2.add(oclTest2);
		}
	}
	
	public void addToOclTest2IgnoreInverse(OclTest2 oclTest2) {
		if ( oclTest2 != null ) {
			if ( !this.oclTest2.isEmpty() ) {
				throw new RuntimeException("Property testoclmodel::org::umlg::testocl::A__::oclTest2is a one and already has a value!");
			}
			this.oclTest2.addIgnoreInverse(oclTest2);
		}
	}
	
	public void addToOclTestCollection2(OclTestCollection2 oclTestCollection2) {
		if ( oclTestCollection2 != null ) {
			oclTestCollection2.clearOclTestCollection();
			oclTestCollection2.initialiseProperty(OclTestCollection2RuntimePropertyEnum.oclTestCollection, false);
			removeFromOclTestCollection2(oclTestCollection2);
		}
		if ( oclTestCollection2 != null ) {
			this.oclTestCollection2.add(oclTestCollection2);
		}
	}
	
	public void addToOclTestCollection2(UmlgSet oclTestCollection2) {
		if ( !oclTestCollection2.isEmpty() ) {
			this.oclTestCollection2.addAll(oclTestCollection2);
		}
	}
	
	public void addToOclTestCollection2IgnoreInverse(OclTestCollection2 oclTestCollection2) {
		if ( oclTestCollection2 != null ) {
			oclTestCollection2.clearOclTestCollection();
			oclTestCollection2.initialiseProperty(OclTestCollection2RuntimePropertyEnum.oclTestCollection, false);
			removeFromOclTestCollection2(oclTestCollection2);
		}
		if ( oclTestCollection2 != null ) {
			this.oclTestCollection2.addIgnoreInverse(oclTestCollection2);
		}
	}
	
	static public UmlgSet allInstances(Filter filter) {
		UmlgSet result = new UmlgMemorySet();
		result.addAll(UMLG.get().allInstances(OclTestCollection.class.getName(), filter));
		return result;
	}
	
	static public UmlgSet allInstances() {
		UmlgSet result = new UmlgMemorySet();
		result.addAll(UMLG.get().allInstances(OclTestCollection.class.getName()));
		return result;
	}
	
	@Override
	public List checkClassConstraints() {
		List result = new ArrayList();
		return result;
	}
	
	public void clearName() {
		this.name.clear();
	}
	
	public void clearOclTest1() {
		this.oclTest1.clear();
	}
	
	public void clearOclTest2() {
		this.oclTest2.clear();
	}
	
	public void clearOclTestCollection2() {
		this.oclTestCollection2.clear();
	}
	
	@Override
	public void delete() {
		for ( OclTestCollection2 child : getOclTestCollection2() ) {
			child.delete();
		}
		this.oclTest2.clear();
		this.oclTest1.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("name") ) {
			if ( propertyMap.get("name") != null ) {
				String name = (String)propertyMap.get("name");
				setName(name);
			} else {
				setName(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;
			}
		}
	}
	
	@SuppressWarnings(	"unchecked")
	@Override
	public void fromJsonNonCompositeOne(Map propertyMap) {
		if ( propertyMap.containsKey("oclTest2") ) {
			if ( propertyMap.get("oclTest2") != null ) {
				Map oclTest2Map = (Map)propertyMap.get("oclTest2");
				if ( oclTest2Map.isEmpty() || oclTest2Map.get("id") == null ) {
					setOclTest2(null);
				} else {
					setOclTest2((OclTest2)UMLG.get().getEntity((oclTest2Map.get("id"))));
				}
			} else {
				setOclTest2(null);
			}
		}
	}
	
	@Override
	public void fromJsonNonCompositeRequiredMany(Map propertyMap) {
	}
	
	/**
	 * Implements the ocl statement for derived property 'derivedTest'
	 * 
	 * package testoclmodel::org::umlg::testocl
	 *     context OclTestCollection::derivedTest : testoclmodel::org::umlg::testocl::OclTest2
	 *     derive: self.oclTest2
	 * endpackage
	 * 
*/ public OclTest2 getDerivedTest() { return getOclTest2(); } @Override public String getMetaDataAsJson() { return OclTestCollection.OclTestCollectionRuntimePropertyEnum.asJson(); } public UmlgMetaNode getMetaNode() { return OclTestCollectionMeta.getInstance(); } public String getName() { UmlgSet tmp = this.name; if ( !tmp.isEmpty() ) { return tmp.iterator().next(); } else { return null; } } public OclTest1 getOclTest1() { UmlgSet tmp = this.oclTest1; if ( !tmp.isEmpty() ) { return tmp.iterator().next(); } else { return null; } } public OclTest2 getOclTest2() { UmlgSet tmp = this.oclTest2; if ( !tmp.isEmpty() ) { return tmp.iterator().next(); } else { return null; } } public UmlgSet getOclTestCollection2() { return this.oclTestCollection2; } @Override public UmlgNode getOwningObject() { UmlgNode result; if ( getOclTest1() != null ) { result = getOclTest1(); } else { result = null; } return result; } @Override public String getQualifiedName() { return "testoclmodel::org::umlg::testocl::OclTestCollection"; } /** * 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(); OclTestCollectionRuntimePropertyEnum runtimeProperty; if ( !inverse ) { runtimeProperty = OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()); } else { runtimeProperty = OclTestCollectionRuntimePropertyEnum.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 sice 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; OclTestCollectionRuntimePropertyEnum runtimeProperty; if ( !inverse ) { runtimeProperty = OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName()); } else { runtimeProperty = OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName()); } if ( runtimeProperty != null && result == 0 ) { switch ( runtimeProperty ) { case name: result = name.size(); break; case oclTest2: result = oclTest2.size(); break; case oclTestCollection2: result = oclTestCollection2.size(); break; case oclTest1: result = oclTest1.size(); break; default: result = 0; } } return result; } @Override public String getUid() { String uid; if ( !this.vertex.property("uid").isPresent() ) { 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 + (getOclTest1() != null ? 1 : 0); return result == 1; } public void initVariables() { } @Override public void initialiseProperties() { this.name = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.name); this.oclTest2 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTest2); this.oclTestCollection2 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTestCollection2); this.oclTest1 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTest1); } @Override public void initialiseProperty(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse) { OclTestCollectionRuntimePropertyEnum runtimeProperty; if ( !inverse ) { runtimeProperty = (OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName())); } else { runtimeProperty = (OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName())); } if ( runtimeProperty != null ) { switch ( runtimeProperty ) { case name: this.name = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.name); break; case oclTest2: this.oclTest2 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTest2); break; case oclTestCollection2: this.oclTestCollection2 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTestCollection2); break; case oclTest1: this.oclTest1 = new UmlgSetImpl(this, OclTestCollectionRuntimePropertyEnum.oclTest1); break; } } } @Override public UmlgRuntimeProperty inverseAdder(UmlgRuntimeProperty tumlRuntimeProperty, boolean inverse, UmlgNode umlgNode) { OclTestCollectionRuntimePropertyEnum runtimeProperty; if ( !inverse ) { runtimeProperty = (OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getQualifiedName())); } else { runtimeProperty = (OclTestCollectionRuntimePropertyEnum.fromQualifiedName(tumlRuntimeProperty.getInverseQualifiedName())); } if ( runtimeProperty != null ) { switch ( runtimeProperty ) { case oclTest2: this.oclTest2.inverseAdder((OclTest2)umlgNode); break; case oclTestCollection2: this.oclTestCollection2.inverseAdder((OclTestCollection2)umlgNode); break; case oclTest1: this.oclTest1.inverseAdder((OclTest1)umlgNode); break; } return runtimeProperty; } else { return null; } } @Override public boolean isTinkerRoot() { return false; } public UmlgSet lookupFor_oclTestCollection_oclTest2() { UmlgSet result = new UmlgMemorySet(); Filter filter = new Filter() { @Override public boolean filter(OclTest2 entity){ return !entity.getOclTestCollection().contains(OclTestCollection.this); } }; result.addAll(org.umlg.testocl.OclTest2.allInstances(filter)); return result; } public void removeFromName(String name) { if ( name != null ) { this.name.remove(name); } } public void removeFromName(UmlgSet name) { if ( !name.isEmpty() ) { this.name.removeAll(name); } } public void removeFromOclTest1(OclTest1 oclTest1) { if ( oclTest1 != null ) { this.oclTest1.remove(oclTest1); } } public void removeFromOclTest1(UmlgSet oclTest1) { if ( !oclTest1.isEmpty() ) { this.oclTest1.removeAll(oclTest1); } } public void removeFromOclTest2(OclTest2 oclTest2) { if ( oclTest2 != null ) { this.oclTest2.remove(oclTest2); } } public void removeFromOclTest2(UmlgSet oclTest2) { if ( !oclTest2.isEmpty() ) { this.oclTest2.removeAll(oclTest2); } } public void removeFromOclTestCollection2(OclTestCollection2 oclTestCollection2) { if ( oclTestCollection2 != null ) { this.oclTestCollection2.remove(oclTestCollection2); } } public void removeFromOclTestCollection2(UmlgSet oclTestCollection2) { if ( !oclTestCollection2.isEmpty() ) { this.oclTestCollection2.removeAll(oclTestCollection2); } } public void setName(String name) { clearName(); addToName(name); } public void setOclTest1(OclTest1 oclTest1) { clearOclTest1(); addToOclTest1(oclTest1); } public void setOclTest2(OclTest2 oclTest2) { clearOclTest2(); addToOclTest2(oclTest2); } public void setOclTestCollection2(UmlgSet oclTestCollection2) { clearOclTestCollection2(); if ( oclTestCollection2 != null ) { addToOclTestCollection2(oclTestCollection2); } } /** * 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("\"metaNodeId\": \"" + getMetaNode().getId() + "\", "); sb.append("\"name\": " + (getName() != null ? "\"" + StringEscapeUtils.escapeJson(getName()) + "\"" : null )); sb.append(", "); if ( getOclTest2() != null ) { if ( UmlgTmpIdManager.INSTANCE.get(getOclTest2().getId()) != null ) { sb.append("\"oclTest2\": " + "{\"id\": \"" + getOclTest2().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getOclTest2().getId()) + "\",\"displayName\": \"" + getOclTest2().getName() + "\"}" + ""); } else { sb.append("\"oclTest2\": " + "{\"id\": \"" + getOclTest2().getId() + "\", \"displayName\": \"" + getOclTest2().getName() + "\"}" + ""); } } else { sb.append("\"oclTest2\": " + "{\"id\": " + null + ", \"displayName\": " + null + "}"); } sb.append(", "); if ( getOclTest1() != null ) { if ( UmlgTmpIdManager.INSTANCE.get(getOclTest1().getId()) != null ) { sb.append("\"oclTest1\": " + "{\"id\": \"" + getOclTest1().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getOclTest1().getId()) + "\",\"displayName\": \"" + getOclTest1().getName() + "\"}" + ""); } else { sb.append("\"oclTest1\": " + "{\"id\": \"" + getOclTest1().getId() + "\", \"displayName\": \"" + getOclTest1().getName() + "\"}" + ""); } } else { sb.append("\"oclTest1\": " + "{\"id\": " + null + ", \"displayName\": " + null + "}"); } sb.append(", "); if ( getDerivedTest() != null ) { if ( UmlgTmpIdManager.INSTANCE.get(getDerivedTest().getId()) != null ) { sb.append("\"derivedTest\": " + "{\"id\": \"" + getDerivedTest().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getDerivedTest().getId()) + "\",\"displayName\": \"" + getDerivedTest().getName() + "\"}" + ""); } else { sb.append("\"derivedTest\": " + "{\"id\": \"" + getDerivedTest().getId() + "\", \"displayName\": \"" + getDerivedTest().getName() + "\"}" + ""); } } else { sb.append("\"derivedTest\": " + "{\"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("\"metaNodeId\": \"" + getMetaNode().getId() + "\", "); sb.append("\"name\": " + (getName() != null ? "\"" + StringEscapeUtils.escapeJson(getName()) + "\"" : null )); sb.append(", "); if ( getOclTest2() != null ) { if ( UmlgTmpIdManager.INSTANCE.get(getOclTest2().getId()) != null ) { sb.append("\"oclTest2\": " + "{\"id\": \"" + getOclTest2().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getOclTest2().getId()) + "\",\"displayName\": \"" + getOclTest2().getName() + "\"}" + ""); } else { sb.append("\"oclTest2\": " + "{\"id\": \"" + getOclTest2().getId() + "\", \"displayName\": \"" + getOclTest2().getName() + "\"}" + ""); } } else { sb.append("\"oclTest2\": " + "{\"id\": " + null + ", \"displayName\": " + null + "}"); } sb.append(", "); if ( getDerivedTest() != null ) { if ( UmlgTmpIdManager.INSTANCE.get(getDerivedTest().getId()) != null ) { sb.append("\"derivedTest\": " + "{\"id\": \"" + getDerivedTest().getId() + "\", \"tmpId\": \"" + UmlgTmpIdManager.INSTANCE.get(getDerivedTest().getId()) + "\",\"displayName\": \"" + getDerivedTest().getName() + "\"}" + ""); } else { sb.append("\"derivedTest\": " + "{\"id\": \"" + getDerivedTest().getId() + "\", \"displayName\": \"" + getDerivedTest().getName() + "\"}" + ""); } } else { sb.append("\"derivedTest\": " + "{\"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 toJsonWithoutCompositeParent() { return toJsonWithoutCompositeParent(false); } @Override public List validateMultiplicities() { List result = new ArrayList(); if ( getName() == null ) { result.add(new UmlgConstraintViolation("multiplicity", "testoclmodel::org::umlg::testocl::OclTestCollection::name", "lower multiplicity is 1")); } if ( getOclTest1() == null ) { result.add(new UmlgConstraintViolation("multiplicity", "testoclmodel::org::umlg::testocl::A__::oclTest1", "lower multiplicity is 1")); } return result; } public List validateName(String name) { List result = new ArrayList(); return result; } static public enum OclTestCollectionRuntimePropertyEnum implements UmlgRuntimeProperty { name(/* qualifiedName */ "testoclmodel::org::umlg::testocl::OclTestCollection::name",/* persistentName */ "name",/* inverseName */ "inverseOf::name",/* inverseQualifiedName */ "inverseOf::testoclmodel::org::umlg::testocl::OclTestCollection::name",/* isAssociationClassOne */ false,/* isMemberEndOfAssociationClass */ false,/* associationClassPropertyNameField */ "null",/* inverseAssociationClassPropertyNameField */ "null",/* isAssociationClassProperty */ false,/* isOnePrimitivePropertyOfAssociationClass */ false,/* isOnePrimitive */ true,/* isReadOnly */ false,/* dataTypeEnum */ null,/* validations */ Collections.emptyList(),/* isManyPrimitive */ false,/* oneEnumeration */ false,/* manyEnumeration */ false,/* isControllingSide */ true,/* isComposite */ false,/* isInverseComposite */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("name"),/* 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 */ false,/* isDerived */ false,/* isNavigable */ true,/* propertyType */ String.class,/* json */ "{\"name\": \"name\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": true, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"testoclmodel::org::umlg::testocl::OclTestCollection::name\", \"persistentName\": \"name\", \"inverseName\": \"inverseOf::name\", \"inverseQualifiedName\": \"inverseOf::testoclmodel::org::umlg::testocl::OclTestCollection::name\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": false, \"controllingSide\": true, \"composite\": false, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": false, \"manyToOne\": true, \"manyToMany\": false, \"upper\": 1, \"lower\": 1, \"inverseUpper\": 1, \"label\": \"name\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": false, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false), oclTest2(/* qualifiedName */ "testoclmodel::org::umlg::testocl::A__::oclTest2",/* persistentName */ "oclTest2",/* inverseName */ "oclTestCollection",/* inverseQualifiedName */ "testoclmodel::org::umlg::testocl::OclTest2::oclTestCollection",/* 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 */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("A__"),/* isOneToOne */ false,/* isOneToMany */ false,/* isManyToOne */ true,/* 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 */ OclTest2.class,/* json */ "{\"name\": \"oclTest2\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"testoclmodel::org::umlg::testocl::A__::oclTest2\", \"persistentName\": \"oclTest2\", \"inverseName\": \"oclTestCollection\", \"inverseQualifiedName\": \"testoclmodel::org::umlg::testocl::OclTest2::oclTestCollection\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": false, \"controllingSide\": false, \"composite\": false, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": false, \"manyToOne\": true, \"manyToMany\": false, \"upper\": 1, \"lower\": 0, \"inverseUpper\": -1, \"label\": \"A__\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": true, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false), oclTestCollection2(/* qualifiedName */ "testoclmodel::org::umlg::testocl::OclTestCollection::oclTestCollection2",/* persistentName */ "oclTestCollection2",/* inverseName */ "oclTestCollection",/* inverseQualifiedName */ "testoclmodel::org::umlg::testocl::A__::oclTestCollection",/* 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 */ true,/* isComposite */ true,/* isInverseComposite */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("A__"),/* 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 */ OclTestCollection2.class,/* json */ "{\"name\": \"oclTestCollection2\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"testoclmodel::org::umlg::testocl::OclTestCollection::oclTestCollection2\", \"persistentName\": \"oclTestCollection2\", \"inverseName\": \"oclTestCollection\", \"inverseQualifiedName\": \"testoclmodel::org::umlg::testocl::A__::oclTestCollection\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": false, \"controllingSide\": true, \"composite\": true, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": true, \"manyToOne\": false, \"manyToMany\": false, \"upper\": -1, \"lower\": 0, \"inverseUpper\": 1, \"label\": \"A__\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": true, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false), oclTest1(/* qualifiedName */ "testoclmodel::org::umlg::testocl::A__::oclTest1",/* persistentName */ "oclTest1",/* inverseName */ "oclTestCollection",/* inverseQualifiedName */ "testoclmodel::org::umlg::testocl::OclTest1::oclTestCollection",/* 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("A__"),/* 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 */ false,/* isDerived */ false,/* isNavigable */ true,/* propertyType */ OclTest1.class,/* json */ "{\"name\": \"oclTest1\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": false, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"testoclmodel::org::umlg::testocl::A__::oclTest1\", \"persistentName\": \"oclTest1\", \"inverseName\": \"oclTestCollection\", \"inverseQualifiedName\": \"testoclmodel::org::umlg::testocl::OclTest1::oclTestCollection\", \"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\": \"A__\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": false, \"derived\": false, \"navigable\": true}",/* isChangeListenerAttribute */ false), derivedTest(/* qualifiedName */ "testoclmodel::org::umlg::testocl::OclTestCollection::derivedTest",/* persistentName */ "derivedTest",/* inverseName */ "inverseOf::derivedTest",/* inverseQualifiedName */ "inverseOf::testoclmodel::org::umlg::testocl::OclTestCollection::derivedTest",/* isAssociationClassOne */ false,/* isMemberEndOfAssociationClass */ false,/* associationClassPropertyNameField */ "null",/* inverseAssociationClassPropertyNameField */ "null",/* isAssociationClassProperty */ false,/* isOnePrimitivePropertyOfAssociationClass */ false,/* isOnePrimitive */ false,/* isReadOnly */ true,/* dataTypeEnum */ null,/* validations */ Collections.emptyList(),/* isManyPrimitive */ false,/* oneEnumeration */ false,/* manyEnumeration */ false,/* isControllingSide */ true,/* isComposite */ false,/* isInverseComposite */ false,/* label */ UmlgLabelConverterFactory.getUmlgLabelConverter().convert("derivedTest"),/* 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 */ false,/* isDerived */ true,/* isNavigable */ true,/* propertyType */ OclTest2.class,/* json */ "{\"name\": \"derivedTest\", \"associationClassOne\": false, \"memberEndOfAssociationClass\": false, \"associationClassPropertyName\": null, \"inverseAssociationClassPropertyName\": null, \"associationClassProperty\": false, \"onePrimitivePropertyOfAssociationClass\": false, \"onePrimitive\": false, \"readOnly\": true, \"dataTypeEnum\": null, \"validations\": null, \"qualifiedName\": \"testoclmodel::org::umlg::testocl::OclTestCollection::derivedTest\", \"persistentName\": \"derivedTest\", \"inverseName\": \"inverseOf::derivedTest\", \"inverseQualifiedName\": \"inverseOf::testoclmodel::org::umlg::testocl::OclTestCollection::derivedTest\", \"manyPrimitive\": false, \"oneEnumeration\": false, \"manyEnumeration\": false, \"controllingSide\": true, \"composite\": false, \"inverseComposite\": false, \"oneToOne\": false, \"oneToMany\": false, \"manyToOne\": true, \"manyToMany\": false, \"upper\": 1, \"lower\": 1, \"inverseUpper\": 1, \"label\": \"derivedTest\", \"qualified\": false, \"inverseQualified\": false, \"ordered\": false, \"inverseOrdered\": false, \"unique\": true, \"inverseUnique\": false, \"derived\": true, \"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 OclTestCollectionRuntimePropertyEnum * * @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 OclTestCollectionRuntimePropertyEnum(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\": \"OclTestCollection\", "); sb.append("\"qualifiedName\": \"testoclmodel::org::umlg::testocl::OclTestCollection\", "); sb.append("\"uri\": \"TODO\", "); sb.append("\"properties\": ["); for ( OclTestCollectionRuntimePropertyEnum l : OclTestCollectionRuntimePropertyEnum.values() ) { sb.append(l.toJson()); if ( count < OclTestCollectionRuntimePropertyEnum.values().length ) { count++; sb.append(","); } } sb.append("]}"); return sb.toString(); } static public OclTestCollectionRuntimePropertyEnum fromInverseQualifiedName(String inverseQualifiedName) { if ( derivedTest.getInverseQualifiedName().equals(inverseQualifiedName) ) { return derivedTest; } if ( oclTest1.getInverseQualifiedName().equals(inverseQualifiedName) ) { return oclTest1; } if ( oclTestCollection2.getInverseQualifiedName().equals(inverseQualifiedName) ) { return oclTestCollection2; } if ( oclTest2.getInverseQualifiedName().equals(inverseQualifiedName) ) { return oclTest2; } if ( name.getInverseQualifiedName().equals(inverseQualifiedName) ) { return name; } return null; } static public OclTestCollectionRuntimePropertyEnum fromLabel(String _label) { if ( derivedTest.getLabel().equals(_label) ) { return derivedTest; } if ( oclTest1.getLabel().equals(_label) ) { return oclTest1; } if ( oclTestCollection2.getLabel().equals(_label) ) { return oclTestCollection2; } if ( oclTest2.getLabel().equals(_label) ) { return oclTest2; } if ( name.getLabel().equals(_label) ) { return name; } return null; } static public OclTestCollectionRuntimePropertyEnum fromQualifiedName(String qualifiedName) { if ( derivedTest.getQualifiedName().equals(qualifiedName) ) { return derivedTest; } if ( oclTest1.getQualifiedName().equals(qualifiedName) ) { return oclTest1; } if ( oclTestCollection2.getQualifiedName().equals(qualifiedName) ) { return oclTestCollection2; } if ( oclTest2.getQualifiedName().equals(qualifiedName) ) { return oclTest2; } if ( name.getQualifiedName().equals(qualifiedName) ) { return name; } 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