View Javadoc

1   /*
2    * Copyright (C) 2008 ETH Zurich
3    *
4    * This file is part of Fosstrak (www.fosstrak.org).
5    *
6    * Fosstrak is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License version 2.1, as published by the Free Software Foundation.
9    *
10   * Fosstrak is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13   * Lesser General Public License for more details.
14   *
15   * You should have received a copy of the GNU Lesser General Public
16   * License along with Fosstrak; if not, write to the Free
17   * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18   * Boston, MA  02110-1301  USA
19   */
20  
21  package org.fosstrak.epcis.repository.model;
22  
23  import static org.fosstrak.epcis.repository.Utils.eq;
24  import static org.fosstrak.epcis.repository.Utils.hc;
25  
26  /**
27   * A business transaction as defined in section 7.2.6 of the spec.
28   * 
29   * @author Sean Wellington
30   */
31  public class BusinessTransaction {
32  
33      private Long id;
34  
35      private BusinessTransactionId bizTransaction;
36  
37      private BusinessTransactionTypeId type;
38  
39      public Long getId() {
40          return id;
41      }
42  
43      public void setId(Long id) {
44          this.id = id;
45      }
46  
47      public BusinessTransactionId getBizTransaction() {
48          return bizTransaction;
49      }
50  
51      public void setBizTransaction(BusinessTransactionId bizTrans) {
52          this.bizTransaction = bizTrans;
53      }
54  
55      public BusinessTransactionTypeId getType() {
56          return type;
57      }
58  
59      public void setType(BusinessTransactionTypeId type) {
60          this.type = type;
61      }
62  
63      @Override
64      public int hashCode() {
65          return hc(bizTransaction) ^ hc(type);
66      }
67  
68      @Override
69      public boolean equals(Object o) {
70          if (o instanceof BusinessTransaction) {
71              BusinessTransaction that = (BusinessTransaction) o;
72              return eq(this.bizTransaction, that.bizTransaction) && eq(this.type, that.type);
73          } else {
74              return false;
75          }
76      }
77  
78  }