private ImmutableList<ChangedValue> computeChangedValues(final JiraWorkflow originalWorkflow, final JiraWorkflow currentWorkflow) { final ChangedValuesBuilder changedValues = new ChangedValuesBuilder(); changedValues.addIfDifferent("common.words.name", originalWorkflow == null ? null : originalWorkflow.getDisplayName(), currentWorkflow.getDisplayName()) .addIfDifferent("common.words.description", originalWorkflow == null ? null : originalWorkflow.getDescription(), currentWorkflow.getDescription()); return changedValues.build(); } }
private RecordRequest workflowCreated(final JiraWorkflow workflow) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.created") .forObject(AssociatedItem.Type.WORKFLOW, workflow.getDisplayName(), workflow.getName()) .withChangedValues(computeChangedValues(workflow)); }
@Override public RecordRequest onWorkflowDeletedEvent(final WorkflowDeletedEvent event) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.deleted") .forObject(AssociatedItem.Type.WORKFLOW, event.getWorkflow().getDisplayName(), event.getWorkflow().getName()); }
private RecordRequest workflowUpdated(JiraWorkflow fromWorkflow, final JiraWorkflow toWorkflow) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.updated") .forObject(AssociatedItem.Type.WORKFLOW, toWorkflow.getDisplayName(), toWorkflow.getName()) .withChangedValues(computeChangedValues(fromWorkflow, toWorkflow)); }