Persisting profile operations as string payloads and retriving same as strings, failing which as profile objects to support legacy functonality

4.x.x
Ace 6 years ago
parent 77db878951
commit deeeb2ce48

@ -53,7 +53,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
bao = new ByteArrayOutputStream(); bao = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bao); oos = new ObjectOutputStream(bao);
oos.writeObject(operation); oos.writeObject(operation.getPayLoad());
stmt.setInt(1, operationId); stmt.setInt(1, operationId);
stmt.setBytes(2, bao.toByteArray()); stmt.setBytes(2, bao.toByteArray());
@ -101,7 +101,13 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); byte[] operationDetails = rs.getBytes("OPERATION_DETAILS");
bais = new ByteArrayInputStream(operationDetails); bais = new ByteArrayInputStream(operationDetails);
ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
profileOperation = (ProfileOperation) ois.readObject(); Object obj = ois.readObject();
if(obj instanceof String){
profileOperation = new ProfileOperation();
profileOperation.setPayLoad(obj);
} else {
profileOperation = (ProfileOperation) obj;
}
} }
} catch (IOException e) { } catch (IOException e) {
throw new OperationManagementDAOException("IO Error occurred while de serialize the profile " + throw new OperationManagementDAOException("IO Error occurred while de serialize the profile " +
@ -147,9 +153,17 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); byte[] operationDetails = rs.getBytes("OPERATION_DETAILS");
bais = new ByteArrayInputStream(operationDetails); bais = new ByteArrayInputStream(operationDetails);
ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
profileOperation = (ProfileOperation) ois.readObject(); Object obj = ois.readObject();
if(obj instanceof String){
profileOperation = new ProfileOperation();
profileOperation.setPayLoad(obj);
profileOperation.setStatus(status);
operationList.add(profileOperation);
} else {
profileOperation = (ProfileOperation) obj;
profileOperation.setStatus(status); profileOperation.setStatus(status);
operationList.add(profileOperation); operationList.add(profileOperation);
};
} }
} catch (IOException e) { } catch (IOException e) {

Loading…
Cancel
Save