Package com.avaje.ebeaninternal.server.el

Examples of com.avaje.ebeaninternal.server.el.ElPropertyValue


        // off root path or parent already ahead in fetch order
        sorted.put(path, p);
      } else {
        OrmQueryProperties parentProp = fetchPaths.get(parentPath);
        if (parentProp == null) {
          ElPropertyValue el = d.getElGetValue(parentPath);
          if (el == null) {
            String msg = "Path [" + parentPath + "] not valid from " + d.getFullName();
            throw new PersistenceException(msg);
          }
          // add a missing parent path just fetching the Id property
          BeanPropertyAssoc<?> assocOne = (BeanPropertyAssoc<?>) el.getBeanProperty();
          parentProp = new OrmQueryProperties(parentPath, assocOne.getTargetIdProperty());
        }
        if (parentProp != null) {
          sortFetchPaths(d, parentProp, sorted);
        }
View Full Code Here


    this.val = value;
  }

  public void addBindValues(SpiExpressionRequest request) {

    ElPropertyValue prop = getElProp(request);
    if (prop != null && prop.isDbEncrypted()) {
      // bind the key as well as the value
      String encryptKey = prop.getBeanProperty().getEncryptKey().getStringValue();
      request.addBindValue(encryptKey);
    }

    String bindValue = getValue(val, caseInsensitive, type);
    request.addBindValue(bindValue);
View Full Code Here

  public void addSql(SpiExpressionRequest request) {

    String propertyName = getPropertyName();
    String pname = propertyName;

    ElPropertyValue prop = getElProp(request);
    if (prop != null && prop.isDbEncrypted()) {
      pname = prop.getBeanProperty().getDecryptProperty(propertyName);
    }
    if (caseInsensitive) {
      request.append("lower(").append(pname).append(")");
    } else {
      request.append(pname);
View Full Code Here

    this.values = array;
  }

  public void addBindValues(SpiExpressionRequest request) {

    ElPropertyValue prop = getElProp(request);
    if (prop != null && !prop.isAssocId()) {
      prop = null;
    }

    for (int i = 0; i < values.length; i++) {
      if (prop == null) {
        request.addBindValue(values[i]);

      } else {
        // extract the id values from the bean
        Object[] ids = prop.getAssocOneIdValues((EntityBean)values[i]);
        if (ids != null) {
          for (int j = 0; j < ids.length; j++) {
            request.addBindValue(ids[j]);
          }
        }
View Full Code Here

      return;
    }

    String propertyName = getPropertyName();

    ElPropertyValue prop = getElProp(request);
    if (prop != null && !prop.isAssocId()) {
      prop = null;
    }

    if (prop != null) {
      request.append(prop.getAssocIdInExpr(propertyName));
      String inClause = prop.getAssocIdInValueExpr(values.length);
      request.append(inClause);

    } else {
      request.append(propertyName);
      request.append(" in (?");
View Full Code Here

    while (it.hasNext()) {
      RawSql.ColumnMapping.Column column = it.next();
      String propertyName = column.getPropertyName();
      if (!RawSqlBuilder.IGNORE_COLUMN.equals(propertyName)) {

        ElPropertyValue el = descriptor.getElGetValue(propertyName);
        if (el == null) {
            throw new PersistenceException("Property [" + propertyName + "] not found on " + descriptor.getFullName());
        } else {
          BeanProperty beanProperty = el.getBeanProperty();
          if (beanProperty.isId() || beanProperty.isDiscriminator()) {
            // For @Id properties we chop off the last part of the path
            propertyName = SplitName.parent(propertyName);
          } else if (beanProperty instanceof BeanPropertyAssocOne<?>) {
            String msg = "Column [" + column.getDbColumn() + "] mapped to complex Property[" + propertyName + "]";
View Full Code Here

    return Op.EQ.equals(type);
  }

  public void addBindValues(SpiExpressionRequest request) {

    ElPropertyValue prop = getElProp(request);
    if (prop != null) {
      if (prop.isAssocId()) {
        Object[] ids = prop.getAssocOneIdValues((EntityBean)value);
        if (ids != null) {
          for (int i = 0; i < ids.length; i++) {
            request.addBindValue(ids[i]);
          }
        }
        return;
      }
      if (prop.isDbEncrypted()) {
        // bind the key as well as the value
        String encryptKey = prop.getBeanProperty().getEncryptKey().getStringValue();
        request.addBindValue(encryptKey);
      } else if (prop.isLocalEncrypted()) {
        // not supporting this for equals (but probably could)
        // prop.getBeanProperty().getScalarType();

      }
    }
View Full Code Here

  public void addSql(SpiExpressionRequest request) {

    String propertyName = getPropertyName();

    ElPropertyValue prop = getElProp(request);
    if (prop != null) {
      if (prop.isAssocId()) {
        request.append(prop.getAssocOneIdExpr(propertyName, type.bind()));
        return;
      }
      if (prop.isDbEncrypted()) {
        String dsql = prop.getBeanProperty().getDecryptSql();
        request.append(dsql).append(type.bind());
        return;
      }
    }
    request.append(propertyName).append(type.bind());
View Full Code Here

    Customer c1 = new Customer();

    SpiEbeanServer server = (SpiEbeanServer)Ebean.getServer(null);
    BeanDescriptor<Customer> descriptor = server.getBeanDescriptor(Customer.class);

    ElPropertyValue elProp = descriptor.getElGetValue("billingAddress.id");
    ElPropertyValue addrLine1Prop = descriptor.getElGetValue("billingAddress.line1");
    ElPropertyValue addrCityProp = descriptor.getElGetValue("billingAddress.city");
   
    elProp.elGetReference((EntityBean)c0);
    elProp.elGetReference((EntityBean)c1);
       
    addrLine1Prop.elSetValue((EntityBean)c1, "12 someplace", true);
    addrCityProp.elSetValue((EntityBean)c1, "Auckland", true);
  }
View Full Code Here

       
        SpiEbeanServer server = (SpiEbeanServer)Ebean.getServer(null);
       
        BeanDescriptor<DPerson> descriptor = server.getBeanDescriptor(DPerson.class);
       
        ElPropertyValue elCmoney = descriptor.getElGetValue("cmoney");
//        ElPropertyValue elCmoneyAmt = descriptor.getElGetValue("cmoney.amount");
//        ElPropertyValue elCmoneyCur = descriptor.getElGetValue("cmoney.currency");
       
        JsonContext jsonContext = server.json();
        String json = jsonContext.toJson(p);
       
        DPerson bean = jsonContext.toBean(DPerson.class, json);
        Assert.assertEquals("first", bean.getFirstName());
        Assert.assertEquals(new Money("12200"), bean.getSalary());
        Assert.assertEquals(new Money("12"), bean.getCmoney().getAmount());
        Assert.assertEquals(NZD, bean.getCmoney().getCurrency());
       
       
        EntityBean entityBean = (EntityBean)p;
       
        Object cmoney = elCmoney.elGetValue(entityBean);
//        Object amt = elCmoneyAmt.elGetValue(entityBean);
//        Object cur = elCmoneyCur.elGetValue(entityBean);
       
        Assert.assertNotNull(cmoney);
//        Assert.assertEquals(new Money("12"), amt);
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.el.ElPropertyValue

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.