Package jeeves.server

Examples of jeeves.server.UserSession


  //--------------------------------------------------------------------------

  @SuppressWarnings("unchecked")
  public Element exec(Element params, ServiceContext context) throws Exception
  {
    UserSession session = context.getUserSession();

    String sUsername = session.getUsername();
    String sName     = session.getName();
    String sSurname  = session.getSurname();
    Profile sProfile  = session.getProfile();

    if (sUsername == null)
      sUsername = Profile.Guest.name();

    if (sName == null)
      sName = sUsername;

    if (sSurname == null)
      sSurname = "";

    if (sProfile == null)
      sProfile = Profile.Guest;

    Element userId   = new Element("userId".addContent(session.getUserId());
    Element username = new Element("username").addContent(sUsername);
    Element name     = new Element("name")    .addContent(sName);
    Element surname  = new Element("surname") .addContent(sSurname);
    Element profile  = new Element("profile") .addContent(sProfile.name());

    Element sEl = new Element(Jeeves.Elem.SESSION)
      .addContent(userId)
      .addContent(username)
      .addContent(name)
      .addContent(surname)
      .addContent(profile);

    if (groupName != null)
    {
      Map<?, Element> group = (Map<?, Element>)session.getProperty(groupName);
      if (group != null)
      {
        Element gEl = new Element(groupName);
        for (Element child : group.values()) {
          if (outFields == null || outFields.contains(child.getName()))
View Full Code Here


  //--------------------------------------------------------------------------

  @SuppressWarnings("unchecked")
  public Element exec(Element params, ServiceContext context) throws Exception
  {
    UserSession session = context.getUserSession();
   
    Hashtable<String, Element> group = (Hashtable<String, Element>) session.getProperty(groupName);
    if (group == null) {
      group = new Hashtable<String, Element>();
    }
    for (Element child : (List<Element>) params.getChildren()) {
      if (inFields == null || inFields.contains(child.getName())) {
        group.put(child.getName(), child);
      }
    }
    session.setProperty(groupName, group);
   
    return params;
  }
View Full Code Here

        long count = _harvesterSettingRepo.count();
        TransactionlessTesting.get().run(new TestTask() {
            @Override
            public void run() throws Exception {
                LocalServiceRequest req = LocalServiceRequest.create("http://localhost/geonetwork/srv/eng/" + SERVICE_NAME);
                UserSession userSession = new UserSession();

                _service.setService(new ServiceFunction() {
                    @Override
                    public Element exec(Element params, ServiceContext context) throws Exception {
                        saveParentAndChildHarvesterSetting(context);
View Full Code Here

        long count = _harvesterSettingRepo.count();
        TransactionlessTesting.get().run(new TestTask() {
            @Override
            public void run() throws Exception {
                LocalServiceRequest req = LocalServiceRequest.create("http://localhost/geonetwork/srv/eng/" + SERVICE_NAME);
                UserSession userSession = new UserSession();

                _service.setService(new ServiceFunction() {
                    @Override
                    public Element exec(Element params, ServiceContext context) throws Exception {
                        saveParentAndChildHarvesterSetting(context);
View Full Code Here

      jeeves = new JeevesEngine();
      // null JeevesServlet arg because not running in servlet here
      jeeves.init(appPath, configPath, baseUrl, null);

      // Make session with all permissions
      session = new UserSession();
      User user = new User().
              setProfile(Profile.Administrator).
              setUsername(Profile.Administrator.name()).
              setId(0).
              setName(Profile.Administrator.name()).
View Full Code Here

     *     <li>If the response is not XML, for example if it is JSON or a string</li>
     * </ol>
     */
    public void executeOnly(LocalServiceRequest request) throws Exception {
        ServiceContext context = new ServiceContext(request.getService(), getApplicationContext(), htContexts, getEntityManager());
        UserSession session = this._userSession;
        if (session == null) {
            session = new UserSession();
        }

        try {
            final ServiceManager serviceManager = context.getBean(ServiceManager.class);
            serviceManager.dispatch(request, session, context);
View Full Code Here

TOP

Related Classes of jeeves.server.UserSession

Copyright © 2018 www.massapicom. 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.