@Override public Iterable<DraftState> getSchemesUsingWorkflow(JiraWorkflow jiraWorkflow) { List<DraftState> states = new ArrayList<DraftState>(); for (Map.Entry<Long, DraftState> entry : workflowState.entrySet()) { DraftState state = entry.getValue(); if (state.getMappings().containsValue(jiraWorkflow.getName())) { states.add(state); } } return states; }
@Override public boolean renameWorkflow(String oldName, String newName) { boolean changed = false; for (DraftState state : Lists.newArrayList(getAll())) { Map<String, String> newMap = Maps.newHashMap(); boolean newMapChanged = false; for (Map.Entry<String, String> entry : state.getMappings().entrySet()) { if (oldName.equals(entry.getValue())) { newMapChanged = true; newMap.put(entry.getKey(), newName); } else { newMap.put(entry.getKey(), entry.getValue()); } } if (newMapChanged) { addState(state.builder().setMappings(newMap).build()); changed = true; } } return changed; }
public Builder(DraftWorkflowSchemeStore.DraftState state) { this.id = state.getId(); this.parentId = state.getParentSchemeId(); this.schemeMap = newHashMap(state.getMappings()); this.lastModifiedDate = state.getLastModifiedDate(); this.lastModifiedUser = state.getLastModifiedUser(); }
MockDraftWorkflowSchemeState(DraftWorkflowSchemeStore.DraftState scheme) { this.id = scheme.getId(); this.mappings = Maps.newHashMap(scheme.getMappings()); this.lastModifiedUser = scheme.getLastModifiedUser(); this.lastModifiedDate = scheme.getLastModifiedDate(); this.parentSchemeId = scheme.getParentSchemeId(); }
DraftWorkflowSchemeImpl(DraftWorkflowSchemeStore.DraftState state, ApplicationUser lastModifiedUser, AssignableWorkflowScheme parent) { super(state.getId(), state.getMappings()); this.lastModifiedUser = lastModifiedUser; this.lastModifiedDate = state.getLastModifiedDate(); this.parent = parent; }