/** * @see org.opencms.file.types.I_CmsResourceType#writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile) */ public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { if (resource.isFile()) { CmsFile file = securityManager.writeFile(cms.getRequestContext(), resource); I_CmsResourceType type = getResourceType(file); // update the relations after writing!! List<CmsLink> links = null; if (type instanceof I_CmsLinkParseable) { // this check is needed because of type change // if the new type is link parseable links = ((I_CmsLinkParseable)type).parseLinks(cms, file); } // this has to be always executed, even if not link parseable to remove old links securityManager.updateRelationsForResource(cms.getRequestContext(), file, links); return file; } // folders can never be written like a file throw new CmsVfsException( Messages.get().container(Messages.ERR_WRITE_FILE_IS_FOLDER_1, cms.getSitePath(resource))); }
/** * @see org.opencms.file.types.I_CmsResourceType#writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile) */ public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { if (resource.isFile()) { CmsFile file = securityManager.writeFile(cms.getRequestContext(), resource); I_CmsResourceType type = getResourceType(file); // update the relations after writing!! List links = null; if (type instanceof I_CmsLinkParseable) { // if the new type is link parseable links = ((I_CmsLinkParseable)type).parseLinks(cms, file); } securityManager.updateRelationsForResource(cms.getRequestContext(), file, links); return file; } // folders can never be written like a file throw new CmsVfsException(Messages.get().container( Messages.ERR_WRITE_FILE_IS_FOLDER_1, cms.getSitePath(resource))); }