1 16 package com.jdon.model.query.cache; 17 18 import java.io.Serializable ; 19 import java.util.Collection ; 20 import java.util.Iterator ; 21 22 26 public class QueryConditonDatakey implements Serializable { 27 28 private String sqlquery; 29 private Collection queryParams; 30 private int start; 31 private int count = 200; 32 private int blockSize; 33 34 35 39 public QueryConditonDatakey(String sqlquery, Collection queryParams) { 40 super(); 41 this.sqlquery = sqlquery; 42 this.queryParams = queryParams; 43 } 44 45 49 public QueryConditonDatakey(String sqlquery, 50 Collection queryParams, 51 int start, int count, 52 int blockSize) { 53 this.sqlquery = sqlquery; 54 this.queryParams = queryParams; 55 this.start = start; 56 this.count = count; 57 this.blockSize = blockSize; 58 } 59 62 public Collection getQueryParams() { 63 return queryParams; 64 } 65 68 public void setQueryParams(Collection queryParams) { 69 this.queryParams = queryParams; 70 } 71 74 public String getSqlquery() { 75 return sqlquery; 76 } 77 80 public void setSqlquery(String sqlquery) { 81 this.sqlquery = sqlquery; 82 } 83 84 85 86 87 90 public int getStart() { 91 return start; 92 } 93 96 public void setStart(int start) { 97 this.start = start; 98 } 99 100 public String getSQlKey(){ 101 StringBuffer sb = new StringBuffer (sqlquery); 102 Iterator iter = queryParams.iterator(); 103 while (iter.hasNext()) { 104 Object queryParamO = iter.next(); 105 if (queryParamO != null){ 106 sb.append("+"); 107 sb.append(queryParamO.toString()); 108 } 109 } 110 return sb.toString(); 111 } 112 113 114 public String toString(){ 115 return getSQlKey(); 116 } 117 118 public int getBlockStart(){ 119 int blockID = start / count; 120 int blockStart = blockID * count; 121 return blockStart; 122 } 123 124 125 128 public int getBlockSize() { 129 return blockSize; 130 } 131 134 public void setBlockSize(int blockSize) { 135 this.blockSize = blockSize; 136 } 137 140 public int getCount() { 141 return count; 142 } 143 146 public void setCount(int count) { 147 this.count = count; 148 } 149 } 150 | Popular Tags |