예제 #1
0
  @Override
  public String[] getSQL() throws AmbitException {
    for (Enzyme.EnzymeFields field : EnzymeFields.values())
      switch (field) {
        case id:
          {
            break;
          }
        default:
          {
            if (field.getValue(getObject()) != null) {
              return new String[] {String.format(sql, field.name())};
            } else break;
          }
      }

    throw new AmbitException();
  }
예제 #2
0
 @Override
 public List<QueryParam> getParameters(int index) throws AmbitException {
   List<QueryParam> params = new ArrayList<QueryParam>();
   for (Enzyme.EnzymeFields field : EnzymeFields.values()) {
     switch (field) {
       case id:
         {
           break;
         }
       default:
         {
           String value = field.getStringValue(getObject(), "");
           if (value != null) {
             params.add(new QueryParam<String>(String.class, value));
             params.add(new QueryParam<Integer>(Integer.class, getObject().getID()));
             return params;
           }
         }
     }
   }
   return null;
 }