1 package fr.ifremer.tutti.service.referential.csv;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import com.google.common.base.Preconditions;
28 import fr.ifremer.tutti.persistence.entities.referential.Gear;
29 import fr.ifremer.tutti.persistence.entities.referential.Gears;
30
31
32
33
34
35 public class GearRow {
36
37 public static final String PROPERTY_ID = "id";
38
39 public static final String PROPERTY_NAME = "name";
40
41 public static final String PROPERTY_TO_DELETE = "toDelete";
42
43 public static final String PROPERTY_LABEL = "label";
44
45 public static final String PROPERTY_SCIENTIFIC_GEAR = "scientificGear";
46
47 protected String id;
48
49 protected String name;
50
51 protected String label;
52
53 protected boolean scientificGear;
54
55 protected Boolean toDelete;
56
57 public GearRow() {
58 super();
59 }
60
61 public GearRow(Gear gear) {
62 super();
63 Preconditions.checkNotNull(gear);
64 setId(gear.getId());
65 setName(gear.getName());
66 setLabel(gear.getLabel());
67 setScientificGear(gear.isScientificGear());
68 }
69
70 public String getId() {
71 return id;
72 }
73
74 public void setId(String id) {
75 this.id = id;
76 }
77
78 public String getName() {
79 return name;
80 }
81
82 public void setName(String name) {
83 this.name = name;
84 }
85
86 public String getLabel() {
87 return label;
88 }
89
90 public void setLabel(String label) {
91 this.label = label;
92 }
93
94 public boolean isScientificGear() {
95 return scientificGear;
96 }
97
98 public void setScientificGear(boolean scientificGear) {
99 this.scientificGear = scientificGear;
100 }
101
102 public Boolean getToDelete() {
103 return toDelete;
104 }
105
106 public void setToDelete(Boolean toDelete) {
107 this.toDelete = toDelete;
108 }
109
110 public Gear toEntity() {
111
112 Gear gear = Gears.newGear();
113 gear.setId(getId());
114 gear.setName(getName());
115 gear.setLabel(getLabel());
116 gear.setScientificGear(isScientificGear());
117 return gear;
118
119 }
120
121 public Integer getIdAsInt() {
122 Integer idAsInt = null;
123 if (id != null) {
124 idAsInt = Integer.valueOf(id);
125 }
126 return idAsInt;
127 }
128 }