Interface SessionService

    • Method Detail

      • getCurrentSession

        Session getCurrentSession()
        Returns:
        the current Session
      • getSession

        @Deprecated
        Session getSession​(java.lang.String id)
        Deprecated.
        since 5.5.1 session management was changed and this method always returns null
        Get Session by given id
      • closeSession

        void closeSession​(Session session)
        Closed the given Session
        Parameters:
        session - the session which will be closed
      • closeCurrentSession

        void closeCurrentSession()
        Close the current Session
      • hasCurrentSession

        boolean hasCurrentSession()
        Check if current session exists and neither closed nor inactive. KAM-158: Replacement for JaloSession.hasCurrentSession()
      • setAttribute

        void setAttribute​(java.lang.String name,
                          java.lang.Object value)
        Set the given value object to the current Session as attribute with the given name. If the value object is a (persisted) model than the model is written to the session attribute.
        Parameters:
        name - name of the attribute
        value - the value to be set
      • getAttribute

        <T> T getAttribute​(java.lang.String name)
        Returns for the given attribute name the content which is stored in the current Session
        Parameters:
        name - the attribute name
        Returns:
        null if such attribute don't exist in the current session.
      • getOrLoadAttribute

        <T> T getOrLoadAttribute​(java.lang.String name,
                                 SessionService.SessionAttributeLoader<T> loader)
        Returns for the given name the content which is stored in the current Session or loads a new value atomically by calling the loader instance.
      • getAllAttributes

        <T> java.util.Map<java.lang.String,​T> getAllAttributes()
        Returns:
        all attributes from the current Session as Map.
      • executeInLocalViewWithParams

        <T> T executeInLocalViewWithParams​(java.util.Map<java.lang.String,​java.lang.Object> localViewParameters,
                                           SessionExecutionBody body)
        Executes the given SessionExecutionBody in a local SessionContext that is populated with parameters provided in the map.
        Parameters:
        localViewParameters - parameters that will be set in local view
        body - callback to be invoked
        Returns:
        callback result
      • removeAttribute

        void removeAttribute​(java.lang.String name)
        Removes the given attribute from the current session. Do nothing if the attribute doesn't exists in the session.
        Parameters:
        name - the attribute name
      • getBoundSession

        Session getBoundSession​(java.lang.Object rawSession)
        Returns service layer session bound to given JaloSession or creates new session (if no session is bound to given JaloSession) and returns it.
      • getRawSession

        java.lang.Object getRawSession​(Session session)
        Returns JaloSession bound to given service layer session.