CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterIncludeChildren().filterStructureId( CmsUUID.getNullUUID());
CmsRelationFilter filter = CmsRelationFilter.TARGETS.filterIncludeChildren().filterStructureId( CmsUUID.getNullUUID());
CmsRelationFilter filter = CmsRelationFilter.SOURCES.filterType(CmsRelationType.CATEGORY); if (recursive) { filter = filter.filterIncludeChildren();
/** * Finds relations from the target root folder or its children to the source root folder or its children.<p> * * @return the list of relations from the target to the source * * @throws CmsException if something goes wrong */ protected List<CmsRelation> findRelationsFromTargetToSource() throws CmsException { List<CmsRelation> relations = m_cms.readRelations( CmsRelationFilter.SOURCES.filterPath(m_targetPath).filterIncludeChildren()); List<CmsRelation> result = new ArrayList<CmsRelation>(); for (CmsRelation rel : relations) { if (isInTargets(rel.getSourcePath()) && isInSources(rel.getTargetPath())) { result.add(rel); } } return result; }
CmsRelationFilter filter = CmsRelationFilter.SOURCES.filterType(CmsRelationType.CATEGORY); if (recursive) { filter = filter.filterIncludeChildren();
CmsRelationFilter.TARGETS.filterStrong().filterIncludeChildren()).iterator(); while (itRelations.hasNext()) { CmsRelation relation = itRelations.next();
CmsRelationFilter.TARGETS.filterStrong().filterIncludeChildren()).iterator(); while (itRelations.hasNext()) { CmsRelation relation = (CmsRelation)itRelations.next();
/** * Removes a resource identified by the given resource name from the given category.<p> * * The resource has to be previously locked.<p> * * @param cms the current cms context * @param resourceName the site relative path to the resource to remove * @param category the category to remove the resource from * * @throws CmsException if something goes wrong */ public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category) throws CmsException { // remove the resource just from this category CmsRelationFilter filter = CmsRelationFilter.TARGETS; filter = filter.filterType(CmsRelationType.CATEGORY); filter = filter.filterResource(cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath()))); filter = filter.filterIncludeChildren(); cms.deleteRelationsFromResource(resourceName, filter); }
/** * Removes a resource identified by the given resource name from the given category.<p> * * The resource has to be previously locked.<p> * * @param cms the current cms context * @param resourceName the site relative path to the resource to remove * @param category the category to remove the resource from * * @throws CmsException if something goes wrong */ public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category) throws CmsException { // remove the resource just from this category CmsRelationFilter filter = CmsRelationFilter.TARGETS; filter = filter.filterType(CmsRelationType.CATEGORY); filter = filter.filterResource( cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath()))); filter = filter.filterIncludeChildren(); cms.deleteRelationsFromResource(resourceName, filter); }
/** * Returns the list of organizational units the given resource belongs to.<p> * * @param dbc the current database context * @param resource the resource * * @return list of {@link CmsOrganizationalUnit} objects * * @throws CmsException if something goes wrong */ public List getResourceOrgUnits(CmsDbContext dbc, CmsResource resource) throws CmsException { try { dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_RESOURCE_OUS, Boolean.TRUE); return m_vfsDriver.readRelations( dbc, dbc.currentProject().getUuid(), resource, CmsRelationFilter.TARGETS.filterIncludeChildren()); } finally { dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_RESOURCE_OUS); } }