Project

General

Profile

Download (1.7 KB) Statistics
| Branch: | Tag: | Revision:
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.cdm.vaadin.presenter;
11

    
12
import org.json.JSONException;
13
import org.springframework.transaction.TransactionStatus;
14

    
15
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
16
import eu.etaxonomy.cdm.api.service.ITaxonService;
17
import eu.etaxonomy.cdm.model.common.CdmBase;
18
import eu.etaxonomy.cdm.model.taxon.Taxon;
19
import eu.etaxonomy.cdm.vaadin.container.IdUuidName;
20
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree;
21
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
22
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener;
23

    
24
/**
25
 * @author cmathew
26
 * @date 9 Apr 2015
27
 *
28
 */
29
public class ConceptRelationshipPresenter implements IConceptRelationshipComponentListener {
30

    
31

    
32
    private final D3ConceptRelationshipTree crTree;
33
    private final ITaxonService taxonService;
34

    
35
    private final ICdmApplicationConfiguration app;
36

    
37

    
38
    public ConceptRelationshipPresenter(D3ConceptRelationshipTree crTree) {
39
        this.crTree = crTree;
40

    
41
        taxonService = CdmSpringContextHelper.getTaxonService();
42
        app = CdmSpringContextHelper.getApplicationConfiguration();
43
    }
44

    
45
    @Override
46
    public void refreshRelationshipView(IdUuidName taxonIun) throws JSONException {
47
        TransactionStatus tx = app.startTransaction();
48
        Taxon taxon = CdmBase.deproxy(taxonService.load(taxonIun.getUuid()), Taxon.class);
49
        crTree.update(taxon);
50
        app.commitTransaction(tx);
51
    }
52

    
53

    
54

    
55
}
(2-2/5)