BrightSide Workbench Full Report + Source Code
MeasureUnit.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.erp.entity;
19 
20 import java.util.HashSet;
21 import java.util.Set;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.ManyToOne;
28 import javax.persistence.OneToMany;
29 
34 @Entity
35 public class MeasureUnit implements java.io.Serializable {
36  @Id
37  @GeneratedValue(strategy=GenerationType.IDENTITY)
38  @Column(name="IDENTIFIER")
39  private long id;
40 
41  private String name, initials;
42 
43  private double ratio;
44 
45  @ManyToOne
46  private MeasureUnit rootUnit;
47 
48  @OneToMany(mappedBy = "rootUnit")
49  private Set<MeasureUnit> relatedUnits = new HashSet<MeasureUnit>();
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 getInitials() {
60  return initials;
61  }
62 
63  public void setInitials(String initials) {
64  this.initials = initials;
65  }
66 
67  public String getName() {
68  return name;
69  }
70 
71  public void setName(String name) {
72  this.name = name;
73  }
74 
75  public double getRatio() {
76  return ratio;
77  }
78 
79  public void setRatio(double ratio) {
80  this.ratio = ratio;
81  }
82 
83  public Set<MeasureUnit> getRelatedUnits() {
84  return relatedUnits;
85  }
86 
87  public void setRelatedUnits(Set<MeasureUnit> relatedUnits) {
88  this.relatedUnits = relatedUnits;
89  }
90 
92  return rootUnit;
93  }
94 
95  public void setRootUnit(MeasureUnit rootUnit) {
96  this.rootUnit = rootUnit;
97  }
98 
99 }
void setRelatedUnits(Set< MeasureUnit > relatedUnits)
void setInitials(String initials)
void setRootUnit(MeasureUnit rootUnit)
Set< MeasureUnit > getRelatedUnits()