com.knowgate.addrbook
Class Fellow

java.lang.Object
  extended by com.knowgate.dataobjs.DBPersist
      extended by com.knowgate.addrbook.Fellow
All Implemented Interfaces:
java.io.Serializable, java.util.Map

public class Fellow
extends DBPersist

Enterprise Fellow

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static short ClassId
           
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
Fellow()
           
Fellow(JDCConnection oConn, java.lang.String sFellowId)
          Construct object and load fields from database.
Fellow(java.lang.String sFellowId)
          Construct object and set gu_fellow field.
 
Method Summary
 void clone(DBPersist oUsr)
          Create a fellow from a ACLUser or from another fellow The fellow is internally stored at this object but NOT persisted to database.
 boolean delete(JDCConnection oConn)
          Delete a register from database The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.
static boolean delete(JDCConnection oConn, java.lang.String sFellowGUID)
          Delete Fellow Calls k_sp_del_fellow stored procedure
 java.lang.String getMeetingAt(JDCConnection oConn, java.util.Date dtAt)
          Get meeting for this user at the given date and time (if any) If the fellow is attending to several meetings at the given time, only the first one is returned.
 java.lang.String getMeetingAt(JDCConnection oConn, java.util.Date dtFrom, java.util.Date dtTo)
          Get meeting for this user at the given time interval (if any) If the fellow is attending to several meetings at the given time, only the first one is returned.
 byte[] getPhoto(java.sql.Connection oConn)
          Get Fellow Photo as a byte array
 boolean hasPhoto(JDCConnection oConn)
           
 boolean isAvailableAt(JDCConnection oConn, java.util.Date dtAt)
          Check whether this Fellow is available at the given time This function checks both the Working Calendar for the fellow (if any) and the meetings to which he attends, for determining if he is available.
 boolean isAvailableAt(JDCConnection oConn, java.util.Date dtFrom, java.util.Date dtTo)
          Check whether this Fellow is available at the given time interval This function checks both the Working Calendar for the fellow (if any) and the meetings to which he attends, for determining if he is available.
 boolean load(java.sql.Connection oConn, java.lang.Object[] PKVals)
          Load Fellow This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.
 boolean load(JDCConnection oConn, java.lang.Object[] PKVals)
          Load Fellow This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.
 boolean load(JDCConnection oConn, java.lang.String sGuFellow)
          Load Fellow This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.
 boolean store(JDCConnection oConn)
          Store Fellow This method extends the base DBPersist.load() by automatically creating a value for gu_fellow if none is suplied and updating dt_modified to current date.
 java.lang.String vCard(java.sql.Connection oConn)
           
 
Methods inherited from class com.knowgate.dataobjs.DBPersist
allcaps, allcaps, changelog, clear, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

ClassId

public static final short ClassId
See Also:
Constant Field Values
Constructor Detail

Fellow

public Fellow()

Fellow

public Fellow(java.lang.String sFellowId)
Construct object and set gu_fellow field. Object is not fully loaded from database.

Parameters:
sFellowId - Fellow Unique Identifier

Fellow

public Fellow(JDCConnection oConn,
              java.lang.String sFellowId)
       throws java.sql.SQLException

Construct object and load fields from database.

Parameters:
oConn - database Connection
sFellowId - Fellow Unique Identifier
Throws:
java.sql.SQLException
Method Detail

clone

public void clone(DBPersist oUsr)

Create a fellow from a ACLUser or from another fellow

The fellow is internally stored at this object but NOT persisted to database.

Overrides:
clone in class DBPersist
Parameters:
oUsr - ACLUser Identifier or Fellow identifier.

hasPhoto

public boolean hasPhoto(JDCConnection oConn)
                 throws java.sql.SQLException
Parameters:
oConn - Database Connection
Returns:
true if Fellow has an associated record at k_fellows_attach table

Throws:
java.sql.SQLException

getPhoto

public byte[] getPhoto(java.sql.Connection oConn)
                throws java.sql.SQLException

Get Fellow Photo as a byte array

Parameters:
oConn - JDBC Connection
Returns:
Byte Array or null if Fellow does not have a photograph.
Throws:
java.sql.SQLException

load

public boolean load(java.sql.Connection oConn,
                    java.lang.Object[] PKVals)
             throws java.sql.SQLException

Load Fellow

This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.

Parameters:
oConn - Database connection
PKVals - A String array with a single element containing GUID of Fellow to be loaded
Returns:
true if Fellow was found k_fellows table
Throws:
java.sql.SQLException

load

public boolean load(JDCConnection oConn,
                    java.lang.Object[] PKVals)
             throws java.sql.SQLException

Load Fellow

This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.

Overrides:
load in class DBPersist
Parameters:
oConn - Database connection
PKVals - A String array with a single element containing GUID of Fellow to be loaded
Returns:
true if Fellow was found k_fellows table
Throws:
java.sql.SQLException

load

public boolean load(JDCConnection oConn,
                    java.lang.String sGuFellow)
             throws java.sql.SQLException

Load Fellow

This method extends the base DBPersist.load() by reading data from k_fellows, k_fellows_attach and k_users and putting all columns into the internal column Map of this instance.

Overrides:
load in class DBPersist
Parameters:
oConn - Database connection
sGuFellow - GUID of Fellow to be loaded
Returns:
true if Fellow was found k_fellows table
Throws:
java.sql.SQLException

store

public boolean store(JDCConnection oConn)
              throws java.sql.SQLException

Store Fellow

This method extends the base DBPersist.load() by automatically creating a value for gu_fellow if none is suplied and updating dt_modified to current date. It does not write any data to k_users nor k_fellows_attach tables.

Overrides:
store in class DBPersist
Parameters:
oConn - Database connection
Returns:
boolean true if register was stored for the first time, false if register already existed.
Throws:
java.sql.SQLException

isAvailableAt

public boolean isAvailableAt(JDCConnection oConn,
                             java.util.Date dtAt)
                      throws java.sql.SQLException

Check whether this Fellow is available at the given time

This function checks both the Working Calendar for the fellow (if any) and the meetings to which he attends, for determining if he is available.

Parameters:
oConn - Database Connection
dtAt - Date and Time to be checked for availability
Returns:
boolean true if given date is within working time of Fellow and he is not attending to any other meeting right then.
Throws:
java.sql.SQLException
Since:
4.0

isAvailableAt

public boolean isAvailableAt(JDCConnection oConn,
                             java.util.Date dtFrom,
                             java.util.Date dtTo)
                      throws java.sql.SQLException

Check whether this Fellow is available at the given time interval

This function checks both the Working Calendar for the fellow (if any) and the meetings to which he attends, for determining if he is available.

Parameters:
oConn - Database Connection
dtFrom - Start Date and Time to be checked for availability
dtTo - End Date and Time to be checked for availability
Returns:
boolean true if given date is within working time of Fellow and he is not attending to any other meeting right then.
Throws:
java.sql.SQLException
Since:
4.0

getMeetingAt

public java.lang.String getMeetingAt(JDCConnection oConn,
                                     java.util.Date dtAt)
                              throws java.sql.SQLException

Get meeting for this user at the given date and time (if any)

If the fellow is attending to several meetings at the given time, only the first one is returned.

Parameters:
oConn - Database Connection
dtAt - Date and Time to be checked for availability
Returns:
String GUID of Meeting or null if Fellow is not attending to any Meeting at that time
Throws:
java.sql.SQLException
Since:
4.0

getMeetingAt

public java.lang.String getMeetingAt(JDCConnection oConn,
                                     java.util.Date dtFrom,
                                     java.util.Date dtTo)
                              throws java.sql.SQLException

Get meeting for this user at the given time interval (if any)

If the fellow is attending to several meetings at the given time, only the first one is returned.

Parameters:
oConn - Database Connection
dtFrom - Start Date and Time to be checked for availability
dtTo - End Date and Time to be checked for availability
Returns:
String GUID of Meeting or null if Fellow is not attending to any Meeting at that interval
Throws:
java.sql.SQLException
Since:
4.0

delete

public boolean delete(JDCConnection oConn)
               throws java.sql.SQLException
Description copied from class: DBPersist

Delete a register from database

The deleted register will be the one matching this DBPersist primary key, as set at constructor or load() method.

Overrides:
delete in class DBPersist
Parameters:
oConn - Database connection
Returns:
true if register was successfully erased, false if not.
Throws:
java.sql.SQLException

vCard

public java.lang.String vCard(java.sql.Connection oConn)
                       throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException
Since:
2.1
See Also:
RFC 2426 (Plain Text)
, vCard 2.1 Spec (MS Word format)

delete

public static boolean delete(JDCConnection oConn,
                             java.lang.String sFellowGUID)
                      throws java.sql.SQLException

Delete Fellow

Calls k_sp_del_fellow stored procedure

Parameters:
oConn - Database Connection
sFellowGUID - Identifier of Fellow to delete
Throws:
java.sql.SQLException