Deletes the relations to a given resource.<p>

@param resource the resource to delete the relations from
@param filter the filter to use for deleting the relations

@throws CmsException if something goes wrong
545244
public void deleteRelationsFromResource(CmsResource resource, CmsRelationFilter filter) throws CmsException {

        m_securityManager.deleteRelationsForResource(m_context, resource, filter);
    }
468826
public void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException {

        CmsUser user = readUser(context, userId);
        deleteUser(context, user, null);
    }
119379
private boolean resourceExists(CmsObject cms, String resource) {

        try {
            cms.readResource(resource, CmsResourceFilter.ALL);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
1201906
protected void deleteConflictingResources(CmsObject cms, CmsModule module, Map<CmsUUID, CmsUUID> conflictingIds)
    throws CmsException, Exception {

        CmsProject conflictProject = cms.createProject(
            "Deletion of conflicting resources for " + module.getName(),
            "Deletion of conflicting resources for " + module.getName(),
            OpenCms.getDefaultUsers().getGroupAdministrators(),
            OpenCms.getDefaultUsers().getGroupAdministrators(),
            CmsProject.PROJECT_TYPE_TEMPORARY);
        CmsObject deleteCms = OpenCms.initCmsObject(cms);
        deleteCms.getRequestContext().setCurrentProject(conflictProject);
        for (CmsUUID vfsId : conflictingIds.values()) {
            CmsResource toDelete = deleteCms.readResource(vfsId, CmsResourceFilter.ALL);
            lock(deleteCms, toDelete);
            deleteCms.deleteResource(toDelete, CmsResource.DELETE_PRESERVE_SIBLINGS);
        }
        OpenCms.getPublishManager().publishProject(deleteCms);
        OpenCms.getPublishManager().waitWhileRunning();
    }
606790
public void deleteUser(CmsRequestContext context, String username) throws CmsException {

        CmsUser user = readUser(context, username);
        deleteUser(context, user, null);
    }
97228
public void setSubscribedResourceAsDeleted(CmsRequestContext context, String poolName, CmsResource resource)
    throws CmsException {

        CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
        try {
            m_driverManager.setSubscribedResourceAsDeleted(dbc, poolName, resource);
        } catch (Exception e) {

            dbc.report(
                null,
                Messages.get().container(
                    Messages.ERR_SET_SUBSCRIBED_RESOURCE_AS_DELETED_1,
                    context.getSitePath(resource)),
                e);

        } finally {
            dbc.clear();
        }
    }
1347503
public void filterTable(String search) {

        m_container.removeAllContainerFilters();
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
            m_container.addContainerFilter(
                new Or(
                    new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_RESOURCE_NAME, search, true, false),
                    new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT, search, true, false),
                    new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_TITLE, search, true, false)));
        }
        if ((m_fileTable.getValue() != null) & !((Set<?>)m_fileTable.getValue()).isEmpty()) {
            m_fileTable.setCurrentPageFirstItemId(((Set<?>)m_fileTable.getValue()).iterator().next());
        }
    }
1360664
public void unsubscribeResourceForAll(CmsObject cms, String resourcePath) throws CmsException {

        CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
        unsubscribeResourceForAll(cms, resource);
    }
864865
protected void rewriteOtherRelations(CmsResource res, Collection<CmsRelation> relations) throws CmsException {

        LOG.info("Rewriting non-content links for " + res.getRootPath());
        for (CmsRelation rel : relations) {
            CmsUUID targetId = rel.getTargetId();
            CmsResource newTargetResource = m_translationsById.get(targetId);
            CmsRelationType relType = rel.getType();
            if (!relType.isDefinedInContent()) {
                if (newTargetResource != null) {
                    m_cms.deleteRelationsFromResource(
                        rel.getSourcePath(),
                        CmsRelationFilter.TARGETS.filterStructureId(rel.getTargetId()).filterType(relType));
                    m_cms.addRelationToResource(
                        rel.getSourcePath(),
                        newTargetResource.getRootPath(),
                        relType.getName());
                }
            }
        }
    }
680486
public void actionDeleteResource() throws JspException {

        if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) {
            // only delete resource if dialog mode is a wizard mode
            try {
                getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS);
            } catch (Throwable e) {
                // error deleting the resource, show error dialog
                includeErrorpage(this, e);
            }
        }
    }
1000513
public void remove() {

    if (context == null) {
      throw new IllegalStateException("link with href=" + getHref() + " can not be removed, because it's not part of a HAL resource tree");
    }

    // iterate over all links grouped by relation (because for removal we need to know the relation)
    ListMultimap<String, Link> allLinks = context.getLinks();
    for (String relation : allLinks.keySet()) {
      List<Link> links = allLinks.get(relation);

      // use an indexed for-loop, because we need to know the index to properly remove the link
      for (int i = 0; i < links.size(); i++) {
        if (links.get(i).getModel() == model) {
          context.removeLink(relation, i);
          context = null;
          return;
        }
      }
    }

    throw new IllegalStateException("the last known context resource of link with href=" + getHref() + " no longer contains this link");
  }
687385
private static void processResourceFilter(ProjectFile project, Filter filter)
   {
      for (Resource resource : project.getResources())
      {
         if (filter.evaluate(resource, null))
         {
            System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName());
         }
      }
   }
146113
public static List<CmsRelationType> filterWeak(Collection<CmsRelationType> relationTypes) {

        List<CmsRelationType> result = new ArrayList<CmsRelationType>(relationTypes);
        Iterator<CmsRelationType> it = result.iterator();
        while (it.hasNext()) {
            CmsRelationType type = it.next();
            if (type.isStrong()) {
                it.remove();
            }
        }
        return result;
    }
668049
protected boolean remove(CmsResource resource) {

        // it is essential that this method is only visible within the db package!
        boolean ret = m_fileList.remove(resource);
        ret |= m_folderList.remove(resource);
        ret |= m_deletedFolderList.remove(resource);
        return ret;
    }
841745
public void update(CmsObject cms, CmsUUID id, CmsResourceFilter filter) throws CmsException {

        try {
            CmsResource resource = cms.readResource(id, filter);

            CmsResource parent = cms.readParentFolder(id);
            CmsUUID parentId = parent.getStructureId();
            Item resourceItem = getItem(id);
            if (resourceItem != null) {
                fillProperties(cms, resourceItem, resource, parentId);
                if (parentId != null) {
                    setParent(resource.getStructureId(), parentId);
                }
            } else {
                addTreeItem(cms, resource, parentId);
            }
        } catch (CmsVfsResourceNotFoundException e) {
            removeItemRecursively(id);
            LOG.debug(e.getLocalizedMessage(), e);
        }
    }
303492
public void addFilter(Filter filter)
   {
      if (filter.isTaskFilter())
      {
         m_taskFilters.add(filter);
      }

      if (filter.isResourceFilter())
      {
         m_resourceFilters.add(filter);
      }

      m_filtersByName.put(filter.getName(), filter);
      m_filtersByID.put(filter.getID(), filter);
   }
749406
public void unsubscribeResourceForAll(CmsObject cms, CmsResource resource) throws CmsException {

        if (!isEnabled()) {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0));
        }
        m_securityManager.unsubscribeResourceForAll(cms.getRequestContext(), getPoolName(), resource);
    }