Package com.founder.fix.fixflow.core.exception

Examples of com.founder.fix.fixflow.core.exception.FixFlowException


        }
      }
      result = pstmt.executeQuery(sql);
    } catch (SQLException e) {
      throw new FixFlowException("查询错误:" + e.getMessage(), e);
    }
    finally
    {
      try {
        pstmt.close();
        if(result!=null){
        result.close();}
      } catch (SQLException e) {
        throw new FixFlowException("关闭游标失败",e);
      }
    }
    return result;
  }
View Full Code Here


   */
  public Integer insert(String tableName, Map<String, Object> data) throws FixFlowException {
   
   
    if (data.size() < 1) {
      throw new FixFlowException("插入错误: 无效的数据输入");
    }
    /* 构造插入查询语句 */
    StringBuffer querySql = new StringBuffer("INSERT INTO ");
    querySql.append(tableName);
    querySql.append(" ( ");

    Set<String> keys = data.keySet();
    for (Object key : keys.toArray()) {
      querySql.append((String) key);
      querySql.append(" , ");
    }

    querySql = new StringBuffer(querySql.substring(0, querySql.lastIndexOf(",")));
    querySql.append(" ) VALUES ( ");
    for (int i = 0; i < data.size(); i++) {
      querySql.append(" ? ,");
    }

    querySql = new StringBuffer(querySql.substring(0, querySql.lastIndexOf(",")));
    querySql.append(" )");
    /* 构造插入查询语句 完成 */

    Integer affectRow = 0;
    PreparedStatement pstmt=null;
    try {
      debugLog.debug("FixFlow引擎数据持久化语句: " +querySql.toString());
      debugLog.debug("参数: "+ data);
      pstmt = conn.prepareStatement(querySql.toString());
     
      Object[] keyArray = keys.toArray();
      for (int i = 0; i < keyArray.length; i++) {

        Object returnObj = transformSqlType(data.get((String) keyArray[i]));
        if (returnObj == null) {
          pstmt.setNull(i + 1, Types.VARCHAR);
        } else {
          pstmt.setObject(i + 1, returnObj);
        }

      }
      
      affectRow = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw new FixFlowException("查询错误:" + e.getMessage(), e);
    }
    finally
    {
      try {
        pstmt.close();
      } catch (SQLException e) {
        throw new FixFlowException("关闭游标失败",e);
      }
    }
   
    return affectRow;
  }
View Full Code Here

   * @return 影响行数
   * @throws DAOException
   */
  public Integer update(String tableName, Map<String, Object> data, String sql, Object[] sdata) throws FixFlowException {
    if (data.size() < 1) {
      throw new FixFlowException("插入错误: 无效的数据输入");
    }

    /* 构造插入查询语句 */
    StringBuffer querySql = new StringBuffer("UPDATE ");
    querySql.append(tableName);
    querySql.append(" SET ");
    Set<String> keys = data.keySet();
    for (Object key : keys.toArray()) {
      querySql.append((String) key);
      querySql.append(" = ? , ");
    }
    querySql = new StringBuffer(querySql.substring(0, querySql.lastIndexOf(",")));
    if (null != sql) {
      querySql.append(" WHERE ");
      querySql.append(sql);
    }
    /* 构造插入查询语句 */
    PreparedStatement pstmt=null;
    Integer affectRow = 0;
    try {
      debugLog.debug("FixFlow引擎数据持久化语句: " +querySql.toString());
      debugLog.debug("参数data: "+ data);
      debugLog.debug("参数sdata: "+ Arrays.asList(sdata));
      pstmt = conn.prepareStatement(querySql.toString());
      Object[] keyArray = keys.toArray();
      int j = 1;
      for (int i = 0; i < keyArray.length; i++) {

        Object returnObj = transformSqlType(data.get((String) keyArray[i]));
        if (returnObj == null) {
          pstmt.setNull(j++, Types.VARCHAR);
        } else {
          pstmt.setObject(j++, returnObj);
        }

      }
      if (null != sdata && sdata.length > 0) {
        for (int i = 0; i < sdata.length; i++) {

          Object returnObj = transformSqlType(sdata[i]);
          if (returnObj == null) {
            pstmt.setNull(j++, Types.VARCHAR);
          } else {
            pstmt.setObject(j++, returnObj);
          }

        }
      }
      affectRow = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw new FixFlowException("查询错误:" + e.getMessage(), e);
    }
    finally
    {
      try {
        pstmt.close();
      } catch (SQLException e) {
        throw new FixFlowException("关闭游标失败",e);
      }
    }
    return affectRow;
  }
View Full Code Here

        }
      }
      affectRow = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw new FixFlowException("查询错误:" + e.getMessage(), e);
    }
    finally
    {
      try {
        pstmt.close();
      } catch (SQLException e) {
        throw new FixFlowException("关闭游标失败",e);
      }
    }
    return affectRow;
  }
View Full Code Here

   */
  public void startTransaction(Integer level) throws FixFlowException {
    try {
      conn.setTransactionIsolation(level);
    } catch (SQLException e) {
      throw new FixFlowException("事务错误:" + e.getMessage(), e);
    }
  }
View Full Code Here

   */
  public void commit() throws FixFlowException {
    try {
      conn.commit();
    } catch (SQLException e) {
      throw new FixFlowException("事务错误:" + e.getMessage(), e);
    }
  }
View Full Code Here

   */
  public void rollback() throws FixFlowException {
    try {
      conn.rollback();
    } catch (SQLException e) {
      throw new FixFlowException("事务错误:" + e.getMessage(), e);
    }
  }
View Full Code Here

    ProcessDefinitionBehavior processDefinition = null;
    if (processDefinitionId != null) {
      processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
      if (processDefinition == null) {
        throw new FixFlowException("通过 processDefinitionId 没有找到指定流程 = '" + processDefinitionId + "'");
      }
    } else if (processDefinitionKey != null) {
      processDefinition = processDefinitionManager.findLatestProcessDefinitionByKey(processDefinitionKey);
      if (processDefinition == null) {
        throw new FixFlowException("通过 processDefinitionKey 没有找到指定流程 '" + processDefinitionKey + "'");
      }
    } else {
      throw new FixFlowException("processDefinitionKey 和 processDefinitionId 不能都为空");
    }

    ProcessInstanceEntity processInstanceEntity = null;
    try {
     
      processInstanceEntity =  processDefinition.createProcessInstance(businessKey);

      processInstanceEntity.setStartAuthor(startAuthor);
      processInstanceEntity.getContextInstance().setTransientVariableMap(transientVariables);
      processInstanceEntity.getContextInstance().setVariableMap(variables);
 

     
      StartEventBehavior startEvent=(StartEventBehavior)processDefinition.getTimeStartEvent(this.nodeId);
     
      processInstanceEntity.timeStart(this.nodeId);
     
      //
      if(startEvent.isPersistence()){
        commandContext.getProcessInstanceManager().saveProcessInstance(processInstanceEntity);
      }
      else{
        System.out.println("=====流程 "+processInstanceEntity.getId()+" 未持久化启动 " + new Date() + " =====");
      }
     
     
     

    } catch (Exception e) {
      throw new FixFlowException("流程实例启动异常! "+ e.getMessage(), e);
    }

    return processInstanceEntity;
  }
View Full Code Here

    if (deleteStatement.equals("deleteEventSubscriptionEntity")) {
      EventSubscriptionPersistence eventSubscriptionPersistence = new EventSubscriptionPersistence(connection);
      try {
        eventSubscriptionPersistence.deleteEventSubscriptionEntityById(parameter.toString());
      } catch (Exception e) {
        throw new FixFlowException("事件订阅删除出错! 错误信息:  " + e.getMessage(), e);
      }
    }

    if (deleteStatement.equals("deleteProcessDefinitionsByDeploymentId")) {
      ProcessDefinitionPersistence processDefinitionPersistence = ProcessObjectFactory.FACTORYINSTANCE.createProcessDefinitionPersistence(connection);
View Full Code Here

    if (statement.equals("findEventSubscriptionByQueryCriteria")) {
      EventSubscriptionPersistence eventSubscriptionPersistence = new EventSubscriptionPersistence(connection);
      try {
        eventSubscriptionPersistence.findEventSubscriptionByQueryCriteria((EventSubscriptionQueryImpl) parameter, page);
      } catch (Exception e) {
        throw new FixFlowException("事件订阅查询出错! 错误信息:  " + e.getMessage(), e);
      }
    }

    if (statement.equals("selectProcessDefinitionsByQueryCriteria")) {
      ProcessDefinitionPersistence processDefinitionPersistence = ProcessObjectFactory.FACTORYINSTANCE.createProcessDefinitionPersistence(connection);
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.exception.FixFlowException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.