CVDal cvdl = new CVDal(dataSource);
cvdl.setSql("project.getproject");
cvdl.setInt(1, projectId);
Collection col = cvdl.executeQuery();
Iterator ite = col.iterator();
ProjectDBVO pdbvo = new ProjectDBVO();
if (ite.hasNext())
{
HashMap project = (HashMap)ite.next();
pdbvo.setProjectID(((Long)project.get("ProjectID")).intValue());
pdbvo.setTitle((String)project.get("ProjectTitle"));
if (project.get("Description") != null)
pdbvo.setDescription((String)project.get("Description"));
if (project.get("StatusID") != null)
pdbvo.setStatusID(((Long)project.get("StatusID")).intValue());
if (project.get("Start") != null)
pdbvo.setStart((java.sql.Date)project.get("Start"));
if (project.get("End") != null)
pdbvo.setEnd((java.sql.Date)project.get("End"));
if (project.get("BudgetedHours") != null)
pdbvo.setBudgetedHours(((Long)project.get("BudgetedHours")).intValue());
if (project.get("HoursUsed") != null)
pdbvo.setUsedHours(((Long)project.get("HoursUsed")).intValue());
if (project.get("Manager") != null)
pdbvo.setManagerID(((Long)project.get("Manager")).intValue());
if (project.get("Owner") != null)
pdbvo.setOwner(((Long)project.get("Owner")).intValue());
if (project.get("Creator") != null)
pdbvo.setCreator(((Long)project.get("Creator")).intValue());
if (project.get("ModifiedBy") != null)
pdbvo.setModifiedBy(((Long)project.get("ModifiedBy")).intValue());
if (project.get("Modified") != null)
pdbvo.setModified((Timestamp)project.get("Modified"));
if (project.get("Created") != null)
pdbvo.setCreated((Timestamp)project.get("Created"));
}
cvdl.clearParameters();
cvdl.setSql("project.getindname");
cvdl.setInt(1, pdbvo.getCreator());
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setCreatorName((String)hm.get("CONCAT(firstname,' ',lastname)"));
}
cvdl.clearParameters();
cvdl.setSql("project.getindname");
cvdl.setInt(1, pdbvo.getModifiedBy());
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setModifierName((String)hm.get("CONCAT(firstname,' ',lastname)"));
}
cvdl.clearParameters();
cvdl.setSql("project.getprojectentitylink");
cvdl.setInt(1, projectId);
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setEntityID(((Long)hm.get("entityid")).intValue());
pdbvo.setEntityName((String)hm.get("name"));
}
cvdl.clearParameters();
cvdl.setSql("project.getprojectindividuallink");
cvdl.setInt(1, projectId);
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setContactID(((Long)hm.get("individualid")).intValue());
pdbvo.setContactName((String)hm.get("CONCAT(firstname , ' ' , lastname)"));
}
cvdl.clearParameters();
cvdl.setSql("project.getprojectgrouplink");
cvdl.setInt(1, projectId);
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setGroupID(((Long)hm.get("groupid")).intValue());
pdbvo.setGroupName((String)hm.get("name"));
}
cvdl.clearParameters();
cvdl.setSql("project.projecthoursused");
cvdl.setInt(1, projectId);
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
if (hm.get("sum(hours)") != null)
{
pdbvo.setUsedHours(((Double)hm.get("sum(hours)")).floatValue());
}
}
cvdl.clearParameters();
cvdl.setSql("project.getindname");
cvdl.setInt(1, pdbvo.getOwner());
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setOwnerName((String)hm.get("CONCAT(firstname,' ',lastname)"));
}
cvdl.clearParameters();
cvdl.setSql("project.getindname");
cvdl.setInt(1, pdbvo.getManagerID());
col = cvdl.executeQuery();
ite = col.iterator();
if (ite.hasNext())
{
HashMap hm = (HashMap)ite.next();
pdbvo.setManager((String)hm.get("CONCAT(firstname,' ',lastname)"));
}
cvdl.clearParameters();
return pdbvo;
}