Project

General

Profile

Revision 5ce3b66a

ID5ce3b66a0506ca4ddc9ec422a1a0ba27cc646b1c
Parent 0d707542
Child 7e055a60

Added by Andreas Kohlbecker almost 2 years ago

ref #7528 ref #6655 introducing RegistrationStatusTransitions to provide a matrix of allowed RegistrationStatus transitions

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/config/RegistrationStatusTransitions.java
1
/**
2
* Copyright (C) 2018 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.config;
10

  
11
import java.util.Arrays;
12
import java.util.HashMap;
13
import java.util.HashSet;
14
import java.util.Map;
15
import java.util.Set;
16

  
17
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
18

  
19
/**
20
 *
21
 * @author a.kohlbecker
22
 * @since Jul 4, 2018
23
 *
24
 */
25
public class RegistrationStatusTransitions {
26

  
27
    static private Map<RegistrationStatus, Set<RegistrationStatus>> allowedTransitions = new HashMap<>();
28

  
29
    static {
30
        allowedTransitions.put(RegistrationStatus.PREPARATION, new HashSet<>(Arrays.asList(RegistrationStatus.CURATION)));
31
        allowedTransitions.put(RegistrationStatus.CURATION, new HashSet<>(Arrays.asList(RegistrationStatus.PREPARATION, RegistrationStatus.READY)));
32
        allowedTransitions.put(RegistrationStatus.READY, new HashSet<>(Arrays.asList(RegistrationStatus.PUBLISHED, RegistrationStatus.REJECTED)));
33
        allowedTransitions.put(RegistrationStatus.PUBLISHED, new HashSet<>()); // no further transition
34
        allowedTransitions.put(RegistrationStatus.REJECTED, new HashSet<>()); // no further transition
35
    }
36

  
37

  
38
    /**
39
     * @param currentStatus
40
     */
41
    public static Set<RegistrationStatus> possibleTransitions(RegistrationStatus currentStatus) {
42
        return allowedTransitions.get(currentStatus);
43
    }
44

  
45

  
46

  
47
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)