/**
   * Returns the workflow property set for a particular user and workflow
   *
   * @return the workflow property set for the workflow with workflowId and the user represented by
   *     userPrincipal
   */
  public PropertySet getPropertySet(
      InfoGluePrincipal userPrincipal, long workflowId, Session session) {
    PropertySet propertySet = null;

    try {
      WorkflowFacade wf =
          new WorkflowFacade(userPrincipal, workflowId, hibernateSessionFactory, session);
      propertySet = wf.getPropertySet();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
    }

    return propertySet;
    // return new WorkflowFacade(userPrincipal, workflowId, false).getPropertySet();
  }
  public PropertySet getPropertySet(InfoGluePrincipal userPrincipal, long workflowId) {
    PropertySet propertySet = null;

    Session session = null;
    net.sf.hibernate.Transaction tx = null;

    try {
      session = hibernateSessionFactory.openSession();
      tx = session.beginTransaction();

      WorkflowFacade wf =
          new WorkflowFacade(userPrincipal, workflowId, hibernateSessionFactory, session);
      propertySet = wf.getPropertySet();

      session.flush();

      tx.commit();
    } catch (Exception e) {
      logger.error("An error occurred when we tries to run getHistorySteps():" + e.getMessage(), e);
      try {
        tx.rollback();
      } catch (HibernateException he) {
        logger.error(
            "An error occurred when we tries to rollback transaction:" + he.getMessage(), he);
      }
      restoreSessionFactory(e);
    } finally {
      try {
        session.close();
      } catch (HibernateException e) {
        logger.error("An error occurred when we tries to close session:" + e.getMessage(), e);
      }
    }

    return propertySet;
    // return new WorkflowFacade(userPrincipal, workflowId, false).getPropertySet();
  }