3d2ccd4322bb76e65e743aec0731cdaf545af943
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / input / NameRelationshipEditorInput.java
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.input.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 return CdmStore.getSearchManager().findNameRelationships(configurator);
104 }
105
106 /* (non-Javadoc)
107 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
108 */
109 /** {@inheritDoc} */
110 @Override
111 protected NameRelationship loadEntity(UUID entityUuid) {
112 List<String> propertyPaths = Arrays.asList(new String[]{});
113 return null; // CdmStore.getNameService().load(entityUuid, propertyPaths);
114 }
115
116 /* (non-Javadoc)
117 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
118 */
119 @Override
120 protected IEntityCreator<NameRelationship> createEntityCreator() {
121 BulkEditorUtil.notImplementedMessage(getClass());
122 return null;
123 }
124
125 /* (non-Javadoc)
126 * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
127 */
128 @Override
129 public String getTypeText(Object entity) {
130 if(entity instanceof NameRelationship){
131 return ((NameRelationship) entity).getType().getTitleCache();
132 }
133
134 return super.getTypeText(entity);
135 }
136
137 }