Package com.founder.fix.fixflow.core.cache

Examples of com.founder.fix.fixflow.core.cache.CacheHandler


  public List<Map<String, String>> execute(CommandContext commandContext) {
   

    ProcessDefinitionManager processDefinitionManager =commandContext.getProcessDefinitionManager();
   
    CacheHandler cacheHandler=Context.getProcessEngineConfiguration().getCacheHandler();
   
    Object cacheData = cacheHandler.getCacheData("GetStartProcessByUserId_" + this.userId);
   
    if(cacheData==null){
      CommandExecutor commandExecutor=Context.getProcessEngineConfiguration().getCommandExecutor();
     
      List<Map<String, Object>> processDefData=commandExecutor.execute(new GetProcessDefinitionGroupKeyCmd());
     
      List<Map<String,String>> processData=new ArrayList<Map<String,String>>();
     
      for (Map<String, Object> map : processDefData) {
        String processKey=StringUtil.getString(map.get("PROCESS_KEY"));
        boolean state=commandExecutor.execute(new VerificationStartUserCmd(this.userId,processKey,null));
        if(state){
          Map<String, String> dataMap=new HashMap<String, String>();
         
         

          ProcessDefinitionBehavior processDefinition = processDefinitionManager
              .findLatestProcessDefinitionByKey(processKey);
         
         
         
          String startFormKey=null;
          if(processDefinition!=null){
            startFormKey=processDefinition.getStartFormKey();
          }
         
         
         
          dataMap.put("startFormKey", startFormKey);
          dataMap.put("processDefinitionId", StringUtil.getString(map.get("PROCESS_ID")));
          dataMap.put("processDefinitionName", StringUtil.getString(map.get("PROCESS_NAME")));
          dataMap.put("processDefinitionKey", StringUtil.getString(map.get("PROCESS_KEY")));
          dataMap.put("category", StringUtil.getString(map.get("CATEGORY")));
          dataMap.put("version", StringUtil.getString(map.get("VERSION")));
          dataMap.put("resourceName", StringUtil.getString(map.get("RESOURCE_NAME")));
          dataMap.put("resourceId", StringUtil.getString(map.get("RESOURCE_ID")));
          dataMap.put("deploymentId", StringUtil.getString(map.get("DEPLOYMENT_ID")));
          dataMap.put("diagramResourceName", StringUtil.getString(map.get("DIAGRAM_RESOURCE_NAME")));
          processData.add(dataMap);
        }
      }
      if(processDefData.size()>0){
        cacheHandler.putCacheData("GetStartProcessByUserId_" + this.userId, processData);
      }
     
      return processData;
    }else{
     
View Full Code Here


   * @param taskInstance
   */
  public void saveTaskInstanceEntity(TaskInstanceEntity taskInstance) {

   
    CacheHandler cacheHandler = Context.getProcessEngineConfiguration().getCacheHandler();
    cacheHandler.putCacheData("IdentityLink_" + taskInstance.getId(), null);
    //TaskInstanceEntity taskInstanceEntity = findTaskById(taskInstance.getId());
    if(taskInstance.isAdd()){
     
      insert(taskInstance);
     
View Full Code Here

      throw new FixFlowException("查询的用户编号不能为空");

    }

    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();

    Object cacheData = cache.getCacheData("user_findUserByUserId_" + userId);
    if (cacheData != null) {
      return (UserTo) cacheData;
    } else {
     
      String userIdField=getUserInfoConfig().getUserIdField();
     
      String userNameField=getUserInfoConfig().getUserNameField();
     
      String sqlText=getUserInfoConfig().getSqlText();
     
     

      SqlCommand sqlCommand = getSqlCommand();

      List<Object> objectParamWhere = new ArrayList<Object>();

      objectParamWhere.add(userId);

      List<Map<String, Object>> dataObj = sqlCommand.queryForList("SELECT USERTABLE.* FROM ("+sqlText+") USERTABLE where USERTABLE."+userIdField+"=?", objectParamWhere);

      if(dataObj.size()==0){
        return null;
      }
     
      if (dataObj.get(0).get(userIdField) == null) {
        return null;
      }
      UserTo userTo = new UserTo(userId, StringUtil.getString(dataObj.get(0).get(userNameField)), dataObj.get(0));
      cache.putCacheData("user_findUserByUserId_"+userId, userTo);
     
      return userTo;
    }
  }
View Full Code Here

  public GroupTo findGroupByGroupId(String groupId) {
    // TODO Auto-generated method stub
    if (groupId == null || groupId.equals("")) {
      return null;
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findGroupByGroupId_" + groupId);
    if (cacheData != null) {
      return (GroupTo) cacheData;
    } 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) {
          return null;
        }
        GroupTo groupTo = new GroupTo(groupId, StringUtil.getString(dataObj.get(0).get(groupNameField)), getId(), dataObj.get(0));
        cache.putCacheData(getId() + "_findGroupByGroupId_" + groupId, groupTo);
        return groupTo;
      } catch (Exception e) {
        e.printStackTrace();
        throw new FixFlowException("获取" + getGroupInfo().getGroupName() + "信息出错!", e);
      }
View Full Code Here

  @Override
  public List<GroupTo> findGroupMembersByUser(String userId) {
    if (userId == null || userId.equals("")) {
      throw new FixFlowException("查询的用户编号不能为空");
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findGroupMembersByUser_" + userId);
    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) {
          GroupTo groupTo = new GroupTo(roleTo.get(groupIdField).toString(), StringUtil.getString(roleTo.get(this.getGroupInfo().getGroupNameField())), getId(),
              roleTo);
          groupTos.add(groupTo);
        }
        cache.putCacheData(getId() + "_findGroupMembersByUser_" + userId, groupTos);
        return groupTos;
      } catch (Exception e) {
        // TODO Auto-generated catch block
        throw new FixFlowException("人员获取" + getGroupInfo().getGroupName() + "出错!", e);
      }
View Full Code Here

  @Override
  public List<GroupTo> findGroupChildMembersByGroupId(String groupId) {
    if (groupId == null || groupId.equals("")) {
      throw new FixFlowException("查询的组编号不能为空");
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findGroupChildMembersByGroupId_" + groupId);
    if (cacheData != null) {
      return (List<GroupTo>) cacheData;
    } else {
      List<GroupTo> groupTos = getGroupChild(groupId, false);
      cache.putCacheData(getId() + "_findGroupChildMembersByGroupId_" + groupId, groupTos);
      return groupTos;
    }
  }
View Full Code Here

  @Override
  public List<GroupTo> findGroupChildMembersIncludeByGroupId(String groupId) {
    if (groupId == null || groupId.equals("")) {
      throw new FixFlowException("查询的组编号不能为空");
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findGroupChildMembersIncludeByGroupId_" + groupId);
    if (cacheData != null) {
      return (List<GroupTo>) cacheData;
    } else {
      List<GroupTo> groupTos = getGroupChild(groupId, true);
      cache.putCacheData(getId() + "_findGroupChildMembersIncludeByGroupId_" + groupId, groupTos);
      return groupTos;
    }
  }
View Full Code Here

  @Override
  public List<UserTo> findUserChildMembersIncludeByGroupId(String groupId) {
    if (groupId == null || groupId.equals("")) {
      throw new FixFlowException("查询的组编号不能为空");
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findUserChildMembersIncludeByGroupId_" + groupId);
    if (cacheData != null) {
      return (List<UserTo>) cacheData;
    } else {
      try {
        SqlCommand sqlCommand = getSqlCommand();
        List<GroupTo> groupTos = getGroupChild(groupId, true);
        List<Object> objectParamWhere = new ArrayList<Object>();
        String sqlInString = "";
        for (GroupTo groupTo : groupTos) {
          if (sqlInString.equals("")) {
            sqlInString = "?";
            objectParamWhere.add(groupTo.getGroupId());
          } else {
            sqlInString = sqlInString + ",?";
            objectParamWhere.add(groupTo.getGroupId());
          }
        }
        UserInfo userInfo = getGroupInfo().getUserInfo();
        String userIdField = userInfo.getUserIdField();
        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."
            + groupIdField + " in (" + sqlInString + ")", objectParamWhere);
        List<UserTo> userTos = new ArrayList<UserTo>();
        for (Map<String, Object> map : dataObj) {
          UserTo userTo = new UserTo(StringUtil.getString(map.get(userIdField)), StringUtil.getString(map.get(userNameField)), map);
          userTos.add(userTo);
        }
        cache.putCacheData(getId() + "_findUserChildMembersIncludeByGroupId_" + groupId, userTos);
        return userTos;
      } catch (Exception e) {
        e.printStackTrace();
        throw new FixFlowException("从" + getGroupInfo().getGroupName() + "获取用户信息出错!", e);
      }
View Full Code Here

  @Override
  public List<UserTo> findUserByGroupId(String groupId) {
    if (groupId == null || groupId.equals("")) {
      throw new FixFlowException("查询的组编号不能为空");
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findUserByGroupId_" + groupId);
    if (cacheData != null) {
      return (List<UserTo>) cacheData;
    } else {
      try {
        SqlCommand sqlCommand = getSqlCommand();
        List<Object> objectParamWhere = new ArrayList<Object>();
        objectParamWhere.add(groupId);
        UserInfo userInfo = getGroupInfo().getUserInfo();
        String userIdField = userInfo.getUserIdField();
        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."
            + groupIdField + "=?", objectParamWhere);
        List<UserTo> userTos = new ArrayList<UserTo>();
        for (Map<String, Object> map : dataObj) {
          UserTo userTo = new UserTo(StringUtil.getString(map.get(userIdField)), StringUtil.getString(map.get(userNameField)), map);
          userTos.add(userTo);
        }
        cache.putCacheData(getId() + "_findUserByGroupId_" + groupId, userTos);
        return userTos;
      } catch (Exception e) {
        e.printStackTrace();
        throw new FixFlowException("从" + getGroupInfo().getGroupName() + "获取用户信息出错!", e);
      }
View Full Code Here

  @Override
  public GroupTo findParentGroupByGroupId(String groupId) {
    if (groupId == null || groupId.equals("")) {
      return null;
    }
    CacheHandler cache = Context.getProcessEngineConfiguration().getCacheHandler();
    Object cacheData = cache.getCacheData(getId() + "_findParentGroupByGroupId_" + groupId);
    if (cacheData != null) {
      return (GroupTo) cacheData;
    } else {
      try {
        String groupIdField = getGroupInfo().getGroupIdField();
        String groupNameField = getGroupInfo().getGroupNameField();
        String supGroupIdField = getGroupInfo().getSupGroupIdField();
        String sqlText = getGroupInfo().getSqlText();
        SqlCommand sqlCommand = getSqlCommand();
        List<Object> objectParamWhere = new ArrayList<Object>();
        objectParamWhere.add(groupId);
        List<Map<String, Object>> dataObj = sqlCommand.queryForList(" SELECT USERTABLENEW.* FROM (" + sqlText
            + ") USERTABLENEW WHERE USERTABLENEW." + groupIdField + " IN (SELECT USERTABLE." + supGroupIdField + " FROM (" + sqlText
            + ") USERTABLE where USERTABLE." + groupIdField + "=?)", objectParamWhere);
        if (dataObj.size() == 0) {
          return null;
        }
        if (dataObj.get(0).get(groupIdField) == null) {
          return null;
        }
        GroupTo groupTo = new GroupTo(StringUtil.getString(dataObj.get(0).get(groupIdField)), StringUtil.getString(dataObj.get(0).get(groupNameField)), getId(), dataObj.get(0));
        cache.putCacheData(getId() + "_findParentGroupByGroupId_" + groupId, groupTo);
        return groupTo;
      } catch (Exception e) {
        e.printStackTrace();
        throw new FixFlowException("获取" + getGroupInfo().getGroupName() + "信息出错!", e);
      }
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.cache.CacheHandler

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.