@Override public void processRow(ResultSet resultSet) throws SQLException { result.put( resultSet.getLong(1), new Payload(resultSet.getBytes("payload")) ); } });
private boolean isSensitive(Payload payload) { return payload.getData()[INFRA_PART_BYTE] == IS_SENSITIVE; }
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @Override public Object clone() { try { ExecutionMessage cloned = (ExecutionMessage) super.clone(); if (payload != null) cloned.payload = (Payload) (payload.clone()); return cloned; } catch (CloneNotSupportedException ex) { throw new RuntimeException("Failed to clone message", ex); } }
@Override public ExecutionMessage mapRow(ResultSet rs, int rowNum) throws SQLException { return new ExecutionMessage(rs.getLong("EXEC_STATE_ID"), rs.getString("ASSIGNED_WORKER"), rs.getString("EXEC_GROUP"), rs.getString("MSG_ID"), ExecStatus.find(rs.getInt("STATUS")), new Payload(rs.getBytes("PAYLOAD")), rs.getInt("MSG_SEQ_ID"), rs.getLong("CREATE_TIME")); } }
private void setSensitive(Payload payload) { payload.getData()[INFRA_PART_BYTE] = IS_SENSITIVE; }
@SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @Override public Object clone() { try { ExecutionMessage cloned = (ExecutionMessage) super.clone(); if (payload != null) cloned.payload = (Payload) (payload.clone()); return cloned; } catch (CloneNotSupportedException ex) { throw new RuntimeException("Failed to clone message", ex); } }
@Override public SystemContext extractSystemContext(byte[] executionObjectSerialized) { Execution execution = executionMessageConverter.extractExecution(new Payload(executionObjectSerialized)); return execution.getSystemContext(); }
private void setSensitive(Payload payload) { payload.getData()[INFRA_PART_BYTE] = IS_SENSITIVE; }
@Override public SystemContext extractSystemContext(byte[] executionObjectSerialized) { Execution execution = executionMessageConverter.extractExecution(new Payload(executionObjectSerialized)); return execution.getSystemContext(); }
private boolean isSensitive(Payload payload) { return payload.getData()[INFRA_PART_BYTE] == IS_SENSITIVE; }
public Payload createPayload(Execution execution, boolean setContainsSensitiveData) { Payload payload = new Payload(objToBytes(execution)); if(setContainsSensitiveData || checkContainsSensitiveData(execution)) { setSensitive(payload); } return payload; }
public <T> T extractExecution(Payload payload) { return objFromBytes(payload.getData()); }
public Payload createPayload(Execution execution, boolean setContainsSensitiveData) { Payload payload = new Payload(objToBytes(execution)); if(setContainsSensitiveData || checkContainsSensitiveData(execution)) { setSensitive(payload); } return payload; }
public <T> T extractExecution(Payload payload) { return objFromBytes(payload.getData()); }
@Override public Long reTrigger(SystemContext newSystemContext, byte[] executionObj) { Execution execution = executionMessageConverter.extractExecution(new Payload(executionObj)); //We must refresh the system context with the new one in order to re-trigger execution.getSystemContext().clear(); execution.getSystemContext().putAll(newSystemContext); //generate new execution id Long newExecutionId = idGenerator.next(); execution.getSystemContext().setExecutionId(newExecutionId); execution.setExecutionId(newExecutionId); // create execution record in ExecutionSummary table executionStateService.createParentExecution(execution.getExecutionId()); // create execution message ExecutionMessage message = createExecutionMessage(execution); queueDispatcher.dispatch(Collections.singletonList(message)); return newExecutionId; }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { ExecutionMessage msg = stateMessages.get(i); ps.setLong(1, msg.getExecStateId()); ps.setString(2, msg.getMsgId()); ps.setBytes(3, msg.getPayload().getData()); }
@Override public Long reTrigger(SystemContext newSystemContext, byte[] executionObj) { Execution execution = executionMessageConverter.extractExecution(new Payload(executionObj)); //We must refresh the system context with the new one in order to re-trigger execution.getSystemContext().clear(); execution.getSystemContext().putAll(newSystemContext); //generate new execution id Long newExecutionId = idGenerator.next(); execution.getSystemContext().setExecutionId(newExecutionId); execution.setExecutionId(newExecutionId); // create execution record in ExecutionSummary table executionStateService.createParentExecution(execution.getExecutionId()); // create execution message ExecutionMessage message = createExecutionMessage(execution); queueDispatcher.dispatch(Collections.singletonList(message)); return newExecutionId; }