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  
25  import java.io.Serializable;
26  
27  /**
28   * A vocabulary type for representing business step identifiers Attributes
29   * 
30   * @author Nikos Kefalakis (nkef)
31   */
32  public class VocabularyAttrCiD implements Serializable {
33  
34  	/**
35  	 * 
36  	 */
37  	private static final long serialVersionUID = -5025973585282842235L;
38  	
39  	private String privateID;
40  	private Long id;
41  	private String attribute;
42  	
43  	public VocabularyAttrCiD() {
44  		this.privateID = java.util.UUID.randomUUID().toString();
45  	}
46  
47  	public int hashCode() {
48  		return privateID.hashCode();
49  	}
50  
51  	public Long getId() {
52  		return id;
53  	}
54  
55  	public void setId(Long id) {
56  		this.id = id;
57  	}
58  
59  	public String getAttribute() {
60  		return attribute;
61  	}
62  
63  	public void setAttribute(String attribute) {
64  		this.attribute = attribute;
65  	}
66  
67  	@Override
68  	public boolean equals(Object o) {
69  		if (o instanceof VocabularyAttrCiD) {
70  			VocabularyAttrCiD that = (VocabularyAttrCiD) o;
71  			return eq(this.id, that.id) && eq(this.attribute, that.attribute);
72  		}
73  		else {
74  			return false;
75  		}
76  
77  	}
78  
79  }