Package siena

Examples of siena.SienaException


          Map<Key, Entity> entities = ds.get(fieldMap.get(field));
          // gets the future here because we need it so we wait for it
          entityMap.put(field, entities);
        }
      }catch(Exception ex){
        throw new SienaException(ex);
      }
      // associates linked models to their models
      // linkedModels is just a map to contain entities already mapped
      Map<Key, Object> linkedModels = new HashMap<Key, Object>();
      Object linkedObj;
      Entity entity;
     
      for (final T model : models) {
        for(Field field: fieldMap.keySet()){
          Object objVal = Util.readField(model, field);
                    // our object is not linked to another object...so it doesn't have any key
                    if(objVal == null) {
                        continue;
                    }

          Key key = GaeMappingUtils.getKey(objVal);
          linkedObj = linkedModels.get(key);
          if(linkedObj==null){
            entity = entityMap.get(field).get(key);
            linkedObj = objVal;
            GaeMappingUtils.fillModel(linkedObj, entity);
            linkedModels.put(key, linkedObj);
          }
       
          field.set(model, linkedObj);       
        }
      }
      return models;
    } catch(IllegalAccessException ex){
      throw new SienaException(ex);
    }   
  }
View Full Code Here


          Map<Key, Entity> entities = ds.get(fieldMap.get(field));
          // gets the future here because we need it so we wait for it
          entityMap.put(field, entities);
        }
      }catch(Exception ex){
        throw new SienaException(ex);
      }
      // associates linked models to their models
      // linkedModels is just a map to contain entities already mapped
      Map<Key, Object> linkedModels = new HashMap<Key, Object>();
      Object linkedObj;
      Entity entity;
     
      for (final T model : models) {
        for(Field field: fieldMap.keySet()){
          Object objVal = Util.readField(model, field);
                    // our object is not linked to another object...so it doesn't have any key
                    if(objVal == null) {
                        continue;
                    }

          Key key = GaeMappingUtils.getKey(objVal);
          linkedObj = linkedModels.get(key);
          if(linkedObj==null){
            entity = entityMap.get(field).get(key);
            linkedObj = objVal;
            GaeMappingUtils.fillModel(linkedObj, entity);
            linkedModels.put(key, linkedObj);
          }
       
          field.set(model, linkedObj);       
        }
      }
      return models;
    } catch(IllegalAccessException ex){
      throw new SienaException(ex);
    }   
  }
View Full Code Here

  public <T> int update(Iterable<T> objects) {
    return _updateMultiple(objects);
  }

  public <T> int update(Query<T> query, Map<String, ?> fieldValues) {
    throw new SienaException("update not implemented for GAE yet");
  }
View Full Code Here

      accFrom.getPersistenceManager().beginTransaction();
      accFrom.amount-=100L;
      accFrom.save();
      accTo.amount+=100L;
      accTo.save();
      throw new SienaException("test");
    }catch(SienaException e){
      accFrom.getPersistenceManager().rollbackTransaction();
    }finally{
      accFrom.getPersistenceManager().closeConnection();
    }
View Full Code Here

      return future.get();
    } catch (Exception e) {
      // FIXME
      // here it might wrap several exceptions with ExecutionException.
      // needs to unwrap it???
      throw new SienaException(e);
    }
  }
View Full Code Here

      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
      Delete d = new Delete(Bytes.toBytes(id.get(obj).toString()));
      table.delete(d);
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
     
      Get g = new Get(Bytes.toBytes(id.get(obj).toString()));     
      Result rowResult = table.get(g);
      if(rowResult.isEmpty()) throw new SienaException("No such object");
      mapObject(clazz, obj, rowResult);
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

            Bytes.toBytes(ClassInfo.getColumnNames(field)[0]),
            Bytes.toBytes(field.get(obj).toString()));
      }
      table.put(p);
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

        field.setAccessible(true);
        field.set(obj, value);
      }
      ClassInfo.getIdField(clazz).set(obj, id);
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

      mapObject(clazz, obj, rowResult);
      return obj;
    } catch(SienaException e) {
      throw e;
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here

TOP

Related Classes of siena.SienaException

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.