Changeset 3512 for trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Timestamp:
- 2002-11-01T09:33:34+13:00 (22 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/AppletAction.java
r3491 r3512 25 25 } 26 26 27 Element request = (Element)message.getElementsByTagName( "request").item(0);27 Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0); 28 28 29 29 // subaction is display/request 30 String request_type = request.getAttribute( "subaction"); // should be 'd' or 'r'30 String request_type = request.getAttribute(GSXML.SUBACTION_ATT); // should be 'd' or 'r' 31 31 if (!request_type.equals("d")&&!request_type.equals("r")) { 32 32 return GSHTML.errorPage("the sa arg to a=a should be d or r!!"); … … 34 34 35 35 // get the collection and service param 36 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, "paramList");36 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 37 37 cgi_.toLong(cgi_paramList); 38 38 HashMap params = GSXML.extractParams(cgi_paramList); … … 58 58 //build up the mr request 59 59 60 Element mr_message = doc_.createElement( "message");61 Element mr_request = doc_.createElement( "request");60 Element mr_message = doc_.createElement(GSXML.MESSAGE_ELEM); 61 Element mr_request = doc_.createElement(GSXML.REQUEST_ELEM); 62 62 mr_message.appendChild(mr_request); 63 mr_request.setAttribute( "type", "describe");64 mr_request.setAttribute( "to", to);65 //mr_request.setAttribute( "info", "appletInfo");63 mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 64 mr_request.setAttribute(GSXML.TO_ATT, to); 65 //mr_request.setAttribute(GSXML."info", "appletInfo"); 66 66 67 67 Element mr_response = (Element)mr_.process(mr_message); … … 70 70 System.out.println(converter_.getString(mr_response)); 71 71 // create the return page tree 72 Element page = doc_.createElement( "page");73 page.setAttribute( "lang", message.getAttribute("lang"));72 Element page = doc_.createElement(GSXML.PAGE_ELEM); 73 page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT)); 74 74 // add the lang stuff from message 75 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "translate"), true));75 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true)); 76 76 // add the config stuff from message 77 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "config"), true));77 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 78 78 79 79 page.appendChild(doc_.importNode(request, true)); 80 80 81 81 // add in the applet info 82 Element app_desc = (Element)doc_.importNode(GSXML.getNodeByPath(mr_response, "response/service/applet"), true); 82 String path = GSXML.RESPONSE_ELEM; 83 path = GSPath.appendLink(path, GSXML.SERVICE_ELEM); 84 path = GSPath.appendLink(path, GSXML.APPLET_ELEM); 85 Element app_desc = (Element)doc_.importNode(GSXML.getNodeByPath(mr_response, path), true); 83 86 // must handle any params that have values that are not 84 87 // necessarily known by the service … … 95 98 // we are processing stuff for the applet send a message to the service, type="query", and take out the something element, and return that as our result - the applet must take xml 96 99 97 Element mr_message = doc_.createElement( "message");98 Element mr_request = doc_.createElement( "request");100 Element mr_message = doc_.createElement(GSXML.MESSAGE_ELEM); 101 Element mr_request = doc_.createElement(GSXML.REQUEST_ELEM); 99 102 mr_message.appendChild(mr_request); 100 mr_request.setAttribute( "type", "query");101 mr_request.setAttribute( "to", to);103 mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 104 mr_request.setAttribute(GSXML.TO_ATT, to); 102 105 103 106 // just append the params for now … … 108 111 // dont need to create a page, just extract the info out. 109 112 System.out.println(converter_.getString(mr_response)); 110 Element applet_info = (Element)GSXML.getNodeByPath(mr_response, "response/appletData").getFirstChild(); 113 // add in the applet data 114 String path = GSXML.RESPONSE_ELEM; 115 path = GSPath.appendLink(path, GSXML.APPLET_DATA_ELEM); 116 Element applet_info = (Element)GSXML.getNodeByPath(mr_response, path).getFirstChild(); 111 117 System.out.println("applet action: applet data ="); 112 118 System.out.println(converter_.getString(applet_info)); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r3491 r3512 16 16 17 17 // create the return page tree 18 Element page = doc_.createElement( "page");19 page.setAttribute( "lang", message.getAttribute("lang"));18 Element page = doc_.createElement(GSXML.PAGE_ELEM); 19 page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT)); 20 20 // add the lang stuff from message 21 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "translate"), true));21 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true)); 22 22 // add the system stuff from message 23 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "config"), true));23 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 24 24 25 Element request = (Element)message.getElementsByTagName( "request").item(0);25 Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0); 26 26 27 27 // the browse type is the subaction 28 String browse_type = request.getAttribute( "subaction");28 String browse_type = request.getAttribute(GSXML.SUBACTION_ATT); 29 29 30 30 if (browse_type.equals("classifier")) { … … 48 48 // extract the params from the cgi-request, and check that we have a coll specified 49 49 // first convert short to long names 50 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, "paramList");50 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 51 51 cgi_.toLong(cgi_paramList); 52 52 HashMap params = GSXML.extractParams(cgi_paramList); … … 63 63 // get the service info from the MR - this will probably need to be cached somehow later on. and add as a description node to the cgi-request - this doesn't work. change to add the specified value as a current attribute to the param - need to do somthing different for query 64 64 65 Element mr_info_message = doc_.createElement( "message");66 Element mr_info_request = doc_.createElement( "request");65 Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM); 66 Element mr_info_request = doc_.createElement(GSXML.REQUEST_ELEM); 67 67 mr_info_message.appendChild(mr_info_request); 68 mr_info_request.setAttribute( "type", "describe");68 mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 69 69 70 70 String to = collection; 71 71 to = GSPath.appendLink(to, "ClassifierBrowse"); 72 mr_info_request.setAttribute( "to", to);72 mr_info_request.setAttribute(GSXML.TO_ATT, to); 73 73 74 74 Element mr_info_response = (Element) mr_.process(mr_info_message); 75 Element description = doc_.createElement("description"); 76 Node cl = GSXML.getNodeByPath(mr_info_response, "response/service/classifierList"); 75 Element description = doc_.createElement(GSXML.DESCRIPTION_ELEM); 76 77 String path = GSXML.RESPONSE_ELEM; 78 path = GSPath.appendLink(path, GSXML.SERVICE_ELEM); 79 path = GSPath.appendLink(path, GSXML.CLASSIFIER_ELEM+GSXML.LIST_MODIFIER); 80 Node cl = GSXML.getNodeByPath(mr_info_response, path); 77 81 78 82 Element imported_classList = (Element)doc_.importNode(cl, true); … … 93 97 94 98 // get the info for the selected node 95 Element mr_query_message = doc_.createElement( "message");96 Element mr_query_request = doc_.createElement( "request");99 Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM); 100 Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM); 97 101 mr_query_message.appendChild(mr_query_request); 98 102 99 mr_query_request.setAttribute( "type", "query");100 mr_query_request.setAttribute( "to", to);103 mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 104 mr_query_request.setAttribute(GSXML.TO_ATT, to); 101 105 102 106 // paramList - empty for now 103 Element paramList = doc_.createElement( "paramList");107 Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 104 108 mr_query_request.appendChild(paramList); 105 109 … … 107 111 // content - contains the classifier node, may be more than one 108 112 // call this resource list for now 109 Element query_content = doc_.createElement( "content");113 Element query_content = doc_.createElement(GSXML.CONTENT_ELEM); 110 114 mr_query_request.appendChild(query_content); 111 115 112 Element resource_list = doc_.createElement( "resourceList");113 Element resource = doc_.createElement( "resource");114 resource.setAttribute( "name", node);116 Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER); 117 Element resource = doc_.createElement(GSXML.RESOURCE_ELEM); 118 resource.setAttribute(GSXML.NAME_ATT, node); 115 119 resource_list.appendChild(resource); 116 120 query_content.appendChild(resource_list); … … 118 122 Element mr_query_response = (Element)mr_.process(mr_query_message); 119 123 120 Element response = (Element)GSXML.getChildByTagName(mr_query_response, "response");124 Element response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); 121 125 Node new_style = GSXML.getChildByTagName(response, "stylesheet"); 122 126 if (new_style !=null) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/PageAction.java
r3491 r3512 16 16 public String process (Element message) { 17 17 18 Element request = (Element)message.getElementsByTagName( "request").item(0);18 Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0); 19 19 // the page name is the subaction 20 String page_name = request.getAttribute( "subaction");20 String page_name = request.getAttribute(GSXML.SUBACTION_ATT); 21 21 22 22 // create the return page tree 23 Element page = doc_.createElement( "page");24 page.setAttribute( "lang", message.getAttribute("lang"));23 Element page = doc_.createElement(GSXML.PAGE_ELEM); 24 page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT)); 25 25 // add the lang stuff from xml_in 26 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "translate"), true));26 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true)); 27 27 // add the system stuff from xml_in 28 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "config"), true));28 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 29 29 30 30 if (page_name.equals("")) { … … 46 46 // first, get the list of collections from mr 47 47 48 Element coll_list_message = doc_.createElement( "message");49 coll_list_message.setAttribute( "lang", page.getAttribute("lang"));50 Element coll_list_request = doc_.createElement( "request");48 Element coll_list_message = doc_.createElement(GSXML.MESSAGE_ELEM); 49 coll_list_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT)); 50 Element coll_list_request = doc_.createElement(GSXML.REQUEST_ELEM); 51 51 coll_list_message.appendChild(coll_list_request); 52 coll_list_request.setAttribute( "type", "describe");52 coll_list_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 53 53 //coll_list_request.setAttribute("info", "collectionList"); 54 54 … … 59 59 60 60 // second, get the metadata for each collection 61 NodeList colls = coll_list_response.getElementsByTagName( "collection");61 NodeList colls = coll_list_response.getElementsByTagName(GSXML.COLLECTION_ELEM); 62 62 63 Element metadata_message = doc_.createElement("message");64 metadata_message.setAttribute("lang", page.getAttribute("lang"));65 Element metadata_request = doc_.createElement("request");66 metadata_message.appendChild(metadata_request);67 metadata_request.setAttribute("type", "describe");63 //Element metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM); 64 //metadata_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT)); 65 //Element metadata_request = doc_.createElement(GSXML.REQUEST_ELEM); 66 //metadata_message.appendChild(metadata_request); 67 //metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 68 68 for (int i=0; i<colls.getLength(); i++) { 69 Element metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM); 70 metadata_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT)); 71 Element metadata_request = doc_.createElement(GSXML.REQUEST_ELEM); 72 metadata_message.appendChild(metadata_request); 73 metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 74 69 75 // get the metadata for each one 70 76 Element c = (Element)colls.item(i); 71 String name = c.getAttribute("name"); 77 String name = c.getAttribute(GSXML.NAME_ATT); 78 System.out.println("getting metadata for coll "+name); 72 79 73 metadata_request.setAttribute("to", name); // overwrites the old value 80 metadata_request.setAttribute(GSXML.TO_ATT, name); // overwrites the old value 81 System.out.println("metadata message = \n"+converter_.getString(metadata_message)); 74 82 Element metadata_response = (Element)mr_.process(metadata_message); 75 Element coll = (Element)metadata_response.getElementsByTagName("collection").item(0); 83 Element coll = (Element)metadata_response.getElementsByTagName(GSXML.COLLECTION_ELEM).item(0); 84 if (coll==null) { 85 System.out.println("coll is null, in \n"+converter_.getString(metadata_response)); 86 } 76 87 GSXML.mergeMetadataLists(c, coll); // add the metadata to the original response 77 88 } … … 80 91 81 92 // add it in to the page xml tree 82 page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_list_response, "response"), true));93 page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_list_response, GSXML.RESPONSE_ELEM), true)); 83 94 84 95 String stylesheet = GSFile.stylesheetFile(config_, "home.xsl"); … … 96 107 // extract the params from the cgi-request, 97 108 // first convert short to long names 98 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, "paramList");109 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 99 110 cgi_.toLong(cgi_paramList); 100 111 HashMap params = GSXML.extractParams(cgi_paramList); … … 108 119 } 109 120 110 Element coll_about_message = doc_.createElement( "message");111 coll_about_message.setAttribute( "lang", page.getAttribute("lang"));121 Element coll_about_message = doc_.createElement(GSXML.MESSAGE_ELEM); 122 coll_about_message.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT)); 112 123 113 Element coll_about_request = doc_.createElement( "request");124 Element coll_about_request = doc_.createElement(GSXML.REQUEST_ELEM); 114 125 coll_about_message.appendChild(coll_about_request); 115 coll_about_request.setAttribute( "type", "describe");116 coll_about_request.setAttribute( "to", coll_name);126 coll_about_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 127 coll_about_request.setAttribute(GSXML.TO_ATT, coll_name); 117 128 118 129 Element coll_about_response = (Element)mr_.process(coll_about_message); … … 121 132 //System.out.println(converter_.getString(coll_about_response)); 122 133 // add the response to the page 123 page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_about_response, "response"), true));134 page.appendChild(doc_.importNode(GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM), true)); 124 135 125 136 // process using the stylesheet -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r3491 r3512 22 22 23 23 // create the return page tree 24 Element page = doc_.createElement( "page");25 page.setAttribute( "lang", message.getAttribute("lang"));24 Element page = doc_.createElement(GSXML.PAGE_ELEM); 25 page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT)); 26 26 // add the lang stuff from message 27 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "translate"), true));27 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true)); 28 28 // add the system stuff from message 29 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "config"), true));30 31 Element request = (Element)message.getElementsByTagName( "request").item(0);29 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 30 31 Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0); 32 32 // query type is teh subaction 33 String query_type = request.getAttribute( "subaction");33 String query_type = request.getAttribute(GSXML.SUBACTION_ATT); 34 34 35 35 if (query_type.equals("")) { … … 59 59 // extract the params from the cgi-request, and check that we have a coll specified 60 60 // first convert short to long names 61 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, "paramList");61 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 62 62 cgi_.toLong(cgi_paramList); 63 63 HashMap params = GSXML.extractParams(cgi_paramList); … … 74 74 // get the service info from the MR - this will probably need to be cached somehow later on. and add as a description node to the cgi-request - this doesn't work. change to add the specified value as a current attribute to the param - need to do somthing different for query 75 75 76 Element mr_info_message = doc_.createElement( "message");77 Element mr_info_request = doc_.createElement( "request");76 Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM); 77 Element mr_info_request = doc_.createElement(GSXML.REQUEST_ELEM); 78 78 mr_info_message.appendChild(mr_info_request); 79 mr_info_request.setAttribute( "type", "describe");79 mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 80 80 81 81 String to = collection; 82 82 to = GSPath.appendLink(to, "TextQuery"); 83 mr_info_request.setAttribute( "to", to);83 mr_info_request.setAttribute(GSXML.TO_ATT, to); 84 84 85 85 Element mr_info_response = (Element) mr_.process(mr_info_message); 86 86 System.err.println("describe response for service"); 87 87 System.err.println(converter_.getString(mr_info_response)); 88 Element description = doc_.createElement( "description");88 Element description = doc_.createElement(GSXML.DESCRIPTION_ELEM); 89 89 // just param list for now - may need content info too 90 Node pl = GSXML.getNodeByPath(mr_info_response, "response/service/paramList"); 90 String path = GSXML.RESPONSE_ELEM; 91 path = GSPath.appendLink(path, GSXML.SERVICE_ELEM); 92 path = GSPath.appendLink(path, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 93 Node pl = GSXML.getNodeByPath(mr_info_response, path); 91 94 if (pl ==null) { 92 95 System.out.println("pl is null"); … … 106 109 Element param = (Element)imported_paramList.getFirstChild(); 107 110 while (param !=null) { 108 if (param.getNodeName().equals( "param")) { // just in case109 String name = param.getAttribute( "name");111 if (param.getNodeName().equals(GSXML.PARAM_ELEM)) { // just in case 112 String name = param.getAttribute(GSXML.NAME_ATT); 110 113 String current = (String)params.get(name); 111 114 if (current !=null && !current.equals("")) { 112 param.setAttribute( "default", current);115 param.setAttribute(GSXML.DEFAULT_ATT, current); 113 116 } 114 117 } … … 119 122 120 123 // check the query string 121 String query = (String)params.get( "query");124 String query = (String)params.get(GSXML.REQUEST_TYPE_QUERY); 122 125 123 126 if (query==null|| query.equals("")) { … … 130 133 131 134 // else do the request, output search box and results 132 Element mr_query_message = doc_.createElement( "message");133 Element mr_query_request = doc_.createElement( "request");135 Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM); 136 Element mr_query_request = doc_.createElement(GSXML.REQUEST_ELEM); 134 137 mr_query_message.appendChild(mr_query_request); 135 138 136 mr_query_request.setAttribute( "type", "query");137 mr_query_request.setAttribute( "to", to);139 mr_query_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 140 mr_query_request.setAttribute(GSXML.TO_ATT, to); 138 141 139 142 // paramList 140 Element paramList = doc_.createElement( "paramList");143 Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 141 144 mr_query_request.appendChild(paramList); 142 145 … … 148 151 String value = (String)e.getValue(); 149 152 // if (!name.equals("c")) { 150 Element p = doc_.createElement( "param");151 p.setAttribute( "name", name);152 p.setAttribute( "value", value);153 Element p = doc_.createElement(GSXML.PARAM_ELEM); 154 p.setAttribute(GSXML.NAME_ATT, name); 155 p.setAttribute(GSXML.VALUE_ATT, value); 153 156 paramList.appendChild(p); 154 157 // } … … 157 160 158 161 // content - contains the query string 159 Element query_content = doc_.createElement( "content");162 Element query_content = doc_.createElement(GSXML.CONTENT_ELEM); 160 163 Text query_text = doc_.createTextNode(query); 161 164 query_content.appendChild(query_text); … … 169 172 170 173 // check that there are some resources - for now check the list, but later should use a numdocs metadata elem 171 Element resource_list = (Element)GSXML.getNodeByPath(mr_query_response, "response/content/resourceList"); // resourceList not present if no docs found 174 path = GSXML.RESPONSE_ELEM; 175 path = GSPath.appendLink(path, GSXML.CONTENT_ELEM); 176 path = GSPath.appendLink(path, GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER); 177 178 Element resource_list = (Element)GSXML.getNodeByPath(mr_query_response, 179 path); // resourceList not present if no docs found 172 180 if (resource_list == null) { 173 181 174 Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, "response");182 Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM); 175 183 176 184 page.appendChild(doc_.importNode(result_response, true)); … … 185 193 // can we dynamically decide what metadata to get? 186 194 // get the Title metadata 187 Element mr_metadata_message = doc_.createElement( "message");188 Element mr_metadata_request = doc_.createElement( "request");195 Element mr_metadata_message = doc_.createElement(GSXML.MESSAGE_ELEM); 196 Element mr_metadata_request = doc_.createElement(GSXML.REQUEST_ELEM); 189 197 mr_metadata_message.appendChild(mr_metadata_request); 190 198 191 mr_metadata_request.setAttribute( "type", "query");199 mr_metadata_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 192 200 to = GSPath.appendLink(collection, "MetadataRetrieve"); 193 mr_metadata_request.setAttribute( "to", to);194 195 Element meta_content = doc_.createElement( "content");201 mr_metadata_request.setAttribute(GSXML.TO_ATT, to); 202 203 Element meta_content = doc_.createElement(GSXML.CONTENT_ELEM); 196 204 mr_metadata_request.appendChild(meta_content); 197 205 … … 200 208 201 209 // the second part of the content is the metadata list 202 Element metadata_list = doc_.createElement( "metadataList");203 Element title = doc_.createElement( "element");204 title.setAttribute( "name", "Title");210 Element metadata_list = doc_.createElement(GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER); 211 Element title = doc_.createElement(GSXML.METADATA_ELEM); 212 title.setAttribute(GSXML.NAME_ATT, "Title"); 205 213 metadata_list.appendChild(title); 206 214 meta_content.appendChild(metadata_list); … … 208 216 Element mr_metadata_response = (Element)mr_.process(mr_metadata_message); 209 217 210 Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, "response");218 Element result_response = (Element)GSXML.getChildByTagName(mr_metadata_response, GSXML.RESPONSE_ELEM); 211 219 212 220 page.appendChild(doc_.importNode(result_response, true)); -
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/ResourceAction.java
r3491 r3512 27 27 // for now, no subaction eventually we may want to have subactions such as text assoc or something ? 28 28 29 Element request = (Element)message.getElementsByTagName( "request").item(0);29 Element request = (Element)message.getElementsByTagName(GSXML.REQUEST_ELEM).item(0); 30 30 31 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, "paramList");31 Element cgi_paramList = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 32 32 cgi_.toLong(cgi_paramList); 33 33 HashMap params = GSXML.extractParams(cgi_paramList); … … 41 41 42 42 // create the return page tree 43 Element page = doc_.createElement( "page");44 page.setAttribute( "lang", message.getAttribute("lang"));43 Element page = doc_.createElement(GSXML.PAGE_ELEM); 44 page.setAttribute(GSXML.LANG_ATT, message.getAttribute(GSXML.LANG_ATT)); 45 45 // add the lang stuff from message 46 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "translate"), true));46 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.TRANSLATION_ELEM), true)); 47 47 // add the config stuff from message 48 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, "config"), true));48 page.appendChild(doc_.importNode(GSXML.getChildByTagName(message, GSXML.CONFIGURATION_ELEM), true)); 49 49 50 50 51 51 52 52 // build up the mr request 53 Element mr_message = doc_.createElement( "message");54 Element mr_request = doc_.createElement( "request");53 Element mr_message = doc_.createElement(GSXML.MESSAGE_ELEM); 54 Element mr_request = doc_.createElement(GSXML.REQUEST_ELEM); 55 55 mr_message.appendChild(mr_request); 56 mr_request.setAttribute( "type", "query");56 mr_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_QUERY); 57 57 mr_request.setAttribute("resourceType", "core"); 58 58 String to = (String)params.get("collection"); // collection name 59 59 to = GSPath.appendLink(to, "ResourceRetrieve"); 60 mr_request.setAttribute( "to", to);60 mr_request.setAttribute(GSXML.TO_ATT, to); 61 61 62 62 // all query requests must have a paramList and a content 63 Element paramList = doc_.createElement( "paramList");63 Element paramList = doc_.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 64 64 mr_request.appendChild(paramList); 65 65 66 Element content = doc_.createElement( "content");66 Element content = doc_.createElement(GSXML.CONTENT_ELEM); 67 67 mr_request.appendChild(content); 68 68 69 Element resource_list = doc_.createElement( "resourceList");70 Element resource = doc_.createElement( "resource");71 resource.setAttribute( "name", resource_name);69 Element resource_list = doc_.createElement(GSXML.RESOURCE_ELEM+GSXML.LIST_MODIFIER); 70 Element resource = doc_.createElement(GSXML.RESOURCE_ELEM); 71 resource.setAttribute(GSXML.NAME_ATT, resource_name); 72 72 resource_list.appendChild(resource); 73 73 content.appendChild(resource_list); … … 77 77 // add the results to the page 78 78 page.appendChild(doc_.importNode(request, true)); 79 page.appendChild(doc_.importNode(GSXML.getChildByTagName(mr_result, "response"), true));79 page.appendChild(doc_.importNode(GSXML.getChildByTagName(mr_result, GSXML.RESPONSE_ELEM), true)); 80 80 81 81 // process using the stylesheet
Note:
See TracChangeset
for help on using the changeset viewer.