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.chemistry.opencmis.client.runtime;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import org.apache.chemistry.opencmis.client.api.ChangeEvent;
25  import org.apache.chemistry.opencmis.client.api.ChangeEvents;
26  
27  public class ChangeEventsImpl implements ChangeEvents {
28  
29      private String latestChangeLogToken;
30      private List<ChangeEvent> events;
31      private boolean hasMoreItems = false;
32      private long totalNumItems = -1;
33  
34      public ChangeEventsImpl() {
35      }
36  
37      public ChangeEventsImpl(String latestChangeLogToken, List<ChangeEvent> events, boolean hasMoreItems,
38              long totalNumItems) {
39          this.latestChangeLogToken = latestChangeLogToken;
40          this.events = events;
41          this.hasMoreItems = hasMoreItems;
42          this.totalNumItems = totalNumItems;
43      }
44  
45      @Override
46      public String getLatestChangeLogToken() {
47          return latestChangeLogToken;
48      }
49  
50      public void setLatestChangeLogToken(String latestChangeLogToken) {
51          this.latestChangeLogToken = latestChangeLogToken;
52      }
53  
54      @Override
55      public List<ChangeEvent> getChangeEvents() {
56          if (events == null) {
57              events = new ArrayList<ChangeEvent>();
58          }
59  
60          return events;
61      }
62  
63      public void setChangeEvents(List<ChangeEvent> events) {
64          this.events = events;
65      }
66  
67      @Override
68      public boolean getHasMoreItems() {
69          return hasMoreItems;
70      }
71  
72      public void setHasMoreItems(boolean hasMoreItems) {
73          this.hasMoreItems = hasMoreItems;
74      }
75  
76      public void setTotalNumItems(long totalNumItems) {
77          this.totalNumItems = totalNumItems;
78      }
79  
80      @Override
81      public long getTotalNumItems() {
82          return totalNumItems;
83      }
84  }