CdmTransientEntityCacher, EntityCacherDebugResult : moved debug methods to debug...
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / CdmEntitySessionInput.java
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 eu.etaxonomy.cdm.api.service.IService;
13 import eu.etaxonomy.cdm.model.common.CdmBase;
14 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
15 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
16 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
17 import eu.etaxonomy.taxeditor.store.CdmStore;
18
19 /**
20 * @author cmathew
21 * @date 5 Feb 2015
22 *
23 */
24 public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled {
25
26 private final ICdmEntitySession cdmEntitySession;
27
28 public CdmEntitySessionInput() {
29 cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
30 }
31
32 /* (non-Javadoc)
33 * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
34 */
35 @Override
36 public void update(CdmDataChangeMap changeEvents) {
37 // do nothing
38
39 }
40
41 /* (non-Javadoc)
42 * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
43 */
44 @Override
45 public ICdmEntitySession getCdmEntitySession() {
46 return cdmEntitySession;
47 }
48
49 public <T extends CdmBase> void update(IService<T> service, T cdmBase) {
50 cdmEntitySession.remoteUpdate(service, cdmBase);
51 }
52
53 public abstract <T extends CdmBase> IService<T> getService();
54
55 public <T extends CdmBase> void update(T cdmBase) {
56 cdmEntitySession.remoteUpdate(getService(), cdmBase);
57 }
58
59
60 public abstract <T extends CdmBase> void update();
61 }