use of org.eclipse.winery.edmm.EdmmManager 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();
}
use of org.eclipse.winery.edmm.EdmmManager 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);
}
Aggregations