public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
try {
HashMap hm = new HashMap();
Vector vecView = new Vector();
Vector vecAll = new Vector();
Vector vecSchedule = new Vector();
Vector vecSend = new Vector();
Collection colview = new ArrayList();
Collection colAll = new ArrayList();
Collection colschedule = new ArrayList();
Collection colsend = new ArrayList();
String typeofModule = "";
HttpSession session = request.getSession(true);
com.centraview.common.UserObject userobjectd = (com.centraview.common.UserObject)session.getAttribute("userobject"); //get the user object
int individualId = userobjectd.getIndividualID();
ListGenerator lg = ListGenerator.getListGenerator(dataSource);
String moduleName = "";
typeofModule = (String)request.getParameter("TYPEOFMODULE");
if (typeofModule == null) {
typeofModule = (String)request.getAttribute("TYPEOFMODULE");
}
if (typeofModule == null) {
typeofModule = Constants.EMAILMODULE;
}
if (typeofModule != null) {
if (typeofModule.equals(Constants.ACTIVITYMODULE)) {
moduleName = Constants.ACTIVITYMODULE;
} else if (typeofModule.equals(Constants.EMAILMODULE)) {
moduleName = Constants.EMAILMODULE;
}
}
PreferenceHome prefHome = (PreferenceHome)CVUtility.getHomeObject("com.centraview.preference.PreferenceHome", "Preference");
Preference prefRemote = (Preference)prefHome.create();
prefRemote.setDataSource(dataSource);
if (moduleName.equals(Constants.ACTIVITYMODULE)) {
hm = prefRemote.getUserDelegation(individualId, moduleName);
vecView = (Vector)hm.get(Constants.VIEW);
vecSchedule = (Vector)hm.get(Constants.SCHEDULEACTIVITY);
vecAll = (Vector)hm.get(Constants.VIEWSCHEDULEACTIVITY);
} else if (moduleName.equals(Constants.EMAILMODULE)) {
Vector emailVecSend = prefRemote.getEmailDelegation(individualId);
vecView = (Vector)hm.get(Constants.VIEW);
vecSend = emailVecSend;
vecAll = (Vector)hm.get(Constants.VIEWSENDEMAIL);
}
ContactFacadeHome facadeHome = (ContactFacadeHome)CVUtility.getHomeObject("com.centraview.contact.contactfacade.ContactFacadeHome", "ContactFacade");
ContactFacade cfremote = (ContactFacade) facadeHome.create();
cfremote.setDataSource(dataSource);
// get the records from the database
Collection sqlResults = cfremote.getEmployeeListCollection(individualId);
// now create a DisplayList out of those records
IndividualList employeeList = new IndividualList();
// ok, now that we have the results from the database,
// we need to generate a DisplayList object to pass
// to the List View code (List.jsp)
Iterator iter = sqlResults.iterator();
while (iter.hasNext()) {
HashMap sqlRow = (HashMap)iter.next();
String individualName = (String)sqlRow.get("Name");
int individualID = ((Number)sqlRow.get("IndividualID")).intValue();
IntMember individualIDfield = new IntMember("IndividualID", individualID, 10, "", 'T', false, 10);
StringMember nameField = new StringMember("Name", individualName, 10, "/centraview/ViewHandler.do?" + Constants.TYPEOFCONTACT + "=" + Constants.INDIVIDUAL + "&rowId=" + individualID, 'T', true);