// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.bulkeditor.input;
-import java.util.Arrays;
import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.core.commands.ExecutionException;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
-import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.strategy.merge.MergeMode;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
-import eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler;
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.AgentCreator;
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
/**
- * <p>AgentEditorInput class.</p>
- *
* @author p.ciardelli
* @created 25.06.2009
* @version 1.0
*/
public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase> {
- /**
- *
- */
private static final long serialVersionUID = 3387950621617078479L;
- /** Constant <code>ID="bulkeditor.input.author"</code> */
public static final String ID = "bulkeditor.input.author";
-
+
private static AgentEditorInput instance;
- /**
- * <p>getID</p>
- *
- * @return the iD
- */
public static String getID() {
return ID;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- /**
- * <p>getName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getName() {
+
+ @Override
+ public String getName() {
return BulkEditorInputType.AGENT.label;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- /**
- * <p>getToolTipText</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getToolTipText() {
+ @Override
+ public String getToolTipText() {
return getName();
}
- /**
- * <p>Getter for the field <code>instance</code>.</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
- */
public static AbstractBulkEditorInput getInstance() {
if (instance == null) {
instance = new AgentEditorInput();
return instance;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
- */
/** {@inheritDoc} */
@Override
public boolean isMergingEnabled() {
return true;
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()
- */
+
/** {@inheritDoc} */
@Override
public boolean isConvertingEnabled() {
return true;
}
-
+
/** {@inheritDoc} */
@Override
public boolean merge(TeamOrPersonBase entity, TeamOrPersonBase mergeTarget) {
try {
IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
- CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, strategy);
+ CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, strategy);
} catch (MergeException e) {
MessagingUtils.errorDialog("Bulk Editor Merge Error",
this,
public List<TeamOrPersonBase> listEntities(IIdentifiableEntityServiceConfigurator configurator) {
return CdmStore.getSearchManager().findTeamOrPersons(configurator);
}
-
- /** {@inheritDoc}
+
+ /** {@inheritDoc}
@Override
public AgentBase loadEntity(UUID uuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return CdmStore.getService(IAgentService.class).load(uuid, propertyPaths);
}*/
-
+
public boolean delete(AgentBase entity) throws ReferencedObjectUndeletableException {
-
- return CdmStore.getService(IAgentService.class).delete(entity) != null;
-
+
+ return CdmStore.getService(IAgentService.class).delete(entity) != null;
+
}
/** {@inheritDoc} */
public boolean save(AgentBase entity) {
-
+
return CdmStore.getService(IAgentService.class).saveOrUpdate(entity) != null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getSortProviders()
- */
@Override
public List<IBulkEditorSortProvider<TeamOrPersonBase>> getSortProviders() {
List<IBulkEditorSortProvider<TeamOrPersonBase>> sortProviders = super.getSortProviders();
-
+
sortProviders.add(0, new IdentifiableEntitySortProvider<TeamOrPersonBase>());
-
+
return sortProviders;
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
- */
+
@Override
protected IEntityCreator<TeamOrPersonBase> createEntityCreator() {
return new AgentCreator();