View Javadoc
1   /*
2    * Copyright 2009 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.xds.core.metadata;
17  
18  import lombok.EqualsAndHashCode;
19  import lombok.Getter;
20  import lombok.ToString;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlType;
25  import java.io.Serializable;
26  
27  /**
28   * Represents a date and time range used in queries.
29   * @author Jens Riemschneider
30   */
31  @XmlAccessorType(XmlAccessType.FIELD)
32  @XmlType(name = "TimeRange", propOrder = {"from", "to"})
33  @EqualsAndHashCode(doNotUseGetters = true)
34  @ToString(doNotUseGetters = true)
35  public class TimeRange implements Serializable {
36      private static final long serialVersionUID = -5468726370729209318L;
37      
38      @Getter private Timestamp from;
39      @Getter private Timestamp to;
40  
41      public void setFrom(Timestamp from) {
42          this.from = from;
43      }
44  
45      public void setFrom(String from) {
46          this.from = Timestamp.fromHL7(from);
47      }
48  
49      public void setTo(Timestamp to) {
50          this.to = to;
51      }
52  
53      public void setTo(String to) {
54          this.to = Timestamp.fromHL7(to);
55      }
56  
57  }