cdm-vaadin/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationType.java @ ae269e4d
1 |
/**
|
---|---|
2 |
* Copyright (C) 2017 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.vaadin.view.registration; |
10 |
|
11 |
import eu.etaxonomy.cdm.mock.Registration; |
12 |
|
13 |
/**
|
14 |
* @author a.kohlbecker
|
15 |
* @since Mar 3, 2017
|
16 |
*
|
17 |
*/
|
18 |
public enum RegistrationType { |
19 |
|
20 |
NAME, TYPIFICATION, INVALID; |
21 |
|
22 |
/**
|
23 |
* @param reg
|
24 |
* @return
|
25 |
*/
|
26 |
public static RegistrationType from(Registration reg) { |
27 |
if(reg.getName() != null){ |
28 |
return NAME; |
29 |
}
|
30 |
if(reg.getTypeDesignations().size() > 0){ |
31 |
return TYPIFICATION; |
32 |
}
|
33 |
return INVALID; |
34 |
}
|
35 |
|
36 |
/**
|
37 |
* @return
|
38 |
*/
|
39 |
public boolean isName() { |
40 |
return NAME.equals(this); |
41 |
|
42 |
}
|
43 |
/**
|
44 |
* @return
|
45 |
*/
|
46 |
public boolean isTypification() { |
47 |
return TYPIFICATION.equals(this); |
48 |
}
|
49 |
|
50 |
}
|