BrightSide Workbench Full Report + Source Code
Service.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.financials.entity;
19 
20 import java.util.HashSet;
21 import java.util.Set;
22 import javax.persistence.*;
23 import org.turro.string.Strings;
24 import org.turro.financials.model.business.IValuation;
25 import org.turro.jpa.entity.IDaoEntity;
26 
31 @Entity
32 public class Service implements java.io.Serializable, IDaoEntity, IValuation {
33 
34  @Id
35  @GeneratedValue(strategy=GenerationType.IDENTITY)
36  @Column(name="IDENTIFIER")
37  private long id;
38 
39  @Column(name="SERVICE_NAME")
40  private String name;
41 
42  @Column(name="SERVICE_INTERNAL")
43  private boolean internal;
44 
45  private double structureMargin, profitMargin;
46 
47  private boolean alwaysApply;
48 
49  @ManyToOne
50  private Company company;
51 
52  @OneToMany(mappedBy = "service", fetch = FetchType.EAGER)
53  @OrderBy(value="name ASC")
54  private Set<Contract> stores = new HashSet<Contract>();
55 
56  public Company getCompany() {
57  return company;
58  }
59 
60  public void setCompany(Company company) {
61  this.company = company;
62  }
63 
64  @Override
65  public double getStructureMargin() {
66  return structureMargin;
67  }
68 
69  public void setStructureMargin(double structureMargin) {
70  this.structureMargin = structureMargin;
71  }
72 
73  @Override
74  public long getId() {
75  return id;
76  }
77 
78  public void setId(long id) {
79  this.id = id;
80  }
81 
82  public boolean isInternal() {
83  return internal;
84  }
85 
86  public void setInternal(boolean internal) {
87  this.internal = internal;
88  }
89 
90  @Override
91  public String getName() {
92  return name;
93  }
94 
95  public void setName(String name) {
96  this.name = name;
97  }
98 
99  @Override
100  public double getProfitMargin() {
101  return profitMargin;
102  }
103 
104  public void setProfitMargin(double profitMargin) {
105  this.profitMargin = profitMargin;
106  }
107 
108  @Override
109  public boolean isAlwaysApply() {
110  return alwaysApply;
111  }
112 
113  public void setAlwaysApply(boolean alwaysApply) {
114  this.alwaysApply = alwaysApply;
115  }
116 
117  public Set<Contract> getStores() {
118  return stores;
119  }
120 
121  public void setStores(Set<Contract> stores) {
122  this.stores = stores;
123  }
124 
125  /* IDaoEntity */
126 
127  @Override
128  public Object entityId() {
129  return id;
130  }
131 
132  @Override
133  public boolean isEmpty() {
134  return Strings.isBlank(name);
135  }
136 
137  /* Helpers */
138 
139  public String getFullName() {
140  return getName();
141  }
142 
143 }
void setStores(Set< Contract > stores)
Definition: Service.java:121
void setInternal(boolean internal)
Definition: Service.java:86
void setCompany(Company company)
Definition: Service.java:60
void setStructureMargin(double structureMargin)
Definition: Service.java:69
void setProfitMargin(double profitMargin)
Definition: Service.java:104
void setAlwaysApply(boolean alwaysApply)
Definition: Service.java:113