Package de.mhus.lib.adb.model

Examples of de.mhus.lib.adb.model.Field


    }
  }

  public Field createField(DbManager manager, Table table, String name, boolean pk, boolean virtual, Method setter, Method getter, Class<?> ret, IConfig attr,DbDynamic.Field dynamicField) {

    Field field = null;
    if (virtual)
      field = new FieldVirtual( table, name, pk, setter, getter, ret, attr );
    else
      field = new FieldPersistent( manager, table, name, pk, setter, getter, ret, attr, dynamicField );
View Full Code Here


        String order = "";
        if (!"".equals(field.getConfig().orderBy())) {
          order = " ORDER BY $db." + tar + "." + field.getConfig().orderBy() + "$";
        }
       
        Field idField = field.getTable().getField(src);
        if (idField == null) return null;
        Object id = idField.getFromTarget(obj);
        if (id == null) return null;
        relations = new RelList<T>( field.getManager().getByQualification(field.getConfig().target(),
            "$db." + field.getConfig().target().getSimpleName() + "." + tar + "$ = $id$" + order ,
            new AttributeMap("id", id) ).toCacheAndClose(), field.getConfig());
       
View Full Code Here

    if (!field.getConfig().managed() || !isChanged()) return;
   
    String src = field.getConfig().sourceAttribute();
    if ("".equals(src)) src = "Id";
    src = src.toLowerCase();
    Field idField = field.getTable().getField(src);
    if (idField == null) return;
    Object id = idField.getFromTarget(obj);
    if (id == null) return;

    String tar = field.getConfig().targetAttribute();
    if ("".equals(tar)) tar = field.getName() + "Id";
    tar = tar.toLowerCase();
View Full Code Here

        src = src.toLowerCase();
        String tar = field.getConfig().targetAttribute();
        if ("".equals(tar)) tar = "Id";
        //tar = tar.toLowerCase();
       
        Field idField = field.getTable().getField(src);
        if (idField == null) return null;
        Object id = idField.getFromTarget(obj);
        if (id == null) return null;
       
        List<?> res = field.getManager().getByQualification(field.getConfig().target(),
            "$db." + field.getConfig().target().getSimpleName() + "." + tar + "$ = $id$",
            new AttributeMap("id", id) ).toCacheAndClose();
View Full Code Here

     
      String src = field.getConfig().sourceAttribute();
      if ("".equals(src)) src = field.getName() + "Id";
      src = src.toLowerCase();

      Field idField = field.getTable().getField(src);
      if (idField == null) return;
     
      if (relation == null)
        idField.set(obj, null);
      else {
        String tar = field.getConfig().targetAttribute();
        if ("".equals(tar)) tar = "Id";
        tar = tar.toLowerCase();

        Object id = field.getManager().getTable(field.getManager().getRegistryName(relation)).getField(tar).get(relation);
        idField.set(obj, id);
      }
      changed = false;
    }
  }
View Full Code Here

    this.config = config;
    if (obj instanceof CaoAdbObject) parentObject = (CaoAdbObject) obj;
    this.adbObject = obj;

    for (CaoMetaDefinition d : m) {
      Field field = tab.getField(d.getName());
      Object value = field.get(obj);
      switch (d.getType()) {
      case OBJECT:
      case BINARY:
        setObject(d.getName(), value);
        break;
View Full Code Here

TOP

Related Classes of de.mhus.lib.adb.model.Field

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.