示例#1
0
 @Override
 public PeMSProfile build() {
   try {
     PeMSProfile record = new PeMSProfile();
     record.pems =
         fieldSetFlags()[0]
             ? this.pems
             : (java.util.List<edu.berkeley.path.model_elements_base.PeMS>)
                 defaultValue(fields()[0]);
     return record;
   } catch (Exception e) {
     throw new org.apache.avro.AvroRuntimeException(e);
   }
 }
  /**
   * Read the pems rows with the given ID and time range from the database.
   *
   * @see #read() if you want a transaction and logging around the operation.
   */
  public PeMSProfile readProfile(Interval interval, Long vdsId) throws DatabaseException {
    PeMSProfile profile = new PeMSProfile();
    profile.setPemsList(new ArrayList<PeMS>());
    PeMS pems;

    String query = null;

    try {
      query = runQueryProfile(interval, vdsId);
      while (null != (pems = pemsFromQueryRS(query))) {
        profile.getPems().add(pems);
      }
    } finally {
      if (query != null) {
        dbr.psDestroy(query);
      }
    }

    return profile;
  }