}
} // end updateTask() method
public TaskDBVO getDBVO(int taskId) throws RemoteException
{
TaskDBVO tdbvo = new TaskDBVO();
tdbvo.setTaskid("" + taskId);
tdbvo.setActivityID(taskId);
try
{
CVDal dl = new CVDal(dataSource);
dl.setSql("projecttask.gettaskactivity");
dl.setInt(1, taskId);
tdbvo.setActivityID(taskId);
Collection col = dl.executeQuery();
Iterator ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
tdbvo.setTitle((String)hm.get("title"));
tdbvo.setActivityDetails((String)hm.get("details"));
tdbvo.setCreatedBy(((Integer)hm.get("creator")).intValue());
tdbvo.setCreatedOn((Timestamp)hm.get("created"));
if (hm.get("modified") != null)
{
tdbvo.setModifiedOn((Timestamp)hm.get("modified"));
}
if (hm.get("owner") != null)
{
tdbvo.setOwner(((Integer)hm.get("owner")).intValue());
}
if (hm.get("modifiedby") != null)
{
tdbvo.setModifiedBy(((Integer)hm.get("modifiedby")).intValue());
}
if (hm.get("status") != null)
{
tdbvo.setStatus(((Integer)hm.get("status")).intValue());
}
if (hm.get("name") != null)
{
tdbvo.setSelectedStatus((String)hm.get("name"));
}
if (hm.get("start") != null)
{
Object o = hm.get("start");
tdbvo.setStart((java.sql.Timestamp)o);
}
if (hm.get("duedate") != null)
{
Object ox = hm.get("duedate");
tdbvo.setEnd((java.sql.Timestamp)ox);
}
tdbvo.fillAuditDetails(this.dataSource);
}
dl.clearParameters();
dl.setSql("projecttask.gettask");
dl.setInt(1, taskId);
col = dl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("projectid") != null)
{
tdbvo.setProjectID(((Long)hm.get("projectid")).intValue());
}
if (hm.get("parent") != null)
{
tdbvo.setParentID(((Long)hm.get("parent")).intValue());
}
if (hm.get("milestone") != null)
{
tdbvo.setIsMileStone((String)hm.get("milestone"));
}
if (hm.get("percentcomplete") != null)
{
tdbvo.setPercentComplete(((Long)hm.get("percentcomplete")).intValue());
}
if (hm.get("projecttitle") != null)
{
tdbvo.setProjectName((String)hm.get("projecttitle"));
}
if (hm.get("projecttaskcount") != null)
{
tdbvo.setProjectTaskCount(((Integer)hm.get("projecttaskcount")).intValue());
}
} // end if (ite.hasNext())
dl.clearParameters();
dl.setSql("projecttask.gettaskassigned");
dl.setInt(1, taskId);
col = dl.executeQuery();
ite = col.iterator();
while (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("individualid") != null)
{
tdbvo.setAssignedTo(((Long)hm.get("individualid")).intValue(), (String)hm.get("CONCAT(firstname, ' ' , lastname)"));
}
}
dl.clearParameters();
Collection col1 = null;
Iterator ite1 = null;
int activityid = -1;
dl.setSql("projecttask.gettaskalert");
dl.setInt(1, taskId);
col = dl.executeQuery();
ite = col.iterator();
HashMap emaila = new HashMap();
HashMap alerta = new HashMap();
boolean email = false;
boolean alert = false;
while (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("actionid") != null)
{
activityid = ((Long)hm.get("actionid")).intValue();
}
dl.setSql("projecttask.gettaskalertaction");
dl.setInt(1, activityid);
col1 = dl.executeQuery();
ite1 = col1.iterator();
if (ite1.hasNext())
{
Object o = ite1.next();
HashMap hhm = (HashMap)o;
String type = (String)hhm.get("type");
if (type.equals("ALERT"))
{
alert = true;
alerta.put((Long)hm.get("recipient"), (String)hm.get("concat(individual.firstname,' ', individual.lastname)"));
}else if (type.equals("EMAIL")){
email = true;
emaila.put((Long)hm.get("recipient"), hm.get("concat(individual.firstname,' ', individual.lastname)"));
} // end if (type.equals("ALERT"))
} // end if (ite1.hasNext())
} // end while (ite.hasNext())
tdbvo.setAlerta(alerta);
tdbvo.setEmaila(emaila);
dl.clearParameters();
dl.setSql("projecttask.getsubtask");
dl.setInt(1, taskId);
tdbvo.setActivityID(taskId);
col = dl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("ActivityID") != null)
{
if (hm.get("parent") != null)
{
tdbvo.setParentID(((Long)hm.get("projectid")).intValue());
}
}
if (hm.get("milestone") != null)
{
tdbvo.setIsMileStone((String)hm.get("milestone"));
}
} // end if (ite.hasNext())
tdbvo.setSubTasks(col);
dl.clearParameters();
dl.setSql("projecttask.getparenttaskname");
dl.setInt(1, tdbvo.getParentID());
col = dl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("title") != null)
{
tdbvo.setParentTask((String)hm.get("title"));
}
}
dl.clearParameters();
dl.setSql("projecttask.gettaskstatus");
col = dl.executeQuery();
ite = col.iterator();
while (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("statusid") != null)
{
tdbvo.setStat(((Integer)hm.get("statusid")).intValue(), (String)hm.get("name"));
}
}
dl.clearParameters();
int parentId = tdbvo.getParentID();
if (parentId != 0)
{
LinkedHashMap lhm = new LinkedHashMap();
boolean flag = true;
while (flag)
{
dl.setSql("projecttask.gettaskparent");
dl.setInt(1, parentId);
col = dl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
lhm.put("" + parentId, hm.get("title"));
if (hm.get("parent") != null)
{
parentId = ((Long)hm.get("parent")).intValue();
if (parentId == 0)
{
flag = false;
}
}else{
flag = false;
}
} // end if (ite.hasNext())
} // end while (flag)
tdbvo.setCrumbs(lhm);
}
dl.clearParameters();
dl.destroy();
}catch (Exception e){
System.out.println("[Exception][TaskEJB.getDBVO] Exception Thrown: " + e);