Class QualifiedAgent

  • All Implemented Interfaces:
    Serializable

    public final class QualifiedAgent
    extends Object
    implements Serializable
    A QualifiedAgent represents an agent (tuple) that has been authenticated and provides all information the system needs for unique identification. Each agent tuple consists of the IDs of the agent and a corresponding organisational position as well as the corresponding names. For more information on an agent use RichAgent.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected QualifiedAgent​(long agentID, String agentUserName, long orgPositionID, String orgPositionName)
      Constructs a new QualifiedAgent for the designated agent and organisational position ID.
      protected QualifiedAgent​(long agentID, String agentUserName, long orgPositionID, String orgPositionName, String userSessionID)
      Constructs a new QualifiedAgent for the designated agent and organisational position ID as well as the user session ID.
    • Constructor Detail

      • QualifiedAgent

        protected QualifiedAgent​(long agentID,
                                 String agentUserName,
                                 long orgPositionID,
                                 String orgPositionName)
        Constructs a new QualifiedAgent for the designated agent and organisational position ID. Please pay attention to the order as both parameters are ints. The user session ID will be set to null.
        Parameters:
        agentID - The ID of this agent.
        agentUserName - The name of this agent.
        orgPositionID - The ID of the organisational position of the agent.
        orgPositionName - The name of the organisational position of the agent.
      • QualifiedAgent

        protected QualifiedAgent​(long agentID,
                                 String agentUserName,
                                 long orgPositionID,
                                 String orgPositionName,
                                 String userSessionID)
        Constructs a new QualifiedAgent for the designated agent and organisational position ID as well as the user session ID. Please pay attention to the order as both parameters are ints.
        Parameters:
        agentID - The ID of this agent.
        agentUserName - The name of this agent.
        orgPositionID - The ID of the organisational position of the agent.
        orgPositionName - The name of the organisational position of the agent.
        userSessionID - The session ID as provided by various (client) frameworks like HTTP-Session-IDs.
    • Method Detail

      • create

        public static QualifiedAgent create​(long agentID,
                                            String agentUserName,
                                            long orgPositionID,
                                            String orgPositionName)
        Constructs a new QualifiedAgent for the designated agent and organisational position ID. Please pay attention to the order as both parameters are ints. The user session ID will be set to null.
        Parameters:
        agentID - The ID of this agent.
        agentUserName - The name of this agent.
        orgPositionID - The ID of the organisational position of the agent.
        orgPositionName - The name of the organisational position of the agent.
        Returns:
        The newly created agent.
      • create

        public static QualifiedAgent create​(long agentID,
                                            String agentUserName,
                                            long orgPositionID,
                                            String orgPositionName,
                                            String userSessionID)
        Constructs a new QualifiedAgent for the designated agent and organisational position ID as well as the user session ID. Please pay attention to the order as both parameters are ints.
        Parameters:
        agentID - The ID of this agent.
        agentUserName - The name of this agent.
        orgPositionID - The ID of the organisational position of the agent.
        orgPositionName - The name of the organisational position of the agent.
        userSessionID - The session ID as provided by various (client) frameworks like HTTP-Session-IDs.
        Returns:
        The newly created agent.
      • getAgentID

        public long getAgentID()
        Returns the Agent's ID of this result entry.
        Returns:
        the Agent's ID of this result entry
      • getAgentUserName

        public String getAgentUserName()
        Returns the Agent's user name of this result entry.
        Returns:
        the Agent's user name of this result entry
      • getOrgPositionID

        public long getOrgPositionID()
        Returns the OrgPosition ID (of the Agent's OrgPosition) of this result entry.
        Returns:
        the OrgPosition ID of this result entry
      • getOrgPositionName

        public String getOrgPositionName()
        Returns the OrgPosition name (of the Agent's OrgPosition) of this result entry.
        Returns:
        the OrgPosition ID of this result entry
      • getUserSessionID

        public String getUserSessionID()
        Gets the ID of the user session which is provided by various (client) frameworks. For instance HTTP-frameworks use a HTTP-Session-ID to identify each user uniquely. This will be null in case no corresponding ID is provided.
        Returns:
        The ID of the user session that allows various frameworks to identify a user uniquely.
      • intern

        public QualifiedAgent intern()
        Interns this qualified agent, that is, looks up the designated agent in an internal map and uses the very same object instance for the same agent, similar to a singleton. This method is equivalent to String.intern().
        Only qualified agents without a user session ID will be interned.
        Returns:
        The interned qualified agent, that is the one and only object instance representing this agent in one JVM or this object instance.
      • equals

        public boolean equals​(Object obj)
        Two QualifiedAgents are equal if their agent IDs and org position IDs match. getUserSessionID() is not considered here!
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object