View Javadoc

1   /*
2    * #%L
3    * Bitrepository Alarm Service
4    * %%
5    * Copyright (C) 2010 - 2012 The State and University Library, The Royal Library and The State Archives, Denmark
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as 
9    * published by the Free Software Foundation, either version 2.1 of the 
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public 
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-2.1.html>.
20   * #L%
21   */
22  package org.bitrepository.alarm.store;
23  
24  import java.util.Date;
25  
26  import org.bitrepository.bitrepositoryelements.AlarmCode;
27  
28  /**
29   * Container for the extraction of data from the alarm database.
30   */
31  public class AlarmDatabaseExtractionModel {
32      /** @see getFileId(). */
33      private String componentId;
34      /** @see getContributorId(). */
35      private AlarmCode alarmCode;
36      /** @see getStartDate(). */
37      private Date startDate;
38      /** @see getEndDate(). */
39      private Date endDate;
40      /** @see getActorName(). */
41      private String fileID;
42      /** @see getOperation(). */
43      private int maxCount;
44      /** @see getAscending().*/
45      private boolean ascending;
46      /** @see #getCollectionID(). */
47      private String collectionID;
48      
49      /**
50       * Constructor.
51       * @param collectionID The id of the collection, may be null.
52       * @param componentId The id of the component.
53       * @param alarmCode The alarm code.
54       * @param startDate The earliest date to restrict the extraction.
55       * @param endDate The latest date to restrict the extraction.
56       * @param fileID The id of the file.
57       * @param maxCount The maximum count of alarms to extract. If null, then set to maximum value for Integer.
58       */
59      public AlarmDatabaseExtractionModel(String collectionID, String componentId, AlarmCode alarmCode, Date startDate, Date endDate, 
60              String fileID, Integer maxCount, boolean ascending) {
61          this.collectionID = collectionID;
62          this.componentId = componentId;
63          this.alarmCode = alarmCode;
64          this.startDate = startDate;
65          this.endDate = endDate;
66          this.fileID = fileID;
67          this.ascending = ascending;
68          
69          if(maxCount != null) {
70              this.maxCount = maxCount;
71          } else {
72              this.maxCount = Integer.MAX_VALUE;
73          }
74      }
75      
76      /**
77       * @return The componentId;
78       */
79      public String getComponentId() {
80          return componentId;
81      }
82      
83      /**
84       * @See getComponentId();
85       * @param componentId The new component id.
86       */
87      public void setComponentId(String componentId) {
88          this.componentId = componentId;
89      }
90      
91      /**
92       * @return The alarmCode;
93       */
94      public AlarmCode getAlarmCode() {
95          return alarmCode;
96      }
97      
98      /**
99       * @See getAlarmCode();
100      * @param alarmCode The new alarm code.
101      */
102     public void setAlarmCode(AlarmCode alarmCode) {
103         this.alarmCode = alarmCode;
104     }
105    
106     /**
107      * @return The startDate;
108      */
109     public Date getStartDate() {
110         return startDate;
111     }
112     
113     /**
114      * @See getStartDate();
115      * @param startDate The startDate.
116      */
117     public void setStartDate(Date startDate) {
118         this.startDate = startDate;
119     }
120     
121     /**
122      * @return The endDate;
123      */
124     public Date getEndDate() {
125         return endDate;
126     }
127     
128     /**
129      * @See getEndDate();
130      * @param endDate The endDate.
131      */
132     public void setEndDate(Date endDate) {
133         this.endDate = endDate;
134     }    
135     
136     /**
137      * @return The fileID;
138      */
139     public String getFileID() {
140         return fileID;
141     }
142     
143     /**
144      * @See getFileID();
145      * @param fileID The new file id.
146      */
147     public void setFileID(String fileID) {
148         this.fileID = fileID;
149     }
150     
151     /**
152      * @return The maxCount;
153      */
154     public Integer getMaxCount() {
155         return maxCount;
156     }
157     
158     /**
159      * @See getMaxCount();
160      * @param maxCount The new max count.
161      */
162     public void setMaxCount(Integer maxCount) {
163         this.maxCount = maxCount;
164     }
165     
166     /**
167      * @return Whether the results are delivered ascending (alternatively descending).
168      */
169     public boolean getAscending() {
170         return ascending;
171     }
172     
173     /**
174      * @See getAscending();
175      * @param ascending Whether the results should be ascending (or alternatively descending).
176      */
177     public void setAscending(boolean ascending) {
178         this.ascending = ascending;
179     }   
180     
181     /**
182      * @return The ID of the collection. 
183      */
184     public String getCollectionID() {
185         return collectionID;
186     }
187     
188     /**
189      * @See getCollectionID(); 
190      * @param collectionID The ID of the collection.
191      */
192     public void setCollectionID(String collectionID) {
193         this.collectionID = collectionID;
194     }
195 }