@Test public void testSourceIsNotComplaint() { AcmObjectHistory currentHistory = new AcmObjectHistory(); currentHistory.setObjectType(ParticipantConstants.OBJECT_TYPE); AcmObjectHistoryEvent event = new AcmObjectHistoryEvent(currentHistory); taskEventListener.onApplicationEvent(event); }
@Override public void onApplicationEvent(AcmObjectHistoryEvent event) { if (event != null && event.getSource() != null) { AcmObjectHistory acmObjectHistory = (AcmObjectHistory) event.getSource(); boolean isTask = checkExecution(acmObjectHistory.getObjectType()); if (isTask) { AcmUnmarshaller converter = getObjectConverter().getJsonUnmarshaller(); String jsonUpdatedTask = acmObjectHistory.getObjectString(); AcmTask updatedTask = converter.unmarshall(jsonUpdatedTask, AcmTask.class); AcmAssignment acmAssignment = createAcmAssignment(updatedTask); AcmObjectHistory acmObjectHistoryExisting = getAcmObjectHistoryService().getAcmObjectHistory(updatedTask.getId(), TaskConstants.OBJECT_TYPE); if (acmObjectHistoryExisting != null) { String json = acmObjectHistoryExisting.getObjectString(); AcmTask existing = converter.unmarshall(json, AcmTask.class); acmAssignment.setOldAssignee(existing.getAssignee()); if (isDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "details.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isPriorityChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "priority.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isStatusChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "status.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent, "from " + existing.getStatus() + " to " + updatedTask.getStatus()); } if (isReworkDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "reworkdetails.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } } if (isAssigneeChanged(acmAssignment)) { getAcmAssignmentDao().save(acmAssignment); getAcmObjectHistoryEventPublisher().publishAssigneeChangeEvent(acmAssignment, event.getUserId(), event.getIpAddress()); } } } }
AcmApplicationTaskEventListener implements ApplicationListener<AcmObjectHistoryEvent> { @Override public void onApplicationEvent(AcmObjectHistoryEvent event) { if (event != null && event.getSource() != null) { AcmObjectHistory acmObjectHistory = (AcmObjectHistory) event.getSource(); boolean isTask = checkExecution(acmObjectHistory.getObjectType()); if (isTask) { AcmUnmarshaller converter = getObjectConverter().getJsonUnmarshaller(); String jsonUpdatedTask = acmObjectHistory.getObjectString(); AcmTask updatedTask = converter.unmarshall(jsonUpdatedTask, AcmTask.class); AcmAssignment acmAssignment = createAcmAssignment(updatedTask); AcmObjectHistory acmObjectHistoryExisting = getAcmObjectHistoryService().getAcmObjectHistory(updatedTask.getId(), TaskConstants.OBJECT_TYPE); if (acmObjectHistoryExisting != null) { String json = acmObjectHistoryExisting.getObjectString(); AcmTask existing = converter.unmarshall(json, AcmTask.class); acmAssignment.setOldAssignee(existing.getAssignee()); if (isDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "details.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isPriorityChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "priority.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isStatusChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "status.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent, "from " + existing.getStatus() + " to " + updatedTask.getStatus()); } if (isReworkDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "reworkdetails.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } } if (isAssigneeChanged(acmAssignment)) { getAcmAssignmentDao().save(acmAssignment); getAcmObjectHistoryEventPublisher().publishAssigneeChangeEvent(acmAssignment, event.getUserId(), event.getIpAddress()); } } } } }
AcmApplicationTaskEventListener implements ApplicationListener<AcmObjectHistoryEvent> { @Override public void onApplicationEvent(AcmObjectHistoryEvent event) { if (event != null && event.getSource() != null) { AcmObjectHistory acmObjectHistory = (AcmObjectHistory) event.getSource(); boolean isTask = checkExecution(acmObjectHistory.getObjectType()); if (isTask) { AcmUnmarshaller converter = getObjectConverter().getJsonUnmarshaller(); String jsonUpdatedTask = acmObjectHistory.getObjectString(); AcmTask updatedTask = converter.unmarshall(jsonUpdatedTask, AcmTask.class); AcmAssignment acmAssignment = createAcmAssignment(updatedTask); AcmObjectHistory acmObjectHistoryExisting = getAcmObjectHistoryService().getAcmObjectHistory(updatedTask.getId(), TaskConstants.OBJECT_TYPE); if (acmObjectHistoryExisting != null) { String json = acmObjectHistoryExisting.getObjectString(); AcmTask existing = converter.unmarshall(json, AcmTask.class); acmAssignment.setOldAssignee(existing.getAssignee()); if (isDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "details.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isPriorityChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "priority.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isStatusChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "status.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent, "from " + existing.getStatus() + " to " + updatedTask.getStatus()); } if (isReworkDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "reworkdetails.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } } if (isAssigneeChanged(acmAssignment)) { getAcmAssignmentDao().save(acmAssignment); getAcmObjectHistoryEventPublisher().publishAssigneeChangeEvent(acmAssignment, event.getUserId(), event.getIpAddress()); } } } }  }
AcmApplicationTaskEventListener implements ApplicationListener<AcmObjectHistoryEvent> { @Override public void onApplicationEvent(AcmObjectHistoryEvent event) { if (event != null && event.getSource() != null) { AcmObjectHistory acmObjectHistory = (AcmObjectHistory) event.getSource(); boolean isTask = checkExecution(acmObjectHistory.getObjectType()); if (isTask) { AcmUnmarshaller converter = getObjectConverter().getJsonUnmarshaller(); String jsonUpdatedTask = acmObjectHistory.getObjectString(); AcmTask updatedTask = converter.unmarshall(jsonUpdatedTask, AcmTask.class); AcmAssignment acmAssignment = createAcmAssignment(updatedTask); AcmObjectHistory acmObjectHistoryExisting = getAcmObjectHistoryService().getAcmObjectHistory(updatedTask.getId(), TaskConstants.OBJECT_TYPE); if (acmObjectHistoryExisting != null) { String json = acmObjectHistoryExisting.getObjectString(); AcmTask existing = converter.unmarshall(json, AcmTask.class); acmAssignment.setOldAssignee(existing.getAssignee()); if (isDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "details.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isPriorityChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "priority.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isStatusChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "status.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent, "from " + existing.getStatus() + " to " + updatedTask.getStatus()); } if (isReworkDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "reworkdetails.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } } if (isAssigneeChanged(acmAssignment)) { getAcmAssignmentDao().save(acmAssignment); getAcmObjectHistoryEventPublisher().publishAssigneeChangeEvent(acmAssignment, event.getUserId(), event.getIpAddress()); } } } }  @Override void onApplicationEvent(AcmObjectHistoryEvent event); boolean isAssigneeChanged(AcmAssignment assignment); boolean isDetailsChanged(AcmTask existing, AcmTask updatedTask); boolean isReworkDetailsChanged(AcmTask existing, AcmTask updatedTask); AcmObjectHistoryService getAcmObjectHistoryService(); void setAcmObjectHistoryService(AcmObjectHistoryService acmObjectHistoryService); TaskEventPublisher getTaskEventPublisher(); void setTaskEventPublisher(TaskEventPublisher taskEventPublisher); AcmObjectHistoryEventPublisher getAcmObjectHistoryEventPublisher(); void setAcmObjectHistoryEventPublisher(AcmObjectHistoryEventPublisher acmObjectHistoryEventPublisher); AcmAssignmentDao getAcmAssignmentDao(); void setAcmAssignmentDao(AcmAssignmentDao acmAssignmentDao); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter); }
AcmApplicationTaskEventListener implements ApplicationListener<AcmObjectHistoryEvent> { @Override public void onApplicationEvent(AcmObjectHistoryEvent event) { if (event != null && event.getSource() != null) { AcmObjectHistory acmObjectHistory = (AcmObjectHistory) event.getSource(); boolean isTask = checkExecution(acmObjectHistory.getObjectType()); if (isTask) { AcmUnmarshaller converter = getObjectConverter().getJsonUnmarshaller(); String jsonUpdatedTask = acmObjectHistory.getObjectString(); AcmTask updatedTask = converter.unmarshall(jsonUpdatedTask, AcmTask.class); AcmAssignment acmAssignment = createAcmAssignment(updatedTask); AcmObjectHistory acmObjectHistoryExisting = getAcmObjectHistoryService().getAcmObjectHistory(updatedTask.getId(), TaskConstants.OBJECT_TYPE); if (acmObjectHistoryExisting != null) { String json = acmObjectHistoryExisting.getObjectString(); AcmTask existing = converter.unmarshall(json, AcmTask.class); acmAssignment.setOldAssignee(existing.getAssignee()); if (isDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "details.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isPriorityChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "priority.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } if (isStatusChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "status.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent, "from " + existing.getStatus() + " to " + updatedTask.getStatus()); } if (isReworkDetailsChanged(existing, updatedTask)) { AcmApplicationTaskEvent taskEvent = new AcmApplicationTaskEvent(updatedTask, "reworkdetails.changed", event.getUserId(), true, event.getIpAddress()); getTaskEventPublisher().publishTaskEvent(taskEvent); } } if (isAssigneeChanged(acmAssignment)) { getAcmAssignmentDao().save(acmAssignment); getAcmObjectHistoryEventPublisher().publishAssigneeChangeEvent(acmAssignment, event.getUserId(), event.getIpAddress()); } } } }  @Override void onApplicationEvent(AcmObjectHistoryEvent event); boolean isAssigneeChanged(AcmAssignment assignment); boolean isDetailsChanged(AcmTask existing, AcmTask updatedTask); boolean isReworkDetailsChanged(AcmTask existing, AcmTask updatedTask); AcmObjectHistoryService getAcmObjectHistoryService(); void setAcmObjectHistoryService(AcmObjectHistoryService acmObjectHistoryService); TaskEventPublisher getTaskEventPublisher(); void setTaskEventPublisher(TaskEventPublisher taskEventPublisher); AcmObjectHistoryEventPublisher getAcmObjectHistoryEventPublisher(); void setAcmObjectHistoryEventPublisher(AcmObjectHistoryEventPublisher acmObjectHistoryEventPublisher); AcmAssignmentDao getAcmAssignmentDao(); void setAcmAssignmentDao(AcmAssignmentDao acmAssignmentDao); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }