예제 #1
0
  /**
   * 获取自列表的列与掩码的Map
   *
   * @param conn
   * @param PO
   * @param dictMetadata
   * @param DOMeta
   * @throws Exception
   */
  protected static java.util.Map getSelfEnumColViewMap(
      JConnection conn, JParamObject PO, DictMetadata dictMetadata) throws Exception {
    if (dictMetadata == null) {
      return null;
    }
    TableMetadata tableMetadata = dictMetadata.getTableMetadata();
    if (tableMetadata == null) {
      return null;
    }
    java.util.List colList = tableMetadata.getColList();
    if (colList == null) return null;

    // 获取各列的掩码
    java.util.Map map = new java.util.HashMap();
    String objid = tableMetadata.getString("OBJ_ID", "");
    Statement st = null;
    ResultSet rs = null;
    String sql = " select * from SYS_SELFENUM" + " where OBJ_ID='" + objid + "' order by COL_DISP";
    try {
      st = conn.createStatement();
      rs = st.executeQuery(sql);
      while (rs.next()) {
        String colid = rs.getString("COL_ID");
        String colval = rs.getString("COL_VAL");
        String colnote = rs.getString("F_NOTE");
        if (colval == null || colval.length() == 0) {
          colval = " ";
        }
        if (colnote == null || colnote.length() == 0) {
          colnote = colval;
        }
        String view = (String) map.get(colid);
        if (view == null) {
          map.put(colid, colval + ":" + colnote);
        } else {
          if (view.endsWith(";")) {
            view = view.substring(0, view.length() - 1);
          }
          map.put(colid, view + ";" + colval + ":" + colnote);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      conn.BackStatement(st, rs);
    }
    return map;
  }
예제 #2
0
 /** 使用新式的元数据兼容旧的元数据 */
 protected static DictMetadata getMetaDataNew(JConnection conn, JParamObject PO, String dctid)
     throws Exception {
   DictMetadata dictMetadata = DictMetadata.getInstance();
   dictMetadata.setID(dctid);
   Statement st = null;
   DCTMetaData DICTMeta = null;
   DOMetaData DOMeta = null;
   try {
     st = JConnection.getInstance(conn).createStatement();
     //
     ESPServerContext ctx = ESPServerContext.getInstance(PO, JConnection.getInstance(conn));
     ctx.setStatement(st);
     DICTMeta =
         (DCTMetaData)
             MetaDataManager.getInstance(MetaDataManager._DCTObject_ + "_DAL")
                 .getMetaData(ctx, dctid);
     if (DICTMeta != null) {
       DOMeta = DICTMeta.getDoMetaData();
       dictMetadata.setStubTable(new Hashtable());
       dictMetadata.getStubTable().putAll(DICTMeta.getDataMap());
       //                DICTMeta.getSYS_DCT_CST();
     } else {
       DOMeta =
           (DOMetaData)
               MetaDataManager.getInstance(MetaDataManager._DataObject_ + "_DAL")
                   .getMetaData(ctx, dctid);
     }
     // 对象信息
     TableMetadata tableMetadata = TableMetadata.getInstance();
     tableMetadata.setID(dctid);
     tableMetadata.setStubTable(new Hashtable());
     if (tableMetadata.colList == null) tableMetadata.colList = new ArrayList();
     dictMetadata.tableMetadata = tableMetadata;
     // 复制对象信息
     if (DOMeta != null) tableMetadata.getStubTable().putAll(DOMeta.getDataMap());
     // 复制列信息
     getColMetadata(conn, PO, dictMetadata, DOMeta);
     // 复制数据字典的扩展属性
     getSYS_DCT_CST(conn, PO, dictMetadata, DICTMeta);
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
     conn.BackStatement(st, null);
   }
   return dictMetadata;
 }
예제 #3
0
 /** 取数据字典的自定义属性列表STUBOBJECT */
 private static List getDictCST(JConnection conn, JParamObject PO, String dctid) {
   java.util.List maps = new ArrayList();
   Statement stmt = null;
   try {
     stmt = conn.createStatement();
     HashMap map = new HashMap();
     map.put("TABLE", "SYS_DCT_CST");
     map.put("WHERE", "DCT_ID = '" + dctid + "'");
     map.put("ORDER", "UNIT_ID,DCT_KEY");
     maps.add(map);
     return DBUtils.SimpleQuery(conn, PO, maps, stmt);
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
     conn.BackStatement(stmt, null);
   }
   return null;
 }