Checks whether the given resource is a model reuse group.<p>

@param cms the cms context
@param resource the resource

@return <code>true</code> in case the resource is a model reuse group
322336
public static boolean isModelCopyGroup(CmsObject cms, CmsResource resource) {

        boolean result = false;
        if (isModelGroup(resource)) {
            try {
                CmsProperty tempElementsProp = cms.readPropertyObject(
                    resource,
                    CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
                    false);
                if (!tempElementsProp.isNullProperty()
                    && CmsContainerElement.USE_AS_COPY_MODEL.equals(tempElementsProp.getValue())) {
                    result = true;
                }
            } catch (CmsException e) {
                LOG.warn(e.getMessage(), e);
            }

        }
        return result;
    }
129908
@SuppressWarnings("deprecation")
    public boolean isInheritedContainer(CmsObject cms) throws CmsException {

        if (m_resource == null) {
            initResource(cms);
        }
        return OpenCms.getResourceManager().getResourceType(
            CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_TYPE_NAME).getTypeId() == m_resource.getTypeId();
    }
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);
    }
119379
private boolean resourceExists(CmsObject cms, String resource) {

        try {
            cms.readResource(resource, CmsResourceFilter.ALL);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
1319432
protected boolean resourceIsValid(CmsResource resource) {

        if (!resource.getRootPath().startsWith(m_basePath)) {
            return false;
        }
        if (m_requireFile & resource.isFolder()) {
            return false;
        }
        if (m_requireFolder & resource.isFile()) {
            return false;
        }
        return true;
    }
544606
@SuppressWarnings("static-method")
	protected boolean isSourceFile(Resource resource) {
		if (resource instanceof BatchLinkableResource) {
			return !((BatchLinkableResource) resource).isLoadedFromStorage();
		}
		return false;
	}
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;
    }
867920
public static String getDefaultSearchTypes(CmsObject cms, CmsResource resource) {

        StringBuffer result = new StringBuffer();
        String referenceSitePath = cms.getSitePath(resource);
        String configPath;
        if (resource == null) {
            // not sure if this can ever happen?
            configPath = cms.addSiteRoot(cms.getRequestContext().getUri());
        } else {
            configPath = resource.getRootPath();
        }
        CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(cms, configPath);
        Set<String> detailPageTypes = OpenCms.getADEManager().getDetailPageTypes(cms);
        for (CmsResourceTypeConfig typeConfig : config.getResourceTypes()) {
            String typeName = typeConfig.getTypeName();
            if (!detailPageTypes.contains(typeName)) {
                continue;
            }
            if (typeConfig.checkViewable(cms, referenceSitePath)) {
                result.append(typeName).append(",");
            }
        }
        result.append(CmsResourceTypeXmlContainerPage.getStaticTypeName()).append(",");
        result.append(CmsResourceTypeBinary.getStaticTypeName()).append(",");
        result.append(CmsResourceTypeImage.getStaticTypeName()).append(",");
        result.append(CmsResourceTypePlain.getStaticTypeName());
        return result.toString();
    }
601394
private void init(CmsResource resource, CmsObject cms) {

        List<CmsProperty> properties;

        try {
            properties = cms.readPropertyObjects(resource, false);
        } catch (CmsException e) {
            m_priority = 0;
            m_title = "";
            return;
        }

        try {
            m_priority = Integer.parseInt(
                CmsProperty.get(CmsPriorityResourceCollector.PROPERTY_PRIORITY, properties).getValue());
        } catch (NumberFormatException e) {
            m_priority = CmsPriorityResourceCollector.PRIORITY_STANDARD;
        }

        m_title = CmsProperty.get(CmsPropertyDefinition.PROPERTY_TITLE, properties).getValue();
        if (CmsStringUtil.isEmpty(m_title)) {
            m_title = "";
        }
    }
1233981
public boolean hasOnlySystemAndSharedResources() {

        for (String modRes : getResources()) {
            if (!CmsStringUtil.isPrefixPath("/system/", modRes) && !OpenCms.getSiteManager().startsWithShared(modRes)) {
                return false;
            }
        }
        return true;
    }
367459
public void parse(CmsResource resource) throws CmsException {

        CmsFile file = m_cms.readFile(resource);
        parse(file);
    }
1213422
public boolean isEditable(CmsObject cms, CmsResource resource) {

        if (!cms.getRequestContext().getCurrentProject().isOnlineProject()
            && OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) {
            return true;
        }
        // determine if this resource type is editable for the current user
        CmsPermissionSet permissions = getAccess().getPermissions(cms, resource);
        return permissions.requiresWritePermission();
    }
351472
private static I_CmsResourceType getResourceType(CmsResource resource, String createType) {

        I_CmsResourceType resType = null;
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(createType)) {
            try {
                resType = OpenCms.getResourceManager().getResourceType(createType);
            } catch (CmsLoaderException e) {
                LOG.error("Could not read resource type '" + createType + "' for resource creation.", e);
            }
        } else if (resource != null) {
            resType = OpenCms.getResourceManager().getResourceType(resource);
        }
        return resType;
    }
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);
    }
556356
public Map<String, CmsXmlContentProperty> getElementSettings(CmsObject cms, CmsResource resource)
    throws CmsException {

        if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
            Map<String, CmsXmlContentProperty> result = new LinkedHashMap<String, CmsXmlContentProperty>();
            Map<String, CmsXmlContentProperty> settings = CmsXmlContentDefinition.getContentHandlerForResource(
                cms,
                resource).getSettings(cms, resource);
            result.putAll(settings);
            return CmsXmlContentPropertyHelper.copyPropertyConfiguration(result);
        }
        return Collections.<String, CmsXmlContentProperty> emptyMap();
    }
120141
boolean isPossiblyDetailContent(CmsResource resource) {

        if (CmsResourceTypeXmlContainerPage.isContainerPage(resource)) {
            return false;
        }
        I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(resource);
        if (type instanceof CmsResourceTypeXmlAdeConfiguration) {
            return false;
        }
        return true;
    }
1170939
private static CmsPropertyResourceComparator create(CmsResource resource, CmsObject cms, String property) {

        CmsPropertyResourceComparator result = new CmsPropertyResourceComparator(null, null, false);
        result.init(resource, cms, property);
        return result;
    }