// wraps request to get session object
ActionRequestImpl reqImpl = (ActionRequestImpl) req;
HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
WebAsset webAsset = (WebAsset) req.getAttribute(webKey);
// Checking permissions
_checkUserPermissions(webAsset, user, PERMISSION_READ);
if (InodeUtils.isSet(webAsset.getInode())) {
// calls the asset factory edit
boolean editAsset = WebAssetFactory.editAsset(webAsset, user.getUserId());
if (!editAsset) {
User userMod = null;
try{
userMod = APILocator.getUserAPI().loadUserById(webAsset.getModUser(),APILocator.getUserAPI().getSystemUser(),false);
}catch(Exception ex){
if(ex instanceof NoSuchUserException){
try {
userMod = APILocator.getUserAPI().getSystemUser();
} catch (DotDataException e) {
Logger.error(this,e.getMessage(),e);
}
}
}
if(userMod!=null){
webAsset.setModUser(userMod.getUserId());
}
try {
Company comp = PublicCompanyFactory.getDefaultCompany();
String message = LanguageUtil.get(comp.getCompanyId(), user.getLocale(), "message." + webAsset.getType() + ".edit.locked");
message += " (" + userMod.getEmailAddress() + ")";
SessionMessages.add(httpReq, "custommessage", message);
} catch (Exception e) {
SessionMessages.add(httpReq, "message", "message." + webAsset.getType() + ".edit.locked");
}
throw (new ActionException(WebKeys.EDIT_ASSET_EXCEPTION));
}
}
Folder parentFolder = new Folder();
String parent = req.getParameter("parent");
if (!(WebAssetFactory.isAbstractAsset(webAsset))) {
if (InodeUtils.isSet(webAsset.getInode())) {
parentFolder = APILocator.getFolderAPI().findParentFolder(webAsset, user, false);
} else if(UtilMethods.isSet(parent)){
parentFolder = APILocator.getFolderAPI().find(parent, user, false);
}
}