Search in sources :

Example 1 with EdmmConverter

use of org.eclipse.winery.edmm.model.EdmmConverter in project winery by eclipse.

the class RestUtils method getEdmmEntityGraph.

public static EntityGraph getEdmmEntityGraph(TServiceTemplate element, boolean useAbsolutPaths) {
    IRepository repository = RepositoryFactory.getRepository();
    Map<QName, TNodeType> nodeTypes = repository.getQNameToElementMapping(NodeTypeId.class);
    Map<QName, TRelationshipType> relationshipTypes = repository.getQNameToElementMapping(RelationshipTypeId.class);
    Map<QName, TNodeTypeImplementation> nodeTypeImplementations = repository.getQNameToElementMapping(NodeTypeImplementationId.class);
    Map<QName, TRelationshipTypeImplementation> relationshipTypeImplementations = repository.getQNameToElementMapping(RelationshipTypeImplementationId.class);
    Map<QName, TArtifactTemplate> artifactTemplates = repository.getQNameToElementMapping(ArtifactTemplateId.class);
    EdmmManager edmmManager = EdmmManager.forRepository(repository);
    Map<QName, EdmmType> oneToOneMappings = edmmManager.getOneToOneMap();
    Map<QName, EdmmType> typeMappings = edmmManager.getTypeMap();
    if (nodeTypes.isEmpty()) {
        throw new IllegalStateException("No Node Types defined!");
    } else if (relationshipTypes.isEmpty()) {
        throw new IllegalStateException("No Relationship Types defined!");
    }
    EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, typeMappings, oneToOneMappings, useAbsolutPaths);
    return edmmConverter.transform(element);
}
Also used : QName(javax.xml.namespace.QName) TArtifactTemplate(org.eclipse.winery.model.tosca.TArtifactTemplate) TNodeTypeImplementation(org.eclipse.winery.model.tosca.TNodeTypeImplementation) TNodeType(org.eclipse.winery.model.tosca.TNodeType) TRelationshipType(org.eclipse.winery.model.tosca.TRelationshipType) EdmmType(org.eclipse.winery.edmm.model.EdmmType) TRelationshipTypeImplementation(org.eclipse.winery.model.tosca.TRelationshipTypeImplementation) EdmmConverter(org.eclipse.winery.edmm.model.EdmmConverter) EdmmManager(org.eclipse.winery.edmm.EdmmManager) IRepository(org.eclipse.winery.repository.backend.IRepository)

Aggregations

QName (javax.xml.namespace.QName)1 EdmmManager (org.eclipse.winery.edmm.EdmmManager)1 EdmmConverter (org.eclipse.winery.edmm.model.EdmmConverter)1 EdmmType (org.eclipse.winery.edmm.model.EdmmType)1 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)1 TNodeType (org.eclipse.winery.model.tosca.TNodeType)1 TNodeTypeImplementation (org.eclipse.winery.model.tosca.TNodeTypeImplementation)1 TRelationshipType (org.eclipse.winery.model.tosca.TRelationshipType)1 TRelationshipTypeImplementation (org.eclipse.winery.model.tosca.TRelationshipTypeImplementation)1 IRepository (org.eclipse.winery.repository.backend.IRepository)1