// return mapping.findForward(BaseConstants.FWD_INVALID_TOKEN);
//}
ServletContext sCtx = request.getSession().getServletContext();
ActionMessages msgs = new ActionMessages();
SystemConfigForm systemConfigForm = (SystemConfigForm) form;
SystemConfigVO systemConfigVO = new SystemConfigVO();
BeanUtils.copyProperties(systemConfigVO, systemConfigForm);
try{
DateTime dt = new DateTime();
int year = dt.getYear();
// Admin
//INSERT INTO MYALUMNI_MEMBERS_TBL (USER_NAME,MEMBER_ID,MEMBER_STATUS,MEMBER_PASSWORD,EMAIL,FIRST_IP_ADDRESS,LAST_IP_ADDRESS,
//CREATION_DATE,LAST_LOGON_DATE,TITLE,NICK_NAME,FIRST_NAME,LAST_NAME,GENDER,FIRST_EMAIL,COUNTRY,YEAR_IN,YEAR_OUT,IS_ADMIN,HIDE_EMAIL,HIDE_ADDRESS,HIDE_PHONE,HIDE_IM,PROMPT_CHANGE,LASTMODIFICATION,LASTMODIFIED_BY,LASTMODIFIED_DATE ) VALUES ('sysadmin', '999999999999999999999999999999','A','X03MO1qnZdYdgyfeuILPmQ==','myalumni@naijatek.com','127.0.0.1','127.0.0.1',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'1000000004999','NickName','FirstName','LastName','U','myalumni@naijatek.com','1000000003999','2007','2007','Y','Y','Y','Y','Y','Y','A','SYSTEM',CURRENT_TIMESTAMP);
MemberVO memberVO = new MemberVO();
memberVO.setMemberUserName(systemConfigVO.getMemberUserName());
memberVO.setLastName(systemConfigVO.getMemberLastName());
memberVO.setFirstName(systemConfigVO.getMemberFirstName());
memberVO.setEmail(systemConfigVO.getMemberEmail());
memberVO.setMemberPassword(systemConfigVO.getMemberPassword());
memberVO.setNickName("");
memberVO.setGender(BaseConstants.GENDER_UNKNOWN);
memberVO.setCountryId("1000000003999");
memberVO.setTitleId("1000000004999");
memberVO.setCareerId("1000000001999");
memberVO.setDormitoryId("1000000005999");
memberVO.setYearIn(year);
memberVO.setYearOut(year);
memberVO.setLastModifiedBy("system");
// create admin
memberService.createAdminMember(memberVO, request);
final String memberId = memberVO.getMemberId();
String[] s = new String[0];
memberVO.setLstSelectedIMs(s);
// Messengers
List<MessengerVO> messengers = new ArrayList<MessengerVO>();
MessengerVO mesgerVO = null;
for(String str : memberVO.getLstSelectedIMs()){
mesgerVO = new MessengerVO();
mesgerVO.setLastModifiedBy(memberVO.getMemberUserName());
mesgerVO.setMemberId(memberId);
mesgerVO.setLookupCodeId(str);
messengers.add(mesgerVO);
}
messengerService.saveAll(messengers, memberId);
// Message Folders
mfService.createMemberMessageFolders(memberId, SystemConfigConstants.MESSAGE_FOLDERS, memberVO.getMemberUserName());
StringBuffer message = new StringBuffer();
message.append("Thank you " + StringUtil.capitalize(memberVO.getFirstName()) + " " + StringUtil.capitalize(memberVO.getLastName()) + " for setting up MyAlumni and Welcome to " + systemConfigVO.getOrganizationName() + "'s owns space in cyberspace.");
setSessionObject(request, BaseConstants.MESSAGE, message.toString());
// send email to registrant
try {
SendMailUtil.sendWelcomeNotice(memberVO.getEmail(), memberVO.getMemberUserName(),systemConfigVO);
}
catch (Exception ex) {
logger.error(ex.getMessage());
msgs.add(BaseConstants.FATAL_KEY, new ActionMessage("error.mailserver"));
saveMessages(request, msgs);
}
// Scroll
ScrollVO scrollVO = new ScrollVO();
scrollVO.setLastModifiedBy("system");
scrollVO.setScrollId(null);
scrollVO.setPriority(BaseConstants.BOOLEAN_YES);
scrollVO.setScrollText("Welcome to " + systemConfigVO.getOrganizationName());
systemConfigService.addScroll(scrollVO);
sCtx.setAttribute(BaseConstants.SCROLL_VO, scrollVO);
systemConfigService.setupIntialization(systemConfigVO);
sCtx.setAttribute(BaseConstants.ORGANIZATION_NAME, systemConfigVO.getOrganizationName());
sCtx.setAttribute(BaseConstants.ORGANIZATION_SHORT_NAME, systemConfigVO.getOrganizationShortName());
sCtx.setAttribute(BaseConstants.ORG_EMAIL, systemConfigVO.getOrgEmail());
sCtx.setAttribute(BaseConstants.ALBUM_URL, systemConfigVO.getAlbumUrl());
sCtx.setAttribute(BaseConstants.FORUM_URL, systemConfigVO.getForumUrl());
sCtx.setAttribute(BaseConstants.SERVER_URL, systemConfigVO.getServerUrl());
sCtx.setAttribute(BaseConstants.FIRST_STARTUP, BaseConstants.BOOLEAN_NO);
}
catch (DuplicateMemberException e) {
msgs.add(BaseConstants.WARN_KEY, new ActionMessage("error.duplicate.member"));