summaryrefslogtreecommitdiffstats
path: root/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java
diff options
context:
space:
mode:
Diffstat (limited to 'dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java')
-rw-r--r--dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java73
1 files changed, 37 insertions, 36 deletions
diff --git a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java
index 0e1b209..7d64dad 100644
--- a/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java
+++ b/dcaedt_be/src/main/java/org/onap/sdc/dcae/composition/controller/VfcmtController.java
@@ -8,6 +8,7 @@ import org.onap.sdc.dcae.composition.restmodels.ImportVFCMTRequest;
import org.onap.sdc.dcae.composition.restmodels.sdc.ExternalReferencesMap;
import org.onap.sdc.dcae.composition.restmodels.sdc.Resource;
import org.onap.sdc.dcae.composition.restmodels.sdc.ResourceDetailed;
+import org.onap.sdc.dcae.enums.AssetType;
import org.onap.sdc.dcae.errormng.ErrConfMgr.ApiType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -23,14 +24,14 @@ import java.util.List;
public class VfcmtController extends BaseController{
- @Autowired
- private VfcmtBusinessLogic vfcmtBusinessLogic;
+ @Autowired
+ private VfcmtBusinessLogic vfcmtBusinessLogic;
@Autowired
private ReferenceBusinessLogic referenceBusinessLogic;
- private static final String VFCMT = "VFCMT";
- private static final String TEMPLATE = "Template";
+ private static final String TEMPLATE = "Template";
private static final String BASE_MONITORING_TEMPLATE = "Base Monitoring Template";
+ private static final String MONITORING_TEMPLATE = "Monitoring Template";
@@ -56,7 +57,7 @@ public class VfcmtController extends BaseController{
@RequestMapping(value = { "/getResourcesByCategory" }, method = { RequestMethod.GET }, produces = {"application/json" })
public ResponseEntity getResourcesByCategory(@ModelAttribute("requestId") String requestId) {
try {
- List<Resource> resources = baseBusinessLogic.getSdcRestClient().getResources(VFCMT, null, null, requestId);
+ List<Resource> resources = baseBusinessLogic.getSdcRestClient().getResources(AssetType.VFCMT.name(), TEMPLATE, MONITORING_TEMPLATE, requestId);
return new ResponseEntity<>(resources, HttpStatus.OK);
} catch (Exception e) {
return handleException(e, ApiType.GET_ALL_VFCMTS);
@@ -85,7 +86,7 @@ public class VfcmtController extends BaseController{
@RequestMapping(value = { "/getResourcesByMonitoringTemplateCategory" }, method = { RequestMethod.GET }, produces = {"application/json" })
public ResponseEntity getResourcesByMonitoringTemplateCategory(@ModelAttribute("requestId") String requestId) {
try {
- List<Resource> resources = baseBusinessLogic.getSdcRestClient().getResources(VFCMT, TEMPLATE, BASE_MONITORING_TEMPLATE, requestId);
+ List<Resource> resources = baseBusinessLogic.getSdcRestClient().getResources(AssetType.VFCMT.name(), TEMPLATE, BASE_MONITORING_TEMPLATE, requestId);
return new ResponseEntity<>(resources, HttpStatus.OK);
} catch (Exception e) {
return handleException(e, ApiType.GET_ALL_VFCMTS);
@@ -100,7 +101,7 @@ public class VfcmtController extends BaseController{
*/
@RequestMapping(value = "/createVFCMT", method = RequestMethod.POST, produces = {"application/json" })
public ResponseEntity createVFCMT(@RequestHeader("USER_ID") String userId, @RequestBody CreateVFCMTRequest request, @ModelAttribute("requestId") String requestId) {
- vfcmtBusinessLogic.addSdcMandatoryFields(request, userId);
+ vfcmtBusinessLogic.addSdcMandatoryFields(request, userId);
try {
ResourceDetailed response = baseBusinessLogic.getSdcRestClient().createResource(userId, request, requestId);
debugLogger.log(LogLevel.DEBUG, this.getClass().getName(), "createVFCMT after post: {}", response);
@@ -122,28 +123,28 @@ public class VfcmtController extends BaseController{
}
- /***
- * Clone or import existing VFCMT and attach to selected service/resource
- * @param userId
- * @param request
- * @return ResponseEntity
- */
- @RequestMapping(value = "/importMC", method = RequestMethod.POST, produces = {"application/json" })
- public ResponseEntity importMC(@RequestHeader("USER_ID") String userId, @RequestBody ImportVFCMTRequest request, @ModelAttribute("requestId") String requestId) {
- return vfcmtBusinessLogic.importMC(userId, request, requestId);
- }
+ /***
+ * Clone or import existing VFCMT and attach to selected service/resource
+ * @param userId
+ * @param request
+ * @return ResponseEntity
+ */
+ @RequestMapping(value = "/importMC", method = RequestMethod.POST, produces = {"application/json" })
+ public ResponseEntity importMC(@RequestHeader("USER_ID") String userId, @RequestBody ImportVFCMTRequest request, @ModelAttribute("requestId") String requestId) {
+ return vfcmtBusinessLogic.importMC(userId, request, requestId);
+ }
/***
* GET a list of Monitoring Components of a service by uuid and version
- * @param context the context type of this request
+ * @param contextType the context type of this request
* @param uuid the uuid of the type requested
* @param version the version of the entity requested
* @return ResponseEntity
*/
- @RequestMapping(value = { "/{context}/{uuid}/{version}/monitoringComponents" }, method = { RequestMethod.GET }, produces = {"application/json" })
- public ResponseEntity getMonitoringComponents(@PathVariable String context, @PathVariable String uuid, @PathVariable String version, @ModelAttribute("requestId") String requestId) {
+ @RequestMapping(value = { "/{contextType}/{uuid}/{version}/monitoringComponents" }, method = { RequestMethod.GET }, produces = {"application/json" })
+ public ResponseEntity getMonitoringComponents(@PathVariable String contextType, @PathVariable String uuid, @PathVariable String version, @ModelAttribute("requestId") String requestId) {
try {
- ExternalReferencesMap mcRefs = baseBusinessLogic.getSdcRestClient().getMonitoringReferences(context, uuid, version, requestId);
+ ExternalReferencesMap mcRefs = baseBusinessLogic.getSdcRestClient().getMonitoringReferences(contextType, uuid, version, requestId);
debugLogger.log(LogLevel.DEBUG, this.getClass().getName(), "Got monitoring references map from SDC: {}", mcRefs.values());
return new ResponseEntity<>(referenceBusinessLogic.fetchMonitoringComponents(mcRefs, requestId), HttpStatus.OK);
} catch (Exception e) {
@@ -151,33 +152,33 @@ public class VfcmtController extends BaseController{
}
}
- @RequestMapping(value = { "/{context}/{serviceUuid}/{vfiName}/{vfcmtUuid}/deleteVfcmtReference" }, method = { RequestMethod.DELETE }, produces = {"application/json" })
- public ResponseEntity deleteVfcmtReference(@RequestHeader("USER_ID") String userId, @PathVariable String context, @PathVariable String serviceUuid, @PathVariable String vfiName, @PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
+ @RequestMapping(value = { "/{contextType}/{serviceUuid}/{vfiName}/{vfcmtUuid}/deleteVfcmtReference" }, method = { RequestMethod.DELETE }, produces = {"application/json" })
+ public ResponseEntity deleteVfcmtReference(@RequestHeader("USER_ID") String userId, @PathVariable String contextType, @PathVariable String serviceUuid, @PathVariable String vfiName, @PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
try {
- referenceBusinessLogic.deleteVfcmtReference(userId, context, serviceUuid, vfiName, vfcmtUuid, requestId);
+ referenceBusinessLogic.deleteVfcmtReference(userId, contextType, serviceUuid, vfiName, vfcmtUuid, requestId);
return new ResponseEntity<>(HttpStatus.OK);
} catch (Exception e) {
return handleException(e, ApiType.DELETE_VFCMT_REFERENCE);
}
}
- @RequestMapping(value = { "/{context}/{monitoringComponentName}/{serviceUuid}/{vfiName}/{vfcmtUuid}/deleteVfcmtReference" }, method = { RequestMethod.DELETE }, produces = {"application/json" })
- public ResponseEntity deleteVfcmtReferenceWithBlueprint(@RequestHeader("USER_ID") String userId, @PathVariable String context, @PathVariable String monitoringComponentName, @PathVariable String serviceUuid, @PathVariable String vfiName, @PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
+ @RequestMapping(value = { "/{contextType}/{monitoringComponentName}/{serviceUuid}/{vfiName}/{vfcmtUuid}/deleteVfcmtReference" }, method = { RequestMethod.DELETE }, produces = {"application/json" })
+ public ResponseEntity deleteVfcmtReferenceWithBlueprint(@RequestHeader("USER_ID") String userId, @PathVariable String contextType, @PathVariable String monitoringComponentName, @PathVariable String serviceUuid, @PathVariable String vfiName, @PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
try {
- referenceBusinessLogic.deleteVfcmtReference(userId, context, serviceUuid, vfiName, vfcmtUuid, requestId);
+ referenceBusinessLogic.deleteVfcmtReference(userId, contextType, serviceUuid, vfiName, vfcmtUuid, requestId);
} catch (Exception e) {
return handleException(e, ApiType.DELETE_VFCMT_REFERENCE);
}
- return referenceBusinessLogic.deleteVfcmtReferenceBlueprint(userId, context, monitoringComponentName, serviceUuid, vfiName, vfcmtUuid, requestId);
+ return referenceBusinessLogic.deleteVfcmtReferenceBlueprint(userId, contextType, monitoringComponentName, serviceUuid, vfiName, vfcmtUuid, requestId);
}
- @RequestMapping(value = { "/getVfcmtReferenceData/{vfcmtUuid}" }, method = { RequestMethod.GET }, produces = {"application/json" })
- public ResponseEntity getVfcmtReferenceData(@PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
- try {
- return vfcmtBusinessLogic.getVfcmtReferenceData(vfcmtUuid, requestId);
- } catch (Exception e) {
- return handleException(e, ApiType.GET_VFCMT);
- }
- }
+ @RequestMapping(value = { "/getVfcmtReferenceData/{vfcmtUuid}" }, method = { RequestMethod.GET }, produces = {"application/json" })
+ public ResponseEntity getVfcmtReferenceData(@PathVariable String vfcmtUuid, @ModelAttribute String requestId) {
+ try {
+ return vfcmtBusinessLogic.getVfcmtReferenceData(vfcmtUuid, requestId);
+ } catch (Exception e) {
+ return handleException(e, ApiType.GET_VFCMT);
+ }
+ }
}