Examples of MutableMetadata


Examples of de.mhus.lib.cao.util.MutableMetadata

//      }
     
      if (tRes.next()) {
        log.t("--- found table",tName);
       
        MutableMetadata caoMeta = null;
        if (caoBundle !=null) {
          caoMeta = new MutableMetadata(caoBundle.getDriver());
          caoBundle.getBundle().put(tName, caoMeta);
        }
       
        // check fields
       
        for (IConfig cfield : ctable.getConfigBundle("field")) {
         
          String fNameOrg = cfield.getExtracted("name");
          String fName = normalizeColumnName(fNameOrg);
         
          if (cfield.getString(K_CATEGORIES, "").indexOf(C_VIRTUAL) < 0) {
            ResultSet fRes = meta.getColumns(null, null, tn, fName);
            log.t("field",tName,fNameOrg);
            if (fRes.next()) {
              String fName2 = fRes.getString("COLUMN_NAME");
              String fType = fRes.getString("TYPE_NAME");
              int    fSize = fRes.getInt("COLUMN_SIZE");
              int    fNull = fRes.getInt("NULLABLE");
              String fDef  = fRes.getString("COLUMN_DEF");
              log.t("found field",tName,fName2,fType,fSize,fNull,fDef);
             
              // check field type && not null
 
              String fType1 = getDbType(cfield);
             
              if (fType.indexOf("CHAR") >=0) fType = fType + "(" + fSize + ")"; // add size to type
             
              if (!fType1.equals(fType)) {
                alterColumn(sth,tn,cfield);
              } else {
                boolean xdef = cfield.getProperty("default") != null;
                // check field default
                if (fDef != null && !xdef) {
                  //remove default
                  alterColumnDropDefault(sth,tn,fName);
                } else
                if (fDef == null && xdef || fDef != null && !fDef.equals(cfield.getProperty("default")) ) {
                  //set default
                  alterColumnSetDefault(sth,tn,fName,cfield);
                }
               
              }
             
             
            } else {
              alterColumnAdd(sth,tn,cfield);
            }
            fRes.close();
          }
          if (caoMeta != null) {
            List<CaoMetaDefinition> metaMap = caoMeta.getMap();
            CaoMetaDefinition.TYPE caoType = getCaoType(cfield);
            String[] categories = MString.splitIgnoreEmpty(cfield.getString(K_CATEGORIES, ""),",",true);
            metaMap.add(new CaoMetaDefinition(caoMeta, cfield.getExtracted("name"), caoType, cfield.getExtracted("nls"), cfield.getInt("size",100), categories ));
          }
         
        }
       
        // END fields
       
        if (tRes.next()) {
          log.t("*** found more then one tables",tName);
        }
      } else {
        log.t("--- table not found",tName);
        // create
       
        MutableMetadata caoMeta = null;
        if (caoBundle !=null) {
          caoMeta = new MutableMetadata(caoBundle.getDriver());
          caoBundle.getBundle().put(tName, caoMeta);
        }
       
        createTable(sth,tn,ctable);
        for (IConfig f:ctable.getConfigBundle("field")) {
          if (caoMeta != null) {
            List<CaoMetaDefinition> metaMap = caoMeta.getMap();
            CaoMetaDefinition.TYPE caoType = getCaoType(f);
            metaMap.add(new CaoMetaDefinition(caoMeta, f.getExtracted("name"), caoType, f.getExtracted("nls"), f.getInt("size",100) ));
          }
        }
      }
View Full Code Here

Examples of de.mhus.lib.cao.util.MutableMetadata

        query = ((JackConnection)getConnection()).getSession()
          .getWorkspace().getQueryManager().createQuery(queryString.trim(),language);
        result = query.execute();
     

      meta = new MutableMetadata(getDriver());
      List<CaoMetaDefinition> map = meta.getMap();
     
      for (String colName : result.getColumnNames()) {
        map.add(new CaoMetaDefinition(meta, colName, TYPE.STRING, null, Integer.MAX_VALUE));
      }
View Full Code Here

Examples of de.mhus.lib.cao.util.MutableMetadata

    public QueryList() throws Exception {
      super(SqlQueryResult.this, queryString);

      result = createResult();
     
      meta = new MutableMetadata(getDriver());
      for (String name : result.getColumnNames()) {
        meta.getMap().add(new CaoMetaDefinition(meta, name, CaoMetaDefinition.TYPE.STRING, null, 200));
      }
     
    }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

         retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
         repository.addMetaDataRetrieval(retrieval);
      }
      if (retrieval instanceof MutableMetaData)
      {
         MutableMetaData mmd = (MutableMetaData)retrieval;
         mmd.addMetaData(tracker, ContextTracker.class);
      }
      else
      {
         log.info("Cannot add/modify default scoped metadata: " + retrieval);
      }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

      KernelMetaDataRepository kmdr = kernel.getMetaDataRepository();
      MutableMetaDataRepository repository = kmdr.getMetaDataRepository();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
      if (retrieval != null && retrieval instanceof MutableMetaData)
      {
         MutableMetaData mmd = (MutableMetaData)retrieval;
         mmd.removeMetaData(ContextTracker.class);

         if (retrieval.isEmpty())
            repository.removeMetaDataRetrieval(retrieval.getScope());
      }
      else
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

    */
   protected abstract MetaDataRetrieval initComponentRetrieval(Signature signature);
  
   public <T extends Annotation> T addAnnotation(Signature signature, T annotation)
   {
      MutableMetaData component = initRetrieval(signature);
      return component.addAnnotation(annotation);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

      return component.addAnnotation(annotation);
   }

   public <T> T addMetaData(Signature signature, String name, T metaData, Class<T> type)
   {
      MutableMetaData component = initRetrieval(signature);
      return component.addMetaData(name, metaData, type);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

      return component.addMetaData(name, metaData, type);
   }

   public <T> T addMetaData(Signature signature, T metaData, Class<T> type)
   {
      MutableMetaData component = initRetrieval(signature);
      return component.addMetaData(metaData, type);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

      return component.addMetaData(metaData, type);
   }

   public <T extends Annotation> T removeAnnotation(Signature signature, Class<T> annotationType)
   {
      MutableMetaData component = initRetrieval(signature);
      return component.removeAnnotation(annotationType);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.MutableMetaData

      return component.removeAnnotation(annotationType);
   }

   public <T> T removeMetaData(Signature signature, Class<T> type)
   {
      MutableMetaData component = initRetrieval(signature);
      return component.removeMetaData(type);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.