Project

General

Profile

« Previous | Next » 

Revision b0fdf0ab

Added by Andreas Kohlbecker about 7 years ago

ref #6169 mock service for registrations

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/presenter/phycobank/RegistrationWorkflowPresenter.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.presenter.phycobank;
10 10

  
11
import org.springframework.beans.factory.annotation.Autowired;
11 12
import org.springframework.context.event.EventListener;
12 13

  
13 14
import com.vaadin.spring.annotation.SpringComponent;
14 15
import com.vaadin.spring.annotation.ViewScope;
15 16

  
16
import eu.etaxonomy.cdm.vaadin.event.phycobank.RegistrationStartEvent;
17
import eu.etaxonomy.cdm.mock.Registration;
18
import eu.etaxonomy.cdm.mock.RegistrationService;
19
import eu.etaxonomy.cdm.model.name.Rank;
20
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
21
import eu.etaxonomy.cdm.vaadin.event.phycobank.RegistrationWorkflowEvent;
17 22
import eu.etaxonomy.cdm.vaadin.view.phycobank.RegistrationWorkflowView;
18 23
import eu.etaxonomy.vaadin.mvp.AbstractPresenter;
19 24

  
......
26 31
@ViewScope
27 32
public class RegistrationWorkflowPresenter extends AbstractPresenter<RegistrationWorkflowView> {
28 33

  
29
    private RegistrationType registrationType = null;
30 34

  
35
    @Autowired
36
    private RegistrationService serviceMock;
37

  
38
    private Registration registration;
31 39

  
32 40
    /**
33 41
     *
......
36 44
    }
37 45

  
38 46
    @EventListener
39
    protected void onRegistrationStartEvent(RegistrationStartEvent e){
40
        this.registrationType = e.getType();
41
        getView().getTitle().setValue(getView().getTitle().getValue() + " " + registrationType.name());
47
    protected void onRegistrationStartEvent(RegistrationWorkflowEvent e){
48

  
49
        if(e.isStart()) {
50
            registration = new Registration();
51
            registration.setName(TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES()));
52
        } else {
53
            registration = serviceMock.loadByRegistrationID(e.getRegistrationID());
54
        }
55
        if(registration != null){
56
            getView().getTitle().setValue(getView().getTitle().getValue() + " " + registrationType().name());
57
            getView().makeWorflow(registrationType());
58
        }
59
    }
60

  
61
    /**
62
     * @return
63
     */
64
    private RegistrationType registrationType() {
65
        return RegistrationType.from(registration);
42 66
    }
43 67

  
44 68

  

Also available in: Unified diff