Merge branch 'hotfix/3.12.3' root/tags/taxeditor/3.12.3 3.12.3
authorjenkins <jenkins-int@bgbm.org>
Wed, 10 Feb 2016 15:11:46 +0000 (16:11 +0100)
committerjenkins <jenkins-int@bgbm.org>
Wed, 10 Feb 2016 15:11:46 +0000 (16:11 +0100)
14 files changed:
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
pom.xml

index bfffeca..4741293 100644 (file)
@@ -1,5 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.12.3.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.12.3.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="src" path="src/main/java"/>
        <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"/>
        <classpathentry exported="true" kind="lib" path="lib/apache-log4j-extras-1.2.17.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.12.2.jar" sourcepath="/home/cmathew/.m2/repository/eu/etaxonomy/cdmlib-persistence/3.12.0-SNAPSHOT/cdmlib-persistence-3.12.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.12.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.12.2.jar"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index 25237c6..90dd13f 100644 (file)
@@ -659,12 +659,12 @@ Bundle-ClassPath: .,
  lib/poi-ooxml-schemas-3.10-FINAL.jar,
  lib/swagger-annotations-1.3.5.jar,
  lib/apache-log4j-extras-1.2.17.jar,
- lib/cdmlib-commons-3.12.2.jar,
- lib/cdmlib-ext-3.12.2.jar,
- lib/cdmlib-io-3.12.2.jar,
- lib/cdmlib-model-3.12.2.jar,
- lib/cdmlib-persistence-3.12.2.jar,
- lib/cdmlib-print-3.12.2.jar,
- lib/cdmlib-remote-3.12.2.jar,
- lib/cdmlib-services-3.12.2.jar
+ lib/cdmlib-commons-3.12.3.jar,
+ lib/cdmlib-ext-3.12.3.jar,
+ lib/cdmlib-io-3.12.3.jar,
+ lib/cdmlib-model-3.12.3.jar,
+ lib/cdmlib-persistence-3.12.3.jar,
+ lib/cdmlib-print-3.12.3.jar,
+ lib/cdmlib-remote-3.12.3.jar,
+ lib/cdmlib-services-3.12.3.jar
 Import-Package: eu.etaxonomy.cdm.api.application
index 1510adf..28ae35e 100644 (file)
@@ -185,16 +185,16 @@ bin.includes = META-INF/,\
                lib/poi-ooxml-schemas-3.10-FINAL.jar,\\r
                lib/xmlbeans-2.3.0.jar,\\r
                lib/swagger-annotations-1.3.5.jar,\\r
-               lib/cdmlib-commons-3.12.2.jar,\\r
-               lib/cdmlib-ext-3.12.2.jar,\\r
-               lib/cdmlib-io-3.12.2.jar,\\r
-               lib/cdmlib-model-3.12.2.jar,\\r
-               lib/cdmlib-persistence-3.12.2.jar,\\r
-               lib/cdmlib-print-3.12.2.jar,\\r
-               lib/cdmlib-remote-3.12.2.jar,\\r
-               lib/cdmlib-services-3.12.2.jar,\\r
                lib/apache-log4j-extras-1.2.17.jar,\\r
-               resources/cdm.map.ser\r
+               resources/cdm.map.ser,\\r
+               lib/cdmlib-commons-3.12.3.jar,\\r
+               lib/cdmlib-ext-3.12.3.jar,\\r
+               lib/cdmlib-io-3.12.3.jar,\\r
+               lib/cdmlib-model-3.12.3.jar,\\r
+               lib/cdmlib-persistence-3.12.3.jar,\\r
+               lib/cdmlib-print-3.12.3.jar,\\r
+               lib/cdmlib-remote-3.12.3.jar,\\r
+               lib/cdmlib-services-3.12.3.jar\r
 \r
 jars.compile.order = .\r
 output.. = bin/\r
index 288b20e..977e853 100644 (file)
@@ -10,6 +10,7 @@ import org.springframework.stereotype.Component;
 import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermBase;
 import eu.etaxonomy.taxeditor.remoting.cache.CacheLoader;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmEntityCacheKey;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
@@ -79,7 +80,8 @@ public class CdmServiceCacher extends CdmCacher  implements ICdmEntitySessionMan
      */
     @Override
     public boolean isCachable(CdmBase cdmEntity) {
-        if(cdmEntity != null && cdmEntity instanceof DefinedTermBase) {
+     //   if(cdmEntity != null && cdmEntity instanceof DefinedTermBase) {
+          if(cdmEntity != null && cdmEntity instanceof TermBase) {
             return true;
         }
         return false;
index ccea9a8..010e7ba 100644 (file)
@@ -382,7 +382,7 @@ public class CdmServerInfo {
            cdmServerInfoList.add(new CdmServerInfo(NAME_PRODUCTION, SERVER_PRODUCTION, 80, "", false));
            //cdmServerInfoList.add(new CdmServerInfo(NAME_INTEGRATION, SERVER_INTEGRATION, 80, CDMSERVER_PREFIX));
            cdmServerInfoList.add(new CdmServerInfo(NAME_DEMO_1, SERVER_DEMO_1, 80, CDMSERVER_PREFIX, false));
-           // cdmServerInfoList.add(new CdmServerInfo(NAME_DEMO_2, SERVER_DEMO_2, 80, CDMSERVER_PREFIX));
+           cdmServerInfoList.add(new CdmServerInfo(NAME_DEMO_2, SERVER_DEMO_2, 80, CDMSERVER_PREFIX, false));
            //cdmServerInfoList.add(new CdmServerInfo(NAME_TEST, SERVER_TEST, 80, CDMSERVER_PREFIX, false));
            cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST, SERVER_LOCALHOST, 8080, CDMSERVER_PREFIX, false));
            cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST_MGD, SERVER_LOCALHOST, NULL_PORT, CDMSERVER_PREFIX, false));
index 7cf0948..dee02e0 100644 (file)
                         <reference
                               definitionId="isMisapplication">
                         </reference>
+                        <reference
+                              definitionId="isHomotypicSynonymOfAcceptedTaxon">
+                        </reference>
                      </or>
                   </not>
                </visibleWhen>
          </with>
       </definition>
       <definition
+            id="isNotHomotypicSynonymOfAcceptedTaxon">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isHomotypicSynonymOfAcceptedTaxon">
+            </test>
+         </with>
+      </definition>
+      <definition
             id="isSynonym">
          <with
                variable="selection">
             name="%scheme.name">
       </scheme>
    </extension>
-    <extension
+    <!--extension
          point="org.eclipse.ui.importWizards">
       <wizard
             category="eu.etaxonomy.taxeditor.import.category.cdm"
             %wizard.description
          </description>
       </wizard>
-   </extension>
+   </extension-->
    <extension
           point="eu.etaxonomy.taxeditor.store.cdmViewer">
        <cdmViewer
index c6a9a0c..5d5f449 100644 (file)
@@ -89,9 +89,9 @@ public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler impleme
                TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
 
                List<UUID> excludeTaxa = new ArrayList<UUID>();
-               excludeTaxa.add(taxon.getUuid());
+               //excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon
 
-               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
+               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
 
 
                if(newParentNode != null){
index 73c2f94..270d9aa 100644 (file)
@@ -35,6 +35,8 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
        private static final String CONCEPT = "isConceptRelation";
        private static final String EMPTY_NAMES = "hasEmptyNames";
        private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms";
+       private static final String HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isHomotypicSynonymOfAcceptedTaxon";
+       
 
        /**
         * <p>Constructor for NameEditorMenuPropertyTester.</p>
@@ -76,7 +78,10 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
                        }
                        else if(ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS.equals(property)){
                                return isAcceptedAndHasNoHomotypicSynonyms(selectedElement);
+                       }else if (HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){
+                               return isHomotypicSynonymOfAcceptedTaxon(selectedElement);
                        }
+                       
                }
 
                return false;
@@ -90,6 +95,19 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
                }
                return false;
        }
+       
+       private boolean isHomotypicSynonymOfAcceptedTaxon(Object selectedElement) {
+               if (isSynonym(selectedElement)){
+                       Synonym synonym = (Synonym) selectedElement;
+                       for (Taxon taxon:synonym.getAcceptedTaxa()){
+                               if (taxon.getHomotypicGroup().equals(synonym.getHomotypicGroup())){
+                                       return false;
+                               }
+                       }
+               }
+               return true;
+       }
+
 
        /**
         * @param receiver
index bd2588b..2478bf5 100644 (file)
@@ -14,7 +14,9 @@ import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
 import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
@@ -51,26 +53,42 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<ITaxonTreeNode>{
             getConversationHolder().bind();
             ITaxonTreeNode parent = getParentTreeNode();
             Taxon taxon = taxonNodePage.getTaxon();
+            Reference sec = taxon.getSec();
+            taxon.setSec(null);
             try{
-                TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
-
-                if(CdmStore.getCurrentSessionManager().isRemoting()) {
+               UUID parentNodeUuid;
+               if(parent instanceof Classification){
+                   parentNodeUuid = ((Classification) parent).getRootNode().getUuid();
+               }
+               else{
+                   parentNodeUuid = parent.getUuid();
+               }
+                UpdateResult result = CdmStore.getService(ITaxonNodeService.class).createNewTaxonNode(parentNodeUuid, taxon, parent.getReference(), parent.getMicroReference());
+
+                //TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
+
+              /*  if(CdmStore.getCurrentSessionManager().isRemoting()) {
                     taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
                 } else {
                     taxonNode = CdmStore.getService(ITaxonNodeService.class).save(taxonNode);
+                }*/
+               generatedTaxonNodeUuid = result.getCdmEntity().getUuid();
+               TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(generatedTaxonNodeUuid);
+               taxonNode.getTaxon().setSec(sec);
+               CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+                Set<CdmBase> affectedObjects = new HashSet<CdmBase>();
+                if (result.getUpdatedObjects().iterator().hasNext()){
+                       TaxonNode parentNode = (TaxonNode)result.getUpdatedObjects().iterator().next();
+                       if(parentNode.getParent() == null) {
+                        affectedObjects.add(taxonNode.getClassification());
+                    }
+                       if(parentNode instanceof TaxonNode) {
+                        affectedObjects.add(parentNode);
+                    }
                 }
-                generatedTaxonNodeUuid = taxonNode.getUuid();
 
-                Set<CdmBase> affectedObjects = new HashSet<CdmBase>();
 
-                TaxonNode parentNode = taxonNode.getParent();
-                if(parentNode.getParent() == null) {
-                    affectedObjects.add(taxonNode.getClassification());
-                }
 
-                if(parentNode instanceof TaxonNode) {
-                    affectedObjects.add(parentNode);
-                }
 
                 if(CdmStore.getCurrentSessionManager().isRemoting()) {
                     CdmApplicationState.getCurrentDataChangeService()
index 037e7c7..0435874 100644 (file)
@@ -145,6 +145,7 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                         }
                     }
                 }
+               
             }
         }
     }
@@ -274,8 +275,8 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
        private void setTaxon(TaxonNameBase taxonName) {
                Reference secundum = null;
                if (getParentTreeNode() != null) {
-                       if (this.secReference != null){
-                               secundum = this.secReference;
+                       if (this.selection_SecRef.getEntity() != null){
+                               secundum = this.selection_SecRef.getEntity();
                        } /*else if (getParentTreeNode() instanceof Classification) {
                                secundum = ((Classification) getParentTreeNode())
                                                .getReference();
index 2a07ef5..c4e708b 100644 (file)
@@ -8,6 +8,7 @@ import java.util.Observable;
 import java.util.Observer;
 
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -23,6 +24,7 @@ import org.springframework.security.core.GrantedAuthority;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IService;
 import eu.etaxonomy.cdm.common.CdmUtils;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Group;
@@ -419,6 +421,13 @@ public class EntitySelectionElement<T extends CdmBase> extends
                /** {@inheritDoc} */
                @Override
                public void widgetSelected(SelectionEvent e) {
+
+               IService<T> service = CdmStore.getService(entity);
+               T loadedEntity = service.load(entity.getUuid());
+            if (loadedEntity==null){
+                   MessageDialog.openInformation(null,"Save changes", "You have made changes that must be saved before this query can be executed");
+                   return;
+               }
                        WizardDialog dialog = new WizardDialog(selectionElement.getShell(),
                                        new EditFromSelectionWizard(selectionElement));
                        if (dialog.open() == IStatus.OK) {
index 9262e04..854481f 100644 (file)
@@ -78,7 +78,11 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
     /** {@inheritDoc} */
     @Override
     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-        if(delaySelection==null){
+       /*to avoid widget is disposed exceptions
+        if(getViewer().getControl().isDisposed()){
+            return;
+        }*/
+       if(delaySelection==null){
             delaySelection = new DelaySelection(part, selection);
         }
         delaySelection.setPart(part);
@@ -88,6 +92,8 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
             Display.getCurrent().asyncExec(delaySelection);
         }
     }
+    
+    
 
     /** {@inheritDoc} */
     @Override
index f9cedbd..35483a8 100644 (file)
@@ -109,10 +109,8 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
         this.part = part;
 
         Object element = selection.getFirstElement();
-
-        getViewer().setInput(element);
-
-        showViewer();
+               getViewer().setInput(element);
+               showViewer();
     }
 
     /**
diff --git a/pom.xml b/pom.xml
index 09d882f..700dac5 100644 (file)
--- a/pom.xml
+++ b/pom.xml
   <properties>
     <java.codelevel>1.6</java.codelevel>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <cdmlib.version>3.12.2</cdmlib.version>
+    <cdmlib.version>3.12.3</cdmlib.version>
     <!-- TODO can we use project.version ????? -->
     <tycho.version>0.22.0</tycho.version>
-    <taxeditor.version>3.12.2</taxeditor.version>
+    <taxeditor.version>3.12.3</taxeditor.version>
     <update.dir>snapshot</update.dir>
     <unitils.version>3.4.2</unitils.version>
   </properties>