Project

General

Profile

Download (1.93 KB) Statistics
| Branch: | Tag: | Revision:
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.model.registration;
10

    
11
import org.apache.commons.lang.StringEscapeUtils;
12

    
13
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
14

    
15

    
16
/**
17
 * @author a.kohlbecker
18
 * @since Mar 28, 2017
19
 *
20
 */
21
public enum WorkflowStep {
22

    
23
    PUBLICATION_DETAILS(0, "Publication"),
24
    NAMES_N_TYPES(1, "Names & Types"),
25
    CURATION(2, "Curation"),
26
    AWAITING_PUBLICATION(3, "Awaiting publication"),
27
    PUBLISHED(3, "Awaiting publication"),
28
    REJECTED(3, "Rejected");
29

    
30
    private String representation;
31
    private int stepIndex = -1;
32

    
33
    private WorkflowStep(int stepIndex, String representation){
34
        this.stepIndex = stepIndex;
35
        this.representation = representation;
36
    }
37

    
38
    /**
39
     * @return the representation
40
     */
41
    public String getRepresentation() {
42
        return representation;
43
    }
44

    
45
    /**
46
     * @return the stepIndex
47
     */
48
    public int getStepIndex() {
49
        return stepIndex;
50
    }
51

    
52
    public String getHtml(){
53
        return StringEscapeUtils.escapeHtml(getRepresentation());
54
    }
55

    
56
    public static WorkflowStep from(RegistrationStatus status, boolean citationDetailsReady) {
57
        if(!citationDetailsReady){
58
            return PUBLICATION_DETAILS;
59
        } else {
60
            switch(status) {
61
            case CURATION:
62
                return CURATION;
63
            case PUBLISHED:
64
                return PUBLISHED;
65
            case REJECTED:
66
                return REJECTED;
67
            case PREPARATION:
68
                return PUBLICATION_DETAILS;
69
            case READY:
70
                return AWAITING_PUBLICATION;
71
            default:
72
                /* this should never happen */
73
                return null;
74
            }
75
        }
76
    }
77
}
(6-6/6)