From de9cf67977d61d4843f1fb395ff53b2275bd46b1 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 10 Oct 2018 22:35:05 +0530 Subject: [PATCH] fixing issues with notification status not getting updated --- .../mgt/dao/impl/ProfileOperationDAOImpl.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index 86463ebca1..f890544188 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -99,11 +99,17 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { if (rs.next()) { byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); + int oppId = rs.getInt("OPERATION_ID"); bais = new ByteArrayInputStream(operationDetails); ois = new ObjectInputStream(bais); Object obj = ois.readObject(); if(obj instanceof String){ + Operation opp = super.getOperation(oppId); profileOperation = new ProfileOperation(); + profileOperation.setCode(opp.getCode()); + profileOperation.setId(oppId); + profileOperation.setCreatedTimeStamp(opp.getCreatedTimeStamp()); + profileOperation.setId(oppId); profileOperation.setPayLoad(obj); } else { profileOperation = (ProfileOperation) obj; @@ -126,7 +132,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { @Override public List getOperationsByDeviceAndStatus(int enrolmentId, - Operation.Status status) throws OperationManagementDAOException { + Operation.Status status) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; ProfileOperation profileOperation; @@ -150,12 +156,17 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { rs = stmt.executeQuery(); while (rs.next()) { + int oppId = rs.getInt("OPERATION_ID"); byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); bais = new ByteArrayInputStream(operationDetails); ois = new ObjectInputStream(bais); Object obj = ois.readObject(); if(obj instanceof String){ + Operation opp = super.getOperation(oppId); profileOperation = new ProfileOperation(); + profileOperation.setCode(opp.getCode()); + profileOperation.setId(oppId); + profileOperation.setCreatedTimeStamp(opp.getCreatedTimeStamp()); profileOperation.setPayLoad(obj); profileOperation.setStatus(status); operationList.add(profileOperation);