diff options
Diffstat (limited to 'adapters/mso-requests-db-adapter')
2 files changed, 76 insertions, 3 deletions
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 43273df14f..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 @@ -59,6 +60,7 @@ public interface MsoRequestsDbAdapter { @WebMethod public void updateServiceOperationStatus (@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId, @WebParam(name = "operationId") @XmlElement(required = false) String operationId, + @WebParam(name = "serviceName") @XmlElement(required = false) String serviceName, @WebParam(name = "operationType") @XmlElement(required = false) String operationType, @WebParam(name = "userId") @XmlElement(required = false) String userId, @WebParam(name = "result") @XmlElement(required = false) String result, @@ -71,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 87be2e1ccb..0b404d76bd 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 @@ -22,7 +22,6 @@ package org.openecomp.mso.adapters.requestsdb; import java.sql.Timestamp; -import javax.jws.WebMethod; import javax.jws.WebService; import org.hibernate.HibernateException; @@ -283,11 +282,13 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { * @since ONAP Amsterdam Release */ @Override - public void updateServiceOperationStatus(String serviceId, String operationId, String operationType, String userId, + 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); operStatus.setUserId(userId); operStatus.setOperation(operationType); operStatus.setReason(reason); @@ -312,6 +313,9 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { String resourceTemplateUUIDs) throws MsoRequestsDbException{ String[] resourceLst = resourceTemplateUUIDs.split(":"); for(String resource: resourceLst){ + if("".equals(resource)){ + continue; + } ResourceOperationStatus resourceStatus = new ResourceOperationStatus(); resourceStatus.setOperationId(operationId); resourceStatus.setServiceId(serviceId); @@ -322,5 +326,56 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { RequestsDatabase.getInstance().updateResOperStatus(resourceStatus); } } - + + /** + * get resource operation status + * <br> + * + * @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 + * <br> + * + * @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); + } } |