/** * Returns the sling resource type on content node of collection * * @param * @return <code>sling:resourceType</code> for the collection resource */ public String getType() { return resource.getResourceType(); }
public final boolean isFolder(Resource res) { String type = res.getResourceType(); for (String treeType : treeTypes) { if (type.equalsIgnoreCase(treeType)) { return true; } } return false; } }
@Nonnull @Override public String getExportedType() { return resource.getResourceType(); } }
@Nonnull @Override public String getExportedType() { return resource.getResourceType(); }
@Nonnull @Override public String getExportedType() { return resource.getResourceType(); }
public static Set<String> getNestedComponentTypes(Resource root, boolean inclusive) { Set<Resource> flattenedResourceTree = flattenResourceTree(root, inclusive); Set<String> resourceTypeSet = Sets.newHashSet(); for (Resource currentResource : flattenedResourceTree) { if (currentResource.getResourceType() != null && StringUtils.isNotBlank(currentResource.getResourceType())) { resourceTypeSet.add(currentResource.getResourceType()); } } return resourceTypeSet; } }
/** * Returns the value of calling <code>getResourceType</code> on the * {@link #getResource() wrapped resource}. */ @Override public String getResourceType() { return getResource().getResourceType(); }
@Nonnull @Override public String getExportedType() { return request.getResource().getResourceType(); }
@Override public boolean apply(final ComponentNode componentNode) { return resourceType.equals(checkNotNull(componentNode).getResource().getResourceType()); } }
@Nonnull @Override public String getExportedType() { return request.getResource().getResourceType(); }
@Nonnull @Override public String getExportedType() { return request.getResource().getResourceType(); }
/** * Determine if the given path is external by verifying that it corresponds to an existing Sling resource. * * @param path JCR path or external URL * @param resourceResolver Sling resource resolver * @return true if path resolves to a valid Sling resource */ public static boolean isExternal(final String path, final ResourceResolver resourceResolver) { return RESOURCE_TYPE_NON_EXISTING.equals(checkNotNull(resourceResolver).resolve(checkNotNull(path)) .getResourceType()); }
@Nonnull @Override public String getExportedType() { if (StringUtils.isEmpty(resourceType)) { resourceType = pageProperties.get(ResourceResolver.PROPERTY_RESOURCE_TYPE, String.class); if (StringUtils.isEmpty(resourceType)) { resourceType = currentPage.getContentResource().getResourceType(); } } return resourceType; }
public <AdapterType> AdapterType getResourceAdapter(Resource resource, Class<AdapterType> type) { try { if (StringUtils.isNotBlank(resource.getResourceType()) && getAdministrativeResourceResolver().getResource(resource.getResourceType()) != null) { return (AdapterType) new DefaultTypedResource(resource, getAdministrativeResourceResolver()); } } catch (LoginException e) { LOG.error("Login Exception encountered acquiring an administrative Resource Resolver", e); } return null; }
private static Resource wrap(Resource resource, ValueMap valueMap, Iterable<Resource> children) { return new GraniteUiSyntheticResource(resource.getResourceResolver(), resource.getResourceMetadata(), resource.getResourceType(), valueMap, children); }
public void setResourceResolver(ResourceResolver resolver) { this.mockResourceResolver = resolver; // recreate request resource with the new resolver if (resource.getResourceResolver() == null) { this.resource = new SyntheticResource(resolver, resource.getPath(), resource.getResourceType()); } }
private void resend(Resource resource) throws PersistenceException, ActionSendException { final Map<String, String> message = MessageSerializer.getMessageFromResource(resource); if (sender.sendMessage(resource.getResourceType(), message)) { resource.getResourceResolver().delete(resource); } }
/** * Get shared properties ValueMap the current resource. */ protected ValueMap getSharedProperties(Page pageRoot, Resource resource) { String sharedPropsPath = pageRoot.getPath() + "/" + JcrConstants.JCR_CONTENT + "/" + SharedComponentProperties.NN_SHARED_COMPONENT_PROPERTIES + "/" + resource.getResourceType(); Resource sharedPropsResource = resource.getResourceResolver().getResource(sharedPropsPath); return sharedPropsResource != null ? sharedPropsResource.getValueMap() : ValueMapDecorator.EMPTY; }
public void checkNodeAcls(ResourceResolver res, String path, Privilege[] prvlgs) throws RepositoryException { Actions.setCurrentItem(path); Session session = res.adaptTo(Session.class); boolean report = res.getResource(path).getResourceType().equals(NameConstants.NT_PAGE); if (!session.getAccessControlManager().hasPrivileges(path, prvlgs)) { note(path, Report.acl_check, "FAIL"); throw new RepositoryException("Insufficient permissions to permit move operation"); } else if (report) { note(path, Report.acl_check, "PASS"); } }
private void testStarResourceHelper(final String path, final String method) { final Resource res = resResolver.resolve( new FakeSlingHttpServletRequest(path, method), path); assertNotNull(res); assertTrue(ResourceUtil.isStarResource(res)); assertEquals("sling:syntheticStarResource", res.getResourceType()); } }