Package org.fao.geonet.services.main

Source Code of org.fao.geonet.services.main.Select

package org.fao.geonet.services.main;

import jeeves.constants.Jeeves;
import jeeves.interfaces.Service;
import jeeves.server.ServiceConfig;
import jeeves.server.UserSession;
import jeeves.server.context.ServiceContext;
import org.fao.geonet.Util;
import org.fao.geonet.constants.Params;
import org.fao.geonet.kernel.SelectionManager;
import org.jdom.Element;

/**
* Select a list of elements stored in session
* Returns status
*/

public class Select implements Service {
 
  String init_type;
 
  public void init(String appPath, ServiceConfig params) throws Exception {
    init_type = params.getValue(Params.TYPE);
  }

  // --------------------------------------------------------------------------
  // ---
  // --- Service
  // ---
  // --------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context)
      throws Exception {
   
    String type = Util.getParam(params, Params.TYPE, init_type );
   
    // Get the selection manager
    UserSession session = context.getUserSession();
    int nbSelected = SelectionManager.updateSelection(type, session, params, context);
   
    // send ok
    Element response = new Element(Jeeves.Elem.RESPONSE);
    response.addContent(new Element("Selected").setText(""+nbSelected));   

    return response;
  }
}

// =============================================================================
TOP

Related Classes of org.fao.geonet.services.main.Select

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.