Returns all locked resources within a folder or matches the lock of the given resource.<p>

@param resource the resource to check
@param filter the lock filter

@return a list of locked resources

@throws CmsException if operation was not successful
483617
public List<CmsResource> getLockedResources(CmsResource resource, CmsLockFilter filter) throws CmsException {

        return m_securityManager.getLockedResourcesObjects(m_context, resource, filter);
    }
675960
public CmsCategory getCategory(CmsObject cms, CmsResource resource) throws CmsException {

        CmsProperty title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false);
        CmsProperty description = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_DESCRIPTION, false);
        return new CmsCategory(
            resource.getStructureId(),
            resource.getRootPath(),
            title.getValue(resource.getName()),
            description.getValue(""),
            getRepositoryBaseFolderName(cms));
    }
889936
public CmsRelationFilter filterResource(CmsResource resource) {

        CmsRelationFilter filter = filterStructureId(resource.getStructureId());
        filter = filterPath(resource.getRootPath());
        return filter;
    }
856930
public CmsPermissionSet getPermissions(String resourceName, String userName) throws CmsException {

        // reading permissions is allowed even if the resource is marked as deleted
        CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
        CmsUser user = readUser(userName);
        return m_securityManager.getPermissions(m_context, resource, user);
    }
119379
private boolean resourceExists(CmsObject cms, String resource) {

        try {
            cms.readResource(resource, CmsResourceFilter.ALL);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
245713
protected void performSingleDeleteOperation(String resource, CmsResourceDeleteMode deleteOption)
    throws CmsException {

        // lock resource if autolock is enabled
        checkLock(resource);
        // delete the resource
        getCms().deleteResource(resource, deleteOption);
    }
681008
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {

        if ((null != resource) && (null != cms)) {
            try {
                return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
            } catch (CmsException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return new ArrayList<CmsCategory>(0);
    }
1027201
public void initResource(CmsObject cms) throws CmsException {

        if (m_resource == null) {
            m_resource = cms.readResource(getId(), CmsResourceFilter.IGNORE_EXPIRATION);
            m_releasedAndNotExpired = m_resource.isReleasedAndNotExpired(cms.getRequestContext().getRequestTime());
        } else if (!isInMemoryOnly()) {
            CmsUUID id = m_resource.getStructureId();
            if (id == null) {
                id = getId();
            }
            // the resource object may have a wrong root path, e.g. if it was created before the resource was moved
            if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
                m_resource = cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION);
                m_releasedAndNotExpired = m_resource.isReleasedAndNotExpired(cms.getRequestContext().getRequestTime());
            } else {
                if (!isTemporaryContent()) {
                    m_resource = cms.readResource(getId(), CmsResourceFilter.IGNORE_EXPIRATION);
                }
                m_releasedAndNotExpired = m_resource.isReleasedAndNotExpired(cms.getRequestContext().getRequestTime());
            }
        }
        if (m_settings == null) {
            setSettings(new HashMap<String, String>(getIndividualSettings()));
        }
        // redo on every init call to ensure sitepath is calculated for current site
        m_sitePath = cms.getSitePath(m_resource);
    }
1144941
private void deleteResourceFromProject(CmsObject cms, CmsResource res) throws CmsException {

        CmsLock lock = cms.getLock(res);
        if (lock.isUnlocked() || lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
            cms.lockResourceTemporary(res);
        } else {
            cms.changeLock(res);
        }
        cms.deleteResource(cms.getSitePath(res), CmsResource.DELETE_PRESERVE_SIBLINGS);
    }
650512
private void lockDescriptor() throws CmsException {

        if ((null == m_descFile) && (null != m_desc)) {
            m_descFile = LockedFile.lockResource(m_cms, m_desc);
        }
    }
545244
public void deleteRelationsFromResource(CmsResource resource, CmsRelationFilter filter) throws CmsException {

        m_securityManager.deleteRelationsForResource(m_context, resource, filter);
    }
646720
public static Resource[] listResources(Resource[] resources, ResourceFilter filter) {
	int count = 0;
	Resource[] children;
	ArrayList<Resource[]> list = new ArrayList<Resource[]>();
	for (int i = 0; i < resources.length; i++) {
	    children = filter == null ? resources[i].listResources() : resources[i].listResources(filter);
	    if (children != null) {
		count += children.length;
		list.add(children);
	    }
	    else list.add(new Resource[0]);
	}
	Resource[] rtn = new Resource[count];
	int index = 0;
	for (int i = 0; i < resources.length; i++) {
	    children = list.get(i);
	    for (int y = 0; y < children.length; y++) {
		rtn[index++] = children[y];
	    }
	}
	// print.out(rtn);
	return rtn;
    }
1210894
public void lockResourceTemporary(String resourceName) throws CmsException {

        boolean exec = false;
        // iterate through all wrappers and call "lockResource" till one does not return false
        List<I_CmsResourceWrapper> wrappers = getWrappers();
        for (I_CmsResourceWrapper wrapper : wrappers) {
            exec = wrapper.lockResource(m_cms, resourceName, true);
            if (exec) {
                break;
            }
        }

        // delegate the call to the CmsObject
        if (!exec) {
            m_cms.lockResourceTemporary(resourceName);
        }
    }
826570
private List<CmsResource> getResources() {

        List<CmsResource> result = new LinkedList<CmsResource>();
        CmsObject cms = getCms();
        CmsResourceFilter filter = CmsResourceFilter.ALL;
        try {
            for (String path : m_paths) {
                List<CmsResource> resources = cms.readResources(path, filter, true);
                // filter out any resource that is no XML content:
                for (CmsResource resource : resources) {
                    if (resource.isFile()) {
                        if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
                            result.add(resource);
                        } else if (CmsResourceTypeXmlPage.isXmlPage(resource)) {
                            result.add(resource);
                        }
                    }
                }
            }
        } catch (CmsException e) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_LANGUAGECOPY_READRESOURCES_0), e);
            result = Collections.emptyList();
        }

        return result;
    }
919180
private boolean isBlockingLocked() {

        boolean result = true;
        CmsLockFilter blockingFilter = CmsLockFilter.FILTER_ALL;
        blockingFilter = blockingFilter.filterNotLockableByUser(getCms().getRequestContext().getCurrentUser());
        try {
            List<String> blocking = getCms().getLockedResources(getParamResource(), blockingFilter);
            result = blocking.size() > 0;
        } catch (CmsException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(e.getLocalizedMessage(), e);
            }
        }
        return result;
    }
232623
protected List<CmsPair<CmsResource, CmsResource>> getMatchingResources(String source, String target)
    throws CmsException {

        List<CmsResource> sourceResources = readTree(source);
        Map<String, CmsResource> sourceRelative = getResourcesByRelativePath(sourceResources, source);

        List<CmsResource> targetResources = readTree(target);
        Map<String, CmsResource> targetRelative = getResourcesByRelativePath(targetResources, target);

        List<CmsPair<CmsResource, CmsResource>> result = new ArrayList<CmsPair<CmsResource, CmsResource>>();
        sourceRelative.keySet().retainAll(targetRelative.keySet());
        for (Map.Entry<String, CmsResource> entry : sourceRelative.entrySet()) {
            String key = entry.getKey();
            CmsResource sourceRes = entry.getValue();
            CmsResource targetRes = targetRelative.get(key);
            result.add(CmsPair.create(sourceRes, targetRes));
        }
        return result;
    }
460357
public final boolean lockIfMatches(final Filter filter, long lockID) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "lockIfMatches", new Object[] { filter, Long.valueOf(lockID) });

        boolean locked = false;

        boolean matches = false;
        AbstractItem item = getItem();
        if (null == item)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "item does not exist");
        }
        else
        {
            try
            {
                if (null == filter || filter.filterMatches(item))
                {
                    matches = true;
                }
            } catch (Exception e)
            {
                //No FFDC Code Needed.
                // assume exception is false return
            }
        }

        boolean hasBecomeNonReleasable = false;
        if (matches)
        {
            synchronized (this)
            {
                if (isAvailable() && !isExpired())
                {
                    if (ItemLinkState.STATE_AVAILABLE == _itemLinkState)
                    {
                        ListStatistics stats = getParentStatistics();
                        synchronized (stats)
                        {
                            stats.incrementLocked();
                            stats.decrementAvailable();
                        }
                    }
                    else
                    {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                            SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                            SibTr.exit(this, tc, "lockIfMatches");
                        throw new StateException(_itemLinkState.toString());
                    }

                    _lockID = lockID;
                    hasBecomeNonReleasable = _declareNotDiscardable(item);
                    _itemLinkState = ItemLinkState.STATE_LOCKED;
                    locked = true;
                }
            }
            if (hasBecomeNonReleasable)
            {
                _declareNotReleasable();
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "lockIfMatches", Boolean.valueOf(locked));
        return locked;
    }