Project

General

Profile

Download (1.71 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
 * @since 2016-09-16
21
 *
22
 */
23
//might extend AnnotatableEntity in future
24
public class MarkedEntityDTO<T extends IdentifiableEntity> extends EntityDTOBase<T> {
25

    
26
    private static final long serialVersionUID = -6633266304860008601L;
27

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

    
42
	private Marker marker;
43

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

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

    
54
	public Marker getMarker() {
55
		return marker;
56
	}
57

    
58

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

    
67

    
68
}
(23-23/44)