/** * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return getResource().hashCode(); }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CmsDocumentDependency) { CmsDocumentDependency other = (CmsDocumentDependency)obj; return m_resource.getRootPath().equals(other.getResource().getRootPath()) && m_locale.equals(other.m_locale); } return false; }
/** * Stores this dependency object for a published resource in the OpenCms runtime context.<p> * * This done to optimize indexing speed. When the index update information is calculated, * all dependencies for a resource must be calculated also. The same information is later needed when * the Lucene document is created, for example in order to store the list of other available languages.<p> * * @param cms the current OpenCms user context */ public void storeInContext(CmsObject cms) { cms.getRequestContext().setAttribute(getAttributeKey(getResource().getRootPath()), this); }
/** * Reads all dependencies that exist for this main resource in the OpenCms VFS.<p> * * To be used when incremental updating an index.<p> * * @param cms the current users OpenCms context */ public void readDependencies(CmsObject cms) { try { // read all resources in the parent folder of the published resource List<CmsResource> folderContent = cms.getResourcesInFolder( CmsResource.getParentFolder(cms.getRequestContext().removeSiteRoot(getResource().getRootPath())), CmsResourceFilter.DEFAULT); // now calculate the dependencies form the folder content that has been read readDependencies(cms, folderContent); } catch (CmsException e) { LOG.warn("Unable to read dependencies for " + getResource().getRootPath(), e); } }
pub = depIt.next().getResource(); } else { dep = null;
CmsResource r = i.next(); if (r.isFile() && !getResource().getRootPath().equals(r.getRootPath())) { CmsPublishedResource pubRes = new CmsPublishedResource( r, getResource().getPublishTag(), CmsResourceState.STATE_CHANGED); CmsDocumentDependency dep = new CmsDocumentDependency(pubRes); mainFileName += getMainDocument().getDocumentSuffix(); if (mainFileName.equals(var.getResource().getRootPath())) { setType(DependencyType.variant); break;