diff options
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/main/java')
10 files changed, 284 insertions, 861 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java deleted file mode 100644 index f223dccb..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ServiceExceptionMapper.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.common;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-@Provider
-public class ServiceExceptionMapper implements ExceptionMapper<BluePrintException> {
-
- @Override
- public Response toResponse(BluePrintException ex) {
- ErrorMessage errorMessage = new ErrorMessage();
- errorMessage.setCode(ex.getCode());
- errorMessage.setMessage(ex.getMessage());
- StringWriter errorStackTrace = new StringWriter();
- ex.printStackTrace(new PrintWriter(errorStackTrace));
- errorMessage.setDeveloperMessage(ex.toString());
- return Response.status(500).entity(errorMessage).type(MediaType.APPLICATION_JSON).build();
- }
-
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java index e9080763..81f7d701 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java @@ -1,17 +1,17 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.onap.ccsdk.apps.controllerblueprints.service.common;
@@ -20,7 +20,6 @@ import io.swagger.models.*; import io.swagger.models.parameters.BodyParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.*;
-import io.swagger.util.Json;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
@@ -63,8 +62,7 @@ public class SwaggerGenerator { swagger.setDefinitions(getDefinition());
- swaggerContent = Json.pretty(swagger);
- return swaggerContent;
+ return swagger.toString();
}
private Info getInfo() {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java index 86c89bf9..94324a80 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java @@ -16,164 +16,112 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
+import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ConfigModelRest.java Purpose: Rest service controller for ConfigModelRest Management
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ConfigModelRest {
+@RestController
+@RequestMapping("/api/v1/config-model")
+public class ConfigModelRest {
- /**
- * This is a getConfigModel rest service
- *
- * @param id
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodel/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- @RequestMapping(value = "/configmodel/{id}", method = RequestMethod.GET)
- @ResponseBody ConfigModel getConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
-
+ private ConfigModelService configModelService;
/**
- * This is a saveConfigModel rest service
- *
- * @param configModel
- * @return ConfigModel
- * @throws BluePrintException
+ * This is a ConfigModelRest constructor.
+ *
+ * @param configModelService Config Model Service
*/
- @POST
- @Path("/configmodel")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel saveConfigModel(@ApiParam(required = true) ConfigModel configModel)
- throws BluePrintException;
+ public ConfigModelRest(ConfigModelService configModelService) {
+ this.configModelService = configModelService;
- /**
- * This is a deleteConfigModel rest service
- *
- * @param id
- * @throws BluePrintException
- */
- @DELETE
- @Path("/configmodel/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete ConfigModel.")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteConfigModel(@ApiParam(required = true) @PathParam("id") Long id) throws BluePrintException;
+ }
- /**
- * This is a getInitialConfigModel rest service
- *
- * @param name
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelinitial/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getInitialConfigModel(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @GetMapping(path = "/initial/{name}")
+ public @ResponseBody
+ ConfigModel getInitialConfigModel(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return this.configModelService.getInitialConfigModel(name);
+ } catch (Exception e) {
+ throw new BluePrintException(2000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getCloneConfigModel rest service
- *
- * @param id
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelclone/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getCloneConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ConfigModel saveConfigModel(@RequestBody ConfigModel configModel) throws BluePrintException {
+ try {
+ return this.configModelService.saveConfigModel(configModel);
+ } catch (Exception e) {
+ throw new BluePrintException(2200, e.getMessage(), e);
+ }
+ }
- /**
- * This is a publishConfigModel rest service
- *
- * @param id
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelpublish/{id}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel publishConfigModel(@ApiParam(required = true) @PathParam("id") Long id)
- throws BluePrintException;
+ @DeleteMapping(path = "/{id}")
+ public void deleteConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ this.configModelService.deleteConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(4000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getConfigModelByNameAndVersion rest service
- *
- * @param name
- * @param version
- * @return ConfigModel
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelbyname/{name}/version/{version}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ConfigModel getConfigModelByNameAndVersion(@ApiParam(required = true) @PathParam("name") String name,
- @ApiParam(required = true) @PathParam("version") String version) throws BluePrintException;
+ @GetMapping(path = "/publish/{id}")
+ public @ResponseBody
+ ConfigModel publishConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.publishConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2500, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchServiceModels rest service
- *
- * @param tags
- * @return List<ConfigModel>
- * @throws BluePrintException
- */
- @GET
- @Path("/configmodelsearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ConfigModel> searchConfigModels(@ApiParam(required = true) @PathParam("tags") String tags)
- throws BluePrintException;
+ @GetMapping(path = "/{id}")
+ public @ResponseBody
+ ConfigModel getConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2001, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/by-name/{name}/version/{version}")
+ public @ResponseBody
+ ConfigModel getConfigModelByNameAndVersion(@PathVariable(value = "name") String name,
+ @PathVariable(value = "version") String version) throws BluePrintException {
+ try {
+ return this.configModelService.getConfigModelByNameAndVersion(name, version);
+ } catch (Exception e) {
+ throw new BluePrintException(2002, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/search/{tags}")
+ public @ResponseBody
+ List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return this.configModelService.searchConfigModels(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(2003, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/clone/{id}")
+ public @ResponseBody
+ ConfigModel getCloneConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
+ try {
+ return this.configModelService.getCloneConfigModel(id);
+ } catch (Exception e) {
+ throw new BluePrintException(2004, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java deleted file mode 100644 index a9abcd5f..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRestImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ConfigModelRestImpl implements ConfigModelRest {
-
- private ConfigModelService configModelService;
-
- /**
- * This is a ConfigModelRestImpl constructor.
- *
- * @param configModelService Config Model Service
- */
- public ConfigModelRestImpl(ConfigModelService configModelService) {
- this.configModelService = configModelService;
-
- }
-
- @Override
- public ConfigModel getInitialConfigModel(String name) throws BluePrintException {
- try {
- return this.configModelService.getInitialConfigModel(name);
- } catch (Exception e) {
- throw new BluePrintException(2000, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
- try {
- return this.configModelService.saveConfigModel(configModel);
- } catch (Exception e) {
- throw new BluePrintException(2200, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteConfigModel(Long id) throws BluePrintException {
- try {
- this.configModelService.deleteConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(4000, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel publishConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.publishConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2500, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.getConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2001, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getConfigModelByNameAndVersion(String name, String version) throws BluePrintException {
- try {
- return this.configModelService.getConfigModelByNameAndVersion(name, version);
- } catch (Exception e) {
- throw new BluePrintException(2002, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ConfigModel> searchConfigModels(String tags) throws BluePrintException {
- try {
- return this.configModelService.searchConfigModels(tags);
- } catch (Exception e) {
- throw new BluePrintException(2003, e.getMessage(), e);
- }
- }
-
- @Override
- public ConfigModel getCloneConfigModel(Long id) throws BluePrintException {
- try {
- return this.configModelService.getCloneConfigModel(id);
- } catch (Exception e) {
- throw new BluePrintException(2004, e.getMessage(), e);
- }
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java index 59b73030..2fa64316 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java @@ -16,110 +16,77 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ModelTypeRest.java Purpose: Rest service controller for Artifact Handling
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ModelTypeRest {
+@RestController
+@RequestMapping("/api/v1/model-type")
+public class ModelTypeRest {
- /**
- * This is a getModelTypeByName rest service
- *
- * @param name
- * @return ModelType
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltype/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by id", response = ModelType.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ModelType getModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ private ModelTypeService modelTypeService;
/**
- * This is a saveModelType rest service
- *
- * @param modelType
- * @return ModelType
- * @throws BluePrintException
+ * This is a ModelTypeResourceImpl, used to save and get the model types stored in database
+ *
+ * @param modelTypeService Model Type Service
*/
+ public ModelTypeRest(ModelTypeService modelTypeService) {
+ this.modelTypeService = modelTypeService;
+ }
- @POST
- @Path("/modeltype")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Save Model Type", response = ModelType.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ModelType saveModelType(@ApiParam(required = true) ModelType modelType) throws BluePrintException;
+ @GetMapping(path = "/{name}")
+ public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(1000, e.getMessage(), e);
+ }
+ }
- /**
- * This is a deleteModelType rest service
- *
- * @param name
- * @throws BluePrintException
- */
- @DELETE
- @Path("/modeltype/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete Model Type")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @GetMapping(path = "/search/{tags}")
+ public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return modelTypeService.searchModelTypes(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(1001, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchModelType rest service
- *
- * @param tags
- * @return List<ModelType>
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltypesearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ModelType> searchModelTypes(@ApiParam(required = true) @PathParam("tags") String tags)
- throws BluePrintException;
+ @GetMapping(path = "/by-definition/{definitionType}")
+ public @ResponseBody
+ List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {
+ try {
+ return modelTypeService.getModelTypeByDefinitionType(definitionType);
+ } catch (Exception e) {
+ throw new BluePrintException(1002, e.getMessage(), e);
+ }
+ }
- /**
- * This is a getModelTypeByDefinitionType rest service
- *
- * @param definitionType
- * @return List<ModelType>
- * @throws BluePrintException
- */
- @GET
- @Path("/modeltypebydefinition/{definitionType}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ModelType> getModelTypeByDefinitionType(
- @ApiParam(required = true) @PathParam("definitionType") String definitionType)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {
+ try {
+ return modelTypeService.saveModel(modelType);
+ } catch (Exception e) {
+ throw new BluePrintException(1100, e.getMessage(), e);
+ }
+ }
+ @DeleteMapping(path = "/{name}")
+ public void deleteModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ modelTypeService.deleteByModelName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(1400, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java deleted file mode 100644 index 6fbc6969..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ModelTypeRestImpl implements ModelTypeRest {
-
- private ModelTypeService modelTypeService;
-
- /**
- * This is a ModelTypeResourceImpl, used to save and get the model types stored in database
- *
- * @param modelTypeService Model Type Service
- */
- public ModelTypeRestImpl(ModelTypeService modelTypeService) {
- this.modelTypeService = modelTypeService;
- }
-
- @Override
- public ModelType getModelTypeByName(String modelName) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByName(modelName);
- } catch (Exception e) {
- throw new BluePrintException(1000, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ModelType> searchModelTypes(String tags) throws BluePrintException {
- try {
- return modelTypeService.searchModelTypes(tags);
- } catch (Exception e) {
- throw new BluePrintException(1001, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {
- try {
- return modelTypeService.getModelTypeByDefinitionType(definitionType);
- } catch (Exception e) {
- throw new BluePrintException(1002, e.getMessage(), e);
- }
- }
-
- @Override
- public ModelType saveModelType(ModelType modelType) throws BluePrintException {
- try {
- return modelTypeService.saveModel(modelType);
- } catch (Exception e) {
- throw new BluePrintException(1100, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteModelTypeByName(String name) throws BluePrintException {
- try {
- modelTypeService.deleteByModelName(name);
- } catch (Exception e) {
- throw new BluePrintException(1400, e.getMessage(), e);
- }
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java index 5bc98336..dfb06bba 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java @@ -16,111 +16,83 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
import java.util.List;
/**
- * ResourceDictionaryRest.java Purpose: Rest service controller for Artifact Handling
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
+@RestController
+@RequestMapping(value = "/api/v1/dictionary")
+public class ResourceDictionaryRest {
-public interface ResourceDictionaryRest {
- /**
- * This is a getDataDictionaryByPath rest service
- *
- * @param name
- * @return ResourceDictionary
- * @throws BluePrintException
- */
- @GET
- @Path("/dictionary/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get Resource dictionary", response = ResourceDictionary.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ResourceDictionary getResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ private ResourceDictionaryService resourceDictionaryService;
/**
- * This is a saveDataDictionary rest service
- *
- * @param resourceMapping
- * @return ResourceDictionary
- * @throws BluePrintException
+ * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
+ *
+ * @param dataDictionaryService Data Dictionary Service
*/
+ public ResourceDictionaryRest(ResourceDictionaryService dataDictionaryService) {
+ this.resourceDictionaryService = dataDictionaryService;
+ }
- @POST
- @Path("/dictionary")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to Save Resource dictionary Type", response = ResourceDictionary.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ResourceDictionary saveResourceDictionary(@ApiParam(required = true) ResourceDictionary resourceMapping)
- throws BluePrintException;
+ @PostMapping(path = "/")
+ public @ResponseBody
+ ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.saveResourceDictionary(dataDictionary);
+ } catch (Exception e) {
+ throw new BluePrintException(4100, e.getMessage(), e);
+ }
+ }
- /**
- * This is a deleteDataDictionaryByName rest service
- *
- * @param name
- * @throws BluePrintException
- */
- @DELETE
- @Path("/dictionary/{name}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to delete ResourceDictionary Type")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- void deleteResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)
- throws BluePrintException;
+ @DeleteMapping(path = "/{name}")
+ public void deleteResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ resourceDictionaryService.deleteResourceDictionary(name);
+ } catch (Exception e) {
+ throw new BluePrintException(4400, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchResourceDictionaryByTags rest service
- *
- * @param tags
- * @return ResourceDictionary
- * @throws BluePrintException
- */
- @GET
- @Path("/dictionarysearch/{tags}")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to search Resource dictionary by tags",
- response = ResourceDictionary.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceDictionary> searchResourceDictionaryByTags(
- @ApiParam(required = true) @PathParam("tags") String tags) throws BluePrintException;
+ @GetMapping(path = "/{name}")
+ public @ResponseBody
+ ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
+ try {
+ return resourceDictionaryService.getResourceDictionaryByName(name);
+ } catch (Exception e) {
+ throw new BluePrintException(4001, e.getMessage(), e);
+ }
+ }
- /**
- * This is a searchResourceDictionaryByNames rest service
- *
- * @param names
- * @return List<ResourceDictionary>
- * @throws BluePrintException
- */
- @POST
- @Path("/dictionarybynames")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to get ResourceDictionary Type by names",
- response = ResourceDictionary.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceDictionary> searchResourceDictionaryByNames(@ApiParam(required = true) List<String> names)
- throws BluePrintException;
+ @PostMapping(path = "/by-names")
+ public @ResponseBody
+ List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)
+ throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByNames(names);
+ } catch (Exception e) {
+ throw new BluePrintException(4002, e.getMessage(), e);
+ }
+ }
+
+ @GetMapping(path = "/search/{tags}")
+ public @ResponseBody
+ List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {
+ try {
+ return resourceDictionaryService.searchResourceDictionaryByTags(tags);
+ } catch (Exception e) {
+ throw new BluePrintException(4003, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java deleted file mode 100644 index e3448424..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ResourceDictionaryRestImpl implements ResourceDictionaryRest {
-
-
- private ResourceDictionaryService resourceDictionaryService;
-
- /**
- * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database
- *
- * @param dataDictionaryService Data Dictionary Service
- */
- public ResourceDictionaryRestImpl(ResourceDictionaryService dataDictionaryService) {
- this.resourceDictionaryService = dataDictionaryService;
- }
-
- @Override
- public ResourceDictionary saveResourceDictionary(ResourceDictionary dataDictionary)
- throws BluePrintException {
- try {
- return resourceDictionaryService.saveResourceDictionary(dataDictionary);
- } catch (Exception e) {
- throw new BluePrintException(4100, e.getMessage(), e);
- }
- }
-
- @Override
- public void deleteResourceDictionaryByName(String name) throws BluePrintException {
- try {
- resourceDictionaryService.deleteResourceDictionary(name);
- } catch (Exception e) {
- throw new BluePrintException(4400, e.getMessage(), e);
- }
- }
-
- @Override
- public ResourceDictionary getResourceDictionaryByName(String resourcePath) throws BluePrintException {
- try {
- return resourceDictionaryService.getResourceDictionaryByName(resourcePath);
- } catch (Exception e) {
- throw new BluePrintException(4001, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)
- throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByNames(names);
- } catch (Exception e) {
- throw new BluePrintException(4002, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {
- try {
- return resourceDictionaryService.searchResourceDictionaryByTags(tags);
- } catch (Exception e) {
- throw new BluePrintException(4003, e.getMessage(), e);
- }
- }
-
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java index fcb8f311..d8ea1941 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java @@ -16,119 +16,87 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-import io.swagger.annotations.*;
+
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
+import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.*;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
import java.util.List;
-
/**
- * ServiceTemplateRest.java Purpose: ServiceTemplateRest interface
- *
- * @author Brinda Santh
- * @version 1.0
+ * {@inheritDoc}
*/
+@RestController
+@RequestMapping(value = "/api/v1/service-template")
+public class ServiceTemplateRest {
-@Api
-@Path("/service")
-@Produces({MediaType.APPLICATION_JSON})
-public interface ServiceTemplateRest {
+ private ServiceTemplateService serviceTemplateService;
/**
- * This is a enrichServiceTemplate rest service
- *
- * @param serviceTemplate
- * @return ServiceTemplate
- * @throws BluePrintException
+ * This is a ServiceTemplateRest constructor
+ *
+ * @param serviceTemplateService Service Template Service
*/
- @POST
- @Path("/servicetemplate/enrich")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to enrich service template", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ServiceTemplate enrichServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
- throws BluePrintException;
+ public ServiceTemplateRest(ServiceTemplateService serviceTemplateService) {
+ this.serviceTemplateService = serviceTemplateService;
+ }
- /**
- * This is a validateServiceTemplate rest service
- *
- * @param serviceTemplate
- * @return ServiceTemplate
- * @throws BluePrintException
- */
- @POST
- @Path("/servicetemplate/validate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to validate service template", response = ServiceTemplate.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- ServiceTemplate validateServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)
- throws BluePrintException;
+ @PostMapping(path = "/enrich")
+ public @ResponseBody
+ ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3500, e.getMessage(), e);
+ }
+ }
- /**
- * This is a generateResourceAssignments rest service
- *
- * @param templateContent
- * @return List<ResourceAssignment>
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/generate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to auto map for the Resource Mapping",
- response = ResourceAssignment.class, responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceAssignment> generateResourceAssignments(
- @ApiParam(required = true) ConfigModelContent templateContent) throws BluePrintException;
+ @PostMapping(path = "/validate")
+ public @ResponseBody
+ ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
+ try {
+ return serviceTemplateService.validateServiceTemplate(serviceTemplate);
+ } catch (Exception e) {
+ throw new BluePrintException(3501, e.getMessage(), e);
+ }
+ }
- /**
- * This is a autoMap rest service
- *
- * @param resourceAssignments
- * @return AutoMapResponse
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/automap")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to auto map for the Resource assignments",
- response = AutoMapResponse.class)
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- AutoMapResponse autoMap(@ApiParam(required = true) List<ResourceAssignment> resourceAssignments)
- throws BluePrintException;
+ @PostMapping(path = "/resource-assignment/auto-map")
+ public @ResponseBody
+ AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {
+ try {
+ return serviceTemplateService.autoMap(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3502, e.getMessage(), e);
+ }
+ }
- /**
- * This is a validateResourceAssignments rest service
- *
- * @param resourceAssignments
- * @return List<ResourceAssignment>
- * @throws BluePrintException
- */
- @POST
- @Path("/resourceassignment/validate")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- @ApiOperation(value = "Provides Rest service to validate Resource assignments", response = ResourceAssignment.class,
- responseContainer = "List")
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})
- List<ResourceAssignment> validateResourceAssignments(
- @ApiParam(required = true) List<ResourceAssignment> resourceAssignments) throws BluePrintException;
+ @PostMapping(path = "/resource-assignment/validate")
+ public @ResponseBody
+ List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.validateResourceAssignments(resourceAssignments);
+ } catch (Exception e) {
+ throw new BluePrintException(3503, e.getMessage(), e);
+ }
+ }
+
+ @PostMapping(path = "/resource-assignment/generate")
+ public @ResponseBody
+ List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)
+ throws BluePrintException {
+ try {
+ return serviceTemplateService.generateResourceAssignments(templateContent);
+ } catch (Exception e) {
+ throw new BluePrintException(3504, e.getMessage(), e);
+ }
+ }
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java deleted file mode 100644 index 6c49d5c6..00000000 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRestImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;
-
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;
-import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
-import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@Service
-public class ServiceTemplateRestImpl implements ServiceTemplateRest {
-
- private ServiceTemplateService serviceTemplateService;
-
- /**
- * This is a ServiceTemplateRestImpl constructor
- *
- * @param serviceTemplateService Service Template Service
- */
- public ServiceTemplateRestImpl(ServiceTemplateService serviceTemplateService) {
- this.serviceTemplateService = serviceTemplateService;
- }
-
- @Override
- public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.enrichServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3500, e.getMessage(), e);
- }
- }
-
- @Override
- public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
- try {
- return serviceTemplateService.validateServiceTemplate(serviceTemplate);
- } catch (Exception e) {
- throw new BluePrintException(3501, e.getMessage(), e);
- }
- }
-
- @Override
- public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
- try {
- return serviceTemplateService.autoMap(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3502, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)
- throws BluePrintException {
- try {
- return serviceTemplateService.validateResourceAssignments(resourceAssignments);
- } catch (Exception e) {
- throw new BluePrintException(3503, e.getMessage(), e);
- }
- }
-
- @Override
- public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent)
- throws BluePrintException {
- try {
- return serviceTemplateService.generateResourceAssignments(templateContent);
- } catch (Exception e) {
- throw new BluePrintException(3504, e.getMessage(), e);
- }
- }
-
-}
|