public void moveToHistory(Step step) { List currentSteps = (List) SerializableCache.getInstance().currentStepsCache.get(new Long(step.getEntryId())); List historySteps = (List) SerializableCache.getInstance().historyStepsCache.get(new Long(step.getEntryId())); if (historySteps == null) { historySteps = new ArrayList(); SerializableCache.getInstance() .historyStepsCache .put(new Long(step.getEntryId()), historySteps); } SimpleStep simpleStep = (SimpleStep) step; for (Iterator iterator = currentSteps.iterator(); iterator.hasNext(); ) { Step currentStep = (Step) iterator.next(); if (simpleStep.getId() == currentStep.getId()) { iterator.remove(); historySteps.add(simpleStep); break; } } SerializableCache.store(); }
public Step createCurrentStep( long entryId, int stepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds) { long id = SerializableCache.getInstance().globalStepId++; SimpleStep step = new SimpleStep( id, entryId, stepId, 0, owner, startDate, dueDate, null, status, previousIds, null); List currentSteps = (List) SerializableCache.getInstance().currentStepsCache.get(new Long(entryId)); if (currentSteps == null) { currentSteps = new ArrayList(); SerializableCache.getInstance().currentStepsCache.put(new Long(entryId), currentSteps); } currentSteps.add(step); SerializableCache.store(); return step; }
public WorkflowEntry createEntry(String workflowName) { long id = SerializableCache.getInstance().globalEntryId++; SimpleWorkflowEntry entry = new SimpleWorkflowEntry(id, workflowName, WorkflowEntry.CREATED); SerializableCache.getInstance().entryCache.put(new Long(id), entry); SerializableCache.store(); return entry; }
public Step markFinished(Step step, int actionId, Date finishDate, String status, String caller) { List currentSteps = (List) SerializableCache.getInstance().currentStepsCache.get(new Long(step.getEntryId())); for (Iterator iterator = currentSteps.iterator(); iterator.hasNext(); ) { SimpleStep theStep = (SimpleStep) iterator.next(); if (theStep.getId() == step.getId()) { theStep.setStatus(status); theStep.setActionId(actionId); theStep.setFinishDate(finishDate); theStep.setCaller(caller); return theStep; } } SerializableCache.store(); return null; }