Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ResourceResolver.findResources()


    log.debug("Finding resources using query: {} of language {}", query,
        language);

    ResourceResolver resolver = getResourceResolver();
    final Iterator<Resource> resources = resolver.findResources(query,
        language);
   
    log.debug("Saving resources to variable {}", var);
    pageContext.setAttribute(var, resources);
View Full Code Here


            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
            rr.findResources("a", "b");
            fail();
        } catch (final IllegalStateException ise) {
            // expected
        }
        try {
View Full Code Here

            }
            buf.append("]");
            if ( logger.isDebugEnabled() ) {
                logger.debug("Executing query {}", buf);
            }
            final Iterator<Resource> iter = resolver.findResources(buf.toString(), "xpath");
            while ( iter.hasNext() ) {
                final Resource eventResource = iter.next();
                if ( eventResource.getPath().startsWith(this.config.getResourcePathWithSlash()) ) {
                    final ReadResult readResult = this.readEvent(eventResource);
                    if ( readResult != null && readResult.event != null ) {
View Full Code Here

                if (searchPath.endsWith("/")) {
                    searchPath = searchPath.substring(0, searchPath.length() - 1);
                }
                final String queryString = String.format(MODEL_XPATH_QUERY, searchPath, Constants.VALIDATION_MODEL_RESOURCE_TYPE,
                        Constants.VALIDATED_RESOURCE_TYPE, validatedResourceType);
                Iterator<Resource> models = rr.findResources(queryString, Query.XPATH);
                while (models.hasNext()) {
                    Resource model = models.next();
                    LOG.info("Found validation model resource {}.", model.getPath());
                    String jcrPath = model.getPath();
                    ValueMap validationModelProperties = model.adaptTo(ValueMap.class);
View Full Code Here

            buf.append(")[@");
            buf.append(ISO9075.encode(JobUtil.PROPERTY_JOB_NAME));
            buf.append(" = '");
            buf.append(name);
            buf.append("']");
            final Iterator<Resource> result = resolver.findResources(buf.toString(), "xpath");

            while ( result.hasNext() ) {
                final Resource jobResource = result.next();
                // sanity check for the path
                if ( this.configuration.isJob(jobResource.getPath()) ) {
View Full Code Here

            buf.append(id);
            buf.append("']");
            if ( logger.isDebugEnabled() ) {
                logger.debug("Exceuting query: {}", buf.toString());
            }
            final Iterator<Resource> result = resolver.findResources(buf.toString(), "xpath");

            while ( result.hasNext() ) {
                final Resource jobResource = result.next();
                // sanity check for the path
                if ( this.configuration.isJob(jobResource.getPath()) ) {
View Full Code Here

                buf.append(" descending");
            } else {
                buf.append(Job.PROPERTY_JOB_CREATED);
                buf.append(" ascending");
            }
            final Iterator<Resource> iter = resolver.findResources(buf.toString(), "xpath");
            long count = 0;

            while ( iter.hasNext() && (limit < 1 || count < limit) ) {
                final Resource jobResource = iter.next();
                // sanity check for the path
View Full Code Here

            buf.append(" < xs:dateTime('");
            buf.append(ISO8601.format(startDate));
            buf.append("')] order by @");
            buf.append(ISO9075.encode(JobUtil.PROPERTY_JOB_CREATED));
            buf.append(" ascending");
            final Iterator<Resource> result = resolver.findResources(buf.toString(), "xpath");

            while ( result.hasNext() ) {
                final Resource eventResource = result.next();
                // sanity check for the path
                if ( eventResource.getPath().startsWith(this.config.getResourcePathWithSlash()) ) {
View Full Code Here

            buf.append(" < xs:dateTime('");
            buf.append(ISO8601.format(startDate));
            buf.append("')] order by @");
            buf.append(ISO9075.encode(org.apache.sling.event.jobs.Job.PROPERTY_JOB_CREATED));
            buf.append(" ascending");
            final Iterator<Resource> result = resolver.findResources(buf.toString(), "xpath");

            while ( result.hasNext() ) {
                final Resource eventResource = result.next();
                // sanity check for the path
                if ( eventResource.getPath().startsWith(this.configuration.getScheduledJobsPath(true)) ) {
View Full Code Here

            jsonWriter.array();

            if (StringUtils.isNotBlank(vanityPath)) {
                String xpath = "//element(*)[" + NameConstants.PN_SLING_VANITY_PATH + "='" + vanityPath + "']";
                @SuppressWarnings("deprecation")
                Iterator<Resource> resources = resolver.findResources(xpath, Query.XPATH);
                while (resources.hasNext()) {
                    Resource resource = resources.next();
                    String path = resource.getPath();
                    if (path.startsWith("/content") && !path.equals(pagePath)) {
                        jsonWriter.value(path);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.