Project

General

Profile

Download (2.89 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

    
10
package eu.etaxonomy.taxeditor.bulkeditor.input;
11

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

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

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

    
31
	private static final long serialVersionUID = -7453923697752787687L;
32

    
33
	public static final String ID = "bulkeditor.input.nameRelationship";
34

    
35
	private static NameRelationshipEditorInput instance;
36

    
37
	public static AbstractBulkEditorInput<NameRelationship> getInstance(){
38
		if(instance == null){
39
			instance = new NameRelationshipEditorInput();
40
		}
41
		return instance;
42
	}
43

    
44
    @Override
45
    protected List<String> getPropertyKeys_internal() {
46
        List<String> propertyKeysInternal = new ArrayList<>();
47
        return propertyKeysInternal;
48
    }
49

    
50
    @Override
51
	public String getName() {
52
		return BulkEditorInputType.NAME_RELATIONSHIP.label;
53
	}
54

    
55
	@Override
56
	public NameRelationship save(NameRelationship entity) {
57
		// TODO Auto-generated method stub
58
		return null;
59
	}
60

    
61
	@Override
62
	public boolean delete(NameRelationship entity, DeleteConfiguratorBase config) {
63
		// TODO Auto-generated method stub
64
		return false;
65
	}
66

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

    
74
	@Override
75
	protected List<NameRelationship> listEntities(
76
			IIdentifiableEntityServiceConfigurator configurator) {
77
		return CdmStore.getSearchManager().findNameRelationships(configurator);
78
	}
79

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

    
86
	@Override
87
	protected IEntityCreator<NameRelationship> createEntityCreator() {
88
		MessagingUtils.notImplementedMessage(getClass());
89
		return null;
90
	}
91

    
92
	@Override
93
	public String getTypeText(Object entity) {
94
		if(entity instanceof NameRelationship){
95
			return ((NameRelationship) entity).getType().getTitleCache();
96
		}
97

    
98
		return super.getTypeText(entity);
99
	}
100

    
101
    @Override
102
    public void merge() {
103

    
104
    }
105

    
106
}
(7-7/11)