{
String dataSource = Settings.getInstance().getSiteInfo(
CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
try {
HttpSession session = request.getSession();
UserObject userObject = (UserObject)session.getAttribute("userobject");
int individualId = userObject.getIndividualID();
String typeOfActivity = "";
// Check the session for an existing error message (possibly from the
// delete handler)
ActionMessages allErrors = (ActionMessages)session.getAttribute("listErrorMessage");
if (allErrors != null) {
saveErrors(request, allErrors);
session.removeAttribute("listErrorMessage");
}
if (request.getParameter(ConstantKeys.TYPEOFACTIVITY) == null) {
// here we can get values all / my / multi, so check if value not equal
// to types of activity
if (!(typeOfActivity.equals(ConstantKeys.APPOINTMENT)
|| typeOfActivity.equals(ConstantKeys.CALL)
|| typeOfActivity.equals(ConstantKeys.FORECASTSALE)
|| typeOfActivity.equals(ConstantKeys.LITERATUREREQUEST)
|| typeOfActivity.equals(ConstantKeys.MEETING)
|| typeOfActivity.equals(ConstantKeys.NEXTACTION)
|| typeOfActivity.equals(ConstantKeys.TODO) || typeOfActivity.equals(ConstantKeys.TASK))) {
ActivityHelperHome home = (ActivityHelperHome)CVUtility.getHomeObject(
"com.centraview.activity.helper.ActivityHelperHome", "ActivityHelper");
try {
ActivityHelper remote = home.create();
remote.setDataSource(dataSource);
String findActivityId = request.getParameter("rowId");
typeOfActivity = remote.getTypeOfActivity(Integer.parseInt(findActivityId))
.toUpperCase();
} catch (Exception e) {
logger.error("[execute]: Exception", e);
}
}
} else if (request.getParameter(ConstantKeys.TYPEOFACTIVITY) != null) {
typeOfActivity = request.getParameter(ConstantKeys.TYPEOFACTIVITY);
// call to activity helper to get typeOfActivity if
// here we get value from "TYPEOFACTIVITYLIST" hidden text box from jsp
// pages
if (!(typeOfActivity.equals(ConstantKeys.APPOINTMENT)
|| typeOfActivity.equals(ConstantKeys.CALL)
|| typeOfActivity.equals(ConstantKeys.FORECASTSALE)
|| typeOfActivity.equals(ConstantKeys.LITERATUREREQUEST)
|| typeOfActivity.equals(ConstantKeys.MEETING)
|| typeOfActivity.equals(ConstantKeys.NEXTACTION)
|| typeOfActivity.equals(ConstantKeys.TODO) || typeOfActivity.equals(ConstantKeys.TASK))) {
ActivityHelperHome home = (ActivityHelperHome)CVUtility.getHomeObject(
"com.centraview.activity.helper.ActivityHelperHome", "ActivityHelper");
try {
ActivityHelper remote = home.create();
remote.setDataSource(dataSource);
String findActivityId = request.getParameter("rowId");
typeOfActivity = remote.getTypeOfActivity(Integer.parseInt(findActivityId))
.toUpperCase();
} catch (Exception e) {
logger.error("[execute]: Exception", e);
}
} else {
typeOfActivity = request.getParameter(ConstantKeys.TYPEOFACTIVITY).toUpperCase();
}
} else {
// Something tells me, we'll NEVER reach this point!!!
typeOfActivity = ConstantKeys.APPOINTMENT;
}
if (typeOfActivity.equals("NEXT ACTION")) {
typeOfActivity = ConstantKeys.NEXTACTION;
} else if (typeOfActivity.equals("TO DO")) {
typeOfActivity = ConstantKeys.TODO;
}
// set request to pass to jsp
request.setAttribute(ConstantKeys.TYPEOFACTIVITY, typeOfActivity);
// set default opening window to detail sub-type activity
request.setAttribute(ConstantKeys.TYPEOFSUBACTIVITY, ConstantKeys.DETAIL);
request.setAttribute(ConstantKeys.TYPEOFOPERATION, ConstantKeys.EDIT);
request.setAttribute("actionName", "");
String currTimeZone = userObject.getUserPref().getTimeZone();
String findActivityId = request.getParameter("rowId");
ActivityVO activityVO = new ActivityVO();
ActivityFacadeHome aa = (ActivityFacadeHome)CVUtility.getHomeObject(
"com.centraview.activity.activityfacade.ActivityFacadeHome", "ActivityFacade");
ActivityFacade remote = aa.create();
remote.setDataSource(dataSource);
activityVO = remote.getActivity(Integer.parseInt(findActivityId), individualId);
activityVO.changeTimeZoneOfAllDates("EST", currTimeZone);
ActivityForm actFrm = (ActivityForm)form;
ActivityGenericFillVOX agf = new ActivityGenericFillVOX();
actFrm.setLocale(request.getLocale());
actFrm = agf.fillBasicForm(activityVO, actFrm);
request.setAttribute("activityform", actFrm);
session.setAttribute("activityform", actFrm);
request.setAttribute("RECORDOPERATIONRIGHT", new Integer(CVUtility.getRecordPermission(
individualId, "Activities", activityVO.getActivityID(), dataSource)));
FORWARD_final = FORWARD_view;
} catch (Exception e) {