diff --git a/pom.xml b/pom.xml index 7281847..2f0bb2f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fr.insee.knowledge knowledge - 0.6.0 + 0.7.0 jar Knowledge-Back-Office Back-office services for Knowledge diff --git a/src/main/java/fr/insee/knowledge/StarterApplication.java b/src/main/java/fr/insee/knowledge/StarterApplication.java index 60598c2..8b54b35 100644 --- a/src/main/java/fr/insee/knowledge/StarterApplication.java +++ b/src/main/java/fr/insee/knowledge/StarterApplication.java @@ -37,6 +37,5 @@ public static SpringApplicationBuilder configureApplicationBuilder(SpringApplica @EventListener(ApplicationReadyEvent.class) public void doSomethingAfterStartup() throws IOException { initializer.createCollections(); - initializer.importDataFromGithub(); } } \ No newline at end of file diff --git a/src/main/java/fr/insee/knowledge/controller/errors/ErrorResponse.java b/src/main/java/fr/insee/knowledge/controller/errors/ErrorResponse.java new file mode 100644 index 0000000..80b7474 --- /dev/null +++ b/src/main/java/fr/insee/knowledge/controller/errors/ErrorResponse.java @@ -0,0 +1,19 @@ +package fr.insee.knowledge.controller.errors; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@RequiredArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ErrorResponse { + private final int status; + private final String message; + private final List errors; +} + diff --git a/src/main/java/fr/insee/knowledge/controller/function/FunctionController.java b/src/main/java/fr/insee/knowledge/controller/function/FunctionController.java index 88e105f..960206f 100644 --- a/src/main/java/fr/insee/knowledge/controller/function/FunctionController.java +++ b/src/main/java/fr/insee/knowledge/controller/function/FunctionController.java @@ -18,9 +18,6 @@ @RestController @RequestMapping(path = "/function") public class FunctionController { - - private final static Logger logger = LoggerFactory.getLogger(FunctionController.class); - @Autowired private FunctionService functionService; diff --git a/src/main/java/fr/insee/knowledge/controller/hierarchy/GenericHierarchyController.java b/src/main/java/fr/insee/knowledge/controller/hierarchy/GenericHierarchyController.java index fa87720..d2bb222 100644 --- a/src/main/java/fr/insee/knowledge/controller/hierarchy/GenericHierarchyController.java +++ b/src/main/java/fr/insee/knowledge/controller/hierarchy/GenericHierarchyController.java @@ -18,9 +18,6 @@ import org.springframework.web.bind.annotation.RestController; public class GenericHierarchyController { - - private final static Logger logger = LoggerFactory.getLogger(GenericHierarchyController.class); - private final GenericHierarchyService hierarchyService; public GenericHierarchyController(GenericHierarchyService hierarchyService) { @@ -30,4 +27,6 @@ public GenericHierarchyController(GenericHierarchyService hierarchyService) { public ResponseEntity getHierarchy() { return new ResponseEntity(hierarchyService.getHierarchy(), HttpStatus.OK); } + + } diff --git a/src/main/java/fr/insee/knowledge/controller/hierarchy/HierarchyGsbpmController.java b/src/main/java/fr/insee/knowledge/controller/hierarchy/HierarchyGsbpmController.java index ddc6c33..42b8dd6 100644 --- a/src/main/java/fr/insee/knowledge/controller/hierarchy/HierarchyGsbpmController.java +++ b/src/main/java/fr/insee/knowledge/controller/hierarchy/HierarchyGsbpmController.java @@ -8,6 +8,7 @@ import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -24,4 +25,12 @@ public HierarchyGsbpmController(HierarchyGsbpmServiceImpl hierarchyService) { public ResponseEntity getGsbpm() { return getHierarchy(); } + + @Operation(summary = "Get a Sub Gsbpm by Id") + @GetMapping(path = "/gsbpm/{id}") + public ResponseEntity getGsbpmChildById(@PathVariable(value = "id") String id) { + return getHierarchy(); + } + + } diff --git a/src/main/java/fr/insee/knowledge/controller/importdata/ImportGithubController.java b/src/main/java/fr/insee/knowledge/controller/importdata/ImportGithubController.java index c33214d..3c26277 100644 --- a/src/main/java/fr/insee/knowledge/controller/importdata/ImportGithubController.java +++ b/src/main/java/fr/insee/knowledge/controller/importdata/ImportGithubController.java @@ -1,6 +1,9 @@ package fr.insee.knowledge.controller.importdata; -import fr.insee.knowledge.service.*; +import fr.insee.knowledge.controller.errors.ErrorResponse; +import fr.insee.knowledge.service.FunctionService; +import fr.insee.knowledge.service.ImportService; +import fr.insee.knowledge.service.exceptions.FunctionValidationException; import fr.insee.knowledge.service.impl.HierarchyGsbpmServiceImpl; import fr.insee.knowledge.service.impl.HierarchyProductServiceImpl; import fr.insee.knowledge.service.impl.HierarchySvcServiceImpl; @@ -9,24 +12,21 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.io.IOException; -import java.util.List; @Tag(name = "Import Data", description = "Import Data from Github") @RestController @Slf4j @RequestMapping(path = "/import") public class ImportGithubController { - private ImportService importService; - private HierarchyProductServiceImpl hierarchyProductSvc; - private HierarchyGsbpmServiceImpl hierarchyGsbpmSvc; - private HierarchyUserServiceImpl hierarchyUserSvc; - private HierarchySvcServiceImpl hierarchyServiceSvc; + private final ImportService importService; + private final HierarchyProductServiceImpl hierarchyProductSvc; + private final HierarchyGsbpmServiceImpl hierarchyGsbpmSvc; + private final HierarchyUserServiceImpl hierarchyUserSvc; + private final HierarchySvcServiceImpl hierarchyServiceSvc; + private final FunctionService functionService; public ImportGithubController(ImportService importService, HierarchyProductServiceImpl hierarchyProductSvc, HierarchyGsbpmServiceImpl hierarchyGsbpmSvc, HierarchyUserServiceImpl hierarchyUserSvc, HierarchySvcServiceImpl hierarchyServiceSvc, FunctionService functionService) { @@ -38,47 +38,45 @@ public ImportGithubController(ImportService importService, HierarchyProductServi this.functionService = functionService; } - private FunctionService functionService; - @Operation(summary = "Import Functions") @GetMapping(path = "/functions") - public ResponseEntity importFunctions() throws IOException { - String result = functionService.importListFunctions(); - return new ResponseEntity(result, HttpStatus.OK); + public String importFunctions() throws IOException { + return functionService.importListFunctions(); } @Operation(summary = "Import GSBPM") @GetMapping(path = "/hierarchy/gsbpm") - public ResponseEntity importGsbpm() throws IOException { - String result = hierarchyGsbpmSvc.importHierarchy(); - return new ResponseEntity(result, HttpStatus.OK); + public String importGsbpm() throws IOException { + return hierarchyGsbpmSvc.importHierarchy(); } @Operation(summary = "Import Services") @GetMapping(path = "/hierarchy/services") - public ResponseEntity importServices() throws IOException { - String result = hierarchyServiceSvc.importHierarchy(); - return new ResponseEntity(result, HttpStatus.OK); + public String importServices() throws IOException { + return hierarchyServiceSvc.importHierarchy(); } @Operation(summary = "Import Products") @GetMapping(path = "/hierarchy/products") - public ResponseEntity importProducts() throws IOException { - String result = hierarchyProductSvc.importHierarchy(); - return new ResponseEntity(result, HttpStatus.OK); + public String importProducts() throws IOException { + return hierarchyProductSvc.importHierarchy(); } @Operation(summary = "Import Users") @GetMapping(path = "/hierarchy/user") - public ResponseEntity importUsers() throws IOException { - String result = hierarchyUserSvc.importHierarchy(); - return new ResponseEntity(result, HttpStatus.OK); + public String importUsers() throws IOException { + return hierarchyUserSvc.importHierarchy(); } @Operation(summary = "Import All") @GetMapping(path = "/import-hierarchy-and-functions") - public ResponseEntity importHierarchyAndFunction() throws IOException { - String results = importService.importHierarchyAndFunction(); - return new ResponseEntity(results, HttpStatus.OK); + public String importHierarchyAndFunction() throws IOException { + return importService.importHierarchyAndFunction(); + } + + @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) + @ExceptionHandler(FunctionValidationException.class) + public ErrorResponse handleFunctionValidationException(FunctionValidationException ex) { + return new ErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR.value(), ex.getMessage(), ex.getErrorMessages()); } } diff --git a/src/main/java/fr/insee/knowledge/dao/generic/DAO.java b/src/main/java/fr/insee/knowledge/dao/generic/DAO.java index 91c3ca2..a034c40 100644 --- a/src/main/java/fr/insee/knowledge/dao/generic/DAO.java +++ b/src/main/java/fr/insee/knowledge/dao/generic/DAO.java @@ -55,7 +55,6 @@ public String insertOrReplaceOne(T document) { } } - public String insertOrReplaceMany(List documents) { try { List> bulkOperations = new ArrayList<>(); diff --git a/src/main/java/fr/insee/knowledge/dao/impl/HierarchyDAOImpl.java b/src/main/java/fr/insee/knowledge/dao/impl/HierarchyDAOImpl.java index 668266d..cbafe15 100644 --- a/src/main/java/fr/insee/knowledge/dao/impl/HierarchyDAOImpl.java +++ b/src/main/java/fr/insee/knowledge/dao/impl/HierarchyDAOImpl.java @@ -9,5 +9,4 @@ public class HierarchyDAOImpl extends DAO { public HierarchyDAOImpl() { super(Constants.CollectionHierarchy); } - } diff --git a/src/main/java/fr/insee/knowledge/domain/Function.java b/src/main/java/fr/insee/knowledge/domain/Function.java index 880eef8..a60ef40 100644 --- a/src/main/java/fr/insee/knowledge/domain/Function.java +++ b/src/main/java/fr/insee/knowledge/domain/Function.java @@ -6,7 +6,7 @@ @JsonInclude(JsonInclude.Include.NON_EMPTY) public class Function extends GenericIDLabel { - private int dispo; + private Boolean dispo; private GenericIDLabel gsbpm; private String idProduct; private List users; @@ -14,7 +14,7 @@ public class Function extends GenericIDLabel { private List tasks; private Service service; - public Function(String id, String label, String description, int dispo, Gsbpm gsbpm, String idProduct, List users, List tools, List tasks, Service service) { + public Function(String id, String label, String description, Boolean dispo, Gsbpm gsbpm, String idProduct, List users, List tools, List tasks, Service service) { super(id, label, description); this.dispo = dispo; this.gsbpm = gsbpm; @@ -28,11 +28,11 @@ public Function() { super(); } - public int getDispo() { + public Boolean getDispo() { return dispo; } - public void setDispo(int dispo) { + public void setDispo(Boolean dispo) { this.dispo = dispo; } diff --git a/src/main/java/fr/insee/knowledge/domain/GenericIDLabel.java b/src/main/java/fr/insee/knowledge/domain/GenericIDLabel.java index d563d3a..ae57dd8 100644 --- a/src/main/java/fr/insee/knowledge/domain/GenericIDLabel.java +++ b/src/main/java/fr/insee/knowledge/domain/GenericIDLabel.java @@ -51,4 +51,8 @@ public String getLabel() { public void setLabel(String label) { this.label = label; } + + public boolean hasId(String targetId) { + return id.equals(targetId); + } } diff --git a/src/main/java/fr/insee/knowledge/domain/RawFunction.java b/src/main/java/fr/insee/knowledge/domain/RawFunction.java new file mode 100644 index 0000000..457a8c2 --- /dev/null +++ b/src/main/java/fr/insee/knowledge/domain/RawFunction.java @@ -0,0 +1,83 @@ +package fr.insee.knowledge.domain; + +import java.util.List; + +public class RawFunction extends GenericIDLabel { + private Boolean dispo; + private String gsbpm; + private String idProduct; + private List users; + private List products; + private List tasks; + private Service service; + + public RawFunction(String id, String label, String description, Boolean dispo, String gsbpm, String idProduct, List users, List products, List tasks, Service service) { + super(id, label, description); + this.dispo = dispo; + this.gsbpm = gsbpm; + this.idProduct = idProduct; + this.users = users; + this.products = products; + this.tasks = tasks; + this.service = service; + } + + public RawFunction() { + } + + public Boolean getDispo() { + return dispo; + } + + public void setDispo(Boolean dispo) { + this.dispo = dispo; + } + + public String getGsbpm() { + return gsbpm; + } + + public void setGsbpm(String gsbpm) { + this.gsbpm = gsbpm; + } + + public String getIdProduct() { + return idProduct; + } + + public void setIdProduct(String idProduct) { + this.idProduct = idProduct; + } + + public List getUsers() { + return users; + } + + public void setUsers(List users) { + this.users = users; + } + + public List getProducts() { + return products; + } + + public void setProducts(List products) { + this.products = products; + } + + public List getTasks() { + return tasks; + } + + public void setTasks(List tasks) { + this.tasks = tasks; + } + + public Service getService() { + return service; + } + + public void setService(Service service) { + this.service = service; + } +} diff --git a/src/main/java/fr/insee/knowledge/domain/hierarchy/Hierarchy.java b/src/main/java/fr/insee/knowledge/domain/hierarchy/Hierarchy.java index cecd847..7c3b365 100644 --- a/src/main/java/fr/insee/knowledge/domain/hierarchy/Hierarchy.java +++ b/src/main/java/fr/insee/knowledge/domain/hierarchy/Hierarchy.java @@ -46,4 +46,19 @@ public List getChildren() { public void setChildren(List children) { this.children = children; } + + public Hierarchy getChildrenById(String targetId) { + if (hasId(targetId)) { + return this; + } + if (this.children != null) { + for (T child : this.children) { + Hierarchy found = child.getChildrenById(targetId); + if (found != null) { + return found; + } + } + } + return null; + } } diff --git a/src/main/java/fr/insee/knowledge/service/GenericHierarchyService.java b/src/main/java/fr/insee/knowledge/service/GenericHierarchyService.java index 6c2a4cd..1b00ad0 100644 --- a/src/main/java/fr/insee/knowledge/service/GenericHierarchyService.java +++ b/src/main/java/fr/insee/knowledge/service/GenericHierarchyService.java @@ -11,4 +11,6 @@ public interface GenericHierarchyService { String importHierarchy() throws IOException; T findHierarchyById(String id); + + Hierarchy findChildrenById(String idChildren); } diff --git a/src/main/java/fr/insee/knowledge/service/InitializerService.java b/src/main/java/fr/insee/knowledge/service/InitializerService.java index 68776cf..b60f1dd 100644 --- a/src/main/java/fr/insee/knowledge/service/InitializerService.java +++ b/src/main/java/fr/insee/knowledge/service/InitializerService.java @@ -5,6 +5,4 @@ public interface InitializerService { void createCollections(); - - void importDataFromGithub() throws IOException; } diff --git a/src/main/java/fr/insee/knowledge/service/exceptions/FunctionValidationException.java b/src/main/java/fr/insee/knowledge/service/exceptions/FunctionValidationException.java new file mode 100644 index 0000000..a0d6341 --- /dev/null +++ b/src/main/java/fr/insee/knowledge/service/exceptions/FunctionValidationException.java @@ -0,0 +1,15 @@ +package fr.insee.knowledge.service.exceptions; + +import lombok.Getter; + +import java.util.List; + +@Getter +public class FunctionValidationException extends RuntimeException { + private final List errorMessages; + + public FunctionValidationException(String message, List errorMessages) { + super(message); + this.errorMessages = errorMessages; + } +} diff --git a/src/main/java/fr/insee/knowledge/service/impl/FunctionServiceImpl.java b/src/main/java/fr/insee/knowledge/service/impl/FunctionServiceImpl.java index 9aa71ae..f6c7f9b 100644 --- a/src/main/java/fr/insee/knowledge/service/impl/FunctionServiceImpl.java +++ b/src/main/java/fr/insee/knowledge/service/impl/FunctionServiceImpl.java @@ -6,7 +6,13 @@ import fr.insee.knowledge.constants.Constants; import fr.insee.knowledge.dao.FunctionDAO; import fr.insee.knowledge.domain.Function; +import fr.insee.knowledge.domain.GenericIDLabel; +import fr.insee.knowledge.domain.RawFunction; +import fr.insee.knowledge.domain.hierarchy.HierarchyGsbpm; +import fr.insee.knowledge.domain.hierarchy.HierarchyProduct; +import fr.insee.knowledge.domain.hierarchy.HierarchyUser; import fr.insee.knowledge.service.FunctionService; +import fr.insee.knowledge.service.exceptions.FunctionValidationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -25,6 +31,19 @@ public class FunctionServiceImpl implements FunctionService { private String githubRepository; @Autowired private FunctionDAO functionDAO; + + @Autowired + private HierarchyProductServiceImpl hierarchyProductService; + + @Autowired + private HierarchyUserServiceImpl hierarchyUserService; + + @Autowired + private HierarchySvcServiceImpl hierarchySvcService; + + @Autowired + private HierarchyGsbpmServiceImpl hierarchyGsbpmService; + private final ObjectMapper mapper = new ObjectMapper(); public Function getFunctionById(String idValue) { @@ -42,35 +61,97 @@ public String importListFunctions() throws IOException { } private List getListFunctionsFromJsonNode(JsonNode rootNode) throws JsonProcessingException { - List listFunction = new ArrayList<>(); - if (rootNode.isArray()) { - for (JsonNode node : rootNode) { - recursiveMapping(listFunction, node, new fr.insee.knowledge.domain.Service()); - } + List functions = new ArrayList<>(); + List validationErrors = new ArrayList<>(); + if (!rootNode.isArray()) { + return functions; + } + + for (JsonNode node : rootNode) { + fr.insee.knowledge.domain.Service service = new fr.insee.knowledge.domain.Service(); + service.setId(node.get(Constants.idField).asText()); + service.setLabel(node.get(Constants.labelField).asText()); + recursiveMapping(functions, node, service, validationErrors); } - return listFunction; + + if (!validationErrors.isEmpty()) { + throw new FunctionValidationException("Des erreurs de validation sont survenues", validationErrors); + } + return functions; } - private void recursiveMapping(List functionList, JsonNode jsonNode, fr.insee.knowledge.domain.Service currentService) throws JsonProcessingException { - currentService.setId(jsonNode.get(Constants.idField).asText()); - currentService.setLabel(jsonNode.get(Constants.labelField).asText()); + private void recursiveMapping(List functions, JsonNode currentServiceNode, fr.insee.knowledge.domain.Service currentService, List validationErrors) throws JsonProcessingException { + + JsonNode functionsNode = currentServiceNode.get(Constants.functionField); + addFunctionsFromService(functions, functionsNode, currentService, validationErrors); - JsonNode functionNodeArray = jsonNode.get(Constants.functionField); - if (functionNodeArray != null) { - for (JsonNode functionNode : functionNodeArray) { - Function function = mapper.treeToValue(functionNode, Function.class); - function.setService(currentService); - functionList.add(function); + JsonNode subServicesNode = currentServiceNode.get(Constants.serviceField); + if (subServicesNode == null) { + return; + } + + for (JsonNode subServiceNode : subServicesNode) { + fr.insee.knowledge.domain.Service subService = new fr.insee.knowledge.domain.Service(); + subService.setId(subServiceNode.get(Constants.idField).asText()); + subService.setLabel(subServiceNode.get(Constants.labelField).asText()); + subService.setService(currentService); + + if (hierarchySvcService.findChildrenById(subService.getId()) == null) { + validationErrors.add(String.format("Le service %s n'existe pas", subService.getId())); } + recursiveMapping(functions, subServiceNode, subService, validationErrors); } - JsonNode node = jsonNode.get(Constants.serviceField); - if (node != null) { - for (JsonNode serviceNode : node) { - fr.insee.knowledge.domain.Service service = new fr.insee.knowledge.domain.Service(); - //TODO test if service exist in database - service.setService(currentService); - recursiveMapping(functionList, serviceNode, service); + } + + private void addFunctionsFromService(List functions, JsonNode functionsNode, + fr.insee.knowledge.domain.Service service, + List validationErrors) throws JsonProcessingException { + if (functionsNode == null) { + return; + } + + for (JsonNode functionNode : functionsNode) { + RawFunction rawFunction = mapper.treeToValue(functionNode, RawFunction.class); + Function function = new Function(); + function.setId(rawFunction.getId()); + function.setLabel(rawFunction.getLabel()); + function.setDescription(rawFunction.getDescription()); + function.setIdProduct(rawFunction.getIdProduct()); + function.setDispo(rawFunction.getDispo()); + function.setTasks(rawFunction.getTasks()); + function.setService(service); + + List products = new ArrayList<>(); + List users = new ArrayList<>(); + + for (String idProduct : rawFunction.getProducts()) { + HierarchyProduct product = (HierarchyProduct) hierarchyProductService.findChildrenById(idProduct); + if (product == null) { + validationErrors.add(String.format("Le produit %s n'existe pas pour la fonction %s", idProduct, function.getId())); + continue; + } + products.add(product); + } + + for (String idUser : rawFunction.getUsers()) { + HierarchyUser user = (HierarchyUser) hierarchyUserService.findChildrenById(idUser); + if (user == null) { + validationErrors.add(String.format("L'utilisateur %s n'existe pas pour la fonction %s", idUser, function.getId())); + continue; + } + users.add(user); } + + String idGsbpm = rawFunction.getGsbpm(); + HierarchyGsbpm gsbpm = (HierarchyGsbpm) hierarchyGsbpmService.findChildrenById(idGsbpm); + if (gsbpm == null) { + validationErrors.add(String.format("Le GSPM %s n'existe pas pour la fonction %s", idGsbpm, function.getId())); + } + + function.setGsbpm(gsbpm); + function.setProducts(products); + function.setUsers(users); + functions.add(function); } } } diff --git a/src/main/java/fr/insee/knowledge/service/impl/GenericHierarchyServiceImpl.java b/src/main/java/fr/insee/knowledge/service/impl/GenericHierarchyServiceImpl.java index 8f952bf..dfcd36e 100644 --- a/src/main/java/fr/insee/knowledge/service/impl/GenericHierarchyServiceImpl.java +++ b/src/main/java/fr/insee/knowledge/service/impl/GenericHierarchyServiceImpl.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.net.URL; -import java.util.Optional; public class GenericHierarchyServiceImpl implements GenericHierarchyService { private final DAO hierarchyDAO; @@ -44,4 +43,12 @@ public String importHierarchy() throws IOException { public T findHierarchyById(String id) { return hierarchyDAO.findById(id); } + + @Override + public Hierarchy findChildrenById(String idChildren) { + Hierarchy hierarchy = this.getHierarchy(); + return hierarchy.getChildrenById(idChildren); + } + + } diff --git a/src/main/java/fr/insee/knowledge/service/impl/InitializerServiceImpl.java b/src/main/java/fr/insee/knowledge/service/impl/InitializerServiceImpl.java index 6c11d17..376a5f4 100644 --- a/src/main/java/fr/insee/knowledge/service/impl/InitializerServiceImpl.java +++ b/src/main/java/fr/insee/knowledge/service/impl/InitializerServiceImpl.java @@ -46,17 +46,7 @@ public void createCollections() { mongoDatabase.createCollection(Constants.CollectionHierarchy, getValidateOption("schemaHierarchy.json")); logger.info("Collections created"); } catch (MongoCommandException | IOException e) { - logger.info("Collections already exists"); - } - } - - public void importDataFromGithub() throws IOException { - logger.info("Import Data from Github"); - try { - String result = importService.importHierarchyAndFunction(); - logger.info(String.valueOf(result)); - } catch (Exception e) { - logger.error("Error could not import data from github. Execption occured ", e); + logger.info("Collections already exists", e); } } } diff --git a/src/main/resources/schema/schemaFunctions.json b/src/main/resources/schema/schemaFunctions.json index ba757ec..1632ef5 100644 --- a/src/main/resources/schema/schemaFunctions.json +++ b/src/main/resources/schema/schemaFunctions.json @@ -11,7 +11,7 @@ "users", "products", "tasks", - "services" + "service" ], "properties": { "_id": { @@ -24,24 +24,23 @@ "bsonType": "string" }, "dispo": { - "bsonType": "int" + "bsonType": "bool" }, "gsbpm": { - "bsonType": "object", - "required": [ - "_id", - "label" - ], - "properties": { - "_id": { - "bsonType": "string" - }, - "label": { - "bsonType": "string" - }, - "description": { - "bsonType": "string" - } + "bsonType": "object", + "required": [ + "_id", + "label" + ], + "properties": { + "_id": { + "bsonType": "string" + }, + "label": { + "bsonType": "string" + }, + "description": { + "bsonType": "string" } } }, @@ -107,7 +106,7 @@ } } }, - "services": { + "service": { "bsonType": "object", "items": { "bsonType": "object", @@ -130,4 +129,4 @@ } } } -} +} \ No newline at end of file