return step; } catch (HibernateException he) { log.error("Saving new workflow entry", he); throw new StoreException("Saving new workflow entry", he); } }
try { session.save(entry); tx.commit();   return step; } catch (HibernateException he) { log.error("Saving new workflow entry", he); throw new StoreException("Saving new workflow entry", he); } }
	public Step createCurrentStep(long entryId, int stepId, String owner, Date startDate, Date dueDate, String status, long[] previousIds) throws StoreException   {	   HibernateCurrentStep step = new HibernateCurrentStep();	   HibernateWorkflowEntry entry;	   Transaction tx;	   try	   {		   tx = session.beginTransaction();		   entry = (HibernateWorkflowEntry) session.find("FROM entry in CLASS " + HibernateWorkflowEntry.class.getName() + " WHERE entry.id = ?", new Long(entryId), Hibernate.LONG).get(0);	   }	   catch (HibernateException he)	   {		   log.error("Looking for workflow entry " + entryId, he);		   throw new StoreException("Looking for workflow entry " + entryId, he);	   }	   step.setEntry(entry);	   step.setStepId(stepId);	   step.setOwner(owner);	   step.setStartDate(startDate);	   step.setDueDate(dueDate);	   step.setStatus(status);	   List stepIdList = new ArrayList(previousIds.length);	   for (int i = 0; i < previousIds.length; i++)	   {		   long previousId = previousIds[i];		   stepIdList.add(new Long(previousId));	   }	   if (!stepIdList.isEmpty())	   {		   String stepIds = TextUtils.join(", ", stepIdList);		   try		   {			   step.setPreviousSteps(session.find("FROM step in CLASS " + HibernateCurrentStep.class.getName() + " WHERE step.id IN (" + stepIds + ")"));		   }		   catch (HibernateException he)		   {			   log.error("Looking for step in " + stepIds, he);			   throw new StoreException("Looking for step in " + stepIds, he);		   }	   }	   else	   {		   step.setPreviousSteps(Collections.EMPTY_LIST);	   }	   if (entry.getCurrentSteps() == null)	   {		   ArrayList cSteps = new ArrayList(1);		   cSteps.add(step);		   entry.setCurrentSteps(cSteps);	   }	   else	   {		   entry.getCurrentSteps().add(step);	   }	   try	   {		   session.save(entry);		   tx.commit();		   //session.save(step);		   return step;	   }	   catch (HibernateException he)	   {		   log.error("Saving new workflow entry", he);		   throw new StoreException("Saving new workflow entry", he);	   }   }