com.knowgate.projtrack
Class Project

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

public class Project
extends DBPersist

Project

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
Project()
          Create empty an Project
Project(JDCConnection oConn, java.lang.String sPrjId)
           
Project(java.lang.String sPrjId)
          Create empty an Project and set gu_project.
 
Method Summary
 java.lang.String clone(JDCConnection oConn)
          Clone Project When a project is cloned all its subprojects, duites and bugs are also cloned.
 float cost(JDCConnection oConn)
          Compute total project cost Total project cost is the sum of costs of all duties from the project
This method call stored procedure k_sp_prj_cost
 boolean delete(JDCConnection oConn)
          Delete Project.
static boolean delete(JDCConnection oConn, java.lang.String sProjectGUID)
          Delete Project.
 void expand(JDCConnection oConn)
          Expand Project childs.
 DBSubset getAllChilds(JDCConnection oConn)
          Get all Project Childs as a DBSubset.
 boolean load(JDCConnection oConn, java.lang.Object[] PKVals)
          Load Project.
 boolean load(JDCConnection oConn, java.lang.String sGuProject)
          Load Project.
static void setEndDate(JDCConnection oConn, java.lang.String sProjectGUID, java.util.Date oDt)
          Set end date for a project.
 ProjectSnapshot snapshot(JDCConnection oConn)
          Get snapshot view of the whole project
 boolean store(JDCConnection oConn)
          Store Project If gu_project is null a new GUID is automatically assigned.
 java.lang.String topParent(JDCConnection oConn)
          Get Project Top Parent.
 java.lang.String toXML(JDCConnection oConn, java.lang.String sIdent, java.lang.String sDelim, java.util.HashMap oAttrs)
           
 
Methods inherited from class com.knowgate.dataobjs.DBPersist
allcaps, allcaps, changelog, clear, clone, 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

Project

public Project()
Create empty an Project


Project

public Project(java.lang.String sPrjId)
Create empty an Project and set gu_project. No data is loaded from database.

Parameters:
sPrjId - Project Unique Identifier.

Project

public Project(JDCConnection oConn,
               java.lang.String sPrjId)
        throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

topParent

public java.lang.String topParent(JDCConnection oConn)
                           throws java.sql.SQLException
Get Project Top Parent. Browse recursively k_projects table until finding the top most parent for Project.

Parameters:
oConn - Database Connection
Returns:
GUID of top most parent Project or null if this is a top Project.
Throws:
java.sql.SQLException

clone

public java.lang.String clone(JDCConnection oConn)
                       throws java.sql.SQLException,
                              java.lang.IllegalAccessException

Clone Project

When a project is cloned all its subprojects, duites and bugs are also cloned.

Parameters:
oConn - Database Connection
Returns:
GUID of new cloned Project
Throws:
java.sql.SQLException
java.lang.IllegalAccessException

load

public boolean load(JDCConnection oConn,
                    java.lang.Object[] PKVals)
             throws java.sql.SQLException
Load Project. If Project is assigned to a Company then Company Legal Name (k_companies.nm_legal) is loaded into property DB.tx_company. If Project is assigned to a Contact then Contact Full Name (tx_name+tx_surname) is loaded into property DB.tx_contact.

Overrides:
load in class DBPersist
Parameters:
oConn - JDCConnection
PKVals - Array of one String containing the GUID of the Project to be loaded
Returns:
Throws:
java.sql.SQLException

load

public boolean load(JDCConnection oConn,
                    java.lang.String sGuProject)
             throws java.sql.SQLException
Load Project. If Project is assigned to a Company then Company Legal Name (k_companies.nm_legal) is loaded into property DB.tx_company. If Project is assigned to a Contact then Contact Full Name (tx_name+tx_surname) is loaded into property DB.tx_contact.

Overrides:
load in class DBPersist
Parameters:
oConn - JDCConnection
sGuProject - Project GUID
Returns:
Throws:
java.sql.SQLException
Since:
4.0

delete

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

Delete Project.

Calls k_sp_del_project stored procedure.
Deletion includes Project Childs, Duties and Bugs.

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

store

public boolean store(JDCConnection oConn)
              throws java.sql.SQLException
Store Project If gu_project is null a new GUID is automatically assigned.
Calls internally to expand() method for re-expanding k_project_expand table.

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

cost

public float cost(JDCConnection oConn)
           throws java.sql.SQLException,
                  java.lang.NumberFormatException

Compute total project cost

Total project cost is the sum of costs of all duties from the project
This method call stored procedure k_sp_prj_cost

Parameters:
oConn - Database Connection
Returns:
Sum of all duty costs for project
Throws:
java.sql.SQLException
java.lang.NumberFormatException

getAllChilds

public DBSubset getAllChilds(JDCConnection oConn)
                      throws java.sql.SQLException

Get all Project Childs as a DBSubset.

Parameters:
oConn - Database Connection
Returns:
DBSubset with the following structure:
gu_projectnm_projectod_levelod_walkid_parent
Project GUIDProject NameDepth LevelWalk order within levelInmediate Parent
Throws:
java.sql.SQLException

expand

public void expand(JDCConnection oConn)
            throws java.sql.SQLException

Expand Project childs.

Calls k_sp_prj_expand stored procedure.
Expansion is stored at k_project_expand table.

Parameters:
oConn - Database Connection
Throws:
java.sql.SQLException

toXML

public java.lang.String toXML(JDCConnection oConn,
                              java.lang.String sIdent,
                              java.lang.String sDelim,
                              java.util.HashMap oAttrs)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

snapshot

public ProjectSnapshot snapshot(JDCConnection oConn)
                         throws java.sql.SQLException

Get snapshot view of the whole project

Parameters:
oConn - Database Connection
Returns:
ProjectSnapshot object instance
Throws:
java.sql.SQLException

delete

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

Delete Project.

Calls k_sp_del_project stored procedure.
Deletion includes Project Childs, Duties and Bugs.

Parameters:
oConn - Database Connection
sProjectGUID - GUID of project to be deleted.
Throws:
java.lang.NullPointerException - if sProjectGUID is null
java.sql.SQLException

setEndDate

public static void setEndDate(JDCConnection oConn,
                              java.lang.String sProjectGUID,
                              java.util.Date oDt)
                       throws java.sql.SQLException

Set end date for a project.

This method updates the end date of a project and also the end date of all its parent projects which end date is prior to the one specified.

Parameters:
oConn - Database Connection
sProjectGUID - GUID of project to be deleted.
sDt - End Date.
Throws:
java.sql.SQLException