Project

General

Profile

Download (1.3 KB) Statistics
| Branch: | Tag: | Revision:
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.view.reference;
10

    
11
import org.hibernate.SessionFactory;
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.transaction.TransactionStatus;
14

    
15
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

    
31
    private static final long serialVersionUID = -7926116447719010837L;
32

    
33
    @Autowired
34
    private SessionFactory factory;
35

    
36
    /**
37
     * {@inheritDoc}
38
     */
39
    @Override
40
    protected void saveBean(Reference bean) {
41
        TransactionStatus tx = getRepo().startTransaction();
42
        Reference persistedBean = getRepo().getReferenceService().merge(bean);
43
        getRepo().getReferenceService().saveOrUpdate(persistedBean);
44
        getRepo().commitTransaction(tx);
45
    }
46

    
47
}
(1-1/3)