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.Species;
29 import fr.ifremer.tutti.persistence.entities.referential.Speciess;
30
31
32
33
34
35 public class SpeciesRow {
36
37 public static final String PROPERTY_ID = "id";
38
39 public static final String PROPERTY_REFERENCE_TAXON_ID = "referenceTaxonId";
40
41 public static final String PROPERTY_NAME = "name";
42
43 public static final String PROPERTY_TO_DELETE = "toDelete";
44
45 protected String id;
46
47 protected Integer referenceTaxonId;
48
49 protected String name;
50
51 protected Boolean toDelete;
52
53 public SpeciesRow() {
54 super();
55 }
56
57 public SpeciesRow(Species species) {
58 super();
59 Preconditions.checkNotNull(species);
60 setId(species.getId());
61 setReferenceTaxonId(species.getReferenceTaxonId());
62
63 setName(species.getName());
64 }
65
66 public String getId() {
67 return id;
68 }
69
70 public void setId(String id) {
71 this.id = id;
72 }
73
74 public Integer getReferenceTaxonId() {
75 return referenceTaxonId;
76 }
77
78 public void setReferenceTaxonId(Integer referenceTaxonId) {
79 this.referenceTaxonId = referenceTaxonId;
80 }
81
82 public String getName() {
83 return name;
84 }
85
86 public void setName(String name) {
87 this.name = name;
88 }
89
90 public Boolean getToDelete() {
91 return toDelete;
92 }
93
94 public void setToDelete(Boolean toDelete) {
95 this.toDelete = toDelete;
96 }
97
98 public Species toEntity(Integer referenceTaxonId) {
99 Species species = Speciess.newSpecies();
100 species.setId(getId());
101 species.setName(getName());
102 species.setReferenceTaxonId(referenceTaxonId);
103 return species;
104 }
105
106 public Integer getIdAsInt() {
107 Integer idAsInt = null;
108 if (id != null) {
109 idAsInt = Integer.valueOf(id);
110 }
111 return idAsInt;
112 }
113
114 }