1 /*******************************************************************************
2 * Imixs Workflow
3 * Copyright (C) 2001, 2011 Imixs Software Solutions GmbH,
4 * http://www.imixs.com
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You can receive a copy of the GNU General Public
17 * License at http://www.gnu.org/licenses/gpl.html
18 *
19 * Project:
20 * http://www.imixs.org
21 * http://java.net/projects/imixs-workflow
22 *
23 * Contributors:
24 * Imixs Software Solutions GmbH - initial API and implementation
25 * Ralph Soika - Software Developer
26 *******************************************************************************/
27
28 package org.imixs.workflow.jee.jpa;
29
30 import java.math.BigInteger;
31
32 import javax.persistence.*;
33
34 /**
35 * A TextItem is a subdata item of the data object class Entity. These subdata
36 * types are used to extract single attributes of an ItemCollection from the
37 * data Attribute of an Entity outside to separate entity ejbs. As both - the
38 * Entity and the SubDataItem are Entity EJBs this facilitate the possibility
39 * of a object-relational data mapping into different table.
40 *
41 * @see org.imixs.workflow.jee.jpa.Entity
42 * @author Ralph Soika
43 * @version 1.0
44 *
45 */
46 @javax.persistence.Entity
47 public class TextItem implements java.io.Serializable {
48
49 /**
50 * default serial id
51 */
52 private static final long serialVersionUID = 1L;
53
54 @SuppressWarnings("unused")
55 @Id
56 @GeneratedValue
57 private BigInteger id;
58
59 public String itemValue;
60
61 public String itemName;
62
63 @SuppressWarnings("unused")
64 private TextItem() {
65 }
66
67 public TextItem(String name, String value) {
68 itemValue = value;
69 itemName = name;
70 }
71
72
73
74
75 @Override
76 public int hashCode() {
77 return ((itemValue+itemName).hashCode());
78 //return super.hashCode();
79 }
80
81 @Override
82 public boolean equals(Object obj) {
83 if (obj == null)
84 return false;
85 if (!(obj instanceof TextItem))
86 return false;
87
88 TextItem aItem = (TextItem) obj;
89 // test if null objects
90 if (aItem.itemName==null || aItem.itemValue==null)
91 return false;
92
93 return (aItem.itemName.equals(itemName) && aItem.itemValue
94 .equals(itemValue));
95
96 }
97
98 }