Loading .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ /.classpath /.settings /org.etsi.osl.tmf.api.iml /.idea/ src/main/java/org/etsi/osl/tmf/BootstrapResources.java +8 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; import org.etsi.osl.tmf.rcm634.repo.ResourceCatalogRepository; import org.etsi.osl.tmf.rcm634.repo.ResourceCategoriesRepository; import org.etsi.osl.tmf.rcm634.repo.ResourceSpecificationRepository; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCandidateRepoService; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCatalogRepoService; Loading Loading @@ -71,6 +72,9 @@ public class BootstrapResources { @Autowired ResourceSpecificationRepository resourceSpecificationRepo; @Autowired ResourceCategoriesRepository resourceCategoriesRepository; @Autowired ObjectMapper objectMapper; Loading Loading @@ -249,6 +253,7 @@ public class BootstrapResources { } @Transactional private void createBootResourceSpec( ResourceCategory scategory, String aname, String afile) { ResourceSpecificationCreate rsc = this.resourceSpecRepoService.readFromLocalLogicalResourceSpec( afile ); Loading @@ -259,6 +264,7 @@ public class BootstrapResources { } @Transactional private void addToCategory(ResourceCategory scategory, ResourceSpecification resourceSpecificationObj) { //Turn the ResourceSpecification to a ResourceCanditate to save it to the ResourceCatalogRepo Loading src/main/java/org/etsi/osl/tmf/configuration/RestExceptionHandler.java +19 −10 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; Loading @@ -18,15 +19,23 @@ public class RestExceptionHandler extends ResponseEntityExceptionHandler { @Override protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { String error = "Malformed JSON request"; ApiError apiError = new ApiError(HttpStatus.BAD_REQUEST, error, ex); return new ResponseEntity<Object>(apiError, apiError.getStatus()); return buildResponseEntity(ex); } // other exception handlers below private ResponseEntity<Object> buildResponseEntity(ApiError apiError) { return new ResponseEntity<>(apiError, apiError.getStatus()); @Override protected ResponseEntity<Object> handleMethodArgumentNotValid( MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { return buildResponseEntity(ex); } // other exception handlers below private ResponseEntity<Object> buildResponseEntity(Throwable ex) { String error = "Malformed JSON request"; ApiError apiError = new ApiError(HttpStatus.BAD_REQUEST, error, ex); return new ResponseEntity<Object>(apiError, apiError.getStatus()); } } src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java +2 −2 Original line number Diff line number Diff line Loading @@ -716,13 +716,13 @@ public class ProductOfferingRepoService { // Build the name LIKE clause StringJoiner nameJoiner = new StringJoiner(" AND "); StringJoiner nameJoiner = new StringJoiner(" OR "); for (String term : searchList) { nameJoiner.add("p.name LIKE '%" + term + "%'"); } // Build the description LIKE clause StringJoiner descriptionJoiner = new StringJoiner(" AND "); StringJoiner descriptionJoiner = new StringJoiner(" OR "); for (String term : searchList) { descriptionJoiner.add("p.description LIKE '%" + term + "%'"); } Loading src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java +2 −1 Original line number Diff line number Diff line Loading @@ -430,9 +430,10 @@ public class ProductSpecificationRepoService { // we need the attachment model from resource spec models boolean idexists = false; for (ProductSpecificationCharacteristic orinalAtt : prodSpec.getProductSpecCharacteristic()) { if (orinalAtt.getName().equals(ar.getName())) { if (orinalAtt.getName()!=null && ar.getName()!=null && orinalAtt.getName().equals(ar.getName())) { idexists = true; idAddedUpdated.put(orinalAtt.getName(), true); orinalAtt.updateWith( ar ); break; } } Loading Loading
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -5,3 +5,4 @@ /.classpath /.settings /org.etsi.osl.tmf.api.iml /.idea/
src/main/java/org/etsi/osl/tmf/BootstrapResources.java +8 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; import org.etsi.osl.tmf.rcm634.repo.ResourceCatalogRepository; import org.etsi.osl.tmf.rcm634.repo.ResourceCategoriesRepository; import org.etsi.osl.tmf.rcm634.repo.ResourceSpecificationRepository; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCandidateRepoService; import org.etsi.osl.tmf.rcm634.reposervices.ResourceCatalogRepoService; Loading Loading @@ -71,6 +72,9 @@ public class BootstrapResources { @Autowired ResourceSpecificationRepository resourceSpecificationRepo; @Autowired ResourceCategoriesRepository resourceCategoriesRepository; @Autowired ObjectMapper objectMapper; Loading Loading @@ -249,6 +253,7 @@ public class BootstrapResources { } @Transactional private void createBootResourceSpec( ResourceCategory scategory, String aname, String afile) { ResourceSpecificationCreate rsc = this.resourceSpecRepoService.readFromLocalLogicalResourceSpec( afile ); Loading @@ -259,6 +264,7 @@ public class BootstrapResources { } @Transactional private void addToCategory(ResourceCategory scategory, ResourceSpecification resourceSpecificationObj) { //Turn the ResourceSpecification to a ResourceCanditate to save it to the ResourceCatalogRepo Loading
src/main/java/org/etsi/osl/tmf/configuration/RestExceptionHandler.java +19 −10 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; Loading @@ -18,15 +19,23 @@ public class RestExceptionHandler extends ResponseEntityExceptionHandler { @Override protected ResponseEntity<Object> handleHttpMessageNotReadable(HttpMessageNotReadableException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { String error = "Malformed JSON request"; ApiError apiError = new ApiError(HttpStatus.BAD_REQUEST, error, ex); return new ResponseEntity<Object>(apiError, apiError.getStatus()); return buildResponseEntity(ex); } // other exception handlers below private ResponseEntity<Object> buildResponseEntity(ApiError apiError) { return new ResponseEntity<>(apiError, apiError.getStatus()); @Override protected ResponseEntity<Object> handleMethodArgumentNotValid( MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) { return buildResponseEntity(ex); } // other exception handlers below private ResponseEntity<Object> buildResponseEntity(Throwable ex) { String error = "Malformed JSON request"; ApiError apiError = new ApiError(HttpStatus.BAD_REQUEST, error, ex); return new ResponseEntity<Object>(apiError, apiError.getStatus()); } }
src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java +2 −2 Original line number Diff line number Diff line Loading @@ -716,13 +716,13 @@ public class ProductOfferingRepoService { // Build the name LIKE clause StringJoiner nameJoiner = new StringJoiner(" AND "); StringJoiner nameJoiner = new StringJoiner(" OR "); for (String term : searchList) { nameJoiner.add("p.name LIKE '%" + term + "%'"); } // Build the description LIKE clause StringJoiner descriptionJoiner = new StringJoiner(" AND "); StringJoiner descriptionJoiner = new StringJoiner(" OR "); for (String term : searchList) { descriptionJoiner.add("p.description LIKE '%" + term + "%'"); } Loading
src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java +2 −1 Original line number Diff line number Diff line Loading @@ -430,9 +430,10 @@ public class ProductSpecificationRepoService { // we need the attachment model from resource spec models boolean idexists = false; for (ProductSpecificationCharacteristic orinalAtt : prodSpec.getProductSpecCharacteristic()) { if (orinalAtt.getName().equals(ar.getName())) { if (orinalAtt.getName()!=null && ar.getName()!=null && orinalAtt.getName().equals(ar.getName())) { idexists = true; idAddedUpdated.put(orinalAtt.getName(), true); orinalAtt.updateWith( ar ); break; } } Loading