Package com.founder.fix.fixflow.core.impl.db

Examples of com.founder.fix.fixflow.core.impl.db.SqlCommand


  public void execute(ExecutionContext executionContext) throws Exception {

   

    SqlCommand sqlCommand=new SqlCommand(Context.getDbConnection());

    String Fix_BizName=StringUtil.getString(Context.getAbstractScriptLanguageMgmt().execute("${Fix_BizName}", executionContext));
    String Fix_BizKeyFile=StringUtil.getString(Context.getAbstractScriptLanguageMgmt().execute("${Fix_BizKeyFile}", executionContext));
    if(Fix_BizName==null||Fix_BizName.equals("")){
      throw new FixFlowException("数据变量${Fix_BizName}为空");
    }
    if(Fix_BizKeyFile==null||Fix_BizKeyFile.equals("")){
      throw new FixFlowException("数据变量${Fix_BizKeyFile}为空");
    }
   
    String processInstId=executionContext.getProcessInstance().getId();
   
    String sqlText="UPDATE "+Fix_BizName+" SET  FIX_PROCESSINSTANCE_ID='"+processInstId+"' WHERE "+Fix_BizKeyFile+"='"+executionContext.getBizKey()+"'";
   
    sqlCommand.execute(sqlText);

  }
View Full Code Here


  Pagination pagination = Context.getProcessEngineConfiguration().getDbConfig().getPagination();

  public ProcessDefinitionPersistence(Connection connection) {
    this.connection = connection;
    // 初始化数据库操作类
    sqlCommand = new SqlCommand(connection);
  }
View Full Code Here

  private java.util.HashMap param;

  public void execute(ExecutionContext executionContext) throws Exception {

   
    SqlCommand sqlCommand=executionContext.getSqlCommand();

    // 构建查询参数
    HashMap<String, Object> objectParam = (HashMap<String, Object>)param;

       
        // 执行插入语句
        sqlCommand.insert(table, objectParam);
   
   
  }
View Full Code Here

  protected Connection connection;
  protected SqlCommand sqlCommand;

  public EventSubscriptionPersistence(Connection connection) {
    this.connection = connection;
    sqlCommand = new SqlCommand(connection);
  }
View Full Code Here

public class FixMailEngine {

  public static void saveMail(FixMailTo fixMailTo) {

    SqlCommand sqlCommand = new SqlCommand(Context.getDbConnection());

    sqlCommand.insert("FIXFLOW_MAIL", fixMailTo.getPersistentDbMap());

  }
View Full Code Here

    List<Object> pObjects = new ArrayList<Object>();
    //pObjects.add(MailStatus.COMPLETE.toString());
    //pObjects.add(MailStatus.FAILURE.toString());
    pObjects.add(MailStatus.NOSEND.toString());
    SqlCommand sqlCommand = new SqlCommand(Context.getDbConnection());
   
    Pagination pagination = Context.getProcessEngineConfiguration().getDbConfig().getPagination();
   
   
   
   
    String sqlText=pagination.getPaginationSql("SELECT * FROM FIXFLOW_MAIL WHERE MAIL_STATUS=?", 1, 10, "*", null);
   
    List<Map<String, Object>> dataList = sqlCommand.queryForList(sqlText, pObjects);
   
    for (Map<String, Object> mapData : dataList) {

      try {
        FixMailTo fixMailTo = new FixMailTo();
        fixMailTo.persistentInit(mapData);

        MailUtil mailUtil = new MailUtil();
        mailUtil.setSmtpHost(mailInfoObj.getSmtpHost(), StringUtil.getInt(mailInfoObj.getSmtpPort()));
        mailUtil.setSmtpAuthentication(mailInfoObj.getUserName(), mailInfoObj.getPassWord());
        // 支持发送多人邮件 #4185
        String to = fixMailTo.getMailTo();
        if (to == null || to.equals("")) {
          throw new FixFlowBizException("mailTo is null");
        }
        String[] str = to.split(",");
        List<String> userMailToList=new ArrayList<String>();
        for (String userMail : str) {
         
          if(userMail==null||userMail.equals("")||userMail.trim().equals("")){
           
          }
          else{
            userMailToList.add(userMail);
          }
         
         
         
         
        }
       
        if(userMailToList.size()==0){
          throw new FixFlowBizException("Mail toaddress is null");
        }
        String[] userMailToFinStrings=(String[])userMailToList.toArray(new String[userMailToList.size()]);
       
       
        mailUtil.setTo(userMailToFinStrings);
       
       
       
       
       
        String cc = fixMailTo.getMailCc();
        if (cc != null && !cc.equals("")) {
          String[] strCC = cc.split(",");
         
          List<String> userMailCCList=new ArrayList<String>();
          for (String userMail : strCC) {
           
            if(userMail==null||userMail.equals("")||userMail.trim().equals("")){
             
            }
            else{
              userMailCCList.add(userMail);
            }
           
          }
         
          if(userMailCCList.size()==0){
            throw new FixFlowBizException("Mail ccaddress is null");
          }
         
          String[] userMailCCFinStrings=(String[])userMailCCList.toArray(new String[userMailCCList.size()]);
     
         
         
         
          mailUtil.setCC(userMailCCFinStrings);
        }
        String title = fixMailTo.getMailSubject();
        String mailContent = fixMailTo.getMailBody();

        mailUtil.setFrom(mailInfoObj.getMailAddress());
        mailUtil.setSubject(title);
        mailUtil.setBody(mailContent);
        mailUtil.setContentType(mailUtil.MODE_HTML);
       

        Map<String, Object> objectParam = new HashMap<String, Object>();
        objectParam.put("MAIL_STATUS", MailStatus.COMPLETE.toString());

        // 构建Where查询参数
        Object[] objectParamWhere = { StringUtil.getString(mapData.get("MAIL_ID")) };

        sqlCommand.update("FIXFLOW_MAIL", objectParam, " MAIL_ID=?", objectParamWhere);
       
   
        // 异步发送
        mailUtil.send();

      } catch (Exception e) {

        try {
          Map<String, Object> objectParam = new HashMap<String, Object>();
          objectParam.put("MAIL_STATUS", MailStatus.FAILURE.toString());
          objectParam.put("FAILURE_REASON", e.getMessage());

          // 构建Where查询参数
          Object[] objectParamWhere = { StringUtil.getString(mapData.get("MAIL_ID")) };

          sqlCommand.update("FIXFLOW_MAIL", objectParam, " MAIL_ID=?", objectParamWhere);
        } catch (Exception e2) {
          e.printStackTrace();
          e2.printStackTrace();
          //throw new FixFlowException("邮件发送失败",e2);
        }

      } finally {
        try {
          Map<String, Object> objectParam = new HashMap<String, Object>();
          objectParam.put("SEND_TIME", new Date());

          // 构建Where查询参数
          Object[] objectParamWhere = { StringUtil.getString(mapData.get("MAIL_ID")) };

          sqlCommand.update("FIXFLOW_MAIL", objectParam, " MAIL_ID=?", objectParamWhere);
        } catch (Exception e) {
          e.printStackTrace();
          //throw new FixFlowException("邮件发送失败",e);
        }

View Full Code Here

  /**
   * 重写方法
   */
  public Date getWorkTime(Date newDate, int days, int hours, int minutes,
      int seconds, ExecutionContext executionContext) {
    SqlCommand sqlCommand = null;
    try {
      // 直接操作 sqlcommand 里边已经包含 connection了
      sqlCommand = executionContext.getSqlCommand();
    } catch (Exception e) {
      try {
        sqlCommand = new SqlCommand(Context.getDbConnection());
      } catch (Exception e1) {
        e1.printStackTrace();
      }
    }
   
    if(newDate == null) {
      return newDate;
    }
   
    //将传递的时间换算成‘秒’
    int updateTimeSeconds = hours * 3600 + minutes * 60 + seconds;
    this.hours = hours;
    this.minutes = minutes;
    this.seconds = seconds;
   
    //搜索出工作日
    String sql = "select commom_date from FIXFLOW_WORKDATE_DETAIL" +
        " group by commom_date order by commom_date";
    List<Map<String, Object>> workDays = sqlCommand.queryForList(sql);
    if(workDays == null || workDays.size() == 0) {
      return newDate;
    }
   
    //计算日期
View Full Code Here

    } else {
      try {
        String groupIdField = getGroupInfo().getGroupIdField();
        String groupNameField = getGroupInfo().getGroupNameField();
        String sqlText = getGroupInfo().getSqlText();
        SqlCommand sqlCommand = getSqlCommand();
        List<Object> objectParamWhere = new ArrayList<Object>();
        objectParamWhere.add(groupId);
        List<Map<String, Object>> dataObj = sqlCommand.queryForList("SELECT USERTABLE.* FROM (" + sqlText + ") USERTABLE where USERTABLE."
            + groupIdField + "=?", objectParamWhere);
        if (dataObj.size() == 0) {
          return null;
        }
        if (dataObj.get(0).get(groupIdField) == null) {
View Full Code Here

    try {
      String groupIdField = getGroupInfo().getGroupIdField();
      String groupNameField = getGroupInfo().getGroupNameField();
      String supIdField = getGroupInfo().getSupGroupIdField();
      String sqlText = getGroupInfo().getSqlText();
      SqlCommand sqlCommand = getSqlCommand();
      String sql = "SELECT USERTABLE.* FROM (" + sqlText + ") USERTABLE where 1=1";
      String countSql = "SELECT count(*) FROM (" + sqlText + ") USERTABLE where 1=1";
      String whereSql = "";
      if(queryMap!= null && queryMap.containsKey("GROUPID")){
        whereSql += " and " + groupIdField +" like '%"+queryMap.get("GROUPID")+"%'";
      }
      if(queryMap!= null && queryMap.containsKey("GROUPNAME")){
        whereSql += " and " + groupNameField +" like '%"+queryMap.get("GROUPNAME")+"%'";
      }
      if(queryMap!= null && queryMap.containsKey("SUPID")){
        whereSql += " and (" + supIdField +" = '"+queryMap.get("SUPID")+"' or "+groupIdField+"='"+queryMap.get("SUPID")+"')";
      }
      sql += whereSql;
      countSql += whereSql;
     
      if (page != null) {
        Pagination pagination = Context.getProcessEngineConfiguration().getDbConfig().getPagination();
        sql = pagination.getPaginationSql(sql, page.getFirstResult(), page.getMaxResults(), "*",null);
      }
      List<Map<String, Object>> dataObj = sqlCommand.queryForList(sql, null);
      int count = Integer.parseInt(sqlCommand.queryForValue(countSql).toString());
      for(int i = 0;i<dataObj.size();i++){
        if (dataObj.get(0).get(groupIdField) != null) {
          GroupTo groupTo = new GroupTo(StringUtil.getString(dataObj.get(i).get(groupIdField)), StringUtil.getString(dataObj.get(i).get(groupNameField)), getId(), dataObj.get(i));
          resultList.add(groupTo);
        }
View Full Code Here

    if (cacheData != null) {
      return (List<GroupTo>) cacheData;
    } else {
      try {
        List<GroupTo> groupTos = new ArrayList<GroupTo>();
        SqlCommand sqlCommand = getSqlCommand();
        List<Object> objectParamWhere = new ArrayList<Object>();
        objectParamWhere.add(userId);
        UserInfo userInfo = getGroupInfo().getUserInfo();
        String userIdField = userInfo.getUserIdField();
        @SuppressWarnings("unused")
        String userNameField = userInfo.getUserNameField();
        String groupIdField = userInfo.getGroupIdField();
        String sqlText = userInfo.getSqlText();
        List<Map<String, Object>> dataObj = sqlCommand.queryForList("SELECT USERTABLE.* FROM (" + sqlText + ") USERTABLE where USERTABLE."
            + userIdField + "=? AND USERTABLE."+groupIdField+" IS NOT NULL", objectParamWhere);
        if(dataObj.size()==0){
          return groupTos;
        }
        for (Map<String, Object> roleTo : dataObj) {
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.db.SqlCommand

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.