Merge branch 'release/4.3.0'
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / dto / MarkedEntityDTO.java
1 // $Id$
2 /**
3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.cdm.api.service.dto;
11
12 import java.util.UUID;
13
14 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
15 import eu.etaxonomy.cdm.model.common.MarkerType;
16
17 /**
18 * DTO for IdentifiableEntities matching a certain marker.
19 *
20 * @author a.mueller
21 * @date 2016-09-16
22 *
23 */
24 //might extend AnnotatableEntity in future
25 public class MarkedEntityDTO<T extends IdentifiableEntity> extends EntityDTOBase<T> {
26
27 public class Marker{
28 UUID typeUuid;
29 String typeLabel;
30 Boolean flag;
31 public Marker(MarkerType markerType, Boolean flag) {
32 this.typeUuid = markerType.getUuid();
33 this.typeLabel = markerType.getTitleCache();
34 this.flag = flag;
35 }
36 public UUID getTypeUuid() {return typeUuid;}
37 public String getTypeLabel() {return typeLabel;}
38 public Boolean getFlag() {return flag;}
39 }
40
41 private Marker marker;
42
43 public MarkedEntityDTO(MarkerType markerType, Boolean flag, T entity){
44 super(entity);
45 this.marker = new Marker(markerType, flag);
46 }
47
48 public MarkedEntityDTO(MarkerType markerType, Boolean flag, UUID entityUuid, String titleCache){
49 super(entityUuid, titleCache);
50 this.marker = new Marker(markerType, flag);
51 }
52
53 public Marker getMarker() {
54 return marker;
55 }
56
57
58 /**
59 * {@inheritDoc}
60 */
61 @Override
62 public String toString() {
63 return "(" + marker.typeLabel + "; " + cdmEntity.getTitleCache() + "; " + cdmEntity.cdmUuid + ")";
64 }
65
66
67 }