@Override public final Set<String> keySet() { return this.metaDataMap.keySet(); }
/** * @see org.apache.sling.event.jobs.Job#getPropertyNames() */ @Override public Set<String> getPropertyNames() { return this.properties.keySet(); }
@Override public final Set<String> keySet() { return this.metaDataMap.keySet(); }
@Override public Set<String> keySet() { return this.map.keySet(); }
@Override public Set<String> keySet() { return this.properties.keySet(); }
@Override public Set<String> keySet() { return this.map.keySet(); }
public Set<String> keySet() { return delegate.keySet(); }
public Iterator<String> getPropertyNames() { return vm.keySet().iterator(); }
@Override public PropertyIterator getProperties() throws RepositoryException { return new FsPropertyIterator(props.keySet().iterator(), contentFile, resolver, this); }
/** * Execute the ImageTransformers as specified by the Request's suffix segments against the Image layer. * * @param layer the Image layer * @param imageTransformersWithParams the transforms and their params * @return the transformed Image layer */ protected final Layer transform(Layer layer, final ValueMap imageTransformersWithParams) { for (final String type : imageTransformersWithParams.keySet()) { if (StringUtils.equals(TYPE_QUALITY, type)) { // Do not process the "quality" transform in the usual manner continue; } final ImageTransformer imageTransformer = this.imageTransformers.get(type); if (imageTransformer == null) { log.warn("Skipping transform. Missing ImageTransformer for type: {}", type); continue; } final ValueMap transformParams = imageTransformersWithParams.get(type, EMPTY_PARAMS); if (transformParams != null) { layer = imageTransformer.transform(layer, transformParams); } } return layer; }
private void populate(Resource resource, String basePath, int depth) throws RepositoryException { ValueMap map = resource.getValueMap(); List<String> keys = new ArrayList<String>(map.keySet()); Collections.sort(keys); for (String key : keys) { Property property = resource.adaptTo(Node.class).getProperty(key); lines.add(new PageCompareDataLineImpl(property, basePath, depth + 1)); } Iterator<Resource> iter = resource.getChildren().iterator(); while (iter.hasNext()) { Resource child = iter.next(); lines.add(new PageCompareDataLineImpl(child, basePath, depth + 1)); populate(child, basePath, depth + 1); } } }
boolean propertiesPass(ValueMap current, ValueMap filter) throws ScriptException { if (filter.containsKey(PN_TEST)){ Object test = bindings.instantiateObject(filter.get(PN_TEST, "${false}")); if (! (test instanceof Boolean)){ logger.error("instatiated test {} is not a boolean, filtering out", test); return false; } return (Boolean) test; } for (String key : filter.keySet()){ if (! IGNORED_PROPERTIES.contains(key) && !key.startsWith(PREFIX_FILTER)){ Pattern pattern = Pattern.compile(filter.get(key, String.class)); if (!pattern.matcher(current.get(key, String.class)).find()){ return false; } } } return true; }
private Component findUrlFilterDefinitionComponent(Component component) { if (component == null) { return null; } ValueMap properties = component.getProperties(); // Collections.disjoint returns true if the collections // have nothing in common, so when it is false, use the current resource if (!Collections.disjoint(properties.keySet(), PROPERTY_NAMES)) { return component; } else { // otherwise, look at the resource type resource's super type return findUrlFilterDefinitionComponent(component.getSuperComponent()); } }
private Component findUrlFilterDefinitionComponent(Component component) { if (component == null) { return null; } ValueMap properties = component.getProperties(); // Collections.disjoint returns true if the collections // have nothing in common, so when it is false, use the current resource if (!Collections.disjoint(properties.keySet(), PROPERTY_NAMES)) { return component; } else { // otherwise, look at the resource type resource's super type return findUrlFilterDefinitionComponent(component.getSuperComponent()); } }
/** * Read the properties from the repository */ private void readProperties(final Resource res) { final Map<String, String> props = new HashMap<String, String>(); if (res != null) { final Resource propertiesChild = res.getChild("properties"); if (propertiesChild != null) { final ValueMap properties = propertiesChild.adaptTo(ValueMap.class); if (properties != null) { for (Iterator<String> it = properties.keySet().iterator(); it .hasNext();) { String key = it.next(); if (!key.equals("jcr:primaryType")) { props.put(key, properties.get(key, String.class)); } } } } } setProperties(props); } }
private static DistributionQueueItem deserializeItem(ValueMap valueMap) { String packageId = valueMap.get(DISTRIBUTION_PACKAGE_ID, String.class); Long sizeProperty = valueMap.get(DISTRIBUTION_PACKAGE_SIZE, Long.class); long size = sizeProperty == null ? -1 : sizeProperty; Map<String, Object> properties = new HashMap<String, Object>(); for (String key : valueMap.keySet()) { if (key.startsWith(DISTRIBUTION_PACKAGE_PREFIX)) { String infoKey = key.substring(DISTRIBUTION_PACKAGE_PREFIX.length()); Object value = valueMap.get(key); if (DistributionPackageInfo.PROPERTY_REQUEST_TYPE.equals(infoKey)) { if (value instanceof String) { value = DistributionRequestType.valueOf((String) value); } } properties.put(infoKey, value); } } DistributionQueueItem queueItem = new DistributionQueueItem(packageId, size, properties); return queueItem; }
/** * remove properties, returns the number of properties that were configured to be removed * @return */ private int removeProperties(Resource resource, Resource configuration) throws RepositoryException { int count = 0; if (configuration != null) { Node node = resource.adaptTo(Node.class); ValueMap configuredProperties = configuration.adaptTo(ValueMap.class); for (String key : configuredProperties.keySet()){ if (! IGNORED_PROPERTIES.contains(key)){ count++; if (node.hasProperty(key)){ logger.info("removing {}", node.getProperty(key).getPath()); if (! isDryRun()){ node.getProperty(key).remove(); } } } } } return count; }
private void populate(Resource r, int depth) throws PathNotFoundException, RepositoryException { ValueMap map = r.getValueMap(); List<String> keys = new ArrayList<String>(map.keySet()); Collections.sort(keys); for (String key : keys) { Property property = r.adaptTo(Node.class).getProperty(key); String relPath = config.getRelativePropertyName(property.getPath()); if (config.handleProperty(relPath)) { versionEntries.add(new EvolutionEntryImpl(property, version, config)); } } Iterator<Resource> iter = r.getChildren().iterator(); while (iter.hasNext()) { depth++; Resource child = iter.next(); String relPath = config.getRelativeResourceName(child.getPath()); if (config.handleResource(relPath)) { versionEntries.add(new EvolutionEntryImpl(child, version, config)); populate(child, depth); } depth--; } } }
private void populate(Resource r, int depth) throws PathNotFoundException, RepositoryException { ValueMap map = r.getValueMap(); List<String> keys = new ArrayList<String>(map.keySet()); Collections.sort(keys); for (String key : keys) { Property property = r.adaptTo(Node.class).getProperty(key); String relPath = EvolutionPathUtil.getRelativePropertyName(property.getPath()); if (config.handleProperty(relPath)) { versionEntries.add(new EvolutionEntryImpl(property, version, config)); } } Iterator<Resource> iter = r.getChildren().iterator(); while (iter.hasNext()) { depth++; Resource child = iter.next(); String relPath = EvolutionPathUtil.getRelativeResourceName(child.getPath()); if (config.handleResource(relPath)) { versionEntries.add(new EvolutionEntryImpl(child, version, config)); populate(child, depth); } depth--; } } }
private void checkReferences(Resource resource) { log.debug("Checking for references in resource {}", resource); ValueMap properties = resource.getValueMap(); properties.keySet().forEach(k -> { if (properties.get(k) instanceof String) { if (matches(properties.get(k, String.class))) { log.trace("Found reference in property {}@{}", resource.getPath(), k); doProcess(resource, k); } } else if (properties.get(k) instanceof String[]) { for (String v : properties.get(k, String[].class)) { if (matches(v)) { log.trace("Found reference in property {}@{}", resource.getPath(), k); doProcess(resource, k); break; } } } }); }