All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.stanford.protege.webprotege.session.WebProtegeSession Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.session;

import edu.stanford.protege.webprotege.common.UserId;

import java.util.Optional;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 12/02/15
 */
public interface WebProtegeSession {

    /**
     * Gets an attribute.
     * @param attribute The attribute to get.  Not {@code null}.
     * @param  The type of the attribute value.
     * @return The optional attribute value.  Not {@code null}.
     * @throws NullPointerException if {@code attribute} is {@code null}.
     */
     Optional getAttribute(WebProtegeSessionAttribute attribute);

    /**
     * Sets an attribute.
     * @param attribute The attribute to set.  Not {@code null}.
     * @param value The value to set.  Not {@code null}.
     * @param  The type of the value
     * @throws NullPointerException if any parameters are {@code null}.
     */
     void setAttribute(WebProtegeSessionAttribute attribute, T value);

    /**
     * Removes an attribute.  This has no effect if the attribute has not been set.
     * @param attribute The attribute to be removed. Not {@code null}.
     */
    void removeAttribute(WebProtegeSessionAttribute attribute);

    /**
     * Gets the user in this session.
     * @return The {@link UserId} of the user in this session.
     * Not {@code null}.  If there is not a specific user in this session then the {@link UserId}
     * of the guest user will be returned.
     */
    UserId getUserInSession();

    /**
     * Sets the user in the session.
     * @param userId The userId.  Not {@code null}.
     * @throws NullPointerException if any parameters are {@code null}.
     */
    void setUserInSession(UserId userId);

    /**
     *  Sets the guest user as the user in this session.
     */
    void clearUserInSession();

    String getSessionId();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy