PortletConfig config, ActionRequest req, ActionResponse res)
throws Exception {
String cmd = req.getParameter(Constants.CMD);
String referer = req.getParameter("referer");
ContainerForm fm = (ContainerForm) form;
// wraps request to get session object
ActionRequestImpl reqImpl = (ActionRequestImpl) req;
HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
if ((referer != null) && (referer.length() != 0)) {
referer = URLDecoder.decode(referer, "UTF-8");
}
Logger.debug(this, "EditContainerAction cmd=" + cmd);
// if we are poping up the "add variables" page
if (com.dotmarketing.util.Constants.CONTAINER_ADD_VARIABLE.equals(cmd)) {
setForward(req, "portlet.ext.containers.add_variables");
return;
}
HibernateUtil.startTransaction();
User user = _getUser(req);
try {
Logger.debug(this, "Calling Retrieve method");
_retrieveWebAsset(req, res, config, form, user, Container.class,
WebKeys.CONTAINER_EDIT);
} catch (Exception ae) {
_handleException(ae, req);
return;
}
/*
* We are editing the container or reloading a current one
*/
if ((cmd != null) && (cmd.equals(Constants.EDIT) || cmd.equals(Constants.UPDATE)) ) {
try {
Logger.debug(this, "Calling Edit Method");
_editWebAsset(req, res, config, form, user);
} catch (Exception ae) {
if ((referer != null) && (referer.length() != 0)) {
if (ae.getMessage().equals(WebKeys.EDIT_ASSET_EXCEPTION)) {
// The web asset edit threw an exception because it's
// locked so it should redirect back with message
java.util.Map<String, String[]> params = new java.util.HashMap<String, String[]>();
params.put("struts_action",
new String[] { "/ext/director/direct" });
params.put("cmd", new String[] { "editContainer" });
params.put("container", new String[] { req
.getParameter("inode") });
params.put("referer", new String[] { URLEncoder.encode(
referer, "UTF-8") });
String directorURL = com.dotmarketing.util.PortletURLUtil
.getActionURL(httpReq, WindowState.MAXIMIZED
.toString(), params);
_sendToReferral(req, res, directorURL);
return;
}
}
_handleException(ae, req);
return;
}
}
/*
* If we are updating the container, copy the information from the
* struts bean to the hbm inode and run the update action and return to
* the list
*/
if ((cmd != null) && cmd.equals(Constants.ADD)) {
try {
String note = fm.getNotes();
if (Validator.validate(req, form, mapping) && note.length()<=255) {
Logger.debug(this, "Calling Save Method");
_saveWebAsset(req, res, config, form, user);