From a75282a875b6f1aa394733a3e65c0debdd2f01fc Mon Sep 17 00:00:00 2001 From: c00149107 Date: Fri, 27 Oct 2017 14:53:10 +0800 Subject: Add resource operation status oper Add resource operation status oper in requests db adapter Change-Id: I0c6a21178147c6c9cac9d1492cd1503e8f658157 Issue-ID:SO-276 Signed-off-by: c00149107 --- .../adapters/requestsdb/MsoRequestsDbAdapter.java | 17 +++++++ .../requestsdb/MsoRequestsDbAdapterImpl.java | 54 +++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) (limited to 'adapters/mso-requests-db-adapter/src/main/java') diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java index 2b2e2dce78..877012c2fe 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java @@ -27,6 +27,7 @@ import javax.xml.bind.annotation.XmlElement; import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.openecomp.mso.requestsdb.InfraActiveRequests; +import org.openecomp.mso.requestsdb.ResourceOperationStatus; /** * MSO Request DB Adapter Web Service @@ -72,5 +73,21 @@ public interface MsoRequestsDbAdapter { @WebParam(name = "operationId") @XmlElement(required = true) String operationId, @WebParam(name = "operationType") @XmlElement(required = true) String operationType, @WebParam(name = "resourceTemplateUUIDs") @XmlElement(required = true) String resourceTemplateUUIDs) throws MsoRequestsDbException; + + @WebMethod + public ResourceOperationStatus getResourceOperationStatus (@WebParam(name="serviceId") @XmlElement(required = true) String serviceId, + @WebParam(name = "operationId") @XmlElement(required = true) String operationId, + @WebParam(name = "resourceTemplateUUID") @XmlElement(required = true) String resourceTemplateUUID) throws MsoRequestsDbException; + @WebMethod + public void updateResourceOperationStatus (@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId, + @WebParam(name = "operationId") @XmlElement(required = true) String operationId, + @WebParam(name = "resourceTemplateUUID") @XmlElement(required = true) String resourceTemplateUUID, + @WebParam(name = "operType") @XmlElement(required = false) String operType, + @WebParam(name = "resourceInstanceID") @XmlElement(required = false) String resourceInstanceID, + @WebParam(name = "jobId") @XmlElement(required = false) String jobId, + @WebParam(name = "status") @XmlElement(required = false) String status, + @WebParam(name = "progress") @XmlElement(required = false) String progress, + @WebParam(name = "errorCode") @XmlElement(required = false) String errorCode, + @WebParam(name = "statusDescription") @XmlElement(required = false) String statusDescription) throws MsoRequestsDbException; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index 900107d3c3..0bdead4835 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -285,6 +285,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { public void updateServiceOperationStatus(String serviceId, String operationId, String serviceName,String operationType, String userId, String result, String operationContent, String progress, String reason) throws MsoRequestsDbException { OperationStatus operStatus = new OperationStatus(); + operStatus.setResult(RequestsDbConstant.Status.PROCESSING); operStatus.setServiceId(serviceId); operStatus.setOperationId(operationId); operStatus.setServiceName(serviceName); @@ -322,5 +323,56 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { RequestsDatabase.getInstance().updateResOperStatus(resourceStatus); } } - + + /** + * get resource operation status + *
+ * + * @param serviceId + * @param operationId + * @param resourceUUID + * @return + * @throws MsoRequestsDbException + * @since ONAP Amsterdam Release + */ + @Override + public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID) + throws MsoRequestsDbException { + return RequestsDatabase.getInstance().getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); + } + + /** + * update resource operation status + *
+ * + * @param serviceId + * @param operationId + * @param resourceUUID + * @param operationType + * @param resourceInstanceID + * @param jobId + * @param status + * @param progress + * @param errorCode + * @param statusDescription + * @throws MsoRequestsDbException + * @since ONAP Amsterdam Release + */ + @Override + public void updateResourceOperationStatus(String serviceId, String operationId, String resourceTemplateUUID, + String operType, String resourceInstanceID, String jobId, String status, String progress, + String errorCode, String statusDescription) throws MsoRequestsDbException { + ResourceOperationStatus resStatus = new ResourceOperationStatus(); + resStatus.setServiceId(serviceId); + resStatus.setOperationId(operationId); + resStatus.setResourceTemplateUUID(resourceTemplateUUID); + resStatus.setOperType(operType); + resStatus.setResourceInstanceID(resourceInstanceID); + resStatus.setJobId(jobId); + resStatus.setStatus(status); + resStatus.setProgress(progress); + resStatus.setErrorCode(errorCode); + resStatus.setStatusDescription(statusDescription); + RequestsDatabase.getInstance().updateResOperStatus(resStatus); + } } -- cgit 1.2.3-korg