eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenDistributionEditorWizardHandler.java -text
++<<<<<<< HEAD
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenInspectSessionsHandler.java -text
++=======
+ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenHandler.java -text
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowRemotingLoginWindowHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/identificationkey/AbstractIdentificaitonKeyWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java -text
<classpathentry exported="true" kind="lib" path="lib/hibernate-c3p0-4.1.10.Final.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate-cglib-repack-2.1_3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate-commons-annotations-4.0.1.Final.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-core-4.1.10.Final.jar" sourcepath="/home/cmathew/.m2/repository/org/hibernate/hibernate-core/4.1.10.Final/hibernate-core-4.1.10.Final-sources.jar"/>
++=======
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-core-4.1.10.Final.jar"/>
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry exported="true" kind="lib" path="lib/hibernate-ehcache-4.1.10.Final.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate-entitymanager-4.1.10.Final.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate-envers-4.1.10.Final.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.osgi.core-1.0.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.aop-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.aspects-3.2.2.RELEASE.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.2.2.RELEASE.jar" sourcepath="/home/cmathew/.m2/repository/org/springframework/org.springframework.beans/3.2.2.RELEASE/org.springframework.beans-3.2.2.RELEASE-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar" sourcepath="/home/cmathew/.m2/repository/org/springframework/org.springframework.context/3.2.2.RELEASE/org.springframework.context-3.2.2.RELEASE-sources.jar"/>
++=======
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.2.2.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar"/>
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry exported="true" kind="lib" path="lib/org.springframework.core-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.expression-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.jdbc-3.2.2.RELEASE.jar" sourcepath="lib/org.springframework.jdbc-3.2.2.RELEASE-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.oxm-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.test-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.springframework.transaction-3.2.2.RELEASE.jar" sourcepath="lib/org.springframework.transaction-3.2.2.RELEASE-sources.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.2.2.RELEASE.jar" sourcepath="/home/cmathew/.m2/repository/org/springframework/org.springframework.web/3.2.2.RELEASE/org.springframework.web-3.2.2.RELEASE-sources.jar"/>
++=======
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.2.2.RELEASE.jar"/>
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry exported="true" kind="lib" path="lib/org.springframework.web.servlet-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/osgi-3.6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/p6spy-1.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-expression-3.2.2.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-modules-cache-0.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-security-config-3.1.3.RELEASE.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.1.3.RELEASE.jar" sourcepath="/home/cmathew/.m2/repository/org/springframework/security/spring-security-core/3.1.3.RELEASE/spring-security-core-3.1.3.RELEASE-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar"/>
++=======
+ <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.1.3.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-easymock-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-inject-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-mock-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-orm-3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.3.jar"/>
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry exported="true" kind="lib" path="lib/usertype.jodatime-2.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/usertype.spi-2.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.5.2-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.5.2-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.5.2-SNAPSHOT.jar" sourcepath="lib/cdmlib-io-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.5.2-SNAPSHOT.jar" sourcepath="lib/cdmlib-model-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.5.2-SNAPSHOT.jar" sourcepath="lib/cdmlib-persistence-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.5.2-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.5.2-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.5.2-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.5.2-SNAPSHOT.jar" sourcepath="lib/cdmlib-services-3.5.2-SNAPSHOT-sources.jar"/>
++=======
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-SNAPSHOT.jar" sourcepath="lib/cdmlib-io-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-SNAPSHOT.jar" sourcepath="lib/cdmlib-model-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-SNAPSHOT.jar" sourcepath="lib/cdmlib-persistence-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-SNAPSHOT-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-SNAPSHOT.jar" sourcepath="lib/cdmlib-services-3.6.1-SNAPSHOT-sources.jar"/>
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry exported="true" kind="lib" path="lib/poi-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/swagger-annotations-1.3.5.jar"/>
++<<<<<<< HEAD
+ <classpathentry exported="true" kind="lib" path="lib/cdm-server-3.5.2-SNAPSHOT.jar"/>
++=======
++>>>>>>> 02176688eaa23a31ff5b71c317cb5ee685483aa4
<classpathentry kind="output" path="target/classes"/>
</classpath>
* @created 19.03.2009
* @version 1.0
*/
-public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPersistableElement {
+public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled, IPersistableElement {
- private final ConversationHolder conversation;
+ private final ConversationHolder conversation;
- private final TaxonNode taxonNode;
+ private TaxonNode taxonNode;
- private TaxonEditorInputDataChangeBehaviour dataChangeBehavior;
+ private TaxonEditorInputDataChangeBehaviour dataChangeBehavior;
- private TaxonBase initiallySelectedTaxonBase;
+ private TaxonBase initiallySelectedTaxonBase;
- private TaxonEditorInput(TaxonNode taxonNode, ConversationHolder conversation){
- this.conversation = conversation;
- this.taxonNode = taxonNode;
- }
+ private final ITaxonNodeService service;
+ private enum CdmType {
+ TAXON_NODE,
+ TAXON_BASE,
+ PARENT_TAXON_NODE
+ }
+ private TaxonEditorInput(UUID uuid, CdmType type) {
+ this.conversation = CdmStore.createConversation();
+ service = CdmStore.getService(ITaxonNodeService.class);
+ switch(type) {
+ case PARENT_TAXON_NODE:
+ initForParentTaxonNode(uuid);
+ break;
+ case TAXON_BASE:
+ initForTaxonBase(uuid);
+ break;
+ case TAXON_NODE:
+ initForTaxonNode(uuid);
+ break;
+ }
+ }
+
+ private void init(TaxonNode taxonNode) {
+ this.taxonNode = taxonNode;
+ }
- /**
- * <p>NewInstance</p>
- *
- * @param taxonNodeUuid a {@link java.util.UUID} object.
- * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
- * @throws java.lang.Exception if any.
- */
- public static TaxonEditorInput NewInstance(UUID taxonNodeUuid) throws Exception{
- try{
- ConversationHolder conversation = CdmStore.createConversation();
- return NewInstance(taxonNodeUuid, conversation);
- }catch(Exception e){
- throw e;
- }
- }
/**
+ * <p>NewInstance</p>
*
- * @param taxonNodeUuid
- * @param conversation
- * @return
+ * @param taxonNodeUuid a {@link java.util.UUID} object.
+ * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
+ * @throws java.lang.Exception if any.
*/
- private static TaxonEditorInput NewInstance(UUID taxonNodeUuid, ConversationHolder conversation){
+ private void initForTaxonNode(UUID taxonNodeUuid) {
+
+ TaxonNode taxonNode = getCdmEntitySession().remoteLoad(service,taxonNodeUuid, null);
+
+ if(taxonNode == null){
+ MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase.");
+ }
+ init(taxonNode);
- TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, null);
+
+ if(taxonNode == null){
+ MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not of type TaxonNode but [null].");
+ return null;
+ }
+ }
- return new TaxonEditorInput(taxonNode, conversation);
+ private void initForTaxonBase(UUID taxonBaseUuid) {
+
+ TaxonBase taxonBase = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonService.class),taxonBaseUuid);
+ if (taxonBase != null){
+ if(taxonBase.isInstanceOf(Taxon.class)){
+ Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+
+ if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){
+ // TODO get accepted taxon
+ MessagingUtils.info("trying to open Mispplied Name ");
+
+ Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
+ Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
+ for(TaxonRelationship relation : relations){
+ if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+ acceptedTaxa.add(relation.getToTaxon());
+ }
+ }
+ setInputForMultipleTaxa(conversation, acceptedTaxa);
+
+ }else{
+ setInputForMultipleNodes(conversation, taxon.getTaxonNodes());
+ }
+ }else if(taxonBase instanceof Synonym){
+ Synonym synonym = (Synonym) taxonBase;
+
+ Set<Taxon> taxa = synonym.getAcceptedTaxa();
+ setInputForMultipleTaxa(conversation, taxa);
+ }
+ }
}
+
/**
- * <p>NewInstanceFromTaxonBase</p>
+ * <p>NewEmptyInstance</p>
*
- * @param taxonBaseUuid a {@link java.util.UUID} object.
+ * @param parentNodeUuid a {@link java.util.UUID} object.
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
*/
- private static TaxonEditorInput getInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
- if(taxonNodes.size() == 1){
- TaxonNode taxonNode = taxonNodes.iterator().next();
- return NewInstance(taxonNode.getUuid(), conversation);
- }else if(taxonNodes.size() > 1){
- TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes);
- if(taxonNode != null){
- return NewInstance(taxonNode.getUuid(), conversation);
- }
- }else if(taxonNodes.size() == 0){
- // this is an undesired state
- MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "The accepted taxon is not part of any classification. This should not have happened.");
- }
- return null;
+ private void initForParentTaxonNode(UUID parentNodeUuid){
+
+
+ TaxonNameBase<?, ?> name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
+ ITaxonTreeNode parentNode = CdmStore.getService(IClassificationService.class).getTreeNodeByUuid(parentNodeUuid);
+
+ Taxon newTaxon = Taxon.NewInstance(name, parentNode.getReference());
+ TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference());
+
+ // add the new taxon to the editors persistence context
+ UUID newTaxonNodeUuid = getCdmEntitySession().remoteSave(CdmStore.getService(ITaxonNodeService.class),newTaxonNode);
+
+ initForTaxonNode(newTaxonNodeUuid);
+ }
+
+ public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){
+ ConversationHolder conversation = CdmStore.createConversation();
+
+ TaxonEditorInput input = null;
+
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
+ if (taxonBase != null){
+ if(taxonBase.isInstanceOf(Taxon.class)){
+ Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+
+ if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){
+ // TODO get accepted taxon
+ MessagingUtils.info("trying to open misapplied Name ");
+
+ Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
+ Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
+ for(TaxonRelationship relation : relations){
+ if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+ acceptedTaxa.add(relation.getToTaxon());
+ }
+ }
+ input = getInputForMultipleTaxa(conversation, acceptedTaxa);
+
+ }else{
+ input = getInputForMultipleNodes(conversation, taxon.getTaxonNodes());
+ }
+ }else if(taxonBase instanceof Synonym){
+ Synonym synonym = (Synonym) taxonBase;
+
+ Set<Taxon> taxa = synonym.getAcceptedTaxa();
+ input = getInputForMultipleTaxa(conversation, taxa);
+ }
+ if (input != null){
+ input.setInitiallySelectedTaxonBase(taxonBase);
+ }
+ }
+
+
+ return input;
+ }
+
+
+ private void setInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
+ if(taxonNodes.size() == 1){
+ TaxonNode taxonNode = taxonNodes.iterator().next();
+ init(taxonNode);
+ }else if(taxonNodes.size() > 1){
+ TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes);
+ if(taxonNode != null){
+ init(taxonNode);
+ }
+ }else if(taxonNodes.size() == 0){
+ // this is an undesired state
+ MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "The accepted taxon is not part of any classification. This should not have happened.");
+ }
}
- private static TaxonEditorInput getInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){
- if(taxa.size() == 1){
- Taxon taxon = taxa.iterator().next();
- Set<TaxonNode> nodes = taxon.getTaxonNodes();
- return getInputForMultipleNodes(conversation, nodes);
- }else if(taxa.size() > 1){
- Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
- for ( Taxon taxon : taxa ){
- taxonNodes.addAll(taxon.getTaxonNodes());
- }
- return getInputForMultipleNodes(conversation, taxonNodes);
- }else if(taxa.size() == 0){
- // this is an undesired state
- MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "Trying to open accepted taxon for a synonym or misapplication but" +
- " no accepted taxa are present. This should not have happened.");
- }
- return null;
+ private void setInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){
+ if(taxa.size() == 1){
+ Taxon taxon = taxa.iterator().next();
+ Set<TaxonNode> nodes = taxon.getTaxonNodes();
+ setInputForMultipleNodes(conversation, nodes);
+ }else if(taxa.size() > 1){
+ Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
+ for ( Taxon taxon : taxa ){
+ taxonNodes.addAll(taxon.getTaxonNodes());
+ }
+ setInputForMultipleNodes(conversation, taxonNodes);
+ }else if(taxa.size() == 0){
+ // this is an undesired state
+ MessagingUtils.warningDialog("Incorrect state", TaxonEditorInput.class, "Trying to open accepted taxon for a synonym or misapplication but" +
+ " no accepted taxa are present. This should not have happened.");
+ }
}
/**
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+
//parent.removeChild(node);
ICdmApplicationConfiguration controller;
-
- controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
-
+
+ controller = CdmStore.getCurrentApplicationConfiguration();
+
IPolytomousKeyNodeService service = controller.getPolytomousKeyNodeService();
+
if (node.getChildren().size()>0){
if(! MessageDialog.openQuestion(null, "Confirm deletion of children", "The selected node has children, do you want to delete them, too?")) {
service.delete(node.getUuid(), false);
public class DeleteOperation extends AbstractPersistentPostOperation {
private final PolytomousKey key;
+ private final ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
+
/**
* @param label
* @param undoContext
*/
public DeleteOperation(String label, IUndoContext undoContext,
PolytomousKey key,
- IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.key = key;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
bind();
DeleteResult result = CdmStore.getService(IPolytomousKeyService.class).delete(key);
- if (result.isError()){
- MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+
+ if (result.isError() && !result.getExceptions().isEmpty()){
+ MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
- } else if(result.isAbort()){
+ }else if(result.isAbort()){
MessageDialog.openWarning(null, "Delete abort", "The object could not be deleted, maybe there was no object selected.");
}
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+ import org.eclipse.jface.dialogs.MessageDialog;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+ import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
monitor.worked(20);
bind();
+
Taxon oldTaxon = (Taxon) HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon());
try {
- DeleteResult result = CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode((TaxonNode) taxonNode, newAcceptedTaxonNode, null, null, null);
-
++
+ UpdateResult result = CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(taxonNode.getUuid(), newAcceptedTaxonNode.getUuid(), null, null, null);
- } catch (IllegalArgumentException e) {
++
+ if (!result.getExceptions().isEmpty() && result.isOk()){
+ String separator = ", ";
+ String exceptionString = "";
+ for (Exception exception : result.getExceptions()) {
+ exceptionString += exception.getLocalizedMessage()+separator;
+ }
+
+ MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);
+ } else if (result.isAbort() || result.isError()){
+ MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), null, null, true);
+ }
+ } catch (IllegalArgumentException e) {
MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false);
return Status.CANCEL_STATUS;
}
*/
public class DeleteOperation extends AbstractPersistentPostOperation{
- private Set<ITaxonTreeNode> treeNodes;
- protected final TaxonDeletionConfigurator config;
+ private Set<ITaxonTreeNode> treeNodes;
+ protected final TaxonDeletionConfigurator config;
+ private final ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
+ /**
+ * <p>Constructor for DeleteTreeNodeOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
+ * @param treeNodes a {@link java.util.Set} object.
+ */
+ public DeleteOperation(String label, IUndoContext undoContext,
+ ITaxonTreeNode taxonNode, TaxonDeletionConfigurator config,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ this.taxonNode = (ITaxonTreeNode)CdmBase.deproxy(taxonNode, CdmBase.class);
+ this.config = config;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+ }
+
+ /**
+ * <p>Constructor for DeleteTreeNodeOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
+ * @param treeNodes a {@link java.util.Set} object.
+ */
+ public DeleteOperation(String label, IUndoContext undoContext,
+ Set<ITaxonTreeNode> treeNodes, TaxonDeletionConfigurator config,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ this.treeNodes = treeNodes;
+ this.config = config;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- bind();
- monitor.worked(20);
- ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
- ITaxonNodeService service = controller.getTaxonNodeService();
- DeleteResult result;
- /**
- * <p>Constructor for DeleteTreeNodeOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- * @param treeNodes a {@link java.util.Set} object.
- */
- public DeleteOperation(String label, IUndoContext undoContext,
- ITaxonTreeNode taxonNode, TaxonDeletionConfigurator config,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.taxonNode = (ITaxonTreeNode)CdmBase.deproxy(taxonNode, CdmBase.class);
- this.config = config;
- }
--
- if(taxonNode != null && taxonNode instanceof TaxonNode) {
- /**
- * <p>Constructor for DeleteTreeNodeOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- * @param treeNodes a {@link java.util.Set} object.
- */
- public DeleteOperation(String label, IUndoContext undoContext,
- Set<ITaxonTreeNode> treeNodes, TaxonDeletionConfigurator config,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.treeNodes = treeNodes;
- this.config = config;
- }
- element = ((TaxonNode)taxonNode).getTaxon();
- result = service.deleteTaxonNode(taxonNode.getUuid(), config);
- if (result.isError() || result.isAbort()){
- MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
- }
-
- } else if(taxonNode != null && taxonNode instanceof Classification) {
- Classification taxonomicTree = (Classification) taxonNode;
- /*if(taxonomicTree.hasChildNodes()){
- if(! MessageDialog.openConfirm(null, "Confirm Deletion", "The selected tree has children, do yu realy want to delete the whole tree with its children?")){
- return null;
- }
- }*/
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ bind();
+ monitor.worked(20);
+ ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
+ ITaxonNodeService service = controller.getTaxonNodeService();
+ if(taxonNode != null && taxonNode instanceof TaxonNode){
+ //((TaxonNode) treeNode).delete();
+
+ element = ((TaxonNode)taxonNode).getTaxon();
+
+ DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
+ if (result.isError() && !result.getExceptions().isEmpty()){
+ //TODO:Error message!
+ MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
+ } else if (!result.getExceptions().isEmpty()){
+ String separator = ", ";
+ String exceptionString = "";
+ for (Exception exception : result.getExceptions()) {
+ exceptionString += exception.getLocalizedMessage()+separator;
+ }
+ MessageDialog.openInformation(null, "Delete of the node was successful but the taxon could not be deleted.", exceptionString);
+ }
+
+
+ }else if(taxonNode != null && taxonNode instanceof Classification){
+ Classification taxonomicTree = (Classification) taxonNode;
- /*if(taxonomicTree.hasChildNodes()){
- if(! MessageDialog.openConfirm(null, "Confirm Deletion", "The selected tree has children, do yu realy want to delete the whole tree with its children?")){
- return null;
- }
- }*/
- DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
- if (result.isError() && !result.getExceptions().isEmpty()){
- //TODO:Error message!
- MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
- }
-
- /*}else{
- try{
- CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
- }catch(ReferencedObjectUndeletableException e){
- throw new ExecutionException(e.getMessage());
- }
- }*/
- } else {
-
- DeleteResult result =service.deleteTaxonNodes(treeNodes, config);
- if (result.isError() && !result.getExceptions().isEmpty()){
- //TODO:Error message!
- MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
- }
+ result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
+ if (result.isError() || result.isAbort()){
+ MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+ }
+
+ } else {
+ Set<UUID> treeNodeUuids = new HashSet<UUID>();
+ ITaxonTreeNode entity = null;
+ for(ITaxonTreeNode treeNode : treeNodes) {
+ if(entity == null) {
+ entity = treeNode;
+ }
+ treeNodeUuids.add(treeNode.getUuid());
+ }
+
- result = service.deleteTaxonNodes(treeNodeUuids, config);
- if (result.isError() || result.isAbort()){
- MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
- }
++ Delete result = service.deleteTaxonNodes(treeNodeUuids, config);
++ if (result.isError() && !result.getExceptions().isEmpty()){
++ //TODO:Error message!
++ MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
+ }
- monitor.worked(40);
- return postExecute(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
+ }
+
+ monitor.worked(40);
+
+ return postExecute(null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
}
<properties>
<java.codelevel>1.6</java.codelevel>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <cdmlib.version>3.5.2-SNAPSHOT</cdmlib.version>
+ <cdmlib.version>3.6.1-SNAPSHOT</cdmlib.version>
<!-- TODO can we use project.version ????? -->
<tycho.version>0.22.0</tycho.version>
- <taxeditor.version>3.5.2-SNAPSHOT</taxeditor.version>
+ <taxeditor.version>3.6.1-SNAPSHOT</taxeditor.version>
<update.dir>snapshot</update.dir>
+ <unitils.version>3.4.2</unitils.version>
</properties>
<modules>
<module>eu.etaxonomy.taxeditor.cdmlib</module>