public RelationshipInstanceGroup whereEitherEndIs(PortInstance<? extends Port> port) { final RelationshipInstanceGroup selection = new RelationshipInstanceGroup(); for (RelationshipInstance instance: this) { if (instance.eitherEndIs(port)) { selection.add(instance); } } return selection; }
public RelationshipInstanceGroup ofType(String name) { final RelationshipInstanceGroup selection = new RelationshipInstanceGroup(); for (RelationshipInstance instance: this) { if (instance.getType().isNamed(name)) { selection.add(instance); } } return selection; }
@Override public boolean add(RelationshipInstance instance) { if (firstNamed(instance.getName()) != null) { //final String error = String.format("Relationship instance name must be unique! There is already a relationhip instance named '%s'.", instance.getName()); //throw new IllegalStateException(error); return false; } instance.getOwner().set(Deployment.this); return super.add(instance); }
public boolean replace(RelationshipInstance relationship){ if (firstNamed(relationship.getName()) != null) { super.remove(relationship); } relationship.getOwner().set(Deployment.this); return super.add(relationship); }
public void relationshipInstanceToPOJO(net.cloudml.core.RelationshipInstance kRelationshipInstance) { checkForNull(kRelationshipInstance, "Cannot convert null!"); if (kRelationshipInstance.getRequiredPortInstance() == null) { throw new IllegalArgumentException("a relationship instance required at least a required port instance"); } if (kRelationshipInstance.getProvidedPortInstance() == null) { throw new IllegalArgumentException("a relationship instance required at least a provided port instance"); } net.cloudml.core.RequiredPortInstance r = kRelationshipInstance.getRequiredPortInstance(); net.cloudml.core.ProvidedPortInstance p = kRelationshipInstance.getProvidedPortInstance(); if (r.getName() == null) { throw new IllegalArgumentException("Required port need a name"); } if (p.getName() == null) { throw new IllegalArgumentException("Provided port need a name"); } RelationshipInstance b = new RelationshipInstance(kRelationshipInstance.getName(), requiredPortInstances.get(r.getName()), providedPortInstances.get(p.getName()), relationships.get(kRelationshipInstance.getType().getName())); model.getRelationshipInstances().add(b); }
@Override public void integrateIn(Deployment container) { final RelationshipInstance relationship = new RelationshipInstance(getName(), findClientPort(container), findServerPort(container), findType(container)); super.prepare(relationship); container.getRelationshipInstances().add(relationship); }
if (b.getName().equals(nodeType)) { RelationshipInstance bi = b.instantiates(nodeType + cnt); dm.getRelationshipInstances().add(bi); Edge edge; if (b.getRequiredEnd().isOptional()) {