use of com.archimatetool.model.IAssociationRelationship in project archi by archimatetool.
the class AllArchimateRelationshipTypeTests method testAssociation_Directed.
// Association Relationship Directed
@Test
public void testAssociation_Directed() {
// Only IAssociationRelationship type
Assume.assumeTrue(relationship instanceof IAssociationRelationship);
IAssociationRelationship aRelationship = (IAssociationRelationship) relationship;
assertFalse(aRelationship.isDirected());
aRelationship.setDirected(true);
assertTrue(aRelationship.isDirected());
}
use of com.archimatetool.model.IAssociationRelationship in project archi by archimatetool.
the class XMLModelExporter method writeModelRelationship.
/**
* Write a relationship
*/
Element writeModelRelationship(IArchimateRelationship relationship, Element relationshipsElement) {
Element relationshipElement = new Element(ELEMENT_RELATIONSHIP, ARCHIMATE3_NAMESPACE);
relationshipsElement.addContent(relationshipElement);
// Identifier
relationshipElement.setAttribute(ATTRIBUTE_IDENTIFIER, checkID(relationship));
// Source ID
relationshipElement.setAttribute(ATTRIBUTE_SOURCE, checkID(relationship.getSource()));
// Target ID
relationshipElement.setAttribute(ATTRIBUTE_TARGET, checkID(relationship.getTarget()));
// Type
relationshipElement.setAttribute(ATTRIBUTE_TYPE, XMLTypeMapper.getArchimateConceptName(relationship), JDOMUtils.XSI_Namespace);
// Influence Modifier/Strength
if (relationship.eClass() == IArchimatePackage.eINSTANCE.getInfluenceRelationship()) {
String strength = ((IInfluenceRelationship) relationship).getStrength();
if (hasSomeText(strength)) {
relationshipElement.setAttribute(ATTRIBUTE_INFLUENCE_MODIFIER, strength);
}
} else // Access direction
if (relationship.eClass() == IArchimatePackage.eINSTANCE.getAccessRelationship()) {
int accessType = ((IAccessRelationship) relationship).getAccessType();
switch(accessType) {
case IAccessRelationship.READ_ACCESS:
relationshipElement.setAttribute(ATTRIBUTE_ACCESS_TYPE, ACCESS_TYPE_READ);
break;
case IAccessRelationship.READ_WRITE_ACCESS:
relationshipElement.setAttribute(ATTRIBUTE_ACCESS_TYPE, ACCESS_TYPE_READ_WRITE);
break;
case IAccessRelationship.UNSPECIFIED_ACCESS:
relationshipElement.setAttribute(ATTRIBUTE_ACCESS_TYPE, ACCESS_TYPE_ACCESS);
break;
default:
relationshipElement.setAttribute(ATTRIBUTE_ACCESS_TYPE, ACCESS_TYPE_WRITE);
break;
}
} else // Association Directed
if (relationship.eClass() == IArchimatePackage.eINSTANCE.getAssociationRelationship()) {
if (((IAssociationRelationship) relationship).isDirected()) {
// $NON-NLS-1$
relationshipElement.setAttribute(ATTRIBUTE_ASSOCIATION_DIRECTED, "true");
}
}
// Name - optional
writeTextToElement(relationship.getName(), relationshipElement, ELEMENT_NAME, false);
// Documentation - optional
writeTextToElement(relationship.getDocumentation(), relationshipElement, ELEMENT_DOCUMENTATION, false);
// Properties
writeProperties(relationship, relationshipElement);
return relationshipElement;
}
use of com.archimatetool.model.IAssociationRelationship in project archi by archimatetool.
the class AssociationConnectionFigure method refreshVisuals.
@Override
public void refreshVisuals() {
// Access type
IAssociationRelationship relation = (IAssociationRelationship) getModelConnection().getArchimateRelationship();
if (relation.isDirected()) {
// half-arrow at target endpoint
setTargetDecoration(fDecoratorTarget);
} else {
setTargetDecoration(null);
}
// This last
super.refreshVisuals();
}
Aggregations