org.ifeth.sehr.client.api
Class LocalUserProfile

java.lang.Object
  extended byorg.ifeth.sehr.client.api.LocalUserProfile

public class LocalUserProfile
extends java.lang.Object

Client object to handle a user profile by a XML based dataset

The intention of this object is to help 'thick' clients to track local users and their SEHR connections. To connect a GUI client to a SEHR host this object must handle at least one valid account of the SEHR host. It is possible to seal other users below this master account using this object. The LocalUserProfileCreateAssistent implements such a usability.

Usage: This object is a data store as well as a functional class to read/write the profile from/to a local file. The getter/setter methods are used to access the data.


Constructor Summary
LocalUserProfile()
          Parameterless constructor
LocalUserProfile(java.lang.String key)
          Constructor with initialization of a crypting object
LocalUserProfile(java.lang.String profilename, java.lang.String reqmail, java.lang.String SEHRHost, int SEHRPort, java.lang.String SEHRZone, java.lang.String driver, java.lang.String login, java.lang.String password, boolean ldapaccount, java.util.Vector mailfilters, java.util.Vector addresses, int parentEntryID)
          Constructor with setting the required data at once
 
Method Summary
 ContactItem[] getAddressesArray()
           
 boolean getAddSuffixToBase()
          Returns the addSuffixToBase boolean
 boolean getAddSuffixToLogin()
          Returns the addSuffixToLogin boolean
 boolean getAddSuffixToURL()
          Returns the addSuffixToURL boolean
 java.lang.String getBase()
          Returns the base used in LDAP queries
 java.util.Vector getContacts()
          Returns the adresses stored in the profile
 DesEncrypter getDeEnCrypt()
           
 java.lang.String getEMail()
          Returns the email address
 int getEntryID()
           
 java.lang.String getLdapLogin()
          Returns the LDAP server login
 java.lang.String getLdapMailField()
          Returns the name of the "mail" field
 java.lang.String getLdapNameField()
          Returns the name of the "name" field
 java.lang.String getLdapPassword()
          Returns the LDAP server password
 java.lang.String getLogin()
          Returns the (account/profile) login
 java.util.Vector getMailFilters()
          Returns the filters
 int getNbSupFields()
          Returns the number of extra fields
 int getParentEntryID()
           
 java.lang.String getPassword()
          Returns the password
 int getPort()
          Returns the LDAP server's port number
 java.lang.String getProfileName()
          Returns the profile name
static java.lang.String[] getProfiles(java.lang.String datapath, boolean filterparent, DesEncrypter denc)
          Get the names of local stored profiles
 java.lang.String getSEHRAccount()
           
 java.lang.String getSEHRAccountPw()
           
 java.lang.String getSEHRConnectionDriver()
           
 java.lang.String getSEHRHost()
          Returns the SEHR server IP
 int getSEHRPort()
          Returns the server's port number
 java.lang.String getSEHRZone()
           
 java.lang.String getSuffix()
          Returns the suffix used in LDAP queries
 java.lang.String[] getSupFields()
          Returns the extra fields
 java.lang.String getUIMail()
           
 java.lang.String getUrl()
          Returns the LDAP server's url
 boolean isCrypt()
           
 boolean isLDAPAccount()
          Tells wether this profile uses LDAP
static boolean isProfileName(java.lang.String datapath, java.lang.String profilename)
           
static LocalUserProfile loadProfile(java.lang.String datapath, java.lang.String profilename, DesEncrypter denc)
          Loads the user profile from a physically accessable file
static LocalUserProfile loadProfileByID(java.lang.String datapath, int EntryID, DesEncrypter denc)
          Loads the user profile from a physically accessable file
static void main(java.lang.String[] args)
          For testing purposes
 void save()
          Writes the current profile to a local file
 void save(java.lang.String datapath, LocalUserProfile p)
          Writes the given profile to a local file using the encryption cipher defined/set by profile!
 void setAddSuffixToBase(boolean addSuffixToBase)
          Sets the value of addSuffixToBase
 void setAddSuffixToLogin(boolean addSuffixToLogin)
          Sets the value of addSuffixToLogin
 void setAddSuffixToURL(boolean addSuffixToURL)
          Sets the value of addSuffixToURL
 void setBase(java.lang.String base)
          Sets the base used in LDAP queries
 void setBaseInfos(java.lang.String profilename, java.lang.String reqmail, java.lang.String SEHRHost, int SEHRPort, java.lang.String login, java.lang.String password, boolean ldapaccount, java.util.Vector mailfilters, java.util.Vector addresses)
          Sets basic infos for the profile at once
 void setContacts(java.util.Vector addresses)
          Sets the addresses stored in the profile
 void setCrypt(DesEncrypter denc)
           
 void setCrypt(java.lang.String pw)
          Set encryption or turn off with param set as 'null'
 void setEMail(java.lang.String mail)
          Sets the new email address
 void setFilters(java.util.Vector filters)
          Sets the filters
 void setIncomingPort(int port)
          Sets the new server's port number
 void setLDAPAccount(boolean ldap)
          Sets the ldapUser boolean
 void setLdapInfos(java.lang.String url, int port, java.lang.String suffix, boolean addSuffixToURL, boolean addSuffixToBase, boolean addSuffixToLogin, java.lang.String base, java.lang.String ldapLogin, java.lang.String ldapPassword, java.lang.String ldapNameField, java.lang.String ldapMailField, int nbSupFields)
          Sets the LDAP related infos for the profile
 void setLdapLogin(java.lang.String ldapLogin)
          Sets the LDAP login
 void setLdapMailField(java.lang.String ldapMailField)
          LDAP: Sets the name of the "mail" field
 void setLdapNameField(java.lang.String ldapNameField)
          Sets the name of the "name" field
 void setLdapPassword(java.lang.String ldapPassword)
          Sets the LDAP password
 void setLogin(java.lang.String login)
          Sets the new login
 void setNbSupFields(int nbSupFields)
          Sets the number of extra fields
 void setParentEntryID(int parentEntryID)
           
 void setPassword(java.lang.String password)
          Sets the new password
 void setPort(int port)
          Sets the new LDAP server's port number
 void setSEHRAccount(java.lang.String account)
           
 void setSEHRAccountPw(java.lang.String accountPw)
           
 void setSEHRConnectionDriver(java.lang.String connectionDriver)
           
 void setSEHRHost(java.lang.String host)
          Sets the new SEHR server IP
 void setSEHRPort(int port)
           
 void setSEHRZone(java.lang.String zone)
           
 void setSuffix(java.lang.String suffix)
          Sets the new suffix
 void setSupFields(java.lang.String[] supFields)
          Sets the extra fields
 void setSupFieldsVector(java.util.Vector supFields)
           
 void setUIMail(java.lang.String mail)
           
 void setUrl(java.lang.String url)
          Sets the new LDAP server's url
 java.lang.String toString()
          Returns the profile name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalUserProfile

public LocalUserProfile()
Parameterless constructor


LocalUserProfile

public LocalUserProfile(java.lang.String key)
Constructor with initialization of a crypting object


LocalUserProfile

public LocalUserProfile(java.lang.String profilename,
                        java.lang.String reqmail,
                        java.lang.String SEHRHost,
                        int SEHRPort,
                        java.lang.String SEHRZone,
                        java.lang.String driver,
                        java.lang.String login,
                        java.lang.String password,
                        boolean ldapaccount,
                        java.util.Vector mailfilters,
                        java.util.Vector addresses,
                        int parentEntryID)
Constructor with setting the required data at once

Method Detail

loadProfileByID

public static LocalUserProfile loadProfileByID(java.lang.String datapath,
                                               int EntryID,
                                               DesEncrypter denc)
Loads the user profile from a physically accessable file

Parameters:
datapath -
Returns:
profile - the profile object

isProfileName

public static boolean isProfileName(java.lang.String datapath,
                                    java.lang.String profilename)

loadProfile

public static LocalUserProfile loadProfile(java.lang.String datapath,
                                           java.lang.String profilename,
                                           DesEncrypter denc)
Loads the user profile from a physically accessable file

Parameters:
datapath -
profilename - - the storage filename of the profile
Returns:
profile - the profile object

getProfileName

public java.lang.String getProfileName()
Returns the profile name

Returns:
profile name

getDeEnCrypt

public DesEncrypter getDeEnCrypt()

isCrypt

public boolean isCrypt()

setCrypt

public void setCrypt(java.lang.String pw)
Set encryption or turn off with param set as 'null'


setCrypt

public void setCrypt(DesEncrypter denc)

getEntryID

public int getEntryID()

getEMail

public java.lang.String getEMail()
Returns the email address

Returns:
email address of the account

setEMail

public void setEMail(java.lang.String mail)
Sets the new email address


getSEHRHost

public java.lang.String getSEHRHost()
Returns the SEHR server IP

Returns:
incoming server

setSEHRHost

public void setSEHRHost(java.lang.String host)
Sets the new SEHR server IP


getSEHRPort

public int getSEHRPort()
Returns the server's port number

Returns:
server's port number

getSEHRConnectionDriver

public java.lang.String getSEHRConnectionDriver()

setSEHRConnectionDriver

public void setSEHRConnectionDriver(java.lang.String connectionDriver)

getSEHRAccount

public java.lang.String getSEHRAccount()

setSEHRAccount

public void setSEHRAccount(java.lang.String account)

getSEHRAccountPw

public java.lang.String getSEHRAccountPw()

setSEHRAccountPw

public void setSEHRAccountPw(java.lang.String accountPw)

getSEHRZone

public java.lang.String getSEHRZone()

setSEHRZone

public void setSEHRZone(java.lang.String zone)

getUIMail

public java.lang.String getUIMail()

setUIMail

public void setUIMail(java.lang.String mail)

setSEHRPort

public void setSEHRPort(int port)

setIncomingPort

public void setIncomingPort(int port)
Sets the new server's port number

Parameters:
port -

getLogin

public java.lang.String getLogin()
Returns the (account/profile) login

Returns:
login

setLogin

public void setLogin(java.lang.String login)
Sets the new login

Parameters:
login -

getPassword

public java.lang.String getPassword()
Returns the password

Returns:
password

setPassword

public void setPassword(java.lang.String password)
Sets the new password

Parameters:
password - new password

isLDAPAccount

public boolean isLDAPAccount()
Tells wether this profile uses LDAP

Returns:
boolean

setLDAPAccount

public void setLDAPAccount(boolean ldap)
Sets the ldapUser boolean


setBaseInfos

public void setBaseInfos(java.lang.String profilename,
                         java.lang.String reqmail,
                         java.lang.String SEHRHost,
                         int SEHRPort,
                         java.lang.String login,
                         java.lang.String password,
                         boolean ldapaccount,
                         java.util.Vector mailfilters,
                         java.util.Vector addresses)
Sets basic infos for the profile at once

Parameters:
SEHRHost -
SEHRPort -
login -
password -
ldapaccount -

getUrl

public java.lang.String getUrl()
Returns the LDAP server's url

Returns:
LDAP server's url

setUrl

public void setUrl(java.lang.String url)
Sets the new LDAP server's url

Parameters:
url - the new LDAP server's url

getPort

public int getPort()
Returns the LDAP server's port number

Returns:
LDAP server's port number

setPort

public void setPort(int port)
Sets the new LDAP server's port number

Parameters:
port - the new LDAP server's port number

getSuffix

public java.lang.String getSuffix()
Returns the suffix used in LDAP queries

Returns:
suffix used in LDAP queries

setSuffix

public void setSuffix(java.lang.String suffix)
Sets the new suffix

Parameters:
suffix - the new suffix used in LDAP queries

getAddSuffixToURL

public boolean getAddSuffixToURL()
Returns the addSuffixToURL boolean

Returns:
addSuffixToURL boolean

setAddSuffixToURL

public void setAddSuffixToURL(boolean addSuffixToURL)
Sets the value of addSuffixToURL

Parameters:
addSuffixToURL - new value of addSuffixToURL

getAddSuffixToBase

public boolean getAddSuffixToBase()
Returns the addSuffixToBase boolean

Returns:
addSuffixToBase boolean

setAddSuffixToBase

public void setAddSuffixToBase(boolean addSuffixToBase)
Sets the value of addSuffixToBase

Parameters:
addSuffixToBase - new value of addSuffixToBase

getAddSuffixToLogin

public boolean getAddSuffixToLogin()
Returns the addSuffixToLogin boolean

Returns:
addSuffixToLogin boolean

setAddSuffixToLogin

public void setAddSuffixToLogin(boolean addSuffixToLogin)
Sets the value of addSuffixToLogin

Parameters:
addSuffixToLogin - new value of addSuffixToLogin

getBase

public java.lang.String getBase()
Returns the base used in LDAP queries

Returns:
base used in LDAP queries

setBase

public void setBase(java.lang.String base)
Sets the base used in LDAP queries

Parameters:
base - new base

getLdapLogin

public java.lang.String getLdapLogin()
Returns the LDAP server login

Returns:
the LDAP login

setLdapLogin

public void setLdapLogin(java.lang.String ldapLogin)
Sets the LDAP login

Parameters:
ldapLogin - new LDAP login

getLdapPassword

public java.lang.String getLdapPassword()
Returns the LDAP server password

Returns:
the LDAP password

setLdapPassword

public void setLdapPassword(java.lang.String ldapPassword)
Sets the LDAP password

Parameters:
ldapPassword - new LDAP password

getLdapNameField

public java.lang.String getLdapNameField()
Returns the name of the "name" field

Returns:
name of the "name" field

setLdapNameField

public void setLdapNameField(java.lang.String ldapNameField)
Sets the name of the "name" field

Parameters:
ldapNameField - new name of the "name" field

getLdapMailField

public java.lang.String getLdapMailField()
Returns the name of the "mail" field

Returns:
name of the "mail" field

setLdapMailField

public void setLdapMailField(java.lang.String ldapMailField)
LDAP: Sets the name of the "mail" field

Parameters:
ldapMailField - new name of the "mail" field

getNbSupFields

public int getNbSupFields()
Returns the number of extra fields

Returns:
number of extra fields

setNbSupFields

public void setNbSupFields(int nbSupFields)
Sets the number of extra fields

Parameters:
nbSupFields - number of extra fields

setLdapInfos

public void setLdapInfos(java.lang.String url,
                         int port,
                         java.lang.String suffix,
                         boolean addSuffixToURL,
                         boolean addSuffixToBase,
                         boolean addSuffixToLogin,
                         java.lang.String base,
                         java.lang.String ldapLogin,
                         java.lang.String ldapPassword,
                         java.lang.String ldapNameField,
                         java.lang.String ldapMailField,
                         int nbSupFields)
Sets the LDAP related infos for the profile

Parameters:
url - LDAP server's url
port - LDAP server's port number
suffix - suffix to be used when querying the LDAP directory
addSuffixToURL - tells wether the suffix must be added to the URL
addSuffixToBase - tells wether the suffix must be added to the base
addSuffixToLogin - tells wether the suffix must be added to the login
base - base to be used when querying the LDAP directory
ldapLogin - LDAP server's login
ldapPassword - LDAP server'password
ldapNameField - name of the "name" field
ldapMailField - name of the "mail" field
nbSupFields - number of extra fields

getSupFields

public java.lang.String[] getSupFields()
Returns the extra fields

Returns:
Vector containing the extra fields

setSupFields

public void setSupFields(java.lang.String[] supFields)
Sets the extra fields

Parameters:
supFields - Vector containing the new extra fields

setSupFieldsVector

public void setSupFieldsVector(java.util.Vector supFields)

getMailFilters

public java.util.Vector getMailFilters()
Returns the filters

Returns:
filters defined in the profile

setFilters

public void setFilters(java.util.Vector filters)
Sets the filters

Parameters:
filters - Vector containing the new filters

getContacts

public java.util.Vector getContacts()
Returns the adresses stored in the profile

Returns:
Vector containing the adresses

getAddressesArray

public ContactItem[] getAddressesArray()

setContacts

public void setContacts(java.util.Vector addresses)
Sets the addresses stored in the profile

Parameters:
addresses - Vector containing the new addresses

getProfiles

public static java.lang.String[] getProfiles(java.lang.String datapath,
                                             boolean filterparent,
                                             DesEncrypter denc)
Get the names of local stored profiles

Returns:
string_profile_array

getParentEntryID

public int getParentEntryID()
Returns:

setParentEntryID

public void setParentEntryID(int parentEntryID)

save

public void save()
Writes the current profile to a local file


save

public void save(java.lang.String datapath,
                 LocalUserProfile p)
Writes the given profile to a local file using the encryption cipher defined/set by profile!


toString

public java.lang.String toString()
Returns the profile name


main

public static void main(java.lang.String[] args)
For testing purposes