summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-10-27 18:02:02 +0530
committerSeshu Kumar M <seshu.kumar.m@huawei.com>2017-10-27 15:24:28 +0000
commit8568c74e9f44d72e3cc1e8c81e4028f5ba5d254e (patch)
treeb6a23e88b7b61026c3f8938ebd775fee02540213 /mso-api-handlers/mso-api-handler-infra/src
parentfc6ab7e90b9e30a705c21cbf7e716ac68098c65e (diff)
correction for the delete flow
IssueId: SO-259 Change-Id: Ibb7a78bc13628ffd2c9d2569dd40542adb9f299d Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index ecd0e4d4cc..c5827046d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -40,6 +40,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.codehaus.jackson.map.ObjectMapper;
+import org.eclipse.jetty.io.RuntimeIOException;
import org.hibernate.Session;
import org.json.JSONObject;
import org.openecomp.mso.apihandler.common.ErrorNumbers;
@@ -67,6 +68,7 @@ import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoDatabaseException;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.OperationStatus;
import org.openecomp.mso.requestsdb.RequestsDatabase;
@@ -761,7 +763,7 @@ public class E2EServiceInstances {
}
- private void createOperationStatusRecordForError(Action action, String requestId) {
+ private void createOperationStatusRecordForError(Action action, String requestId) throws MsoDatabaseException{
AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
@@ -780,21 +782,24 @@ public class E2EServiceInstances {
os.setResult("error");
os.setServiceId(requestId);
os.setUserId("");
- os.setFinishedAt(new Timestamp(System.currentTimeMillis()));
- os.setOperateAt(new Timestamp(System.currentTimeMillis()));
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
session.save(os);
session.getTransaction().commit();
} catch (Exception e) {
msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException("Data did inserted in Operatus Status Table for failure", e);
} finally {
if (null != session) {
session.close();
}
}
}
- private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) {
+ private void createOperationStatusRecord(String actionNm, String serviceId, String operationId) throws MsoDatabaseException{
AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
@@ -814,14 +819,17 @@ public class E2EServiceInstances {
os.setServiceId(serviceId);
//TODO : to be updated...
os.setUserId("");
- os.setFinishedAt(new Timestamp(System.currentTimeMillis()));
- os.setOperateAt(new Timestamp(System.currentTimeMillis()));
+ Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
+ Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
+ os.setFinishedAt(endTimeStamp);
+ os.setOperateAt(startTimeStamp);
session.save(os);
session.getTransaction().commit();
} catch (Exception e) {
msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request in Operation", e);
+ throw new MsoDatabaseException("Data did inserted in Operatus Status Table", e);
} finally {
if (null != session) {
session.close();