Package siena.core

Examples of siena.core.Relation


          ClassInfo.getClassInfo(this.getClass()).aggregator);
  }
 
  public Model aggregate(Object aggregator, String fieldName){
    return setRelation(
        new Relation(RelationMode.AGGREGATION, aggregator, Util.getField(aggregator.getClass(), fieldName)));
  }
View Full Code Here


   
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    if(info.hasAggregator){
      Relation rel = (Relation)Util.readField(obj, info.aggregator);
      if(rel != null && rel.mode == RelationMode.AGGREGATION){
        ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
        Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
        _deleteSingle(obj, keys, parentKey, parentInfo, (Field)rel.discriminator);
      }else {
View Full Code Here

  private <T> void _insertSingle(T obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    if(info.hasAggregator){
      Relation rel = (Relation)Util.readField(obj, info.aggregator);
      if(rel != null && rel.mode == RelationMode.AGGREGATION){
        ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
        Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
        _insertSingle(obj, parentKey, rel.target, parentInfo, (Field)rel.discriminator);
      }else {
View Full Code Here

    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
     
      if(info.hasAggregator){
        Relation rel = (Relation)Util.readField(obj, info.aggregator);
        if(rel != null && rel.mode == RelationMode.AGGREGATION){
          ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
          Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
          _insertAddEntity(entities, obj, info, parentKey, parentInfo, (Field)rel.discriminator);
        }else {
View Full Code Here

  public void update(Object obj) {
    Class<?> clazz = obj.getClass();
    ClassInfo info = ClassInfo.getClassInfo(clazz);
   
    if(info.hasAggregator){
      Relation rel = (Relation)Util.readField(obj, info.aggregator);
      if(rel != null && rel.mode == RelationMode.AGGREGATION){
        ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
        Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
        if(!info.hasAggregatedFields && !info.hasOwnedFields){
          _updateSimple(obj, info, parentKey, parentInfo, (Field)rel.discriminator);
View Full Code Here

    for(Object obj:objects){
      Class<?> clazz = obj.getClass();
      ClassInfo info = ClassInfo.getClassInfo(clazz);
     
      if(info.hasAggregator){
        Relation rel = (Relation)Util.readField(obj, info.aggregator);
        if(rel != null && rel.mode == RelationMode.AGGREGATION){
          ClassInfo parentInfo = ClassInfo.getClassInfo(rel.target.getClass());
          Key parentKey = GaeMappingUtils.makeKey(parentInfo, rel.target);
          _updateBuildMaps(entitiesMap, objectsMap, keysMap,
              obj, parentKey, parentInfo, (Field)rel.discriminator);
View Full Code Here

    }

    if(aggregs.size() == 1){
      // aggregators
      QueryAggregated aggreg = aggregs.get(0);     
      Relation rel =
        new Relation(RelationMode.AGGREGATION, aggreg.aggregator, aggreg.field);
      Util.setField(obj, info.aggregator, rel);
    }
    else if(aggregs.size() > 1){
      throw new SienaException("Only one aggregation per query allowed");
    }
View Full Code Here

    }
   
    if(aggregs.size() == 1){
      QueryAggregated aggreg = aggregs.get(0);
     
      Relation rel =
        new Relation(RelationMode.AGGREGATION, aggreg.aggregator, aggreg.field);
      for(T obj: objs){
        Util.setField(obj, info.aggregator, rel);
      }     
    }
    else if(aggregs.size() > 1){
View Full Code Here

TOP

Related Classes of siena.core.Relation

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.