private WorkflowAnnotation findAnnotationById( List<WorkflowAnnotation> annotations, String idToFind) { WorkflowAnnotation found = null; for (WorkflowAnnotation annotation : annotations) { if (annotation.getId().equals(idToFind)) { found = annotation; break; } } return found; }
public void updateAnnotationForWorkflow(JiraWorkflow workflow, WorkflowAnnotation annotation) throws Exception { String propKey = getPropertyKey(workflow); List<WorkflowAnnotation> annotations = loadAnnotations(propKey); WorkflowAnnotation oldAnnotation = findAnnotationById(annotations, annotation.getId()); if (oldAnnotation != null) { oldAnnotation.setDescription(annotation.getDescription()); } saveAnnotations(propKey, annotations); }
public void removeAnnotationFromWorkflow(JiraWorkflow workflow, String annotationId) throws Exception { String propKey = getPropertyKey(workflow); List<WorkflowAnnotation> annotations = loadAnnotations(propKey); Iterator<WorkflowAnnotation> i = annotations.iterator(); WorkflowAnnotation annotation; while (i.hasNext()) { annotation = i.next(); if (annotation.getId().equals(annotationId)) { i.remove(); } } saveAnnotations(propKey, annotations); }
public void addAnnotationToWorkflow(JiraWorkflow workflow, WorkflowAnnotation annotation) throws Exception { String propKey = getPropertyKey(workflow); List<WorkflowAnnotation> annotations = loadAnnotations(propKey); WorkflowAnnotation oldAnnotation = findAnnotationById(annotations, annotation.getId()); if (oldAnnotation == null) { annotations.add(annotation); } saveAnnotations(propKey, annotations); }
public boolean workflowHasAnnotation(JiraWorkflow workflow, WorkflowAnnotation annotation) throws Exception { return workflowHasAnnotation(workflow, annotation.getId()); }
public void removeAnnotationFromWorkflow(JiraWorkflow workflow, WorkflowAnnotation annotation) throws Exception { removeAnnotationFromWorkflow(workflow, annotation.getId()); }