Changeset 745 for MDService2/trunk/MDService2/src/eu/clarin/cmdi
- Timestamp:
- 10/04/10 11:31:33 (14 years ago)
- Location:
- MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java
r713 r745 128 128 e.setAttribute("collection", ""); 129 129 } 130 131 130 if (key_array.length > 3){ 132 e.setAttribute("startRecord", key_array[3]); 131 e.setAttribute("squery", key_array[3]); 132 }else{ 133 e.setAttribute("squery", ""); 134 } 135 if (key_array.length > 4){ 136 e.setAttribute("startRecord", key_array[4]); 133 137 }else{ 134 138 e.setAttribute("startRecord", ""); 135 139 } 136 if (key_array.length > 4){137 e.setAttribute("maximumRecords", key_array[ 4]);140 if (key_array.length > 5){ 141 e.setAttribute("maximumRecords", key_array[5]); 138 142 }else{ 139 143 e.setAttribute("maximumRecords", ""); … … 186 190 Query query; 187 191 188 query = new Query(str,"recordset",""); 192 if (str == null) return ""; 193 if (str.trim().length() == 0) return ""; 194 195 query = new Query("", str,"recordset",""); 189 196 if (query.isStatus(Query.PARSEERROR)) { 190 197 Admin.notifyUser("Cache.transformQuery.PARSEERROR:" + query.getMsg()); … … 207 214 208 215 String[] key_array = key_info.split("//-"); 209 String query_str; 210 211 Admin.notifyUser("formPATH:" + key_info); 212 216 String query_str; 213 217 214 218 if(key_array.length > 1){ 215 219 //Admin.notifyUser("formPATH- querystring:" + key_array[1]); 216 220 if (key_array[0].equals("recordset")){ 217 query_str = t ransformQuery(key_array[1]);221 query_str = this.transformQuery(key_array[1]); 218 222 Admin.notifyUser("formPATH- querystring-transformed:" + query_str); 219 223 } … … 233 237 } 234 238 if (key_array.length > 3){ 235 xpath_expr = xpath_expr + "and @startRecord='"+key_array[3]+"'"; 239 xpath_expr = xpath_expr + "and @squery='"+key_array[3]+"'"; 240 }else{ 241 xpath_expr = xpath_expr + " and @squery=''"; 242 } 243 if (key_array.length > 4){ 244 xpath_expr = xpath_expr + "and @startRecord='"+key_array[4]+"'"; 236 245 }else{ 237 246 xpath_expr = xpath_expr + " and @startRecord=''"; 238 247 } 239 if (key_array.length > 4){240 xpath_expr = xpath_expr + "and @maximumRecords='"+key_array[ 4]+"']";248 if (key_array.length > 5){ 249 xpath_expr = xpath_expr + "and @maximumRecords='"+key_array[5]+"']"; 241 250 }else{ 242 251 xpath_expr = xpath_expr + " and @maximumRecords='']"; … … 259 268 path = cachepath + PREFIX + key_array[0] + "_"+id + ".xml"; 260 269 } else if (list.getLength() > 1){ 261 //Admin.notifyUser("formPath:!!!:multiple paths:"+key_info);270 Admin.notifyUser("formPath ERROR:!!!:multiple paths:"+key_info); 262 271 263 272 } -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r713 r745 30 30 private String actionkey; 31 31 private String q; 32 private String squery; 32 33 private String cache = Cache.USE; 33 34 private String collection; … … 49 50 } 50 51 52 public String getSquery() { 53 return squery; 54 } 55 56 public void setSquery(String squery) { 57 this.squery = squery; 58 } 59 51 60 public String getCache() { 52 61 return cache; … … 119 128 } 120 129 130 121 131 public String getFullFormat() { 122 132 return actionkey + "2" + format; -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java
r713 r745 52 52 if (getQ()!=null) { 53 53 key += getQ() + "//-" ; 54 } else { 55 key +="//-" ; 54 56 } 55 57 if (getCollection()!=null) { 56 58 key += getCollection() + "//-"; 59 } else { 60 key +="//-" ; 61 } 62 if (getSquery()!=null) { 63 key += getSquery() + "//-" ; 64 } else { 65 key +="//-" ; 57 66 } 58 67 if (getStartRecord()!=null) { … … 73 82 // URL targetURL =new URL( base_url, compname + ".xml"); 74 83 75 Admin.notifyUser("MDRPA.getQ:" + get Q());84 Admin.notifyUser("MDRPA.getQ:" + getSquery() + " and (" + getQ() + ")"); 76 85 Admin.notifyUser("MDRPA.getActionkey:" + getActionkey()); 77 86 Admin.notifyUser("MDRPA.getMaxdepth:" + getMaxdepth()); 78 87 79 Query query = new Query(get Q(),getActionkey());88 Query query = new Query(getSquery(), getQ(),getActionkey()); 80 89 if (query.isStatus(Query.PARSEERROR)) { 81 90 Admin.notifyUser("MDRPA.query.PARSEERROR:" + query.getMsg()); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDTransformer.java
r706 r745 209 209 } 210 210 // 211 212 211 StreamSource src =new StreamSource(); 213 212 src.setInputStream(in); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/model/Query.java
r706 r745 29 29 public static String COLLECTIONS = "collections"; 30 30 public static String COLUMNS = "columns"; 31 public static String startRecord = null;32 public static String maximumRecords = null;33 31 public static String MODEL = "model"; 34 32 public static String RECORDSET = "recordset"; … … 47 45 private URL targetRequest; 48 46 private String syntax = "cql"; /* cql, cmdIndex, xpath */ 47 private String squery_string; 49 48 private String query_string; 50 49 private CQLNode query_cql; … … 55 54 private String collection="olac"; 56 55 private String columns="Id,name"; 56 private String startRecord = null; 57 private String maximumRecords = null; 58 private String squery = null; 57 59 private int maxdepth=1; 58 60 … … 63 65 64 66 65 public Query(String queryString) {66 this( queryString, MODEL);67 public Query(String squeryString, String queryString) { 68 this(squeryString, queryString, MODEL); 67 69 } 68 70 … … 74 76 */ 75 77 76 public Query(String queryString, String type, String collection, String columns) {78 public Query(String squeryString,String queryString, String type, String collection, String columns) { 77 79 this.type =type; 78 setQueryString( queryString);80 setQueryString(squeryString, queryString); 79 81 setCollection(collection); 80 82 setColumns(columns); … … 88 90 */ 89 91 90 public Query(String queryString, String type, String collection) {92 public Query(String squeryString, String queryString, String type, String collection) { 91 93 this.type =type; 92 setQueryString( queryString);94 setQueryString(squeryString, queryString); 93 95 setCollection(collection); 94 96 } … … 101 103 */ 102 104 103 public Query(String queryString, String type) { 104 105 public Query(String squeryString, String queryString, String type) { 105 106 this.type =type; 106 setQueryString( queryString);107 setQueryString(squeryString, queryString); 107 108 } 108 109 … … 132 133 } 133 134 134 public void setQueryString(String queryString) { 135 query_string = queryString; 136 if (type.equals(RECORDSET)) { 137 138 135 public void setQueryString(String squeryString, String queryString) { 136 if (squeryString.trim().length() == 0){ 137 squeryString = null; 138 } 139 if (queryString.trim().length() == 0){ 140 queryString = null; 141 } 142 String squery = createsqueryString(squeryString); 143 if (squery != null && queryString != null){ 144 query_string = "(" + squery + " ) and (" + queryString + ")"; 145 } else if (squery != null) { 146 query_string = squery; 147 } else { 148 query_string = queryString; 149 } 150 Admin.notifyUser("QUERY.QUERYSTRING:" + query_string); 151 if (type.equals(RECORDSET)) { 139 152 parse(); 140 153 //preprocess(); … … 163 176 } 164 177 178 public String getSQuery() { 179 return this.squery; 180 } 181 182 public void setSQuery(String squery) { 183 if (squery!=null) { 184 this.squery = squery; 185 } 186 } 187 165 188 public String getStartRecord() { 166 189 return startRecord; … … 209 232 } 210 233 234 // apply rules form squery 235 public String createsqueryString (String _squery){ 236 String sq = null; 237 238 if (_squery !=null){ 239 sq = "* any " + _squery; 240 } 241 242 return sq; 243 } 211 244 public String getSimpleQueryString() { 212 245 String[] arr_and = query_string.split(" and "); … … 236 269 simple_form = simple_form + rel + arr_or[j]; 237 270 } 238 Admin.notifyUser(simple_form);271 //Admin.notifyUser(simple_form); 239 272 if (arr_or.length > 1){ 240 273 simple_form = "(" + simple_form + ") ";
Note: See TracChangeset
for help on using the changeset viewer.