net.sf.nakeduml.userinteractionmetamodel.ClassifierUserInteraction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metamodel Show documentation
Show all versions of metamodel Show documentation
A uml code generator and execution engine
The newest version!
package net.sf.nakeduml.userinteractionmetamodel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.sf.nakeduml.domainmetamodel.DomainClassifier;
import net.sf.nakeduml.domainmetamodel.DomainEntity;
import net.sf.nakeduml.util.CompositionNode;
import util.CompOperationNavigationOndouble;
import util.CompPropertyFieldOndouble;
import util.CompPropertyNavigationOndouble;
import util.Stdlib;
public class ClassifierUserInteraction extends UserInteraction implements CompositionNode {
private AbstractUserInteractionFolder folder;
private Boolean isTooMany = false;
private PropertyNavigation originatingPropertyNavigation;
private Set participationGroup = new HashSet();
private Set ownedOperationNavigation = new HashSet();
private ClassifierUserInteraction superClassifierUserInteraction;
private Boolean isCustom = false;
private Set ownedPropertyNavigation = new HashSet();
private UserInteractionKind userInteractionKind;
private Set ownedPropertyField = new HashSet();
/** Default constructor for
*/
public ClassifierUserInteraction() {
}
/** This constructor is intended for easy initialization in unit tests
*
* @param owningObject
*/
public ClassifierUserInteraction(AbstractUserInteractionFolder owningObject) {
init(owningObject);
addToOwningObject();
}
public void addAllToOwnedOperationNavigation(Set ownedOperationNavigation) {
for ( OperationNavigation o : ownedOperationNavigation ) {
addToOwnedOperationNavigation(o);
}
}
public void addAllToOwnedPropertyField(Set ownedPropertyField) {
for ( PropertyField o : ownedPropertyField ) {
addToOwnedPropertyField(o);
}
}
public void addAllToOwnedPropertyNavigation(Set ownedPropertyNavigation) {
for ( PropertyNavigation o : ownedPropertyNavigation ) {
addToOwnedPropertyNavigation(o);
}
}
public void addAllToParticipationGroup(Set participationGroup) {
for ( ParticipationGroup o : participationGroup ) {
addToParticipationGroup(o);
}
}
public void addToOwnedOperationNavigation(OperationNavigation ownedOperationNavigation) {
ownedOperationNavigation.setClassifierUserInteraction(this);
}
public void addToOwnedPropertyField(PropertyField ownedPropertyField) {
ownedPropertyField.setClassifierUserInteraction(this);
}
public void addToOwnedPropertyNavigation(PropertyNavigation ownedPropertyNavigation) {
ownedPropertyNavigation.setClassifierUserInteraction(this);
}
/** Call this method when you want to attach this object to the containment tree. Useful with transitive persistence
*/
public void addToOwningObject() {
getFolder().getEntityUserInteraction().add((ClassifierUserInteraction)this);
}
public void addToParticipationGroup(ParticipationGroup participationGroup) {
participationGroup.setClassifierUserInteraction(this);
}
public void clearOwnedOperationNavigation() {
removeAllFromOwnedOperationNavigation(getOwnedOperationNavigation());
}
public void clearOwnedPropertyField() {
removeAllFromOwnedPropertyField(getOwnedPropertyField());
}
public void clearOwnedPropertyNavigation() {
removeAllFromOwnedPropertyNavigation(getOwnedPropertyNavigation());
}
public void clearParticipationGroup() {
removeAllFromParticipationGroup(getParticipationGroup());
}
public OperationNavigation createOwnedOperationNavigation() {
OperationNavigation newInstance= new OperationNavigation();
newInstance.init(this);
return newInstance;
}
public PropertyField createOwnedPropertyField() {
PropertyField newInstance= new PropertyField();
newInstance.init(this);
return newInstance;
}
public PropertyNavigation createOwnedPropertyNavigation() {
PropertyNavigation newInstance= new PropertyNavigation();
newInstance.init(this);
return newInstance;
}
public ParticipationGroup createParticipationGroup() {
ParticipationGroup newInstance= new ParticipationGroup();
newInstance.init(this);
return newInstance;
}
public List getActionNavigation() {
List actionNavigation = (List)select2();
return actionNavigation;
}
public List getChildNavigation() {
List childNavigation = (List)select3();
return childNavigation;
}
public DomainClassifier getClassifier() {
DomainClassifier classifier = ((DomainEntity) this.getRepresentedElement());
return classifier;
}
public AbstractUserInteractionFolder getFolder() {
AbstractUserInteractionFolder folderSubsetting = null;
if ( this.folder!=null ) {
folderSubsetting=this.folder;
}
return folderSubsetting;
}
public List getLinkNavigation() {
List linkNavigation = (List)select9();
return linkNavigation;
}
public List getOperationNavigation() {
List operationNavigation = (List)((this.getSuperClassifierUserInteraction() == null) ?
(Collection)sortedBy5() :
(Collection)sortedBy7());
return operationNavigation;
}
public PropertyNavigation getOriginatingPropertyNavigation() {
return originatingPropertyNavigation;
}
public Set getOriginatingPropertyNavigationSourcePopulation() {
return new HashSet(Stdlib.collectionAsSet(this.getOwnedPropertyNavigation()));
}
public Set getOwnedElement() {
Set ownedElementSubsetting = new HashSet();
ownedElementSubsetting.addAll(super.getOwnedElement());
ownedElementSubsetting.addAll(getParticipationGroup());
ownedElementSubsetting.addAll(getOwnedOperationNavigation());
ownedElementSubsetting.addAll(getOwnedPropertyNavigation());
ownedElementSubsetting.addAll(getOwnedPropertyField());
return ownedElementSubsetting;
}
public Set getOwnedOperationNavigation() {
return ownedOperationNavigation;
}
public Set getOwnedPropertyField() {
return ownedPropertyField;
}
public Set getOwnedPropertyNavigation() {
return ownedPropertyNavigation;
}
public UserInteractionElement getOwner() {
UserInteractionElement ownerSubsetting = null;
ownerSubsetting=super.getOwner();
if ( getFolder()!=null ) {
ownerSubsetting=getFolder();
}
return ownerSubsetting;
}
public CompositionNode getOwningObject() {
return getFolder();
}
public Set getParticipationGroup() {
return participationGroup;
}
public List getPropertyField() {
List propertyField = (List)sortedBy8();
return propertyField;
}
public List getPropertyNavigation() {
List propertyNavigation = (List)sortedBy1();
return propertyNavigation;
}
public List getQueryNavigation() {
List queryNavigation = (List)select4();
return queryNavigation;
}
public ClassifierUserInteraction getSuperClassifierUserInteraction() {
return superClassifierUserInteraction;
}
public Set getSuperClassifierUserInteractionSourcePopulation() {
return new HashSet(Stdlib.collectionAsSet(this.getFolder().getEntityUserInteraction()));
}
public UserInteractionKind getUserInteractionKind() {
return userInteractionKind;
}
public void init(CompositionNode owner) {
super.init(owner);
internalSetOwner((AbstractUserInteractionFolder)owner);
this.setCustom( false );
createComponents();
}
public Boolean isCustom() {
return isCustom;
}
public Boolean isTooMany() {
return isTooMany;
}
public void markDeleted() {
super.markDeleted();
if ( getFolder()!=null ) {
getFolder().getEntityUserInteraction().remove((ClassifierUserInteraction)this);
}
for ( ParticipationGroup child : new ArrayList(getParticipationGroup()) ) {
child.markDeleted();
}
for ( OperationNavigation child : new ArrayList(getOwnedOperationNavigation()) ) {
child.markDeleted();
}
for ( PropertyField child : new ArrayList(getOwnedPropertyField()) ) {
child.markDeleted();
}
for ( PropertyNavigation child : new ArrayList(getOwnedPropertyNavigation()) ) {
child.markDeleted();
}
}
public void removeAllFromOwnedOperationNavigation(Set ownedOperationNavigation) {
for ( OperationNavigation o : ownedOperationNavigation ) {
removeFromOwnedOperationNavigation(o);
}
}
public void removeAllFromOwnedPropertyField(Set ownedPropertyField) {
for ( PropertyField o : ownedPropertyField ) {
removeFromOwnedPropertyField(o);
}
}
public void removeAllFromOwnedPropertyNavigation(Set ownedPropertyNavigation) {
for ( PropertyNavigation o : ownedPropertyNavigation ) {
removeFromOwnedPropertyNavigation(o);
}
}
public void removeAllFromParticipationGroup(Set participationGroup) {
for ( ParticipationGroup o : participationGroup ) {
removeFromParticipationGroup(o);
}
}
public void removeFromOwnedOperationNavigation(OperationNavigation ownedOperationNavigation) {
ownedOperationNavigation.setClassifierUserInteraction(null);
}
public void removeFromOwnedPropertyField(PropertyField ownedPropertyField) {
ownedPropertyField.setClassifierUserInteraction(null);
}
public void removeFromOwnedPropertyNavigation(PropertyNavigation ownedPropertyNavigation) {
ownedPropertyNavigation.setClassifierUserInteraction(null);
}
public void removeFromOwningObject() {
this.markDeleted();
}
public void removeFromParticipationGroup(ParticipationGroup participationGroup) {
participationGroup.setClassifierUserInteraction(null);
}
public void setCustom(Boolean isCustom) {
this.isCustom=isCustom;
}
public void setFolder(AbstractUserInteractionFolder folder) {
if ( this.folder!=null ) {
this.folder.getEntityUserInteraction().remove((ClassifierUserInteraction)this);
}
if ( folder!=null ) {
folder.getEntityUserInteraction().add((ClassifierUserInteraction)this);
this.folder=folder;
} else {
this.folder=null;
}
}
public void setOriginatingPropertyNavigation(PropertyNavigation originatingPropertyNavigation) {
this.originatingPropertyNavigation=originatingPropertyNavigation;
}
public void setOwnedOperationNavigation(Set ownedOperationNavigation) {
for ( OperationNavigation o : new HashSet(this.ownedOperationNavigation) ) {
o.setClassifierUserInteraction(null);
}
for ( OperationNavigation o : ownedOperationNavigation ) {
o.setClassifierUserInteraction((ClassifierUserInteraction)this);
}
}
public void setOwnedPropertyField(Set ownedPropertyField) {
for ( PropertyField o : new HashSet(this.ownedPropertyField) ) {
o.setClassifierUserInteraction(null);
}
for ( PropertyField o : ownedPropertyField ) {
o.setClassifierUserInteraction((ClassifierUserInteraction)this);
}
}
public void setOwnedPropertyNavigation(Set ownedPropertyNavigation) {
for ( PropertyNavigation o : new HashSet(this.ownedPropertyNavigation) ) {
o.setClassifierUserInteraction(null);
}
for ( PropertyNavigation o : ownedPropertyNavigation ) {
o.setClassifierUserInteraction((ClassifierUserInteraction)this);
}
}
public void setParticipationGroup(Set participationGroup) {
for ( ParticipationGroup o : new HashSet(this.participationGroup) ) {
o.setClassifierUserInteraction(null);
}
for ( ParticipationGroup o : participationGroup ) {
o.setClassifierUserInteraction((ClassifierUserInteraction)this);
}
}
public void setSuperClassifierUserInteraction(ClassifierUserInteraction superClassifierUserInteraction) {
this.superClassifierUserInteraction=superClassifierUserInteraction;
}
public void setTooMany(Boolean isTooMany) {
this.isTooMany=isTooMany;
}
public void setUserInteractionKind(UserInteractionKind userInteractionKind) {
this.userInteractionKind=userInteractionKind;
}
public String toString() {
StringBuilder sb = new StringBuilder();
if ( getOwner()==null ) {
sb.append("owner=null;");
} else {
sb.append("owner="+getOwner().getClass().getSimpleName()+"[");
sb.append(getOwner().getName());
sb.append("];");
}
sb.append("name=");
sb.append(getName());
sb.append(";");
sb.append("additionalHumanName=");
sb.append(getAdditionalHumanName());
sb.append(";");
sb.append("humanName=");
sb.append(getHumanName());
sb.append(";");
sb.append("qualifiedName=");
sb.append(getQualifiedName());
sb.append(";");
if ( getRepresentedElement()==null ) {
sb.append("representedElement=null;");
} else {
sb.append("representedElement="+getRepresentedElement().getClass().getSimpleName()+"[");
sb.append(getRepresentedElement().getName());
sb.append("];");
}
sb.append("successMessage=");
sb.append(getSuccessMessage());
sb.append(";");
sb.append("instructionToUser=");
sb.append(getInstructionToUser());
sb.append(";");
if ( getFolder()==null ) {
sb.append("folder=null;");
} else {
sb.append("folder="+getFolder().getClass().getSimpleName()+"[");
sb.append(getFolder().getName());
sb.append("];");
}
sb.append("inHierarchy=");
sb.append(getInHierarchy());
sb.append(";");
sb.append("isCustom=");
sb.append(isCustom());
sb.append(";");
sb.append("isTooMany=");
sb.append(isTooMany());
sb.append(";");
if ( getClassifier()==null ) {
sb.append("classifier=null;");
} else {
sb.append("classifier="+getClassifier().getClass().getSimpleName()+"[");
sb.append(getClassifier().getName());
sb.append("];");
}
if ( getFolder()==null ) {
sb.append("folder=null;");
} else {
sb.append("folder="+getFolder().getClass().getSimpleName()+"[");
sb.append(getFolder().getName());
sb.append("];");
}
sb.append("userInteractionKind=");
sb.append(getUserInteractionKind());
sb.append(";");
if ( getOriginatingPropertyNavigation()==null ) {
sb.append("originatingPropertyNavigation=null;");
} else {
sb.append("originatingPropertyNavigation="+getOriginatingPropertyNavigation().getClass().getSimpleName()+"[");
sb.append(getOriginatingPropertyNavigation().getName());
sb.append("];");
}
if ( getSuperClassifierUserInteraction()==null ) {
sb.append("superClassifierUserInteraction=null;");
} else {
sb.append("superClassifierUserInteraction="+getSuperClassifierUserInteraction().getClass().getSimpleName()+"[");
sb.append(getSuperClassifierUserInteraction().getName());
sb.append("];");
}
return sb.toString();
}
public String toXmlString() {
StringBuilder sb = new StringBuilder();
if ( getName()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getName());
sb.append(" ");
sb.append("\n");
}
if ( getAdditionalHumanName()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getAdditionalHumanName());
sb.append(" ");
sb.append("\n");
}
if ( getRepresentedElement()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getRepresentedElement().getClass().getSimpleName());
sb.append("[");
sb.append(getRepresentedElement().getName());
sb.append("]");
sb.append(" ");
sb.append("\n");
}
if ( getSuccessMessage()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getSuccessMessage());
sb.append(" ");
sb.append("\n");
}
if ( getInstructionToUser()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getInstructionToUser());
sb.append(" ");
sb.append("\n");
}
if ( getInHierarchy()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getInHierarchy());
sb.append(" ");
sb.append("\n");
}
if ( isCustom()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(isCustom());
sb.append(" ");
sb.append("\n");
}
if ( isTooMany()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(isTooMany());
sb.append(" ");
sb.append("\n");
}
for ( ParticipationGroup participationGroup : getParticipationGroup() ) {
sb.append("");
sb.append(participationGroup.toXmlString());
sb.append(" ");
sb.append("\n");
}
for ( OperationNavigation ownedOperationNavigation : getOwnedOperationNavigation() ) {
sb.append("");
sb.append(ownedOperationNavigation.toXmlString());
sb.append(" ");
sb.append("\n");
}
for ( PropertyField ownedPropertyField : getOwnedPropertyField() ) {
sb.append("");
sb.append(ownedPropertyField.toXmlString());
sb.append(" ");
sb.append("\n");
}
if ( getFolder()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getFolder().getClass().getSimpleName());
sb.append("[");
sb.append(getFolder().getName());
sb.append("]");
sb.append(" ");
sb.append("\n");
}
if ( getUserInteractionKind()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getUserInteractionKind());
sb.append(" ");
sb.append("\n");
}
for ( PropertyNavigation ownedPropertyNavigation : getOwnedPropertyNavigation() ) {
sb.append("");
sb.append(ownedPropertyNavigation.toXmlString());
sb.append(" ");
sb.append("\n");
}
if ( getOriginatingPropertyNavigation()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getOriginatingPropertyNavigation().getClass().getSimpleName());
sb.append("[");
sb.append(getOriginatingPropertyNavigation().getName());
sb.append("]");
sb.append(" ");
sb.append("\n");
}
if ( getSuperClassifierUserInteraction()==null ) {
sb.append(" ");
} else {
sb.append("");
sb.append(getSuperClassifierUserInteraction().getClass().getSimpleName());
sb.append("[");
sb.append(getSuperClassifierUserInteraction().getName());
sb.append("]");
sb.append(" ");
sb.append("\n");
}
return sb.toString();
}
/** Implements ->select( i_OperationNavigation : OperationNavigation | not i_OperationNavigation.operation.isQuery )
*/
private List select2() {
List result = new ArrayList();
for ( OperationNavigation i_OperationNavigation : this.getOperationNavigation() ) {
if ( !i_OperationNavigation.getOperation().isQuery() ) {
result.add( i_OperationNavigation );
}
}
return result;
}
/** Implements ->select( i_PropertyNavigation : PropertyNavigation | i_PropertyNavigation.property.isComposite )
*/
private List select3() {
List result = new ArrayList();
for ( PropertyNavigation i_PropertyNavigation : this.getPropertyNavigation() ) {
if ( i_PropertyNavigation.getProperty().isComposite() ) {
result.add( i_PropertyNavigation );
}
}
return result;
}
/** Implements ->select( i_OperationNavigation : OperationNavigation | i_OperationNavigation.operation.isQuery )
*/
private List select4() {
List result = new ArrayList();
for ( OperationNavigation i_OperationNavigation : this.getOperationNavigation() ) {
if ( i_OperationNavigation.getOperation().isQuery() ) {
result.add( i_OperationNavigation );
}
}
return result;
}
/** Implements ->select( i_PropertyNavigation : PropertyNavigation | not i_PropertyNavigation.property.isComposite )
*/
private List select9() {
List result = new ArrayList();
for ( PropertyNavigation i_PropertyNavigation : this.getPropertyNavigation() ) {
if ( !i_PropertyNavigation.getProperty().isComposite() ) {
result.add( i_PropertyNavigation );
}
}
return result;
}
/** Implements ->sortedBy( i_PropertyNavigation : PropertyNavigation | i_PropertyNavigation.displayIndex )
*/
private List sortedBy1() {
List result = new ArrayList();
result.addAll(this.getOwnedPropertyNavigation());
// System.out.println("BEFORE SORTING ON i_PropertyNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
// create a new Comparator instance;
Comparator comp = new CompPropertyNavigationOndouble();
// sort the result collection;
Collections.sort(result, comp);
// System.out.println("AFTER SORTING ON i_PropertyNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
return result;
}
/** Implements ->sortedBy( i_OperationNavigation : OperationNavigation | i_OperationNavigation.displayIndex )
*/
private List sortedBy5() {
List result = new ArrayList();
result.addAll(this.getOwnedOperationNavigation());
// System.out.println("BEFORE SORTING ON i_OperationNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
// create a new Comparator instance;
Comparator comp = new CompOperationNavigationOndouble();
// sort the result collection;
Collections.sort(result, comp);
// System.out.println("AFTER SORTING ON i_OperationNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
return result;
}
/** Implements ->sortedBy( i_OperationNavigation : OperationNavigation | i_OperationNavigation.displayIndex )
*/
private List sortedBy7() {
List result = new ArrayList();
result.addAll(union6());
// System.out.println("BEFORE SORTING ON i_OperationNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
// create a new Comparator instance;
Comparator comp = new CompOperationNavigationOndouble();
// sort the result collection;
Collections.sort(result, comp);
// System.out.println("AFTER SORTING ON i_OperationNavigation.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
return result;
}
/** Implements ->sortedBy( i_PropertyField : PropertyField | i_PropertyField.displayIndex )
*/
private List sortedBy8() {
List result = new ArrayList();
result.addAll(this.getOwnedPropertyField());
// System.out.println("BEFORE SORTING ON i_PropertyField.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
// create a new Comparator instance;
Comparator comp = new CompPropertyFieldOndouble();
// sort the result collection;
Collections.sort(result, comp);
// System.out.println("AFTER SORTING ON i_PropertyField.getDisplayIndex()");
// System.out.println(Util.collectionToString(result, "\n"));
return result;
}
/** Implements .union(self.ownedOperationNavigation) on .operationNavigation
*/
private List union6() {
List result = new ArrayList(this.getSuperClassifierUserInteraction().getOperationNavigation());
result.addAll( this.getOwnedOperationNavigation() );
return result;
}
/** Used to set the owner internally in extended composition semantics
*
* @param newOwner
*/
protected void internalSetOwner(AbstractUserInteractionFolder newOwner) {
this.folder=newOwner;
}
public void copyState(ClassifierUserInteraction from, ClassifierUserInteraction to) {
to.setName(from.getName());
to.setAdditionalHumanName(from.getAdditionalHumanName());
to.setRepresentedElement(getRepresentedElement());
to.setSuccessMessage(from.getSuccessMessage());
to.setInstructionToUser(from.getInstructionToUser());
to.setInHierarchy(from.getInHierarchy());
to.setCustom(from.isCustom());
to.setTooMany(from.isTooMany());
for ( ParticipationGroup child : getParticipationGroup() ) {
to.addToParticipationGroup(child.makeCopy());
}
for ( OperationNavigation child : getOwnedOperationNavigation() ) {
to.addToOwnedOperationNavigation(child.makeCopy());
}
for ( PropertyField child : getOwnedPropertyField() ) {
to.addToOwnedPropertyField(child.makeCopy());
}
to.setUserInteractionKind(from.getUserInteractionKind());
for ( PropertyNavigation child : getOwnedPropertyNavigation() ) {
to.addToOwnedPropertyNavigation(child.makeCopy());
}
to.setOriginatingPropertyNavigation(getOriginatingPropertyNavigation());
to.setSuperClassifierUserInteraction(getSuperClassifierUserInteraction());
}
public void createComponents() {
super.createComponents();
}
public ClassifierUserInteraction makeCopy() {
ClassifierUserInteraction result = new ClassifierUserInteraction();
copyState((ClassifierUserInteraction)this,result);
return result;
}
public void shallowCopyState(ClassifierUserInteraction from, ClassifierUserInteraction to) {
to.setName(from.getName());
to.setAdditionalHumanName(from.getAdditionalHumanName());
to.setRepresentedElement(getRepresentedElement());
to.setSuccessMessage(from.getSuccessMessage());
to.setInstructionToUser(from.getInstructionToUser());
to.setInHierarchy(from.getInHierarchy());
to.setCustom(from.isCustom());
to.setTooMany(from.isTooMany());
to.setUserInteractionKind(from.getUserInteractionKind());
to.setOriginatingPropertyNavigation(getOriginatingPropertyNavigation());
to.setSuperClassifierUserInteraction(getSuperClassifierUserInteraction());
}
}