Construct a chain of resource parents starting with the resource and ending with the root.

@param resource The staring point.
@return list of resource in the chain form start to the root.
555633
public static List<? extends IResource> chain(IResource resource)
    {
        List<IResource> chain = new ArrayList<IResource>();
        while (true)
        {
           chain.add(resource);
           if (!resource.hasParent())
               break;
           resource = resource.getParent();
        }
        return chain;
    }
867372
public List<Resource> buildResources() {
        List<Resource> resources = new ArrayList<Resource>();
        for (ResourceBuilder builder : _resourceBuilders) {
            Resource resource = builder.build();
            if (resource != null) {
                resources.add(resource);
            }
        }
        return resources;
    }
788775
@Nullable
    public static InputStream getResourceAsStream(@NotNull String resource) {
        final ClassLoader classLoader = FileUtils.class.getClassLoader();
        final InputStream inputStream = classLoader != null
                ? classLoader.getResourceAsStream(resource)
                : ClassLoader.getSystemResourceAsStream(resource);

        if (inputStream == null) {
            try {
                return new FileInputStream(resource);
            } catch (final FileNotFoundException e) {
                LOGGER.error("Unable to create an Input Stream for " + resource, e);
            }
        }
        return inputStream;
    }
168084
protected String determineResourceName(final Resource resource) {
        String resourceName = null;

        if (resource instanceof ContextResource) {
            resourceName = ((ContextResource) resource).getPathWithinContext();

        } else if (resource instanceof ByteArrayResource) {
            resourceName = resource.getDescription();

        } else {
            try {
                resourceName = resource.getFile().getAbsolutePath();
            } catch (IOException e) {
                resourceName = resource.getFilename();
            }
        }
        return resourceName;
    }
115572
private List<CmsContainerElementBean> getGroupContainerElements(CmsResource resource) throws CmsException {

        CmsXmlGroupContainer xmlGroupContainer = CmsXmlGroupContainerFactory.unmarshal(
            getCmsObject(),
            resource,
            getRequest());
        CmsGroupContainerBean groupContainer = xmlGroupContainer.getGroupContainer(getCmsObject());
        return groupContainer.getElements();
    }
923708
private void getAllDescendants(Resource<L> parent, List<Resource<L>> descendants) {
        for (Resource<L> child : getChildren(parent)) {
            if (!descendants.contains(child)) {
                getAllDescendants(child, descendants);
                descendants.add(child);
            }
        }
        return;
    }
743288
public List<CmsVariationBean> getVariations(String resource) {

        List<String> ret = (List<String>)(m_filePaths.get(resource));
        List<CmsVariationBean> res = new ArrayList<CmsVariationBean>();
        if (ret == null) {
            return new ArrayList<CmsVariationBean>();
        }
        for (String r : ret) {
            res.add(new CmsVariationBean(r));
        }
        return res;
    }
1093302
public static Properties readPropertiesFromClassLoader(String resource) {
        Properties properties = new Properties();
        try {
            properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return properties;
    }
50859
public static URL getResource(String resource, Class<?> baseClass) {
		return (null != baseClass) ? baseClass.getResource(resource) : ClassLoaderUtil.getClassLoader().getResource(resource);
	}
248590
def parent(self, resource):
        
        resource.check()
        self['parent_type'] = resource.type
        self['parent_uuid'] = resource.uuid
33056
@Override
	public LinkRelation getCollectionResourceRelFor(Class<?> resource) {

		LookupContext context = LookupContext.forCollectionResourceRelLookup(entityType);

		return providers.getRequiredPluginFor(context).getCollectionResourceRelFor(resource);
	}
348491
def parent_resources(cls):
        """"""
        parent = cls.parent_resource
        parents = [parent]

        try:
            while True:
                parent = parent.parent_resource
                parents.append(parent)
        except AttributeError:
            pass

        parents.reverse()
        return parents
256535
public Set<ResourceType<L>> getParents(ResourceType<L> resourceType) {
        Set<ResourceType<L>> directParents = index.predecessorsOf(resourceType);
        return Collections.unmodifiableSet(directParents);
    }
269000
public List<List<RESOURCE>> partitionYoungResources(List<RESOURCE> resources) {

        if (resources.isEmpty()) {
            return Collections.<List<RESOURCE>> emptyList();
        }
        List<List<RESOURCE>> result = new ArrayList<List<RESOURCE>>();
        List<RESOURCE> currentGroup = new ArrayList<RESOURCE>();
        result.add(currentGroup);

        long lastDate = getDateLastModified(resources.get(0));
        for (RESOURCE res : resources) {
            LOG.debug("Processing young resource " + getRootPath(res));
            long resDate = getDateLastModified(res);
            if ((lastDate - resDate) > GROUP_SESSIONS_GAP) {
                LOG.debug("=== new group ===");
                currentGroup = new ArrayList<RESOURCE>();
                result.add(currentGroup);
            }
            lastDate = resDate;
            currentGroup.add(res);
        }
        return result;
    }
33507
public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) {
    return child(parentResource, name, resourceType, ValueMap.EMPTY);
  }
738705
public Set<Resource<L>> getRootResources() {
        graphLockRead.lock();
        try {
            Set<Resource<L>> roots = new HashSet<>();
            Set<Resource<L>> allResources = resourcesGraph.vertexSet();
            for (Resource<L> resource : allResources) {
                if (neighborIndex.predecessorsOf(resource).isEmpty()) {
                    roots.add(resource);
                }
            }
            return Collections.unmodifiableSet(roots);
        } finally {
            graphLockRead.unlock();
        }
    }
285883
public ResponseBuilder initialize(final Resource parent, final Resource resource) {

        // Check that the persistence layer supports LDP-R
        if (MISSING_RESOURCE.equals(resource)) {
            // Can't delete a non-existent resources
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(resource)) {
            // Can't delete a non-existent resources
            throw new ClientErrorException(GONE);
        } else if (!supportsInteractionModel(LDP.Resource)) {
            throw new ClientErrorException(status(BAD_REQUEST)
                .link(UnsupportedInteractionModel.getIRIString(), LDP.constrainedBy.getIRIString())
                .entity("Unsupported interaction model provided").type(TEXT_PLAIN_TYPE).build());
        }

        // Check the cache
        final EntityTag etag = new EntityTag(buildEtagHash(getIdentifier(), resource.getModified(), null));
        checkCache(resource.getModified(), etag);

        setResource(resource);
        resource.getContainer().ifPresent(p -> setParent(parent));
        return noContent();
    }