This project has retired. For details please refer to its Attic page.
AbstractUserQuery xref
View Javadoc

1   package org.apache.archiva.redback.users;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * Abstract Implementation of UserQuery.
24   * Intended to be subclassed by UserManager providers.
25   */
26  public abstract class AbstractUserQuery
27      implements UserQuery
28  {
29  
30      private String username;
31  
32      private String fullName;
33  
34      private String email;
35  
36      private long maxResults = -1;
37  
38      private long firstResult;
39  
40      private String orderBy = ORDER_BY_USERNAME;
41  
42      private boolean ascending = true;
43  
44      public String getUsername()
45      {
46          return username;
47      }
48  
49      public void setUsername( String userName )
50      {
51          this.username = userName;
52      }
53  
54      public String getFullName()
55      {
56          return fullName;
57      }
58  
59      public void setFullName( String fullName )
60      {
61          this.fullName = fullName;
62      }
63  
64      public String getEmail()
65      {
66          return email;
67      }
68  
69      public void setEmail( String email )
70      {
71          this.email = email;
72      }
73  
74      public long getFirstResult()
75      {
76          return firstResult;
77      }
78  
79      public void setFirstResult( int firstResult )
80      {
81          this.firstResult = firstResult;
82      }
83  
84      public long getMaxResults()
85      {
86          return maxResults;
87      }
88  
89      public void setMaxResults( int maxResults )
90      {
91          this.maxResults = maxResults;
92      }
93  
94      public String getOrderBy()
95      {
96          return orderBy;
97      }
98  
99      public void setOrderBy( String orderBy )
100     {
101         if ( orderBy == null )
102         {
103             throw new IllegalArgumentException( "orderBy cannot be set to null" );
104         }
105         else if ( !ALLOWED_ORDER_FIELDS.contains( orderBy ) )
106         {
107             throw new IllegalArgumentException( orderBy + " is not an allowed orderBy field: " + orderBy );
108         }
109         this.orderBy = orderBy;
110     }
111 
112     public boolean isAscending()
113     {
114         return ascending;
115     }
116 
117     public void setAscending( boolean ascending )
118     {
119         this.ascending = ascending;
120     }
121 
122 }