{
String dataSource = Settings.getInstance().getSiteInfo(
CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
int eventid = 0;
MarketingFacadeHome mfh = (MarketingFacadeHome)CVUtility.getHomeObject(
"com.centraview.marketing.marketingfacade.MarketingFacadeHome", "MarketingFacade");
try {
DynaActionForm dynaForm = (DynaActionForm)form;
String strEventid = (String)dynaForm.get("eventid");
String strName = (String)dynaForm.get("name");
String strDescription = (String)dynaForm.get("description");
String strWhoShouldAttend = (String)dynaForm.get("whoshouldattend");
String strMaxAttendee = "0";
if ((dynaForm.get("maxattendees") != null) && (!(dynaForm.get("maxattendees").equals("")))) {
strMaxAttendee = (String)dynaForm.get("maxattendees");
}
String strModerator = (String)dynaForm.get("moderatorid");
// call ejb to insert record
// initialize hashmap
HashMap mapEvent = new HashMap();
mapEvent.put("eventid", strEventid);
mapEvent.put("Name", strName);
mapEvent.put("Description", strDescription);
mapEvent.put("WhoShouldAttend", strWhoShouldAttend);
mapEvent.put("MaxAttendees", strMaxAttendee);
mapEvent.put("Moderator", strModerator);
if ((dynaForm.get("startmonth") != null) && (dynaForm.get("startday") != null)
&& (dynaForm.get("startyear") != null)) {
String startmonth = (String)dynaForm.get("startmonth");
String startday = (String)dynaForm.get("startday");
String startyear = (String)dynaForm.get("startyear");
String startTime = (String)dynaForm.get("starttime");
try {
Timestamp start = DateUtility.createTimestamp(startyear, startmonth, startday, startTime);
mapEvent.put("StartDate", start);
} catch (Exception e) {
logger.error("[execute] SaveEventHandler saveEvent thrown.", e);
}
}
if ((dynaForm.get("endmonth") != null) && (dynaForm.get("endday") != null)
&& (dynaForm.get("endyear") != null)) {
String endmonth = (String)dynaForm.get("endmonth");
String endday = (String)dynaForm.get("endday");
String endyear = (String)dynaForm.get("endyear");
String endTime = (String)dynaForm.get("endtime");
try {
Timestamp end = DateUtility.createTimestamp(endyear, endmonth, endday, endTime);
mapEvent.put("EndDate", end);
} catch (Exception e) {
logger.error("[execute] SaveEventHandler saveEvent thrown.", e);
}
}
HttpSession session = request.getSession();
int individualID = ((UserObject)session.getAttribute("userobject")).getIndividualID();
mapEvent.put("Creator", "" + individualID);
// call to marketing facade
MarketingFacade remote = mfh.create();
remote.setDataSource(dataSource);
String[] attchmentids = request.getParameterValues("attachfile");
mapEvent.put("Attachment", attchmentids);