Project

General

Profile

Download (2.8 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.bulkeditor.input;
10

    
11
import java.util.ArrayList;
12
import java.util.Arrays;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
17
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
18
import eu.etaxonomy.cdm.model.name.NameRelationship;
19
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
20
import eu.etaxonomy.taxeditor.model.MessagingUtils;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * @author n.hoffmann
25
 * @created Oct 19, 2010
26
 */
27
public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRelationship> {
28

    
29
	public static final String ID = "bulkeditor.input.nameRelationship";
30

    
31
	private static NameRelationshipEditorInput instance;
32

    
33
	public static AbstractBulkEditorInput<NameRelationship> getInstance(){
34
		if(instance == null){
35
			instance = new NameRelationshipEditorInput();
36
		}
37
		return instance;
38
	}
39

    
40
    @Override
41
    protected List<String> getPropertyKeys_internal() {
42
        List<String> propertyKeysInternal = new ArrayList<>();
43
        return propertyKeysInternal;
44
    }
45

    
46
    @Override
47
	public String getName() {
48
		return BulkEditorInputType.NAME_RELATIONSHIP.label;
49
	}
50

    
51
	@Override
52
	public NameRelationship save(NameRelationship entity) {
53
		// TODO Auto-generated method stub
54
		return null;
55
	}
56

    
57
	@Override
58
	public boolean delete(NameRelationship entity, DeleteConfiguratorBase config) {
59
		// TODO Auto-generated method stub
60
		return false;
61
	}
62

    
63
	@Override
64
	protected long countEntities(IIdentifiableEntityServiceConfigurator configurator) {
65
	    //TODO there is neither a service for name relationships nor any concrete
66
	    //method for counting them
67
	    return CdmStore.getCommonService().count(NameRelationship.class);
68
	}
69

    
70
	@Override
71
	protected List<NameRelationship> listEntities(
72
			IIdentifiableEntityServiceConfigurator configurator) {
73
		return CdmStore.getSearchManager().findNameRelationships(configurator);
74
	}
75

    
76
	@Override
77
	protected NameRelationship loadEntity(UUID entityUuid) {
78
		List<String> propertyPaths = Arrays.asList(new String[]{});
79
		return null; // CdmStore.getNameService().load(entityUuid, propertyPaths);
80
	}
81

    
82
	@Override
83
	protected IEntityCreator<NameRelationship> createEntityCreator() {
84
		MessagingUtils.notImplementedMessage(getClass());
85
		return null;
86
	}
87

    
88
	@Override
89
	public String getTypeText(Object entity) {
90
		if(entity instanceof NameRelationship){
91
			return ((NameRelationship) entity).getType().getTitleCache();
92
		}
93

    
94
		return super.getTypeText(entity);
95
	}
96

    
97
    @Override
98
    public void merge() {
99

    
100
    }
101
}
(7-7/11)