xref: /OpenGrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/QueryParameters.java (revision 912cbfdf480a7d5e004f3f4fc465ec8adc1ab0e5)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * See LICENSE.txt included in this distribution for the specific
9  * language governing permissions and limitations under the License.
10  *
11  * When distributing Covered Code, include this CDDL HEADER in each
12  * file and include the License file at LICENSE.txt.
13  * If applicable, add the following below this CDDL HEADER, with the
14  * fields enclosed by brackets "[]" replaced with your own identifying
15  * information: Portions Copyright [yyyy] [name of copyright owner]
16  *
17  * CDDL HEADER END
18  */
19 
20 /*
21  * Copyright (c) 2020, Chris Fraire <cfraire@me.com>.
22  */
23 package org.opengrok.indexer.web;
24 
25 /**
26  * Represents a container for OpenGrok web query parameter names.
27  */
28 public class QueryParameters {
29     /**
30      * Parameter name to control activation of xref annotation.
31      */
32     public static final String ANNOTATION_PARAM = "a";
33 
34     /**
35      * {@link #ANNOTATION_PARAM} concatenated with {@code "=true" }.
36      */
37     public static final String ANNOTATION_PARAM_EQ_TRUE = ANNOTATION_PARAM + "=true";
38 
39     /**
40      * Parameter name to specify a count value.
41      */
42     public static final String COUNT_PARAM = "n";
43 
44     /**
45      * {@link #COUNT_PARAM} concatenated with {@code "=" }.
46      */
47     public static final String COUNT_PARAM_EQ = COUNT_PARAM + "=";
48 
49     /**
50      * Parameter name to specify an OpenGrok search of definitions.
51      */
52     public static final String DEFS_SEARCH_PARAM = "defs";
53 
54     /**
55      * {@link #DEFS_SEARCH_PARAM} concatenated with {@code "=" }.
56      */
57     public static final String DEFS_SEARCH_PARAM_EQ = DEFS_SEARCH_PARAM + "=";
58 
59     /**
60      * Parameter name to specify a source code degree of diffing.
61      */
62     public static final String DIFF_LEVEL_PARAM = "full";
63 
64     /**
65      * {@link #DIFF_LEVEL_PARAM} concatenated with {@code "=" }.
66      */
67     public static final String DIFF_LEVEL_PARAM_EQ = DIFF_LEVEL_PARAM + "=";
68 
69     /**
70      * Parameter name to specify a format setting.
71      */
72     public static final String FORMAT_PARAM = "format";
73 
74     /**
75      * {@link #FORMAT_PARAM} concatenated with {@code "=" }.
76      */
77     public static final String FORMAT_PARAM_EQ = FORMAT_PARAM + "=";
78 
79     /**
80      * Parameter name to specify a mediated fragment identifier.
81      */
82     public static final String FRAGMENT_IDENTIFIER_PARAM = "fi";
83 
84     /**
85      * {@link #FRAGMENT_IDENTIFIER_PARAM} concatenated with {@code "=" }.
86      */
87     public static final String FRAGMENT_IDENTIFIER_PARAM_EQ = FRAGMENT_IDENTIFIER_PARAM + "=";
88 
89     /**
90      * Parameter name to specify an OpenGrok full search.
91      */
92     public static final String FULL_SEARCH_PARAM = "full";
93 
94     /**
95      * {@link #FULL_SEARCH_PARAM} concatenated with {@code "=" }.
96      */
97     public static final String FULL_SEARCH_PARAM_EQ = FULL_SEARCH_PARAM + "=";
98 
99     /**
100      * Parameter name to specify an OpenGrok search of history.
101      */
102     public static final String HIST_SEARCH_PARAM = "hist";
103 
104     /**
105      * {@link #HIST_SEARCH_PARAM} concatenated with {@code "=" }.
106      */
107     public static final String HIST_SEARCH_PARAM_EQ = HIST_SEARCH_PARAM + "=";
108 
109     /**
110      * Parameter name to specify a match offset.
111      */
112     public static final String MATCH_OFFSET_PARAM = "mo";
113 
114     /**
115      * {@link #MATCH_OFFSET_PARAM} concatenated with {@code "=" }.
116      */
117     public static final String MATCH_OFFSET_PARAM_EQ = MATCH_OFFSET_PARAM + "=";
118 
119     /**
120      * Parameter name to specify a value indicating if redirection should be
121      * short-circuited when state or query result would have an indicated
122      * otherwise.
123      */
124     public static final String NO_REDIRECT_PARAM = "xrd";
125 
126     /**
127      * Parameter name to specify a count of projects selected by the user
128      * through browser interaction.
129      */
130     public static final String NUM_SELECTED_PARAM = "nn";
131 
132     /**
133      * Parameter name to specify an OpenGrok search of paths.
134      */
135     public static final String PATH_SEARCH_PARAM = "path";
136 
137     /**
138      * {@link #PATH_SEARCH_PARAM} concatenated with {@code "=" }.
139      */
140     public static final String PATH_SEARCH_PARAM_EQ = PATH_SEARCH_PARAM + "=";
141 
142     /**
143      * Parameter name to specify an OpenGrok project search.
144      */
145     public static final String PROJECT_SEARCH_PARAM = "project";
146 
147     /**
148      * {@link #PROJECT_SEARCH_PARAM} concatenated with {@code "=" }.
149      */
150     public static final String PROJECT_SEARCH_PARAM_EQ = PROJECT_SEARCH_PARAM + "=";
151 
152     /**
153      * Parameter name to specify an OpenGrok search of references of symbols.
154      */
155     public static final String REFS_SEARCH_PARAM = "refs";
156 
157     /**
158      * {@link #REFS_SEARCH_PARAM} concatenated with {@code "=" }.
159      */
160     public static final String REFS_SEARCH_PARAM_EQ = REFS_SEARCH_PARAM + "=";
161 
162     /**
163      * Parameter name to specify a source repository revision ID.
164      */
165     public static final String REVISION_PARAM = "r";
166 
167     /**
168      * {@link #REVISION_PARAM} concatenated with {@code "=" }.
169      */
170     public static final String REVISION_PARAM_EQ = REVISION_PARAM + "=";
171 
172     /**
173      * Parameter name to specify a first source repository revision ID.
174      */
175     public static final String REVISION_1_PARAM = "r1";
176 
177     /**
178      * {@link #REVISION_1_PARAM} concatenated with {@code "=" }.
179      */
180     public static final String REVISION_1_PARAM_EQ = REVISION_1_PARAM + "=";
181 
182     /**
183      * Parameter name to specify a second source repository revision ID.
184      */
185     public static final String REVISION_2_PARAM = "r2";
186 
187     /**
188      * {@link #REVISION_2_PARAM} concatenated with {@code "=" }.
189      */
190     public static final String REVISION_2_PARAM_EQ = REVISION_2_PARAM + "=";
191 
192     /**
193      * Parameter name to specify a sort setting.
194      */
195     public static final String SORT_PARAM = "sort";
196 
197     /**
198      * {@link #SORT_PARAM} concatenated with {@code "=" }.
199      */
200     public static final String SORT_PARAM_EQ = SORT_PARAM + "=";
201 
202     /**
203      * Parameter name to specify a starting value.
204      */
205     public static final String START_PARAM = "start";
206 
207     /**
208      * {@link #START_PARAM} concatenated with {@code "=" }.
209      */
210     public static final String START_PARAM_EQ = START_PARAM + "=";
211 
212     /**
213      * Parameter name to specify an OpenGrok search of file type.
214      */
215     public static final String TYPE_SEARCH_PARAM = "type";
216 
217     /**
218      * {@link #TYPE_SEARCH_PARAM} concatenated with {@code "=" }.
219      */
220     public static final String TYPE_SEARCH_PARAM_EQ = TYPE_SEARCH_PARAM + "=";
221 
222     /**
223      * Parameter name to specify window hash for utils-*.js.
224      */
225     public static final String WINDOW_HASH_PARAM = "h";
226 
227     /**
228      * {@link #WINDOW_HASH_PARAM} concatenated with {@code "=" }.
229      */
230     public static final String WINDOW_HASH_PARAM_EQ = WINDOW_HASH_PARAM + "=";
231 
232     /**
233      * Parameter to be used when searching all projects. Useful when instance has too many projects and the resulting
234      * URL consisting of all projects could be too long.
235      */
236     public static final String ALL_PROJECT_SEARCH = "searchall";
237 
238     /* private to enforce static */
QueryParameters()239     private QueryParameters() {
240     }
241 }
242