All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.cq.commons.predicate.IsUnstructuredPredicate Maven / Gradle / Ivy

package com.day.cq.commons.predicate;

import com.day.cq.commons.jcr.JcrConstants;
import org.apache.commons.collections.Predicate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;

import javax.jcr.Node;
import javax.jcr.RepositoryException;

/**
 * Predicate used to filter nodes of type nt:unstructured.
 */
@Component(metatype = false)
@Service(Predicate.class)
@Properties({
        @Property(name = "predicate.name", value = "unstructured")
})
public class IsUnstructuredPredicate extends AbstractNodePredicate implements Predicate {

    /**
     * {@inheritDoc}
     *
     * @return true if node is or extends nt:unstructured
     */
    public boolean evaluate(Node node) throws RepositoryException {
        return node.isNodeType(JcrConstants.NT_UNSTRUCTURED);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy