edu.mayo.bsi.ngsportal.server
Class PortalConnection

java.lang.Object
  extended by edu.mayo.bsi.ngsportal.server.PortalConnection

public class PortalConnection
extends Object

Class that tracks information about a person who is using the NGS Portal

@author Gregory Dougherty


Constructor Summary
PortalConnection(Encryptor encryptor, int contactID, boolean canSeeAll, boolean canEditAll, boolean canAdministerProjects, int[] roles, String lanID, String firstName, String lastName)
          Constructor
 
Method Summary
 boolean canAdministerProjects()
           
 boolean canEditAll()
           
 boolean canSeeAll()
           
 int getContactID()
           
 Encryptor getEncryptor()
           
 String getFirstName()
           
 String getFullName()
           
 String getLanID()
           
 String getLastName()
           
 int[] getRoles()
           
 ConnectionResponse makeConnectionResponse(int key, String[] userRuns)
          Create a ConnectionResponse that describes the contents of this PortalConnection
 boolean setUser(int contactID, boolean canSeeAll, boolean canEditAll, boolean canAdministerProjects, int[] roles, String lanID, String firstName, String lastName)
          Called when the user has logged in
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortalConnection

public PortalConnection(Encryptor encryptor,
                        int contactID,
                        boolean canSeeAll,
                        boolean canEditAll,
                        boolean canAdministerProjects,
                        int[] roles,
                        String lanID,
                        String firstName,
                        String lastName)
Constructor

Parameters:
encryptor - Key to decoding the user's password
contactID - The db ID of the person who has this connection
canSeeAll - True if this user can see all runs, else false
canEditAll - True if this user can edit all runs, else false
canAdministerProjects - True if this user can administer Secondary Analysis Projects, else false
roles - All of the roles played by the user, null if the user does not yet have any
lanID - The user's lan ID
firstName - The LDAP specified first name of the User with that lan ID
lastName - The LDAP specified last name of the User with that lan ID
Method Detail

setUser

public final boolean setUser(int contactID,
                             boolean canSeeAll,
                             boolean canEditAll,
                             boolean canAdministerProjects,
                             int[] roles,
                             String lanID,
                             String firstName,
                             String lastName)
Called when the user has logged in

Parameters:
contactID - The db ID of the person who has this connection
canSeeAll - True if this user can see all runs, else false
canEditAll - True if this user can edit all runs, else false
canAdministerProjects - True if this user can administer Secondary Analysis Projects, else false
roles - All of the roles played by the user, null if the user does not yet have any
lanID - The user's lan ID
firstName - The LDAP specified first name of the User with that lan ID
lastName - The LDAP specified last name of the User with that lan ID
Returns:
True if could set this information, false if it was already set

makeConnectionResponse

public ConnectionResponse makeConnectionResponse(int key,
                                                 String[] userRuns)
Create a ConnectionResponse that describes the contents of this PortalConnection

Parameters:
key - Value of the key the references this PortalConnection
userRuns - Array of runs that the TREATTableBrowser has that are visible to the user with this LAN ID
Returns:
A new ConnectionResponse

getEncryptor

public final Encryptor getEncryptor()
Returns:
the encryptor

getContactID

public final int getContactID()
Returns:
the contactID

canSeeAll

public final boolean canSeeAll()
Returns:
If the user can see all runs, i.e. if the user is an Informatics Specialist of some sort, or else is a lab tech / lab manager

canEditAll

public final boolean canEditAll()
Returns:
If the user can edit all runs, i.e. if the user is an Informatics Specialist of some sort

canAdministerProjects

public final boolean canAdministerProjects()
Returns:
the canAdministerProjects

getLanID

public final String getLanID()
Returns:
the lanID

getFirstName

public final String getFirstName()
Returns:
the firstName

getLastName

public final String getLastName()
Returns:
the lastName

getFullName

public final String getFullName()
Returns:
lastName + ", " + firstName

getRoles

public final int[] getRoles()
Returns:
the roles

toString

public String toString()
Overrides:
toString in class Object