1
|
/**
|
2
|
* Copyright (C) 2015 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.format;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
14
|
import eu.etaxonomy.cdm.model.common.Identifier;
|
15
|
import eu.etaxonomy.cdm.model.term.DefinedTerm;
|
16
|
|
17
|
/**
|
18
|
* @author pplitzner
|
19
|
* @since Nov 30, 2015
|
20
|
*/
|
21
|
public class IdentifiableEntityFormatter extends AbstractCdmFormatter {
|
22
|
|
23
|
public IdentifiableEntityFormatter(Object object, FormatKey[] formatKeys) {
|
24
|
super(object, formatKeys);
|
25
|
}
|
26
|
|
27
|
@Override
|
28
|
protected void initFormatKeys(Object object) {
|
29
|
super.initFormatKeys(object);
|
30
|
IdentifiableEntity<?> identifiableEntity = (IdentifiableEntity<?>)object;
|
31
|
List<Identifier> identifiers = identifiableEntity.getIdentifiers();
|
32
|
String identifierString = null;
|
33
|
for (Identifier identifier : identifiers) {
|
34
|
if(DefinedTerm.uuidSampleDesignation.equals(identifier.getType())){
|
35
|
identifierString = identifier.getIdentifier();
|
36
|
break;
|
37
|
}
|
38
|
}
|
39
|
if(identifierString!=null){
|
40
|
formatKeyMap.put(FormatKey.SAMPLE_DESIGNATION, identifierString);
|
41
|
}
|
42
|
}
|
43
|
|
44
|
}
|