1
|
/**
|
2
|
* Copyright (C) 2014 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.api.service.dto;
|
10
|
|
11
|
import java.io.Serializable;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
15
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
16
|
|
17
|
/**
|
18
|
* @author a.mueller
|
19
|
* @date 2015-01-19
|
20
|
*
|
21
|
*/
|
22
|
public class IdentifiedEntityDTO<T extends IdentifiableEntity> extends EntityDTOBase<T> implements Serializable{
|
23
|
|
24
|
private static final long serialVersionUID = -6993723067086766695L;
|
25
|
|
26
|
|
27
|
public class AlternativeIdentifier implements Serializable{
|
28
|
|
29
|
private static final long serialVersionUID = -6342783530172264106L;
|
30
|
|
31
|
UUID typeUuid;
|
32
|
String typeLabel;
|
33
|
String identifier;
|
34
|
public AlternativeIdentifier(DefinedTerm identifierType, String identifier) {
|
35
|
this.typeUuid = identifierType.getUuid();
|
36
|
this.typeLabel = identifierType.getTitleCache();
|
37
|
this.identifier = identifier;
|
38
|
}
|
39
|
public UUID getTypeUuid() {return typeUuid;}
|
40
|
public String getTypeLabel() {return typeLabel;}
|
41
|
public String getIdentifier() {return identifier;}
|
42
|
}
|
43
|
|
44
|
private AlternativeIdentifier identifier;
|
45
|
|
46
|
|
47
|
public IdentifiedEntityDTO(DefinedTerm identifierType, String identifier, T entity){
|
48
|
super(entity);
|
49
|
this.identifier = new AlternativeIdentifier(identifierType, identifier);
|
50
|
}
|
51
|
|
52
|
public IdentifiedEntityDTO(DefinedTerm identifierType, String identifier, UUID entityUuid, String titleCache, String abbrevTitleCache){
|
53
|
super(entityUuid, titleCache, abbrevTitleCache);
|
54
|
this.identifier = new AlternativeIdentifier(identifierType, identifier);
|
55
|
}
|
56
|
|
57
|
public AlternativeIdentifier getIdentifier() {
|
58
|
return identifier;
|
59
|
}
|
60
|
|
61
|
|
62
|
/**
|
63
|
* {@inheritDoc}
|
64
|
*/
|
65
|
@Override
|
66
|
public String toString() {
|
67
|
return "(" + identifier.typeLabel + "; " + cdmEntity.getTitleCache() + "; " + cdmEntity.getUuid() + ")";
|
68
|
}
|
69
|
}
|