Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / taxeditor / session / DefaultNewEntityListener.java
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.session;
10
11 import org.apache.log4j.Logger;
12
13 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
14 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
15 import eu.etaxonomy.cdm.model.NewEntityListener;
16 import eu.etaxonomy.cdm.model.common.CdmBase;
17
18 /**
19 * @author cmathew
20 * @date 30 Sep 2015
21 *
22 */
23 public class DefaultNewEntityListener implements NewEntityListener {
24
25 private static final Logger logger = Logger.getLogger(DefaultNewEntityListener.class);
26
27 /* (non-Javadoc)
28 * @see eu.etaxonomy.cdm.model.NewEntityListener#onCreate(eu.etaxonomy.cdm.model.common.CdmBase)
29 */
30 @Override
31 public void onCreate(CdmBase cdmBase) {
32 logger.info("New Entity created : " + cdmBase);
33 if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){
34 ICdmEntitySession activeSession = ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
35 if(activeSession != null) {
36 activeSession.addNewCdmEntity(cdmBase);
37 }
38 }
39 }
40
41 }