コード例 #1
0
 /**
  * @param conn JConnection
  * @param PO JParamObject
  * @param dictMetadata DictMetadata
  * @param colMetadata ColMetaData
  * @throws Exception
  */
 protected static void getColRefDictMetadata(
     JConnection conn, JParamObject PO, DictMetadata dictMetadata, ColumnMetaData colMetadata)
     throws Exception {
   // 如果列没有启用,直接返回
   TableMetadata tableMetadata = dictMetadata.getTableMetadata();
   if (!"1".equals(colMetadata.getString("COL_USE", "1"))) return;
   String COL_FOBJ = colMetadata.getString("COL_FOBJ", null);
   if (COL_FOBJ == null || "".equals(COL_FOBJ.trim())) return;
   // 如果外键是他自己,可能造成死循环,不再获取元数据
   if (COL_FOBJ.equals(tableMetadata.getString("OBJ_ID", ""))) return;
   DictMetadata fkeyDictMetadata = getMetaDataNew(conn, PO, COL_FOBJ);
   attachColmetadataRefDict(colMetadata, fkeyDictMetadata);
 }
コード例 #2
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;
  }
コード例 #3
0
 protected static void getSYS_DCT_CST(
     JConnection conn, JParamObject PO, DictMetadata dictMetadata, DCTMetaData DCTMeta)
     throws Exception {
   if (DCTMeta == null) return;
   TableMetadata tableMetadata = dictMetadata.getTableMetadata();
   String DCT_ID = tableMetadata.getString("OBJ_ID", "");
   java.util.List list = new ArrayList();
   java.util.Map SYS_DCT_CST = DCTMeta.getSYS_DCT_CST();
   if (SYS_DCT_CST == null) return;
   ;
   for (Iterator it = SYS_DCT_CST.keySet().iterator(); it.hasNext(); ) {
     Object key = it.next();
     Object val = SYS_DCT_CST.get(key);
     StubObject so = new StubObject();
     so.setString("UNIT_ID", "");
     so.setString("DCT_ID", DCT_ID);
     so.setString("DCT_KEY", (String) key);
     so.setString("DCT_VALUE", (String) val);
     list.add(so);
   }
   dictMetadata.setObject("SYS_DCT_CST", list);
 }