Project

General

Profile

Download (1.37 KB) Statistics
| Branch: | Tag: | Revision:
1 0b0a8928 Patrick Plitzner
/**
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 a81e3c1b Andreas Müller
package eu.etaxonomy.cdm.format;
10 0b0a8928 Patrick Plitzner
11 733faa22 Patrick Plitzner
import java.util.List;
12
13
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
14
import eu.etaxonomy.cdm.model.common.Identifier;
15 a1dce9c6 Andreas Müller
import eu.etaxonomy.cdm.model.term.DefinedTerm;
16 733faa22 Patrick Plitzner
17 0b0a8928 Patrick Plitzner
/**
18
 * @author pplitzner
19 53db84af Andreas Müller
 * @since Nov 30, 2015
20 0b0a8928 Patrick Plitzner
 */
21
public class IdentifiableEntityFormatter extends AbstractCdmFormatter {
22
23
    public IdentifiableEntityFormatter(Object object, FormatKey[] formatKeys) {
24
        super(object, formatKeys);
25
    }
26
27
    @Override
28 16f965a1 p.plitzner
    protected void initFormatKeys(Object object) {
29 0b0a8928 Patrick Plitzner
        super.initFormatKeys(object);
30 a81e3c1b Andreas Müller
        IdentifiableEntity<?> identifiableEntity = (IdentifiableEntity<?>)object;
31 733faa22 Patrick Plitzner
        List<Identifier> identifiers = identifiableEntity.getIdentifiers();
32
        String identifierString = null;
33 0a140219 Andreas Müller
        for (Identifier identifier : identifiers) {
34 a1dce9c6 Andreas Müller
            if(DefinedTerm.uuidSampleDesignation.equals(identifier.getType())){
35 733faa22 Patrick Plitzner
                identifierString = identifier.getIdentifier();
36
                break;
37
            }
38
        }
39
        if(identifierString!=null){
40
            formatKeyMap.put(FormatKey.SAMPLE_DESIGNATION, identifierString);
41
        }
42 0b0a8928 Patrick Plitzner
    }
43
44
}