2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.vaadin
.presenter
.registration
;
11 import org
.apache
.log4j
.Logger
;
12 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
13 import org
.springframework
.context
.event
.EventListener
;
15 import com
.vaadin
.spring
.annotation
.SpringComponent
;
16 import com
.vaadin
.spring
.annotation
.ViewScope
;
18 import eu
.etaxonomy
.cdm
.mock
.Registration
;
19 import eu
.etaxonomy
.cdm
.mock
.RegistrationService
;
20 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
21 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameFactory
;
22 import eu
.etaxonomy
.cdm
.vaadin
.event
.registration
.RegistrationWorkflowEvent
;
23 import eu
.etaxonomy
.cdm
.vaadin
.view
.registration
.RegistrationWorkflowView
;
24 import eu
.etaxonomy
.vaadin
.mvp
.AbstractPresenter
;
27 * @author a.kohlbecker
33 public class RegistrationWorkflowPresenter
extends AbstractPresenter
<RegistrationWorkflowView
> {
37 private RegistrationService serviceMock
;
39 private Registration registration
;
44 public RegistrationWorkflowPresenter() {
48 protected void onRegistrationStartEvent(RegistrationWorkflowEvent e
){
50 if(registration
!= null){
51 Logger
.getLogger(RegistrationWorkflowPresenter
.class).warn("Foiling attempt to start another registration in existing workflow");
56 registration
= new Registration();
57 registration
.setName(TaxonNameFactory
.NewBotanicalInstance(Rank
.SPECIES()));
59 registration
= serviceMock
.loadByRegistrationID(e
.getRegistrationID());
61 if(registration
!= null){
62 // getView().getTitle().setValue("Workflow for a " + registrationType().name());
63 getView().makeWorflow(registrationType());
70 private RegistrationType
registrationType() {
71 return RegistrationType
.from(registration
);