01: /*
02: * $Header$
03: * $Revision: 7957 $
04: * $Date: 2007-08-23 04:22:35 -0700 $
05: *
06: * ====================================================================
07: *
08: * Copyright 1999-2004 The Apache Software Foundation
09: *
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: *
22: */
23: package org.apache.slide.index.lucene.expressions;
24:
25: import org.apache.lucene.index.Term;
26: import org.apache.lucene.search.TermQuery;
27:
28: import org.apache.slide.content.NodeProperty;
29: import org.apache.slide.index.lucene.Index;
30: import org.apache.slide.index.lucene.IndexConfiguration;
31:
32: /**
33: * Implements the <code>is-pricipal</code> and the <code>not-is-pricipal</code>
34: * expression.
35: */
36: public class IsPrincipalExpression extends AbstractLuceneExpression {
37: public IsPrincipalExpression(Index index, boolean negated) {
38: super (index);
39:
40: setQuery(new TermQuery(new Term(IndexConfiguration
41: .generateFieldName(NodeProperty.DEFAULT_NAMESPACE,
42: "resourcetype"), "principal")));
43:
44: if (negated) {
45: setQuery(negateQuery(getQuery()));
46: }
47: }
48: }
|