View Javadoc

1   /*
2    * ModeShape (http://www.modeshape.org)
3    * See the COPYRIGHT.txt file distributed with this work for information
4    * regarding copyright ownership.  Some portions may be licensed
5    * to Red Hat, Inc. under one or more contributor license agreements.
6    * See the AUTHORS.txt file in the distribution for a full listing of 
7    * individual contributors.
8    *
9    * ModeShape is free software. Unless otherwise indicated, all code in ModeShape
10   * is licensed to you under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation; either version 2.1 of
12   * the License, or (at your option) any later version.
13   * 
14   * ModeShape is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this software; if not, write to the Free
21   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
23   */
24  package org.modeshape.graph.query.plan;
25  
26  import java.io.Serializable;
27  import net.jcip.annotations.NotThreadSafe;
28  import org.modeshape.graph.query.QueryResults;
29  
30  @NotThreadSafe
31  public final class PlanHints implements Serializable, Cloneable {
32  
33      private static final long serialVersionUID = 1L;
34  
35      /** This flag indicates that the plan has a criteria somewhere */
36      public boolean hasCriteria = false;
37  
38      /** This flag indicates that the plan has a join somewhere */
39      public boolean hasJoin = false;
40  
41      /** This flag indicates that the plan has a sort somewhere */
42      public boolean hasSort = false;
43  
44      // List of groups to make dependent
45      // public List makeDepGroups = null;
46  
47      /** flag indicates that the plan has a union somewhere */
48      public boolean hasSetQuery = false;
49  
50      // flag indicating that the plan has a grouping node somewhere
51      // public boolean hasAggregates = false;
52  
53      // List of groups that should not be dependent
54      // public List makeNotDepGroups = null;
55  
56      public boolean hasLimit = false;
57  
58      public boolean hasOptionalJoin = false;
59  
60      public boolean hasFullTextSearch = false;
61  
62      /** Flag indicates that the plan has at least one view somewhere */
63      public boolean hasView = false;
64  
65      /** Flag indicates whether the query plan should be included in the {@link QueryResults} */
66      public boolean showPlan = false;
67  
68      /** Flag indicates whether to check during validation for the existance of columns used in column selectors and criteria. */
69      public boolean validateColumnExistance = true;
70  
71      public PlanHints() {
72      }
73  
74      @Override
75      public String toString() {
76          StringBuilder sb = new StringBuilder("PlanHints {");
77          sb.append(" hasCriteria=").append(hasCriteria);
78          sb.append(", hasView=").append(hasView);
79          sb.append(", hasJoin=").append(hasJoin);
80          sb.append(", hasSort=").append(hasSort);
81          sb.append(", hasSetQuery=").append(hasSetQuery);
82          sb.append(", hasLimit=").append(hasLimit);
83          sb.append(", hasOptionalJoin=").append(hasOptionalJoin);
84          sb.append(", hasFullTextSearch=").append(hasFullTextSearch);
85          sb.append(", showPlan=").append(showPlan);
86          sb.append(", validateColumnExistance=").append(validateColumnExistance);
87          sb.append('}');
88          return sb.toString();
89      }
90  
91      /**
92       * {@inheritDoc}
93       * 
94       * @see java.lang.Object#clone()
95       */
96      @Override
97      public PlanHints clone() {
98          PlanHints clone = new PlanHints();
99          clone.hasCriteria = this.hasCriteria;
100         clone.hasView = this.hasView;
101         clone.hasJoin = this.hasJoin;
102         clone.hasSort = this.hasSort;
103         clone.hasSetQuery = this.hasSetQuery;
104         clone.hasLimit = this.hasLimit;
105         clone.hasOptionalJoin = this.hasOptionalJoin;
106         clone.hasFullTextSearch = this.hasFullTextSearch;
107         clone.showPlan = this.showPlan;
108         clone.validateColumnExistance = this.validateColumnExistance;
109         return clone;
110     }
111 }