示例#1
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;
 }
示例#2
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);
 }