if ((undoneResource1 == null) || !undoneResource2.getRootPath().equals(undoneResource1.getRootPath())) { try { links = linkParseable.parseLinks(cms, cms.readFile(undoneResource2)); } catch (CmsException e) { if (LOG.isWarnEnabled()) {
if ((undoneResource1 == null) || !undoneResource2.getRootPath().equals(undoneResource1.getRootPath())) { try { links = linkParseable.parseLinks(cms, cms.readFile(undoneResource2)); } catch (CmsException e) { if (LOG.isWarnEnabled()) {
/** * Creates the relation information for the resource with the given resource name.<p> * * @param cms the cms context * @param securityManager the security manager * @param resourceName the resource name of the resource to update the relations for * * @return the fresh read resource * * @throws CmsException if something goes wrong */ protected CmsResource createRelations(CmsObject cms, CmsSecurityManager securityManager, String resourceName) throws CmsException { CmsResource resource = securityManager.readResource( cms.getRequestContext(), resourceName, CmsResourceFilter.ALL); I_CmsResourceType resourceType = getResourceType(resource); List links = null; if (resourceType instanceof I_CmsLinkParseable) { I_CmsLinkParseable linkParseable = (I_CmsLinkParseable)resourceType; links = linkParseable.parseLinks(cms, cms.readFile(resource)); } securityManager.updateRelationsForResource(cms.getRequestContext(), resource, links); return resource; }
/** * Creates the relation information for the resource with the given resource name.<p> * * @param cms the cms context * @param securityManager the security manager * @param resourceName the resource name of the resource to update the relations for * * @return the fresh read resource * * @throws CmsException if something goes wrong */ protected CmsResource createRelations(CmsObject cms, CmsSecurityManager securityManager, String resourceName) throws CmsException { CmsResource resource = securityManager.readResource( cms.getRequestContext(), resourceName, CmsResourceFilter.ALL); I_CmsResourceType resourceType = getResourceType(resource); List<CmsLink> links = null; if (resourceType instanceof I_CmsLinkParseable) { I_CmsLinkParseable linkParseable = (I_CmsLinkParseable)resourceType; links = linkParseable.parseLinks(cms, cms.readFile(resource)); } securityManager.updateRelationsForResource(cms.getRequestContext(), resource, links); return 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<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))); }
if (type instanceof I_CmsLinkParseable) { // this check is needed because of type change links = ((I_CmsLinkParseable)type).parseLinks(cms, file);