Project

General

Profile

Download (1.26 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.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
    @Override
28
    public void onCreate(CdmBase cdmBase) {
29
        logger.info("New Entity created : " + cdmBase);
30
        if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){
31
            ICdmEntitySession activeSession = ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
32
            if(activeSession != null) {
33
                activeSession.addNewCdmEntity(cdmBase);
34
            }
35
        }
36
    }
37

    
38
}
(4-4/9)