Project

General

Profile

Download (1.64 KB) Statistics
| Branch: | Tag: | Revision:
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.util.UUID;
12

    
13
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
14
import eu.etaxonomy.cdm.model.common.MarkerType;
15

    
16
/**
17
 * DTO for IdentifiableEntities matching a certain marker.
18
 *
19
 * @author a.mueller
20
 * @date 2016-09-16
21
 *
22
 */
23
//might extend AnnotatableEntity in future
24
public class MarkedEntityDTO<T extends IdentifiableEntity> extends EntityDTOBase<T> {
25

    
26
	public class Marker{
27
		UUID typeUuid;
28
		String typeLabel;
29
		Boolean flag;
30
		public Marker(MarkerType markerType, Boolean flag) {
31
			this.typeUuid = markerType.getUuid();
32
			this.typeLabel = markerType.getTitleCache();
33
			this.flag = flag;
34
		}
35
		public UUID getTypeUuid() {return typeUuid;}
36
		public String getTypeLabel() {return typeLabel;}
37
		public Boolean getFlag() {return flag;}
38
	}
39

    
40
	private Marker marker;
41

    
42
	public MarkedEntityDTO(MarkerType markerType, Boolean flag, T entity){
43
	    super(entity);
44
		this.marker = new Marker(markerType, flag);
45
	}
46

    
47
	public MarkedEntityDTO(MarkerType markerType, Boolean flag, UUID entityUuid, String titleCache){
48
	    super(entityUuid, titleCache);
49
	    this.marker = new Marker(markerType, flag);
50
	}
51

    
52
	public Marker getMarker() {
53
		return marker;
54
	}
55

    
56

    
57
    /**
58
     * {@inheritDoc}
59
     */
60
    @Override
61
    public String toString() {
62
        return "(" + marker.typeLabel + "; "  + cdmEntity.getTitleCache() + "; " + cdmEntity.getUuid() +  ")";
63
    }
64

    
65

    
66
}
(12-12/14)