Revision 25a150bd
Added by Andreas Kohlbecker over 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/event/registration/RegistrationWorkflowEvent.java | ||
---|---|---|
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.event.registration; |
|
10 |
|
|
11 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 3, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class RegistrationWorkflowEvent { |
|
17 |
|
|
18 |
private Action action; |
|
19 |
private Integer citationID = null; |
|
20 |
|
|
21 |
/** |
|
22 |
* |
|
23 |
* @param citationID the id of a {@link Reference} denoting a |
|
24 |
* complete registration working set. |
|
25 |
*/ |
|
26 |
public RegistrationWorkflowEvent(int citationID, Action action){ |
|
27 |
this.action = action; |
|
28 |
this.citationID = citationID; |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* @return the action |
|
33 |
*/ |
|
34 |
public Action getAction() { |
|
35 |
return action; |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* @return the registrationID |
|
40 |
*/ |
|
41 |
public Integer getCitationID() { |
|
42 |
return citationID; |
|
43 |
} |
|
44 |
|
|
45 |
public boolean isStart() { |
|
46 |
return action.equals(Action.start); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
public enum Action { |
|
51 |
start, open; |
|
52 |
} |
|
53 |
|
|
54 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/event/registration/RegistrationWorkingsetAction.java | ||
---|---|---|
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.event.registration; |
|
10 |
|
|
11 |
/** |
|
12 |
* @author a.kohlbecker |
|
13 |
* @since Mar 3, 2017 |
|
14 |
* |
|
15 |
*/ |
|
16 |
public class RegistrationWorkingsetAction { |
|
17 |
|
|
18 |
private Action action; |
|
19 |
private Integer citationID = null; |
|
20 |
|
|
21 |
/** |
|
22 |
* |
|
23 |
* @param citationID the id of a {@link Reference} denoting a |
|
24 |
* complete registration working set. |
|
25 |
*/ |
|
26 |
public RegistrationWorkingsetAction(int citationID, Action action){ |
|
27 |
this.action = action; |
|
28 |
this.citationID = citationID; |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* @return the action |
|
33 |
*/ |
|
34 |
public Action getAction() { |
|
35 |
return action; |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* @return the registrationID |
|
40 |
*/ |
|
41 |
public Integer getCitationID() { |
|
42 |
return citationID; |
|
43 |
} |
|
44 |
|
|
45 |
public boolean isStart() { |
|
46 |
return action.equals(Action.start); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
public enum Action { |
|
51 |
start, open; |
|
52 |
} |
|
53 |
|
|
54 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.model.common.User; |
29 | 29 |
import eu.etaxonomy.cdm.model.name.Rank; |
30 | 30 |
import eu.etaxonomy.cdm.model.name.Registration; |
31 |
import eu.etaxonomy.cdm.model.name.RegistrationStatus; |
|
31 | 32 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
32 | 33 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
33 | 34 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
34 | 35 |
import eu.etaxonomy.cdm.model.reference.Reference; |
35 | 36 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
37 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.Operation; |
|
36 | 38 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
37 | 39 |
import eu.etaxonomy.cdm.service.CdmStore; |
38 | 40 |
import eu.etaxonomy.cdm.service.IRegistrationWorkingSetService; |
... | ... | |
42 | 44 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
43 | 45 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction; |
44 | 46 |
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction; |
45 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent;
|
|
47 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction;
|
|
46 | 48 |
import eu.etaxonomy.cdm.vaadin.model.EntityReference; |
47 | 49 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
48 | 50 |
import eu.etaxonomy.cdm.vaadin.security.UserHelper; |
... | ... | |
127 | 129 |
Authentication authentication = currentSecurityContext().getAuthentication(); |
128 | 130 |
reg.setSubmitter((User)authentication.getPrincipal()); |
129 | 131 |
EntityChangeEvent event = getRegistrationStore().saveBean(reg); |
132 |
UserHelper.fromSession().createAuthorityForCurrentUser(Registration.class, event.getEntityId(), Operation.UPDATE, RegistrationStatus.PREPARATION.name()); |
|
130 | 133 |
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
131 | 134 |
return getRepo().getRegistrationService().find(event.getEntityId()); |
132 | 135 |
} |
... | ... | |
247 | 250 |
if(event.getReason().equals(Reason.SAVE)){ |
248 | 251 |
if(newTaxonNameForRegistration != null){ |
249 | 252 |
int taxonNameId = newTaxonNameForRegistration.getId(); |
253 |
getRepo().getSession().refresh(newTaxonNameForRegistration); |
|
250 | 254 |
Registration reg = createNewRegistrationForName(taxonNameId); |
251 | 255 |
workingset.add(reg); |
252 | 256 |
} |
... | ... | |
266 | 270 |
* @param event |
267 | 271 |
* @throws RegistrationValidationException |
268 | 272 |
*/ |
269 |
@EventListener(condition = "#event.action == T(eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent.Action).start")
|
|
270 |
public void onRegistrationWorkflowEventActionStart(RegistrationWorkflowEvent event) throws RegistrationValidationException {
|
|
273 |
@EventListener(condition = "#event.action == T(eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction.Action).start")
|
|
274 |
public void onRegistrationWorkflowEventActionStart(RegistrationWorkingsetAction event) throws RegistrationValidationException {
|
|
271 | 275 |
|
272 | 276 |
getView().getAddExistingNameCombobox().commit(); |
273 | 277 |
TaxonName typifiedName = getView().getAddExistingNameCombobox().getValue(); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorksetViewBean.java | ||
---|---|---|
54 | 54 |
import eu.etaxonomy.cdm.vaadin.event.ShowDetailsEvent; |
55 | 55 |
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction; |
56 | 56 |
import eu.etaxonomy.cdm.vaadin.event.TypeDesignationWorkingsetEditorAction; |
57 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkflowEvent;
|
|
57 |
import eu.etaxonomy.cdm.vaadin.event.registration.RegistrationWorkingsetAction;
|
|
58 | 58 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
59 | 59 |
import eu.etaxonomy.cdm.vaadin.security.AccessRestrictedView; |
60 | 60 |
import eu.etaxonomy.cdm.vaadin.security.PermissionDebugUtils; |
... | ... | |
193 | 193 |
addExistingNameButton.setDescription("A name which was previously published in a earlier publication."); |
194 | 194 |
addExistingNameButton.setEnabled(false); |
195 | 195 |
addExistingNameButton.addClickListener( |
196 |
e -> eventBus.publishEvent(new RegistrationWorkflowEvent(citationID, RegistrationWorkflowEvent.Action.start))
|
|
196 |
e -> eventBus.publishEvent(new RegistrationWorkingsetAction(citationID, RegistrationWorkingsetAction.Action.start))
|
|
197 | 197 |
); |
198 | 198 |
|
199 | 199 |
existingNameCombobox = new LazyComboBox<TaxonName>(TaxonName.class); |
Also available in: Unified diff
renaming event to action and solving refresh problem in workingset editor