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);
}
Aggregations