Project

General

Profile

Download (1.81 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.jscomponent.D3ConceptRelationshipTree.Direction;
22
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
23
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener;
24

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

    
32

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

    
36
    private final ICdmApplicationConfiguration app;
37

    
38

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

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

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

    
54

    
55

    
56
}
(2-2/5)