* @param activityid int
* @return LiteratureDetails
*/
public LiteratureDetails getLiteratureDetails(int activityID,int individualID)
{
LiteratureDetails literatureDetails = new LiteratureDetails();
CVDal cvdal = new CVDal(dataSource);
Collection colDetails = null;
try
{
InitialContext ic = CVUtility.getInitialContext();
ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
remote.setDataSource(dataSource);
ActivityVO actVo = new ActivityVO();
actVo = remote.getActivity(activityID,individualID);
literatureDetails.setDuebydate(actVo.getActivityDueDate());
if(actVo.getEntityID() != 0){
literatureDetails.setEntityid(actVo.getEntityID());
literatureDetails.setEntityname(actVo.getEntityName());
}
if(actVo.getIndividualID() != 0){
literatureDetails.setIndividualid(actVo.getIndividualID());
literatureDetails.setIndividualname(actVo.getIndividualName());
}
if(actVo.getTitle() != null){
literatureDetails.setDetail(actVo.getTitle());
}
if(actVo.getActivityDetails() != null){
literatureDetails.setTitle(actVo.getActivityDetails());
}
literatureDetails.setStatusid(actVo.getStatus());
String selectQuery = " SELECT lr.deliverymethod deliveryMethod, " +
" lr.requestedby requestedBy, concat(req.firstname, ' ' , req.lastname) requestedByName " +
" FROM literaturerequest lr " +
" LEFT OUTER JOIN individual req ON (lr.requestedby = req.individualid) " +
" WHERE lr.activityid = ?";
cvdal.setSqlQuery(selectQuery);
cvdal.setInt(1,activityID);
colDetails = cvdal.executeQuery();
if(colDetails != null && colDetails.size() != 0){
Iterator it = colDetails.iterator();
while (it.hasNext())
{
HashMap mapResult = (HashMap)it.next();
literatureDetails.setAssignedtoid(Integer.parseInt(mapResult.get("requestedBy").toString()));
literatureDetails.setAssignedtoname((String)mapResult.get("requestedByName"));
literatureDetails.setDeliveryid(Integer.parseInt(mapResult.get("deliveryMethod").toString()));
}//end of while (it.hasNext())
}//end of if(colDetails != null && colDetails.size() != 0)
colDetails = null;
cvdal.setSqlQueryToNull();
cvdal.clearParameters();
selectQuery = " SELECT lrl.literatureid , l.title FROM literaturerequestlink lrl "+
" LEFT OUTER JOIN literature l ON (lrl.literatureid = l.literatureid) "+
" WHERE lrl.activityid = ? ";
cvdal.setSqlQuery(selectQuery);
cvdal.setInt(1,activityID);
colDetails = cvdal.executeQuery();
String literatureId = "";
String literatureName = "";
if(colDetails != null && colDetails.size() != 0){
Iterator it = colDetails.iterator();
while (it.hasNext())
{
HashMap mapResult = (HashMap)it.next();
literatureId += ((Number)mapResult.get("literatureid")).intValue()+",";
literatureName += (String)mapResult.get("title")+",";
}//end of while (it.hasNext())
}//end of if(colDetails != null && colDetails.size() != 0)
literatureDetails.setLiteratureId(literatureId);
literatureDetails.setLiteratureName(literatureName);
}
catch(Exception e)
{
logger.error("[execute] Exception thrown.", e);