Project

General

Profile

Download (1.51 KB) Statistics
| Branch: | Tag: | Revision:
1 c7d830cc Cherian Mathew
/**
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 ac1f29b5 Cherian Mathew
import java.util.List;
12
import java.util.Map;
13
14 c7d830cc Cherian Mathew
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 c9f13bde Cherian Mathew
    private ICdmEntitySession cdmEntitySession;
25 c7d830cc Cherian Mathew
26 c9f13bde Cherian Mathew
    public CdmEntitySessionInput(boolean init) {
27
        if(init) {
28
            initSession();
29
        }
30
    }
31
32
    protected void initSession() {
33 c7d830cc Cherian Mathew
        cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
34
    }
35
36
    @Override
37
    public ICdmEntitySession getCdmEntitySession() {
38 8c8ead8a Cherian Mathew
        return cdmEntitySession;
39 c7d830cc Cherian Mathew
    }
40
41 8c8ead8a Cherian Mathew
    public void bind() {
42 692fd528 Patrick Plitzner
        if(cdmEntitySession!=null){
43
            cdmEntitySession.bind();
44
        }
45 6034c463 Katja Luther
        else {
46
            initSession();
47
        }
48 c7d830cc Cherian Mathew
    }
49
50 8c8ead8a Cherian Mathew
    public void dispose() {
51 eb717abe Katja Luther
        if (cdmEntitySession != null){
52
            cdmEntitySession.dispose();
53
        }
54 692fd528 Patrick Plitzner
        cdmEntitySession = null;
55 6034c463 Katja Luther
56 c7d830cc Cherian Mathew
    }
57
58 8c8ead8a Cherian Mathew
    public abstract void merge();
59 c7d830cc Cherian Mathew
60 ac1f29b5 Cherian Mathew
    @Override
61
    public Map<Object, List<String>> getPropertyPathsMap() {
62
        // TODO Auto-generated method stub
63
        return null;
64
    }
65
66 c7d830cc Cherian Mathew
}