- Timestamp:
- 2022-09-20T11:33:23+12:00 (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java
r32549 r36642 3 3 import org.greenstone.gsdl3.util.*; 4 4 import org.greenstone.gsdl3.action.*; 5 import org.greenstone.gsdl3.service.CollectionGroups; 5 6 // XML classes 6 7 import org.w3c.dom.Node; … … 11 12 // other java classes 12 13 import java.io.File; 14 import java.io.Serializable; 13 15 import java.util.HashMap; 14 16 import java.util.Enumeration; … … 21 23 22 24 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.core.DefaultReceptionist.class.getName()); 25 26 // this gets set to the groupInfo service name if there is one. 27 protected String groupInfoServiceName = null; 23 28 24 29 /** … … 49 54 return; 50 55 } 51 Element coll_param = GSXML.getNamedElement(param_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, GSParams.COLLECTION); 52 if (coll_param == null) 56 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 57 String coll_name = (String)params.get(GSParams.COLLECTION); 58 if (coll_name == null) 53 59 { 54 60 logger.debug(" coll param is null, returning"); … … 56 62 } 57 63 58 // see if the collection/cluster element is already there59 String coll_name = coll_param.getAttribute(GSXML.VALUE_ATT);60 64 UserContext userContext = new UserContext(page_request); 61 65 62 66 if (coll_name.equals("")) 63 67 { 64 Element pc_param = GSXML.getNamedElement(param_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, "p.c"); 65 if (pc_param != null) 66 { 67 coll_name = pc_param.getAttribute(GSXML.VALUE_ATT); 68 } 68 coll_name = (String)params.get("p.c"); 69 69 } 70 70 … … 110 110 } 111 111 112 // have we got group param, and pathList?? 113 String group = (String)params.get(GSParams.GROUP); 114 if (group != null && !group.equals("")) { 115 // ...yes we do. add group path info if not already present 116 Element path_list = (Element) GSXML.getChildByTagName(page_response, GSXML.PATH_ELEM + GSXML.LIST_MODIFIER); 117 if (path_list == null) { 118 // lets get it now 119 120 Element group_info_response = getGroupInfo(group, userContext); 121 if (group_info_response != null) { 122 path_list = (Element) GSXML.getChildByTagName(group_info_response,GSXML.PATH_ELEM + GSXML.LIST_MODIFIER); 123 if (path_list != null) { 124 page_response.appendChild(doc.importNode(path_list, true)); 125 } 126 } 127 } 128 } 112 129 113 130 // have got a coll description … … 195 212 } 196 213 } 214 215 // copied from pageaction - put in a single place 216 /** sends a request to GroupCurrentContent service to get group info. null group will give top level info, 217 otherwise will just give info for specified group */ 218 protected Element getGroupInfo(String group, UserContext userContext) { 219 220 if (groupInfoServiceName == null) { 221 // this is the first time we have come here, set this up 222 223 if (this.mr instanceof MessageRouter && ((MessageRouter)this.mr).pingModule(CollectionGroups.GROUP_CONTENT_SERVICE)) { 224 this.groupInfoServiceName = CollectionGroups.GROUP_CONTENT_SERVICE; 225 } else { 226 this.groupInfoServiceName = "NO_GROUPS"; 227 } 228 } 229 if (this.groupInfoServiceName.equals ("NO_GROUPS")) { 230 return null; 231 } 232 // otherwise lets get the group info 233 Document doc = XMLConverter.newDOM(); 234 // collections and groups list 235 Element group_info_message = doc.createElement(GSXML.MESSAGE_ELEM); 236 Element group_info_request = GSXML.createBasicRequest(doc, GSXML.TO_ATT, this.groupInfoServiceName, userContext); 237 group_info_message.appendChild(group_info_request); 238 if (group != null) { 239 Element param_list = doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 240 GSXML.addParameterToList(param_list, GSParams.GROUP, group); 241 group_info_request.appendChild(param_list); 242 } 243 // send off the request 244 Element group_info_response_message = (Element) this.mr.process(group_info_message); 245 Element group_info_response = (Element) GSXML.getChildByTagName(group_info_response_message, GSXML.RESPONSE_ELEM); 246 return group_info_response; 247 } 248 197 249 }
Note:
See TracChangeset
for help on using the changeset viewer.