Package siena

Examples of siena.ClassInfo


 
  protected <T> List<T> doSearch(Query<T> query, int limit, int offset){
    // TODO this is a very raw impl: need some work certainly
    try {
      Connection conn = this.getConnection();
      ClassInfo ci = ClassInfo.getClassInfo(query.getQueriedClass());
      // doesn't index a table that has already been indexed
      if(!tableIndexMap.containsKey(ci.tableName)){
        List<String> colList = ci.getUpdateFieldsColumnNames();
        String cols = null;
        if(!colList.isEmpty()){
          cols = "";
          // removes auto generated IDs from index
          int sz = colList.size();
          for (int i=0; i<sz; i++) {
            if("h2".equals(dbMode)) cols+=colList.get(i).toUpperCase();
            // !!! mysql mode means case INsensitive to lowercase !!!!
            else if("mysql".equals(dbMode)) cols+=colList.get(i).toLowerCase();
            else cols+=colList.get(i).toUpperCase();
           
            if(i<sz-1) cols += ",";
          }
        }
        // creates the index
        FullText.createIndex(conn, "PUBLIC", ci.tableName.toUpperCase(), cols);
        tableIndexMap.put(ci.tableName, true);
      }
     
      String searchString = "";
      Iterator<QueryFilterSearch> it = query.getSearches().iterator();
      boolean first = true;
      while(it.hasNext()){
        if(!first){
          searchString += " ";
        }else {
          first = false;
        }
        searchString += it.next().match;       
      }
     
      ResultSet rs = FullText.searchData(conn, searchString, limit, offset);
      List<T> res = new ArrayList<T>();
      Field idField = ci.getIdField();
      Class<?> idClass = idField.getType();
      while(rs.next()) {
        //String queryStr = rs.getString("QUERY");
        //String score = rs.getString("SCORE");
        //Array columns = rs.getArray("COLUMNS");
View Full Code Here


 
  protected <T> List<T> doSearchKeys(Query<T> query, int limit, int offset){
    // TODO this is a very raw impl: need some work certainly
    try {
      Connection conn = this.getConnection();
      ClassInfo ci = ClassInfo.getClassInfo(query.getQueriedClass());
      // doesn't index a table that has already been indexed
      if(!tableIndexMap.containsKey(ci.tableName)){
        List<String> colList = ci.getUpdateFieldsColumnNames();
        String cols = null;
        if(!colList.isEmpty()){
          cols = "";
          // removes auto generated IDs from index
          int sz = colList.size();
View Full Code Here

 
  protected <T> int doSearchCount(Query<T> query){
    // TODO this is a very raw impl: need some work certainly
    try {
      Connection conn = this.getConnection();
      ClassInfo ci = ClassInfo.getClassInfo(query.getQueriedClass());
      // doesn't index a table that has already been indexed
      if(!tableIndexMap.containsKey(ci.tableName)){
        List<String> colList = ci.getUpdateFieldsColumnNames();
        String cols = null;
        if(!colList.isEmpty()){
          cols = "";
          // removes auto generated IDs from index
          int sz = colList.size();
View Full Code Here

            cols.add(col);
          }
        }
        // if is model, gets the key type and does the same as herebefore
        else if(ClassInfo.isModel(cl)) {
          ClassInfo ci = ClassInfo.getClassInfo(cl);
          if(ci.keys.size()==1){
            Field key = ci.keys.get(0);
            if(Number.class.isAssignableFrom(key.getType())
                ||
              Date.class.isAssignableFrom(key.getType())){
View Full Code Here

      joinFields = new ArrayList<Field>();
      for(QueryJoin join:query.getJoins())
        joinFields.add(join.field);
    }
    // then adds the remaining joins coming from @Join if not added yet
    ClassInfo ci = ClassInfo.getClassInfo(query.getQueriedClass());
    if(ci.joinFields.size() > 0){
      if(joinFields == null) joinFields = new ArrayList<Field>();
      for(Field f: ci.joinFields){
        if(!joinFields.contains(f)) joinFields.add(f);
      }
View Full Code Here

TOP

Related Classes of siena.ClassInfo

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.