//wraps request to get session object
ActionRequestImpl reqImpl = (ActionRequestImpl) req;
HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
LinkForm linkForm = (LinkForm) form;
//gets the new information for the link from the request object
Link link = new Link();
link.setTitle(((LinkForm) form).getTitle());
BeanUtils.copyProperties(link,form);
req.setAttribute(WebKeys.LINK_FORM_EDIT,link);
boolean previousShowMenu = link.isShowOnMenu();
//gets the current link being edited from the request object
Link currentLink = (Link) req.getAttribute(WebKeys.LINK_EDIT);
//parent folder or inode for this file
Folder parent = APILocator.getFolderAPI().find(req.getParameter("parent"), user, false);
//http://jira.dotmarketing.net/browse/DOTCMS-5899
if(UtilMethods.isSet(currentLink.getInode())){
Identifier id = APILocator.getIdentifierAPI().find(currentLink);
String URI = id.getURI();
String uriPath = URI.substring(0,URI.lastIndexOf("/")+1);
if(!uriPath.equals(APILocator.getIdentifierAPI().find(parent).getPath())){
id.setURI(APILocator.getIdentifierAPI().find(parent).getPath()+currentLink.getProtocal() + currentLink.getUrl());
APILocator.getIdentifierAPI().save(id);
}
}
//Checking permissions
_checkPermissions(currentLink, parent, user, httpReq);
//gets user id from request for mod user
String userId = user.getUserId();
// take care of internal links
if (InodeUtils.isSet(linkForm.getInternalLinkIdentifier())) {
Identifier internalLinkIdentifier = identifierAPI.findFromInode(linkForm.getInternalLinkIdentifier());
//link.setLinkType(LinkType.INTERNAL.toString());
link.setInternalLinkIdentifier(internalLinkIdentifier.getInode());
link.setProtocal("http://");
StringBuffer myURL = new StringBuffer();