Changeset 713


Ignore:
Timestamp:
09/21/10 21:24:48 (14 years ago)
Author:
gaba
Message:

WorkspaceProfile? - arrayName = <item>

Location:
MDService2/trunk/MDService2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js

    r706 r713  
    787787       
    788788        if (jsonw["WorkspaceProfile"].Querysets[0] == undefined){
    789                 var jj = jsonw["WorkspaceProfile"]["Querysets"]["Queryset"];
    790                 delete jsonw["WorkspaceProfile"]["Querysets"]["Queryset"];
     789                var jj = jsonw["WorkspaceProfile"]["Querysets"]["item"];
     790                delete jsonw["WorkspaceProfile"]["Querysets"]["item"];
    791791                jsonw["WorkspaceProfile"]["Querysets"] = [{}];
    792792                jsonw["WorkspaceProfile"]["Querysets"][0] = jj;
     
    796796                $.each(jsonw["WorkspaceProfile"]["Querysets"], function(i,item) {
    797797                    if (this.Queries[0] == undefined){
    798                         var jj = this["Queries"]["Query"];
    799                                 delete this["Queries"]["Query"];
     798                        var jj = this["Queries"]["item"];
     799                                delete this["Queries"]["item"];
    800800                                this.Queries = [{}];
    801801                        this.Queries[0] = jj;
     
    816816                                        if (this.columns != "null") {
    817817                                                if (this.columns[0] == undefined){
    818                                                 var jj = this["columns"]["col"];
    819                                                         delete this["columns"]["col"];
     818                                                var jj = this["columns"]["item"];
     819                                                        delete this["columns"]["item"];
    820820                                                        this.columns = [{}];
    821821                                                this.columns[0] = jj;
     
    885885       
    886886        var tmp = JSON.stringify(jsonw["WorkspaceProfile"]);
    887        
     887        /*
    888888        if (String(jsonw["WorkspaceProfile"]["Querysets"]) != "null") {
    889889                $.each(jsonw["WorkspaceProfile"]["Querysets"], function(i,item) {
     
    906906                                }
    907907                            });
    908                             */
     908                         //  /   
    909909                        }
    910910                });
     
    920920               
    921921        }
    922        
     922        */
    923923        var JSONText = JSON.stringify(jsonw["WorkspaceProfile"]);
    924        
     924        /*
    925925        if (jsonw["WorkspaceProfile"].Querysets[0] == undefined){
    926926                var jj = jsonw["WorkspaceProfile"]["Querysets"]["Queryset"];
     
    940940                });
    941941        }
    942        
     942        */
    943943        //$.post("/MDService2/workspaceprofilesave/1/" + JSONText, "");
    944944        //var JSONText1 = "{WorkspaceProfile:{Querysets:{[{Query:}]}}}";
    945         $.post("/MDService2/workspaceprofilesave/1/", JSONText);
     945        $.post("/MDService2/workspaceprofilesave/1/" + JSONText, "");
    946946}
    947947
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java

    r704 r713  
    129129                }
    130130
     131                if (key_array.length > 3){
     132                        e.setAttribute("startRecord", key_array[3]);
     133                }else{
     134                        e.setAttribute("startRecord", "");
     135                }
     136                if (key_array.length > 4){
     137                        e.setAttribute("maximumRecords", key_array[4]);
     138                }else{
     139                        e.setAttribute("maximumRecords", "");
     140                }
    131141                DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd:hh-mm-ss");
    132142                e.setAttribute("date", dateFormat.format(new Date()).toString());
     
    218228               
    219229                if (key_array.length > 2){
    220                         xpath_expr = xpath_expr + "and @collection='"+key_array[2]+"']";
    221                 }else{
    222                         xpath_expr = xpath_expr + " and @collection='']";
     230                        xpath_expr = xpath_expr + "and @collection='"+key_array[2]+"'";
     231                }else{
     232                        xpath_expr = xpath_expr + " and @collection=''";
     233                }
     234                if (key_array.length > 3){
     235                        xpath_expr = xpath_expr + "and @startRecord='"+key_array[3]+"'";
     236                }else{
     237                        xpath_expr = xpath_expr + " and @startRecord=''";
     238                }
     239                if (key_array.length > 4){
     240                        xpath_expr = xpath_expr + "and @maximumRecords='"+key_array[4]+"']";
     241                }else{
     242                        xpath_expr = xpath_expr + " and @maximumRecords='']";
    223243                }
    224244               
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java

    r706 r713  
    3030        private String actionkey;
    3131        private String q;
    32         private String cache = Cache.SKIP;
     32        private String cache = Cache.USE;
    3333        private String collection;
    3434        private String columns;
     
    227227                                        sourceStream = Cache.getCache().getFromCache(getRequestKey());
    228228                        }
    229 
    230229                        if (sourceStream == null) { // either not in cache or cache_flag=refresh
    231230                                //sourceStream = getTargetRequest().openStream();
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java

    r706 r713  
    4343                 urls.put("record", "?operation=searchRetrieve&query=");
    4444         }
    45                
     45       
     46         @Override
     47         public String getRequestKey() {
     48                        String key="";
     49                        if (getActionkey()!=null) {
     50                                key += getActionkey() + "//-" ;
     51                        }
     52                        if (getQ()!=null) {
     53                                key += getQ() + "//-" ;
     54                        }
     55                        if (getCollection()!=null) {
     56                                key += getCollection() + "//-";
     57                        }
     58                        if (getStartRecord()!=null) {
     59                                key += getStartRecord() + "//-";
     60                        }
     61                        if (getMaximumRecords()!=null) {
     62                                key += getMaximumRecords();
     63                        }
     64                         
     65                        return key;
     66        }
    4667        /**
    4768         * uses base_url + url_pattern (parametrized by actionkey) to form a url
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/WorkspaceAction.java

    r706 r713  
    77import java.io.IOException;
    88import java.io.InputStream;
     9import java.net.MalformedURLException;
     10import java.net.URL;
     11
    912import java.io.StringReader;
    1013import java.io.StringWriter;
    11 import java.net.MalformedURLException;
    12 import java.net.URL;
    13 
    14 import javax.servlet.http.HttpServletRequest;
    1514import javax.xml.parsers.DocumentBuilder;
    1615import javax.xml.parsers.DocumentBuilderFactory;
     
    2524import javax.xml.transform.stream.StreamResult;
    2625
     26
    2727import net.sf.json.JSON;
    2828import net.sf.json.JSONSerializer;
    2929import net.sf.json.xml.XMLSerializer;
    3030
    31 import org.apache.commons.io.IOUtils;
    32 import org.apache.struts2.interceptor.ServletRequestAware;
    3331import org.w3c.dom.Document;
    3432import org.w3c.dom.Node;
     
    3836
    3937import com.opensymphony.xwork2.ActionSupport;
     38
    4039
    4140/**
     
    208207                node.getParentNode().replaceChild(node2, node);
    209208        }
    210        
     209
     210        /*
    211211        public String save(){
    212212               
     
    302302                return SUCCESS;
    303303        }
     304       
     305*/
     306        public String save(){
     307               
     308        String jsonData = getData();
     309        Admin.notifyUser("JSON data:"+jsonData);
     310       
     311        XMLSerializer serializer = new XMLSerializer();
     312                JSON json = JSONSerializer.toJSON( jsonData );
     313                serializer.setRootName("WorkspaceProfile");
     314                serializer.setElementName("item");
     315        serializer.setTypeHintsEnabled(false);
     316        String xml = serializer.write( json );
     317        Admin.notifyUser("XML:" + xml);
     318       
     319        InputStream is_xml = new ByteArrayInputStream( xml.getBytes( ) );
     320        Admin.writeToFile(getPath(), is_xml);
     321   
     322        String ret = "1";
     323                resultStream = new ByteArrayInputStream(ret.getBytes());
     324                               
     325
     326                return SUCCESS;
     327        }
     328
    304329        /**
    305330         * default Action method
  • MDService2/trunk/MDService2/src/mdservice.properties

    r689 r713  
    1 mdrepository.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats/
    2 dcregistry.uri = http://www.isocat.org/rest/
     1//mdrepository.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats/
     2mdrepository.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/
     3//dcregistry.uri = http://www.isocat.org/rest/
     4dcregistry.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/
    35//compregistry.uri = file:/c:/Users/master/3lingua/clarin/CMDI/_repo2/metadata/toolkit/components/clarin/
    4 compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/
     6//compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/
     7compregistry.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/
    58//collections.uri = file:/c:/Users/master/3lingua/clarin/CMDI/data_zx_metares/fsls.xml
    6 collections.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats?operation=getCollections&collection=
     9//collections.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats?operation=getCollections&collection=
     10collections.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql?operation=getCollections&collection=
    711//scripts.path = C:/Users/master/3lingua/clarin/CMDI/scripts/
    812scripts.path = xsl/
    913//cache.path = /srv/tomcat6/webapps/MDService2_cache/
    10 cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/
    11 //cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
    12 //workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
    13 workspaceprofile.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/
     14//cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/
     15cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
     16workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/
     17//workspaceprofile.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/
    1418cacheindex.file = cache_index.xml
    1519xml.comp =
Note: See TracChangeset for help on using the changeset viewer.