Project

General

Profile

Download (1.89 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2015 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.taxeditor.editor;
11

    
12
import java.util.List;
13

    
14
import eu.etaxonomy.cdm.api.service.IService;
15
import eu.etaxonomy.cdm.model.common.CdmBase;
16
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
17
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
18
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
19
import eu.etaxonomy.taxeditor.store.CdmStore;
20

    
21
/**
22
 * @author cmathew
23
 * @date 5 Feb 2015
24
 *
25
 */
26
public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled {
27

    
28
    private final ICdmEntitySession cdmEntitySession;
29

    
30
    public CdmEntitySessionInput() {
31
        cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
32
    }
33

    
34
    /* (non-Javadoc)
35
     * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
36
     */
37
    @Override
38
    public void update(CdmDataChangeMap changeEvents) {
39
       // do nothing
40

    
41
    }
42

    
43
    /* (non-Javadoc)
44
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
45
     */
46
    @Override
47
    public ICdmEntitySession getCdmEntitySession() {
48
       return cdmEntitySession;
49
    }
50

    
51
    public <T extends CdmBase> void update(IService<T> service, T cdmBase) {
52
        cdmEntitySession.remoteUpdate(service, cdmBase);
53
    }
54

    
55
    public abstract  <T extends CdmBase> IService<T> getService();
56

    
57
    public <T extends CdmBase> void update(T cdmBase) {
58
        cdmEntitySession.remoteUpdate(getService(), cdmBase);
59
    }
60

    
61
    public abstract <T extends CdmBase> List<T> getRootEntities();
62

    
63
    public abstract <T extends CdmBase> void update();
64
}
(2-2/18)