Package railo.runtime.component

Examples of railo.runtime.component.Property


            CommonUtil.createProperty(name.getString(),res.getString("TYPE_NAME")));
      }
     
      // ids
      res = md.getPrimaryKeys(null, null, tableName);
      Property p;
      while(res.next()) {
        name=CommonUtil.createKey(res.getString("COLUMN_NAME"));
        p=(Property) properties.get(name,null);
        if(p!=null) p.getDynamicAttributes().setEL(CommonUtil.FIELDTYPE, "id");
      }
     
      // MUST foreign-key relation
   
    }
View Full Code Here


  private static PropertyCollection splitJoins(Component cfc,Map<String, PropertyCollection> joins,Property[] props,SessionFactoryData data) {
    Struct sct=CommonUtil.createStruct();
    ArrayList<Property> others = new ArrayList<Property>();
    java.util.List<Property> list;
    String table;
    Property prop;
    String fieldType;
    boolean isJoin;
    for(int i=0;i<props.length;i++){
      prop=props[i];
      table=getTable(cfc,prop,data);
      // joins
      if(!Util.isEmpty(table,true)){
        isJoin=true;
        // wrong field type
        try {
          fieldType = toString(cfc, prop, sct, FIELDTYPE,false,data);
         
          if("collection".equalsIgnoreCase(fieldType)) isJoin=false;
          else if("primary".equals(fieldType)) isJoin=false;
          else if("version".equals(fieldType)) isJoin=false;
          else if("timestamp".equals(fieldType)) isJoin=false;
        }
        catch (PageException e) {}
       
        // missing column
        String columns=null;
        try {
          if(ORMUtil.isRelated(props[i])){
                columns=toString(cfc,props[i], prop.getDynamicAttributes(), "fkcolumn",data);
              }
              else {
                columns=toString(cfc,props[i], prop.getDynamicAttributes(), "joincolumn",data);
              }
        }
        catch(PageException e){}
        if(Util.isEmpty(columns)) isJoin=false;
       
View Full Code Here

        clazz.appendChild(join);
   
        join.setAttribute("table", escape(HibernateUtil.convertTableName(data,coll.getTableName())));
        //addTableInfo(joinNode, table, schema, catalog);
       
        Property first = properties[0];
        String schema = null, catalog=null, mappedBy=null, columns=null;
        if(ORMUtil.isRelated(first)){
          catalog=toString(cfc,first, first.getDynamicAttributes(), "linkcatalog",data);
          schema=toString(cfc,first, first.getDynamicAttributes(), "linkschema",data);
          columns=toString(cfc,first, first.getDynamicAttributes(), "fkcolumn",data);
         
        }
        else {
          catalog=toString(cfc,first, first.getDynamicAttributes(), "catalog",data);
          schema=toString(cfc,first, first.getDynamicAttributes(), "schema",data);
          mappedBy=toString(cfc,first, first.getDynamicAttributes(), "mappedby",data);
          columns=toString(cfc,first, first.getDynamicAttributes(), "joincolumn",data);
        }

        if(!Util.isEmpty(catalog)) join.setAttribute("catalog", catalog);
        if(!Util.isEmpty(schema)) join.setAttribute("schema", schema);
       
View Full Code Here

    clazz.appendChild(cid);
   
    //cid.setAttribute("mapped","true");
   
   
    Property prop;
    // ids
    for(int y=0;y<props.length;y++){
      prop=props[y];
      meta = prop.getDynamicAttributes();
      Element key = doc.createElement("key-property");
      cid.appendChild(key);
     
      // name
      key.setAttribute("name",prop.getName());
     
      // column
      Element column = doc.createElement("column");
      key.appendChild(column);
     
      String str = toString(cfc,prop,meta,"column",data);
        if(Util.isEmpty(str,true)) str=prop.getName();
        column.setAttribute("name",formatColumn(str,data));
        ColumnInfo info=getColumnInfo(columnsInfo,tableName,str,null);
       
            str = toString(cfc,prop,meta,"sqltype",data);
        if(!Util.isEmpty(str,true)) column.setAttribute("sql-type",str);
        str = toString(cfc,prop,meta,"length",data);
        if(!Util.isEmpty(str,true)) column.setAttribute("length",str);
           
        /*if(info!=null){
          column.setAttribute("sql-type",info.getTypeName());
          column.setAttribute("length",Caster.toString(info.getSize()));
        }*/
     
         // type
      //str=getType(info,prop,meta,"long"); //MUSTMUST
      //key.setAttribute("type", str);
     
      String generator=toString(cfc,prop,meta,"generator",data);
      String type = getType(info,cfc,prop,meta,getDefaultTypeForGenerator(generator,"string"),data);
      if(!Util.isEmpty(type))key.setAttribute("type", type);
     
     
     
           
    }
   
    // many-to-one
    String fieldType;
    for(int y=0;y<props.length;y++){
      prop=props[y];
      meta = prop.getDynamicAttributes();
      fieldType = toString(cfc,prop,meta,"fieldType",data);
      if(CommonUtil.listFindNoCaseIgnoreEmpty(fieldType,"many-to-one",',')==-1)continue;
     
      Element key = doc.createElement("key-many-to-one");
      cid.appendChild(key);
     
      // name
      key.setAttribute("name",prop.getName());
     
      // entity-name
      setForeignEntityName(cfc,prop, meta, key,false,data);
     
      // fkcolum
View Full Code Here

        try {
          Component cfc = data.getEntityByCFCName(foreignCFC.toString(), false);
          if(cfc!=null){
            Property[] ids = getIds(cfc,cfc.getProperties(true),null,true,data);
            if(ids!=null && ids.length>0){
              Property id = ids[0];
              id.getDynamicAttributes();
              Struct meta = id.getDynamicAttributes();
              if(meta!=null){
                String type=CommonUtil.toString(meta.get(TYPE,null));
               
                if(!Util.isEmpty(type) && (!type.equalsIgnoreCase("any") && !type.equalsIgnoreCase("object"))){
                  return type;
View Full Code Here

        Property[] _props=getProperties(pc,other,dc,meta,isClass, true,data);
        PropertyCollection _propColl = splitJoins(cfc,new HashMap<String, PropertyCollection>(), _props,data);
        _props=_propColl.getProperties();
       
        Struct m;
        Property _prop=null;
        for(int i=0;i<_props.length;i++){
          m = _props[i].getDynamicAttributes();
          // fieldtype
          String fieldtype = CommonUtil.toString(m.get(FIELDTYPE,null),null);
          if("many-to-many".equalsIgnoreCase(fieldtype)) {
View Full Code Here

   
    String feName = toString(cfc,prop,meta,"cfc",true,data);
    Component feCFC=data.getEntityByCFCName(feName, false);
    Property[] feProps = feCFC.getProperties(true);
   
    Property p;
    Component _cfc;
    for(int i=0;i<feProps.length;i++){
      p=feProps[i];

      // compare fieldType
      str=toString(feCFC,p,p.getDynamicAttributes(),"fieldtype",false,data);
      if(!otherType.equalsIgnoreCase(str)) continue;
     
      // compare cfc
      str=toString(feCFC,p,p.getDynamicAttributes(),"cfc",false,data);
      if(Util.isEmpty(str)) continue;
      _cfc=data.getEntityByCFCName(str, false);
      if(_cfc==null || !_cfc.equals(cfc))continue;
     
      // get fkcolumn
      str=toString(_cfc,p,p.getDynamicAttributes(),"fkcolumn",data);
      if(!Util.isEmpty(str)) return str;
     
     
    }
    throw ExceptionUtil.createException(data,null,"cannot terminate foreign key column name for component "+cfc.getName(),null);
View Full Code Here

      Property[] properties=ci.getProperties(false);
      DumpTable prop = new DumpTable("#99cc99","#ccffcc","#000000");

      prop.setTitle("Properties");
      prop.setWidth("100%");
      Property p;
      Object child;
      for(int i=0;i<properties.length;i++) {
        p=properties[i];
        child = ci.scope.get(KeyImpl.init(p.getName()),null);
        DumpData dd;
        if(child instanceof Component) {
          DumpTable t = new DumpTable("component","#99cc99","#ffffff","#000000");
          t.appendRow(1,new SimpleDumpData("Component"),new SimpleDumpData(((Component)child).getCallName()));
          dd=t;
         
        }
        else
          dd=DumpUtil.toDumpData(child, pc, maxlevel-1, dp);
       
       
       
        prop.appendRow(1, new SimpleDumpData(p.getName()),dd);
      }
     
      if(access>=ACCESS_PUBLIC && !prop.isEmpty()) {
        table.appendRow(0,prop);
      }
View Full Code Here

           
       
        // Properties
        if(comp.properties.properties!=null) {
          ArrayImpl parr = new ArrayImpl();
          Property p;
          Iterator<Entry<String, Property>> pit = comp.properties.properties.entrySet().iterator();
          while(pit.hasNext()){
            p=pit.next().getValue();
            parr.append(p.getMetaData());
          }
          parr.sort(new ArrayOfStructComparator(KeyConstants._name));
          sct.set(KeyConstants._properties,parr);
        }
View Full Code Here

   
    // MappedSuperClass 
    if(isPersistent() && !isBasePeristent() && top.base!=null && top.base.properties.properties!=null && top.base.properties.meta!=null) {
      boolean msc = Caster.toBooleanValue(top.base.properties.meta.get(KeyConstants._mappedSuperClass,Boolean.FALSE),false);
      if(msc){
        Property p;
        Iterator<Entry<String, Property>> it = top.base.properties.properties.entrySet().iterator();
        while(it.hasNext())  {
          p = it.next().getValue();
          if(p.isPeristent()) {
           
            setProperty(p);
          }
        }
      }
View Full Code Here

TOP

Related Classes of railo.runtime.component.Property

Copyright © 2018 www.massapicom. 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.