PortletRequest req = event.getActionRequest();
ActionResponse res = event.getActionResponse();
PortletSession session = req.getPortletSession();
String oid = event.getAction().getParameter("oid");
AccountRequest accountRequest =
accountService.getAccountRequestByOid(oid);
if (accountRequest == null) {
log.error("AccountRequest was already deleted.");
res.setRenderParameter("message", "Account was already deleted.");
return;
}
String[] prevAndNextOids = getPrevAndNextOids(oid);
String prevOid = prevAndNextOids[0];
String nextOid = prevAndNextOids[1];
TextAreaBean adminCommentsBean =
event.getTextAreaBean("adminCommentsBean");
adminCommentsBean.setValue(accountRequest.getAdminComments());
String message = event.getAction().getParameter("message");
if ((message != null) && (!message.equals(""))) {
res.setRenderParameter("message", message);
}
session.setAttribute(ACCOUNT_REQUEST, accountRequest);
session.setAttribute(PREVIOUS_REQUEST, prevOid);
session.setAttribute(NEXT_REQUEST, nextOid);
if (log.isDebugEnabled()) {
log.debug("account_type: " + accountRequest.getAccountType());
}
AccountRequestAttrCollection attrs =
accountService.newAccountRequestAttrCollection(accountRequest.getAccountType());
Map attributes = accountRequest.getAttributes();
for (Iterator itr = attrs.iterator(); itr.hasNext(); ) {
AccountRequestAttr attr = (AccountRequestAttr)itr.next();
Object valueObj = attributes.get(attr.getName());
if (valueObj != null) {
attr.setValue((String)valueObj);