use of org.eclipse.winery.edmm.toscalight.ToscaLightChecker in project winery by eclipse.
the class EdmmUtils method getAllToscaLightCompliantModels.
public static Map<QName, TServiceTemplate> getAllToscaLightCompliantModels() {
Map<QName, TServiceTemplate> serviceTemplates = RepositoryFactory.getRepository().getQNameToElementMapping(ServiceTemplateId.class);
ToscaLightChecker toscaLightChecker = EdmmUtils.getToscaLightChecker();
return serviceTemplates.entrySet().stream().filter(entry -> toscaLightChecker.isToscaLightCompliant(entry.getValue())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
use of org.eclipse.winery.edmm.toscalight.ToscaLightChecker in project winery by eclipse.
the class EdmmUtils method checkToscaLightCompatibility.
public static Map<String, Object> checkToscaLightCompatibility(TServiceTemplate serviceTemplate) {
ToscaLightChecker toscaLightChecker = getToscaLightChecker();
boolean toscaLightCompliant = toscaLightChecker.isToscaLightCompliant(serviceTemplate);
Map<QName, List<String>> errorList = toscaLightChecker.getErrorList();
errorList.entrySet().removeIf(entry -> entry.getValue().isEmpty());
HashMap<String, Object> map = new HashMap<>();
map.put("isToscaLightCompatible", toscaLightCompliant);
map.put("errorList", errorList);
return map;
}
use of org.eclipse.winery.edmm.toscalight.ToscaLightChecker 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);
}
Aggregations