Package com.exedosoft.plat.bo

Examples of com.exedosoft.plat.bo.BOInstance


    String returnUrl = "";

    DOService aService = DOService
        .getService("multi_tenancy_browse_byname");
    // ////////////根据用户查找租户
    BOInstance tenant = aService.getInstance(formBI.getValue("tenancyId"));
    // ////////如果租户不存在
    if (tenant == null || tenant.getName() == null) {
      ret[0] = I18n.instance().get("该账号没有被激活!");
      return ret;
    }
    log.info("当前登录的租户为::" + formBI.getValue("tenancyId"));

    // tenant data datastore url
    String multi_datasource_uid = tenant.getValue("multi_datasource_uid");
    // tenant config datastore url
    String model_datasource_uid = tenant.getValue("model_datasource_uid");

    DODataSource dataDds = dsConfig.get(multi_datasource_uid);
    DODataSource dds = dsConfig.get(model_datasource_uid);

    if (dataDds == null && dds == null) {

      DOService findDataSource = DOService
          .getService("multi_datasource_browse");

      // //data datasource
      BOInstance aBI = findDataSource.getInstance(multi_datasource_uid);
      if (aBI != null) {
        dataDds = (DODataSource) aBI.toObject(DODataSource.class);
        // /现在多租户情况下默认都是mysql
        dataDds.setDialect(DODataSource.DIALECT_MYSQL);
        dsConfig.put(multi_datasource_uid, dataDds);
      }

      // /model datasource
      aBI = findDataSource.getInstance(model_datasource_uid);
      if (aBI != null) {
        dds = (DODataSource) aBI.toObject(DODataSource.class);
        // /现在多租户情况下默认都是mysql
        dds.setDialect(DODataSource.DIALECT_MYSQL);
        dsConfig.put(model_datasource_uid, dds);
      }
    }

    if (dataDds == null || dds == null) {
      ret[0] = I18n.instance().get("该账号没有被激活或者没有正确初始化,请与管理员联系!");
      return ret;
    }

    // /globals 放到session中

    // //需要更改多租户表中,租户数据库中的数据源
    // ////每个租户为定位到某个物理数据库中
    // ///租户数据库分配
    TenancyValues tv = new TenancyValues(dds, tenant);

    tv.setDataDDS(dataDds);
    DOGlobals.getInstance().getSessoinContext().setTenancyValues(tv);

    /**
     * 查找账号
     */
    MultiAccount ma = MultiAccount.findAccount(formBI.getValue("name"),
        formBI.getValue("password"), formBI.getValue("tenancyId"));
    BOInstance user = new BOInstance();
   

    if (ma == null) {
      // //////////直接可以从用户表中访问,可以考虑,计费时根据这个表计费,肯定还需要一个计费表和这个表关联。另外一个思路是同意注册。

      String serviceName = request.getParameter("contextServiceName");
      BOInstance biUser = null;
      if (serviceName != null && !serviceName.trim().equals("")) {
        DOService findUserByUserNamePassword = DOService
            .getService(serviceName);
        List listUser = findUserByUserNamePassword.invokeSelect();
        if (listUser != null && listUser.size() > 0) {
          biUser = (BOInstance) listUser.get(0);
        }

      }
      if (biUser == null) {
        ret[0] = I18n.instance().get("账号/密码出错,请重试!");
        return ret;
      } else {
        user = biUser;
        // /设置公司名称
        user.putValue("company", tenant.getValue("l10n"));
      }

    } else {

      user.fromObject(ma);
      DOService findUserService = DOService
          .getService("do_org_user_browse");

      List corrUsers = findUserService.invokeSelect(ma.getObjUid());
      BOInstance employee = null;
      try {
        if (corrUsers == null || corrUsers.size() == 0) {
          // user.putValue("objuid",
          // ma.getObjUid());
          DOService storeUser = DOService
              .getService("do_org_user_insert");
          // /建立用户间的对应关系
          user.putValue("user_code", user.getValue("name"));
          employee = storeUser.store(user);

        } else {
          employee = (BOInstance) corrUsers.get(0);
        }
      } catch (ExedoException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
      user.putValue("name", employee.getValue("name"));
      // /设置公司名称
      user.putValue("company", tenant.getValue("l10n"));
    }

    // /ret return path
View Full Code Here


  //
  // }

  private BOInstance getFormInstance(HttpServletRequest request) {

    BOInstance formInstance = new BOInstance();
    Map formValues = request.getParameterMap();

    for (Iterator it = formValues.keySet().iterator(); it.hasNext();) {
      String key = (String) it.next();
      String[] values = (String[]) formValues.get(key);

      if (values != null && values.length == 1) {
        formInstance.putValue(key, Escape.unescape(values[0]));
      } else {
        escapeValues(values);
        formInstance.putValue(key, values);
      }
    }
    return formInstance;
  }
View Full Code Here

    CacheFactory.getCacheData().fromSerialObject();
    DOService findDataSource = DOService
        .getService("multi_datasource_browse");

    // //data datasource
    BOInstance aBI = findDataSource
        .getInstance("402881eb38a231d20138a23b4ab70015");
    DODataSource dataDds = null;
    if (aBI != null) {
      dataDds = (DODataSource) aBI.toObject(DODataSource.class);
      // /现在多租户情况下默认都是mysql
      dataDds.setDialect(DODataSource.DIALECT_MYSQL);
    }

    BOInstance aBI2 = findDataSource
        .getInstance("402881eb38a231d20138a23b4ab70015");
    DODataSource dataDds2 = null;
    if (aBI2 != null) {
      dataDds2 = (DODataSource) aBI2.toObject(DODataSource.class);
      // /现在多租户情况下默认都是mysql
      dataDds2.setDialect(DODataSource.DIALECT_MYSQL);
    }

    System.out.println("equals::::" + dataDds.equals(dataDds2));
View Full Code Here

      PreparedStatement pstmt = conn.prepareStatement(this.service.getMainSql());
      ResultSet rs = pstmt.executeQuery();//sql
      SearchTransCode stc = new SearchTransCode(null);
      List<BOInstance> list = new ArrayList<BOInstance>();
      while (rs.next()) {
        BOInstance  bi = stc.transRSToBOInstance(rs, null);
        bi.setUid(bi.getValue("uid"));
        list.add(bi);
      }
      this.setInstances(list);
      rs.close();
    } catch (Exception e) {
View Full Code Here

  public String excute() {

    log.info("Enter CoreSaveEditAction::::::::::::::::::::::::::");


    BOInstance uiForm = DOGlobals.getInstance().getSessoinContext()
        .getFormInstance();
    String formUid = uiForm.getValue("formUid");
    DOFormModel aFm = DOFormModel.getFormModelByID(formUid);

    if (aFm == null) {
      setEchoValue(I18n.instance().get("未配置FormModel"));
      return NO_FORWARD;
    }

    /*
     * 必须定义两个服务,新增的服务和修改 的服务
     */
    DOService insertService = aFm.getLinkService();
    DOService updateService = aFm.getSecondService();

    if (insertService == null || updateService == null) {
      setEchoValue(I18n.instance().get("必须定义两个服务,新增的服务和修改的服务!"));
      return NO_FORWARD;
    }

    Connection con = null;
    int batchSize = 0;
    try {

      con = insertService.getBo().getDataBase().getContextConnection();
       // ////////////////////////////////////新增
      String inputName = uiForm.getValue("inputName");
      if (inputName != null && !inputName.trim().equals("")) {
        String[] inputValues = uiForm.getValueArray(inputName);
        log.info("Current SQL:" + insertService.getTempSql());
        PreparedStatement pstmt = con.prepareStatement(insertService
            .getTempSql());

        List<String> newIds = new ArrayList<String>();
        for (int len = 0; len < inputValues.length; len++) {
          int i = 1;
          for (Iterator it = insertService.retrieveParaServiceLinks()
              .iterator(); it.hasNext();) {
            DOParameterService dops = (DOParameterService) it
                .next();
            DOParameter dop = dops.getDop();

            String value = null;

            if (dop.getType() != null
                && dop.getType().intValue() == DOParameter.TYPE_FORM
                && dop.getDefaultValue() == null) {// //form类型直接从节目获取
              log.info("Batch Parameter Name:::" + dop.getName());
              String[] valueArray = uiForm.getValueArray(dop
                  .getName());
              value = valueArray[len];
              if ("".equals(value)) {
                value = null;
              }
            } else {
              value = dop.getValue();
            }
           
            if (dop.getType() != null
                && dop.getType().intValue() == DOParameter.TYPE_KEY) {
              newIds.add(value);
            }
            value = dops.getAfterPattermValue(value);
            insertService.putStatementAValue(pstmt, i, dops, value);
            i++;
          }
          batchSize++;
          pstmt.addBatch();
        }
        log.info("::batchSize:::" + batchSize);
        pstmt.executeBatch();
       
        /////多租户的处理
        for(String anID : newIds){
          insertService.dealMultiTenancy(null, con, anID);
        }
      }
      // ////////////////////////////////////end 新增=====================

      // ////////////修改   begin==============================================
      DOBO refreshBO = aFm.getGridModel().getService().getBo();

      String[] ids = uiForm.getValueArray("id");
      if (ids != null && ids.length > 0) {

        PreparedStatement pstmt = con.prepareStatement(updateService
            .getTempSql());
        for (int ii = 0; ii < ids.length; ii++) {
          String idstr = ids[ii];
          System.out.println("one isstr::" + idstr);
          if (idstr != null) {
            String[] vals = idstr.split(";﹕#");
            HashMap<String, String> paras = new HashMap<String, String>();
            String id = "";
            if (vals != null && vals.length > 0) {
              id = vals[0];
              for (int j = 1; j < vals.length; j++) {
                String aKeyValue = vals[j];
                System.out.println("aKeyValue::::::" + aKeyValue);
                String[] arrayKV = aKeyValue.split("﹕﹕");
                String aValue = null;
                if(arrayKV.length > 1){
                   aValue = arrayKV[1];
                }
                paras.put(arrayKV[0],aValue);
              }
            }
           
            System.out.println("paras:::::" + paras);

            BOInstance oldInstance = refreshBO.refreshContext(id);
            String newKeyValue = null;
            int i = 1;
            for (Iterator it = updateService
                .retrieveParaServiceLinks().iterator(); it
                .hasNext();) {
View Full Code Here

          .getMainSql());
      ResultSet rs = pstmt.executeQuery();// sql
      SearchTransCode stc = new SearchTransCode(null);
      List<BOInstance> list = new ArrayList<BOInstance>();
      while (rs.next()) {
        BOInstance bi = stc.transRSToBOInstance(rs, null);
        bi.setBo(this.service.getBo());
        String sn = rs.getString("sn");
        String tcn = rs.getString("cn");
        if (sn != null && !sn.trim().equals("")) {
        //  bi.putValue("uid", bi.getValue("sn"));
          String cn = LDAPPeopleUtil.getLDAPCNBySN(sn);
          System.out.println(tcn + "<=======================>" + cn);
          bi.putValue("cn", cn);
          list.add(bi);
        }
      }
      this.setInstances(list);
      rs.close();
View Full Code Here

   
    DOService aService = DOService.getService("zf_employee_list_ldapbyaction");
   
    List list = aService.invokeSelect();
   
    BOInstance anItem = (BOInstance)list.get(5);
   
   
    System.out.println("An item::" + anItem);
    System.out.println("Name::" + anItem.getName());
    System.out.println("Uid::" + anItem.getUid());
   
  }
View Full Code Here

  public Boolean isAccess(DOFormModel formModel) {

    if (DOGlobals.getInstance().getSessoinContext().getUser() != null) {

      BOInstance aRole = (BOInstance) DOGlobals.getInstance()
          .getSessoinContext().getUser().getObjectValue("roleObj");
      if(aRole!=null){
        if ("5".equals(aRole.getValue("degree"))) {
          return Boolean.TRUE;
        }
      }
    }
    return null;
View Full Code Here

  private void authMenu(String parterUid) {
    List allAuthMenus = SessionParterFactory.getSessionParter()
        .getMenuAuthConfigByAccount(parterUid);

    DOBO boUser = OrgParter.getDefaultEmployee().getDoBO();
    BOInstance user = boUser.getInstance(parterUid);

    System.out.println("Enter:::::::::::::DOAuthUserSave");

    if (user == null) {
      System.out.println("User is null!!!!!!!!!");
      return;
    }

    String authcofig = DOGlobals.getInstance().getSessoinContext()
        .getFormInstance().getValue("authcofig");
    String[] menuConfigs = authcofig.split(";");

//    WFDAO dao = new WFDAO();
//    dao.setAutoClose(false);
    try {

      // /////////////////删除权限设置
      for (int i = 0; i < menuConfigs.length; i++) {
        String[] aConfig = menuConfigs[i].split(",");
        if (aConfig[0] != null && !"".equals(aConfig[0])) {

          String dbAccess = "0";
          if (allAuthMenus.contains(aConfig[0])) {
            dbAccess = "1";
          }
          if (!dbAccess.equals(aConfig[1])) {
            DOAuthorization.removeDOAuthorizations(OrgParter
                .getDefaultEmployee(), user.getUid(),
                DOAuthorization.WHAT_UI_MENU, aConfig[0]);

          }

        }
      }

      // ////////////删除之后再计算一下权限设置
      allAuthMenus = SessionParterFactory.getSessionParter()
          .getMenuAuthConfigByAccount(parterUid);

      // //////////////////增加权限设置

      for (int i = 0; i < menuConfigs.length; i++) {
        String[] aConfig = menuConfigs[i].split(",");
        String dbAccess = "0";
        if (allAuthMenus.contains(aConfig[0])) {
          dbAccess = "1";
        }
        if (!dbAccess.equals(aConfig[1])) {

          DOAuthorization da = new DOAuthorization();
          da.setParterUid(OrgParter.getDefaultEmployee().getObjUid());
          da.setOuUid(user.getUid());
          da.setWhatType(DOAuthorization.WHAT_UI_MENU);
          da.setWhatUid(aConfig[0]);
          if (("0".equals(aConfig[1]))) {
            da.setAuthority(Boolean.FALSE);
            da.setIsInherit(Boolean.TRUE);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public String excute() throws ExedoException {

    DOBO ptNI = DOBO.getDOBOByName("do_wfi_processinstance");
    BOInstance curPt = ptNI.getCorrInstance();
    BOInstance echo = new BOInstance();

    ProcessInstance pi = ProcessInstance.getProcessInstance(curPt.getUid());

    if (curPt == null || pi == null) {
      this.setEchoValue(I18n.instance().get("不存在工作流实例!"));
      return NO_FORWARD;
    }

    List<NodeInstance> nis = pi.retrieveNodeInstances();
    Map<String, NodeInstance> nodeIMap = new HashMap<String, NodeInstance>();
    for (Iterator<NodeInstance> it = nis.iterator(); it.hasNext();) {
      NodeInstance ni = it.next();
      if (nodeIMap.get(ni.getNode().getObjUid()) == null) {
        nodeIMap.put(ni.getNode().getObjUid(), ni);
      } else if (ni.getExeStatus().intValue() == NodeInstance.STATUS_FINISH) {
        nodeIMap.put(ni.getNode().getObjUid(), ni);
      }
    }

    ProcessTemplate pt = pi.getProcessTemplate();

    StringBuilder xml = new StringBuilder("<wf>  <processtemplate name='")
        .append(pt.getPtName()).append("'>");
    StringBuilder strNodeList = new StringBuilder("<nodes>");
    StringBuilder strFlowList = new StringBuilder("<transitions>");

    for (Iterator<PTNode> it = pt.retrieveNodes().iterator(); it.hasNext();) {
      PTNode aNode = it.next();
      String autoServiceName = "";
      String deciType = "";
      String authType = "";
      if (aNode.getAutoExcutesService() != null) {
        autoServiceName = aNode.getAutoExcutesService().getName();
      }
      if (aNode.getDecisionType() != null) {
        deciType = aNode.getDecisionType().toString();
      }
      if (aNode.getAuthType() != null) {
        authType = aNode.getAuthType().toString();
      }
      String paneName = "";
      if (aNode.getPane() != null) {
        paneName = aNode.getPane().getName();
      }

      String nodeName = aNode.getNodeName();
      NodeInstance nodeI = nodeIMap.get(aNode.getObjUid());
      if (nodeI != null && nodeI.getPerformer() != null) {
        String name = null;
        try {
          BOInstance user = OrgParter.getDefaultEmployee().getDoBO()
              .getInstance(nodeI.getPerformer());
          if (user != null) {
            name = user.getName();
          }
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        if (name != null) {
          nodeName = nodeName + "(操作人:" + name + ")";
        }
      }
      //当流程是下一步执行人可选时,当前节点操作人若为上一步操作人所选择的,
      //则在当前节点显示当前节点的操作人.--by stone
      else if (nodeI != null && nodeI.getPerformer() == null) {
        String name = null;
        String nodeUUid = null;
        String nextUserId = null;

        nodeUUid = nodeI.getObjUid();

        if (nodeUUid != null) {
          List nextUserList = DOAuthorization.getAuthConfigOfWhat(""
              + DOAuthorization.WHAT_WF_NODEINSTANCE, nodeUUid);

          if (nextUserList.size() > 0) {
            DOAuthorization nextuserDO = (DOAuthorization) nextUserList
                .iterator().next();
            if (nextuserDO != null) {
              nextUserId = nextuserDO.getOuUid();
            }

            if (nextUserId != null) {
              BOInstance ouUser = OrgParter.getDefaultEmployee()
                  .getDoBO().getInstance(nextUserId);

              if (ouUser != null) {
                name = ouUser.getName();
              }
            }
          }
        }
        if (name != null) {
View Full Code Here

TOP

Related Classes of com.exedosoft.plat.bo.BOInstance

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.