1 package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
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 fr.ifremer.tutti.persistence.entities.data.BatchContainer;
28 import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
29 import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
30 import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
31 import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
32 import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
33 import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
34 import fr.ifremer.tutti.persistence.entities.referential.Species;
35 import fr.ifremer.tutti.service.PersistenceService;
36 import fr.ifremer.tutti.service.catches.multipost.MultiPostImportResult;
37 import fr.ifremer.tutti.type.WeightUnit;
38 import fr.ifremer.tutti.ui.swing.TuttiUIContext;
39 import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
40 import fr.ifremer.tutti.ui.swing.util.computable.ComputableData;
41
42 import java.io.File;
43 import java.util.List;
44 import java.util.Map;
45
46
47
48
49
50
51
52
53
54 public abstract class SpeciesOrBenthosBatchUISupport {
55
56 public static final String SPECIES = "SPECIES";
57 public static final String BENTHOS = "BENTHOS";
58 public static final String PROPERTY_TOTAL_COMPUTED_WEIGHT = "totalComputedWeight";
59 public static final String PROPERTY_TOTAL_SORTED_WEIGHT = "totalSortedWeight";
60 public static final String PROPERTY_TOTAL_UNSORTED_COMPUTED_WEIGHT = "totalUnsortedComputedWeight";
61 public static final String PROPERTY_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT = "totalSampleSortedComputedWeight";
62 public static final String PROPERTY_TOTAL_INERT_WEIGHT = "totalInertWeight";
63 public static final String PROPERTY_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT = "totalLivingNotItemizedWeight";
64
65 protected final TuttiUIContext context;
66
67 protected final EditCatchesUIModel catchesUIModel;
68
69 protected final Map<String, String> catchesUIModelPropertiesMapping;
70
71 protected final WeightUnit weightUnit;
72
73 protected SpeciesOrBenthosBatchUISupport(TuttiUIContext context,
74 EditCatchesUIModel catchesUIModel,
75 Map<String, String> catchesUIModelPropertiesMapping,
76 WeightUnit weightUnit) {
77 this.context = context;
78 this.catchesUIModel = catchesUIModel;
79 this.catchesUIModelPropertiesMapping = catchesUIModelPropertiesMapping;
80 this.weightUnit = weightUnit;
81 }
82
83 public EditCatchesUIModel getCatchesUIModel() {
84 return catchesUIModel;
85 }
86
87 public Map<String, String> getCatchesUIModelPropertiesMapping() {
88 return catchesUIModelPropertiesMapping;
89 }
90
91 public WeightUnit getWeightUnit() {
92 return weightUnit;
93 }
94
95 protected PersistenceService getPersistenceService() {
96 return context.getPersistenceService();
97 }
98
99 public abstract BatchContainer<SpeciesBatch> getRootSpeciesBatch(Integer batchId);
100
101 public abstract String getTitle();
102
103 public abstract boolean canPupitriImport();
104
105 public abstract boolean canPsionImport();
106
107 public abstract boolean canBigfinImport();
108
109 public abstract Float getTotalComputedWeight();
110
111 public abstract void setTotalComputedWeight(Float totalComputedWeight);
112
113 public abstract ComputableData<Float> getTotalSortedComputedOrNotWeight();
114
115 public abstract Float getTotalSortedWeight();
116
117 public abstract void setTotalSortedWeight(Float totalSortedWeight);
118
119 public abstract Float getTotalSortedComputedWeight();
120
121 public abstract void setTotalSortedComputedWeight(Float totalSortedComputedWeight);
122
123 public abstract Float getTotalUnsortedComputedWeight();
124
125 public abstract void setTotalUnsortedComputedWeight(Float totalUnsortedComputedWeight);
126
127 public abstract Float getTotalSampleSortedComputedWeight();
128
129 public abstract void setTotalSampleSortedComputedWeight(Float totalSampleSortedComputedWeight);
130
131 public abstract ComputableData<Float> getTotalInertComputedOrNotWeight();
132
133 public abstract Float getTotalInertWeight();
134
135 public abstract void setTotalInertWeight(Float totalInertWeight);
136
137 public abstract Float getTotalInertComputedWeight();
138
139 public abstract void setTotalInertComputedWeight(Float totalInertComputedWeight);
140
141 public abstract ComputableData<Float> getTotalLivingNotItemizedComputedOrNotWeight();
142
143 public abstract Float getTotalLivingNotItemizedWeight();
144
145 public abstract void setTotalLivingNotItemizedWeight(Float totalLivingNotItemizedWeight);
146
147 public abstract Float getTotalLivingNotItemizedComputedWeight();
148
149 public abstract void setTotalLivingNotItemizedComputedWeight(Float totalLivingNotItemizedComputedWeight);
150
151 public abstract Integer getDistinctSortedSpeciesCount();
152
153 public abstract void setDistinctSortedSpeciesCount(Integer distinctSortedSpeciesCount);
154
155 public abstract Integer getDistinctUnsortedSpeciesCount();
156
157 public abstract void setDistinctUnsortedSpeciesCount(Integer distinctUnsortedSpeciesCount);
158
159 public abstract Map<String, Object> importMultiPost(File file, FishingOperation operation, boolean importFrequencies, boolean importIndivudalObservations);
160
161 public abstract MultiPostImportResult importMultiPost(File file, FishingOperation operation, SpeciesBatch speciesBatch, boolean importFrequencies, boolean importIndivudalObservations);
162
163 public abstract void exportMultiPost(File file, FishingOperation operation, boolean importFrequencies, boolean importIndivudalObservations);
164
165 public abstract void exportMultiPost(File file, FishingOperation operation, SpeciesBatch speciesBatch, boolean importFrequencies, boolean importIndivudalObservations);
166
167 public abstract SpeciesBatch createBatch(SpeciesBatch speciesBatch, Integer parentBatchId);
168
169 public abstract SpeciesBatch saveBatch(SpeciesBatch speciesBatch);
170
171 public abstract List<SpeciesBatchFrequency> saveBatchFrequencies(Integer speciesBatchId, List<SpeciesBatchFrequency> frequency);
172
173 public abstract List<Species> getReferentSpeciesWithSurveyCode(boolean restrictToProtocol);
174
175 public abstract List<Species> getReferentOtherSpeciesWithSurveyCode(boolean restrictToProtocol);
176
177 public abstract List<SpeciesProtocol> getSpeciesFromProtocol();
178
179 public final List<Species> getReferentSpeciesWithSurveyCode() {
180 return getReferentSpeciesWithSurveyCode(false);
181 }
182
183 public final SpeciesProtocol getSpeciesProtocol(Species species) {
184 return TuttiProtocols.getSpeciesProtocol(species, getSpeciesFromProtocol());
185 }
186
187 public final SampleCategoryModelEntry getBestFirstSampleCategory(List<SampleCategoryModelEntry> data, Species species) {
188 SpeciesProtocol speciesProtocol = getSpeciesProtocol(species);
189 return context.getDataContext().getBestFirstSampleCategory(data, speciesProtocol);
190 }
191
192 public abstract void deleteSpeciesSubBatch(Integer speciesBatchId);
193
194 public abstract void deleteSpeciesBatch(Integer speciesBatchId);
195 }