Project

General

Profile

Download (4.2 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 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

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

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

    
18
import eu.etaxonomy.cdm.api.service.INameService;
19
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
20
import eu.etaxonomy.cdm.model.common.RelationshipBase;
21
import eu.etaxonomy.cdm.model.name.NameRelationship;
22
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
23
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
24
import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
25
import eu.etaxonomy.taxeditor.store.CdmStore;
26

    
27
/**
28
 * <p>NameRelationshipEditorInput class.</p>
29
 *
30
 * @author n.hoffmann
31
 * @created Oct 19, 2010
32
 * @version 1.0
33
 */
34
public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRelationship> {
35

    
36
	/**
37
	 * 
38
	 */
39
	private static final long serialVersionUID = -7453923697752787687L;
40

    
41
	/** Constant <code>ID="bulkeditor.input.nameRelationship"</code> */
42
	public static final String ID = "bulkeditor.input.nameRelationship";
43

    
44
	private static NameRelationshipEditorInput instance;
45

    
46
	/**
47
	 * <p>Getter for the field <code>instance</code>.</p>
48
	 *
49
	 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
50
	 */
51
	public static AbstractBulkEditorInput<NameRelationship> getInstance(){
52
		if(instance == null){
53
			instance = new NameRelationshipEditorInput();
54
		}
55
		return instance;
56
	}
57
	
58
	/* (non-Javadoc)
59
	 * @see org.eclipse.ui.IEditorInput#getName()
60
	 */
61
	/** {@inheritDoc} */
62
	@Override
63
	public String getName() {
64
		return BulkEditorInputType.NAME_RELATIONSHIP.label;
65
	}
66

    
67
	/* (non-Javadoc)
68
	 * @see org.eclipse.ui.IEditorInput#getToolTipText()
69
	 */
70
	/** {@inheritDoc} */
71
	@Override
72
	public String getToolTipText() {
73
		return getName();
74
	}
75

    
76
	/* (non-Javadoc)
77
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
78
	 */
79
	/** {@inheritDoc} */
80
	@Override
81
	public boolean save(NameRelationship entity) {
82
		// TODO Auto-generated method stub
83
		return false;
84
	}
85

    
86
	/* (non-Javadoc)
87
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
88
	 */
89
	/** {@inheritDoc} */
90
	@Override
91
	public boolean delete(NameRelationship entity) {
92
		// TODO Auto-generated method stub
93
		return false;
94
	}
95

    
96
	/* (non-Javadoc)
97
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
98
	 */
99
	/** {@inheritDoc} */
100
	@Override
101
	protected List<NameRelationship> listEntities(
102
			IIdentifiableEntityServiceConfigurator configurator) {
103
		List<NameRelationship> relationships = new ArrayList<NameRelationship>(); 
104
		List<RelationshipBase> all = CdmStore.getService(INameService.class).getAllRelationships(0, 0);
105
		
106
		for (RelationshipBase relationship : all){
107
			if(relationship instanceof NameRelationship){
108
				relationships.add((NameRelationship) relationship);
109
			}
110
		}
111
		
112
		
113
		return relationships;
114
	}
115

    
116
	/* (non-Javadoc)
117
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
118
	 */
119
	/** {@inheritDoc} */
120
	@Override
121
	protected NameRelationship loadEntity(UUID entityUuid) {
122
		List<String> propertyPaths = Arrays.asList(new String[]{}); 
123
		return null; // CdmStore.getNameService().load(entityUuid, propertyPaths);
124
	}
125

    
126
	/* (non-Javadoc)
127
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
128
	 */
129
	@Override
130
	protected IEntityCreator<NameRelationship> createEntityCreator() {
131
		BulkEditorUtil.notImplementedMessage(getClass());
132
		return null;
133
	}
134
	
135
	/* (non-Javadoc)
136
	 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
137
	 */
138
	@Override
139
	public String getTypeText(Object entity) {
140
		if(entity instanceof NameRelationship){
141
			return ((NameRelationship) entity).getType().getTitleCache();
142
		}
143
		
144
		return super.getTypeText(entity);
145
	}
146

    
147
}
(5-5/8)