Ignore:
Timestamp:
06/01/11 21:59:12 (13 years ago)
Author:
gaba
Message:

save, savenew
publish existing query
workspace functionality corrections

Location:
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/VirtualCollectionProxyAction.java

    r1310 r1388  
    3636        //private String proxy_key = "virtual_collection";
    3737       
    38         private String qid;
     38        //private String qid;
    3939        //private String date;
    4040        //private String datefrom;
    4141        //private String dateto;
    42        
     42        /*
    4343        public String getQid(){
    4444                return qid;
     
    4747                this.qid = qid;
    4848        }
    49        
     49        */
    5050        @Override
    5151        protected void  initialize(){
     
    105105       
    106106                //create connection and post request data
    107                
    108         URL url = new URL("http://clarin.ids-mannheim.de/vcr/service/virtualcollection");
     107                // find out
     108                String urlstring = "http://clarin.ids-mannheim.de/vcr/service/virtualcollection";
     109                String vcrstr = (String)getQueryVcrid();
     110                if (!vcrstr.equals("0")){
     111                        urlstring = urlstring + "/" + vcrstr;
     112                }
     113                //qlist.item(0).get
     114        URL url = new URL(urlstring);
    109115        String charset = "UTF-8";
    110116        URLConnection urlconn = url.openConnection();
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/WorkspaceAction.java

    r1384 r1388  
    552552                   // apend to specific queryset
    553553                                NodeList wsnodelist = (NodeList) getQueryParent();
    554                         wsnodelist.item(0).appendChild(node2);
     554                                Node anode = wsnodelist.item(0);
     555                                if (anode.getTextContent().trim().toLowerCase().equals("null")){
     556                                        anode.setTextContent("");
     557                                }
     558                        anode.appendChild(node2);
    555559                        }
    556560                       
     
    585589                                           // apend to specific bookmarkset
    586590                                                        NodeList wsnodelist = (NodeList) getBookmarkParent();
    587                                                 wsnodelist.item(0).appendChild(node2);
     591                                                        Node anode = wsnodelist.item(0);
     592                                                        if (anode.getTextContent().trim().toLowerCase().equals("null")){
     593                                                                anode.setTextContent("");
     594                                                        }
     595                                                anode.appendChild(node2);
    588596                                                }
    589597                                               
     
    620628                                                NodeList wsnodelist = (NodeList) this.getWorkspace();
    621629                                                Element welem = (Element)wsnodelist.item(0);
    622                                                         welem.getElementsByTagName("Querysets").item(0).appendChild(node2);
     630                                                        Node anode = welem.getElementsByTagName("Querysets").item(0);
     631                                                        if (anode.getTextContent().trim().toLowerCase().equals("null")){
     632                                                                anode.setTextContent("");
     633                                                        }
     634                                                        anode.appendChild(node2);
    623635                                                }
    624636                                               
     
    655667                                                NodeList wsnodelist = (NodeList) this.getWorkspace();
    656668                                                Element welem = (Element)wsnodelist.item(0);
    657                                                         welem.getElementsByTagName("Bookmarksets").item(0).appendChild(node2);
     669                                                Node anode = welem.getElementsByTagName("Bookmarksets").item(0);
     670                                               if (anode.getTextContent().trim().toLowerCase().equals("null")){
     671                                                                anode.setTextContent("");
     672                                                        }
     673                                                anode.appendChild(node2);
    658674                                                }
    659675                                               
     
    873889            XPathExpression expr;
    874890                        expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" + this.qid + "']");
     891                        //expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" +this.qid.toString()+"']");
    875892                                //expr = xpath.compile("//item[@id='" + this.qid + "']");
    876893                        //expression is evaluated with respect to a certain context node which is doc.
     
    901918             return result;
    902919        }
     920
     921public Object getQueryVcrid() throws XPathExpressionException{
     922       
     923        XPathFactory factory = XPathFactory.newInstance();
     924    XPath xpath = factory.newXPath();
     925    XPathExpression expr;
     926//              expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item[id='" + this.qsid + "']/vcrid");
     927                expr = xpath.compile("//Profiles/WorkspaceProfiles/WorkspaceProfile/Querysets/item/Queries/item[id='" + this.qid + "']/vcrid");
     928           
     929                //expression is evaluated with respect to a certain context node which is doc.
     930                Object result = null;
     931                try{
     932                result = expr.evaluate(workspace_doc, XPathConstants.STRING);
     933                } catch(Exception e){
     934                       
     935                }
     936
     937     return result;
     938}
    903939        public Object getQueryset() throws XPathExpressionException{
    904940               
Note: See TracChangeset for help on using the changeset viewer.