1 |
0e7a9b4f
|
Andreas Kohlbecker
|
/**
|
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 |
ae269e4d
|
Andreas Kohlbecker
|
package eu.etaxonomy.cdm.vaadin.view.reference;
|
10 |
0e7a9b4f
|
Andreas Kohlbecker
|
|
11 |
4d551d34
|
Andreas Kohlbecker
|
import org.hibernate.SessionFactory;
|
12 |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
13 |
|
|
import org.springframework.transaction.TransactionStatus;
|
14 |
|
|
|
15 |
0e7a9b4f
|
Andreas Kohlbecker
|
import com.vaadin.spring.annotation.SpringComponent;
|
16 |
|
|
import com.vaadin.spring.annotation.ViewScope;
|
17 |
|
|
|
18 |
|
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
19 |
|
|
import eu.etaxonomy.vaadin.mvp.AbstractEditorPresenter;
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* @author a.kohlbecker
|
23 |
|
|
* @since Apr 5, 2017
|
24 |
|
|
*
|
25 |
|
|
*/
|
26 |
|
|
@SpringComponent
|
27 |
|
|
@ViewScope
|
28 |
|
|
public class ReferenceEditorPresenter extends AbstractEditorPresenter<Reference> {
|
29 |
|
|
|
30 |
74f4344f
|
Andreas Kohlbecker
|
|
31 |
|
|
private static final long serialVersionUID = -7926116447719010837L;
|
32 |
|
|
|
33 |
4d551d34
|
Andreas Kohlbecker
|
@Autowired
|
34 |
|
|
private SessionFactory factory;
|
35 |
|
|
|
36 |
0e7a9b4f
|
Andreas Kohlbecker
|
/**
|
37 |
|
|
* {@inheritDoc}
|
38 |
|
|
*/
|
39 |
|
|
@Override
|
40 |
|
|
protected void saveBean(Reference bean) {
|
41 |
4d551d34
|
Andreas Kohlbecker
|
TransactionStatus tx = getRepo().startTransaction();
|
42 |
|
|
Reference persistedBean = getRepo().getReferenceService().merge(bean);
|
43 |
|
|
getRepo().getReferenceService().saveOrUpdate(persistedBean);
|
44 |
|
|
getRepo().commitTransaction(tx);
|
45 |
0e7a9b4f
|
Andreas Kohlbecker
|
}
|
46 |
|
|
|
47 |
|
|
}
|