Package com.exedosoft.plat.bo

Examples of com.exedosoft.plat.bo.DODataSource


  public String excute() {

    String dataSourceUid = null;
    if ("true".equals(DOGlobals.getValue("multi.tenancy"))) {

      DODataSource dss = DOGlobals.getInstance().getSessoinContext()
          .getTenancyValues().getDataDDS();
      dataSourceUid = dss.getObjUid();

    } else {

      DOBO bo = DOBO.getDOBOByName("do_datasource");
      dataSourceUid = bo.getCorrInstance().getUid();
View Full Code Here


    List listHiddenKeys = Arrays.asList(key_hiddens);

    DOBO bo = DOBO.getDOBOByName("do_bo");
    DOBO selected = DOBO.getDOBOByID(bo.getCorrInstance().getUid());

    DODataSource dss = null;
    ///多租户情况`
   
    if ("true".equals(DOGlobals.getValue("multi.tenancy"))) {
      dss = DOGlobals.getInstance().getSessoinContext()
          .getTenancyValues().getDataDDS();
    } else {//单租户情况
      dss = selected.getDataBase();
    }
   
   
    Transaction t = dss.getTransaction();
    t.begin();

    // /先确定删除的
    List list = selected.retrieveProperties();
    List propCols = new ArrayList();

    for (Iterator it = list.iterator(); it.hasNext();) {
      DOBOProperty dop = (DOBOProperty) it.next();
      if (dop.getIsPersistence() == null
          || dop.getIsPersistence().intValue() == DOBOProperty.PERSISTENCE_YES) {
        propCols.add(dop.getObjUid());
      }
    }
    List removeCols = new ArrayList(propCols);

    System.out.println("AllCols::" + removeCols);

    removeCols.removeAll(listHiddenKeys);
    // //需要删除的字段propCols

    System.out.println("RemoveCols::" + removeCols);

    for (int i = 0; i < removeCols.size(); i++) {
      String colObjuid = (String) removeCols.get(i);
      DOBOProperty dop = DOBOProperty.getDOBOPropertyByID(colObjuid);

      StringBuffer sb = new StringBuffer("alter table ");
      sb.append(selected.getSqlStr()).append(" drop column ").append(
          dop.getColName());

      listSql.add(sb.toString());

      pm.removeProperty(selected, dop);
    }

    // 先确定新增的

    for (int len = 0; len < key_hiddens.length; len++) {

      String keyHidden = key_hiddens[len];
      if (keyHidden == null || keyHidden.equals("")) {
        if (colNames[len] != null && !colNames[len].equals("")) {
          DOBOProperty dopExists =  DOBOProperty.getDOBOPropertyByName(selected.getName(),
              colNames[len]);
          if (dopExists==null || dopExists.getColName()==null) {

            StringBuffer sb = new StringBuffer("alter table ");
            sb.append(selected.getSqlStr()).append(" add  ")
                .append(colNames[len]).append(" ").append(
                    dbtypes[len]);

            int iDBSize = 255;
            if (dbsizes[len] != null && !dbsizes[len].equals("")) {
              iDBSize = Integer
                  .parseInt(dbsizes[len]);
              sb.append(" (").append(dbsizes[len]).append(")");
            }
            listSql.add(sb.toString());

            int iType = 12;
            try {
              iType = Integer.parseInt(map.get(dbtypes[len]
                  .toLowerCase()));
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            System.out.println("ColName:" + colNames[len]
                + "  DBSize:" + dbsizes[len]);
            pm.addProperty(selected, colNames[len], iType, iDBSize);
           

          }else{
            System.out.println("已经存在ColName::" + DOBOProperty.getDOBOPropertyByName(selected.getName(),
                colNames[len]));
          }
        }
      }
    }

    // //确定修改的

    Connection con = null;
    try {
      con = dss.getConnection();
      Statement stmt = con.createStatement();

      for (Iterator<String> it = listSql.iterator(); it.hasNext();) {
        String aSql = it.next();
        stmt.execute(aSql);
View Full Code Here

    // ////////////////清楚缓存
//    HbmDAO dao = new HbmDAO();
//    dao.setAutoClose(false);
//    dao.setIsTransaction(true);
   
    DODataSource dds = DODataSource.parseGlobals();
   
    Transaction t = dds.getTransaction();
   
    t.begin();
   
    try {
View Full Code Here

        if (biTenancy != null) {

          sb.append("\n<tenant>").append(biTenancy.getValue("name"))
              .append("</tenant>\n");
          DODataSource dss = null;
          // /多租户情况`

          if ("true".equals(DOGlobals.getValue("multi.tenancy"))) {
            dss = DOGlobals.getInstance().getSessoinContext()
                .getTenancyValues().getDataDDS();
          } else {// 单租户情况
            DOBO bo = DOBO.getDOBOByName("do_datasource");
            dss = DODataSource.getDataSourceByL10n(bo
                .getCorrInstance().getValue("l10n"));
          }

          Connection con = null;
          try {
            con = dss.getConnection();
            String sql = "show create table "
                + selectBI.getValue("sqlstr");

            PreparedStatement pstmt = con.prepareStatement(sql);
View Full Code Here

    DOBO aBO = new DOBO();
    aBO.setType(DOBO.TYPE_BUSINESS);
    aBO.setName(project.getName() + "_global_bo");
    aBO.setL10n(project.getL10n() + "_global");

    DODataSource dds = DODataSource.parseGlobals();

    Transaction t = dds.getTransaction();

    t.begin();

    DOService aService = DOService.getService("DO_UI_PaneLinks_copy");
    try {
View Full Code Here

TOP

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

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.