1 |
|
// $Id$
|
2 |
|
/**
|
3 |
|
* Copyright (C) 2009 EDIT
|
4 |
|
* European Distributed Institute of Taxonomy
|
5 |
|
* http://www.e-taxonomy.eu
|
6 |
|
*
|
7 |
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8 |
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9 |
|
*/
|
10 |
|
package eu.etaxonomy.cdm.api.facade;
|
11 |
|
|
12 |
|
import java.util.UUID;
|
13 |
|
|
14 |
|
import org.apache.commons.lang.StringUtils;
|
15 |
|
import org.apache.log4j.Logger;
|
16 |
|
|
17 |
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
18 |
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
19 |
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
20 |
|
import eu.etaxonomy.cdm.model.agent.Person;
|
21 |
|
import eu.etaxonomy.cdm.model.agent.Team;
|
22 |
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
23 |
|
import eu.etaxonomy.cdm.model.common.Language;
|
24 |
|
import eu.etaxonomy.cdm.model.common.Representation;
|
25 |
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
26 |
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
27 |
|
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
28 |
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
29 |
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
30 |
|
import eu.etaxonomy.cdm.strategy.StrategyBase;
|
31 |
|
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
|
32 |
|
|
33 |
|
/**
|
34 |
|
* @author a.mueller
|
35 |
|
* @date 03.06.2010
|
36 |
|
*
|
37 |
|
*/
|
38 |
|
public class DerivedUnitFacadeFieldUnitCacheStrategy extends StrategyBase implements IIdentifiableEntityCacheStrategy<FieldUnit> {
|
39 |
|
private static final long serialVersionUID = 1578628591216605619L;
|
40 |
|
private static final Logger logger = Logger.getLogger(DerivedUnitFacadeFieldUnitCacheStrategy.class);
|
41 |
|
|
42 |
|
private static final UUID uuid = UUID.fromString("df4672c1-ce5c-4724-af6d-91e2b326d4a4");
|
43 |
|
|
44 |
|
/* (non-Javadoc)
|
45 |
|
* @see eu.etaxonomy.cdm.strategy.StrategyBase#getUuid()
|
46 |
|
*/
|
47 |
|
@Override
|
48 |
|
protected UUID getUuid() {
|
49 |
|
return uuid;
|
50 |
|
}
|
51 |
|
|
52 |
|
private boolean includeEmptySeconds = false;
|
53 |
|
private boolean includeReferenceSystem = true;
|
54 |
|
|
55 |
|
|
56 |
|
/* (non-Javadoc)
|
57 |
|
* @see eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy#getTitleCache(eu.etaxonomy.cdm.model.common.IdentifiableEntity)
|
58 |
|
*/
|
59 |
|
@Override
|
60 |
|
public String getTitleCache(FieldUnit fieldUnit) {
|
61 |
|
DerivedUnitFacade facade;
|
62 |
|
String result = "";
|
63 |
|
DerivedUnitFacadeConfigurator config = DerivedUnitFacadeConfigurator.NewInstance();
|
64 |
|
config.setFirePropertyChangeEvents(false);
|
65 |
|
facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, fieldUnit, config);
|
66 |
|
result = getFieldData(facade);
|
67 |
|
result = addPlantDescription(result, facade);
|
68 |
|
facade.close();
|
69 |
|
return result;
|
70 |
|
}
|
71 |
|
|
72 |
|
|
73 |
|
protected String getFieldData(DerivedUnitFacade facade) {
|
74 |
|
String ALTITUDE_PREFIX = "alt. ";
|
75 |
|
// String ALTITUDE_POSTFIX = " m";
|
76 |
|
|
77 |
|
String result = "";
|
78 |
|
|
79 |
|
|
80 |
|
//country
|
81 |
|
String strCountry = null;
|
82 |
|
NamedArea country = facade.getCountry();
|
83 |
|
Representation repCountry = country == null ? null : country.getRepresentation(Language.DEFAULT());
|
84 |
|
//TODO currently the label is the 3 digit representation of the country and text is the full text.
|
85 |
|
//this is against the common way of handling text, label and labelabbrev in defined terms
|
86 |
|
strCountry = repCountry == null ? null: repCountry.getText();
|
87 |
|
result = CdmUtils.concat(", ", result, strCountry);
|
88 |
|
|
89 |
|
//locality
|
90 |
|
result = CdmUtils.concat(", ", result, facade.getLocalityText());
|
91 |
|
|
92 |
|
//elevation
|
93 |
|
if (StringUtils.isNotBlank(facade.absoluteElevationToString())){
|
94 |
|
result = CdmUtils.concat(", " , result, ALTITUDE_PREFIX);
|
95 |
|
result += facade.absoluteElevationToString();
|
96 |
|
}
|
97 |
|
|
98 |
|
//exact locality
|
99 |
|
if (facade.getExactLocation() != null){
|
100 |
|
String exactLocation = facade.getExactLocation().toSexagesimalString(this.includeEmptySeconds, this.includeReferenceSystem);
|
101 |
|
result = CdmUtils.concat(", ", result, exactLocation);
|
102 |
|
}
|
103 |
|
|
104 |
|
//ecology
|
105 |
|
result = CdmUtils.concat(", ", result, facade.getEcology());
|
106 |
|
|
107 |
|
//gathering period
|
108 |
|
//TODO period.toString ??
|
109 |
|
TimePeriod gatheringPeriod = facade.getGatheringPeriod();
|
110 |
|
result = CdmUtils.concat(", ", result, (gatheringPeriod == null? null : gatheringPeriod.toString()));
|
111 |
|
|
112 |
|
//collector (team) and field number
|
113 |
|
String collectorAndFieldNumber = getCollectorAndFieldNumber(facade);
|
114 |
|
result = CdmUtils.concat(", ", result, collectorAndFieldNumber);
|
115 |
|
|
116 |
|
|
117 |
|
return result;
|
118 |
|
}
|
119 |
|
|
120 |
|
|
121 |
|
protected String addPlantDescription(String result, DerivedUnitFacade facade) {
|
122 |
|
|
123 |
|
//plant description
|
124 |
|
result = CdmUtils.concat("; ", result, facade.getPlantDescription());
|
125 |
|
if (CdmUtils.isNotEmpty(result)){
|
126 |
|
result += ".";
|
127 |
|
}
|
128 |
|
|
129 |
|
return result;
|
130 |
|
}
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
private String getCollectorAndFieldNumber(DerivedUnitFacade facade) {
|
135 |
|
String result = "";
|
136 |
|
AgentBase<?> collector = facade.getCollector();
|
137 |
|
String fieldNumber = facade.getFieldNumber();
|
138 |
|
Person primaryCollector = facade.getPrimaryCollector();
|
139 |
|
|
140 |
|
if (collector == null){
|
141 |
|
return fieldNumber;
|
142 |
|
}else if(collector.isProtectedTitleCache()){
|
143 |
|
return CdmUtils.concat(" ", collector.getTitleCache(), fieldNumber);
|
144 |
|
}else{
|
145 |
|
result = "";
|
146 |
|
Team collectorTeam;
|
147 |
|
if (collector.isInstanceOf(Person.class)){
|
148 |
|
collectorTeam = Team.NewInstance();
|
149 |
|
if (primaryCollector == null){
|
150 |
|
primaryCollector = CdmBase.deproxy(collector, Person.class);
|
151 |
|
}
|
152 |
|
collectorTeam.addTeamMember(primaryCollector);
|
153 |
|
} else if (collector.isInstanceOf(Team.class) && ! collector.isProtectedTitleCache() ){
|
154 |
|
collectorTeam = CdmBase.deproxy(collector, Team.class);
|
155 |
|
}else{
|
156 |
|
return CdmUtils.concat(" ", collector.getTitleCache(), fieldNumber);
|
157 |
|
}
|
158 |
|
|
159 |
|
int counter = 0;
|
160 |
|
int teamSize = collectorTeam.getTeamMembers().size();
|
161 |
|
boolean fieldNumberAdded = false;
|
162 |
|
for (Person member : collectorTeam.getTeamMembers()){
|
163 |
|
counter++;
|
164 |
|
String concatString = (counter >= teamSize)? " & " : ", ";
|
165 |
|
result = CdmUtils.concat(concatString, result, getMemberString(member) );
|
166 |
|
if (member.equals(primaryCollector)){
|
167 |
|
result = addFieldNumber(result, fieldNumber);
|
168 |
|
fieldNumberAdded = true;
|
169 |
|
}
|
170 |
|
}
|
171 |
|
if (! fieldNumberAdded){
|
172 |
|
result = addFieldNumber(result, fieldNumber);
|
173 |
|
}
|
174 |
|
return result;
|
175 |
|
}
|
176 |
|
|
177 |
|
}
|
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
private String addFieldNumber(String result, String fieldNumber) {
|
182 |
|
result = CdmUtils.concat(" ", result, fieldNumber);
|
183 |
|
return result;
|
184 |
|
}
|
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
/**
|
189 |
|
* Strategy to format a collector team member name
|
190 |
|
* @param member
|
191 |
|
* @return
|
192 |
|
*/
|
193 |
|
private String getMemberString(Person member) {
|
194 |
|
if (StringUtils.isNotBlank(member.getLastname()) && ! member.isProtectedTitleCache() ){
|
195 |
|
String result = member.getLastname();
|
196 |
|
if (StringUtils.isNotBlank(member.getFirstname())){
|
197 |
|
result = member.getFirstname().substring(0,1) + ". " + result;
|
198 |
|
}
|
199 |
|
return result;
|
200 |
|
}else{
|
201 |
|
return member.getTitleCache();
|
202 |
|
}
|
203 |
|
}
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
private boolean testPrimaryCollectorInCollectorTeam(AgentBase collector, Person primaryCollector) {
|
208 |
|
if (collector.isInstanceOf(Person.class)){
|
209 |
|
return collector.equals(primaryCollector);
|
210 |
|
}else if (collector.isInstanceOf(Team.class)){
|
211 |
|
Team collectorTeam = CdmBase.deproxy(collector, Team.class);
|
212 |
|
return collectorTeam.getTeamMembers().contains(primaryCollector);
|
213 |
|
}else{
|
214 |
|
logger.warn("Collector is not of type person or team");
|
215 |
|
return false;
|
216 |
|
}
|
217 |
|
}
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
/**
|
222 |
|
* @param facade
|
223 |
|
*/
|
224 |
|
private String getCode(DerivedUnitFacade facade) {
|
225 |
|
String code = "";
|
226 |
|
if(facade.getCollection() != null){
|
227 |
|
code = facade.getCollection().getCode();
|
228 |
|
if (CdmUtils.isEmpty(code)){
|
229 |
|
Institution institution = facade.getCollection().getInstitute();
|
230 |
|
if (institution != null){
|
231 |
|
code = institution.getCode();
|
232 |
|
}
|
233 |
|
if (CdmUtils.isEmpty(code)){
|
234 |
|
Collection superCollection = facade.getCollection().getSuperCollection();
|
235 |
|
if (superCollection != null){
|
236 |
|
code = superCollection.getCode();
|
237 |
|
}
|
238 |
|
}
|
239 |
|
}
|
240 |
|
}
|
241 |
|
return code;
|
242 |
|
}
|
243 |
|
|
244 |
|
// ************************** GETTER / SETTER ******************************************************
|
245 |
|
|
246 |
|
public boolean isIncludeSeconds() {
|
247 |
|
return includeEmptySeconds;
|
248 |
|
}
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
public void setIncludeSeconds(boolean includeSeconds) {
|
253 |
|
this.includeEmptySeconds = includeSeconds;
|
254 |
|
}
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
public void setIncludeReferenceSystem(boolean includeReferenceSystem) {
|
259 |
|
this.includeReferenceSystem = includeReferenceSystem;
|
260 |
|
}
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
public boolean isIncludeReferenceSystem() {
|
265 |
|
return includeReferenceSystem;
|
266 |
|
}
|
267 |
|
|
268 |
|
|
269 |
|
}
|
|
1 |
// $Id$
|
|
2 |
/**
|
|
3 |
* Copyright (C) 2009 EDIT
|
|
4 |
* European Distributed Institute of Taxonomy
|
|
5 |
* http://www.e-taxonomy.eu
|
|
6 |
*
|
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms.
|
|
9 |
*/
|
|
10 |
package eu.etaxonomy.cdm.api.facade;
|
|
11 |
|
|
12 |
import java.util.List;
|
|
13 |
import java.util.UUID;
|
|
14 |
|
|
15 |
import org.apache.commons.lang.StringUtils;
|
|
16 |
import org.apache.log4j.Logger;
|
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.common.CdmUtils;
|
|
19 |
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
|
20 |
import eu.etaxonomy.cdm.model.agent.Institution;
|
|
21 |
import eu.etaxonomy.cdm.model.agent.Person;
|
|
22 |
import eu.etaxonomy.cdm.model.agent.Team;
|
|
23 |
import eu.etaxonomy.cdm.model.common.CdmBase;
|
|
24 |
import eu.etaxonomy.cdm.model.common.Language;
|
|
25 |
import eu.etaxonomy.cdm.model.common.Representation;
|
|
26 |
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
|
27 |
import eu.etaxonomy.cdm.model.location.NamedArea;
|
|
28 |
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
|
29 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
|
30 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
|
|
31 |
import eu.etaxonomy.cdm.strategy.StrategyBase;
|
|
32 |
import eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy;
|
|
33 |
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* @author a.mueller
|
|
37 |
* @date 03.06.2010
|
|
38 |
*
|
|
39 |
*/
|
|
40 |
public class DerivedUnitFacadeFieldUnitCacheStrategy extends StrategyBase implements IIdentifiableEntityCacheStrategy<FieldUnit> {
|
|
41 |
private static final long serialVersionUID = 1578628591216605619L;
|
|
42 |
private static final Logger logger = Logger.getLogger(DerivedUnitFacadeFieldUnitCacheStrategy.class);
|
|
43 |
|
|
44 |
private static final UUID uuid = UUID.fromString("df4672c1-ce5c-4724-af6d-91e2b326d4a4");
|
|
45 |
|
|
46 |
@Override
|
|
47 |
protected UUID getUuid() {
|
|
48 |
return uuid;
|
|
49 |
}
|
|
50 |
|
|
51 |
private boolean includeEmptySeconds = false;
|
|
52 |
private boolean includeReferenceSystem = true;
|
|
53 |
|
|
54 |
@Override
|
|
55 |
public String getTitleCache(FieldUnit fieldUnit) {
|
|
56 |
DerivedUnitFacade facade;
|
|
57 |
String result = "";
|
|
58 |
DerivedUnitFacadeConfigurator config = DerivedUnitFacadeConfigurator.NewInstance();
|
|
59 |
config.setFirePropertyChangeEvents(false);
|
|
60 |
facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, fieldUnit, config);
|
|
61 |
result = getFieldData(facade);
|
|
62 |
result = addPlantDescription(result, facade);
|
|
63 |
facade.close();
|
|
64 |
return result;
|
|
65 |
}
|
|
66 |
|
|
67 |
|
|
68 |
protected String getFieldData(DerivedUnitFacade facade) {
|
|
69 |
String ALTITUDE_PREFIX = "alt. ";
|
|
70 |
// String ALTITUDE_POSTFIX = " m";
|
|
71 |
|
|
72 |
String result = "";
|
|
73 |
|
|
74 |
|
|
75 |
//country
|
|
76 |
String strCountry = null;
|
|
77 |
NamedArea country = facade.getCountry();
|
|
78 |
Representation repCountry = country == null ? null : country.getRepresentation(Language.DEFAULT());
|
|
79 |
//TODO currently the label is the 3 digit representation of the country and text is the full text.
|
|
80 |
//this is against the common way of handling text, label and labelabbrev in defined terms
|
|
81 |
strCountry = repCountry == null ? null: repCountry.getText();
|
|
82 |
result = CdmUtils.concat(", ", result, strCountry);
|
|
83 |
|
|
84 |
//locality
|
|
85 |
result = CdmUtils.concat(", ", result, facade.getLocalityText());
|
|
86 |
|
|
87 |
//elevation
|
|
88 |
if (StringUtils.isNotBlank(facade.absoluteElevationToString())){
|
|
89 |
result = CdmUtils.concat(", " , result, ALTITUDE_PREFIX);
|
|
90 |
result += facade.absoluteElevationToString();
|
|
91 |
}
|
|
92 |
|
|
93 |
//exact locality
|
|
94 |
if (facade.getExactLocation() != null){
|
|
95 |
String exactLocation = facade.getExactLocation().toSexagesimalString(this.includeEmptySeconds, this.includeReferenceSystem);
|
|
96 |
result = CdmUtils.concat(", ", result, exactLocation);
|
|
97 |
}
|
|
98 |
|
|
99 |
//ecology
|
|
100 |
result = CdmUtils.concat(", ", result, facade.getEcology());
|
|
101 |
|
|
102 |
//gathering period
|
|
103 |
//TODO period.toString ??
|
|
104 |
TimePeriod gatheringPeriod = facade.getGatheringPeriod();
|
|
105 |
result = CdmUtils.concat(", ", result, (gatheringPeriod == null? null : gatheringPeriod.toString()));
|
|
106 |
|
|
107 |
//collector (team) and field number
|
|
108 |
String collectorAndFieldNumber = getCollectorAndFieldNumber(facade);
|
|
109 |
result = CdmUtils.concat(", ", result, collectorAndFieldNumber);
|
|
110 |
|
|
111 |
|
|
112 |
return result;
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
protected String addPlantDescription(String result, DerivedUnitFacade facade) {
|
|
117 |
|
|
118 |
//plant description
|
|
119 |
result = CdmUtils.concat("; ", result, facade.getPlantDescription());
|
|
120 |
if (CdmUtils.isNotEmpty(result)){
|
|
121 |
result += ".";
|
|
122 |
}
|
|
123 |
|
|
124 |
return result;
|
|
125 |
}
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
private String getCollectorAndFieldNumber(DerivedUnitFacade facade) {
|
|
130 |
String result = "";
|
|
131 |
AgentBase<?> collector = facade.getCollector();
|
|
132 |
String fieldNumber = facade.getFieldNumber();
|
|
133 |
Person primaryCollector = facade.getPrimaryCollector();
|
|
134 |
|
|
135 |
if (collector == null){
|
|
136 |
return fieldNumber;
|
|
137 |
}else if(collector.isProtectedTitleCache()){
|
|
138 |
return CdmUtils.concat(" ", collector.getTitleCache(), fieldNumber);
|
|
139 |
}else{
|
|
140 |
result = "";
|
|
141 |
Team collectorTeam;
|
|
142 |
if (collector.isInstanceOf(Person.class)){
|
|
143 |
collectorTeam = Team.NewInstance();
|
|
144 |
if (primaryCollector == null){
|
|
145 |
primaryCollector = CdmBase.deproxy(collector, Person.class);
|
|
146 |
}
|
|
147 |
collectorTeam.addTeamMember(primaryCollector);
|
|
148 |
} else if (collector.isInstanceOf(Team.class) && ! collector.isProtectedTitleCache() ){
|
|
149 |
collectorTeam = CdmBase.deproxy(collector, Team.class);
|
|
150 |
}else{
|
|
151 |
return CdmUtils.concat(" ", collector.getTitleCache(), fieldNumber);
|
|
152 |
}
|
|
153 |
|
|
154 |
int counter = 0;
|
|
155 |
// int teamSize = collectorTeam.getTeamMembers().size();
|
|
156 |
boolean fieldNumberAdded = false;
|
|
157 |
List<Person> teamMembers = collectorTeam.getTeamMembers();
|
|
158 |
for (Person member : teamMembers){
|
|
159 |
counter++;
|
|
160 |
String concatString = TeamDefaultCacheStrategy.concatString(collectorTeam, teamMembers, counter);
|
|
161 |
//(counter >= teamSize)? " & " : ", ";
|
|
162 |
result = CdmUtils.concat(concatString, result, getMemberString(member) );
|
|
163 |
if (member.equals(primaryCollector)){
|
|
164 |
result = addFieldNumber(result, fieldNumber);
|
|
165 |
fieldNumberAdded = true;
|
|
166 |
}
|
|
167 |
}
|
|
168 |
if (collectorTeam.isHasMoreMembers()){
|
|
169 |
result = TeamDefaultCacheStrategy.addHasMoreMembers(result);
|
|
170 |
}
|
|
171 |
if (! fieldNumberAdded){
|
|
172 |
result = addFieldNumber(result, fieldNumber);
|
|
173 |
}
|
|
174 |
return result;
|
|
175 |
}
|
|
176 |
|
|
177 |
}
|
|
178 |
|
|
179 |
private String addFieldNumber(String str, String fieldNumber) {
|
|
180 |
String result = CdmUtils.concat(" ", str, fieldNumber);
|
|
181 |
return result;
|
|
182 |
}
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Strategy to format a collector team member name
|
|
188 |
* @param member
|
|
189 |
* @return
|
|
190 |
*/
|
|
191 |
private String getMemberString(Person member) {
|
|
192 |
if (StringUtils.isNotBlank(member.getLastname()) && ! member.isProtectedTitleCache() ){
|
|
193 |
String result = member.getLastname();
|
|
194 |
if (StringUtils.isNotBlank(member.getFirstname())){
|
|
195 |
result = member.getFirstname().substring(0,1) + ". " + result;
|
|
196 |
}
|
|
197 |
return result;
|
|
198 |
}else{
|
|
199 |
return member.getTitleCache();
|
|
200 |
}
|
|
201 |
}
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
private boolean testPrimaryCollectorInCollectorTeam(AgentBase collector, Person primaryCollector) {
|
|
206 |
if (collector.isInstanceOf(Person.class)){
|
|
207 |
return collector.equals(primaryCollector);
|
|
208 |
}else if (collector.isInstanceOf(Team.class)){
|
|
209 |
Team collectorTeam = CdmBase.deproxy(collector, Team.class);
|
|
210 |
return collectorTeam.getTeamMembers().contains(primaryCollector);
|
|
211 |
}else{
|
|
212 |
logger.warn("Collector is not of type person or team");
|
|
213 |
return false;
|
|
214 |
}
|
|
215 |
}
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
/**
|
|
220 |
* @param facade
|
|
221 |
*/
|
|
222 |
private String getCode(DerivedUnitFacade facade) {
|
|
223 |
String code = "";
|
|
224 |
if(facade.getCollection() != null){
|
|
225 |
code = facade.getCollection().getCode();
|
|
226 |
if (CdmUtils.isEmpty(code)){
|
|
227 |
Institution institution = facade.getCollection().getInstitute();
|
|
228 |
if (institution != null){
|
|
229 |
code = institution.getCode();
|
|
230 |
}
|
|
231 |
if (CdmUtils.isEmpty(code)){
|
|
232 |
Collection superCollection = facade.getCollection().getSuperCollection();
|
|
233 |
if (superCollection != null){
|
|
234 |
code = superCollection.getCode();
|
|
235 |
}
|
|
236 |
}
|
|
237 |
}
|
|
238 |
}
|
|
239 |
return code;
|
|
240 |
}
|
|
241 |
|
|
242 |
// ************************** GETTER / SETTER ******************************************************
|
|
243 |
|
|
244 |
public boolean isIncludeSeconds() {
|
|
245 |
return includeEmptySeconds;
|
|
246 |
}
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
public void setIncludeSeconds(boolean includeSeconds) {
|
|
251 |
this.includeEmptySeconds = includeSeconds;
|
|
252 |
}
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
public void setIncludeReferenceSystem(boolean includeReferenceSystem) {
|
|
257 |
this.includeReferenceSystem = includeReferenceSystem;
|
|
258 |
}
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
public boolean isIncludeReferenceSystem() {
|
|
263 |
return includeReferenceSystem;
|
|
264 |
}
|
|
265 |
|
|
266 |
|
|
267 |
}
|
Fix et al. for collectors #5568