Search in sources :

Example 1 with EdmmType

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

the class EdmmUtils method getToscaLightChecker.

public static ToscaLightChecker getToscaLightChecker() {
    IRepository repository = RepositoryFactory.getRepository();
    Map<QName, TRelationshipType> relationshipTypes = repository.getQNameToElementMapping(RelationshipTypeId.class);
    Map<QName, TNodeType> nodeTypes = repository.getQNameToElementMapping(NodeTypeId.class);
    Map<QName, EdmmType> typeMap = EdmmManager.forRepository(repository).getTypeMap();
    Map<QName, EdmmType> oneToOneMap = EdmmManager.forRepository(repository).getOneToOneMap();
    return new ToscaLightChecker(nodeTypes, relationshipTypes, typeMap, oneToOneMap);
}
Also used : TRelationshipType(org.eclipse.winery.model.tosca.TRelationshipType) EdmmType(org.eclipse.winery.edmm.model.EdmmType) QName(javax.xml.namespace.QName) IRepository(org.eclipse.winery.repository.backend.IRepository) TNodeType(org.eclipse.winery.model.tosca.TNodeType) ToscaLightChecker(org.eclipse.winery.edmm.toscalight.ToscaLightChecker)

Example 2 with EdmmType

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

the class EdmmResource method getOneToOneMap.

@GET
@Path("one-to-one-map")
@Produces(MediaType.APPLICATION_JSON)
public Response getOneToOneMap() {
    IRepository repository = RepositoryFactory.getRepository();
    EdmmManager edmmManager = EdmmManager.forRepository(repository);
    Map<QName, EdmmType> oneToOneMap = edmmManager.getOneToOneMap();
    Map<String, String> reverseOneToOneMap = new HashMap<>();
    for (Map.Entry<QName, EdmmType> entry : oneToOneMap.entrySet()) {
        EdmmType edmmType = entry.getValue();
        reverseOneToOneMap.put(edmmType.getValue(), entry.getKey().getLocalPart());
    }
    return Response.ok().type(MediaType.APPLICATION_JSON).entity(reverseOneToOneMap).build();
}
Also used : EdmmType(org.eclipse.winery.edmm.model.EdmmType) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) EdmmManager(org.eclipse.winery.edmm.EdmmManager) IRepository(org.eclipse.winery.repository.backend.IRepository) Map(java.util.Map) HashMap(java.util.HashMap) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with EdmmType

use of org.eclipse.winery.edmm.model.EdmmType 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)3 EdmmType (org.eclipse.winery.edmm.model.EdmmType)3 IRepository (org.eclipse.winery.repository.backend.IRepository)3 EdmmManager (org.eclipse.winery.edmm.EdmmManager)2 TNodeType (org.eclipse.winery.model.tosca.TNodeType)2 TRelationshipType (org.eclipse.winery.model.tosca.TRelationshipType)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 EdmmConverter (org.eclipse.winery.edmm.model.EdmmConverter)1 ToscaLightChecker (org.eclipse.winery.edmm.toscalight.ToscaLightChecker)1 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)1 TNodeTypeImplementation (org.eclipse.winery.model.tosca.TNodeTypeImplementation)1 TRelationshipTypeImplementation (org.eclipse.winery.model.tosca.TRelationshipTypeImplementation)1