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 public boolean hasSubqueries = false;
63
64 /** Flag indicates that the plan has at least one view somewhere */
65 public boolean hasView = false;
66
67 /** Flag indicates whether the query plan should be included in the {@link QueryResults} */
68 public boolean showPlan = false;
69
70 /** Flag indicates whether to check during validation for the existance of columns used in column selectors and criteria. */
71 public boolean validateColumnExistance = true;
72
73 public PlanHints() {
74 }
75
76 @Override
77 public String toString() {
78 StringBuilder sb = new StringBuilder("PlanHints {");
79 sb.append(" hasCriteria=").append(hasCriteria);
80 sb.append(", hasView=").append(hasView);
81 sb.append(", hasJoin=").append(hasJoin);
82 sb.append(", hasSort=").append(hasSort);
83 sb.append(", hasSetQuery=").append(hasSetQuery);
84 sb.append(", hasLimit=").append(hasLimit);
85 sb.append(", hasOptionalJoin=").append(hasOptionalJoin);
86 sb.append(", hasFullTextSearch=").append(hasFullTextSearch);
87 sb.append(", hasSubqueries=").append(hasSubqueries);
88 sb.append(", showPlan=").append(showPlan);
89 sb.append(", validateColumnExistance=").append(validateColumnExistance);
90 sb.append('}');
91 return sb.toString();
92 }
93
94 /**
95 * {@inheritDoc}
96 *
97 * @see java.lang.Object#clone()
98 */
99 @Override
100 public PlanHints clone() {
101 PlanHints clone = new PlanHints();
102 clone.hasCriteria = this.hasCriteria;
103 clone.hasView = this.hasView;
104 clone.hasJoin = this.hasJoin;
105 clone.hasSort = this.hasSort;
106 clone.hasSetQuery = this.hasSetQuery;
107 clone.hasLimit = this.hasLimit;
108 clone.hasOptionalJoin = this.hasOptionalJoin;
109 clone.hasFullTextSearch = this.hasFullTextSearch;
110 clone.showPlan = this.showPlan;
111 clone.validateColumnExistance = this.validateColumnExistance;
112 return clone;
113 }
114 }