Changeset 27144

Show
Ignore:
Timestamp:
28.03.2013 14:00:19 (7 years ago)
Author:
kjdon
Message:

added a helper method - get the format info via message router, and merge in any global format info

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java

    r26491 r27144  
    1010import org.greenstone.gsdl3.util.GSParams; 
    1111import org.greenstone.gsdl3.util.GSXML; 
     12import org.greenstone.gsdl3.util.GSXSLT; 
    1213import org.greenstone.gsdl3.util.UserContext; 
    1314import org.greenstone.gsdl3.util.XMLConverter; 
     
    271272        elem.appendChild(elem.getOwnerDocument().importNode(documentOptionList, true)); 
    272273    } 
     274 
     275  protected Element getFormatInfo(String to, UserContext userContext) { 
     276    Element mr_format_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 
     277    Element mr_format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 
     278    mr_format_message.appendChild(mr_format_request); 
     279 
     280    // process the message 
     281    Element mr_response_message = (Element) this.mr.process(mr_format_message); 
     282    // the response 
     283     
     284    Element format_response = (Element) GSXML.getChildByTagName(mr_response_message, GSXML.RESPONSE_ELEM); 
     285     
     286    Element format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.FORMAT_ELEM); 
     287    if (format_elem!= null) { 
     288      Element global_format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.GLOBAL_FORMAT_ELEM); 
     289      if (global_format_elem != null) 
     290    { 
     291      GSXSLT.mergeFormatElements(format_elem, global_format_elem, false); 
     292    } 
     293    } 
     294    return format_elem; 
     295  } 
    273296} 
     297 
     298   
     299