View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.ext.scimv2.api.data;
20  
21  import com.fasterxml.jackson.annotation.JsonCreator;
22  import com.fasterxml.jackson.annotation.JsonProperty;
23  import java.util.ArrayList;
24  import java.util.List;
25  import java.util.Optional;
26  import org.apache.syncope.ext.scimv2.api.type.Resource;
27  import org.apache.syncope.ext.scimv2.api.type.SortOrder;
28  
29  public class SCIMSearchRequest extends SCIMBean {
30  
31      private static final long serialVersionUID = 5759362928661983543L;
32  
33      private final List<String> schemas = List.of(Resource.SearchRequest.schema());
34  
35      private final List<String> attributes = new ArrayList<>();
36  
37      private final List<String> excludedAttributes = new ArrayList<>();
38  
39      private final String filter;
40  
41      private final String sortBy;
42  
43      private final SortOrder sortOrder;
44  
45      private final Integer startIndex;
46  
47      private final Integer count;
48  
49      @JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
50      public SCIMSearchRequest(
51              @JsonProperty("filter") final String filter,
52              @JsonProperty("sortBy") final String sortBy,
53              @JsonProperty("sortOrder") final SortOrder sortOrder,
54              @JsonProperty("startIndex") final Integer startIndex,
55              @JsonProperty("count") final Integer count) {
56  
57          this.filter = filter;
58          this.sortBy = sortBy;
59          this.sortOrder = sortOrder;
60          this.startIndex = startIndex;
61          this.count = count;
62      }
63  
64      public List<String> getSchemas() {
65          return schemas;
66      }
67  
68      public List<String> getAttributes() {
69          return attributes;
70      }
71  
72      public List<String> getExcludedAttributes() {
73          return excludedAttributes;
74      }
75  
76      public String getFilter() {
77          return filter;
78      }
79  
80      public String getSortBy() {
81          return sortBy;
82      }
83  
84      public SortOrder getSortOrder() {
85          return sortOrder;
86      }
87  
88      public int getStartIndex() {
89          return Optional.ofNullable(startIndex).orElse(1);
90      }
91  
92      public int getCount() {
93          return Optional.ofNullable(count).orElse(25);
94      }
95  }