Package org.apache.sling.api.resource

Examples of org.apache.sling.api.resource.ValueMap.containsKey()


            String name = ResourceUtil.getName(path);
            String parentPath = ResourceUtil.getParent(path);
            Resource parentResource = getResourceInternal(parentPath);
            if (parentResource!=null) {
                ValueMap props = ResourceUtil.getValueMap(parentResource);
                if (props.containsKey(name)) {
                    return new MockPropertyResource(path, props, this);
                }
            }
        }
       
View Full Code Here


            newRefreshed = true;
        }
        try {
            Resource resource = resolver.getResource(path);
            final ValueMap props = resource.adaptTo(ValueMap.class);
            if (props.containsKey(PROP_VANITY_PATH)) {
                doAddVanity(path);
            }
            if (props.containsKey(ResourceResolverImpl.PROP_ALIAS)) {
                doAddAlias(path);
            }
View Full Code Here

            Resource resource = resolver.getResource(path);
            final ValueMap props = resource.adaptTo(ValueMap.class);
            if (props.containsKey(PROP_VANITY_PATH)) {
                doAddVanity(path);
            }
            if (props.containsKey(ResourceResolverImpl.PROP_ALIAS)) {
                doAddAlias(path);
            }
            if (path.startsWith(this.mapRoot)) {
                doUpdateConfiguration();
            }
View Full Code Here

            return;
        }
       
        final ValueMap props = resource.adaptTo(ValueMap.class);
        long vanityOrder = 0;
        if (props.containsKey(PROP_VANITY_ORDER)) {
            vanityOrder = props.get(PROP_VANITY_ORDER, Long.class);
        }  

        // url is ignoring scheme and host.port and the path is
        // what is stored in the sling:vanityPath property
View Full Code Here

                    final String nodePath = ResourceUtil.getParent(absolutePath);
                    final String propertyName = ResourceUtil.getName(absolutePath);
                    Resource resource = resourceResolver.getResource(nodePath);
                    if (resource!=null) {
                        ValueMap props = resource.adaptTo(ValueMap.class);
                        return props.containsKey(propertyName);
                    }
                    else {
                        return false;
                    }
                }
View Full Code Here

        this.rootNode.getSession().refresh(false);
        this.rootNode.setProperty(Text.escapeIllegalJcrChars(TEST_PATH), VALUE);
        this.rootNode.setProperty(PROP1, VALUE1);
        this.rootNode.setProperty(PROP2, VALUE2);
        final ValueMap vm = this.createPropertyMap(this.rootNode);
        assertTrue(vm.containsKey(TEST_PATH));
        search(vm.keySet().iterator(), TEST_PATH);
        search(vm.keySet().iterator(), PROP1);
        search(vm.keySet().iterator(), PROP2);
        search(vm.values().iterator(), VALUE);
        search(vm.values().iterator(), VALUE1);
View Full Code Here

    public void testIeratorsOld() throws Exception {
        this.rootNode.getSession().refresh(false);
        this.rootNode.setProperty(ISO9075.encodePath(TEST_PATH), VALUE);
        final ValueMap vm = this.createPropertyMap(this.rootNode);
        assertTrue(vm.containsKey(TEST_PATH));
        search(vm.keySet().iterator(), TEST_PATH);
        search(vm.values().iterator(), VALUE);
    }

    public void testDotSlash() throws Exception {
View Full Code Here

        final String value = "value";
        this.rootNode.setProperty(prop, value);
        final ValueMap vm = this.createPropertyMap(this.rootNode);
        assertEquals(value, vm.get(prop));
        assertEquals(value, vm.get("./" + prop));
        assertTrue(vm.containsKey("./" + prop));
    }

    protected void search(Iterator<?> i, Object value) {
        boolean found = false;
        while ( !found && i.hasNext() ) {
View Full Code Here

     */
    @Function
    public static List<Map<String, String>> getMultiFieldPanelValues(Resource resource, String name) {
        ValueMap map = resource.adaptTo(ValueMap.class);
        List<Map<String, String>> results = new ArrayList<Map<String, String>>();
        if (map.containsKey(name)) {
            String[] values = map.get(name, new String[0]);
            for (String value : values) {

                try {
                    JSONObject parsed = new JSONObject(value);
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.