/*
(non-Javadoc)
@see org.springframework.hateoas.server.LinkRelationProvider#getItemResourceRelFor(java.lang.Class)
504924
@Override
	public LinkRelation getItemResourceRelFor(Class<?> type) {

		LookupContext context = LookupContext.forItemResourceRelLookup(type);

		return providers.getRequiredPluginFor(context).getItemResourceRelFor(type);
	}
77643
@Override
    Resource getResource(final String relativePath) {
        return allResourcePaths.contains(relativePath) ? newResource(relativePath) : null;
    }
1177073
def get_for_resource(resource):
        
        resource_content_type = ContentType.objects.get_for_model(resource)
        default_items = set(DefaultPriceListItem.objects.filter(resource_content_type=resource_content_type))
        service = resource.service_project_link.service
        items = set(PriceListItem.objects.filter(
            default_price_list_item__in=default_items, service=service).select_related('default_price_list_item'))
        rewrited_defaults = set([i.default_price_list_item for i in items])
        return items | (default_items - rewrited_defaults)
298681
public I_CmsResourceLoader getLoader(CmsResource resource) throws CmsLoaderException {

        return getLoader(getResourceType(resource.getTypeId()).getLoaderId());
    }
94582
private static String getResourceFor(String pLibrary) {
        Iterator<NativeResourceSPI> providers = sRegistry.providers(pLibrary);
        while (providers.hasNext()) {
            NativeResourceSPI resourceSPI = providers.next();

            try {
                return resourceSPI.getClassPathResource(Platform.get());
            }
            catch (Throwable t) {
                // Dergister and try next
                sRegistry.deregister(resourceSPI);
            }
        }

        return null;
    }
788865
public ItemList getItemList() {
        if (!atomics.containsKey(mRTX)) {
            atomics.put(mRTX, new ItemList());
        }
        return atomics.get(mRTX);
    }
1201075
private LinkedHashMap<CmsUUID, CmsClientSitemapEntry> getDeletedList() {

        CmsObject cms = getCmsObject();
        CmsUser user = cms.getRequestContext().getCurrentUser();
        Object obj = user.getAdditionalInfo(ADDINFO_ADE_DELETED_LIST);
        LinkedHashMap<CmsUUID, CmsClientSitemapEntry> result = new LinkedHashMap<CmsUUID, CmsClientSitemapEntry>();
        if (obj instanceof String) {
            try {
                JSONArray array = new JSONArray((String)obj);
                for (int i = 0; i < array.length(); i++) {
                    try {
                        CmsUUID delId = new CmsUUID(array.getString(i));
                        CmsResource res = cms.readResource(delId, CmsResourceFilter.ALL);
                        if (res.getState().isDeleted()) {
                            // make sure resource is still deleted
                            CmsClientSitemapEntry delEntry = new CmsClientSitemapEntry();
                            delEntry.setSitePath(cms.getSitePath(res));
                            delEntry.setOwnProperties(getClientProperties(cms, res, false));
                            delEntry.setName(res.getName());
                            delEntry.setVfsPath(cms.getSitePath(res));
                            delEntry.setResourceTypeName(
                                OpenCms.getResourceManager().getResourceType(res).getTypeName());
                            delEntry.setEntryType(
                                res.isFolder()
                                ? EntryType.folder
                                : isRedirectType(res.getTypeId()) ? EntryType.redirect : EntryType.leaf);
                            delEntry.setNavModeIcon(
                                CmsIconUtil.getIconClasses(
                                    delEntry.getResourceTypeName(),
                                    delEntry.getVfsPath(),
                                    false));
                            delEntry.setId(delId);
                            result.put(delId, delEntry);
                        }
                    } catch (Throwable e) {
                        // should never happen, catches wrong or no longer existing values
                        LOG.warn(e.getLocalizedMessage());
                    }
                }
            } catch (Throwable e) {
                // should never happen, catches json parsing
                LOG.warn(e.getLocalizedMessage());
            }
        }
        return result;
    }
1012834
public static AbstractItem getItemStreamInstance(String itemClassName) {
        AbstractItem itemStream = itemInterfaceRef.getService().getItemStreamInstance(itemClassName);;
        return itemStream;
    }
1005330
@javax.annotation.CheckForNull
    public static IResource getResource(Object element) {
        if (element instanceof IJavaElement) {
            return ((IJavaElement) element).getResource();
        }

        return Util.getAdapter(IResource.class, element);
    }
903249
public URL getResource(String resourceName, BeanContextChild child)
	{
		if (resourceName == null || child == null)
		{
			throw new NullPointerException();
		}
		if (!contains(child))
		{
			throw new IllegalArgumentException(Messages.getString("beans.6D"));
		}

		return ClassLoader.getSystemResource(resourceName);
	}
1293696
public URL getResourceFrom(String name, AbstractClassLoader first) {
		if (name.length() == 0) return null;
		if (name.charAt(0) == '/') name = name.substring(1);
		URL url = null;
    	// try with the first one
    	if (first != null)
   			url = first.getResourceURL(name);
    	// then, try on other libraries
    	if (url == null) {
        	for (int i = 0; i < libs.size(); i++) {
        		AbstractClassLoader cl = libs.get(i);
        		if (cl == first) continue;
       			url = cl.getResourceURL(name);
        		if (url != null) break;
        	}
        }
        if (url == null)
        	url = AppClassLoader.class.getClassLoader().getResource(name);
        return url;
	}
645104
public String getItemImageUrl(final TreeItemImage item, final String itemId) {

		if (item == null) {
			return null;
		}

		// Check if has image url
		String url = item.getUrl();
		if (!Util.empty(url)) {
			return url;
		}

		// Check if has image
		Image image = item.getImage();
		if (image == null) {
			return null;
		}

		// Check static resource
		if (image instanceof InternalResource) {
			return ((InternalResource) image).getTargetUrl();
		}

		// Build targetted url
		Environment env = getEnvironment();
		Map<String, String> parameters = env.getHiddenParameters();
		parameters.put(Environment.TARGET_ID, getTargetId());

		String cacheKey = item.getImageCacheKey();

		if (Util.empty(cacheKey)) {
			// Add some randomness to the URL to prevent caching
			String random = WebUtilities.generateRandom();
			parameters.put(Environment.UNIQUE_RANDOM_PARAM, random);
		} else {
			// Remove step counter as not required for cached content
			parameters.remove(Environment.STEP_VARIABLE);
			parameters.remove(Environment.SESSION_TOKEN_VARIABLE);
			// Add the cache key
			parameters.put(Environment.CONTENT_CACHE_KEY, cacheKey);
		}

		// Item id
		parameters.put(ITEM_REQUEST_KEY, itemId);

		// The targetable path needs to be configured for the portal environment.
		url = env.getWServletPath();

		// Note the last parameter. In javascript we don't want to encode "&".
		return WebUtilities.getPath(url, parameters, true);
	}
725836
@Override
    public TargetProtocolItemStream getTargetProtocolItemStream()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getTargetProtocolItemStream");

        TargetProtocolItemStream targetProtocolItemStream = _targetDestinationHandler.getTargetProtocolItemStream();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getTargetProtocolItemStream", targetProtocolItemStream);

        return targetProtocolItemStream;
    }
891554
public static URL getResource(String resource, Class<?> context, boolean checkParent)
    {
        URL url = Thread.currentThread().getContextClassLoader().getResource(resource);
        if (url != null)
            return url;

        if (context != null)
        {
            ClassLoader loader = context.getClassLoader();
            while (loader != null)
            {
                url = loader.getResource(resource);
                if (url != null)
                    return url;
                loader = checkParent ? loader.getParent() : null;
            }
        }

        return ClassLoader.getSystemResource(resource);
    }
1197167
@CheckResult
    @NonNull
    public static PowerAdapter asAdapter(@NonNull @LayoutRes int... resources) {
        return new ItemAdapter(toItems(checkNotNull(resources, "resources")));
    }
373433
@Override
	public LinkRelation getCollectionResourceRelFor(java.lang.Class<?> type) {

		LookupContext context = LookupContext.forCollectionResourceRelLookup(type);

		return providers.getRequiredPluginFor(context).getCollectionResourceRelFor(type);
	}
403580
@Override
    public CmsResource getResource(CmsObject cms, CmsListItem item) {

        CmsResource res = null;

        CmsUUID id = new CmsUUID(item.getId());
        if (!id.isNullUUID()) {
            try {
                res = cms.readResource(id, CmsResourceFilter.ALL);
            } catch (CmsException e) {
                // should never happen
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }

        return res;
    }