valueMap.put("finishDate", new Timestamp(step.getFinishDate().getTime()));
if (step.getFinishDate() != null) { valueMap.put("finishDate", new Timestamp(step.getFinishDate().getTime())); }
    public void moveToHistory(Step step) throws StoreException {        try {            Long id = new Long(step.getId());            gd.removeByAnd("OSCurrentStep", UtilMisc.toMap("id", id));            HashMap valueMap = new HashMap();            valueMap.put("id", id);            valueMap.put("entryId", new Long(step.getEntryId()));            valueMap.put("actionId", new Integer(step.getActionId()));            valueMap.put("stepId", new Integer(step.getStepId()));            valueMap.put("owner", step.getOwner());            valueMap.put("startDate", new Timestamp(step.getStartDate().getTime()));            Timestamp realDueDate = null;            if (step.getDueDate() != null) {                realDueDate = new Timestamp(step.getDueDate().getTime());            }            valueMap.put("dueDate", realDueDate);            valueMap.put("finishDate", new Timestamp(step.getFinishDate().getTime()));            valueMap.put("status", step.getStatus());            valueMap.put("caller", step.getCaller());            GenericValue gv = gd.create("OSHistoryStep", valueMap);            ArrayList storeList = new ArrayList();            storeList.add(gv);            long[] previousIds = step.getPreviousStepIds();            if (previousIds != null) {                for (int i = 0; i < previousIds.length; i++) {                    long previousId = previousIds[i];                    GenericValue prevGv = gd.create("OSHistoryStepPrev", UtilMisc.toMap("id", id, "previousId", new Long(previousId)));                    storeList.add(prevGv);                }            }            gd.storeAll(storeList);        } catch (GenericEntityException e) {            throw new StoreException("Could not move to history step for #" + step.getEntryId(), e);        }    }