Ignore:
Timestamp:
2018-09-13T14:05:59+12:00 (6 years ago)
Author:
kjdon
Message:

params class changed, now returns false by default for shouldsave. so don't need to add any that we don't want saving in the session. turned hard coded strings into static string variables

File:
1 edited

Legend:

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

    r31774 r32448  
    2121{
    2222
    23   public static final String HITS_PER_PAGE = "hitsPerPage";
     23  public static final String HITS_PER_PAGE_ARG = "hitsPerPage";
    2424    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.action.QueryAction.class.getName());
     25 
     26    /**
     27     * tell the param class what its arguments are.
     28     * if an action has its own arguments, this should add them to
     29     * the params object - particularly
     30     * important for args that need to be saved to the session
     31     */
     32    public boolean addActionParameters(GSParams params)
     33    {
     34      // some query services don't do paging themselves, in shich case we do it here. Let tell servlet to save the param just in case nothing else is doing that.
     35      params.addServiceParameter(HITS_PER_PAGE_ARG, "20", true, false);
     36        return true;
     37    }
    2538 
    2639    /**
     
    351364    {
    352365
    353       String hits_pp = (String) service_params.get(HITS_PER_PAGE);
     366      String hits_pp = (String) service_params.get(HITS_PER_PAGE_ARG);
    354367     
    355368        int hits = 20;
     
    427440  protected boolean addHitsParamToService(Document doc, Element service_description, String lang) {
    428441    Element param_list = (Element)GSXML.getChildByTagName(service_description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    429     Element param = GSXML.createParameterDescription(doc, HITS_PER_PAGE, getTextString("param." + HITS_PER_PAGE, lang, "ServiceRack", null), GSXML.PARAM_TYPE_INTEGER, "20", null, null);
     442    Element param = GSXML.createParameterDescription(doc, HITS_PER_PAGE_ARG, getTextString("param." + HITS_PER_PAGE_ARG, lang, "ServiceRack", null), GSXML.PARAM_TYPE_INTEGER, "20", null, null);
    430443    Element query_param = GSXML.getNamedElement(param_list, GSXML.PARAM_ELEM, GSXML.NAME_ATT, "query");
    431444    if (query_param != null) {
Note: See TracChangeset for help on using the changeset viewer.