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 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 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 List findCurrentSteps(long entryId) { List currentSteps = (List) SerializableCache.getInstance().currentStepsCache.get(new Long(entryId)); if (currentSteps == null) { currentSteps = new ArrayList(); SerializableCache.getInstance().currentStepsCache.put(new Long(entryId), currentSteps); } return currentSteps; }
public PropertySet getPropertySet(long entryId) { PropertySet ps = (PropertySet) SerializableCache.getInstance().propertySetCache.get(new Long(entryId)); if (ps == null) { ps = PropertySetManager.getInstance("serializable", null); SerializableCache.getInstance().propertySetCache.put(new Long(entryId), ps); } return ps; }
public List findHistorySteps(long entryId) { List historySteps = (List) SerializableCache.getInstance().historyStepsCache.get(new Long(entryId)); if (historySteps == null) { historySteps = new ArrayList(); SerializableCache.getInstance().historyStepsCache.put(new Long(entryId), historySteps); } return historySteps; }
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; }
public WorkflowEntry findEntry(long entryId) { return (WorkflowEntry) SerializableCache.getInstance().entryCache.get(new Long(entryId)); }