예제 #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;
 }