001    package org.apache.archiva.rest.api.model;
002    
003    import javax.xml.bind.annotation.XmlRootElement;
004    import java.io.Serializable;
005    import java.util.ArrayList;
006    import java.util.List;
007    
008    /*
009     * Licensed to the Apache Software Foundation (ASF) under one
010     * or more contributor license agreements.  See the NOTICE file
011     * distributed with this work for additional information
012     * regarding copyright ownership.  The ASF licenses this file
013     * to you under the Apache License, Version 2.0 (the
014     * "License"); you may not use this file except in compliance
015     * with the License.  You may obtain a copy of the License at
016     *
017     *  http://www.apache.org/licenses/LICENSE-2.0
018     *
019     * Unless required by applicable law or agreed to in writing,
020     * software distributed under the License is distributed on an
021     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
022     * KIND, either express or implied.  See the License for the
023     * specific language governing permissions and limitations
024     * under the License.
025     */
026    @XmlRootElement( name = "searchRequest" )
027    public class SearchRequest
028        implements Serializable
029    {
030    
031        /**
032         * @since 1.4-M3
033         *        to be able to search with a query on selected repositories
034         */
035        private String queryTerms;
036    
037        /**
038         * groupId
039         */
040        private String groupId;
041    
042        /**
043         * artifactId
044         */
045        private String artifactId;
046    
047        /**
048         * version
049         */
050        private String version;
051    
052        /**
053         * packaging (jar, war, pom, etc.)
054         */
055        private String packaging;
056    
057        /**
058         * class name or package name
059         */
060        private String className;
061    
062        /**
063         * repositories
064         */
065        private List<String> repositories = new ArrayList<String>();
066    
067    
068        /**
069         * contains osgi metadata Bundle-Version if available
070         *
071         * @since 1.4-M1
072         */
073        private String bundleVersion;
074    
075        /**
076         * contains osgi metadata Bundle-SymbolicName if available
077         *
078         * @since 1.4-M1
079         */
080        private String bundleSymbolicName;
081    
082        /**
083         * contains osgi metadata Export-Package if available
084         *
085         * @since 1.4-M1
086         */
087        private String bundleExportPackage;
088    
089        /**
090         * contains osgi metadata Export-Service if available
091         *
092         * @since 1.4-M1
093         */
094        private String bundleExportService;
095    
096        /**
097         * contains osgi metadata Import-Package if available
098         *
099         * @since 1.4-M3
100         */
101        private String bundleImportPackage;
102    
103    
104        /**
105         * contains osgi metadata Require-Bundle if available
106         *
107         * @since 1.4-M3
108         */
109        private String bundleRequireBundle;
110    
111        private String classifier;
112    
113        /**
114         * not return artifact with file extension pom
115         *
116         * @since 1.4-M2
117         */
118        private boolean includePomArtifacts = false;
119    
120        /**
121         * @since 1.4-M4
122         */
123        private int pageSize = 30;
124    
125        /**
126         * @since 1.4-M4
127         */
128        private int selectedPage = 0;
129    
130    
131        public SearchRequest()
132        {
133            // no op
134        }
135    
136        public SearchRequest( String groupId, String artifactId, String version, String packaging, String className,
137                              List<String> repositories )
138        {
139            this.groupId = groupId;
140            this.artifactId = artifactId;
141            this.version = version;
142            this.packaging = packaging;
143            this.className = className;
144            this.repositories = repositories;
145        }
146    
147        public String getGroupId()
148        {
149            return groupId;
150        }
151    
152        public void setGroupId( String groupId )
153        {
154            this.groupId = groupId;
155        }
156    
157        public String getArtifactId()
158        {
159            return artifactId;
160        }
161    
162        public void setArtifactId( String artifactId )
163        {
164            this.artifactId = artifactId;
165        }
166    
167        public String getVersion()
168        {
169            return version;
170        }
171    
172        public void setVersion( String version )
173        {
174            this.version = version;
175        }
176    
177        public String getPackaging()
178        {
179            return packaging;
180        }
181    
182        public void setPackaging( String packaging )
183        {
184            this.packaging = packaging;
185        }
186    
187        public String getClassName()
188        {
189            return className;
190        }
191    
192        public void setClassName( String className )
193        {
194            this.className = className;
195        }
196    
197        public List<String> getRepositories()
198        {
199            return repositories;
200        }
201    
202        public void setRepositories( List<String> repositories )
203        {
204            this.repositories = repositories;
205        }
206    
207    
208        public String getBundleVersion()
209        {
210            return bundleVersion;
211        }
212    
213        public void setBundleVersion( String bundleVersion )
214        {
215            this.bundleVersion = bundleVersion;
216        }
217    
218        public String getBundleSymbolicName()
219        {
220            return bundleSymbolicName;
221        }
222    
223        public void setBundleSymbolicName( String bundleSymbolicName )
224        {
225            this.bundleSymbolicName = bundleSymbolicName;
226        }
227    
228        public String getBundleExportPackage()
229        {
230            return bundleExportPackage;
231        }
232    
233        public void setBundleExportPackage( String bundleExportPackage )
234        {
235            this.bundleExportPackage = bundleExportPackage;
236        }
237    
238        public String getBundleExportService()
239        {
240            return bundleExportService;
241        }
242    
243        public void setBundleExportService( String bundleExportService )
244        {
245            this.bundleExportService = bundleExportService;
246        }
247    
248        public String getClassifier()
249        {
250            return classifier;
251        }
252    
253        public void setClassifier( String classifier )
254        {
255            this.classifier = classifier;
256        }
257    
258        public boolean isIncludePomArtifacts()
259        {
260            return includePomArtifacts;
261        }
262    
263        public void setIncludePomArtifacts( boolean includePomArtifacts )
264        {
265            this.includePomArtifacts = includePomArtifacts;
266        }
267    
268        public String getQueryTerms()
269        {
270            return queryTerms;
271        }
272    
273        public void setQueryTerms( String queryTerms )
274        {
275            this.queryTerms = queryTerms;
276        }
277    
278        public String getBundleImportPackage()
279        {
280            return bundleImportPackage;
281        }
282    
283        public void setBundleImportPackage( String bundleImportPackage )
284        {
285            this.bundleImportPackage = bundleImportPackage;
286        }
287    
288        public String getBundleRequireBundle()
289        {
290            return bundleRequireBundle;
291        }
292    
293        public void setBundleRequireBundle( String bundleRequireBundle )
294        {
295            this.bundleRequireBundle = bundleRequireBundle;
296        }
297    
298        public int getPageSize()
299        {
300            return pageSize;
301        }
302    
303        public void setPageSize( int pageSize )
304        {
305            this.pageSize = pageSize;
306        }
307    
308        public int getSelectedPage()
309        {
310            return selectedPage;
311        }
312    
313        public void setSelectedPage( int selectedPage )
314        {
315            this.selectedPage = selectedPage;
316        }
317    
318        @Override
319        public String toString()
320        {
321            final StringBuilder sb = new StringBuilder();
322            sb.append( "SearchRequest" );
323            sb.append( "{queryTerms='" ).append( queryTerms ).append( '\'' );
324            sb.append( ", groupId='" ).append( groupId ).append( '\'' );
325            sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
326            sb.append( ", version='" ).append( version ).append( '\'' );
327            sb.append( ", packaging='" ).append( packaging ).append( '\'' );
328            sb.append( ", className='" ).append( className ).append( '\'' );
329            sb.append( ", repositories=" ).append( repositories );
330            sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
331            sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
332            sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
333            sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
334            sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
335            sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
336            sb.append( ", classifier='" ).append( classifier ).append( '\'' );
337            sb.append( ", includePomArtifacts=" ).append( includePomArtifacts );
338            sb.append( ", pageSize=" ).append( pageSize );
339            sb.append( ", selectedPage=" ).append( selectedPage );
340            sb.append( '}' );
341            return sb.toString();
342        }
343    }