3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import eu
.etaxonomy
.cdm
.api
.service
.config
.IIdentifiableEntityServiceConfigurator
;
17 import eu
.etaxonomy
.cdm
.model
.common
.MarkerType
;
18 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
19 import eu
.etaxonomy
.taxeditor
.bulkeditor
.command
.BulkEditorInputTypeValues
.BulkEditorInputType
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
24 * <p>ReferenceEditorInput class.</p>
30 public class ReferenceEditorInput
extends AbstractBulkEditorInput
<ReferenceBase
> {
35 private static final long serialVersionUID
= 3806243517765126749L;
37 /** Constant <code>ID="bulkeditor.input.reference"</code> */
38 public static final String ID
= "bulkeditor.input.reference";
40 private static ReferenceEditorInput instance
;
43 * <p>Constructor for ReferenceEditorInput.</p>
45 public ReferenceEditorInput() {
54 public static String
getID() {
59 * @see org.eclipse.ui.IEditorInput#getName()
64 * @return a {@link java.lang.String} object.
66 public String
getName() {
67 return BulkEditorInputType
.REFERENCE
.label
;
71 * @see org.eclipse.ui.IEditorInput#getToolTipText()
74 * <p>getToolTipText</p>
76 * @return a {@link java.lang.String} object.
78 public String
getToolTipText() {
83 * <p>Getter for the field <code>instance</code>.</p>
85 * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
87 public static AbstractBulkEditorInput
getInstance() {
88 if (instance
== null) {
89 instance
= new ReferenceEditorInput();
95 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
99 public boolean isMergingEnabled() {
104 * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMarkerTypeEditingEnabled(eu.etaxonomy.cdm.model.common.MarkerType)
108 public boolean isMarkerTypeEditingEnabled(MarkerType markerType
) {
109 if (MarkerType
.PUBLISH().equals(markerType
)) {
112 return super.isMarkerTypeEditingEnabled(markerType
);
115 // Entity persistence
119 public List
listEntities(IIdentifiableEntityServiceConfigurator configurator
) {
120 return CdmStore
.findReferences(configurator
);
125 public ReferenceBase
loadEntity(UUID entityUuid
) {
126 List
<String
> propertyPaths
= Arrays
.asList(new String
[]{"*", "inReference.*", "authorTeam.*"});
127 return CdmStore
.getReferenceService().load(entityUuid
, propertyPaths
);
131 public boolean delete(Object entity
) {
132 return CdmStore
.getReferenceService().delete((ReferenceBase
) entity
) != null;
136 public boolean save(Object entity
) {
137 return CdmStore
.getReferenceService().saveOrUpdate((ReferenceBase
) entity
) != null;