Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* ModeShape (http://www.modeshape.org)
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership. Some portions may be licensed
* to Red Hat, Inc. under one or more contributor license agreements.
* See the AUTHORS.txt file in the distribution for a full listing of
* individual contributors.
*
* ModeShape is free software. Unless otherwise indicated, all code in ModeShape
* is licensed to you under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* ModeShape is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.modeshape.jcr.query.process;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.modeshape.jcr.api.query.qom.Operator;
import org.modeshape.jcr.query.QueryResults.Columns;
import org.modeshape.jcr.query.QueryResults.Location;
import org.modeshape.jcr.query.lucene.CompareStringQuery;
import org.modeshape.jcr.query.model.And;
import org.modeshape.jcr.query.model.BindVariableName;
import org.modeshape.jcr.query.model.ChildNode;
import org.modeshape.jcr.query.model.Comparison;
import org.modeshape.jcr.query.model.Constraint;
import org.modeshape.jcr.query.model.DescendantNode;
import org.modeshape.jcr.query.model.FullTextSearch;
import org.modeshape.jcr.query.model.Literal;
import org.modeshape.jcr.query.model.Not;
import org.modeshape.jcr.query.model.Or;
import org.modeshape.jcr.query.model.PropertyExistence;
import org.modeshape.jcr.query.model.Relike;
import org.modeshape.jcr.query.model.SameNode;
import org.modeshape.jcr.query.model.SetCriteria;
import org.modeshape.jcr.query.model.StaticOperand;
import org.modeshape.jcr.query.model.TypeSystem;
import org.modeshape.jcr.query.model.TypeSystem.TypeFactory;
import org.modeshape.jcr.query.validate.Schemata;
import org.modeshape.jcr.value.Path;
/**
*/
public class SelectComponent extends DelegatingComponent {
private final Constraint constraint;
private final ConstraintChecker checker;
private final Map variables;
/**
* Create a SELECT processing component that pass those tuples that satisfy the supplied constraint. Certain constraints
* (including {@link FullTextSearch}, {@link SameNode} and {@link PropertyExistence}) are evaluated in a fairly limited
* fashion, essentially operating upon the tuple values themselves.
*
* For example, the {@link SameNode} constraint is satisfied when the selected node has the same path as the constraint's
* {@link SameNode#getPath() path}. And the {@link PropertyExistence} constraint is satisfied when the
* {@link PropertyExistence#getPropertyName() property} is represented in the tuple with a non-null value. Similarly,
* {@link FullTextSearch} always evaluates to true. Obviously these implementations will likely not be sufficient for many
* purposes. But in cases where these particular constraints are handled in other ways (and thus not expected to be seen by
* this processor), this form may be sufficient.
*
*
* @param delegate the delegate processing component that this component should use to obtain the input tuples; may not be
* null
* @param constraint the query constraint; may not be null
* @param variables the map of variables keyed by their name (as used in {@link BindVariableName} constraints); may be null
*/
public SelectComponent( ProcessingComponent delegate,
Constraint constraint,
Map variables ) {
super(delegate);
this.constraint = constraint;
this.variables = variables != null ? variables : Collections.emptyMap();
TypeSystem types = delegate.getContext().getTypeSystem();
Schemata schemata = delegate.getContext().getSchemata();
this.checker = createChecker(types, schemata, delegate.getColumns(), this.constraint, this.variables);
}
@Override
public List