Package siena.core.options

Examples of siena.core.options.QueryOption


    return list.get(0);
  }

  public <T> void release(Query<T> query) {
    QueryOptionOffset offset = (QueryOptionOffset)query.option(QueryOptionOffset.ID);
    QueryOption state = query.option(QueryOptionState.ID);
   
    // resets offset
    if(offset.isActive())
      offset.offset=0;
    // disables reusable and cludge
    if(state.isActive()){
      state.passivate();
    }
  }
View Full Code Here


   
  }

  public <T> void release(QueryAsync<T> query) {
    QueryOptionOffset offset = (QueryOptionOffset)query.option(QueryOptionOffset.ID);
    QueryOption reuse = query.option(QueryOptionState.ID);
   
    // resets offset
    if(offset.isActive())
      offset.offset=0;
    // disables reusable and cludge
    if(reuse.isActive()){
      reuse.passivate();
    }
  }
View Full Code Here

  }
 
  public void testDumpQueryOption() {
    Query<PersonLongAutoID> query = pm.createQuery(PersonLongAutoID.class);
   
    QueryOption opt = query.option(QueryOptionPage.ID);
    Json dump = opt.dump();
    String str = JsonSerializer.serialize(dump).toString();
    assertNotNull(str);
    assertEquals("{\"value\": {\"pageType\": \"TEMPORARY\", \"state\": \"PASSIVE\", \"pageSize\": 0, \"type\": 1}, \"type\": \""+QueryOptionPage.class.getName()+"\"}", str);
  }
View Full Code Here

    assertNotNull(str);
    assertEquals("{\"value\": {\"pageType\": \"TEMPORARY\", \"state\": \"PASSIVE\", \"pageSize\": 0, \"type\": 1}, \"type\": \""+QueryOptionPage.class.getName()+"\"}", str);
  }
 
  public void testRestoreQueryOption() {
    QueryOption optRestored = (QueryOption)JsonSerializer.deserialize(QueryOption.class, Json.loads(
      "{\"type\":\""+QueryOptionPage.class.getName()+"\", \"value\": {\"pageType\": \"TEMPORARY\", \"state\": \"PASSIVE\", \"pageSize\": 0, \"type\": 1} }"
    ));
    Query<PersonLongAutoID> query = pm.createQuery(PersonLongAutoID.class);
   
    QueryOption opt = query.option(QueryOptionPage.ID);
   
    assertEquals(opt, optRestored);
  }
View Full Code Here

        String[] columns = ClassInfo.getColumnNames(f, info.tableName);
        for (String col : columns) {
          cols.add(col);
        }
      }
      QueryOption opt = qf.option;
      if(opt != null){
        // only manages QueryOptionJdbcSearch
        if(QueryOptionJdbcSearch.class.isAssignableFrom(opt.getClass())){
          if(((QueryOptionJdbcSearch)opt).booleanMode){
            sql.append("MATCH("+Util.join(cols, ",")+") AGAINST(? IN BOOLEAN MODE)");
          }
          else {
           
View Full Code Here

          for (String col : columns) {
            cols.add("coalesce("+col+", '')");
          }
        }
      }
      QueryOption opt = qf.option;
      if(opt != null){
        // only manages QueryOptionJdbcSearch
        if(QueryOptionPostgresqlSearch.class.isAssignableFrom(opt.getClass())){
          String lang = ((QueryOptionPostgresqlSearch)opt).language;
          if(lang != null && !"".equals(lang) ){
            sql.append("to_tsvector('"+lang+"', "+Util.join(cols, " || ' ' || ")+") @@ to_tsquery(?)");
          }
          else {
View Full Code Here

TOP

Related Classes of siena.core.options.QueryOption

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.