Project

General

Profile

Download (1.83 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
//$Id$
3
/**
4
* Copyright (C) 2007 EDIT
5
* European Distributed Institute of Taxonomy 
6
* http://www.e-taxonomy.eu
7
* 
8
* The contents of this file are subject to the Mozilla Public License Version 1.1
9
* See LICENSE.TXT at the top of this package for the full license terms.
10
*/
11

    
12
package eu.etaxonomy.taxeditor.dnd.transfer;
13

    
14
import java.util.UUID;
15

    
16
import eu.etaxonomy.cdm.api.service.IClassificationService;
17
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
18
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
19
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
20
import eu.etaxonomy.taxeditor.model.CdmObjectTransfer;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * Drag / Drop Transfer object for Taxon Node 
25
 * 
26
 * @author c.mathew
27
 * @created Mar 25, 2013
28
 */
29
public class TaxonNodeTransfer extends CdmObjectTransfer<ITaxonTreeNode> {
30

    
31
	private static TaxonNodeTransfer instance = new TaxonNodeTransfer();
32
	private static final String TYPE_NAME = "taxonNode-transfer-format";
33
	private static final int TYPEID = registerType(TYPE_NAME);
34
	
35
	public static synchronized TaxonNodeTransfer getInstance(){
36
		return instance;
37
	}
38
	
39
	private TaxonNodeTransfer(){}
40
	
41
	/* (non-Javadoc)
42
	 * @see org.eclipse.swt.dnd.Transfer#getTypeIds()
43
	 */
44
	@Override
45
	protected int[] getTypeIds() {
46
		return new int[] { TYPEID };
47
	}
48

    
49
	/* (non-Javadoc)
50
	 * @see org.eclipse.swt.dnd.Transfer#getTypeNames()
51
	 */
52
	@Override
53
	protected String[] getTypeNames() {
54
		return new String[] { TYPE_NAME };
55
	}
56

    
57
	/* (non-Javadoc)
58
	 * @see eu.etaxonomy.taxeditor.model.CdmObjectTransfer#loadElement(java.util.UUID)
59
	 */
60
	@Override
61
	public ITaxonTreeNode loadElement(UUID uuid) {
62
		ITaxonTreeNode result = CdmStore.getService(ITaxonNodeService.class).load(uuid, null);
63
		if ( result != null){
64
			return result;
65
		}
66
		result = CdmStore.getService(IClassificationService.class).load(uuid, null);
67
		return result;
68
	}
69
}
    (1-1/1)