Search in sources :

Example 6 with IAssociationRelationship

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());
}
Also used : IAssociationRelationship(com.archimatetool.model.IAssociationRelationship) Test(org.junit.Test)

Example 7 with IAssociationRelationship

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;
}
Also used : IInfluenceRelationship(com.archimatetool.model.IInfluenceRelationship) IAssociationRelationship(com.archimatetool.model.IAssociationRelationship) IArchimateElement(com.archimatetool.model.IArchimateElement) Element(org.jdom2.Element)

Example 8 with IAssociationRelationship

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();
}
Also used : IAssociationRelationship(com.archimatetool.model.IAssociationRelationship)

Aggregations

IAssociationRelationship (com.archimatetool.model.IAssociationRelationship)8 IInfluenceRelationship (com.archimatetool.model.IInfluenceRelationship)4 IAccessRelationship (com.archimatetool.model.IAccessRelationship)3 Test (org.junit.Test)3 IArchimateConcept (com.archimatetool.model.IArchimateConcept)2 IArchimateElement (com.archimatetool.model.IArchimateElement)2 IBusinessActor (com.archimatetool.model.IBusinessActor)2 IDiagramModelArchimateConnection (com.archimatetool.model.IDiagramModelArchimateConnection)2 IDiagramModelArchimateObject (com.archimatetool.model.IDiagramModelArchimateObject)2 IFolder (com.archimatetool.model.IFolder)2 Element (org.jdom2.Element)2 CSVParseException (com.archimatetool.csv.CSVParseException)1 IAggregationRelationship (com.archimatetool.model.IAggregationRelationship)1 IArchimateRelationship (com.archimatetool.model.IArchimateRelationship)1 IAssignmentRelationship (com.archimatetool.model.IAssignmentRelationship)1 ICompositionRelationship (com.archimatetool.model.ICompositionRelationship)1 IDiagramModelGroup (com.archimatetool.model.IDiagramModelGroup)1 IFlowRelationship (com.archimatetool.model.IFlowRelationship)1 IJunction (com.archimatetool.model.IJunction)1 IProperties (com.archimatetool.model.IProperties)1