View Javadoc

1   /*
2    *  Copyright 2004-2006 Stefan Reuter
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   */
17  package org.asteriskjava.live;
18  
19  import java.util.Date;
20  
21  /**
22   * An entry in the linked channels history of an {@link AsteriskChannel}.
23   *
24   * @author srt
25   * @version $Id$
26   * @since 0.3
27   */
28  public class LinkedChannelHistoryEntry
29  {
30      private final Date dateLinked;
31      private Date dateUnlinked;
32      private final AsteriskChannel channel;
33  
34      /**
35       * Creates a new instance.
36       *
37       * @param dateLinked the date the channel was linked.
38       * @param channel    the channel that has been linked.
39       */
40      public LinkedChannelHistoryEntry(Date dateLinked, AsteriskChannel channel)
41      {
42          this.dateLinked = dateLinked;
43          this.channel = channel;
44      }
45  
46      /**
47       * Returns the date the channel was linked.
48       *
49       * @return the date the channel was linked.
50       */
51      public Date getDateLinked()
52      {
53          return dateLinked;
54      }
55  
56      /**
57       * Returns the date the channel was unlinked.
58       *
59       * @return the date the channel was unlinked.
60       */
61      public Date getDateUnlinked()
62      {
63          return dateUnlinked;
64      }
65  
66      /**
67       * Sets the date the channel was unlinked.
68       *
69       * @param dateUnlinked the date the channel was unlinked.
70       */
71      public void setDateUnlinked(Date dateUnlinked)
72      {
73          this.dateUnlinked = dateUnlinked;
74      }
75  
76      /**
77       * Returns the channel that has been linked.
78       *
79       * @return the channel that has been linked.
80       */
81      public AsteriskChannel getChannel()
82      {
83          return channel;
84      }
85  
86      @Override
87      public String toString()
88      {
89          final StringBuilder sb;
90  
91          sb = new StringBuilder(100);
92          sb.append("LinkedChannelHistoryEntry[");
93          sb.append("dateLinked=").append(dateLinked).append(",");
94          sb.append("dateUnlinked=").append(dateUnlinked).append(",");
95          sb.append("channel=").append(channel).append("]");
96          return sb.toString();
97      }
98  }