Merge branch 'develop' into unify_derivative_views
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 27 Oct 2015 09:46:20 +0000 (10:46 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 27 Oct 2015 09:46:20 +0000 (10:46 +0100)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java

index 07890e6f1fa94fa3d1244a73b3171da46ed0ed9a..86228cbb59fe2dd1673509f7594fcffe9b93756b 100644 (file)
@@ -22,6 +22,7 @@ import org.springframework.core.io.Resource;
 import eu.etaxonomy.cdm.api.service.ITestService;
 import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
 import eu.etaxonomy.cdm.common.monitor.NullProgressMonitor;
+import eu.etaxonomy.cdm.ext.geo.IEditGeoService;
 import eu.etaxonomy.cdm.io.service.IIOService;
 import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
 import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
@@ -186,4 +187,8 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
     public ICachedCommonService getCachedCommonService(){
         return ((CdmApplicationRemoteConfiguration)configuration).getCachedCommonService();
     }
+
+    public IEditGeoService getEditGeoService() {
+        return ((CdmApplicationRemoteConfiguration)configuration).getEditGeoService();
+    }
 }
index 7ce1808ac77d4a8e4b82d6a9c678e0472c412c04..dc519d8a001fd43f1e8a4227d3b72a9a5d2453f5 100644 (file)
@@ -32,7 +32,10 @@ public class DefaultNewEntityListener implements NewEntityListener {
     public void onCreate(CdmBase cdmBase) {
         logger.info("New Entity created : " + cdmBase);
         if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){
-            ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession().addNewCdmEntity(cdmBase);
+            ICdmEntitySession activeSession = ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
+            if(activeSession != null) {
+                activeSession.addNewCdmEntity(cdmBase);
+            }
         }
     }
 
index f9051e871d833b20795f36ed3fd5557b6fba29d0..624e98dc2adbe272bb4e89830764668f25889afa 100644 (file)
@@ -975,5 +975,14 @@ public class TransientClassificationService implements IClassificationService {
         return defaultService.loadWithUpdate(arg0);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(UUID arg0,
+            List<UUID> arg1) {
+        return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(arg0, arg1);
+    }
+
 
 }
index 821fc8c5bd8377e720cf0f043061a73f9a1e1d0d..35239371ca5ab3ccaa73602f62ed12fe85a1c447 100644 (file)
@@ -143,7 +143,7 @@ public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelecti
                        }
                }
 
-               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification, excludeTaxa);
+               model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), excludeTaxa);
        }
 
        /** {@inheritDoc} */
index 138a0e760e1fd26c56f20604fa18269b58ea021a..07a3d89d9462f441264b014df546d341dc746636 100644 (file)
@@ -19,10 +19,11 @@ import java.util.Map;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Label;
 
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
 import eu.etaxonomy.cdm.common.UriUtils;
 import eu.etaxonomy.cdm.ext.geo.IEditGeoService;
 import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -71,10 +72,15 @@ public class FeatureDistributionDetailElement extends AbstractCdmDetailElement<F
                        URI serviceUri = new URI(serviceUriString);
                        if(UriUtils.isServiceAvailable(serviceUri, 500)){
                                image = formFactory.createBrowserElement(formElement, null, style);
-                               String mapUriString = getMapUriString(getEntity());
-                               image.setImageUriString(mapUriString);
+                               // FIXME : This is a temporary workaround which ic
+                               //         waiting for #5357 to be fixed
+                               if(!isUnsavedDistribution(getEntity())) {
+                                   String mapUriString = getMapUriString(getEntity());
+                                   image.setImageUriString(mapUriString);
+                                   message = mapUriString;
+                               }
                                formElement.getLayoutComposite().layout();
-                               message = mapUriString;
+
                                return;
                        } else {
                                message = String.format("The service is not available: %s", serviceUriString);
@@ -110,12 +116,13 @@ public class FeatureDistributionDetailElement extends AbstractCdmDetailElement<F
                int width = image.calculateWidth();
                 IEditGeoService editGeoService;
                List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
-               if(CdmStore.getCurrentApplicationConfiguration() instanceof CdmApplicationRemoteConfiguration) {
-                   editGeoService = ((CdmApplicationRemoteConfiguration)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
+               if(CdmStore.getCurrentSessionManager().isRemoting()) {
+                   editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
                }else{
                    editGeoService =(IEditGeoService) CdmStore.getCurrentApplicationConfiguration().getBean(
                        "editGeoService");
                }
+
                String parameter = editGeoService.getDistributionServiceRequestParameterString(
                                getTaxonDescriptions(),
                 false,
@@ -135,4 +142,13 @@ public class FeatureDistributionDetailElement extends AbstractCdmDetailElement<F
                return Arrays.asList(((TaxonDescription) getEntity().getDescription()).getTaxon().getDescriptions().toArray(new TaxonDescription[0]));
        }
 
+       private boolean isUnsavedDistribution(FeatureNodeContainer container) {
+           for(DescriptionElementBase dist : container.getDescriptionElements()) {
+               if(dist.getId() == 0) {
+                   return true;
+               }
+           }
+           return false;
+       }
+
 }