Project

General

Profile

Download (1.51 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2015 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.taxeditor.editor;
10

    
11
import java.util.List;
12
import java.util.Map;
13

    
14
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
15
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
16
import eu.etaxonomy.taxeditor.store.CdmStore;
17

    
18
/**
19
 * @author cmathew
20
 * @date 5 Feb 2015
21
 */
22
public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled {
23

    
24
    private ICdmEntitySession cdmEntitySession;
25

    
26
    public CdmEntitySessionInput(boolean init) {
27
        if(init) {
28
            initSession();
29
        }
30
    }
31

    
32
    protected void initSession() {
33
        cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
34
    }
35

    
36
    @Override
37
    public ICdmEntitySession getCdmEntitySession() {
38
        return cdmEntitySession;
39
    }
40

    
41
    public void bind() {
42
        if(cdmEntitySession!=null){
43
            cdmEntitySession.bind();
44
        }
45
        else {
46
            initSession();
47
        }
48
    }
49

    
50
    public void dispose() {
51
        if (cdmEntitySession != null){
52
            cdmEntitySession.dispose();
53
        }
54
        cdmEntitySession = null;
55

    
56
    }
57

    
58
    public abstract void merge();
59

    
60
    @Override
61
    public Map<Object, List<String>> getPropertyPathsMap() {
62
        // TODO Auto-generated method stub
63
        return null;
64
    }
65

    
66
}
(1-1/7)