Changeset 1569 for MDService2
- Timestamp:
- 09/30/11 11:01:52 (13 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js
r1561 r1569 206 206 @class Represents a Query. 207 207 */ 208 function Query(collection, columns, query ) {208 function Query(collection, columns, query, squery) { 209 209 this.id = 0; 210 210 this.collection = collection; // [] 211 211 this.columns = columns; // string 212 212 this.query = query; //sctext 213 //this.squery = squery;213 this.squery = squery; 214 214 this.listid = ""; 215 215 this.container = {}; … … 313 313 this.query = json["querystring"]; 314 314 } 315 /* 315 316 316 if (json["squerystring"] == "[NULL]"){ 317 317 this.squery = null; … … 319 319 this.squery = json["squerystring"]; 320 320 } 321 */ 321 322 322 this.columns = columns_text; 323 323 … … 443 443 Query.prototype.query_uri = function () { 444 444 var params = "?"; 445 //if (this.query != null) {446 // params = params + "q=" + escape(this.query) + "&";447 //}448 445 if (this.query != null) { 449 escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; 446 params = params + "query=" + escape(this.query) + "&"; 447 } 448 if (this.squery != null) { 449 escaped_sq =escape(this.squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; 450 450 escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B"); 451 451 //params = params + "squery=" + escaped_sq + "&"; … … 487 487 var str = ""; 488 488 var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : ""; 489 str = Query. simplequerystring(this.query) + coll + " @" + this.repository.toString();489 str = Query.queryliststring(this.squery,this.query) + coll + " @" + this.repository.toString(); 490 490 return str; 491 491 }; … … 552 552 json_cols[i] = cols; 553 553 } 554 554 /* 555 var q = ""; 556 if (this.squery != undefined){ 557 q = q + squery; 558 } 559 if (this.query != undefined){ 560 q = q + query; 561 } 562 */ 555 563 var jsonq = {"id":this.id, 556 564 "name":"", 557 //"squerystring":this.squery,558 "querystring": this.query,565 "squerystring":this.squery, 566 "querystring":query, 559 567 "searchclauses":"null" , 560 568 "collections" : json_coll, … … 647 655 Query.fullformatstring = function (json) { 648 656 var qs = json.querystring; 649 //var sqs = json.squerystring;657 var sqs = json.squerystring; 650 658 651 659 if (qs == "[NULL]") { 652 660 qs = null; 653 661 } 654 /*662 655 663 if (sqs == "[NULL]") { 656 664 sqs = null; 657 665 } 658 */666 659 667 var collection_text = Query.collectiontext(json); 660 668 661 669 var full_str = ""; 662 670 var len = formatquerystring_len; 663 /*671 664 672 if (sqs != null) { 665 673 if (sqs.length > len){ … … 670 678 } 671 679 } 672 */680 673 681 if (qs != null) { 674 682 qs = Query.simplequerystring(qs); … … 688 696 return full_str; 689 697 }; 690 /* 698 691 699 Query.queryliststring = function(squery, query) { 692 700 var s_squery = ""; … … 709 717 return str; 710 718 }; 711 */ 719 712 720 Query.simplequerystring = function (querystring) { 713 721 -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
r1561 r1569 569 569 }, 570 570 571 // from searchclauses to querystring571 // from searchclauses to simple querystring only * any <string> is converted 572 572 simplequerytext: function(){ 573 573 this.buildsctext(); 574 return sctext.replace('* any ',''); 575 }, 574 if (sctext.substring(0,6) == '* any '){ 575 return sctext.replace('* any ',''); 576 } 577 return ""; 578 }, 579 576 580 buildsctext: function(){ 577 581 var uncompletequery = false; -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js
r1561 r1569 20 20 var DEBUG = false; 21 21 22 // check for jQuery and Sarissa22 // check for jQuery 23 23 try{ 24 24 jQuery; … … 28 28 29 29 /////// INIT VARIABLE SETTINGS 30 // get url parameters31 30 url_params = getUrlVars(); 32 31 workspace = new Workspace(); 33 // create searchclauses 34 //searchclauseset.addsearchclause(new SearchClause("","",""),"",0,0); 35 // load query if exists params 36 //loadQueryFromUriParams(); 32 37 33 // create widgets 38 39 34 columns_widget = new ListWidget($('#columns-widget'), "columns"); 40 35 collections_widget = new ListWidget($('#collections-widget'), "collections"); 41 36 listwidgetset.add(columns_widget); 42 37 listwidgetset.add(collections_widget); 43 createInfos();44 38 45 39 //////////// LOAD DATA 46 40 loadData(); 47 //handleBubble();48 49 41 addFunctionality(); 50 //addVisuals();51 52 //queryuriparams loaded after collections and workspaceprofile are loaded53 //loadQueryFromUriParams();54 42 55 43 ////////////// CREATE UI-LAYOUT 56 44 createBlock('base',''); 57 //jQuery.each(blocks_settings,function(index,block){58 // jQuery.each(block.sublayouts,function(index,name){59 // createLayouts(name);60 // });61 //});62 45 createLayouts('base'); 63 46 47 // ??autocomplete correction 64 48 initDetailFloat(); 65 // autocomplete correction66 49 searchclauseset.addsearchclause(new SearchClause("","",""),"",0,0); 67 //createInfos(); 68 50 createInfos(); 69 51 detailcaller.calldetail(undefined, "info"); 70 52 … … 87 69 88 70 function getSelectedRepository(){ 89 //var id = parseInt($('#repositories_select').find("option:selected").val()); 90 return $('#repositories_select').find("option:selected").text();//val(); 91 71 return $('#repositories_select').find("option:selected").text(); 92 72 } 73 93 74 function getInputMode(){ 94 75 if ($('#searchclauselist').is(":visible")){ … … 97 78 return 'simple'; 98 79 } 80 99 81 /** 100 82 * This function is called during the initialization sequence and binds event-handlers to events of ui-elements. … … 102 84 */ 103 85 function addFunctionality(){ 104 //TODO query-input action not valid (solve in html_snippets.xsl ?)105 //$('#query-input').children("form").attr("id","searchretrieve");106 86 107 87 //switch the input simple query vs complex query 108 //$('#searchclauselist').hide();109 88 $('#switch-input').live('click',function(){ 110 89 $('#searchclauselist').toggle(); … … 274 253 event.preventDefault(); 275 254 //hideWelcomeMessage(); 276 var query ;255 var query, squery; 277 256 if (getInputMode() == 'complex'){ 278 257 searchclauseset.buildsctext(); 279 258 query = searchclauseset.sctext; 280 259 } else { 281 query = $('#input-simplequery').attr("value");260 squery = $('#input-simplequery').attr("value"); 282 261 } 283 262 //searchclauseset.buildsctext(); … … 296 275 query = null; 297 276 } 298 var q = new Query(collections, columns, query ); //actions.collections.current, query );277 var q = new Query(collections, columns, query, squery); //actions.collections.current, query ); 299 278 q.repository = getSelectedRepository(); 300 279 //if (ws) { -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java
r1559 r1569 14 14 import com.opensymphony.xwork2.ActionSupport; 15 15 16 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 16 17 import eu.clarin.cmdi.mdservice.internal.Cache; 17 18 import eu.clarin.cmdi.mdservice.internal.MDTransformer; … … 208 209 */ 209 210 public String getActionContentType() { 210 if (this.getFormat().toLowerCase().startsWith("html")) { 211 if (this.getFormat().toLowerCase().startsWith("html")) { // && !getDiagnostics().Exists()) { 211 212 this.actionContentType = "text/html"; 212 213 //this.actionContentType = "application/xhtml+xml"; … … 263 264 * @throws IOException 264 265 * @throws NoStylesheetException 265 */ 266 public InputStream getSourceStream() throws IOException, NoStylesheetException { 266 * @throws CQLParseException 267 */ 268 public InputStream getSourceStream() throws IOException, NoStylesheetException, CQLParseException { 267 269 return getTargetProxy().getSourceStream(); 268 270 } -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/BasicProxy.java
r1541 r1569 8 8 import org.apache.log4j.Logger; 9 9 import eu.clarin.cmdi.mdservice.action.GenericAction; 10 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 10 11 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 11 12 import eu.clarin.cmdi.mdservice.internal.Utils; … … 91 92 * uses base_url + url_pattern (parametrized by actionkey) to form a url 92 93 * @return the full target-request URL to be sent to the target repository 94 * @throws CQLParseException 93 95 * @throws Exception 94 96 */ 95 public URL getTargetRequest() throws IOException {97 public URL getTargetRequest() throws IOException, CQLParseException { 96 98 97 99 URL targetURL =new URL(getBaseURI() + this.getSourceAction().getTargetRequestParams()); … … 102 104 } 103 105 104 public InputStream getSourceStream() throws IOException, NoStylesheetException {106 public InputStream getSourceStream() throws IOException, NoStylesheetException, CQLParseException { 105 107 URLConnection urlConnection = getTargetRequest().openConnection(); 106 108 getSourceAction().setRequestProperties(urlConnection); -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/MDRepoProxy.java
r1554 r1569 5 5 import java.util.HashMap; 6 6 import org.apache.log4j.Logger; 7 8 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 9 import eu.clarin.cmdi.mdservice.model.Diagnostic; 7 10 import eu.clarin.cmdi.mdservice.model.Query; 8 11 import eu.clarin.cmdi.mdservice.model.WorkspaceProfile; … … 54 57 * uses base_url + url_pattern (parametrized by actionkey) to form a url 55 58 * @return the full target-request URL to be sent to the target repository 59 * @throws CQLParseException 56 60 * @throws Exception 57 61 */ 58 62 @Override 59 public URL getTargetRequest() throws IOException {63 public URL getTargetRequest() throws IOException, CQLParseException { 60 64 61 65 //TODO squery removed … … 70 74 if (query.isStatus(Query.PARSEERROR)) { 71 75 log.debug("MDRP.query.PARSEERROR:" + query.getMsg()); 76 throw new CQLParseException("MDRP.query.PARSEERROR:" + query.getMsg()); 77 //getSourceAction().getDiagnostics().Add(Diagnostic.SYSTEM_ERROR, "MDRP.query.PARSEERROR:" + query.getMsg()); 72 78 //TODO exception ?? 73 return null;79 //return null; 74 80 } else { 75 81 query.setMaxdepth(Integer.valueOf(getParam("maxdepth"))); -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/ProxyInterface.java
r1536 r1569 7 7 8 8 import eu.clarin.cmdi.mdservice.action.GenericAction; 9 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 9 10 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 10 11 11 12 public interface ProxyInterface { 12 13 13 public URL getTargetRequest() throws IOException ;14 public InputStream getSourceStream() throws IOException, NoStylesheetException ;14 public URL getTargetRequest() throws IOException, CQLParseException; 15 public InputStream getSourceStream() throws IOException, NoStylesheetException, CQLParseException; 15 16 public void setSourceAction(GenericAction action) ; 16 17 /** -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/Pz2Proxy.java
r1511 r1569 34 34 import org.xml.sax.SAXException; 35 35 36 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 36 37 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 37 38 import eu.clarin.cmdi.mdservice.model.Query; … … 136 137 * The distinction is based on the command parameter: if it is given, the Class(Service) acts as a basic proxy 137 138 * transparently passing the communication between client and target repository. 139 * @throws CQLParseException 138 140 */ 139 141 @Override 140 public InputStream getSourceStream() throws IOException, NoStylesheetException {142 public InputStream getSourceStream() throws IOException, NoStylesheetException, CQLParseException { 141 143 if (getCommand() == null){ 142 144 try { -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/RepoProxy.java
r1522 r1569 30 30 import eu.clarin.cmdi.mdservice.action.GenericAction; 31 31 import eu.clarin.cmdi.mdservice.action.RepoAction; 32 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 32 33 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 33 34 import eu.clarin.cmdi.mdservice.model.Diagnostic; … … 128 129 129 130 130 public InputStream getSourceStream() throws IOException, NoStylesheetException {131 public InputStream getSourceStream() throws IOException, NoStylesheetException, CQLParseException { 131 132 return getTargetRequest().openStream(); 132 133 } … … 155 156 * uses base_url + url_pattern (parametrized by actionkey) to form a url 156 157 * @return the full target-request URL to be sent to the target repository 158 * @throws CQLParseException 157 159 * @throws Exception 158 160 */ 159 public URL getTargetRequest() throws IOException {161 public URL getTargetRequest() throws IOException, CQLParseException { 160 162 161 163
Note: See TracChangeset
for help on using the changeset viewer.