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.common.lib.scim;
20  
21  import com.fasterxml.jackson.annotation.JsonIgnore;
22  import java.io.Serializable;
23  import java.time.OffsetDateTime;
24  import java.util.Optional;
25  import org.apache.commons.lang3.StringUtils;
26  
27  public class SCIMGeneralConf implements Serializable {
28  
29      private static final long serialVersionUID = 3228349133950736647L;
30  
31      private OffsetDateTime creationDate = OffsetDateTime.now();
32  
33      private OffsetDateTime lastChangeDate = OffsetDateTime.now();
34  
35      private int bulkMaxOperations = 1000;
36  
37      private int bulkMaxPayloadSize = 1048576;
38  
39      private int filterMaxResults = 200;
40  
41      public OffsetDateTime getCreationDate() {
42          return creationDate;
43      }
44  
45      public void setCreationDate(final OffsetDateTime creationDate) {
46          this.creationDate = creationDate;
47      }
48  
49      public OffsetDateTime getLastChangeDate() {
50          return lastChangeDate;
51      }
52  
53      public void setLastChangeDate(final OffsetDateTime lastChangeDate) {
54          this.lastChangeDate = lastChangeDate;
55      }
56  
57      @JsonIgnore
58      public String getETagValue() {
59          OffsetDateTime etagDate = getLastChangeDate() == null
60                  ? getCreationDate() : getLastChangeDate();
61          return Optional.ofNullable(etagDate).
62                  map(date -> String.valueOf(date.toInstant().toEpochMilli())).
63                  orElse(StringUtils.EMPTY);
64  
65      }
66  
67      public int getBulkMaxOperations() {
68          return bulkMaxOperations;
69      }
70  
71      public void setBulkMaxOperations(final int bulkMaxOperations) {
72          this.bulkMaxOperations = bulkMaxOperations;
73      }
74  
75      public int getBulkMaxPayloadSize() {
76          return bulkMaxPayloadSize;
77      }
78  
79      public void setBulkMaxPayloadSize(final int bulkMaxPayloadSize) {
80          this.bulkMaxPayloadSize = bulkMaxPayloadSize;
81      }
82  
83      public int getFilterMaxResults() {
84          return filterMaxResults;
85      }
86  
87      public void setFilterMaxResults(final int filterMaxResults) {
88          this.filterMaxResults = filterMaxResults;
89      }
90  }