eu.etaxonomy.taxeditor.cdmlib/lib/activation-1.1.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/antlr-2.7.7.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aopalliance-1.0.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/aspectjrt-1.7.1-sources.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aspectjrt-1.7.1.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/aspectjweaver-1.7.1-sources.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/aspectjweaver-1.7.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/avro-1.6.3.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/batik-anim-1.7.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/stax-1.2.0.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/stax-api-1.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/swagger-annotations-1.3.5.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-core-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-database-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbmaintainer-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbunit-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-easymock-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-inject-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-mock-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-orm-3.3.jar -text
-eu.etaxonomy.taxeditor.cdmlib/lib/unitils-spring-3.3.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-core-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-database-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbmaintainer-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-dbunit-3.4.2.jar -text
+eu.etaxonomy.taxeditor.cdmlib/lib/unitils-spring-3.4.2.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/usertype.jodatime-2.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/usertype.spi-2.0.1.jar -text
eu.etaxonomy.taxeditor.cdmlib/lib/validation-api-1.0.0.GA.jar -text
eu.etaxonomy.taxeditor.cdmlib/pom.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/RemotingMonitoredGenericApplicationContext.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/RemotingMonitoredListableBeanFactory.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/lazyloading/CdmLazyLoader.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceException.java -text
-eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmEagerLoadingException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmRemotingException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmClientCacheException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmEntityCacheKey.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelFieldPropertyFromClass.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmRemoteCacheManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/EntityCacherDebugResult.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/ProxyUtils.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/ICdmRemoteSource.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CachedCommonServiceImpl.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmAuthenticatedHttpInvokerRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceInterceptorException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/ICachedCommonService.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/TermServiceRequestExecutor.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmClientSessionException.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionEnabled.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManager.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManagerObserver.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySession.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySessionManager.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/cdmlib-ehcache.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/.svnignore -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/cdmlib-remote-webapp.war -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/jetty-runner-9.2.3.v20140905.jar -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/start-9.2.3.v20140905.jar -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/config.properties -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/httpInvokerServiceClients.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/localApplicationContext.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remoting_persistence_security.xml -text
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remoting_services_security.xml -text
-eu.etaxonomy.taxeditor.cdmlib/src/test/resources/eu/etaxonomy/cdm/datasources/cdm.datasources.xml -text
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/log4j.properties -text
eu.etaxonomy.taxeditor.editor/.classpath -text
eu.etaxonomy.taxeditor.editor/.project -text
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF -text
eu.etaxonomy.taxeditor.editor/plugin.xml -text
eu.etaxonomy.taxeditor.editor/pom.xml -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java -text
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
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/MatchStrategyConfigurator.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmStorePropertyTester.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/DefaultLanguageDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/LoginDialog.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/UriDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorComposite.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionsDialog.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java -text
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF -text
eu.etaxonomy.taxeditor.test/build.properties -text
eu.etaxonomy.taxeditor.test/ide/eclipse/EDITor[!!-~]Tests.launch -text
+eu.etaxonomy.taxeditor.test/lib/byte-buddy-0.5.1.jar -text
eu.etaxonomy.taxeditor.test/pom.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/cdmlib-ehcache.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/datasources.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/PolytomousKeyTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/remoting/session/CdmEntitySessionManagerTest.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/h2/cdmTest.h2.db -text
+eu.etaxonomy.taxeditor.test/src/main/resources/h2/cdmTest.trace.db -text
+eu.etaxonomy.taxeditor.test/src/main/resources/log4j.properties -text
eu.etaxonomy.taxeditor.test/src/main/resources/log4j.xml -text
+eu.etaxonomy.taxeditor.test/src/main/resources/unitils.properties -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmModelGetMethodCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/PolytomousKeyTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/application/menu/general/NewMenuTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmPersistentRemoteSourceTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTestManager.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/HttpInvokerServicesTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmEntityCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemoteLazyLoadingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/RemotePersistentCollectionTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/navigation/navigator/contextmenu/ClassificationTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonWizardTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/operations/OperationTestBase.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ITestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceInterceptorTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceRebasingTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/TargetTestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/TestService.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManagerTest.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/session/MockSessionOwner.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/AbstractEditorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/ContextMenuHelper.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/test/SwtBotUtils.java -text
+eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/dialogs/CdmServerInfoTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/dialogs/LoginDialogTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/selection/AbstractSelectionElementTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/ui/selection/ClassificationSelectionElementTest.java -text
src/site/resources/css/site.css -text
src/site/resources/images/taxeditor_transformed.png -text
src/site/site.xml -text
+
+# The following files will be ignored when merging another
+# branch into this branch in case of merge conflict and
+# if the 'ours' merge driver is configured.
+# WARNING : This merge driver should NOT be set in development
+# environments. It is supposed to be used only in CI
+# environments.
+# The driver can be configured by executing,
+# git config --local merge.ours.driver true
+**/pom.xml merge=ours
+**/MANIFEST.MF merge=ours
+**/feature.xml merge=ours
+eu.etaxonomy.taxeditor.cdmlib/.classpath merge=ours
+eu.etaxonomy.taxeditor.cdmlib/build.properties merge=ours
+eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product merge=ours
+eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre merge=ours
-/.project
-eu.etaxonomy.taxeditor.application/.settings
-eu.etaxonomy.taxeditor.application/target
-eu.etaxonomy.taxeditor.bulkeditor/.settings
-eu.etaxonomy.taxeditor.bulkeditor/target
-eu.etaxonomy.taxeditor.cdmlib/.directory
-eu.etaxonomy.taxeditor.cdmlib/.settings
+.project
+integration-test.log
+eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/*
+.settings
+target
+.directory
eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.jar
eu.etaxonomy.taxeditor.cdmlib/cdmlib-*.zip
eu.etaxonomy.taxeditor.cdmlib/dist
+eu.etaxonomy.taxeditor.cdmlib/lib/cdm-server*
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib*
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.servletbridge.extensionbundle-1.2.0.v20100503.jar
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.transforms.hook-1.0.300.v20100719.jar
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.weaving.hook-1.0.100.v20110502.jar
eu.etaxonomy.taxeditor.cdmlib/log4j-1.2.14src.zip
-eu.etaxonomy.taxeditor.cdmlib/target
-eu.etaxonomy.taxeditor.editor/.settings
-eu.etaxonomy.taxeditor.editor/target
-eu.etaxonomy.taxeditor.feature.platform/.settings
eu.etaxonomy.taxeditor.feature.platform/bin
-eu.etaxonomy.taxeditor.feature.platform/target
-eu.etaxonomy.taxeditor.feature/.settings
eu.etaxonomy.taxeditor.feature/compile.eu.etaxonomy.taxeditor.product.feature.xml
eu.etaxonomy.taxeditor.feature/plugin_customization.ini
-eu.etaxonomy.taxeditor.feature/target
-eu.etaxonomy.taxeditor.feature/workspace
-eu.etaxonomy.taxeditor.help/.settings
eu.etaxonomy.taxeditor.help/original_document/~$xonomic_Editor_User_Manual_Version_4.doc
-eu.etaxonomy.taxeditor.help/target
-eu.etaxonomy.taxeditor.navigation/.settings
-eu.etaxonomy.taxeditor.navigation/target
-eu.etaxonomy.taxeditor.printpublisher/.settings
-eu.etaxonomy.taxeditor.printpublisher/target
-eu.etaxonomy.taxeditor.store/.settings
-eu.etaxonomy.taxeditor.store/hibernate.log
-eu.etaxonomy.taxeditor.store/target
+hibernate.log
eu.etaxonomy.taxeditor.test/screenshots/*.jpeg
-eu.etaxonomy.taxeditor.test/target
-eu.etaxonomy.taxeditor/.settings
-eu.etaxonomy.taxeditor/target
+eu.etaxonomy.taxeditor.test/src/test/resources/.cdm-server-ehcache
+eu.etaxonomy.taxeditor.test/src/test/resources/.cdmLibrary/cdm_remote_servers.json
+eu.etaxonomy.taxeditor.test/src/test/resources/.cdmLibrary/remote-webapp
+eu.etaxonomy.taxeditor.test/src/test/resources/.cdmLibrary/writableResources/test.mgd.datasources.xml
+eu.etaxonomy.taxeditor.webapp/lib/cdmlib-remote-webapp.war
/runtime-taxeditor.product
-/target
/workspace
+/*.patch
+/eu.etaxonomy.taxeditor.webapp/.settings/org.eclipse.core.resources.prefs
+/eu.etaxonomy.taxeditor.webapp/.settings/org.eclipse.m2e.core.prefs
+
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/plugin
Export-Package: eu.etaxonomy.taxeditor
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.apache.log4j,
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Import-Package: eu.etaxonomy.cdm.database,
+ org.apache.log4j,
org.eclipse.equinox.app,
org.eclipse.equinox.p2.repository.metadata,
org.osgi.framework,
- org.osgi.service.packageadmin
+ org.osgi.service.packageadmin,
+ org.springframework.remoting
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
eu.etaxonomy.taxeditor.store,
eu.etaxonomy.taxeditor.bulkeditor,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.printpublisher,
- eu.etaxonomy.taxeditor.molecular,
+ eu.etaxonomy.taxeditor.molecular;resolution:=optional,
eu.etaxonomy.taxeditor.help,
org.eclipse.equinox.ds,
org.eclipse.equinox.util,
source.. = src/main/java/,\
- src/test/java/,\
- src/main/resources/
+ src/test/java/
bin.includes = META-INF/,\
.,\
plugin.xml,\
id="eu.etaxonomy.taxeditor.application.perspective.taxonomic"
name="%perspective.name">
</perspective>
- <!--perspective
- class="eu.etaxonomy.taxeditor.perspective.BulkEditing"
- id="eu.etaxonomy.taxeditor.application.perspective.bulkeditor"
- name="Bulk Editing">
- </perspective-->
<perspective
class="eu.etaxonomy.taxeditor.perspective.PolytomousKey"
id="eu.etaxonomy.taxeditor.application.perspective.polytomous"
restorable="true">
</view>
</extension-->
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="eu.etaxonomy.taxeditor.application.perspective.bulkeditor">
- <showInPart
- id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
- </showInPart>
- <showInPart
- id="eu.etaxonomy.taxeditor.bulkeditor.referencingobjectsview">
- </showInPart>
- </perspectiveExtension>
- <perspectiveExtension
- targetID="eu.etaxonomy.taxeditor.application.perspective.polytomous">
- <showInPart
- id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
- </showInPart>
- </perspectiveExtension>
- <perspectiveExtension
- targetID="eu.etaxonomy.taxeditor.application.perspective.uses">
- <showInPart
- id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
- </showInPart>
- </perspectiveExtension>
- </extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
commandId="org.eclipse.ui.file.import"
label="%command.label.3"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.file.export"
label="%command.label.4"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.taxeditor.application.filemenu.io"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
import org.eclipse.ui.statushandlers.AbstractStatusHandler;
import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.springframework.remoting.RemoteAccessException;
+import org.springframework.remoting.RemoteConnectFailureException;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
private CdmStatusHandler cdmStatusHandler;
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
*/
class CdmStatusHandler extends AbstractStatusHandler {
+ private Throwable previousT;
/* (non-Javadoc)
* @see org.eclipse.ui.statushandlers.AbstractStatusHandler#handle(org.eclipse.ui.statushandlers.StatusAdapter, int)
*/
@Override
public void handle(StatusAdapter statusAdapter, int style)
{
+
if(statusAdapter.getStatus().matches(IStatus.ERROR)) {
IStatus status = statusAdapter.getStatus();
Throwable t = statusAdapter.getStatus().getException();
+ // NOTE : the global status handling mechanism in the case of
+ // runtime exceptions is called twice, once by the application
+ // throwing the exception and then by the rcp logging mechanism
+ // The check below is to make sure that the same exception is
+ // not shown twice in succession.
+ if(t != null && previousT == t) {
+ return;
+ }
+ previousT = t;
+
+
+
// NOTE : Currently we only allow RuntimeExceptions since
// allowing all kinds of exceptions would also include
// those in generated status objects coming from from logging triggers
// leading to a recursive infinite loop of :
// initial exception thrown -> status handling -> dialog opening + logging of status ->
// status handling -> dialog opening + logging of status ... and so on
- if(t != null && t instanceof RuntimeException && ! "Widget is disposed".equals(t.getMessage())){
- MessagingUtils.errorDialog("Unexpected error",
- null,
- MessagingUtils.UNEXPECTED_ERROR_MESSAGE,
- statusAdapter.getStatus().getPlugin(),
- t,
- true);
- }
+ if(t != null &&
+ t instanceof RuntimeException &&
+ ! "Widget is disposed".equals(t.getMessage()) &&
+ ! handleKnownRuntimeException(t,statusAdapter.getStatus().getPlugin())) {
+
+ MessagingUtils.errorDialog("Unexpected error",
+ null,
+ MessagingUtils.UNEXPECTED_ERROR_MESSAGE,
+ statusAdapter.getStatus().getPlugin(),
+ t,
+ true);
+
+ } else if (t != null && ("Widget is disposed".equals(t.getMessage()))){
+ MessagingUtils.warn(this.getClass(), t);
+ if (PreferencesUtil.isShowUpWidgetIsDisposedMessages()){
+ MessagingUtils.errorDialog("Widget is disposed",
+ null,
+ MessagingUtils.WIDGET_IS_DISPOSED_MESSAGE,
+ statusAdapter.getStatus().getPlugin(),
+ t,
+ true);
+
+ }
+ }
+ }
+ }
+
+ private boolean handleKnownRuntimeException(Throwable t, String pluginId) {
+ if(t instanceof RemoteConnectFailureException ||
+ t.getCause() instanceof RemoteConnectFailureException) {
+ MessagingUtils.errorDialog("Connection Failure",
+ null,
+ MessagingUtils.CONNECTION_FAILURE_MESSAGE + System.getProperty("line.separator"),
+ pluginId,
+ t,
+ true,
+ false);
+ return true;
+ }
+ if(t instanceof RemoteAccessException ||
+ t.getCause() instanceof RemoteAccessException) {
+ MessagingUtils.errorDialog("Remote Access Error",
+ null,
+ MessagingUtils.REMOTE_ACCESS_FAILURE_MESSAGE + System.getProperty("line.separator"),
+ pluginId,
+ t,
+ true,
+ false);
+ return true;
}
+ return false;
}
}
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
import eu.etaxonomy.taxeditor.update.P2Util;
+import eu.etaxonomy.taxeditor.util.ApplicationUtil;
/**
* <p>ApplicationWorkbenchWindowAdvisor class.</p>
configurer.setShowCoolBar(true);
configurer.setShowStatusLine(true);
configurer.setShowPerspectiveBar(true);
- configurer.setTitle("EDIT Taxonomic Editor " + ApplicationUtil.getVersion());
+ configurer.setTitle(ApplicationUtil.getTitle());
configurer.setShowProgressIndicator(true);
CdmDataSourceRepository.createDefaultH2DataSource();
import org.eclipse.ui.IPlaceholderFolderLayout;
import org.eclipse.ui.progress.IProgressConstants;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
public static final String ADDITIONAL = "additional";
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
- */
@Override
public void createInitialLayout(IPageLayout layout) {
layout.addView(TaxonNavigator.ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
- layout.addView(DerivateSearchView.ID, IPageLayout.TOP, 0.5f, layout.getEditorArea());
+ layout.addView(DerivateView.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea());
layout.addView(DescriptiveViewPart.ID, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.core.ProvisionException;
-import org.eclipse.equinox.p2.operations.ProvisioningJob;
-import org.eclipse.equinox.p2.operations.ProvisioningSession;
-import org.eclipse.equinox.p2.operations.RepositoryTracker;
-import org.eclipse.equinox.p2.operations.Update;
-import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.equinox.p2.ui.ProvisioningUI;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import eu.etaxonomy.taxeditor.ApplicationUtil;
import eu.etaxonomy.taxeditor.TaxonomicEditorPlugin;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.util.ApplicationUtil;
/**
* This class is a utility class for updating the editor from a p2 update site,
}
PreferencesUtil.setP2Repositories(repoElements);
}
-
- /**
- *
- *
- */
- public static void checkForUpdates() {
- // the main job which performs the update
- Job updateJob = new Job("Update Job") {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- return doCheckForUpdates(monitor);
- }
- };
- updateJob.schedule();
- }
-
- /**
- * @param monitor
- * @return
- */
- private static IStatus doCheckForUpdates(IProgressMonitor monitor) {
-
- BundleContext bundleContext = TaxonomicEditorPlugin.getContext();
- ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
- if (reference == null) {
- IStatus errorStatus = new Status(IStatus.ERROR, TaxonomicEditorPlugin.PLUGIN_ID,
- "No provisioning agent found. This application is not set up for updates.");
- return errorStatus;
- }
-
- final IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(reference);
- IStatus updateStatus;
- try {
- updateStatus = P2Util.checkForUpdates(agent, monitor);
- MessagingUtils.info(updateStatus);
- } finally {
- bundleContext.ungetService(reference);
- }
- return updateStatus;
- }
-
- /**
- * @param agent
- * @param monitor
- * @return
- * @throws OperationCanceledException
- */
- static IStatus checkForUpdates(IProvisioningAgent agent, final IProgressMonitor monitor) {
- ProvisioningSession session = new ProvisioningSession(agent);
- // the default update operation looks for updates to the currently
- // running profile, using the default profile root marker. To change
- // which installable units are being updated, use the more detailed
- // constructors.
- final UpdateOperation operation = new UpdateOperation(session);
-// try {
-// setUpdateRepositories(operation);
-// } catch (URISyntaxException e) {
-// MessagingUtils.errorDialog("Invalid update site URI",
-// operation,
-// "The update site URI has an invalid syntax",
-// TaxonomicEditorPlugin.PLUGIN_ID,
-// e,
-// false);
-// return null;
-// }
-
- final IStatus status = operation.resolveModal(monitor);
-
- if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
- return status;
- }
-
- if (status.isOK() && status.getSeverity() != IStatus.ERROR) {
- // We need this block of code to be in async execution
- // since the confirm dialogs work only on the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- String updates = "";
- Update[] possibleUpdates = operation
- .getPossibleUpdates();
- for (Update update : possibleUpdates) {
- updates += update + "\n";
- }
-
- boolean doInstall = MessagingUtils.confirmDialog("Updates available", "Do you want to install the available updates ?");
- // We may need to think whether we still run in async mode once
- // the user agrees to update. Maybe be reasonable to change to blocking
- // from this point until the update is complete.
-
- // More complex status handling might include showing the user what
- // updates are available if there are multiples, differentiating
- // patches vs. updates, etc. In this example, we simply update as
- // suggested by the operation.
- if(doInstall) {
- ProvisioningJob provisioningJob = operation.getProvisioningJob(monitor);
- if (provisioningJob == null) {
- MessagingUtils.messageDialog("Error in performing update",
- operation,
- "ProvisioningJob could not be created." + System.getProperty("line.separator") +
- "Either this application does not support p2 software installation or this application has been launched from within the Eclipse IDE",
- null,
- false);
-
- } else {
- // register a job change listener to track
- // installation progress and notify user upon success
- provisioningJob
- .addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- // We need this block of code to be in async execution
- // since the confirm dialogs work only on the UI thread
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- boolean restart = MessagingUtils.confirmDialog(
- "Updates installed, restart?",
- "Updates have been installed successfully, do you want to restart?");
- if (restart) {
- PlatformUI.getWorkbench().restart();
- }
- }
- });
- }
- super.done(event);
- }
- });
- provisioningJob.schedule();
- }
- }
- }
- });
- }
- return status;
- }
}
*/
public class UpdateHandler extends PreloadingRepositoryHandler {
- boolean hasNoRepos = false;
+ boolean hasNoRepos = false;
- @Override
+ @Override
protected void doExecute(LoadMetadataRepositoryJob job) {
- if (hasNoRepos) {
- return;
- }
- UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
+ if (hasNoRepos) {
+ return;
+ }
+ UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
- // check for updates
- operation.resolveModal(null);
- if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
- if (UpdateSingleIUWizard.validFor(operation)) {
- // Special case for only updating a single root
- UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.open();
- } else {
- // Open the normal version of the update wizard
- getProvisioningUI().openUpdateWizard(false, operation, job);
- }
- }
- }
+ // check for updates
+ operation.resolveModal(null);
+ if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
+ if (UpdateSingleIUWizard.validFor(operation)) {
+ // Special case for only updating a single root
+ UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ } else {
+ // Open the normal version of the update wizard
+ getProvisioningUI().openUpdateWizard(false, operation, job);
+ }
+ }
+ }
- @Override
+ @Override
protected boolean preloadRepositories() {
- hasNoRepos = false;
- RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
- if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
- hasNoRepos = true;
- return false;
- }
- return super.preloadRepositories();
- }
+ hasNoRepos = false;
+ RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker();
+ if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) {
+ hasNoRepos = true;
+ return false;
+ }
+ return super.preloadRepositories();
+ }
}
+++ /dev/null
-### ************ APPENDER ***********************************###\r
-\r
-### direct log messages to stdout ###\r
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
-log4j.appender.stdout.Target=System.out\r
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n\r
-\r
-### direct messages to file hibernate.log ###\r
-log4j.appender.file=org.apache.log4j.FileAppender\r
-log4j.appender.file.File=taxeditor.log\r
-log4j.appender.file.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n\r
-\r
-### ************* LOG LEVELS *********************************###\r
-\r
-### set log levels - for more verbose logging change 'info' to 'debug' ###\r
-### levels: error, warn, debug, info\r
-log4j.rootLogger=INFO, stdout\r
-\r
-### set directory-specific levels below\r
-\r
-### basic level for editor directory\r
-log4j.logger.eu.etaxonomy.taxeditor.editor = WARN, stdout \r
-\r
-log4j.logger.eu.etaxonomy.taxeditor.editor.handler = DEBUG, stdout\r
-\r
-### log level for conversation handler\r
-#log4j.logger.eu.etaxonomy.cdm.api.application = DEBUG, stdout\r
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/main/java"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/java"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Bulkeditor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
org.eclipse.core.expressions,
eu.etaxonomy.taxeditor.store,
eu.etaxonomy.taxeditor.cdmlib
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
-Import-Package: org.eclipse.core.runtime,
+Import-Package: eu.etaxonomy.taxeditor.editor,
+ org.eclipse.core.runtime,
org.eclipse.equinox.app,
org.eclipse.jface.text,
org.eclipse.jface.text.presentation,
org.eclipse.jface.text.source,
org.eclipse.ui.views.properties,
org.osgi.framework
-Bundle-ClassPath: .,
- activation-1.1.jar,
- antlr-2.7.6.jar,
- aopalliance-1.0.jar,
- asm-attrs.jar,
- asm.jar,
- aspectjrt-1.6.3.jar,
- aspectjweaver-1.6.3.jar,
- avalon-framework-4.2.0.jar,
- batik-all-1.7.jar,
- c3p0-0.9.1.jar,
- cdmlib-commons-3.0.7-SNAPSHOT.jar,
- cdmlib-ext-3.0.7-SNAPSHOT.jar,
- cdmlib-io-3.0.7-SNAPSHOT.jar,
- cdmlib-model-3.0.7-SNAPSHOT.jar,
- cdmlib-persistence-3.0.7-SNAPSHOT.jar,
- cdmlib-print-3.0.7-SNAPSHOT.jar,
- cdmlib-remote-3.0.7-SNAPSHOT.jar,
- cglib-2.1.3.jar,
- commons-beanutils-1.7.0.jar,
- commons-collections-3.2.jar,
- commons-dbcp-1.2.2.jar,
- commons-io-1.3.1.jar,
- commons-logging-1.0.4.jar,
- commons-pool-1.3.jar,
- dom4j-1.6.1.jar,
- dozer-5.3.0-sources.jar,
- dozer-5.3.0.jar,
- ehcache-1.2.3.jar,
- ejb3-persistence.jar,
- ezmorph-1.0.4.jar,
- fop.jar,
- google-api-translate-java-0.92.jar,
- hibernate-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-commons-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-core-3.4.0-SNAPSHOT.jar,
- hibernate-envers-3.4.0-SNAPSHOT.jar,
- hibernate-search-3.1.0.GA.jar,
- hibernate-tools-3.2.0.ga.jar,
- hibernate-validator-4.0.0.CR1.jar,
- hsqldb.jar,
- httpclient-4.0.1.jar,
- httpcore-4.0.1.jar,
- javassist.jar,
- jaxb-api-2.1.6.jar,
- jaxb-impl-2.1.6.jar,
- jaxen-1.1.2.jar,
- jdbc-1.2.jar,
- jdbc2_0-stdext.jar,
- jdom.jar,
- joda-time-1.5.jar,
- joda-time-hibernate-1.0.jar,
- json-lib-2.2.3-jdk15.jar,
- jsr250-api-1.0.jar,
- jta.jar,
- jtds-1.2.2.jar,
- junit-4.4.jar,
- junit-4.8.1-sources.jar,
- junit-4.8.1.jar,
- log4j-1.2.14.jar,
- lsid-client-1.1.2.jar,
- lsid-server-1.1.2.jar,
- lucene-core-2.4.0.jar,
- lucene-spellchecker-2.4.0.jar,
- mail-1.4.jar,
- msbase-2000.3.jar,
- mssqlserver-2000.3.jar,
- msutil-2000.3.jar,
- mysql-connector-java-5.0.5.jar,
- odfdom-0.8.jar,
- opencsv-1.8.jar,
- org.springframework.aop-3.0.4.RELEASE-sources.jar,
- org.springframework.asm-3.0.4.RELEASE-sources.jar,
- org.springframework.aspects-3.0.4.RELEASE-sources.jar,
- org.springframework.beans-3.0.4.RELEASE-sources.jar,
- org.springframework.context-3.0.4.RELEASE-sources.jar,
- org.springframework.context.support-3.0.4.RELEASE-sources.jar,
- org.springframework.core-3.0.4.RELEASE-sources.jar,
- org.springframework.expression-3.0.4.RELEASE-sources.jar,
- org.springframework.jdbc-3.0.4.RELEASE-sources.jar,
- org.springframework.orm-3.0.4.RELEASE-sources.jar,
- org.springframework.oxm-3.0.4.RELEASE-sources.jar,
- org.springframework.transaction-3.0.4.RELEASE-sources.jar,
- org.springframework.web-3.0.4.RELEASE-sources.jar,
- org.springframework.web.servlet-3.0.4.RELEASE-sources.jar,
- poi-3.1-FINAL.jar,
- postgresql-8.2-504.jdbc4.jar,
- saxon9he.jar,
- serializer-2.7.0.jar,
- servlet-api-2.5.jar,
- spring-modules-cache-0.7.jar,
- spring-modules-lucene-0.8a.jar,
- wsdl4j-1.6.1.jar,
- xalan-2.7.0.jar,
- xercesImpl-2.7.1.jar,
- xercesImpl.jar,
- xml-apis-1.3.04.jar,
- xml-apis-ext-1.3.04.jar,
- xml-apis.jar,
- xml-resolver-1.2.jar,
- xmlgraphics-commons-1.3.1.jar,
- xom-1.0.jar,
- xsltc.jar,
- xstream-1.3.1.jar,
- yjp-controller-api-redist-8.0.1.jar,
- ant-antlr.jar,
- ant-apache-bcel.jar,
- ant-apache-bsf.jar,
- ant-apache-log4j.jar,
- ant-apache-oro.jar,
- ant-apache-regexp.jar,
- ant-apache-resolver.jar,
- ant-commons-logging.jar,
- ant-commons-net.jar,
- ant-jai.jar,
- ant-javamail.jar,
- ant-jdepend.jar,
- ant-jmf.jar,
- ant-jsch.jar,
- ant-junit.jar,
- ant-launcher.jar,
- ant-netrexx.jar,
- ant-nodeps.jar,
- ant-starteam.jar,
- ant-stylebook.jar,
- ant-swing.jar,
- ant-trax.jar,
- ant-weblogic.jar,
- ant.jar,
- runtime_registry_compatibility.jar,
- jdi.jar,
- jdimodel.jar,
- pdebuild.jar,
- compatibility.jar,
- junit.jar
command.label.3 = De-Duplicate Group
command.label.4 = Delete
command.label.5 = Convert to Person
+command.label.6 = Convert to Team
command.name = Merge Group
command.name.0 = Set as Target for Group Merge
command.name.1 = Dynamic Open Bulk Editor
-commandParameter.name = Bulk Editor Class
command.name.2 = Dynamic New Object
command.name.3 = Dynamic Delete Object
command.name.4 = Set as Candidate for Group Merge
command.name.9 = convert to Team
specification.label = Merge Candidate Annotation
specification.label.0 = Merge Target Annotation
-command.label.6 = Convert to Team
-command.name.10 = convert Person to Team
\ No newline at end of file
+command.name.10 = convert Person to Team
+command.label.OPEN_REFERENCING_OBJECTS_VIEW = Referencing Objects View
+command.name.OPEN_REFERENCING_OBJECTS_VIEW = Open Referencing Objects View
\ No newline at end of file
command.label.3 = Dedupliziere Gruppe
command.label.4 = L\u00f6schen
command.label.5 = Umwandeln in Person
-command.label.6 = Umwandeln in Team
\ No newline at end of file
+command.label.6 = Umwandeln in Team
+command.name = Gruppen zusammenfügen
+command.name.0 = Setze als Ziel für Gruppenzusammenfügung
+command.name.1 = Dynamisches Öffnen Bulk Editor
+command.name.2 = Dynamisches Neues Objekt
+command.name.3 = Dynamisches Objekt Löschen
+command.name.4 = Setze als Kandidat für Gruppenzusammenfügung
+command.name.5 = Entferne Kandidat für Gruppenzusammenfügung
+command.name.6 = Setze Marker Flag
+command.name.7 = Löschen
+command.name.8 = In Person umwandeln
+command.name.9 = In Team umwandeln
+specification.label = Kandidat-Annotation zusammenfügen
+specification.label.0 = Ziel-Annotation zusammenfügen
+command.name.10 = Person in Team umwandeln
+command.label.OPEN_REFERENCING_OBJECTS_VIEW = Referenzierende Objekte
+command.name.OPEN_REFERENCING_OBJECTS_VIEW = Öffne Referenzierende Objekte
\ No newline at end of file
BulkEditorInputType_5=Users\r
BulkEditorInputType_6=Groups\r
BulkEditorInputType_7=Taxa\r
+BulkEditorInputType_8=Media\r
BulkEditorInputType_5=Nutzer\r
BulkEditorInputType_6=Nutzergruppen\r
BulkEditorInputType_7=Taxa\r
+BulkEditorInputType_8=Medien
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.4"?>\r
-<plugin>\r
-\r
- <extension\r
- id="application"\r
- point="org.eclipse.core.runtime.applications">\r
- <application>\r
- <run\r
- class="eu.etaxonomy.taxeditor.bulkeditor.Application">\r
- </run>\r
- </application>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.editors">\r
- <editor\r
- class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"\r
- default="false"\r
- id="bulkeditor.editor"\r
- name="%editor.name">\r
- </editor>\r
- <editor\r
- class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"\r
- default="false"\r
- id="nameeditor.editor"\r
- name="%editor.name.0">\r
- </editor>\r
- <editor\r
- class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
- default="false"\r
- id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
- name="%editor.name.1">\r
- </editor>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.menus">\r
- <menuContribution\r
- locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">\r
- <menu\r
- id="bulkeditor.menus.openmenu"\r
- label="%menu.label">\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </menu>\r
- <menu\r
- label="%menu.label.0">\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </menu>\r
- </menuContribution>\r
- <menuContribution\r
- locationURI="menu:bulkeditor.menus.openmenu">\r
- <dynamic\r
- class="eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem"\r
- id="taxeditor-bulkeditor.dynamicopenmenu">\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </dynamic>\r
- <!--command\r
- commandId="taxeditor-nameeditor.commands.open"\r
- label="Open Name Editor"\r
- style="push">\r
- <visibleWhen\r
- checkEnabled="false">\r
- <reference\r
- definitionId="pigsFly">\r
- </reference>\r
- </visibleWhen>\r
- </command-->\r
- </menuContribution>\r
- <menuContribution\r
- locationURI="popup:#BulkEditorContext">\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"\r
- label="%command.label"\r
- style="push">\r
- <visibleWhen>\r
- <reference\r
- definitionId="isTaxonBulkEditorInput">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- <separator\r
- name="taxeditor-bulkeditor.separator1"\r
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ id="application"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run
+ class="eu.etaxonomy.taxeditor.bulkeditor.Application">
+ </run>
+ </application>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"
+ default="false"
+ id="bulkeditor.editor"
+ name="%editor.name">
+ </editor>
+ <editor
+ class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"
+ default="false"
+ id="nameeditor.editor"
+ name="%editor.name.0">
+ </editor>
+ <editor
+ class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
+ default="false"
+ id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
+ name="%editor.name.1">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">
+ <menu
+ id="bulkeditor.menus.openmenu"
+ label="%menu.label">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </menu>
+ <menu
+ label="%menu.label.0">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ locationURI="menu:bulkeditor.menus.openmenu">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem"
+ id="taxeditor-bulkeditor.dynamicopenmenu">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </dynamic>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:#BulkEditorContext">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.bulkeditor.cdmViewerContextMenu">
+ </dynamic>
+ <separator
+ name="taxeditor-bulkeditor.separator1"
+ visible="true">
+ </separator>
+ <menu
+ label="%menu.label.1">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"
+ id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">
+ <visibleWhen
+ checkEnabled="false">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </dynamic>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </menu>
+ <separator
+ name="taxeditor-bulkeditor.separator4"\r
visible="true">\r
- </separator>\r
- <menu\r
- label="%menu.label.1">\r
- <dynamic\r
- class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">\r
- <visibleWhen\r
- checkEnabled="false">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </dynamic>\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </menu>\r
- <separator\r
- name="eu.etaxonomy.taxeditor.bulkeditor.separator1">\r
- </separator>\r
- <command\r
- commandId="bulkeditor.commands.setmergetarget"\r
- label="%command.label.0"\r
- style="push">\r
- <visibleWhen>\r
- <reference\r
- definitionId="isMergeEnabled">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- \r
- <command\r
- commandId="bulkeditor.commands.setmergecandidate"\r
- label="%command.label.1"\r
- style="push">\r
- <visibleWhen>\r
- <reference\r
- definitionId="isMergeEnabled">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- <command\r
- commandId="bulkeditor.commands.removemergecandidate"\r
- label="%command.label.2"\r
- style="push">\r
- <visibleWhen>\r
- <reference\r
- definitionId="isMergeEnabled">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- <!--menuContribution\r
- locationURI="popup:org.eclipse.ui.popup.any"--> \r
- <command\r
- commandId="bulkeditor.commands.mergegroup"\r
- label="%command.label.3"\r
- style="push">\r
- <visibleWhen>\r
- <reference\r
- definitionId="isMergeEnabled">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"\r
- label="%command.label.5"\r
- style="push">\r
- <visibleWhen\r
- checkEnabled="true">\r
- <and>\r
- <reference\r
- definitionId="isConvertEnabled">\r
- </reference>\r
- <reference \r
- definitionId="isTeam">\r
- </reference>\r
- </and>\r
- </visibleWhen>\r
- </command>\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"\r
- label="%command.label.6"\r
- style="push">\r
- <visibleWhen \r
- checkEnabled="true">>\r
- <and>\r
- <reference\r
- definitionId="isConvertEnabled">\r
- </reference>\r
- <reference \r
- definitionId="isPerson">\r
- </reference>\r
- </and>\r
- </visibleWhen>\r
- </command>\r
- <separator\r
- name="taxeditor-bulkeditor.separator2"\r
- visible="true">\r
- </separator>\r
- <menu\r
- label="%menu.label.2">\r
- <dynamic\r
- class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">\r
- </dynamic>\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </menu>\r
+ </separator>
+ <command
+ commandId="bulkeditor.commands.setmergetarget"
+ label="%command.label.0"
+ style="push">
+ <visibleWhen>
+ <reference
+ definitionId="isMergeEnabled">
+ </reference>
+ </visibleWhen>
+ </command>
+
+ <command
+ commandId="bulkeditor.commands.setmergecandidate"
+ label="%command.label.1"
+ style="push">
+ <visibleWhen>
+ <reference
+ definitionId="isMergeEnabled">
+ </reference>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="bulkeditor.commands.removemergecandidate"
+ label="%command.label.2"
+ style="push">
+ <visibleWhen>
+ <reference
+ definitionId="isMergeEnabled">
+ </reference>
+ </visibleWhen>
+ </command>
+ <!--menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any"-->
+ <command
+ commandId="bulkeditor.commands.mergegroup"
+ label="%command.label.3"
+ style="push">
+ <visibleWhen>
+ <reference
+ definitionId="isMergeEnabled">
+ </reference>
+ </visibleWhen>
+ </command>
<separator\r
- name="taxeditor-bulkeditor.separator3"\r
+ name="eu.etaxonomy.taxeditor.bulkeditor.separator1"\r
visible="true">\r
</separator>\r
- <command\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
- label="%command.label.4"\r
- style="push">\r
- <visibleWhen\r
- checkEnabled="true">\r
- <reference\r
- definitionId="isCdmStoreConnected">\r
- </reference>\r
- </visibleWhen>\r
- </command>\r
- </menuContribution>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.commands">\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler"\r
- id="bulkeditor.commands.mergegroup"\r
- name="%command.name">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeTargetHandler"\r
- id="bulkeditor.commands.setmergetarget"\r
- name="%command.name.0">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.OpenBulkEditorHandler"\r
- id="taxeditor-bulkeditor.dynamicopenmenu"\r
- name="%command.name.1">\r
- <commandParameter\r
- id="taxeditor-bulkeditor.commandParameter.inputType"\r
- name="%commandParameter.name"\r
- values="eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues">\r
- </commandParameter>\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.NewObjectHandler"\r
- id="taxeditor-bulkeditor.dynamicnewobjectcommand"\r
- name="%command.name.2">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.DeleteObjectHandler"\r
- id="taxeditor-bulkeditor.dynamicdeleteobjectcommand"\r
- name="%command.name.3">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeCandidateHandler"\r
- id="bulkeditor.commands.setmergecandidate"\r
- name="%command.name.4">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.RemoveMergeCandidateHandler"\r
- id="bulkeditor.commands.removemergecandidate"\r
- name="%command.name.5">\r
- </command>\r
- <command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
- id="taxeditor-bulkeditor.command.setMarkerFlag"\r
- name="%command.name.6">\r
- </command>\r
- <command\r
- id="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
- name="%command.name.7">\r
- </command>\r
- <command\r
- id="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"\r
- name="%command.name.8">\r
- </command>\r
- <command\r
- id="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"\r
- name="%command.name.10">\r
- </command>\r
- <!--command\r
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.new"\r
- name="New Entity">\r
- </command-->\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.editors.markerAnnotationSpecification">\r
- <specification\r
- annotationType="merge_candidate_annotation"\r
- colorPreferenceKey="merge_candidate_annotation_color"\r
- colorPreferenceValue="220,220,255"\r
- highlightPreferenceValue="true"\r
- icon="icons/merge_candidate.gif"\r
- includeOnPreferencePage="true"\r
- label="%specification.label"\r
- overviewRulerPreferenceKey="merge_candidate_annotation_overview"\r
- overviewRulerPreferenceValue="true"\r
- presentationLayer="0"\r
- symbolicIcon="task"\r
- textPreferenceKey="merge_candidate_annotation_text"\r
- textPreferenceValue="false"\r
- textStylePreferenceValue="BOX"\r
- verticalRulerPreferenceKey="merge_candidate_annotation_vertical"\r
- verticalRulerPreferenceValue="true">\r
- </specification>\r
- <specification\r
- annotationType="merge_target_annotation"\r
- colorPreferenceKey="merge_target_annotation_color"\r
- colorPreferenceValue="220,220,255"\r
- highlightPreferenceValue="true"\r
- icon="icons/merge_target.gif"\r
- includeOnPreferencePage="true"\r
- label="%specification.label.0"\r
- overviewRulerPreferenceKey="merge_target_annotation_overview"\r
- overviewRulerPreferenceValue="true"\r
- presentationLayer="1"\r
- symbolicIcon="task"\r
- textPreferenceKey="merge_target_annotation_text"\r
- textPreferenceValue="false"\r
- textStylePreferenceValue="BOX"\r
- verticalRulerPreferenceKey="merge_target_annotation_vertical"\r
- verticalRulerPreferenceValue="true">\r
- </specification> \r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.editors.annotationTypes">\r
- <type\r
- name="merge_candidate_annotation">\r
- </type>\r
- <type\r
- name="merge_target_annotation">\r
- </type>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.views">\r
- <view\r
- class="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"\r
- name="%view.name"\r
- restorable="false">\r
- </view>\r
- </extension> \r
- <extension\r
- point="org.eclipse.core.expressions.definitions">\r
- <definition\r
- id="isMergeEnabled">\r
- <with\r
- variable="activeEditor">\r
- <test\r
- property="taxeditor-bulkeditor.propertyTester.isMergingEnabled">\r
- </test>\r
- </with>\r
- </definition>\r
- <definition\r
- id="isConvertEnabled">\r
- <with\r
- variable="activeEditor">\r
- <test\r
- property="taxeditor-bulkeditor.propertyTester.isConvertingEnabled">\r
- </test>\r
- </with>\r
- </definition>\r
- <definition\r
- id="isTaxonBulkEditorInput">\r
- <with\r
- variable="activeEditor">\r
- <test\r
- property="taxeditor-bulkeditor.propertyTester.isTaxonEditor">\r
- </test>\r
- </with>\r
- </definition>\r
- <definition\r
- id="isTeam">\r
- <with\r
- variable="selection">\r
- <test\r
- property="eu.etaxonomy.taxeditor.bulkeditor.command.isTeam">\r
- </test>\r
- </with>\r
- </definition>\r
- <definition\r
- id="isPerson">\r
- <with\r
- variable="selection">\r
- <test\r
- property="eu.etaxonomy.taxeditor.bulkeditor.command.isPerson">\r
- </test>\r
- </with>\r
- </definition>\r
- </extension>\r
- <extension\r
- point="org.eclipse.core.expressions.propertyTesters">\r
- <propertyTester\r
- class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"\r
- id="taxeditor-bulkeditor.PropertyTester"\r
- namespace="taxeditor-bulkeditor.propertyTester"\r
- properties="isMergingEnabled, isDerivedUnitEditor, isTaxonEditor, isGroupEditor, isConvertingEnabled"\r
- type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
- </propertyTester>\r
- <propertyTester\r
- class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"\r
- id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"\r
- namespace="eu.etaxonomy.taxeditor.bulkeditor.command"\r
- properties="isTeam, isPerson"\r
- type="java.lang.Object">\r
- </propertyTester>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.handlers">\r
- <handler\r
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"\r
- commandId="org.eclipse.ui.edit.cut">\r
- <activeWhen>\r
- <with\r
- variable="activeFocusControlId">\r
- <equals\r
- value="bulkeditor.textControlId">\r
- </equals>\r
- </with>\r
- </activeWhen>\r
- </handler>\r
- <handler\r
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"\r
- commandId="org.eclipse.ui.edit.copy">\r
- <activeWhen>\r
- <with\r
- variable="activeFocusControlId">\r
- <equals\r
- value="bulkeditor.textControlId">\r
- </equals>\r
- </with>\r
- </activeWhen>\r
- </handler>\r
- <handler\r
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"\r
- commandId="org.eclipse.ui.edit.paste">\r
- <activeWhen>\r
- <with\r
- variable="activeFocusControlId">\r
- <equals\r
- value="bulkeditor.textControlId">\r
- </equals>\r
- </with>\r
- </activeWhen>\r
- </handler>\r
- <handler\r
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">\r
- <activeWhen>\r
- <with\r
- variable="selection">\r
- <instanceof\r
- value="eu.etaxonomy.taxeditor.model.LineSelection">\r
- </instanceof>\r
- </with>\r
- </activeWhen>\r
- </handler>\r
- <handler\r
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler"\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person">\r
- </handler>\r
- <handler\r
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"\r
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">\r
- </handler>\r
- \r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.preferencePages">\r
- <page\r
- category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
- class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"\r
- id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"\r
- name="%page.name">\r
- </page>\r
- <page\r
- category="eu.etaxonomy.taxeditor.preferences.general"\r
- class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"\r
- id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
- name="%page.name.0">\r
- </page>\r
- </extension>\r
- <extension\r
- point="org.eclipse.ui.perspectiveExtensions">\r
- <perspectiveExtension\r
- targetID="*">\r
- <showInPart\r
- id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"></showInPart>\r
- <showInPart\r
- id="eu.etaxonomy.taxeditor.view.detail">\r
- </showInPart>\r
- </perspectiveExtension>\r
- </extension>\r
-<!-- start set marker -->\r
-\r
-</plugin>\r
+ <command
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
+ label="%command.label.5"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <reference
+ definitionId="isConvertEnabled">
+ </reference>
+ <reference
+ definitionId="isTeam">
+ </reference>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
+ label="%command.label.6"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">>
+ <and>
+ <reference
+ definitionId="isConvertEnabled">
+ </reference>
+ <reference
+ definitionId="isPerson">
+ </reference>
+ </and>
+ </visibleWhen>
+ </command>
+ <separator
+ name="taxeditor-bulkeditor.separator2"
+ visible="true">
+ </separator>
+ <menu
+ label="%menu.label.2">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"
+ id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">
+ </dynamic>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </menu>
+ <separator
+ name="taxeditor-bulkeditor.separator3"
+ visible="true">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"
+ label="%command.label.4"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.referencingObjectsView.cdmViewerContextMenu">
+ </dynamic>
+ <separator
+ name="eu.etaxonomy.taxeditor.bulkeditor.separator1">
+ </separator>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?after=org.eclipse.ui.views.showView.supplemental">
+ <command
+ commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView"
+ label="%command.label.OPEN_REFERENCING_OBJECTS_VIEW"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler"
+ id="bulkeditor.commands.mergegroup"
+ name="%command.name">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeTargetHandler"
+ id="bulkeditor.commands.setmergetarget"
+ name="%command.name.0">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.OpenBulkEditorHandler"
+ id="taxeditor-bulkeditor.dynamicopenmenu"
+ name="%command.name.1">
+ <commandParameter
+ id="taxeditor-bulkeditor.commandParameter.inputType"
+ name="Bulk Editor Class"
+ values="eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues">
+ </commandParameter>
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.NewObjectHandler"
+ id="taxeditor-bulkeditor.dynamicnewobjectcommand"
+ name="%command.name.2">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.DeleteObjectHandler"
+ id="taxeditor-bulkeditor.dynamicdeleteobjectcommand"
+ name="%command.name.3">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeCandidateHandler"
+ id="bulkeditor.commands.setmergecandidate"
+ name="%command.name.4">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.RemoveMergeCandidateHandler"
+ id="bulkeditor.commands.removemergecandidate"
+ name="%command.name.5">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"
+ id="taxeditor-bulkeditor.command.setMarkerFlag"
+ name="%command.name.6">
+ </command>
+ <command
+ id="eu.etaxonomy.taxeditor.bulkeditor.delete"
+ name="%command.name.7">
+ </command>
+ <command
+ id="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
+ name="%command.name.8">
+ </command>
+ <command
+ id="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
+ name="%command.name.10">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
+ id="eu.etaxonomy.taxeditor.openReferencingObjectsView"
+ name="%command.name.OPEN_REFERENCING_OBJECTS_VIEW">
+ </command>
+ <!--command
+ defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.new"
+ name="New Entity">
+ </command-->
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.markerAnnotationSpecification">
+ <specification
+ annotationType="merge_candidate_annotation"
+ colorPreferenceKey="merge_candidate_annotation_color"
+ colorPreferenceValue="220,220,255"
+ highlightPreferenceValue="true"
+ icon="icons/merge_candidate.gif"
+ includeOnPreferencePage="true"
+ label="%specification.label"
+ overviewRulerPreferenceKey="merge_candidate_annotation_overview"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="0"
+ symbolicIcon="task"
+ textPreferenceKey="merge_candidate_annotation_text"
+ textPreferenceValue="false"
+ textStylePreferenceValue="BOX"
+ verticalRulerPreferenceKey="merge_candidate_annotation_vertical"
+ verticalRulerPreferenceValue="true">
+ </specification>
+ <specification
+ annotationType="merge_target_annotation"
+ colorPreferenceKey="merge_target_annotation_color"
+ colorPreferenceValue="220,220,255"
+ highlightPreferenceValue="true"
+ icon="icons/merge_target.gif"
+ includeOnPreferencePage="true"
+ label="%specification.label.0"
+ overviewRulerPreferenceKey="merge_target_annotation_overview"
+ overviewRulerPreferenceValue="true"
+ presentationLayer="1"
+ symbolicIcon="task"
+ textPreferenceKey="merge_target_annotation_text"
+ textPreferenceValue="false"
+ textStylePreferenceValue="BOX"
+ verticalRulerPreferenceKey="merge_target_annotation_vertical"
+ verticalRulerPreferenceValue="true">
+ </specification>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors.annotationTypes">
+ <type
+ name="merge_candidate_annotation">
+ </type>
+ <type
+ name="merge_target_annotation">
+ </type>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ class="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView"
+ id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"
+ name="%view.name"
+ restorable="false">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="isMergeEnabled">
+ <with
+ variable="activeEditor">
+ <test
+ property="taxeditor-bulkeditor.propertyTester.isMergingEnabled">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isConvertEnabled">
+ <with
+ variable="activeEditor">
+ <test
+ property="taxeditor-bulkeditor.propertyTester.isConvertingEnabled">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isTaxonBulkEditorInput">
+ <with
+ variable="activeEditor">
+ <test
+ property="taxeditor-bulkeditor.propertyTester.isTaxonEditor">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isTeam">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.bulkeditor.command.isTeam">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isPerson">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.bulkeditor.command.isPerson">
+ </test>
+ </with>
+ </definition>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"
+ id="taxeditor-bulkeditor.PropertyTester"
+ namespace="taxeditor-bulkeditor.propertyTester"
+ properties="isMergingEnabled, isDerivedUnitEditor, isTaxonEditor, isGroupEditor, isConvertingEnabled"
+ type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">
+ </propertyTester>
+ <propertyTester
+ class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"
+ id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"
+ namespace="eu.etaxonomy.taxeditor.bulkeditor.command"
+ properties="isTeam, isPerson"
+ type="java.lang.Object">
+ </propertyTester>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"
+ commandId="org.eclipse.ui.edit.cut">
+ <activeWhen>
+ <with
+ variable="activeFocusControlId">
+ <equals
+ value="bulkeditor.textControlId">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"
+ commandId="org.eclipse.ui.edit.copy">
+ <activeWhen>
+ <with
+ variable="activeFocusControlId">
+ <equals
+ value="bulkeditor.textControlId">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"
+ commandId="org.eclipse.ui.edit.paste">
+ <activeWhen>
+ <with
+ variable="activeFocusControlId">
+ <equals
+ value="bulkeditor.textControlId">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">
+ <activeWhen>
+ <with
+ variable="selection">
+ <instanceof
+ value="eu.etaxonomy.taxeditor.model.LineSelection">
+ </instanceof>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler"
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person">
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"
+ commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">
+ </handler>
+
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+ class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"
+ name="%page.name">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+ name="%page.name.0">
+ </page>
+ </extension>
+ <extension
+ point="eu.etaxonomy.taxeditor.store.cdmViewer">
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView"
+ selection="java.lang.Object"
+ viewerName="Referencing Objects View">
+ </viewCommandMapping>
+ </extension>
+<!-- start set marker -->
+
+</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
if (annotation instanceof IEntityContainer<?>) {
IEntityContainer<?> container = (IEntityContainer<?>) annotation;
if (container.isMarkedAsNew() || container.isDirty()) {
- persistenceService.save(container.getEntity()); // save
+ Object entity = persistenceService.save(container.getEntity()); // save
+ container.setEntity(entity);
container.setDirty(false);
container.markAsNew(false);
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.annotatedlineeditor;
import java.util.Iterator;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class AnnotatedLineEditor extends TextEditor implements IConversationEnabled, IPostOperationEnabled {
- protected ConversationHolder conversation;
-
- private IEntityPersistenceService persistenceService;
- protected ILineDisplayStrategy lineDisplayStrategy;
-
-
- /**
- * <p>Constructor for AnnotatedLineEditor.</p>
- *
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public AnnotatedLineEditor(ConversationHolder conversation) {
- this.conversation = conversation;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
- */
- /** {@inheritDoc} */
- @Override
- protected void doSetInput(IEditorInput input) throws CoreException {
-
- AnnotatedLineDocumentProvider provider = new AnnotatedLineDocumentProvider(input);
-
- provider.setLineDisplayStrategy(lineDisplayStrategy, input);
- setDocumentProvider(provider);
-
- super.doSetInput(input);
- }
-
- /**
- * <p>Setter for the field <code>persistenceService</code>.</p>
- *
- * @param persistenceService a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
- */
- protected void setPersistenceService(
- IEntityPersistenceService persistenceService) {
- this.persistenceService = persistenceService;
- }
-
- /**
- * <p>Getter for the field <code>persistenceService</code>.</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
- */
- protected IEntityPersistenceService getPersistenceService() {
- return persistenceService;
- }
-
- /**
- * <p>Setter for the field <code>lineDisplayStrategy</code>.</p>
- *
- * @param lineDisplayStrategy a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy} object.
- */
- protected void setLineDisplayStrategy(
- ILineDisplayStrategy lineDisplayStrategy) {
- this.lineDisplayStrategy = lineDisplayStrategy;
- }
-
- /** {@inheritDoc} */
- @Override
- protected ISourceViewer createSourceViewer(Composite parent,
- IVerticalRuler ruler, int styles) {
-
- fAnnotationAccess= getAnnotationAccess();
- fOverviewRuler= createOverviewRuler(getSharedColors());
- LineSelectionViewer viewer = new LineSelectionViewer(parent, ruler, getOverviewRuler(),
- isOverviewRulerVisible(), styles);
-// isOverviewRulerVisible(), styles | SWT.WRAP);
- getSourceViewerDecorationSupport(viewer);
-
- return viewer;
- }
-
- /**
- * Create an annotated line with an "empty" entity, i.e. using the editor
- * input's default entity type and a zero-length title cache.
- *
- * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
- */
- public LineAnnotation createAnnotatedLineNewObject() {
-
- // Create new object
-
- AnnotatedLineDocumentProvider documentProvider = (AnnotatedLineDocumentProvider) getDocumentProvider();
- IEntityCreator entityCreator = documentProvider.getEntityCreator(getEditorInput());
- Object entity = entityCreator.createEntity(null);
-
- LineAnnotation annotation = createAnnotatedLine(entity);
- if (annotation != null) {
- annotation.markAsNew(true);
- }
- return annotation;
- }
-
- /**
- * Create an annotated line, first creating an entity of type "key" - this key
- * must be recognized by the editor's entity creator.
- *
- * @param key a {@link java.lang.Object} object.
- * @param titleCache a {@link java.lang.String} object.
- * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
- */
- public LineAnnotation createAnnotatedLineNewObject(Object key, String titleCache) {
-
-
-
- // Create new object
- Object entity = ((AnnotatedLineDocumentProvider) getDocumentProvider()).
- getEntityCreator(getEditorInput()).createEntity(key, titleCache);
- // checks if the creator also saves the entity (in a different conversation), in which case
- // we need to bind back this editors conversation
- // we also need to reload the entity because the conversation used to
- // to create / save the entity may have been closed
- if(entity != null && ((AnnotatedLineDocumentProvider) getDocumentProvider()).getEntityCreator(getEditorInput()).savesEntity()) {
- getConversationHolder().bind();
- Object object = CdmStore.getService(IOccurrenceService.class).load(((CdmBase)entity).getUuid());
- entity = HibernateProxyHelper.deproxy(object);
- }
-
- if(entity == null) {
- return null;
- }
- LineAnnotation annotation = createAnnotatedLine(entity);
- if (annotation != null) {
- annotation.markAsNew(true);
- }
-
- return annotation;
-
- }
-
- @Override
- public boolean isDirty() {
- return super.isDirty();
- }
-
- /**
- * Creates an annotated line at the end of the document. The annotation contains the entity.
- *
- * @param entity a {@link java.lang.Object} object.
- * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
- */
- public LineAnnotation createAnnotatedLine(Object entity) {
-
- IEditorInput input = getEditorInput();
- AnnotatedLineDocumentProvider provider = (AnnotatedLineDocumentProvider) getDocumentProvider();
-
- LineAnnotation annotation = null;
- try {
- annotation = provider.createAnnotatedLine(input, entity);
-
- // Jump to new line
- IAnnotationModel model = provider.getAnnotationModel(input);
- if(model != null){
- int start= model.getPosition(annotation).getOffset();
- selectAndReveal(start, 0);
- }
-
- } catch (BadLocationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return annotation;
- }
-
- /**
- * <p>removeAnnotatedLine</p>
- *
- * @param lineno a int.
- */
- public void removeAnnotatedLine(int lineno) {
- ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(lineno);
- }
-
- /**
- * <p>removeAnnotatedLine</p>
- *
- * @param annotation a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
- */
- public void removeAnnotatedLine(LineAnnotation annotation) {
- ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(annotation);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- /** {@inheritDoc} */
- @Override
- public void doSave(IProgressMonitor progressMonitor) {
- if (getConversationHolder() != null) {
- if( ! getConversationHolder().isBound()){
- getConversationHolder().bind();
- }
- super.doSave(progressMonitor);
- getConversationHolder().commit(true);
- } else {
- super.doSave(progressMonitor);
- }
- firePropertyChange(PROP_DIRTY);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#setFocus()
- */
- /** {@inheritDoc} */
- @Override
- public void setFocus() {
- super.setFocus();
- if (getConversationHolder() != null) {
- getConversationHolder().bind();
- }
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
- // TODO pass focus to underlying widgets
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
+ protected ConversationHolder conversation;
+
+ private IEntityPersistenceService persistenceService;
+ protected ILineDisplayStrategy lineDisplayStrategy;
+
+
+ /**
+ * <p>Constructor for AnnotatedLineEditor.</p>
+ *
+ * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ public AnnotatedLineEditor(ConversationHolder conversation) {
+ this.conversation = conversation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+
+ AnnotatedLineDocumentProvider provider = new AnnotatedLineDocumentProvider(input);
+
+ provider.setLineDisplayStrategy(lineDisplayStrategy, input);
+ setDocumentProvider(provider);
+
+ super.doSetInput(input);
+ }
+
+ /**
+ * <p>Setter for the field <code>persistenceService</code>.</p>
+ *
+ * @param persistenceService a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
+ */
+ protected void setPersistenceService(
+ IEntityPersistenceService persistenceService) {
+ this.persistenceService = persistenceService;
+ }
+
+ /**
+ * <p>Getter for the field <code>persistenceService</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
+ */
+ protected IEntityPersistenceService getPersistenceService() {
+ return persistenceService;
+ }
+
+ /**
+ * <p>Setter for the field <code>lineDisplayStrategy</code>.</p>
+ *
+ * @param lineDisplayStrategy a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy} object.
+ */
+ protected void setLineDisplayStrategy(
+ ILineDisplayStrategy lineDisplayStrategy) {
+ this.lineDisplayStrategy = lineDisplayStrategy;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent,
+ IVerticalRuler ruler, int styles) {
+
+ fAnnotationAccess= getAnnotationAccess();
+ fOverviewRuler= createOverviewRuler(getSharedColors());
+ LineSelectionViewer viewer = new LineSelectionViewer(parent, ruler, getOverviewRuler(),
+ isOverviewRulerVisible(), styles);
+ // isOverviewRulerVisible(), styles | SWT.WRAP);
+ getSourceViewerDecorationSupport(viewer);
+
+ return viewer;
+ }
+
+ /**
+ * Create an annotated line with an "empty" entity, i.e. using the editor
+ * input's default entity type and a zero-length title cache.
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLineNewObject() {
+
+ // Create new object
+
+ AnnotatedLineDocumentProvider documentProvider = (AnnotatedLineDocumentProvider) getDocumentProvider();
+ IEntityCreator entityCreator = documentProvider.getEntityCreator(getEditorInput());
+ Object entity = entityCreator.createEntity(null);
+
+ LineAnnotation annotation = createAnnotatedLine(entity);
+ if (annotation != null) {
+ annotation.markAsNew(true);
+ }
+ return annotation;
+ }
+
+ /**
+ * Create an annotated line, first creating an entity of type "key" - this key
+ * must be recognized by the editor's entity creator.
+ *
+ * @param key a {@link java.lang.Object} object.
+ * @param titleCache a {@link java.lang.String} object.
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLineNewObject(Object key, String titleCache) {
+
+
+
+ // Create new object
+ Object entity = ((AnnotatedLineDocumentProvider) getDocumentProvider()).
+ getEntityCreator(getEditorInput()).createEntity(key, titleCache);
+ // checks if the creator also saves the entity (in a different conversation), in which case
+ // we need to bind back this editors conversation
+ // we also need to reload the entity because the conversation used to
+ // to create / save the entity may have been closed
+ if(entity != null && ((AnnotatedLineDocumentProvider) getDocumentProvider()).getEntityCreator(getEditorInput()).savesEntity()) {
+ getConversationHolder().bind();
+ //FIXME: why do we use IOccurrenceService here? is this generic?
+ //because this method is only invoked by the handler which is used in the
+ //specimen bulk editor. This is unsafe and should be refactored!
+ Object object = CdmStore.getService(IOccurrenceService.class).load(((CdmBase)entity).getUuid());
+ entity = HibernateProxyHelper.deproxy(object);
+ }
+
+ if(entity == null) {
+ return null;
+ }
+ LineAnnotation annotation = createAnnotatedLine(entity);
+ if (annotation != null) {
+ annotation.markAsNew(true);
+ }
+
+ return annotation;
+
+ }
+
+ @Override
+ public boolean isDirty() {
+ return super.isDirty();
+ }
+
+ /**
+ * Creates an annotated line at the end of the document. The annotation contains the entity.
+ *
+ * @param entity a {@link java.lang.Object} object.
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLine(Object entity) {
+
+ IEditorInput input = getEditorInput();
+ AnnotatedLineDocumentProvider provider = (AnnotatedLineDocumentProvider) getDocumentProvider();
+
+ LineAnnotation annotation = null;
+ try {
+ annotation = provider.createAnnotatedLine(input, entity);
+
+ // Jump to new line
+ IAnnotationModel model = provider.getAnnotationModel(input);
+ if(model != null){
+ int start= model.getPosition(annotation).getOffset();
+ selectAndReveal(start, 0);
+ }
+
+ } catch (BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return annotation;
+ }
+
+ /**
+ * <p>removeAnnotatedLine</p>
+ *
+ * @param lineno a int.
+ */
+ public void removeAnnotatedLine(int lineno) {
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(lineno);
+ }
+
+ /**
+ * <p>removeAnnotatedLine</p>
+ *
+ * @param annotation a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public void removeAnnotatedLine(LineAnnotation annotation) {
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(annotation);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ if (getConversationHolder() != null) {
+ if( ! getConversationHolder().isBound()){
+ getConversationHolder().bind();
+ }
+ super.doSave(progressMonitor);
+ getConversationHolder().commit(true);
+ } else {
+ super.doSave(progressMonitor);
+ }
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#setFocus()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setFocus() {
+ super.setFocus();
+ if (getConversationHolder() != null) {
+ getConversationHolder().bind();
+ }
+ ((AbstractBulkEditorInput)getEditorInput()).bind();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
+ // TODO pass focus to underlying widgets
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
- /** {@inheritDoc} */
- @Override
+ return conversation;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ /** {@inheritDoc} */
+ @Override
public void update(CdmDataChangeMap changeEvents) {}
- /**
- * Refreshes text in all lines.
- */
- protected void refreshLineDisplay() {
- IDocumentProvider provider = getDocumentProvider();
- IEditorInput input = getEditorInput();
- IAnnotationModel model = provider.getAnnotationModel(input);
- Iterator iter = getDocumentProvider().getAnnotationModel(getEditorInput()).getAnnotationIterator();
- while (iter.hasNext()) {
- Object next = iter.next();
- if (next instanceof LineAnnotation) {
- LineAnnotation annotation = (LineAnnotation) next;
- ((AnnotatedLineDocumentProvider) getDocumentProvider()).
- updateLineFromAnnotation(annotation);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
- */
- /** {@inheritDoc} */
- @Override
+ /**
+ * Refreshes text in all lines.
+ */
+ protected void refreshLineDisplay() {
+ IDocumentProvider provider = getDocumentProvider();
+ IEditorInput input = getEditorInput();
+ IAnnotationModel model = provider.getAnnotationModel(input);
+ Iterator iter = getDocumentProvider().getAnnotationModel(getEditorInput()).getAnnotationIterator();
+ while (iter.hasNext()) {
+ Object next = iter.next();
+ if (next instanceof LineAnnotation) {
+ LineAnnotation annotation = (LineAnnotation) next;
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).
+ updateLineFromAnnotation(annotation);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ /** {@inheritDoc} */
+ @Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
- refreshLineDisplay();
-
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.editors.text.TextEditor#dispose()
- */
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- super.dispose();
- conversation.close();
- }
-
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
- @Override
+ refreshLineDisplay();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#dispose()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ super.dispose();
+ conversation.close();
+ ((AbstractBulkEditorInput)getEditorInput()).dispose();
+ }
+
+ /**
+ * <p>onComplete</p>
+ *
+ * @return a boolean.
+ */
+ @Override
public boolean onComplete() {
- // TODO Auto-generated method stub
- return false;
- }
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
// $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.
*/
* @return a T object.
*/
T getEntity();
-
+
+ void setEntity(Object entity);
+
/**
* <p>getEditableText</p>
*
* @return a {@link java.lang.String} object.
*/
String getEditableText();
-
+
/**
* <p>getAttachedEntities</p>
*
* @return a {@link java.util.Set} object.
*/
Set<T> getAttachedEntities();
-
+
/**
* <p>markAsMerged</p>
*
* @param mergeTarget a T object.
*/
void markAsMerged(T mergeTarget);
-
+
/**
* <p>markAsDeleted</p>
*/
void markAsDeleted();
-
+
/**
* <p>markAsNew</p>
*
* @param isNew a boolean.
*/
void markAsNew(boolean isNew);
-
+
/**
* <p>isMarkedAsMerged</p>
*
* @return a boolean.
*/
boolean isMarkedAsMerged();
-
+
/**
* <p>isMarkedAsDeleted</p>
*
* @return a boolean.
*/
boolean isMarkedAsDeleted();
-
+
/**
* <p>isMarkedAsNew</p>
*
// $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.
*/
* @version 1.0
*/
public interface IEntityPersistenceService<T> {
-
+
/**
* <p>create</p>
*
* @param entity a {@link java.lang.Object} object.
* @return a boolean.
*/
- boolean create(T entity);
-
+ T create(T entity);
+
/**
* <p>save</p>
*
* @param entity a {@link java.lang.Object} object.
* @return a boolean.
*/
- boolean save(T entity);
-
+ T save(T entity);
+
/**
* <p>merge</p>
*
* @return a boolean.
*/
boolean merge(T entity, T mergeTarget);
-
+
/**
* <p>delete</p>
*
* @param entity a {@link java.lang.Object} object.
* @return a boolean.
- * @throws ReferencedObjectUndeletableException
+ * @throws ReferencedObjectUndeletableException
*/
boolean delete(T entity) throws ReferencedObjectUndeletableException;
}
// $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.
*/
/** Constant <code>TYPE_GENERIC="Annotation.TYPE_UNKNOWN"</code> */
public static final String TYPE_GENERIC = Annotation.TYPE_UNKNOWN;
-
+
private T entity;
private ILineDisplayStrategy lineDisplayStrategy;
private boolean markedAsNew;
private T mergeTarget;
-
+
/**
* <p>Constructor for LineAnnotation.</p>
*
this.lineDisplayStrategy = lineDisplayStrategy;
setType(TYPE_GENERIC);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.Annotation#getText()
*/
public String getText() {
return getEditableText();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.Annotation#setText(java.lang.String)
*/
@Override
public void setText(String text) {
lineDisplayStrategy.setText(text, entity);
- dirty = true;
+ dirty = true;
super.setText(text);
}
-
+
/** {@inheritDoc} */
@Override
public String toString() {
// For debugging
return getText();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.IEntityContainer#getAttachedEntities()
*/
*
* @return a {@link java.util.Set} object.
*/
- public Set getAttachedEntities() {
+ @Override
+ public Set getAttachedEntities() {
// TODO Auto-generated method stub
return null;
}
*
* @return a T object.
*/
- public T getEntity() {
+ @Override
+ public T getEntity() {
return entity;
}
*
* @return a {@link java.lang.String} object.
*/
- public String getEditableText() {
+ @Override
+ public String getEditableText() {
return lineDisplayStrategy.getText(entity);
}
*
* @return a T object.
*/
- public T getMergeTarget() {
+ @Override
+ public T getMergeTarget() {
return mergeTarget;
}
*
* @return a boolean.
*/
- public boolean isMarkedAsDeleted() {
+ @Override
+ public boolean isMarkedAsDeleted() {
return super.isMarkedDeleted();
}
*
* @return a boolean.
*/
- public boolean isMarkedAsMerged() {
+ @Override
+ public boolean isMarkedAsMerged() {
return markedAsMerged;
}
*
* @return a boolean.
*/
- public boolean isMarkedAsNew() {
+ @Override
+ public boolean isMarkedAsNew() {
return markedAsNew;
}
/**
* <p>markAsDeleted</p>
*/
- public void markAsDeleted() {
+ @Override
+ public void markAsDeleted() {
super.markDeleted(true);
if (!isMarkedAsMerged()) {
lineDisplayStrategy.setStatusMessage(entity + " deleted.", entity);
*
* @param mergeTarget a T object.
*/
- public void markAsMerged(T mergeTarget) {
+ @Override
+ public void markAsMerged(T mergeTarget) {
this.mergeTarget = mergeTarget;
markedAsMerged = true;
lineDisplayStrategy.setStatusMessage("'" + entity + "' merged into '" + mergeTarget + "'.", entity);
* @see eu.etaxonomy.taxeditor.bulkeditor.IEntityContainer#markAsNew()
*/
/** {@inheritDoc} */
- public void markAsNew(boolean isNew) {
+ @Override
+ public void markAsNew(boolean isNew) {
markedAsNew = isNew;
lineDisplayStrategy.setStatusMessage("New entity created.", entity);
}
* @see eu.etaxonomy.taxeditor.bulkeditor.IEntityContainer#setDirty(boolean)
*/
/** {@inheritDoc} */
- public void setDirty(boolean dirty) {
+ @Override
+ public void setDirty(boolean dirty) {
this.dirty = dirty;
}
*
* @return a boolean.
*/
- public boolean isDirty() {
+ @Override
+ public boolean isDirty() {
return dirty;
}
public String getHoverText() {
return lineDisplayStrategy.getHoverText(entity);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityContainer#setEntity(java.lang.Object)
+ */
+ @Override
+ public void setEntity(Object entity) {
+ this.entity = (T) entity;
+ }
}
displayWarningDialog();
isInitialFocus = false;
}
+ super.setFocus();
}
private void displayWarningDialog() {
--- /dev/null
+/**
+ * Copyright (C) 2016 EDIT
+ * 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;
+/**
+ * @author kluther
+ * @date 29 Feb 2016
+ *
+ */
+public interface BulkEditorLables {
+
+
+
+ public static final String CONVERT_TEAM_2_PERSON_LABEL = "Convert Team to Person";
+ public static final String CONVERT_PERSON_2_TEAM_LABEL = "Convert Person to Team";
+ public static final String DELETE_LABEL = "Delete";
+ public static final String MERGE_GROUP_LABEL = "Merge Group";
+ public static final String REMOVE_MERGE_CANDIDATE_LABEL = "Remove from Merge Group";
+ public static final String SET_MERGE_CANDIDATE_LABEL = "Set as Merge Candidate";
+ public static final String SET_MERGE_TARGET_LABEL = "Set as Merge Target";
+
+ public static final String NO_CONVERT_PERSON_TO_TEAM_MESSAGE = "Can not convert Person into a Team.";
+ public static final String TRANSFORMATION_NOT_POSSIBLE_PERSON_PART_OF_TEAM_MESSAGE = "Person can not be transformed into team as it is already part of a team.";
+ public static final String NO_CONVERT_TEAM_TO_PERSON_MESSAGE = "Can not convert Team to Person";
+
+
+ public static final String UNSAVED_CHANGES_MESSAGE = "There are unsaved changes in the source taxon. Please save first.";
+ public static final String SINGLE_PERSON_SELECTION_MESSAGE = "The chosen operation is available only for a single person";
+ public static final String SINGLE_TEAM_SELECTION_MESSAGE = "The chosen operation is available only for a single team";
+ public static final String NO_PERSON_SELECTION_MESSAGE = "No person selected for conversion";
+ public static final String ONLY_PERSON_SELECTION_MESSAGE = "Only a person can be converted into a team.";
+ public static final String NO_TEAM_SELECTION_MESSAGE = "No team selected for conversion";
+ public static final String ONLY_TEAM_SELECTION_MESSAGE = "Only a team can be converted into a person.";
+ public static final String ONLY_FOR_BULKEDITOR_MESSAGE = "You have to choose a line in the bulkeditor to perform this operation.";
+
+
+
+
+
+}
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.action.IStatusLineManager;
import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.Marker;
-import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener;
import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* <p>BulkEditorLineDisplay class.</p>
if (entity instanceof IAnnotatableEntity) {
IAnnotatableEntity annotatableEntity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(entity);
- Map<MarkerType, Boolean> editMarkerTypePreferences = PreferencesUtil.getEditMarkerTypePreferences();
-
String markerText = "";
List<String> markers = new ArrayList<String>();
for (Marker marker : annotatableEntity.getMarkers()) {
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
public static final String IS_CONVERT_ENABLED = "isConvertingEnabled";
public static final String IS_PERSON = "isPerson";
public static final String IS_TEAM = "isTeam";
+ public static final String IS_MEDIA_EDITOR = "isMediaEditor";
/* (non-Javadoc)
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
}
else if(IS_TAXON_EDITOR.equals(property)){
return bulkEditor.getEditorInput() instanceof TaxonEditorInput;
+ } else if(IS_MEDIA_EDITOR.equals(property)){
+ return bulkEditor.getEditorInput() instanceof MediaEditorInput;
}
// if (("isPublishFlagEditingEnabled").equals(property)) {
contributionItems.add(new Separator(groupName));
contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem());
contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.MEDIA.createContributionItem());
+ contributionItems.add(new Separator(groupName));
contributionItems.add(BulkEditorInputType.USER.createContributionItem());
contributionItems.add(BulkEditorInputType.GROUP.createContributionItem());
-
+ contributionItems.add(BulkEditorInputType.MEDIA.createContributionItem());
return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
}
import org.eclipse.ui.texteditor.IDocumentProvider;\r
\r
import eu.etaxonomy.cdm.api.service.IAgentService;\r
+import eu.etaxonomy.cdm.api.service.UpdateResult;\r
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
import eu.etaxonomy.cdm.model.agent.Person;\r
import eu.etaxonomy.cdm.model.agent.Team;\r
Team team ;\r
for(Object object : structuredSelection.toList()){\r
LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);\r
- team = null;\r
+ UpdateResult result = null;\r
+ team = null;\r
if (object instanceof Person){\r
Person person = HibernateProxyHelper.deproxy(object, Person.class);\r
try {\r
- team = CdmStore.getService(IAgentService.class).convertPerson2Team(person);\r
+ result = CdmStore.getService(IAgentService.class).convertPerson2Team(person.getUuid());\r
} catch (IllegalArgumentException e) {\r
MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getLocalizedMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);\r
} catch (MergeException e) {\r
- MessagingUtils.informationDialog("Convert not possible", "Person can not be transformed into team as it is referenced in a way that does not allow converting");\r
+ MessagingUtils.informationDialog("Convert not possible", "Person can not be transformed into team as it is already part of a team.");\r
}\r
}else{\r
MessagingUtils.informationDialog("Can not convert Person into a Team", "convert Person to Team can only be called on a person.");\r
}\r
-\r
+ if (result != null &&result.isOk()){\r
+ team = (Team)result.getCdmEntity();\r
+ }\r
if (team != null){\r
((BulkEditor) editor).removeAnnotatedLine(annotation);\r
((BulkEditor) editor).createAnnotatedLine(team);\r
import org.eclipse.ui.handlers.HandlerUtil;\r
import org.eclipse.ui.texteditor.IDocumentProvider;\r
\r
-import eu.etaxonomy.cdm.api.service.AgentServiceImpl;\r
import eu.etaxonomy.cdm.api.service.IAgentService;\r
+import eu.etaxonomy.cdm.api.service.UpdateResult;\r
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
-import eu.etaxonomy.cdm.model.agent.AgentBase;\r
import eu.etaxonomy.cdm.model.agent.Person;\r
import eu.etaxonomy.cdm.model.agent.Team;\r
import eu.etaxonomy.cdm.strategy.merge.MergeException;\r
@Override\r
public Person execute(ExecutionEvent event) throws ExecutionException {\r
ISelection selection = HandlerUtil.getCurrentSelection(event);\r
- \r
+\r
IEditorPart editor = HandlerUtil.getActiveEditor(event);\r
- \r
+\r
IEditorInput input = editor.getEditorInput();\r
if (editor.isDirty()){\r
boolean proceed = MessageDialog.openQuestion(null,\r
}\r
}\r
if((input instanceof IEntityPersistenceService) && (selection instanceof IStructuredSelection)){\r
- \r
- \r
+\r
+\r
IDocumentProvider provider = ((BulkEditor) editor).getDocumentProvider();\r
- LineAnnotationModel model = \r
+ LineAnnotationModel model =\r
(LineAnnotationModel) provider.getAnnotationModel(input);\r
- \r
- \r
+\r
+\r
IStructuredSelection structuredSelection = (IStructuredSelection) selection;\r
- \r
+\r
IEntityPersistenceService persistenceService = (IEntityPersistenceService) input;\r
- \r
+\r
Person person ;\r
for(Object object : structuredSelection.toList()){\r
LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);\r
person = null;\r
+ UpdateResult result = null;\r
if (object instanceof Team){\r
Team team = HibernateProxyHelper.deproxy(object, Team.class);\r
try {\r
- person = CdmStore.getService(IAgentService.class).convertTeam2Person(team);\r
+ result = CdmStore.getService(IAgentService.class).convertTeam2Person(team.getUuid());\r
} catch (IllegalArgumentException e) {\r
MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());\r
} catch (MergeException e) {\r
}else{\r
MessagingUtils.informationDialog("Can not convert Team to Person", "convertTeam2Person can only be called on a team.");\r
}\r
- \r
+ if (result != null && result.isOk()){\r
+ person = (Person)result.getCdmEntity();\r
+ }\r
if (person != null){\r
((BulkEditor) editor).removeAnnotatedLine(annotation);\r
((BulkEditor) editor).createAnnotatedLine(person);\r
// $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.handler;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.UUID;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.IWorkbenchPage;
+import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.persistence.dao.hibernate.HibernateBeanInitializer;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
-import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog;
/**
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
-
+
ISelection selection = HandlerUtil.getCurrentSelection(event);
-
+
IEditorPart editor = HandlerUtil.getActiveEditor(event);
-
+
IEditorInput input = editor.getEditorInput();
-
+
if((input instanceof IEntityPersistenceService) && (selection instanceof IStructuredSelection)){
-
-
+
+
IDocumentProvider provider = ((BulkEditor) editor).getDocumentProvider();
- LineAnnotationModel model =
+ LineAnnotationModel model =
(LineAnnotationModel) provider.getAnnotationModel(input);
-
-
+
+
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
+
IEntityPersistenceService persistenceService = (IEntityPersistenceService) input;
-
-
+
+
for(Object object : structuredSelection.toList()){
-
+
LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);
- DeleteResult result = new DeleteResult();
+ DeleteResult result = new DeleteResult();
+ String errorMessage= "The object ";
//result.setError();
try {
ICdmApplicationConfiguration controller;
- controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
- //persistenceService.delete(object);
+ controller = CdmStore.getCurrentApplicationConfiguration();
+
if (object instanceof SpecimenOrObservationBase){
-
IOccurrenceService service = controller.getOccurrenceService();
- SpecimenOrObservationBase persistedObject = service.load(((SpecimenOrObservationBase) object).getUuid());
- if (persistedObject != null){
- result = service.delete(persistedObject);
- }
+ if (object != null){
+ result = service.delete(((SpecimenOrObservationBase) object).getUuid());
+ errorMessage = "The specimen or observation ";
+ }
} else if (object instanceof Reference){
IReferenceService service = controller.getReferenceService();
-
- Reference persistedObject = service.load(((Reference) object).getUuid());
- if (persistedObject != null){
- result = service.delete(persistedObject);
+ if (object != null){
+ result = service.delete(((Reference) object).getUuid());
+ errorMessage = "The reference ";
}
-
+
} else if (object instanceof Group){
IGroupService service = controller.getGroupService();
- Group persistedObject = service.load(((Group) object).getUuid());
- if (persistedObject != null){
- result = service.delete(persistedObject);
+ if (object != null){
+ result = service.delete(((Group) object).getUuid());
+ errorMessage = "The group ";
}
}else if (object instanceof User){
IUserService service = controller.getUserService();
- User persistedObject = service.load(((User) object).getUuid());
- if (persistedObject != null){
- result = service.delete(persistedObject);
+ if (object != null){
+ result = service.delete(((User) object).getUuid());
+ errorMessage = "The user ";
}
} else if (object instanceof TaxonNameBase){
INameService service = controller.getNameService();
- TaxonNameBase name = service.load(((TaxonNameBase) object).getUuid());
- if (name != null){
+ if (object != null){
NameDeletionConfigurator config = new NameDeletionConfigurator();
-
- result = service.delete(name.getUuid(), config);
- }
+
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the name?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
+ int result_dialog= dialog.open();
+ if (result_dialog == 1){
+ return null;
+ }
+ result = service.delete(((TaxonNameBase) object).getUuid(), config);
+ errorMessage = "The name ";
+ }
} else if (object instanceof TaxonBase){
ITaxonService service = controller.getTaxonService();
- TaxonBase taxonBase = service.load(((TaxonBase) object).getUuid());
- if (taxonBase != null){
+ if (object != null){
if (object instanceof Taxon){
- result = service.deleteTaxon(((TaxonBase) object).getUuid(), null, null);
+ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+ config.setDeleteInAllClassifications(true);
+ DeleteConfiguratorDialog dialog;
+ if (((Taxon)object).getTaxonNodes().isEmpty()){
+ dialog = new DeleteConfiguratorDialog(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", null, "Do you really want to delete the taxon?", MessageDialog.WARNING, new String[] { "Delete", "Skip" }, 0);
+ int result_dialog= dialog.open();
+ if (result_dialog == 1){
+ return null;
+ }
+ result = service.deleteTaxon(((TaxonBase) object).getUuid(), config, null);
+ errorMessage = "The taxon ";
+ } else{
+ MessagingUtils.messageDialog("Delete not possible", getClass(), "The taxon can not be deleted in bulk editor. It is used in a classification.", null);
+ return null;
+ }
+
}else{
- result = service.deleteSynonym((Synonym)object, null);
+ SynonymDeletionConfigurator config = new SynonymDeletionConfigurator();
+
+ result = service.deleteSynonym(((Synonym)object).getUuid(), config);
+ errorMessage = "The synonym ";
}
}
} else if (object instanceof TeamOrPersonBase){
IAgentService service = controller.getAgentService();
- TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
- result = service.delete((TeamOrPersonBase)object);
- }
+ //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
+ result = service.delete(((TeamOrPersonBase)object).getUuid());
+ errorMessage = "The team or person ";
+ } else if (object instanceof Media){
+ IMediaService service = controller.getMediaService();
+ //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
+ result = service.delete(((Media)object).getUuid(), null);
+ errorMessage = "The media ";
+ }
+
} catch (Exception e){
MessagingUtils.errorDialog("Exception occured. Delete not possible", getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true);
}
if (result.isError() || result.isAbort()){
if (!result.getExceptions().isEmpty()) {
- String message = null;
+ List<String> messages = new ArrayList<String>();
int i = result.getExceptions().size();
for (Exception e:result.getExceptions()){
- i--;
- message+= e.getMessage();
- if (i>0){
- message+= ", ";
- }
+ messages.add(e.getMessage());
}
-
-
- MessagingUtils.messageDialog("Delete not possible", getClass(), result.getExceptions().toString(), null);
+ errorMessage += "could not be deleted.";
+ //MessagingUtils.errorDialog("test", getClass(), "message", TaxeditorBulkeditorPlugin.PLUGIN_ID, result.getExceptions().iterator().next(),true);
+ DeleteResultMessagingUtils.messageDialogWithDetails(result,errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
}else{
MessagingUtils.messageDialog("Delete not possible", getClass(), "The object could not be deleted. An exception occured.", null);
-
}
}
if (result.isOk() ){
((BulkEditor) editor).removeAnnotatedLine(annotation);
if(result.getUpdatedObjects().size() != 0 || !result.getExceptions().isEmpty()){
- MessagingUtils.informationDialog("Delete successfull", "The object is deleted but there are updated objects: " + result.toString());
+ List<String> messages = new ArrayList<String>();
+ int i = result.getExceptions().size();
+ for (Exception e:result.getExceptions()){
+ messages.add(e.getMessage());
+ }
+ errorMessage += "was deleted but related object(s) could not be deleted. ";
+ //MessagingUtils.errorDialog("test", getClass(), "message", TaxeditorBulkeditorPlugin.PLUGIN_ID, result.getExceptions().iterator().next(),true);
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
}
}
-
- }
+
+ }
}
-
-
+
+
return null;
}
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.CdmBaseSortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.TitleCacheComparator;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @version 1.0
* @param <T>
*/
-public abstract class AbstractBulkEditorInput<T extends ICdmBase> implements IEditorInput, IEntityPersistenceService<T> {
+public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEntitySessionInput implements IEditorInput ,
+ IEntityPersistenceService<T> {
private UUID entityUuid;
private static Class serviceClass;
+ public AbstractBulkEditorInput() {
+ super(true);
+ }
+
/**
* <p>NewInstance</p>
*
public boolean merge(T entity, T mergeTarget) {
if (entity instanceof IMergable) {
try {
- CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), (Class<? extends CdmBase>)entity.getClass());
+ CdmStore.getCommonService().merge(mergeTarget.getUuid(), entity.getUuid(), (Class<? extends CdmBase>)entity.getClass());
} catch (MergeException e) {
MessagingUtils.errorDialog("Bulk Editor Merge Error",
this,
/** {@inheritDoc} */
@Override
- public boolean create(T entity) {
+ public T create(T entity) {
return save(entity);
}
/**
* @return
*/
- public List<?> getModel() {
+ public List<T> getModel() {
return model;
}
+ protected boolean replaceInModel(T entity) {
+ int index = model.indexOf(entity);
+ if(index >= 0) {
+ model.set(index, entity);
+ return true;
+ } else {
+ return false;
+ }
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<T> getRootEntities() {
+ return getModel();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
return ID;
}
+
@Override
public String getName() {
return BulkEditorInputType.AGENT.label;
}
+
@Override
public String getToolTipText() {
return getName();
return true;
}
+
/** {@inheritDoc} */
@Override
public boolean isConvertingEnabled() {
if(entity instanceof Person && mergeTarget instanceof Person) {
IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(Person.class);
strategy.setMergeMode("institutionalMemberships", MergeMode.FIRST);
- CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), Person.class);
+ CdmStore.getCommonService().merge(mergeTarget.getUuid(), entity.getUuid(), Person.class);
} else {
IMergeStrategy strategy = DefaultMergeStrategy.NewInstance(TeamOrPersonBase.class);
- CdmStore.getCommonService().merge(mergeTarget.getId(), entity.getId(), TeamOrPersonBase.class);
+ CdmStore.getCommonService().merge(mergeTarget.getUuid(), entity.getUuid(), TeamOrPersonBase.class);
}
} catch (MergeException e) {
MessagingUtils.errorDialog("Bulk Editor Merge Error",
public boolean delete(AgentBase entity) throws ReferencedObjectUndeletableException {
-
return CdmStore.getService(IAgentService.class).delete(entity) != null;
}
return sortProviders;
}
+
@Override
protected IEntityCreator<TeamOrPersonBase> createEntityCreator() {
return new AgentCreator();
}
@Override
- public boolean save(TeamOrPersonBase entity) {
- return CdmStore.getService(IAgentService.class).saveOrUpdate(entity) != null;
+ public TeamOrPersonBase save(TeamOrPersonBase entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return (TeamOrPersonBase) CdmStore.getService(IAgentService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IAgentService.class).saveOrUpdate(entity) ;
+ return entity;
+ }
}
@Override
return false;
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
+
}
package eu.etaxonomy.taxeditor.bulkeditor.input;
import java.util.HashMap;
-import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
public enum BulkEditorInputType {
- AGENT(Messages.BulkEditorInputType_0, AgentEditorInput.ID),
- REFERENCE(Messages.BulkEditorInputType_1, ReferenceEditorInput.ID),
- NAME(Messages.BulkEditorInputType_2, NameEditorInput.ID),
- NAME_RELATIONSHIP(Messages.BulkEditorInputType_3, NameRelationshipEditorInput.ID),
- OCCURRENCE(Messages.BulkEditorInputType_4, OccurrenceEditorInput.ID),
- USER(Messages.BulkEditorInputType_5, UserEditorInput.ID),
+ AGENT(Messages.BulkEditorInputType_0, AgentEditorInput.ID),
+ REFERENCE(Messages.BulkEditorInputType_1, ReferenceEditorInput.ID),
+ NAME(Messages.BulkEditorInputType_2, NameEditorInput.ID),
+ NAME_RELATIONSHIP(Messages.BulkEditorInputType_3, NameRelationshipEditorInput.ID),
+ OCCURRENCE(Messages.BulkEditorInputType_4, OccurrenceEditorInput.ID),
+ USER(Messages.BulkEditorInputType_5, UserEditorInput.ID),
GROUP(Messages.BulkEditorInputType_6, GroupEditorInput.ID),
- TAXON(Messages.BulkEditorInputType_7, TaxonEditorInput.ID);
+ TAXON(Messages.BulkEditorInputType_7, TaxonEditorInput.ID),
+ MEDIA(Messages.BulkEditorInputType_8, MediaEditorInput.ID);
public String id;
public String label;
- public ResourceBundle resourceBundle;
+ public ResourceBundle resourceBundle;
BulkEditorInputType(String label, String id) {
this.id = id;
this.label = label;
}
- public IContributionItem createContributionItem(){
+ public IContributionItem createContributionItem(){
return createContributionItem(label, id);
}
-
+
/**
* @param key
* @param object
return new CommandContributionItem(parameter);
}
-
+
public static BulkEditorInputType getById(String id) {
for (BulkEditorInputType type : values()) {
return USER;
} else if (Taxon.class.isAssignableFrom(clazz)){
return TAXON;
- }
+ } else if (Media.class.isAssignableFrom(clazz)){
+ return MEDIA;
+ }
return null;
}
return GROUP;
} else if (input instanceof TaxonEditorInput){
return TAXON;
- }
+ }else if (input instanceof MediaEditorInput){
+ return MEDIA;
+ }
return null;
}
return new GroupEditorInput();
case TAXON:
return new TaxonEditorInput();
+ case MEDIA:
+ return new MediaEditorInput();
default:
throw new IllegalStateException(
"No input class for the given input type defined."); //$NON-NLS-1$
}
}
-
+
public static Class getServiceClass(
BulkEditorInputType inputType) {
switch (inputType) {
return IGroupService.class;
case TAXON:
return ITaxonService.class;
+ case MEDIA:
+ return IMediaService.class;
default:
throw new IllegalStateException(
"No input class for the given input type defined."); //$NON-NLS-1$
// $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 eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
public static final String ID = "bulkeditor.input.group";
-
+
private static GroupEditorInput instance;
-
+
/**
* @return the instance
*/
}
return instance;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
@Override
- public boolean save(Group entity) {
- return CdmStore.getService(IGroupService.class).saveOrUpdate(entity) != null;
+ public Group save(Group entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IGroupService.class).saveOrUpdate(entity);
+ return entity;
+ }
}
/* (non-Javadoc)
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
-
+
@Override
protected Group loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return CdmStore.getService(IGroupService.class).load(entityUuid, propertyPaths);
}
*/
protected IEntityCreator<Group> createEntityCreator() {
return new GroupCreator();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
return entity.getName();
}
-
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.List;
+
+import eu.etaxonomy.cdm.api.service.IMediaService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.MediaCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 10.03.2016
+ *
+ */
+public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
+ public static final String ID = "bulkeditor.input.media";
+
+ private static MediaEditorInput instance;
+
+ public static String getID() {
+ return ID;
+ }
+
+ public static AbstractBulkEditorInput getInstance() {
+ if (instance == null) {
+ instance = new MediaEditorInput();
+ }
+ return instance;
+ }
+
+ @Override
+ public String getName() {
+ return BulkEditorInputType.MEDIA.label;
+ }
+
+ @Override
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @Override
+ public Media save(Media entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(IMediaService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IMediaService.class).saveOrUpdate(entity) ;
+ return entity;
+ }
+ }
+
+ @Override
+ public boolean delete(Media entity) throws ReferencedObjectUndeletableException {
+ return CdmStore.getService(IMediaService.class).delete(entity) != null;
+ }
+
+ @Override
+ protected List<Media> listEntities(IIdentifiableEntityServiceConfigurator configurator) {
+ return CdmStore.getSearchManager().findMedia(configurator);
+ }
+
+ @Override
+ protected IEntityCreator<Media> createEntityCreator() {
+ return new MediaCreator();
+ }
+
+ @Override
+ public void merge() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List<IBulkEditorSortProvider<Media>> getSortProviders() {
+ List<IBulkEditorSortProvider<Media>> sortProviders = super.getSortProviders();
+
+ sortProviders.add(0, new IdentifiableEntitySortProvider<Media>());
+
+ return sortProviders;
+ }
+}
public static String BulkEditorInputType_5;\r
public static String BulkEditorInputType_6;\r
public static String BulkEditorInputType_7;\r
+ public static String BulkEditorInputType_8;\r
static {\r
// initialize resource bundle\r
NLS.initializeMessages(BUNDLE_NAME, Messages.class);\r
// $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 eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
-import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
public class NameEditorInput extends AbstractBulkEditorInput<TaxonNameBase> {
/**
- *
+ *
*/
private static final long serialVersionUID = -3085029575759626823L;
private static NameEditorInput instance;
/** Constant <code>ID="bulkeditor.input.name"</code> */
public static final String ID = "bulkeditor.input.name";
-
+
/**
* <p>Getter for the field <code>instance</code>.</p>
*
}
return instance;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
*
* @return a {@link java.lang.String} object.
*/
- public String getName() {
+ @Override
+ public String getName() {
return BulkEditorInputType.NAME.label;
}
*
* @return a {@link java.lang.String} object.
*/
- public String getToolTipText() {
+ @Override
+ public String getToolTipText() {
return getName();
}
return CdmStore.getSearchManager().findNames(configurator);
}
- /** {@inheritDoc}
+ /** {@inheritDoc}
@Override
public TaxonNameBase loadEntity(UUID uuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return CdmStore.getService(INameService.class).load(uuid, propertyPaths);
}
*/
- /** {@inheritDoc}
+ /** {@inheritDoc}
**/
- public boolean delete(TaxonNameBase entity) {
+ @Override
+ public boolean delete(TaxonNameBase entity) {
return CdmStore.getService(INameService.class).delete(entity) != null;
}
/** {@inheritDoc} */
- public boolean save(TaxonNameBase entity) {
- return CdmStore.getService(INameService.class).saveOrUpdate(entity) != null;
+ @Override
+ public TaxonNameBase save(TaxonNameBase entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(INameService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(INameService.class).saveOrUpdate(entity);
+ return entity;
+ }
}
/* (non-Javadoc)
@Override
public List<IBulkEditorSortProvider<TaxonNameBase>> getSortProviders() {
List<IBulkEditorSortProvider<TaxonNameBase>> sortProviders = super.getSortProviders();
-
+
sortProviders.add(0, new IdentifiableEntitySortProvider<TaxonNameBase>());
-
+
return sortProviders;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
*/
}
return super.getTypeText(entity);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
return (entity).getFullTitleCache();
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
}
// $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.
*/
public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRelationship> {
/**
- *
+ *
*/
private static final long serialVersionUID = -7453923697752787687L;
}
return instance;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
*/
/** {@inheritDoc} */
@Override
- public boolean save(NameRelationship entity) {
+ public NameRelationship save(NameRelationship entity) {
// TODO Auto-generated method stub
- return false;
+ return null;
}
/* (non-Javadoc)
/** {@inheritDoc} */
@Override
protected NameRelationship loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return null; // CdmStore.getNameService().load(entityUuid, propertyPaths);
}
MessagingUtils.notImplementedMessage(getClass());
return null;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
*/
if(entity instanceof NameRelationship){
return ((NameRelationship) entity).getType().getTitleCache();
}
-
+
return super.getTypeText(entity);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
}
package eu.etaxonomy.taxeditor.bulkeditor.input;
-import java.util.Arrays;
import java.util.List;
-import java.util.UUID;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.OccurrenceCreator;
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
*/
- /** {@inheritDoc}
+ /** {@inheritDoc}
@Override
protected SpecimenOrObservationBase loadEntity(UUID entityUuid) {
List<String> propertyPaths = Arrays.asList(new String[]{});
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
*/
- /** {@inheritDoc}
+ /** {@inheritDoc}
* @throws ReferencedObjectUndeletableException */
@Override
public boolean delete(SpecimenOrObservationBase entity) throws ReferencedObjectUndeletableException {
*/
/** {@inheritDoc} */
@Override
- public boolean save(SpecimenOrObservationBase entity) {
- return CdmStore.getService(IOccurrenceService.class).save(entity) != null;
+ public SpecimenOrObservationBase<IIdentifiableEntityCacheStrategy> save(SpecimenOrObservationBase entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(IOccurrenceService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IOccurrenceService.class).save(entity);
+ return entity;
+ }
}
return sortProviders;
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
}
// $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.
*/
public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
/**
- *
+ *
*/
private static final long serialVersionUID = 3806243517765126749L;
/** Constant <code>ID="bulkeditor.input.reference"</code> */
public static final String ID = "bulkeditor.input.reference";
-
+
private static ReferenceEditorInput instance;
/**
public static String getID() {
return ID;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
*
* @return a {@link java.lang.String} object.
*/
- public String getName() {
+ @Override
+ public String getName() {
return BulkEditorInputType.REFERENCE.label;
}
*
* @return a {@link java.lang.String} object.
*/
- public String getToolTipText() {
+ @Override
+ public String getToolTipText() {
return getName();
}
public boolean isMergingEnabled() {
return true;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMarkerTypeEditingEnabled(eu.etaxonomy.cdm.model.common.MarkerType)
*/
return super.isMarkerTypeEditingEnabled(markerType);
}
-
+
/** {@inheritDoc} */
@Override
public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
return CdmStore.getSearchManager().findReferences(configurator);
}
-
+
// Entity persistence
-
+
/** {@inheritDoc} */
@Override
public Reference loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{"*", "inReference.*", "authorTeam.*"});
+ List<String> propertyPaths = Arrays.asList(new String[]{"*", "inReference.*", "authorTeam.*"});
return CdmStore.getService(IReferenceService.class).load(entityUuid, propertyPaths);
}
- /** {@inheritDoc}
+ /** {@inheritDoc}
* @throws ReferencedObjectUndeletableException */
- public boolean delete(Reference entity) throws ReferencedObjectUndeletableException {
+ @Override
+ public boolean delete(Reference entity) throws ReferencedObjectUndeletableException {
return CdmStore.getService(IReferenceService.class).delete(entity) != null;
}
/** {@inheritDoc} */
- public boolean save(Reference entity) {
- return CdmStore.getService(IReferenceService.class).saveOrUpdate(entity) != null;
+ @Override
+ public Reference save(Reference entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(IReferenceService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IReferenceService.class).saveOrUpdate(entity);
+ return entity;
+ }
}
/* (non-Javadoc)
protected IEntityCreator<Reference> createEntityCreator() {
return new ReferenceCreator();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getSortProviders()
*/
@Override
public List<IBulkEditorSortProvider<Reference>> getSortProviders() {
List<IBulkEditorSortProvider<Reference>> sortProviders = super.getSortProviders();
-
+
sortProviders.add(0, new IdentifiableEntitySortProvider<Reference>());
sortProviders.add(1, new ReferenceSortProvider());
-
+
return sortProviders;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getTypeText(java.lang.Object)
*/
return super.getTypeText(entity);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
}
import java.util.List;\r
import java.util.UUID;\r
\r
-import eu.etaxonomy.cdm.api.service.INameService;\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;\r
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;\r
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;\r
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
import eu.etaxonomy.cdm.model.taxon.Synonym;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.NameCreator;\r
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.TaxonCreator;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
private static TaxonEditorInput instance;\r
/** Constant <code>ID="bulkeditor.input.taxon"</code> */\r
public static final String ID = "bulkeditor.input.taxon";\r
- \r
- \r
- \r
+\r
+\r
+\r
/**\r
* <p>Getter for the field <code>instance</code>.</p>\r
*\r
if (instance == null) {\r
instance = new TaxonEditorInput();\r
}\r
- \r
+\r
return instance;\r
}\r
- \r
- \r
+\r
+\r
@Override\r
public String getName() {\r
return BulkEditorInputType.TAXON.label;\r
return getName();\r
}\r
\r
- \r
+\r
/**\r
* <p>getID</p>\r
*\r
public static Object getID() {\r
return ID;\r
}\r
- \r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()\r
*/\r
return false;\r
}\r
@Override\r
- public boolean save(TaxonBase entity) {\r
- return CdmStore.getService(ITaxonService.class).saveOrUpdate(entity) != null;\r
+ public TaxonBase save(TaxonBase entity) {\r
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
+ return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();\r
+ } else {\r
+ CdmStore.getService(ITaxonService.class).saveOrUpdate(entity);\r
+ return entity;\r
+ }\r
}\r
\r
- \r
+\r
\r
/** {@inheritDoc} */\r
@Override\r
List<TaxonBase> taxa = CdmStore.getSearchManager().findTaxa(configurator);\r
List<TaxonBase> taxaCopy = new ArrayList<TaxonBase>();\r
for (TaxonBase taxon:taxa){\r
- \r
+\r
if (taxon instanceof Taxon){\r
taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Taxon.class));\r
}else{\r
\r
@Override\r
protected TaxonBase loadEntity(UUID entityUuid) {\r
- List<String> propertyPaths = Arrays.asList(new String[]{}); \r
+ List<String> propertyPaths = Arrays.asList(new String[]{});\r
return CdmStore.getService(ITaxonService.class).load(entityUuid, propertyPaths);\r
}\r
\r
- \r
\r
- /** {@inheritDoc} \r
+\r
+ /** {@inheritDoc}\r
* @throws ReferencedObjectUndeletableException */\r
- public boolean delete(TaxonBase entity) {\r
+ @Override\r
+ public boolean delete(TaxonBase entity) {\r
return CdmStore.getService(ITaxonService.class).delete(entity) != null;\r
}\r
@Override\r
return new TaxonCreator();\r
}\r
\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()\r
+ */\r
+ @Override\r
+ public void merge() {\r
+\r
+ }\r
+\r
}\r
// $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 eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
public class UserEditorInput extends AbstractBulkEditorInput<User> {
public static final String ID = "bulkeditor.input.user";
-
+
private static UserEditorInput instance;
-
+
/**
* @return the instance
*/
}
return instance;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
@Override
- public boolean save(User entity) {
- return CdmStore.getService(IUserService.class).saveOrUpdate(entity) != null;
+ public User save(User entity) {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ return CdmStore.getService(IUserService.class).merge(entity, true).getMergedEntity();
+ } else {
+ CdmStore.getService(IUserService.class).saveOrUpdate(entity);
+ return entity;
+ }
+
}
/* (non-Javadoc)
return CdmStore.getSearchManager().findUsers(configurator);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
-
+
@Override
protected User loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
}
*/
protected IEntityCreator<User> createEntityCreator() {
return new UserCreator();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
return String.format("%s, %s", entity.getUsername(), entity.getPerson());
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+
+ }
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+
+/**
+ * @author k.luther
+ * @date 10.03.2016
+ *
+ */
+public class MediaCreator implements IEntityCreator<Media> {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Media createEntity(String text) {
+ Media result = Media.NewInstance();
+ result.setTitleCache(text);
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Media createEntity(Object key, String text) {
+ if (key.equals(Media.class)){
+ Media result = Media.NewInstance();
+ result.setTitleCache(text);
+ return result;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Object, String> getKeyLabelPairs() {
+ Map<Object, String> result = new HashMap<Object, String>();
+ result.put(Media.class, "Media");
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean savesEntity() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
// $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.
*/
public User createEntity(Object key, String text) {
try{
User user = User.NewInstance(text, text);
- CdmStore.getService(IUserService.class).createUser(user);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IUserService.class).createUser(user);
+ user = CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
+ } else {
+ CdmStore.getService(IUserService.class).createUser(user);
+ }
return user;
} catch (AccessDeniedException e){
MessagingUtils.messageDialog("Access denied", getClass(), e.getMessage(), e);
package eu.etaxonomy.taxeditor.bulkeditor.preference;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.TermStore;
/**
- * <p>BulkEditorMarkerPreferenceComposite class.</p>
- *
* @author p.ciardelli
* @created 17.08.2009
* @version 1.0
*/
-public class BulkEditorMarkerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+public class BulkEditorMarkerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- private Map<MarkerType, Boolean> markerTypeEditingMap = new HashMap<MarkerType, Boolean>();
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(PreferencesUtil.getPreferenceStore());
if(!CdmStore.isActive()) {
MessagingUtils.noDataSourceWarningDialog(null);
- }else{
- markerTypeEditingMap = PreferencesUtil.getEditMarkerTypePreferences();
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new GridLayout());
+ @Override
+ protected void createFieldEditors() {
if(CdmStore.isActive()){
for (final MarkerType markerType : TermStore.getTerms(MarkerType.class)) {
- final Button button = new Button(container, SWT.CHECK);
- button.setText(String.format("Edit '%s' markers", markerType.getLabel()));
-
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- markerTypeEditingMap.put(markerType, button.getSelection());
- }
- });
-
- boolean edit = markerTypeEditingMap.get(markerType) == null ? true : markerTypeEditingMap.get(markerType);
-
- button.setSelection(edit);
+ addField(new BooleanFieldEditor(IPreferenceKeys.EDIT_MARKER_TYPE_PREFIX
+ + markerType.getClass().getName() + markerType.getLabel(), String.format("Edit '%s' markers",
+ markerType.getLabel()), getFieldEditorParent()));
}
}
- return container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- PreferencesUtil.setEditMarkerTypePreferences(markerTypeEditingMap);
- return super.performOk();
- }
+ }
}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbenchPart;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.api.service.IEventBaseService;
import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.EventBase;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
-import eu.etaxonomy.taxeditor.model.LineSelection;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
/**
- * <p>ReferencingObjectsView class.</p>
- *
* @author p.ciardelli
* @created 08.07.2009
* @version 1.0
*/
-public class ReferencingObjectsView extends AbstractCdmViewPart{
+public class ReferencingObjectsView extends AbstractCdmViewPart {
private static final Logger logger = Logger
.getLogger(ReferencingObjectsView.class);
- /** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
private TableViewer viewer;
private String referencedObjectTitleCache;
private ConversationHolder conversation;
+ private final ICdmEntitySession cdmEntitySession;
+
+ public ReferencingObjectsView() {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
+ }
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createViewer(Composite parent) {
viewer.setContentProvider(new ReferencingObjectsContentProvider());
viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
viewer.setCellModifier(new ICellModifier() {
-
@Override
public void modify(Object element, String property, Object value) {
- // TODO Auto-generated method stub
-
}
@Override
return true;
}
});
-// viewer.setInput(new ArrayList<CdmBase>());
+
+ //create context menu
+ MenuManager menuManager = new MenuManager();
+ getSite().registerContextMenu(menuManager, viewer);
+ Control control = viewer.getControl();
+ Menu menu = menuManager.createContextMenu(control);
+ control.setMenu(menu);
+
+ // Propagate selection from viewer
+ getSite().setSelectionProvider(viewer);
}
/**
viewer.setColumnProperties(titles);
}
- /**
- * <p>updateReferencingObjects</p>
- *
- * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
- */
+ @Override
+ public void setFocus() {
+ cdmEntitySession.bind();
+ }
+
public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
final Display display = Display.getCurrent();
@Override
public void run() {
if (entityUUID != null){
-
+ ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ cdmEntitySession.bind();
List<CdmBase> referencingObjects = getReferencingObjects(entityUUID, objectClass);
-
+ if(previousCdmEntitySession != null) {
+ previousCdmEntitySession.bind();
+ }
updateView(referencingObjects);
}
referencedObject = CdmStore.getService(IUserService.class).load(entity);
} else if (objectClass.isAssignableFrom(Group.class)){
referencedObject = CdmStore.getService(IGroupService.class).load(entity);
- }
+ } else if (objectClass.isAssignableFrom(Media.class)){
+ referencedObject = CdmStore.getService(IMediaService.class).load(entity);
+ } else if (DescriptionBase.class.isAssignableFrom(objectClass)){
+ referencedObject = CdmStore.getService(IDescriptionService.class).load(entity);
+ } else if (DescriptionElementBase.class.isAssignableFrom(objectClass)){
+ referencedObject = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(entity, null);
+ } else if (objectClass.equals(Sequence.class)){
+ referencedObject = CdmStore.getService(ISequenceService.class).load(entity, null);
+ } else if (EventBase.class.isAssignableFrom(objectClass)){
+ referencedObject = CdmStore.getService(IEventBaseService.class).load(entity, null);
+ }
//referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
Set<CdmBase> setOfReferencingObjects = null;
if (referencedObject != null){
- referencedObjectTitleCache = ((IdentifiableEntity)referencedObject).getTitleCache();
+ if(referencedObject.isInstanceOf(IdentifiableEntity.class)){
+ referencedObjectTitleCache = (HibernateProxyHelper.deproxy(referencedObject, IdentifiableEntity.class)).getTitleCache();
+ }
+ else if(referencedObject.isInstanceOf(DescriptionElementBase.class)){
+ referencedObjectTitleCache = DescriptionHelper.getLabel(referencedObject);
+ }
+ else{
+ referencedObjectTitleCache = null;
+ }
setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjects(referencedObject);
}
if (setOfReferencingObjects != null){
}
} catch (Exception e) {
logger.error("Error retrieving referencing objects", e);
+ setContentDescription("The referencing objects view could not be loaded completely. Some Problems occured.");
}
return null;
}
class ReferencingClassComparator implements Comparator<CdmBase> {
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
@Override
public int compare(CdmBase o1, CdmBase o2) {
String string1 = o1.getClass().getSimpleName();
}
}
- /**
- *
- */
private void updateView(List<CdmBase> referencingObjects) {
if (viewer != null && !viewer.getControl().isDisposed()){
try{
/** {@inheritDoc} */
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if(! (part instanceof BulkEditor)){
- setContentDescription("");
- showEmptyPage();
- return;
- }
-
- if(! (selection instanceof LineSelection)){
- return;
- }
- LineSelection lineSelection = (LineSelection) selection;
-
- if(lineSelection.size() != 1){
- return;
- }
-
- if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){
- return;
- }
-
- showViewer(part, lineSelection);
+ if(part == this){
+ return;
+ }
+ if(selection instanceof IStructuredSelection){
+ showViewer(part, (IStructuredSelection) selection);
+ }
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
/** {@inheritDoc} */
@Override
public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
// this.part = part;
- updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() );
+ Object firstElement = selection.getFirstElement();
+ if(firstElement instanceof TreeNode){
+ firstElement = ((TreeNode) firstElement).getValue();
+ }
+ if(firstElement instanceof CdmBase){
+ updateReferencingObjects(((CdmBase) firstElement).getUuid(),firstElement.getClass() );
+ }
+ else{
+ updateView(null);
+ setContentDescription("");
+ }
}
/** {@inheritDoc} */
conversation.close();
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
+ cdmEntitySession.dispose();
super.dispose();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#getViewer()
- */
/** {@inheritDoc} */
@Override
public Viewer getViewer() {
return viewer;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#dirtyStateChanged()
- */
/** {@inheritDoc} */
@Override
public void changed(Object object) {
// no editing in this view
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
- */
/** {@inheritDoc} */
@Override
public boolean onComplete() {
}
public void refresh(){
-
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
selectionService.addPostSelectionListener(this);
}
-
}
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.8.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.8.0-SNAPSHOT.jar" sourcepath="lib/cdmlib-services-3.8.0-SNAPSHOT-sources.jar"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry kind="src" path="src/main/java"/>\r
- <classpathentry kind="src" path="src/main/resources"/>\r
- <classpathentry exported="true" kind="lib" path="lib/activation-1.1.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.7.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.7.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/avro-1.6.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-anim-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-awt-util-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-bridge-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-css-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-dom-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-ext-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-extension-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-gvt-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-js-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-parser-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-script-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-svg-dom-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-svggen-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-transcoder-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-util-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.2.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.aopalliance-1.0.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.logging-1.1.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-codec-20041127.091804.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.6.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.1.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.5.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/concurrent-1.3.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/dbunit-2.4.9.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/doxia-core-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/doxia-logging-api-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/doxia-module-apt-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/doxia-module-xhtml-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/doxia-sink-api-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/dozer-5.3.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/easymock-3.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/easymockclassextension-2.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/ehcache-core-2.6.9.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/ezmorph-1.0.6.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/fop-1.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/guava-r05.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/h2-1.3.170.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-c3p0-4.1.10.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-cglib-repack-2.1_3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-commons-annotations-4.0.1.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-core-4.1.10.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-ehcache-4.1.10.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-entitymanager-4.1.10.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-envers-4.1.10.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-search-4.2.0.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-search-analyzers-4.2.0.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-search-engine-4.2.0.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-search-orm-4.2.0.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hibernate-validator-4.3.1.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/hsqldb-1.8.0.10.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/httpclient-4.2.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/httpcore-4.2.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/icu4j-2.6.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/identificationKeyAPI-1.0-SNAPSHOT.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/itextpdf-5.4.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jackson-core-asl-1.8.8.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jackson-mapper-asl-1.8.8.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jakarta-regexp-1.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/javassist-3.17.1-GA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jaxb-api-2.2.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jaxb-impl-2.2-EA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jaxb-xjc-2.2-EA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jaxb1-impl-2.2-EA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jboss-logging-3.1.3.GA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jdbc4-2.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jdom-1.1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/joda-time-2.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/json-lib-2.4-jdk15.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jsr250-api-1.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jtds-1.3.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/junit-4.11.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/junit-benchmarks-0.5.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lsid-client-1.1.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lsid-server-1.1.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-core-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-facet-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-grouping-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-highlighter-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-kuromoji-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-memory-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-misc-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-phonetic-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-queries-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-smartcn-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-spatial-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-spellchecker-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/lucene-stempel-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/mchange-commons-java-0.2.3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.1.24.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/objenesis-1.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/odfdom-java-0.8.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/ognl-2.6.9.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/opencsv-2.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.eclipse.equinox.common-3.6.0.v20110523.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.osgi.core-1.0.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.aop-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.aspects-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.core-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.expression-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.jdbc-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.orm-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.oxm-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.test-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.transaction-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/org.springframework.web.servlet-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/osgi-3.6.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/p6spy-1.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/paranamer-2.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/plexus-classworlds-1.2-alpha-9.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/plexus-container-default-1.0-alpha-30.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/plexus-utils-2.0.5.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/postgresql-9.1-901.jdbc4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/sanselan-0.97-incubator.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/servlet-api-2.5.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.7.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/snappy-java-1.0.4.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/solr-analysis-extras-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/solr-core-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/solr-solrj-3.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-aop-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-beans-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-context-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-context-support-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-core-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-expression-3.2.2.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-modules-cache-0.7.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-security-config-3.1.3.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.1.3.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-easymock-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-inject-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-mock-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-orm-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.3.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/usertype.jodatime-2.0.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/usertype.spi-2.0.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xalan-2.6.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.11.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xml-apis-1.0.b2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xml-resolver-1.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xmlgraphics-commons-1.5.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xmlParserAPIs-2.6.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xmlpull-1.1.3.1.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xmlunit-1.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xom-1.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xpp3_min-1.1.4c.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xpp3-1.1.4c.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xstream-1.4.4.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/yjp-controller-api-redist-9.0.8.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/google-api-translate-java-0.92.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/odfdom-0.8.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/h2mig_pagestore_addon.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/poi-3.10-FINAL.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.10-FINAL.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.10-FINAL.jar"/>\r
- <classpathentry exported="true" kind="lib" path="lib/swagger-annotations-1.3.5.jar"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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 kind="src" path="src/main/resources"/>
+ <classpathentry exported="true" kind="lib" path="lib/activation-1.1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/apache-log4j-extras-1.2.17.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.8.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.8.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/avro-1.6.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-anim-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-awt-util-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-bridge-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-css-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-dom-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-ext-1.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-extension-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-gvt-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-js-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-parser-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-script-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-svg-dom-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-svggen-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-transcoder-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-util-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.5.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.0.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cglib-3.2.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cglib-nodep-3.2.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/classmate-1.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/codemodel-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.aopalliance-1.0.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.9.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-csv-1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.3.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.5.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/concurrent-1.3.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dbunit-2.4.9.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/doxia-core-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/doxia-logging-api-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/doxia-module-apt-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/doxia-module-xhtml-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/doxia-sink-api-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dozer-5.3.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dtd-parser-1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/easymock-2.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/easymockclassextension-2.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/ehcache-core-2.6.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/ezmorph-1.0.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/FastInfoset-1.2.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/fop-1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/google-api-translate-java-0.92.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/guava-19.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/h2-1.4.190.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/h2mig_pagestore_addon.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-c3p0-5.0.7.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-5.0.1.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-core-5.0.7.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-ehcache-5.0.7.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-entitymanager-5.0.7.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-envers-5.0.7.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-jpa-2.1-api-1.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-search-4.2.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-search-analyzers-4.2.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-search-engine-5.5.2.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-search-orm-5.5.2.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-validator-5.2.2.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate-validator-cdi-5.2.2.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hsqldb-2.3.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpclient-4.5.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpclient-cache-4.2.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpcore-4.4.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/httpmime-4.5.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/icu4j-2.6.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/identificationKeyAPI-1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/istack-commons-runtime-2.21.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/istack-commons-tools-2.21.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/itextpdf-5.5.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jackson-annotations-2.6.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jackson-core-2.6.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jackson-core-asl-1.8.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jackson-databind-2.6.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jackson-mapper-asl-1.8.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jakarta-regexp-1.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jandex-2.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javassist-3.20.0-GA.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javax.el-2.2.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javax.el-api-2.2.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb-api-2.2.12.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb-core-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb-jxc-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb-xjc-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxb1-impl-2.2-EA.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jboss-logging-3.3.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j-1.7.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jdbc4-2.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jdom-1.1.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jdom2-2.0.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jena-arq-2.13.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jena-core-2.13.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jena-iri-1.1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jena-tdb-1.1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/joda-time-2.9.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/json-20090211.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/json-lib-2.4-jdk15.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jsonld-java-0.5.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jsr250-api-1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jta-1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jtds-1.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/junit-4.12.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/junit-benchmarks-0.7.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/libthrift-0.9.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lsid-client-1.1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lsid-server-1.1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-analyzers-common-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-backward-codecs-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-core-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-facet-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-grouping-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-highlighter-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-join-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-memory-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-misc-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-queries-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-queryparser-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-sandbox-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/lucene-suggest-5.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mapstruct-1.0.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mchange-commons-java-0.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.1.38.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/objenesis-1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/odfdom-0.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/odfdom-java-0.8.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/ognl-2.6.9.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/opencsv-2.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/org.osgi.core-1.0.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/osgi-3.6.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/p6spy-2.1.4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/paranamer-2.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/plexus-classworlds-1.2-alpha-9.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/plexus-component-annotations-1.5.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/plexus-container-default-1.0-alpha-30.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/plexus-utils-3.0.15.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-3.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/postgresql-9.4-1206-jdbc4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/relaxngDatatype-20020414.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/rngom-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/sanselan-0.97-incubator.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/Saxon-HE-9.7.0-2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/servlet-api-2.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.7.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/slf4j-nop-1.7.13.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/snappy-java-1.0.4.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/solr-analysis-extras-3.6.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/solr-core-3.6.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/solr-solrj-3.6.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-aop-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-aspects-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-beans-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-context-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-context-support-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-core-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-expression-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-jdbc-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-modules-cache-0.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-orm-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-oxm-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-plugin-core-1.2.0.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-plugin-metadata-1.2.0.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-security-config-4.0.3.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-security-core-4.0.3.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-security-web-4.0.3.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-test-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-tx-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-web-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/spring-webmvc-4.2.4.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-core-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-schema-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-spi-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-spring-web-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-swagger-common-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/springfox-swagger2-2.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/standard-1.1.2.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/stax-ex-1.7.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/swagger-annotations-1.5.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/swagger-models-1.5.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tools.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/txw2-2.2.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-easymock-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-inject-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-mock-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-orm-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.4.2.jar"/>
+ <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.1.0.Final.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xalan-2.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xml-apis-1.0.b2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xml-resolver-1.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.6.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xmlgraphics-commons-1.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xmlpull-1.1.3.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xmlunit-1.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xom-1.2.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xpp3_min-1.1.4c.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xpp3-1.1.4c.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xsom-20140925.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/xstream-1.4.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/yjp-controller-api-redist-9.0.8.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
-bin
\ No newline at end of file
+bin
+/target/
+/target/
+/target/
+/target/
Bundle-ManifestVersion: 2
Bundle-Name: CDM Library Dependencies Plugin
Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Eclipse-BundleShape: dir
Export-Package: com.google.api,
com.google.api.detect,
com.google.api.translate,
+ eu.etaxonomy.cdm,
eu.etaxonomy.cdm.api.application,
+ eu.etaxonomy.cdm.api.cache,
eu.etaxonomy.cdm.api.conversation,
eu.etaxonomy.cdm.api.facade,
- eu.etaxonomy.cdm.api.lazyloading,
eu.etaxonomy.cdm.api.service,
eu.etaxonomy.cdm.api.service.config,
eu.etaxonomy.cdm.api.service.description,
eu.etaxonomy.cdm.ext.occurrence.gbif,
eu.etaxonomy.cdm.ext.openurl,
eu.etaxonomy.cdm.ext.sru,
+ eu.etaxonomy.cdm.format,
eu.etaxonomy.cdm.hibernate,
eu.etaxonomy.cdm.hibernate.search,
eu.etaxonomy.cdm.io.api.application,
eu.etaxonomy.cdm.io.sdd.ikeyplus,
eu.etaxonomy.cdm.io.sdd.in,
eu.etaxonomy.cdm.io.sdd.out,
+ eu.etaxonomy.cdm.io.service,
eu.etaxonomy.cdm.io.specimen,
eu.etaxonomy.cdm.io.specimen.abcd206.in,
eu.etaxonomy.cdm.io.specimen.excel.in,
eu.etaxonomy.cdm.persistence.dao.hibernate.occurrence,
eu.etaxonomy.cdm.persistence.dao.hibernate.reference,
eu.etaxonomy.cdm.persistence.dao.hibernate.taxon,
- eu.etaxonomy.cdm.persistence.dao.hibernate.validation,
eu.etaxonomy.cdm.persistence.dao.hibernate.view,
eu.etaxonomy.cdm.persistence.dao.media,
eu.etaxonomy.cdm.persistence.dao.name,
eu.etaxonomy.cdm.print.out.pdf,
eu.etaxonomy.cdm.print.out.taxpub,
eu.etaxonomy.cdm.print.out.xml,
- eu.etaxonomy.cdm.remote,
eu.etaxonomy.cdm.remote.config,
eu.etaxonomy.cdm.remote.controller,
eu.etaxonomy.cdm.remote.controller.dto,
eu.etaxonomy.cdm.strategy.merge,
eu.etaxonomy.cdm.strategy.parser,
eu.etaxonomy.cdm.strategy.parser.location,
+ eu.etaxonomy.cdm.test.integration,
eu.etaxonomy.cdm.validation,
eu.etaxonomy.cdm.validation.annotation,
eu.etaxonomy.cdm.validation.constraint,
eu.etaxonomy.remote.dto.rdf,
+ eu.etaxonomy.taxeditor.remoting,
+ eu.etaxonomy.taxeditor.remoting.cache,
+ eu.etaxonomy.taxeditor.remoting.server,
+ eu.etaxonomy.taxeditor.remoting.source,
+ eu.etaxonomy.taxeditor.service,
+ eu.etaxonomy.taxeditor.session,
+ eu.etaxonomy.taxeditor.session.mock,
+ javassist.util.proxy,
javax.persistence,
junit.framework;uses:="org.junit.runner.manipulation,org.junit.runner,org.junit.runner.notification",
+ net.sf.ehcache,
+ net.sf.ehcache.config,
+ net.sf.ehcache.statistics,
+ net.sf.ehcache.store,
net.sf.json;uses:="net.sf.json.processors,net.sf.json.util,org.apache.commons.lang.exception",
+ org.aopalliance.aop,
org.apache.commons.collections;uses:="org.apache.commons.collections.keyvalue,new org.apache.commons.collections",
+ org.apache.commons.collections.buffer,
+ org.apache.commons.dbcp,
org.apache.commons.io;uses:="org.apache.commons.io.filefilter",
org.apache.commons.lang;uses:="org.apache.commons.lang.exception",
org.apache.commons.lang.exception,
+ org.apache.commons.lang.text,
+ org.apache.commons.logging,
org.apache.fop.apps,
org.apache.http,
org.apache.http.client,
+ org.apache.http.util,
org.apache.log4j;uses:="org.apache.log4j.helpers,org.apache.log4j.or,org.apache.log4j.spi",
org.apache.log4j.chainsaw;
uses:="org.apache.log4j,
org.w3c.dom,
org.xml.sax",
org.apache.lucene.index,
- org.apache.lucene.queryParser,
+ org.apache.lucene.queryparser.classic,
org.apache.lucene.util,
org.apache.sanselan;uses:="org.apache.sanselan.common,org.apache.sanselan.common.byteSources",
org.apache.xerces.dom,
org.hibernate,
org.hibernate.annotations.common.reflection,
org.hibernate.cache.internal,
+ org.hibernate.cfg,
org.hibernate.classic,
org.hibernate.collection.internal,
+ org.hibernate.collection.spi,
org.hibernate.criterion,
+ org.hibernate.engine.internal,
+ org.hibernate.engine.spi,
+ org.hibernate.engine.transaction.spi,
org.hibernate.envers.query.criteria,
+ org.hibernate.internal,
+ org.hibernate.internal.util,
+ org.hibernate.internal.util.collections,
+ org.hibernate.mapping,
+ org.hibernate.persister.collection,
+ org.hibernate.persister.entity,
+ org.hibernate.pretty,
org.hibernate.proxy,
+ org.hibernate.proxy.pojo.javassist,
org.hibernate.search,
org.hibernate.search.spatial.impl,
+ org.hibernate.type,
org.jadira.usertype.dateandtime.joda,
org.jadira.usertype.dateandtime.shared.spi,
org.jboss.logging,
org.odftoolkit.odfdom.dom.element,
org.odftoolkit.odfdom.dom.element.style,
org.odftoolkit.odfdom.dom.style,
+ org.slf4j,
+ org.springframework.aop,
+ org.springframework.aop.framework,
+ org.springframework.beans,
org.springframework.beans.factory,
org.springframework.beans.factory.annotation;
uses:="org.apache.commons.logging,
org.springframework.beans.factory.wiring,
org.springframework.core.type,
org.springframework.beans.factory",
+ org.springframework.beans.factory.config,
+ org.springframework.beans.factory.support,
+ org.springframework.beans.factory.xml,
org.springframework.cache.ehcache,
org.springframework.context;
uses:="org.springframework.core.io,
org.springframework.core.io.support,
org.springframework.beans.factory.config,
org.springframework.beans.factory",
+ org.springframework.context.config,
org.springframework.context.event;
uses:="org.springframework.core,
org.aopalliance.intercept,
org.springframework.context,
org.springframework.beans.factory",
+ org.springframework.context.support,
org.springframework.core;uses:="org.springframework.util",
+ org.springframework.core.env,
org.springframework.core.io;uses:="org.jboss.virtual",
+ org.springframework.core.io.support,
org.springframework.core.type.classreading,
+ org.springframework.jdbc.datasource,
org.springframework.orm.hibernate3;
uses:="org.apache.commons.logging,
org.aopalliance.intercept,
org.springframework.dao,
org.springframework.transaction.support",
org.springframework.orm.hibernate4,
+ org.springframework.remoting,
+ org.springframework.remoting.httpinvoker,
+ org.springframework.remoting.support,
org.springframework.security.access,
org.springframework.security.authentication,
+ org.springframework.security.authentication.dao,
+ org.springframework.security.authentication.encoding,
org.springframework.security.authentication.event,
+ org.springframework.security.config,
org.springframework.security.core,
org.springframework.security.core.context,
org.springframework.security.core.userdetails,
org.springframework.security.provisioning,
- org.springframework.security.remoting.httpinvoker,
org.springframework.stereotype,
org.springframework.transaction;uses:="org.springframework.core",
org.springframework.transaction.annotation;uses:="javax.ejb,org.springframework.transaction.interceptor",
org.springframework.transaction,
org.apache.commons.logging,
org.springframework.beans.factory",
+ org.springframework.util,
org.springframework.web.servlet;
uses:="org.springframework.web.multipart,
org.apache.commons.logging,
org.springframework.ui,
javax.servlet.http"
Bundle-Vendor: EDIT
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.osgi,
- org.eclipse.equinox.common
+ org.eclipse.equinox.common,
+ org.apache.commons.httpclient;bundle-version="3.1.0",
+ org.eclipse.core.runtime
Bundle-ClassPath: .,
lib/activation-1.1.1.jar,
lib/antlr-2.7.7.jar,
lib/aopalliance-1.0.jar,
- lib/aspectjrt-1.7.1.jar,
- lib/aspectjweaver-1.7.1.jar,
+ lib/apache-log4j-extras-1.2.17.jar,
+ lib/aspectjrt-1.8.8.jar,
+ lib/aspectjweaver-1.8.8.jar,
lib/avro-1.6.3.jar,
lib/batik-anim-1.7.jar,
lib/batik-awt-util-1.7.jar,
lib/batik-bridge-1.7.jar,
lib/batik-css-1.7.jar,
lib/batik-dom-1.7.jar,
- lib/batik-ext-1.7.jar,
+ lib/batik-ext-1.8.jar,
lib/batik-extension-1.7.jar,
lib/batik-gvt-1.7.jar,
lib/batik-js-1.7.jar,
lib/batik-transcoder-1.7.jar,
lib/batik-util-1.7.jar,
lib/batik-xml-1.7.jar,
- lib/c3p0-0.9.2.jar,
- lib/cglib-nodep-2.2.2.jar,
+ lib/c3p0-0.9.5.2.jar,
+ lib/cdmlib-commons-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-ext-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-io-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-model-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-persistence-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-print-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-remote-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-services-4.0.0-SNAPSHOT.jar,
+ lib/cdmlib-test-4.0.0-SNAPSHOT.jar,
+ lib/cglib-3.2.0.jar,
+ lib/cglib-nodep-3.2.0.jar,
+ lib/classmate-1.3.1.jar,
+ lib/codemodel-2.2.11.jar,
lib/com.springsource.org.aopalliance-1.0.0.jar,
lib/com.springsource.org.apache.commons.logging-1.1.1.jar,
- lib/commons-beanutils-1.8.3.jar,
- lib/commons-codec-20041127.091804.jar,
- lib/commons-collections-3.2.1.jar,
+ lib/commons-beanutils-1.9.2.jar,
+ lib/commons-codec-1.10.jar,
+ lib/commons-collections-3.2.2.jar,
+ lib/commons-csv-1.0.jar,
lib/commons-dbcp-1.4.jar,
lib/commons-io-2.4.jar,
lib/commons-lang-2.6.jar,
- lib/commons-logging-1.1.2.jar,
+ lib/commons-lang3-3.3.2.jar,
+ lib/commons-logging-1.2.jar,
lib/commons-pool-1.5.4.jar,
lib/concurrent-1.3.4.jar,
lib/dbunit-2.4.9.jar,
lib/dom4j-1.6.1.jar,
- lib/doxia-core-1.3.jar,
- lib/doxia-logging-api-1.3.jar,
- lib/doxia-module-apt-1.3.jar,
- lib/doxia-module-xhtml-1.3.jar,
- lib/doxia-sink-api-1.3.jar,
+ lib/doxia-core-1.6.jar,
+ lib/doxia-logging-api-1.6.jar,
+ lib/doxia-module-apt-1.6.jar,
+ lib/doxia-module-xhtml-1.6.jar,
+ lib/doxia-sink-api-1.6.jar,
lib/dozer-5.3.0.jar,
- lib/easymock-3.1.jar,
+ lib/dtd-parser-1.1.jar,
+ lib/easymock-2.3.jar,
lib/easymockclassextension-2.3.jar,
- lib/ehcache-core-2.6.9.jar,
+ lib/ehcache-core-2.6.11.jar,
lib/ezmorph-1.0.6.jar,
+ lib/FastInfoset-1.2.13.jar,
lib/fop-1.1.jar,
- lib/guava-r05.jar,
- lib/h2-1.3.170.jar,
+ lib/google-api-translate-java-0.92.jar,
+ lib/guava-19.0.jar,
+ lib/h2-1.4.190.jar,
+ lib/h2mig_pagestore_addon.jar,
lib/hamcrest-core-1.3.jar,
- lib/hibernate-c3p0-4.1.10.Final.jar,
+ lib/hibernate-c3p0-5.0.7.Final.jar,
lib/hibernate-cglib-repack-2.1_3.jar,
- lib/hibernate-commons-annotations-4.0.1.Final.jar,
- lib/hibernate-core-4.1.10.Final.jar,
- lib/hibernate-ehcache-4.1.10.Final.jar,
- lib/hibernate-entitymanager-4.1.10.Final.jar,
- lib/hibernate-envers-4.1.10.Final.jar,
- lib/hibernate-jpa-2.0-api-1.0.1.Final.jar,
+ lib/hibernate-commons-annotations-5.0.1.Final.jar,
+ lib/hibernate-core-5.0.7.Final.jar,
+ lib/hibernate-ehcache-5.0.7.Final.jar,
+ lib/hibernate-entitymanager-5.0.7.Final.jar,
+ lib/hibernate-envers-5.0.7.Final.jar,
+ lib/hibernate-jpa-2.1-api-1.0.0.Final.jar,
lib/hibernate-search-4.2.0.Final.jar,
lib/hibernate-search-analyzers-4.2.0.Final.jar,
- lib/hibernate-search-engine-4.2.0.Final.jar,
- lib/hibernate-search-orm-4.2.0.Final.jar,
- lib/hibernate-validator-4.3.1.Final.jar,
- lib/hsqldb-1.8.0.10.jar,
- lib/httpclient-4.2.3.jar,
- lib/httpcore-4.2.4.jar,
+ lib/hibernate-search-engine-5.5.2.Final.jar,
+ lib/hibernate-search-orm-5.5.2.Final.jar,
+ lib/hibernate-validator-5.2.2.Final.jar,
+ lib/hibernate-validator-cdi-5.2.2.Final.jar,
+ lib/hsqldb-2.3.3.jar,
+ lib/httpclient-4.5.1.jar,
+ lib/httpclient-cache-4.2.6.jar,
+ lib/httpcore-4.4.4.jar,
+ lib/httpmime-4.5.1.jar,
lib/icu4j-2.6.1.jar,
- lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar,
- lib/identificationKeyAPI-1.0-SNAPSHOT.jar,
- lib/itextpdf-5.4.0.jar,
+ lib/identificationKeyAPI-1.0.jar,
+ lib/istack-commons-runtime-2.21.jar,
+ lib/istack-commons-tools-2.21.jar,
+ lib/itextpdf-5.5.8.jar,
+ lib/jackson-annotations-2.6.5.jar,
+ lib/jackson-core-2.6.5.jar,
lib/jackson-core-asl-1.8.8.jar,
+ lib/jackson-databind-2.6.5.jar,
lib/jackson-mapper-asl-1.8.8.jar,
lib/jakarta-regexp-1.4.jar,
- lib/javassist-3.17.1-GA.jar,
- lib/jaxb-api-2.2.7.jar,
- lib/jaxb-impl-2.2-EA.jar,
- lib/jaxb-xjc-2.2-EA.jar,
+ lib/jandex-2.0.0.Final.jar,
+ lib/javassist-3.20.0-GA.jar,
+ lib/javax.el-2.2.6.jar,
+ lib/javax.el-api-2.2.5.jar,
+ lib/javax.servlet-api-3.1.0.jar,
+ lib/jaxb-api-2.2.12.jar,
+ lib/jaxb-core-2.2.11.jar,
+ lib/jaxb-jxc-2.2.11.jar,
+ lib/jaxb-runtime-2.2.11.jar,
+ lib/jaxb-xjc-2.2.11.jar,
lib/jaxb1-impl-2.2-EA.jar,
lib/jaxen-1.1.4.jar,
- lib/jboss-logging-3.1.3.GA.jar,
+ lib/jaxen-1.1.6.jar,
+ lib/jboss-logging-3.3.0.Final.jar,
lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar,
+ lib/jcl-over-slf4j-1.7.6.jar,
lib/jdbc4-2.0.jar,
lib/jdom-1.1.3.jar,
- lib/joda-time-2.1.jar,
+ lib/jdom2-2.0.6.jar,
+ lib/jena-arq-2.13.0.jar,
+ lib/jena-core-2.13.0.jar,
+ lib/jena-iri-1.1.2.jar,
+ lib/jena-tdb-1.1.2.jar,
+ lib/joda-time-2.9.1.jar,
+ lib/json-20090211.jar,
lib/json-lib-2.4-jdk15.jar,
+ lib/jsonld-java-0.5.1.jar,
lib/jsr250-api-1.0.jar,
- lib/jtds-1.3.0.jar,
- lib/junit-4.11.jar,
- lib/junit-benchmarks-0.5.0.jar,
+ lib/jta-1.1.jar,
+ lib/jtds-1.3.1.jar,
+ lib/junit-4.12.jar,
+ lib/junit-benchmarks-0.7.2.jar,
+ lib/libthrift-0.9.2.jar,
lib/log4j-1.2.17.jar,
lib/lsid-client-1.1.2.jar,
lib/lsid-server-1.1.2.jar,
- lib/lucene-analyzers-3.6.2.jar,
- lib/lucene-core-3.6.2.jar,
- lib/lucene-facet-3.6.2.jar,
- lib/lucene-grouping-3.6.2.jar,
- lib/lucene-highlighter-3.6.2.jar,
- lib/lucene-kuromoji-3.6.2.jar,
- lib/lucene-memory-3.6.2.jar,
- lib/lucene-misc-3.6.2.jar,
- lib/lucene-phonetic-3.6.2.jar,
- lib/lucene-queries-3.6.2.jar,
- lib/lucene-smartcn-3.6.2.jar,
- lib/lucene-spatial-3.6.2.jar,
- lib/lucene-spellchecker-3.6.2.jar,
- lib/lucene-stempel-3.6.2.jar,
- lib/mchange-commons-java-0.2.3.3.jar,
- lib/mysql-connector-java-5.1.24.jar,
+ lib/lucene-analyzers-common-5.4.1.jar,
+ lib/lucene-backward-codecs-5.4.1.jar,
+ lib/lucene-core-5.4.1.jar,
+ lib/lucene-facet-5.4.1.jar,
+ lib/lucene-grouping-5.4.1.jar,
+ lib/lucene-highlighter-5.4.1.jar,
+ lib/lucene-join-5.4.1.jar,
+ lib/lucene-memory-5.4.1.jar,
+ lib/lucene-misc-5.4.1.jar,
+ lib/lucene-queries-5.4.1.jar,
+ lib/lucene-queryparser-5.4.1.jar,
+ lib/lucene-sandbox-5.4.1.jar,
+ lib/lucene-suggest-5.4.1.jar,
+ lib/mapstruct-1.0.0.Final.jar,
+ lib/mchange-commons-java-0.2.11.jar,
+ lib/mysql-connector-java-5.1.38.jar,
lib/objenesis-1.2.jar,
+ lib/odfdom-0.8.jar,
lib/odfdom-java-0.8.7.jar,
lib/ognl-2.6.9.jar,
lib/opencsv-2.3.jar,
- lib/org.eclipse.equinox.common-3.6.0.v20110523.jar,
- lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar,
lib/org.osgi.core-1.0.0.jar,
- lib/org.springframework.aop-3.2.2.RELEASE.jar,
- lib/org.springframework.aspects-3.2.2.RELEASE.jar,
- lib/org.springframework.beans-3.2.2.RELEASE.jar,
- lib/org.springframework.context-3.2.2.RELEASE.jar,
- lib/org.springframework.core-3.2.2.RELEASE.jar,
- lib/org.springframework.expression-3.2.2.RELEASE.jar,
- lib/org.springframework.jdbc-3.2.2.RELEASE.jar,
- lib/org.springframework.orm-3.2.2.RELEASE.jar,
- lib/org.springframework.oxm-3.2.2.RELEASE.jar,
- lib/org.springframework.test-3.2.2.RELEASE.jar,
- lib/org.springframework.transaction-3.2.2.RELEASE.jar,
- lib/org.springframework.web-3.2.2.RELEASE.jar,
- lib/org.springframework.web.servlet-3.2.2.RELEASE.jar,
lib/osgi-3.6.0.jar,
- lib/p6spy-1.3.jar,
+ lib/p6spy-2.1.4.jar,
lib/paranamer-2.3.jar,
lib/plexus-classworlds-1.2-alpha-9.jar,
+ lib/plexus-component-annotations-1.5.5.jar,
lib/plexus-container-default-1.0-alpha-30.jar,
- lib/plexus-utils-2.0.5.jar,
- lib/postgresql-9.1-901.jdbc4.jar,
+ lib/plexus-utils-3.0.15.jar,
+ lib/poi-3.13.jar,
+ lib/poi-ooxml-3.13.jar,
+ lib/poi-ooxml-schemas-3.13.jar,
+ lib/postgresql-9.4-1206-jdbc4.jar,
+ lib/relaxngDatatype-20020414.jar,
+ lib/rngom-2.2.11.jar,
lib/sanselan-0.97-incubator.jar,
+ lib/Saxon-HE-9.7.0-2.jar,
lib/servlet-api-2.5.jar,
- lib/slf4j-api-1.7.2.jar,
- lib/slf4j-log4j12-1.7.2.jar,
+ lib/slf4j-api-1.7.13.jar,
+ lib/slf4j-log4j12-1.7.13.jar,
+ lib/slf4j-nop-1.7.13.jar,
lib/snappy-java-1.0.4.1.jar,
lib/solr-analysis-extras-3.6.2.jar,
lib/solr-core-3.6.2.jar,
lib/solr-solrj-3.6.2.jar,
- lib/spring-aop-3.2.2.RELEASE.jar,
- lib/spring-beans-3.2.2.RELEASE.jar,
- lib/spring-context-3.2.2.RELEASE.jar,
- lib/spring-context-support-3.2.2.RELEASE.jar,
- lib/spring-core-3.2.2.RELEASE.jar,
- lib/spring-expression-3.2.2.RELEASE.jar,
+ lib/spring-aop-4.2.4.RELEASE.jar,
+ lib/spring-aspects-4.2.4.RELEASE.jar,
+ lib/spring-beans-4.2.4.RELEASE.jar,
+ lib/spring-context-4.2.4.RELEASE.jar,
+ lib/spring-context-support-4.2.4.RELEASE.jar,
+ lib/spring-core-4.2.4.RELEASE.jar,
+ lib/spring-expression-4.2.4.RELEASE.jar,
+ lib/spring-jdbc-4.2.4.RELEASE.jar,
lib/spring-modules-cache-0.7.jar,
- lib/spring-security-config-3.1.3.RELEASE.jar,
- lib/spring-security-core-3.1.3.RELEASE.jar,
+ lib/spring-orm-4.2.4.RELEASE.jar,
+ lib/spring-oxm-4.2.4.RELEASE.jar,
+ lib/spring-plugin-core-1.2.0.RELEASE.jar,
+ lib/spring-plugin-metadata-1.2.0.RELEASE.jar,
+ lib/spring-security-config-4.0.3.RELEASE.jar,
+ lib/spring-security-core-4.0.3.RELEASE.jar,
+ lib/spring-security-web-4.0.3.RELEASE.jar,
+ lib/spring-test-4.2.4.RELEASE.jar,
+ lib/spring-tx-4.2.4.RELEASE.jar,
+ lib/spring-web-4.2.4.RELEASE.jar,
+ lib/spring-webmvc-4.2.4.RELEASE.jar,
+ lib/springfox-core-2.3.1.jar,
+ lib/springfox-schema-2.3.1.jar,
+ lib/springfox-spi-2.3.1.jar,
+ lib/springfox-spring-web-2.3.1.jar,
+ lib/springfox-swagger-common-2.3.1.jar,
+ lib/springfox-swagger2-2.3.1.jar,
+ lib/standard-1.1.2.jar,
lib/stax-1.2.0.jar,
lib/stax-api-1.0.1.jar,
- lib/unitils-core-3.3.jar,
- lib/unitils-database-3.3.jar,
- lib/unitils-dbmaintainer-3.3.jar,
- lib/unitils-dbunit-3.3.jar,
- lib/unitils-easymock-3.3.jar,
- lib/unitils-inject-3.3.jar,
- lib/unitils-mock-3.3.jar,
- lib/unitils-orm-3.3.jar,
- lib/unitils-spring-3.3.jar,
+ lib/stax-ex-1.7.7.jar,
+ lib/swagger-annotations-1.5.6.jar,
+ lib/swagger-models-1.5.5.jar,
+ lib/tools.jar,
+ lib/txw2-2.2.11.jar,
+ lib/unitils-core-3.4.2.jar,
+ lib/unitils-database-3.4.2.jar,
+ lib/unitils-dbmaintainer-3.4.2.jar,
+ lib/unitils-dbunit-3.4.2.jar,
+ lib/unitils-easymock-3.4.2.jar,
+ lib/unitils-inject-3.4.2.jar,
+ lib/unitils-mock-3.4.2.jar,
+ lib/unitils-orm-3.4.2.jar,
+ lib/unitils-spring-3.4.2.jar,
lib/usertype.jodatime-2.0.1.jar,
lib/usertype.spi-2.0.1.jar,
- lib/validation-api-1.0.0.GA.jar,
- lib/wsdl4j-1.6.2.jar,
- lib/xalan-2.6.0.jar,
+ lib/validation-api-1.1.0.Final.jar,
+ lib/wsdl4j-1.6.3.jar,
+ lib/xalan-2.7.0.jar,
lib/xercesImpl-2.11.0.jar,
lib/xml-apis-1.0.b2.jar,
lib/xml-apis-ext-1.3.04.jar,
lib/xml-resolver-1.2.jar,
+ lib/xmlbeans-2.6.0.jar,
lib/xmlgraphics-commons-1.5.jar,
- lib/xmlParserAPIs-2.6.2.jar,
lib/xmlpull-1.1.3.1.jar,
- lib/xmlunit-1.4.jar,
- lib/xom-1.0.jar,
+ lib/xmlunit-1.6.jar,
+ lib/xom-1.2.5.jar,
lib/xpp3_min-1.1.4c.jar,
lib/xpp3-1.1.4c.jar,
- lib/xstream-1.4.4.jar,
- lib/yjp-controller-api-redist-9.0.8.jar,
- lib/google-api-translate-java-0.92.jar,
- lib/odfdom-0.8.jar,
- lib/h2mig_pagestore_addon.jar,
- lib/spring-security-remoting-3.1.3.RELEASE.jar,
- lib/jena-core-2.11.2.jar,
- lib/jena-iri-1.0.2.jar,
- lib/poi-3.10-FINAL.jar,
- lib/poi-ooxml-3.10-FINAL.jar,
- lib/xmlbeans-2.3.0.jar,
- lib/poi-ooxml-schemas-3.10-FINAL.jar,
- lib/swagger-annotations-1.3.5.jar,
- lib/cdmlib-commons-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-ext-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-io-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-model-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-persistence-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-print-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-remote-3.8.0-SNAPSHOT.jar,
- lib/cdmlib-services-3.8.0-SNAPSHOT.jar
+ lib/xsom-20140925.jar,
+ lib/xstream-1.4.8.jar,
+ lib/yjp-controller-api-redist-9.0.8.jar
Import-Package: eu.etaxonomy.cdm.api.application
-bin.includes = META-INF/,\\r
- .,\\r
- lib/activation-1.1.1.jar,\\r
- lib/antlr-2.7.7.jar,\\r
- lib/aopalliance-1.0.jar,\\r
- lib/aspectjrt-1.7.1.jar,\\r
- lib/aspectjweaver-1.7.1.jar,\\r
- lib/avro-1.6.3.jar,\\r
- lib/batik-anim-1.7.jar,\\r
- lib/batik-awt-util-1.7.jar,\\r
- lib/batik-bridge-1.7.jar,\\r
- lib/batik-css-1.7.jar,\\r
- lib/batik-dom-1.7.jar,\\r
- lib/batik-ext-1.7.jar,\\r
- lib/batik-extension-1.7.jar,\\r
- lib/batik-gvt-1.7.jar,\\r
- lib/batik-js-1.7.jar,\\r
- lib/batik-parser-1.7.jar,\\r
- lib/batik-script-1.7.jar,\\r
- lib/batik-svg-dom-1.7.jar,\\r
- lib/batik-svggen-1.7.jar,\\r
- lib/batik-transcoder-1.7.jar,\\r
- lib/batik-util-1.7.jar,\\r
- lib/batik-xml-1.7.jar,\\r
- lib/c3p0-0.9.2.jar,\\r
- lib/cglib-nodep-2.2.2.jar,\\r
- lib/com.springsource.org.aopalliance-1.0.0.jar,\\r
- lib/com.springsource.org.apache.commons.logging-1.1.1.jar,\\r
- lib/commons-beanutils-1.8.3.jar,\\r
- lib/commons-codec-20041127.091804.jar,\\r
- lib/commons-collections-3.2.1.jar,\\r
- lib/commons-dbcp-1.4.jar,\\r
- lib/commons-io-2.4.jar,\\r
- lib/commons-lang-2.6.jar,\\r
- lib/commons-logging-1.1.2.jar,\\r
- lib/commons-pool-1.5.4.jar,\\r
- lib/concurrent-1.3.4.jar,\\r
- lib/dbunit-2.4.9.jar,\\r
- lib/dom4j-1.6.1.jar,\\r
- lib/doxia-core-1.3.jar,\\r
- lib/doxia-logging-api-1.3.jar,\\r
- lib/doxia-module-apt-1.3.jar,\\r
- lib/doxia-module-xhtml-1.3.jar,\\r
- lib/doxia-sink-api-1.3.jar,\\r
- lib/dozer-5.3.0.jar,\\r
- lib/easymock-3.1.jar,\\r
- lib/easymockclassextension-2.3.jar,\\r
- lib/ehcache-core-2.6.9.jar,\\r
- lib/ezmorph-1.0.6.jar,\\r
- lib/fop-1.1.jar,\\r
- lib/guava-r05.jar,\\r
- lib/h2-1.3.170.jar,\\r
- lib/hamcrest-core-1.3.jar,\\r
- lib/hibernate-c3p0-4.1.10.Final.jar,\\r
- lib/hibernate-cglib-repack-2.1_3.jar,\\r
- lib/hibernate-commons-annotations-4.0.1.Final.jar,\\r
- lib/hibernate-core-4.1.10.Final.jar,\\r
- lib/hibernate-ehcache-4.1.10.Final.jar,\\r
- lib/hibernate-entitymanager-4.1.10.Final.jar,\\r
- lib/hibernate-envers-4.1.10.Final.jar,\\r
- lib/hibernate-jpa-2.0-api-1.0.1.Final.jar,\\r
- lib/hibernate-search-4.2.0.Final.jar,\\r
- lib/hibernate-search-analyzers-4.2.0.Final.jar,\\r
- lib/hibernate-search-engine-4.2.0.Final.jar,\\r
- lib/hibernate-search-orm-4.2.0.Final.jar,\\r
- lib/hibernate-validator-4.3.1.Final.jar,\\r
- lib/hsqldb-1.8.0.10.jar,\\r
- lib/httpclient-4.2.3.jar,\\r
- lib/httpcore-4.2.4.jar,\\r
- lib/icu4j-2.6.1.jar,\\r
- lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar,\\r
- lib/identificationKeyAPI-1.0-SNAPSHOT.jar,\\r
- lib/itextpdf-5.4.0.jar,\\r
- lib/jackson-core-asl-1.8.8.jar,\\r
- lib/jackson-mapper-asl-1.8.8.jar,\\r
- lib/jakarta-regexp-1.4.jar,\\r
- lib/javassist-3.17.1-GA.jar,\\r
- lib/jaxb-api-2.2.7.jar,\\r
- lib/jaxb-impl-2.2-EA.jar,\\r
- lib/jaxb-xjc-2.2-EA.jar,\\r
- lib/jaxb1-impl-2.2-EA.jar,\\r
- lib/jaxen-1.1.4.jar,\\r
- lib/jboss-logging-3.1.3.GA.jar,\\r
- lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar,\\r
- lib/jdbc4-2.0.jar,\\r
- lib/jdom-1.1.3.jar,\\r
- lib/joda-time-2.1.jar,\\r
- lib/json-lib-2.4-jdk15.jar,\\r
- lib/jsr250-api-1.0.jar,\\r
- lib/jtds-1.3.0.jar,\\r
- lib/junit-4.11.jar,\\r
- lib/junit-benchmarks-0.5.0.jar,\\r
- lib/log4j-1.2.17.jar,\\r
- lib/lsid-client-1.1.2.jar,\\r
- lib/lsid-server-1.1.2.jar,\\r
- lib/lucene-analyzers-3.6.2.jar,\\r
- lib/lucene-core-3.6.2.jar,\\r
- lib/lucene-facet-3.6.2.jar,\\r
- lib/lucene-grouping-3.6.2.jar,\\r
- lib/lucene-highlighter-3.6.2.jar,\\r
- lib/lucene-kuromoji-3.6.2.jar,\\r
- lib/lucene-memory-3.6.2.jar,\\r
- lib/lucene-misc-3.6.2.jar,\\r
- lib/lucene-phonetic-3.6.2.jar,\\r
- lib/lucene-queries-3.6.2.jar,\\r
- lib/lucene-smartcn-3.6.2.jar,\\r
- lib/lucene-spatial-3.6.2.jar,\\r
- lib/lucene-spellchecker-3.6.2.jar,\\r
- lib/lucene-stempel-3.6.2.jar,\\r
- lib/mchange-commons-java-0.2.3.3.jar,\\r
- lib/mysql-connector-java-5.1.24.jar,\\r
- lib/objenesis-1.2.jar,\\r
- lib/odfdom-java-0.8.7.jar,\\r
- lib/ognl-2.6.9.jar,\\r
- lib/opencsv-2.3.jar,\\r
- lib/org.eclipse.equinox.common-3.6.0.v20110523.jar,\\r
- lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar,\\r
- lib/org.osgi.core-1.0.0.jar,\\r
- lib/org.springframework.aop-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.aspects-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.beans-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.context-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.core-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.expression-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.jdbc-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.orm-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.oxm-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.test-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.transaction-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.web-3.2.2.RELEASE.jar,\\r
- lib/org.springframework.web.servlet-3.2.2.RELEASE.jar,\\r
- lib/osgi-3.6.0.jar,\\r
- lib/p6spy-1.3.jar,\\r
- lib/paranamer-2.3.jar,\\r
- lib/plexus-classworlds-1.2-alpha-9.jar,\\r
- lib/plexus-container-default-1.0-alpha-30.jar,\\r
- lib/plexus-utils-2.0.5.jar,\\r
- lib/postgresql-9.1-901.jdbc4.jar,\\r
- lib/sanselan-0.97-incubator.jar,\\r
- lib/servlet-api-2.5.jar,\\r
- lib/slf4j-api-1.7.2.jar,\\r
- lib/slf4j-log4j12-1.7.2.jar,\\r
- lib/snappy-java-1.0.4.1.jar,\\r
- lib/solr-analysis-extras-3.6.2.jar,\\r
- lib/solr-core-3.6.2.jar,\\r
- lib/solr-solrj-3.6.2.jar,\\r
- lib/spring-aop-3.2.2.RELEASE.jar,\\r
- lib/spring-beans-3.2.2.RELEASE.jar,\\r
- lib/spring-context-3.2.2.RELEASE.jar,\\r
- lib/spring-context-support-3.2.2.RELEASE.jar,\\r
- lib/spring-core-3.2.2.RELEASE.jar,\\r
- lib/spring-expression-3.2.2.RELEASE.jar,\\r
- lib/spring-modules-cache-0.7.jar,\\r
- lib/spring-security-config-3.1.3.RELEASE.jar,\\r
- lib/spring-security-core-3.1.3.RELEASE.jar,\\r
- lib/stax-1.2.0.jar,\\r
- lib/stax-api-1.0.1.jar,\\r
- lib/unitils-core-3.3.jar,\\r
- lib/unitils-database-3.3.jar,\\r
- lib/unitils-dbmaintainer-3.3.jar,\\r
- lib/unitils-dbunit-3.3.jar,\\r
- lib/unitils-easymock-3.3.jar,\\r
- lib/unitils-inject-3.3.jar,\\r
- lib/unitils-mock-3.3.jar,\\r
- lib/unitils-orm-3.3.jar,\\r
- lib/unitils-spring-3.3.jar,\\r
- lib/usertype.jodatime-2.0.1.jar,\\r
- lib/usertype.spi-2.0.1.jar,\\r
- lib/validation-api-1.0.0.GA.jar,\\r
- lib/wsdl4j-1.6.2.jar,\\r
- lib/xalan-2.6.0.jar,\\r
- lib/xercesImpl-2.11.0.jar,\\r
- lib/xml-apis-1.0.b2.jar,\\r
- lib/xml-apis-ext-1.3.04.jar,\\r
- lib/xml-resolver-1.2.jar,\\r
- lib/xmlgraphics-commons-1.5.jar,\\r
- lib/xmlParserAPIs-2.6.2.jar,\\r
- lib/xmlpull-1.1.3.1.jar,\\r
- lib/xmlunit-1.4.jar,\\r
- lib/xom-1.0.jar,\\r
- lib/xpp3_min-1.1.4c.jar,\\r
- lib/xpp3-1.1.4c.jar,\\r
- lib/xstream-1.4.4.jar,\\r
- lib/yjp-controller-api-redist-9.0.8.jar,\\r
- lib/google-api-translate-java-0.92.jar,\\r
- lib/odfdom-0.8.jar,\\r
- lib/h2mig_pagestore_addon.jar,\\r
- lib/spring-security-remoting-3.1.3.RELEASE.jar,\\r
- lib/spring-security-remoting-3.1.3.RELEASE.jar,\\r
- lib/jena-core-2.11.2.jar,\\r
- lib/jena-iri-1.0.2.jar,\\r
- lib/poi-3.10-FINAL.jar,\\r
- lib/poi-ooxml-3.10-FINAL.jar,\\r
- 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.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-ext-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-io-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-model-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-persistence-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-print-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-remote-3.8.0-SNAPSHOT.jar,\\r
- lib/cdmlib-services-3.8.0-SNAPSHOT.jar\r
-\r
-jars.compile.order = .\r
-output.. = bin/\r
-source.. = src/main/java/,\\r
- src/main/resources/,\\r
- src/test/java/\r
-src.includes = src/\r
-\r
+bin.includes = META-INF/,\
+ .,\
+ resources/cdm.map.ser,\
+ lib/activation-1.1.1.jar,\
+ lib/antlr-2.7.7.jar,\
+ lib/aopalliance-1.0.jar,\
+ lib/apache-log4j-extras-1.2.17.jar,\
+ lib/aspectjrt-1.8.8.jar,\
+ lib/aspectjweaver-1.8.8.jar,\
+ lib/avro-1.6.3.jar,\
+ lib/batik-anim-1.7.jar,\
+ lib/batik-awt-util-1.7.jar,\
+ lib/batik-bridge-1.7.jar,\
+ lib/batik-css-1.7.jar,\
+ lib/batik-dom-1.7.jar,\
+ lib/batik-ext-1.8.jar,\
+ lib/batik-extension-1.7.jar,\
+ lib/batik-gvt-1.7.jar,\
+ lib/batik-js-1.7.jar,\
+ lib/batik-parser-1.7.jar,\
+ lib/batik-script-1.7.jar,\
+ lib/batik-svg-dom-1.7.jar,\
+ lib/batik-svggen-1.7.jar,\
+ lib/batik-transcoder-1.7.jar,\
+ lib/batik-util-1.7.jar,\
+ lib/batik-xml-1.7.jar,\
+ lib/c3p0-0.9.5.2.jar,\
+ lib/cdmlib-commons-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-ext-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-io-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-model-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-persistence-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-print-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-remote-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-services-4.0.0-SNAPSHOT.jar,\
+ lib/cdmlib-test-4.0.0-SNAPSHOT.jar,\
+ lib/cglib-3.2.0.jar,\
+ lib/cglib-nodep-3.2.0.jar,\
+ lib/classmate-1.3.1.jar,\
+ lib/codemodel-2.2.11.jar,\
+ lib/com.springsource.org.aopalliance-1.0.0.jar,\
+ lib/com.springsource.org.apache.commons.logging-1.1.1.jar,\
+ lib/commons-beanutils-1.9.2.jar,\
+ lib/commons-codec-1.10.jar,\
+ lib/commons-collections-3.2.2.jar,\
+ lib/commons-csv-1.0.jar,\
+ lib/commons-dbcp-1.4.jar,\
+ lib/commons-io-2.4.jar,\
+ lib/commons-lang-2.6.jar,\
+ lib/commons-lang3-3.3.2.jar,\
+ lib/commons-logging-1.2.jar,\
+ lib/commons-pool-1.5.4.jar,\
+ lib/concurrent-1.3.4.jar,\
+ lib/dbunit-2.4.9.jar,\
+ lib/dom4j-1.6.1.jar,\
+ lib/doxia-core-1.6.jar,\
+ lib/doxia-logging-api-1.6.jar,\
+ lib/doxia-module-apt-1.6.jar,\
+ lib/doxia-module-xhtml-1.6.jar,\
+ lib/doxia-sink-api-1.6.jar,\
+ lib/dozer-5.3.0.jar,\
+ lib/dtd-parser-1.1.jar,\
+ lib/easymock-2.3.jar,\
+ lib/easymockclassextension-2.3.jar,\
+ lib/ehcache-core-2.6.11.jar,\
+ lib/ezmorph-1.0.6.jar,\
+ lib/FastInfoset-1.2.13.jar,\
+ lib/fop-1.1.jar,\
+ lib/google-api-translate-java-0.92.jar,\
+ lib/guava-19.0.jar,\
+ lib/h2-1.4.190.jar,\
+ lib/h2mig_pagestore_addon.jar,\
+ lib/hamcrest-core-1.3.jar,\
+ lib/hibernate-c3p0-5.0.7.Final.jar,\
+ lib/hibernate-cglib-repack-2.1_3.jar,\
+ lib/hibernate-commons-annotations-5.0.1.Final.jar,\
+ lib/hibernate-core-5.0.7.Final.jar,\
+ lib/hibernate-ehcache-5.0.7.Final.jar,\
+ lib/hibernate-entitymanager-5.0.7.Final.jar,\
+ lib/hibernate-envers-5.0.7.Final.jar,\
+ lib/hibernate-jpa-2.1-api-1.0.0.Final.jar,\
+ lib/hibernate-search-4.2.0.Final.jar,\
+ lib/hibernate-search-analyzers-4.2.0.Final.jar,\
+ lib/hibernate-search-engine-5.5.2.Final.jar,\
+ lib/hibernate-search-orm-5.5.2.Final.jar,\
+ lib/hibernate-validator-5.2.2.Final.jar,\
+ lib/hibernate-validator-cdi-5.2.2.Final.jar,\
+ lib/hsqldb-2.3.3.jar,\
+ lib/httpclient-4.5.1.jar,\
+ lib/httpclient-cache-4.2.6.jar,\
+ lib/httpcore-4.4.4.jar,\
+ lib/httpmime-4.5.1.jar,\
+ lib/icu4j-2.6.1.jar,\
+ lib/identificationKeyAPI-1.0.jar,\
+ lib/istack-commons-runtime-2.21.jar,\
+ lib/istack-commons-tools-2.21.jar,\
+ lib/itextpdf-5.5.8.jar,\
+ lib/jackson-annotations-2.6.5.jar,\
+ lib/jackson-core-2.6.5.jar,\
+ lib/jackson-core-asl-1.8.8.jar,\
+ lib/jackson-databind-2.6.5.jar,\
+ lib/jackson-mapper-asl-1.8.8.jar,\
+ lib/jakarta-regexp-1.4.jar,\
+ lib/jandex-2.0.0.Final.jar,\
+ lib/javassist-3.20.0-GA.jar,\
+ lib/javax.el-2.2.6.jar,\
+ lib/javax.el-api-2.2.5.jar,\
+ lib/javax.servlet-api-3.1.0.jar,\
+ lib/jaxb-api-2.2.12.jar,\
+ lib/jaxb-core-2.2.11.jar,\
+ lib/jaxb-jxc-2.2.11.jar,\
+ lib/jaxb-runtime-2.2.11.jar,\
+ lib/jaxb-xjc-2.2.11.jar,\
+ lib/jaxb1-impl-2.2-EA.jar,\
+ lib/jaxen-1.1.4.jar,\
+ lib/jaxen-1.1.6.jar,\
+ lib/jboss-logging-3.3.0.Final.jar,\
+ lib/jboss-transaction-api_1.1_spec-1.0.0.Final.jar,\
+ lib/jcl-over-slf4j-1.7.6.jar,\
+ lib/jdbc4-2.0.jar,\
+ lib/jdom-1.1.3.jar,\
+ lib/jdom2-2.0.6.jar,\
+ lib/jena-arq-2.13.0.jar,\
+ lib/jena-core-2.13.0.jar,\
+ lib/jena-iri-1.1.2.jar,\
+ lib/jena-tdb-1.1.2.jar,\
+ lib/joda-time-2.9.1.jar,\
+ lib/json-20090211.jar,\
+ lib/json-lib-2.4-jdk15.jar,\
+ lib/jsonld-java-0.5.1.jar,\
+ lib/jsr250-api-1.0.jar,\
+ lib/jta-1.1.jar,\
+ lib/jtds-1.3.1.jar,\
+ lib/junit-4.12.jar,\
+ lib/junit-benchmarks-0.7.2.jar,\
+ lib/libthrift-0.9.2.jar,\
+ lib/log4j-1.2.17.jar,\
+ lib/lsid-client-1.1.2.jar,\
+ lib/lsid-server-1.1.2.jar,\
+ lib/lucene-analyzers-common-5.4.1.jar,\
+ lib/lucene-backward-codecs-5.4.1.jar,\
+ lib/lucene-core-5.4.1.jar,\
+ lib/lucene-facet-5.4.1.jar,\
+ lib/lucene-grouping-5.4.1.jar,\
+ lib/lucene-highlighter-5.4.1.jar,\
+ lib/lucene-join-5.4.1.jar,\
+ lib/lucene-memory-5.4.1.jar,\
+ lib/lucene-misc-5.4.1.jar,\
+ lib/lucene-queries-5.4.1.jar,\
+ lib/lucene-queryparser-5.4.1.jar,\
+ lib/lucene-sandbox-5.4.1.jar,\
+ lib/lucene-suggest-5.4.1.jar,\
+ lib/mapstruct-1.0.0.Final.jar,\
+ lib/mchange-commons-java-0.2.11.jar,\
+ lib/mysql-connector-java-5.1.38.jar,\
+ lib/objenesis-1.2.jar,\
+ lib/odfdom-0.8.jar,\
+ lib/odfdom-java-0.8.7.jar,\
+ lib/ognl-2.6.9.jar,\
+ lib/opencsv-2.3.jar,\
+ lib/org.osgi.core-1.0.0.jar,\
+ lib/osgi-3.6.0.jar,\
+ lib/p6spy-2.1.4.jar,\
+ lib/paranamer-2.3.jar,\
+ lib/plexus-classworlds-1.2-alpha-9.jar,\
+ lib/plexus-component-annotations-1.5.5.jar,\
+ lib/plexus-container-default-1.0-alpha-30.jar,\
+ lib/plexus-utils-3.0.15.jar,\
+ lib/poi-3.13.jar,\
+ lib/poi-ooxml-3.13.jar,\
+ lib/poi-ooxml-schemas-3.13.jar,\
+ lib/postgresql-9.4-1206-jdbc4.jar,\
+ lib/relaxngDatatype-20020414.jar,\
+ lib/rngom-2.2.11.jar,\
+ lib/sanselan-0.97-incubator.jar,\
+ lib/Saxon-HE-9.7.0-2.jar,\
+ lib/servlet-api-2.5.jar,\
+ lib/slf4j-api-1.7.13.jar,\
+ lib/slf4j-log4j12-1.7.13.jar,\
+ lib/slf4j-nop-1.7.13.jar,\
+ lib/snappy-java-1.0.4.1.jar,\
+ lib/solr-analysis-extras-3.6.2.jar,\
+ lib/solr-core-3.6.2.jar,\
+ lib/solr-solrj-3.6.2.jar,\
+ lib/spring-aop-4.2.4.RELEASE.jar,\
+ lib/spring-aspects-4.2.4.RELEASE.jar,\
+ lib/spring-beans-4.2.4.RELEASE.jar,\
+ lib/spring-context-4.2.4.RELEASE.jar,\
+ lib/spring-context-support-4.2.4.RELEASE.jar,\
+ lib/spring-core-4.2.4.RELEASE.jar,\
+ lib/spring-expression-4.2.4.RELEASE.jar,\
+ lib/spring-jdbc-4.2.4.RELEASE.jar,\
+ lib/spring-modules-cache-0.7.jar,\
+ lib/spring-orm-4.2.4.RELEASE.jar,\
+ lib/spring-oxm-4.2.4.RELEASE.jar,\
+ lib/spring-plugin-core-1.2.0.RELEASE.jar,\
+ lib/spring-plugin-metadata-1.2.0.RELEASE.jar,\
+ lib/spring-security-config-4.0.3.RELEASE.jar,\
+ lib/spring-security-core-4.0.3.RELEASE.jar,\
+ lib/spring-security-web-4.0.3.RELEASE.jar,\
+ lib/spring-test-4.2.4.RELEASE.jar,\
+ lib/spring-tx-4.2.4.RELEASE.jar,\
+ lib/spring-web-4.2.4.RELEASE.jar,\
+ lib/spring-webmvc-4.2.4.RELEASE.jar,\
+ lib/springfox-core-2.3.1.jar,\
+ lib/springfox-schema-2.3.1.jar,\
+ lib/springfox-spi-2.3.1.jar,\
+ lib/springfox-spring-web-2.3.1.jar,\
+ lib/springfox-swagger-common-2.3.1.jar,\
+ lib/springfox-swagger2-2.3.1.jar,\
+ lib/standard-1.1.2.jar,\
+ lib/stax-1.2.0.jar,\
+ lib/stax-api-1.0.1.jar,\
+ lib/stax-ex-1.7.7.jar,\
+ lib/swagger-annotations-1.5.6.jar,\
+ lib/swagger-models-1.5.5.jar,\
+ lib/tools.jar,\
+ lib/txw2-2.2.11.jar,\
+ lib/unitils-core-3.4.2.jar,\
+ lib/unitils-database-3.4.2.jar,\
+ lib/unitils-dbmaintainer-3.4.2.jar,\
+ lib/unitils-dbunit-3.4.2.jar,\
+ lib/unitils-easymock-3.4.2.jar,\
+ lib/unitils-inject-3.4.2.jar,\
+ lib/unitils-mock-3.4.2.jar,\
+ lib/unitils-orm-3.4.2.jar,\
+ lib/unitils-spring-3.4.2.jar,\
+ lib/usertype.jodatime-2.0.1.jar,\
+ lib/usertype.spi-2.0.1.jar,\
+ lib/validation-api-1.1.0.Final.jar,\
+ lib/wsdl4j-1.6.3.jar,\
+ lib/xalan-2.7.0.jar,\
+ lib/xercesImpl-2.11.0.jar,\
+ lib/xml-apis-1.0.b2.jar,\
+ lib/xml-apis-ext-1.3.04.jar,\
+ lib/xml-resolver-1.2.jar,\
+ lib/xmlbeans-2.6.0.jar,\
+ lib/xmlgraphics-commons-1.5.jar,\
+ lib/xmlpull-1.1.3.1.jar,\
+ lib/xmlunit-1.6.jar,\
+ lib/xom-1.2.5.jar,\
+ lib/xpp3_min-1.1.4c.jar,\
+ lib/xpp3-1.1.4c.jar,\
+ lib/xsom-20140925.jar,\
+ lib/xstream-1.4.8.jar,\
+ lib/yjp-controller-api-redist-9.0.8.jar
+
+jars.compile.order = .
+output.. = bin/
+source.. = src/main/java/,\
+ src/main/resources/
+src.includes = src/
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>JSTL 1.1 XML library</description>
+ <display-name>JSTL XML</display-name>
+ <tlib-version>1.1</tlib-version>
+ <short-name>x</short-name>
+ <uri>http://java.sun.com/jsp/jstl/xml</uri>
+
+ <validator>
+ <description>
+ Provides validation features for JSTL XML tags.
+ </description>
+ <validator-class>
+ org.apache.taglibs.standard.tlv.JstlXmlTLV
+ </validator-class>
+ </validator>
+
+ <tag>
+ <description>
+ Simple conditional tag that establishes a context for
+ mutually exclusive conditional operations, marked by
+ <when> and <otherwise>
+ </description>
+ <name>choose</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <description>
+ Like <%= ... >, but for XPath expressions.
+ </description>
+ <name>out</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.ExprTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+XPath expression to be evaluated.
+ </description>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Determines whether characters <,>,&,'," in the
+resulting string should be converted to their
+corresponding character entity codes. Default
+value is true.
+ </description>
+ <name>escapeXml</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ XML conditional tag, which evalutes its body if the
+ supplied XPath expression evalutes to 'true' as a boolean
+ </description>
+ <name>if</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The test condition that tells whether or not the
+body content should be processed.
+ </description>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+resulting value of the test condition. The type
+of the scoped variable is Boolean.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ XML iteration tag.
+ </description>
+ <name>forEach</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+current item of the iteration. This scoped variable
+has nested visibility. Its type depends on the
+result of the XPath expression in the select
+attribute.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+XPath expression to be evaluated.
+ </description>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Iteration begins at the item located at the
+specified index. First item of the collection has
+index 0.
+ </description>
+ <name>begin</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration ends at the item located at the specified
+index (inclusive).
+ </description>
+ <name>end</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Iteration will only process every step items of
+the collection, starting with the first one.
+ </description>
+ <name>step</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for the
+status of the iteration. Object exported is of type
+javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
+ </description>
+ <name>varStatus</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Subtag of <choose> that follows <when> tags
+ and runs only if all of the prior conditions evaluated to
+ 'false'
+ </description>
+ <name>otherwise</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+ <tag>
+ <description>
+ Adds a parameter to a containing 'transform' tag's Transformer
+ </description>
+ <name>param</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the transformation parameter.
+ </description>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Value of the parameter.
+ </description>
+ <name>value</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Parses XML content from 'source' attribute or 'body'
+ </description>
+ <name>parse</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.XmlParseTEI</tei-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable for
+the parsed XML document. The type of the
+scoped variable is implementation
+dependent.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Name of the exported scoped variable for
+the parsed XML document. The type of the
+scoped variable is
+org.w3c.dom.Document.
+ </description>
+ <name>varDom</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for varDom.
+ </description>
+ <name>scopeDom</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Deprecated. Use attribute 'doc' instead.
+ </description>
+ <name>xml</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Source XML document to be parsed.
+ </description>
+ <name>doc</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+The system identifier (URI) for parsing the
+XML document.
+ </description>
+ <name>systemId</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Filter to be applied to the source
+document.
+ </description>
+ <name>filter</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Saves the result of an XPath expression evaluation in a 'scope'
+ </description>
+ <name>set</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <description>
+Name of the exported scoped variable to hold
+the value specified in the action. The type of the
+scoped variable is whatever type the select
+expression evaluates to.
+ </description>
+ <name>var</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+XPath expression to be evaluated.
+ </description>
+ <name>select</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Conducts a transformation given a source XML document
+ and an XSLT stylesheet
+ </description>
+ <name>transform</name>
+ <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
+ <tei-class>org.apache.taglibs.standard.tei.XmlTransformTEI</tei-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+Name of the exported
+scoped variable for the
+transformed XML
+document. The type of the
+scoped variable is
+org.w3c.dom.Document.
+ </description>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Scope for var.
+ </description>
+ <name>scope</name>
+ <required>false</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Result
+Object that captures or
+processes the transformation
+result.
+ </description>
+ <name>result</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Deprecated. Use attribute
+'doc' instead.
+ </description>
+ <name>xml</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Source XML document to be
+transformed. (If exported by
+<x:set>, it must correspond
+to a well-formed XML
+document, not a partial
+document.)
+ </description>
+ <name>doc</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+Deprecated. Use attribute
+'docSystemId' instead.
+ </description>
+ <name>xmlSystemId</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+The system identifier (URI)
+for parsing the XML
+document.
+ </description>
+ <name>docSystemId</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+javax.xml.transform.Source
+Transformation stylesheet as
+a String, Reader, or
+Source object.
+ </description>
+ <name>xslt</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <description>
+The system identifier (URI)
+for parsing the XSLT
+stylesheet.
+ </description>
+ <name>xsltSystemId</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+ <tag>
+ <description>
+ Subtag of <choose> that includes its body if its
+ expression evalutes to 'true'
+ </description>
+ <name>when</name>
+ <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
+ <body-content>JSP</body-content>
+ <attribute>
+ <description>
+The test condition that tells whether or
+not the body content should be
+processed
+ </description>
+ <name>select</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>
- <packaging>eclipse-plugin</packaging>
- <name>CDM Library Dependencies Plugin</name>
- <description>CDM Library and dependencies as a plugin</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.4</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeArtifactIds>cdmlib-commons,cdmlib-model,cdmlib-persistence,cdmlib-remote,cdmlib-print,cdmlib-services,cdmlib-ext,cdmlib-io</includeArtifactIds>
- <outputDirectory>lib</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeTransitive>true</excludeTransitive>
- </configuration>
- </execution>
- <execution>
- <id>copy-dependencies-sources</id>
- <phase>validate</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <classifier>sources</classifier>
- <includeArtifactIds>cdmlib-commons,cdmlib-model,cdmlib-persistence,cdmlib-remote,cdmlib-print,cdmlib-services,cdmlib-ext,cdmlib-io</includeArtifactIds>
- <outputDirectory>lib</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeTransitive>true</excludeTransitive>
- <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>remove-existing-jars</id>
- <phase>clean</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <echo>Remove all cdmlib jars</echo>
- <delete>
- <fileset dir="./lib" includes="cdmlib-*" />
- </delete>
- </target>
- </configuration>
- </execution>
- <execution>
- <id>update-snapshot-jar-names</id>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <echo>Update cdmlib jars to SNAPSHOT when build with timestamp</echo>
- <move todir="./lib">
- <fileset dir="./lib" />
- <mapper type="regexp" from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
- </move>
- <move todir="./lib">
- <fileset dir="./lib" />
- <mapper type="regexp" from="(^cdmlib\-.*\-[0-9]\.[0-9]\.[0-9]\-)[0-9.-]+(\-sources\.jar)" to="\1SNAPSHOT\2" />
- </move>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>identificationKeyAPI</groupId>
- <artifactId>identificationKeyAPI</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-commons</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-model</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-persistence</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-remote</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-print</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-services</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-io</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>eu.etaxonomy</groupId>
- <artifactId>cdmlib-ext</artifactId>
- <version>${cdmlib.version}</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.7.1</version>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>1.7.1</version>
- </dependency>
-
- <!-- for ikey-plus
- TODO this should not be needed but the utils class contained in this jar
- seems to be loaded as bean by spring
- -->
- </dependencies>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>taxeditor-parent</artifactId>\r
+ <version>4.0.0-SNAPSHOT</version>\r
+ </parent>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
+ <packaging>eclipse-plugin</packaging>\r
+ <name>CDM Library Dependencies Plugin</name>\r
+ <description>CDM Library and dependencies as a plugin</description>\r
+\r
+ <build>\r
+ <pluginManagement>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-surefire-plugin</artifactId>\r
+ <version>2.7</version>\r
+ </plugin>\r
+ </plugins>\r
+ </pluginManagement>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-dependency-plugin</artifactId>\r
+ <version>2.4</version>\r
+ <executions>\r
+ <execution>\r
+ <id>copy-dependencies</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <excludeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </excludeArtifactIds>\r
+ <includeArtifactIds>\r
+ cdmlib-services,cdmlib-commons,cdmlib-persistence,cdmlib-ext,cdmlib-model,cdmlib-io,cdmlib-print,cdmlib-remote,cdmlib-test\r
+ </includeArtifactIds>\r
+ <outputDirectory>${basedir}/lib</outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ <execution>\r
+ <id>copy-dependency-war</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <includeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </includeArtifactIds>\r
+ <outputDirectory>\r
+ ${basedir}/src/main/resources/etc/jetty\r
+ </outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-antrun-plugin</artifactId>\r
+ <version>1.7</version>\r
+ <executions>\r
+ <execution>\r
+ <id>update-snapshot-jar-names</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>run</goal>\r
+ </goals>\r
+ <configuration>\r
+ <target>\r
+ <echo>Anonymizing war</echo>\r
+ <move todir="./src/main/resources/etc/jetty">\r
+ <fileset dir="./src/main/resources/etc/jetty" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-remote\-webapp).*(\.war)" to="\1\2" />\r
+ </move>\r
+ <echo>Update cdmlib jars to SNAPSHOT when build with\r
+ timestamp\r
+ </echo>\r
+ <move todir="./lib">\r
+ <fileset dir="./lib" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*\-\d+\.\d+\.\d+\-)[\d.-]+(\.jar)"\r
+ to="\1SNAPSHOT\2" />\r
+ </move>\r
+ <move todir="./lib">\r
+ <fileset dir="./lib" />\r
+ <mapper type="regexp"\r
+ from="(^cdmlib\-.*\-\d+\.\d+\.\d+\-)[\d.-]+(\-sources\.jar)"\r
+ to="\1SNAPSHOT\2" />\r
+ </move>\r
+ </target>\r
+ </configuration>\r
+ </execution>\r
+ <execution>\r
+ <id>remove-existing-jars</id>\r
+ <phase>clean</phase>\r
+ <goals>\r
+ <goal>run</goal>\r
+ </goals>\r
+ <configuration>\r
+ <target>\r
+ <echo>Remove all cdmlib jars</echo>\r
+ <delete>\r
+ <fileset dir="./lib" includes="cdmlib-*" />\r
+ </delete>\r
+ </target>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ <profiles>\r
+ <profile>\r
+ <id>copyAllJars</id>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-dependency-plugin</artifactId>\r
+ <version>2.4</version>\r
+ <executions>\r
+ <execution>\r
+ <id>copy-all-dependencies</id>\r
+ <phase>validate</phase>\r
+ <goals>\r
+ <goal>copy-dependencies</goal>\r
+ </goals>\r
+ <configuration>\r
+ <excludeArtifactIds>\r
+ cdmlib-remote-webapp\r
+ </excludeArtifactIds>\r
+ <outputDirectory>${basedir}/lib</outputDirectory>\r
+ <overWriteReleases>true</overWriteReleases>\r
+ <overWriteSnapshots>true</overWriteSnapshots>\r
+ <excludeTransitive>true</excludeTransitive>\r
+ </configuration>\r
+ </execution>\r
+ </executions>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+ </profile>\r
+ </profiles>\r
+ <repositories>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - External Bundle\r
+ Milestones\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/milestone\r
+ </url>\r
+ </repository>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - SpringSource\r
+ Bundle\r
+ Releases\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/release\r
+ </url>\r
+ </repository>\r
+ <repository>\r
+ <id>SpringSource Enterprise Bundle Repository - External Bundle\r
+ Releases\r
+ </id>\r
+ <url>http://repository.springsource.com/maven/bundles/external\r
+ </url>\r
+ </repository>\r
+ <repository>\r
+ <id>repository.springsource.release</id>\r
+ <name>SpringSource GA Repository</name>\r
+ <url>http://repo.springsource.org/release</url>\r
+ </repository>\r
+ </repositories>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-remote-webapp</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ <type>war</type>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-commons</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-model</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-persistence</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-remote</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-print</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-services</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-io</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-ext</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>eu.etaxonomy</groupId>\r
+ <artifactId>cdmlib-test</artifactId>\r
+ <version>${cdmlib.version}</version>\r
+ </dependency>\r
+\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-server</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-util</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-xml</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-servlet</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-webapp</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-security</artifactId> -->\r
+ <!-- <version>9.1.3.v20140225</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-http</artifactId> -->\r
+ <!-- <version>${jetty.version}</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>org.eclipse.jetty</groupId> -->\r
+ <!-- <artifactId>jetty-io</artifactId> -->\r
+ <!-- <version>${jetty.version}</version> -->\r
+ <!-- </dependency> -->\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>javax.servlet</groupId> -->\r
+ <!-- <artifactId>javax.servlet-api</artifactId> -->\r
+ <!-- <version>3.1.0</version> -->\r
+ <!-- </dependency> -->\r
+\r
+ <!-- <dependency> -->\r
+ <!-- <groupId>javax.servlet</groupId> -->\r
+ <!-- <artifactId>jsp-api</artifactId> -->\r
+ <!-- <version>2.0</version> -->\r
+ <!-- </dependency> -->\r
+\r
+ <dependency>\r
+ <groupId>net.sf.ehcache</groupId>\r
+ <artifactId>ehcache-core</artifactId>\r
+ <version>2.4.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-core</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate.common</groupId>\r
+ <artifactId>hibernate-commons-annotations</artifactId>\r
+ <version>4.0.1.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-search-engine</artifactId>\r
+ <version>4.2.0.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate.javax.persistence</groupId>\r
+ <artifactId>hibernate-jpa-2.0-api</artifactId>\r
+ <version>1.0.1.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-envers</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-entitymanager</artifactId>\r
+ <version>4.1.10.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>dom4j</groupId>\r
+ <artifactId>dom4j</artifactId>\r
+ <version>1.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jadira.usertype</groupId>\r
+ <artifactId>usertype.jodatime</artifactId>\r
+ <version>2.0.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jadira.usertype</groupId>\r
+ <artifactId>usertype.spi</artifactId>\r
+ <version>2.0.1</version>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.11</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>log4j</groupId>\r
+ <artifactId>log4j</artifactId>\r
+ <version>1.2.17</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jdom</groupId>\r
+ <artifactId>jdom</artifactId>\r
+ <version>1.1.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-context</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-context-support</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-aspects</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-test</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-beans</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-tx</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-web</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-core</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-aop</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-expression</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-orm</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-jdbc</artifactId>\r
+ <version>4.2.4.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-core</artifactId>\r
+ <version>4.0.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-config</artifactId>\r
+ <version>4.0.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework.security</groupId>\r
+ <artifactId>spring-security-remoting</artifactId>\r
+ <version>4.0.3.RELEASE</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.logging</groupId>\r
+ <artifactId>jboss-logging</artifactId>\r
+ <version>3.1.3.GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.hamcrest</groupId>\r
+ <artifactId>hamcrest-core</artifactId>\r
+ <version>1.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.mchange</groupId>\r
+ <artifactId>c3p0</artifactId>\r
+ <version>0.9.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.spec.javax.transaction</groupId>\r
+ <artifactId>jboss-transaction-api_1.1_spec</artifactId>\r
+ <version>1.0.0.Final</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.aspectj</groupId>\r
+ <artifactId>aspectjrt</artifactId>\r
+ <version>1.7.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-logging</groupId>\r
+ <artifactId>commons-logging</artifactId>\r
+ <version>1.1.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-lang</groupId>\r
+ <artifactId>commons-lang</artifactId>\r
+ <version>2.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>aopalliance</groupId>\r
+ <artifactId>aopalliance</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>joda-time</groupId>\r
+ <artifactId>joda-time</artifactId>\r
+ <version>2.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.ibm.lsid</groupId>\r
+ <artifactId>lsid-client</artifactId>\r
+ <version>1.1.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.ibm.lsid</groupId>\r
+ <artifactId>lsid-server</artifactId>\r
+ <version>1.1.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.apache.lucene</groupId>\r
+ <artifactId>lucene-core</artifactId>\r
+ <version>3.6.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <version>1.7.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.javassist</groupId>\r
+ <artifactId>javassist</artifactId>\r
+ <version>3.17.1-GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>au.com.bytecode</groupId>\r
+ <artifactId>opencsv</artifactId>\r
+ <version>2.4</version>\r
+ </dependency>\r
+\r
+ <!-- For Unit Tests Start -->\r
+\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-core</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-spring</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-database</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-dbcp</groupId>\r
+ <artifactId>commons-dbcp</artifactId>\r
+ <version>1.4</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-pool</groupId>\r
+ <artifactId>commons-pool</artifactId>\r
+ <version>1.5.4</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-dbmaintainer</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.h2database</groupId>\r
+ <artifactId>h2</artifactId>\r
+ <version>1.4.181</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.unitils</groupId>\r
+ <artifactId>unitils-dbunit</artifactId>\r
+ <version>3.4.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.dbunit</groupId>\r
+ <artifactId>dbunit</artifactId>\r
+ <version>2.4.9</version>\r
+ </dependency>\r
+ <!-- For Unit Tests End -->\r
+\r
+ <!-- For Hibernate Mapping Start -->\r
+ <dependency>\r
+ <groupId>wsdl4j</groupId>\r
+ <artifactId>wsdl4j</artifactId>\r
+ <version>1.6.3</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.validation</groupId>\r
+ <artifactId>validation-api</artifactId>\r
+ <version>1.1.0.Final</version>\r
+ </dependency>\r
+ <!-- For Hibernate Mapping End -->\r
+\r
+ <dependency>\r
+ <groupId>com.itextpdf</groupId>\r
+ <artifactId>itextpdf</artifactId>\r
+ <version>5.5.8</version>\r
+ <scope>compile</scope>\r
+ </dependency>\r
+ \r
+\r
+ </dependencies>\r
+</project>\r
+
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.cdm.api.application;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmApplicationException extends Exception {
+
+ public CdmApplicationException(Exception ex) {
+ super(ex);
+ }
+
+}
/**\r
-* Copyright (C) 2014 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
+ * Copyright (C) 2014 EDIT\r
+ * European Distributed Institute of Taxonomy\r
+ * http://www.e-taxonomy.eu\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
\r
package eu.etaxonomy.cdm.api.application;\r
\r
-import javax.sql.DataSource;\r
-\r
-import org.hibernate.SessionFactory;\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
\r
import org.apache.log4j.Logger;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.beans.BeansException;\r
+import org.springframework.context.ApplicationContext;\r
+import org.springframework.context.ApplicationContextAware;\r
+import org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor;\r
+import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;\r
+import org.springframework.security.access.AccessDecisionVoter;\r
+import org.springframework.security.authentication.AuthenticationProvider;\r
+import org.springframework.security.authentication.ProviderManager;\r
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;\r
+import org.springframework.security.authentication.dao.DaoAuthenticationProvider;\r
+import org.springframework.security.authentication.dao.ReflectionSaltSource;\r
+import org.springframework.security.authentication.encoding.Md5PasswordEncoder;\r
+import org.springframework.security.core.Authentication;\r
+import org.springframework.security.core.context.SecurityContext;\r
+import org.springframework.security.core.context.SecurityContextHolder;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.PlatformTransactionManager;\r
import org.springframework.transaction.TransactionStatus;\r
\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;\r
+import eu.etaxonomy.cdm.api.service.IAgentService;\r
+import eu.etaxonomy.cdm.api.service.IAnnotationService;\r
+import eu.etaxonomy.cdm.api.service.IClassificationService;\r
+import eu.etaxonomy.cdm.api.service.ICollectionService;\r
+import eu.etaxonomy.cdm.api.service.ICommonService;\r
import eu.etaxonomy.cdm.api.service.IDatabaseService;\r
+import eu.etaxonomy.cdm.api.service.IDescriptionService;\r
+import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;\r
+import eu.etaxonomy.cdm.api.service.IEntityValidationService;\r
+import eu.etaxonomy.cdm.api.service.IEventBaseService;\r
+import eu.etaxonomy.cdm.api.service.IFeatureNodeService;\r
+import eu.etaxonomy.cdm.api.service.IFeatureTreeService;\r
+import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;\r
+import eu.etaxonomy.cdm.api.service.IGroupService;\r
+import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;\r
+import eu.etaxonomy.cdm.api.service.ILocationService;\r
+import eu.etaxonomy.cdm.api.service.IMediaService;\r
+import eu.etaxonomy.cdm.api.service.IMetadataService;\r
+import eu.etaxonomy.cdm.api.service.INameService;\r
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;\r
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;\r
+import eu.etaxonomy.cdm.api.service.IProgressMonitorService;\r
+import eu.etaxonomy.cdm.api.service.IReferenceService;\r
+import eu.etaxonomy.cdm.api.service.IService;\r
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;\r
+import eu.etaxonomy.cdm.api.service.ITaxonService;\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.api.service.ITestService;\r
+import eu.etaxonomy.cdm.api.service.IUserService;\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.api.service.IWorkingSetService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;\r
+import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;\r
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;\r
import eu.etaxonomy.cdm.ext.geo.IEditGeoService;\r
+import eu.etaxonomy.cdm.io.service.IIOService;\r
+import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmPermissionEvaluator;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.UnanimousBasedUnrevokable;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter;\r
+import eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter;\r
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;\r
+import eu.etaxonomy.taxeditor.service.CachedCommonServiceImpl;\r
+import eu.etaxonomy.taxeditor.service.CdmAuthenticatedHttpInvokerRequestExecutor;\r
+import eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor;\r
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;\r
+import eu.etaxonomy.taxeditor.service.TermServiceRequestExecutor;\r
+import eu.etaxonomy.taxeditor.session.CdmEntitySessionManager;\r
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;\r
\r
\r
/**\r
*\r
*/\r
@Component\r
-public class CdmApplicationRemoteConfiguration extends CdmApplicationDefaultConfiguration {\r
- \r
- @SuppressWarnings("unused")\r
- private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class);\r
-\r
- @Autowired\r
- IEditGeoService editGeoService;\r
- \r
- public CdmApplicationRemoteConfiguration() {\r
- }\r
- \r
+public class CdmApplicationRemoteConfiguration implements ICdmApplicationConfiguration, ApplicationContextAware {\r
+\r
+ @SuppressWarnings("unused")\r
+ private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class);\r
+\r
+ protected ApplicationContext applicationContext;\r
+\r
+ private ICdmRemoteSource remoteSource;\r
+\r
+ private Map serviceMap = new HashMap<Class<IService>, IService>();\r
+\r
+ private ICdmEntitySessionManager cdmEntitySessionManager;\r
+\r
+ private CdmPermissionEvaluator cdmPermissionEvaluator;\r
+\r
+ private ProviderManager authenticationManager;\r
+\r
+ private ICachedCommonService cachedCommonService;\r
+\r
+ public CdmApplicationRemoteConfiguration() {}\r
+\r
+ public CdmApplicationRemoteConfiguration(ICdmRemoteSource remoteSource) {\r
+ this.remoteSource = remoteSource;\r
+\r
+ }\r
+\r
+ public void setRemoteSource(ICdmRemoteSource remoteSource) {\r
+ this.remoteSource = remoteSource;\r
+ }\r
+\r
+ private Object getService(Class<?> clazz, String serviceSuffix, HttpComponentsHttpInvokerRequestExecutor executor) {\r
+ if(serviceMap.containsKey(clazz)) {\r
+ return serviceMap.get(clazz);\r
+ }\r
+ Object service = getService(clazz, serviceSuffix, remoteSource, executor);\r
+ serviceMap.put(clazz, service);\r
+ return service;\r
+ }\r
+\r
+ public static Object getService(Class<?> clazz,\r
+ String serviceSuffix,\r
+ ICdmRemoteSource remoteSource,\r
+ HttpComponentsHttpInvokerRequestExecutor executor) {\r
+\r
+ String baseUrl;\r
+ if(remoteSource.getContextPath() == null || remoteSource.getContextPath().equals("")) {\r
+ baseUrl = "http://" + remoteSource.getServer() + ":" + String.valueOf(remoteSource.getPort());\r
+ } else {\r
+ baseUrl = "http://" + remoteSource.getServer() + ":" + String.valueOf(remoteSource.getPort()) + "/" + remoteSource.getContextPath();\r
+ }\r
+ HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean();\r
+ proxy.setServiceInterface(clazz);\r
+ proxy.setServiceUrl(baseUrl + serviceSuffix);\r
+ if(executor != null) {\r
+ executor.setReadTimeout(0);\r
+ proxy.setHttpInvokerRequestExecutor(executor);\r
+ }\r
+ proxy.afterPropertiesSet();\r
+ return proxy.getObject();\r
+ }\r
+\r
+ // ****************************** APPLICATION CONTEXT *************************************************/\r
+\r
+ @Override\r
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException{\r
+ this.applicationContext = applicationContext;\r
+ }\r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#getTransactionManager()\r
*/\r
@Override\r
public PlatformTransactionManager getTransactionManager() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("getTransactionManager is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
+ throw new UnsupportedOperationException("getTransactionManager is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
+\r
+ /**\r
+ * @return\r
*/\r
+ public IEditGeoService getEditGeoService() {\r
+ return (IEditGeoService) getService(IEditGeoService.class, "/remoting/editgeo.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ /**\r
+ * @return\r
+ */\r
+ public ICachedCommonService getCachedCommonService(){\r
+ if(cachedCommonService == null) {\r
+ cachedCommonService = new CachedCommonServiceImpl();\r
+ }\r
+ return cachedCommonService;\r
+ }\r
+\r
+\r
+ public ICdmEntitySessionManager getCdmEntitySessionManager() {\r
+ if(cdmEntitySessionManager == null) {\r
+ cdmEntitySessionManager = new CdmEntitySessionManager();\r
+ }\r
+ return cdmEntitySessionManager;\r
+ }\r
+\r
+\r
+\r
+\r
+\r
+\r
+ // ****************************** GETTER *************************************************/\r
+\r
@Override\r
- public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
+ public final Object getBean(String name){\r
+ throw new UnsupportedOperationException("getBean is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
+\r
+ @Override\r
+ public IAgentService getAgentService(){\r
+ return (IAgentService) getService(IAgentService.class, "/remoting/agent.service", new CdmServiceRequestExecutor());\r
+ }\r
\r
+ @Override\r
+ public IAnnotationService getAnnotationService(){\r
+ return (IAnnotationService) getService(IAnnotationService.class, "/remoting/annotation.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IDatabaseService getDatabaseService(){\r
+ return (IDatabaseService) getService(IDatabaseService.class, "/remoting/database.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public INameService getNameService(){\r
+ return (INameService) getService(INameService.class, "/remoting/name.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IReferenceService getReferenceService(){\r
+ return (IReferenceService) getService(IReferenceService.class, "/remoting/reference.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ITaxonService getTaxonService(){\r
+ return (ITaxonService) getService(ITaxonService.class, "/remoting/taxon.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IClassificationService getClassificationService(){\r
+ return (IClassificationService) getService(IClassificationService.class, "/remoting/classification.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ITaxonNodeService getTaxonNodeService(){\r
+ return (ITaxonNodeService) getService(ITaxonNodeService.class, "/remoting/taxonnode.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IDescriptionService getDescriptionService(){\r
+ return (IDescriptionService) getService(IDescriptionService.class, "/remoting/description.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IOccurrenceService getOccurrenceService(){\r
+ return (IOccurrenceService) getService(IOccurrenceService.class, "/remoting/occurrence.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IPrimerService getPrimerService(){\r
+ return (IPrimerService) getService(IPrimerService.class, "/remoting/primer.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IAmplificationService getAmplificationService(){\r
+ return (IAmplificationService) getService(IAmplificationService.class, "/remoting/amplification.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ISequenceService getSequenceService(){\r
+ return (ISequenceService) getService(ISequenceService.class, "/remoting/sequence.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IEventBaseService getEventBaseService() {\r
+ return (IEventBaseService) getService(IEventBaseService.class, "/remoting/eventbase.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IMediaService getMediaService(){\r
+ return (IMediaService) getService(IMediaService.class, "/remoting/media.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ITermService getTermService(){\r
+ return (ITermService) getService(ITermService.class, "/remoting/term.service", new TermServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ICommonService getCommonService(){\r
+ return (ICommonService) getService(ICommonService.class, "/remoting/common.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ILocationService getLocationService(){\r
+ return (ILocationService) getService(ILocationService.class, "/remoting/location.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IUserService getUserService(){\r
+ return (IUserService) getService(IUserService.class, "/remoting-public/user.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+\r
+ public static IUserService getUserService(ICdmRemoteSource remoteSource) {\r
+ return (IUserService) getService(IUserService.class, "/remoting-public/user.service", remoteSource, new HttpComponentsHttpInvokerRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IMetadataService getMetadataService() {\r
+ return (IMetadataService) getService(IMetadataService.class, "/remoting-public/metadata.service", new HttpComponentsHttpInvokerRequestExecutor());\r
+ }\r
+\r
+ public static IMetadataService getMetadataService(ICdmRemoteSource remoteSource) {\r
+ return (IMetadataService) getService(IMetadataService.class, "/remoting-public/metadata.service", remoteSource, new HttpComponentsHttpInvokerRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IGrantedAuthorityService getGrantedAuthorityService(){\r
+ return (IGrantedAuthorityService) getService(IGrantedAuthorityService.class, "/remoting/grantedauthority.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IService<CdmBase> getMainService(){\r
+ return null;\r
+ }\r
+\r
+\r
+ @Override\r
+ public ProviderManager getAuthenticationManager(){\r
+ if(authenticationManager != null) {\r
+ return authenticationManager;\r
+ }\r
+\r
+ authenticationManager = getAuthenticationManager(getUserService());\r
+ return authenticationManager;\r
+ }\r
+\r
+ public static ProviderManager getAuthenticationManager(IUserService userService) {\r
+ Md5PasswordEncoder passwordEncoder = new Md5PasswordEncoder();\r
+ ReflectionSaltSource saltSource = new ReflectionSaltSource();\r
+ saltSource.setUserPropertyToUse("getUsername");\r
+\r
+ DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();\r
+ daoAuthenticationProvider.setUserDetailsService(userService);\r
+ daoAuthenticationProvider.setSaltSource(saltSource);\r
+ daoAuthenticationProvider.setPasswordEncoder(passwordEncoder);\r
+\r
+ return new ProviderManager(Arrays.asList((AuthenticationProvider)daoAuthenticationProvider));\r
+ }\r
+\r
+\r
+ @Override\r
+ public ConversationHolder NewConversation() {\r
+ return new ConversationHolderMock();\r
+ }\r
+\r
+ @Override\r
+ public ICollectionService getCollectionService(){\r
+ return (ICollectionService) getService(ICollectionService.class, "/remoting/collection.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IFeatureTreeService getFeatureTreeService(){\r
+ return (IFeatureTreeService) getService(IFeatureTreeService.class, "/remoting/featuretree.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IFeatureNodeService getFeatureNodeService(){\r
+ return (IFeatureNodeService) getService(IFeatureNodeService.class, "/remoting/featurenode.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IVocabularyService getVocabularyService(){\r
+ return (IVocabularyService) getService(IVocabularyService.class, "/remoting/vocabulary.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IIdentificationKeyService getIdentificationKeyService(){\r
+ return (IIdentificationKeyService) getService(IIdentificationKeyService.class, "/remoting/identificationkey.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IPolytomousKeyService getPolytomousKeyService(){\r
+ return (IPolytomousKeyService) getService(IPolytomousKeyService.class, "/remoting/polytomouskey.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+\r
+ @Override\r
+ public IPolytomousKeyNodeService getPolytomousKeyNodeService(){\r
+ return (IPolytomousKeyNodeService) getService(IPolytomousKeyNodeService.class, "/remoting/polytomouskeynode.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IProgressMonitorService getProgressMonitorService() {\r
+ return (IProgressMonitorService) getService(IProgressMonitorService.class, "/remoting/progressmonitor.service", new CdmAuthenticatedHttpInvokerRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IWorkingSetService getWorkingSetService(){\r
+ return (IWorkingSetService) getService(IWorkingSetService.class, "/remoting/workingset.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public IGroupService getGroupService(){\r
+ return (IGroupService) getService(IGroupService.class, "/remoting/group.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityValidationService getEntityValidationService(){\r
+ return (IEntityValidationService) getService(IEntityValidationService.class, "/remoting/entityvalidation.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+\r
+ @Override\r
+ public IEntityConstraintViolationService getEntityConstraintViolationService(){\r
+ return (IEntityConstraintViolationService) getService(IEntityConstraintViolationService.class, "/remoting/entityconstraintviolation.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ @Override\r
+ public ICdmPermissionEvaluator getPermissionEvaluator(){\r
+\r
+ if(cdmPermissionEvaluator != null) {\r
+ return cdmPermissionEvaluator;\r
+ }\r
+ List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<AccessDecisionVoter<? extends Object>>();\r
+ decisionVoters.add(new GrantAlwaysVoter());\r
+ decisionVoters.add(new TaxonNodeVoter());\r
+ decisionVoters.add(new TaxonBaseVoter());\r
+ decisionVoters.add(new DescriptionBaseVoter());\r
+ decisionVoters.add(new DescriptionElementVoter());\r
+ UnanimousBasedUnrevokable accessDecisionManager = new UnanimousBasedUnrevokable(decisionVoters);\r
+\r
+ cdmPermissionEvaluator = new CdmPermissionEvaluator();\r
+ cdmPermissionEvaluator.setAccessDecisionManager(accessDecisionManager);\r
+\r
+ return cdmPermissionEvaluator;\r
+ }\r
+\r
+\r
+ @Override\r
+ public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
+ throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#startTransaction()\r
- */\r
@Override\r
public TransactionStatus startTransaction(Boolean readOnly) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
+ throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#commitTransaction(org.springframework.transaction.TransactionStatus)\r
- */\r
@Override\r
public void commitTransaction(TransactionStatus txStatus) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#NewConversation()\r
- */\r
- @Override\r
- public ConversationHolder NewConversation() { \r
- return new ConversationHolderMock();\r
- }\r
- \r
- /**\r
- * @return\r
- */\r
- public IEditGeoService getEditGeoService() {\r
- return this.editGeoService;\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setDataSource(javax.sql.DataSource)\r
- */\r
- @Override\r
- public void setDataSource(DataSource dataSource) { \r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setTransactionManager(org.springframework.transaction.PlatformTransactionManager)\r
- */\r
- @Override\r
- public void setTransactionManager(PlatformTransactionManager transactionManager) { \r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.api.application.CdmApplicationDefaultConfiguration#setSessionFactory(org.hibernate.SessionFactory)\r
- */\r
- @Override\r
- public void setSessionFactory(SessionFactory sessionFactory) { \r
+ throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
+ }\r
+\r
+ @Override\r
+ public void authenticate(String username, String password){\r
+ UsernamePasswordAuthenticationToken tokenForUser = new UsernamePasswordAuthenticationToken(username, password);\r
+ Authentication authentication = this.getAuthenticationManager().authenticate(tokenForUser);\r
+ SecurityContext context = SecurityContextHolder.getContext();\r
+ context.setAuthentication(authentication);\r
+ }\r
+\r
+ public IIOService getIOService() {\r
+ return (IIOService) getService(IIOService.class, "/remoting/io.service", new CdmServiceRequestExecutor());\r
+ }\r
+\r
+ public ITestService getTestService() {\r
+ return (ITestService) getService(ITestService.class, "/remoting/test.service", new CdmServiceRequestExecutor());\r
}\r
}\r
/**
-* Copyright (C) 2014 EDIT
-* 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.
-*/
+ * Copyright (C) 2014 EDIT
+ * 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.cdm.api.application;
import java.util.List;
-import java.util.Properties;
import org.apache.log4j.Logger;
import org.hibernate.collection.internal.AbstractPersistentCollection;
import org.hibernate.proxy.AbstractLazyInitializer;
-import org.springframework.beans.MutablePropertyValues;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationListener;
-import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
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.common.monitor.SubProgressMonitor;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
+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;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
/**
* CDM Application Controller class for remoting clients
- *
+ *
* FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround.
* The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase
* class with {@link CdmApplicationController} and this class as subclasses
*
*/
public class CdmApplicationRemoteController extends CdmApplicationController {
-
+
private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class);
- public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE =
- new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml");
+
+ public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE =
+ new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml");
private final Resource applicationContextResource;
private final IProgressMonitor progressMonitor;
-
+ private ICdmRemoteSource remoteSource;
+
+
/**
* Creates new instance of CdmApplicationRemoteController
- *
+ *
* @param applicationContextResource
* @param remoteSource
* @param omitTermLoading
* @param listeners
* @return
*/
- public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource,
- ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners) {
- return new CdmApplicationRemoteController(applicationContextResource,
- remoteSource,
- omitTermLoading,
- progressMonitor,
- listeners);
-
- }
+// public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource,
+// ICdmRemoteSource remoteSource,
+// IProgressMonitor progressMonitor,
+// List<ApplicationListener> listeners) {
+// return new CdmApplicationRemoteController(applicationContextResource,
+// remoteSource,
+// false,
+// progressMonitor,
+// listeners);
+//
+// }
/**
* Creates new instance of CdmApplicationRemoteController
- *
+ *
* @param applicationContextResource
* @param remoteSource
* @param omitTermLoading
* @param listeners
* @return
*/
- public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners) {
-
- return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
- remoteSource,
- omitTermLoading,
- progressMonitor,
- listeners);
-
+ public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
+ IProgressMonitor progressMonitor,
+ List<ApplicationListener> listeners) {
+
+ return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
+ remoteSource,
+ false,
+ progressMonitor,
+ listeners);
+
}
-
- /**
- * Constructs CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
- */
- private CdmApplicationRemoteController(Resource applicationContextResource,
- ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- IProgressMonitor progressMonitor,
- List<ApplicationListener> listeners){
- logger.info("Start CdmApplicationRemoteController with remote source: " + remoteSource.getName());
- this.applicationContextResource =
- applicationContextResource != null ? applicationContextResource : DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE;
+
+ public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ IProgressMonitor progressMonitor,
+ List<ApplicationListener> listeners) {
+
+ return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE,
+ remoteSource,
+ validateXml,
+ progressMonitor,
+ listeners);
+
+ }
+
+ /**
+ * Constructs CdmApplicationRemoteController
+ *
+ * @param applicationContextResource
+ * @param remoteSource
+ * @param omitTermLoading
+ * @param progressMonitor
+ * @param listeners
+ */
+ private CdmApplicationRemoteController(Resource applicationContextResource,
+ ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ IProgressMonitor progressMonitor,
+ List<ApplicationListener> listeners){
+ logger.info("Start CdmApplicationRemoteController with remote source: " + remoteSource.getName());
+ this.applicationContextResource =
+ applicationContextResource != null ? applicationContextResource : DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE;
this.progressMonitor = progressMonitor != null ? progressMonitor : new NullProgressMonitor();
+ this.remoteSource = remoteSource;
+ setNewRemoteSource(remoteSource, validateXml, listeners);
+
+ }
+
+
- setNewRemoteSource(remoteSource, omitTermLoading, listeners);
-
- }
-
-
-
/**
* Creates and starts a new spring application context
- *
+ *
* @param remoteSource object for connecting to an http-invoker server
* @param omitTermLoading
* @param listeners
* @return
*/
- protected boolean setNewRemoteSource(ICdmRemoteSource remoteSource,
- boolean omitTermLoading,
- List<ApplicationListener> listeners){
+ public boolean setNewRemoteSource(ICdmRemoteSource remoteSource,
+ boolean validateXml,
+ List<ApplicationListener> listeners){
logger.info("Connecting to '" + remoteSource.getName() + "'");
- MonitoredGenericApplicationContext applicationContext = new MonitoredGenericApplicationContext();
- int refreshTasks = 45;
- int nTasks = 5 + refreshTasks;
+ int nTasks = 2;
progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
- progressMonitor.subTask("Registering remote source.");
- PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
- Properties properties = new Properties();
- properties.setProperty("remoteServer", remoteSource.getServer());
- properties.setProperty("remotePort", String.valueOf(remoteSource.getPort()));
- properties.setProperty("remoteContext", remoteSource.getContextPath());
- pspc.setProperties(properties);
- applicationContext.addBeanFactoryPostProcessor(pspc);
+ progressMonitor.subTask("Initialising CDM Model Cache ...");
+ CdmRemoteCacheManager.getInstance();
progressMonitor.worked(1);
-
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
- //xmlReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
- progressMonitor.subTask("Registering resources.");
- xmlReader.loadBeanDefinitions(applicationContextResource);
+ progressMonitor.subTask("Starting application context ...");
+ init();
progressMonitor.worked(1);
-
- //omitTerms
- if (omitTermLoading == true){
- String initializerName = "persistentTermInitializer";
- BeanDefinition beanDef = applicationContext.getBeanDefinition(initializerName);
- MutablePropertyValues values = beanDef.getPropertyValues();
- values.addPropertyValue("omit", omitTermLoading);
- }
-
- if (listeners != null){
- for(ApplicationListener listener : listeners){
- applicationContext.addApplicationListener(listener);
- }
- }
-
-
- applicationContext.refresh(new SubProgressMonitor(progressMonitor, refreshTasks));
- applicationContext.start();
-
- progressMonitor.subTask("Cleaning up.");
- setApplicationContext(applicationContext);
- progressMonitor.worked(1);
-
progressMonitor.done();
return true;
}
-
+
+
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.application.CdmApplicationController#init()
*/
@Override
- protected void init(){
- configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration");
- AbstractLazyInitializer.setConfiguration(this);
- AbstractPersistentCollection.setConfiguration(this);
+ protected void init(){
+ configuration = new CdmApplicationRemoteConfiguration(remoteSource);
+ ((CdmApplicationRemoteConfiguration)configuration).setApplicationContext(applicationContext);
+ AbstractLazyInitializer.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
+ AbstractPersistentCollection.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
+ }
+
+ public ICdmEntitySessionManager getCdmEntitySessionManager() {
+ return ((CdmApplicationRemoteConfiguration)configuration).getCdmEntitySessionManager();
+ }
+ public IIOService getIOService(){
+ return ((CdmApplicationRemoteConfiguration)configuration).getIOService();
}
+ public ITestService getTestService(){
+ return ((CdmApplicationRemoteConfiguration)configuration).getTestService();
+ }
+
+ public ICachedCommonService getCachedCommonService(){
+ return ((CdmApplicationRemoteConfiguration)configuration).getCachedCommonService();
+ }
+
+ public IEditGeoService getEditGeoService() {
+ return ((CdmApplicationRemoteConfiguration)configuration).getEditGeoService();
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.cdm.api.application;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.springframework.security.core.context.SecurityContext;
+
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.cdm.io.service.IIOService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
+import eu.etaxonomy.taxeditor.session.DefaultNewEntityListener;
+
+/**
+ * @author cmathew
+ * @date 17 Jun 2015
+ *
+ */
+public class CdmApplicationState {
+
+ private static CdmApplicationState cdmApplicationState;
+
+ private ICdmApplicationConfiguration appConfig;
+
+ private ICdmDataChangeService dataChangeService;
+
+ private SecurityContext securityContext;
+
+ private static CdmServiceCacher cdmServiceCacher;
+
+ private static String cdmlibVersion = null;
+ private static String cdmlibLastModified = null;
+
+ public static CdmApplicationState getInstance() {
+ if(cdmApplicationState == null) {
+ cdmApplicationState = new CdmApplicationState();
+ }
+
+ return cdmApplicationState;
+ }
+
+ public void setAppConfig(ICdmApplicationConfiguration appConfig) {
+ this.appConfig = appConfig;
+ if(appConfig instanceof CdmApplicationRemoteController) {
+ CdmBase.setNewEntityListener(new DefaultNewEntityListener());
+ } else {
+ CdmBase.setNewEntityListener(null);
+ }
+ }
+
+ public ICdmApplicationConfiguration getAppConfig() {
+ return appConfig;
+ }
+
+ public static void setCurrentAppConfig(ICdmApplicationConfiguration appConfig) {
+ getInstance().setAppConfig(appConfig);
+ }
+
+ public static ICdmApplicationConfiguration getCurrentAppConfig() {
+ return getInstance().getAppConfig();
+ }
+
+ /**
+ * @return the dataChangeService
+ */
+ public ICdmDataChangeService getDataChangeService() {
+ return dataChangeService;
+ }
+
+ /**
+ * @param dataChangeService the dataChangeService to set
+ */
+ public void setDataChangeService(ICdmDataChangeService dataChangeService) {
+ this.dataChangeService = dataChangeService;
+ }
+
+ public static ICdmDataChangeService getCurrentDataChangeService() {
+ return getInstance().getDataChangeService();
+ }
+
+ public static void setCurrentDataChangeService(ICdmDataChangeService dataChangeService) {
+ getInstance().setDataChangeService(dataChangeService);
+ }
+
+
+
+ /**
+ * @return the securityContext
+ */
+ public SecurityContext getSecurityContext() {
+ return securityContext;
+ }
+
+ /**
+ * @param securityContext the securityContext to set
+ */
+ public void setSecurityContext(SecurityContext securityContext) {
+ this.securityContext = securityContext;
+ }
+
+ /**
+ * @return the securityContext
+ */
+ public static SecurityContext getCurrentSecurityContext() {
+ return getInstance().getSecurityContext();
+ }
+
+ /**
+ * @param securityContext the securityContext to set
+ */
+ public static void setCurrentSecurityContext(SecurityContext securityContext) {
+ getInstance().setSecurityContext(securityContext);
+ }
+
+ public static void dispose() {
+ getInstance().setCurrentDataChangeService(null);
+ getInstance().setAppConfig(null);
+ getInstance().setSecurityContext(null);
+ cdmApplicationState = null;
+ cdmServiceCacher = null;
+ cdmlibVersion = null;
+ cdmlibLastModified = null;
+ }
+
+
+ /**
+ * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
+ * interface. If a matching getter is found the according service implementation is returned by
+ * invoking the getter otherwise the method returns <code>null</code>.
+ *
+ * @param <T>
+ * @param serviceClass
+ * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
+ * @throws CdmApplicationException
+ */
+ public static <T extends IService> T getService(Class<T> serviceClass) throws CdmApplicationException {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
+
+ T service = null;
+
+ for (Method method : methods) {
+ Type type = method.getGenericReturnType();
+
+ if (type.equals(serviceClass)) {
+ try {
+ service = (T) method.invoke(configuration, null);
+ break;
+ } catch (IllegalArgumentException iae) {
+ throw new CdmApplicationException(iae);
+ } catch (IllegalAccessException iae) {
+ throw new CdmApplicationException(iae);
+ } catch (InvocationTargetException ite) {
+ throw new CdmApplicationException(ite);
+ }
+ }
+ }
+
+ return service;
+ }
+
+
+ /**
+ * @see #getService(Class)
+ * As ICommonService is not extending IService we need a specific request here
+ */
+ public static ICommonService getCommonService() {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ return configuration.getCommonService();
+
+ }
+
+ public static IIOService getIOService() {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ return ((CdmApplicationRemoteController)configuration).getIOService();
+
+ }
+
+
+ public static ITestService getTestService() {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ return ((CdmApplicationRemoteController)configuration).getTestService();
+
+ }
+
+ public static ICachedCommonService getCachedCommonService() {
+ ICdmApplicationConfiguration configuration = getCurrentAppConfig();
+
+ return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
+
+ }
+
+ public static CdmServiceCacher getCdmServiceCacher() {
+ return cdmServiceCacher;
+ }
+
+ public static void setCdmServiceCacher(CdmServiceCacher cacher) {
+ cdmServiceCacher = cacher;
+ }
+
+ public static void updateCdmlibManifestInfo() {
+ cdmlibVersion = null;
+ cdmlibLastModified = null;
+ String cdmlibPathPrefix = "lib/cdmlib-services-";
+ String jarSuffix = ".jar";
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.cdmlib");
+ Dictionary<String, String> headers = bundle.getHeaders();
+ String bundleClasspath = headers.get(Constants.BUNDLE_CLASSPATH);
+ try {
+ ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, bundleClasspath);
+ for (ManifestElement manifestElement : elements) {
+ String jar = manifestElement.getValue();
+ if(jar.startsWith(cdmlibPathPrefix) && jar.endsWith(jarSuffix)) {
+ URL fileURL = bundle.getEntry(jar);
+ File file = null;
+ try {
+ String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
+ file = new File(new URI(urlString));
+ JarFile jarFile = new JarFile(file);
+ Manifest manifest = jarFile.getManifest();
+ Attributes attributes = manifest.getMainAttributes();
+ // from the OSGI spec the LastModified value is " the number of milliseconds
+ // since midnight Jan. 1, 1970 UTC with the condition that a change must
+ // always result in a higher value than the previous last modified time
+ // of any bundle"
+ cdmlibVersion = attributes.getValue("Bundle-Version");
+ cdmlibLastModified = attributes.getValue("Bnd-LastModified");
+
+ jarFile.close();
+ if(cdmlibVersion == null || cdmlibLastModified == null) {
+ throw new IllegalStateException("Invalid cdmlib manifest info");
+ }
+ } catch (URISyntaxException urise) {
+ throw new IllegalStateException(urise);
+ } catch (IOException ioe) {
+ throw new IllegalStateException(ioe);
+ }
+ }
+ }
+ } catch (BundleException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public static String getCdmlibVersion() {
+ if(cdmlibVersion == null) {
+ updateCdmlibManifestInfo();
+ }
+ return cdmlibVersion;
+ }
+
+ public static String getCdmlibLastModified() {
+ if(cdmlibLastModified == null) {
+ updateCdmlibManifestInfo();
+ }
+ return cdmlibLastModified;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.cdm.api.application;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 7 Apr 2015
+ *
+ */
+public class CdmChangeEvent {
+
+ public enum Action {
+ Create,
+ Update,
+ Delete
+ }
+
+ private final Action action;
+ private final Set<CdmBase> changedObjects;
+ private final Class sourceType;
+ private Class entityType;
+ private Object source;
+
+ public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType) {
+ this.action = action;
+ this.changedObjects = changedObjects;
+ this.sourceType = sourceType;
+ }
+
+ public CdmChangeEvent(Action action, CdmBase changedObject, Class sourceType) {
+ this.action = action;
+ changedObjects = new HashSet<CdmBase>();
+ changedObjects.add(changedObject);
+ this.sourceType = sourceType;
+ }
+
+ public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType, Class entityType) {
+ this(action, changedObjects, sourceType);
+ this.entityType = entityType;
+ }
+
+ public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Object source) {
+ this(action, changedObjects, source.getClass());
+ this.source = source;
+ }
+
+ /**
+ * @return the action
+ */
+ public Action getAction() {
+ return action;
+ }
+
+ /**
+ * @return the changedObjects
+ */
+ public Set<? extends CdmBase> getChangedObjects() {
+ return changedObjects;
+ }
+
+ /**
+ * @return the sourceType
+ */
+ public Class getSourceType() {
+ return sourceType;
+ }
+
+
+ /**
+ * @return the source
+ */
+ public Object getSource() {
+ return source;
+ }
+
+ public Class getEntityType() {
+ return entityType;
+ }
+
+ public boolean hasChanges() {
+ return changedObjects != null && !changedObjects.isEmpty();
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.cdm.api.application;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmDataChangeService implements ICdmDataChangeService {
+
+ protected final Set<ICdmChangeListener> listeners;
+
+ private final List<CdmChangeEvent> currentEvents;
+
+ public CdmDataChangeService() {
+ listeners = new HashSet<ICdmChangeListener>();
+ currentEvents = new ArrayList<CdmChangeEvent>();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#register(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
+ */
+ @Override
+ public void register(ICdmChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmDataChangeService#unregister(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
+ */
+ @Override
+ public void unregister(ICdmChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#addEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+ */
+ @Override
+ public void addEvent(CdmChangeEvent event) {
+ currentEvents.add(event);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireCurrentChangeEvents(boolean)
+ */
+ @Override
+ public void fireCurrentChangeEvents(boolean async) {
+ try {
+ for(CdmChangeEvent event : currentEvents) {
+ fireChangeEvent(event,async);
+ }
+ } finally {
+ currentEvents.clear();
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireChangeEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent, boolean)
+ */
+ @Override
+ public void fireChangeEvent(final CdmChangeEvent event, boolean async) {
+
+ for(final ICdmChangeListener listener : listeners) {
+ listener.onChange(event);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#clear()
+ */
+ @Override
+ public void clear() {
+ listeners.clear();
+ currentEvents.clear();
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.cdm.api.application;
+
+/**
+ * @author cmathew
+ * @date 7 Apr 2015
+ *
+ */
+public interface ICdmChangeListener {
+
+ public void onChange(CdmChangeEvent event);
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.cdm.api.application;
+
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public interface ICdmDataChangeService {
+
+ public abstract void register(ICdmChangeListener listener);
+
+ public abstract void unregister(ICdmChangeListener listener);
+
+ public abstract void addEvent(CdmChangeEvent event);
+
+ public abstract void fireCurrentChangeEvents(boolean async);
+
+ public abstract void fireChangeEvent(CdmChangeEvent event, boolean async);
+
+ public abstract void clear();
+
+}
\ No newline at end of file
import java.util.UUID;
-import org.springframework.beans.factory.annotation.Autowired;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+
import org.springframework.stereotype.Component;
-import eu.etaxonomy.cdm.api.service.ITermService;
+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;
+import eu.etaxonomy.taxeditor.service.TermServiceRequestExecutor;
+import eu.etaxonomy.taxeditor.session.CdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
/**
* Class which uses CDM services to cache cdm entities
*
- * FIXME: Currently only handles terms entities. It would be
+ * FIXME: Currently only handles term entities. It would be
* interesting to have a generic method which finds the
* correct service to load / cache the entity.
*
* @param <T>
*/
@Component
-public class CdmServiceCacher<T extends CdmBase> extends CdmCacher {
+public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver {
- @Autowired
- ITermService termService;
- @Override
- protected T findByUuid(UUID uuid) {
- return (T)termService.findWithoutFlush(uuid);
- }
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.cache.CdmCacher#setup()
- */
+ private ICdmEntitySessionManager cdmEntitySessionManager;
+
+ private CdmTransientEntityCacher cdmTransientEntityCacher;
+
+ private CacheLoader cacheLoader;
+
@Override
protected void setup() {
- // TODO Auto-generated method stub
+ DefinedTermBase.setCacher(this);
+ CdmTransientEntityCacher.setDefaultCacher(this);
+ TermServiceRequestExecutor.setDefaultCacher(this);
+ cacheLoader = new CacheLoader(this);
+ }
+
+
+ @Override
+ protected CacheConfiguration getDefaultCacheConfiguration() {
+ // For a better understanding on how to size caches, refer to
+ // http://ehcache.org/documentation/configuration/cache-size
+
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(100);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ return new CacheConfiguration(DEFAULT_CACHE_NAME, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ }
+
+ @Override
+ protected CdmBase findByUuid(UUID uuid) {
+ CdmBase term = CdmApplicationState.getCurrentAppConfig().getTermService().findWithoutFlush(uuid);
+ return load(term);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.ICdmCacher#isCachable(eu.etaxonomy.cdm.model.common.CdmBase)
- */
@Override
- public boolean isCachable(CdmBase arg0) {
- // TODO Auto-generated method stub
+ public boolean isCachable(CdmBase cdmEntity) {
+ // if(cdmEntity != null && cdmEntity instanceof DefinedTermBase) {
+ if(cdmEntity != null && cdmEntity instanceof TermBase) {
+ return true;
+ }
return false;
}
+
+ public void setCdmEntitySessionManager(ICdmEntitySessionManager cdmEntitySessionManager) {
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+ if(cdmEntitySessionManager != null) {
+ cdmEntitySessionManager.addSessionObserver(this);
+ }
+ }
+
+
+ public CdmTransientEntityCacher getCurrentCacher() {
+ ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession();
+ if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) {
+ return ((CdmEntitySession) cdmEntitySession).getCacher();
+ }
+ return null;
+ }
+
+ @Override
+ public CdmBase getFromCache(CdmBase cdmBase) {
+ CdmBase cachedCdmEntity = null;
+ // first we check in the active session cache if the
+ // entity has been loaded there
+ // FIXME:Remoting do we really need the cdmTransientEntityCacher
+ // here. Is it not guarenteed that all every entity which 'isCachable'
+ // by this cacher is cached only in this cacher ?
+ if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) {
+ CdmEntityCacheKey key = CdmTransientEntityCacher.generateKey(cdmBase);
+ cachedCdmEntity = cdmTransientEntityCacher.getFromCache(key);
+
+ }
+ if(cachedCdmEntity == null) {
+ cachedCdmEntity = super.getFromCache(cdmBase);
+ }
+ return cachedCdmEntity;
+ }
+
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.cache.CdmCacher#load(eu.etaxonomy.cdm.model.common.CdmBase)
*/
@Override
- public CdmBase load(CdmBase arg0) {
- // TODO Auto-generated method stub
- return null;
+ public CdmBase load(CdmBase cdmEntity) {
+ CdmBase cachedCdmEntity = getFromCache(cdmEntity.getUuid());
+
+ if(isCachable(cdmEntity) && cachedCdmEntity == null) {
+ cachedCdmEntity = cacheLoader.load(cdmEntity, false, true);
+ }
+ return cachedCdmEntity;
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver#changed()
+ */
+ @Override
+ public void changed() {
+ ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession();
+ if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) {
+ this.cdmTransientEntityCacher = ((CdmEntitySession) cdmEntitySession).getCacher();
+ } else {
+ this.cdmTransientEntityCacher = null;
+ }
+ }
}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting;
+
+public class CdmEagerLoadingException extends RuntimeException {
+
+ public CdmEagerLoadingException(Throwable t) {
+ super(t);
+ }
+
+ public CdmEagerLoadingException(String message) {
+ super(message);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting;
+
+public class CdmRemotingException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -560332689478356360L;
+
+ public CdmRemotingException(String message) {
+ super(message);
+ }
+
+ public CdmRemotingException(Exception exception) {
+ super(exception);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.api.service.pager.Pager;
+import eu.etaxonomy.cdm.model.ICdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+
+/**
+ * @author cmathew
+ * @date 19 Feb 2015
+ *
+ */
+public class CacheLoader {
+ private static final Logger logger = Logger.getLogger(CacheLoader.class);
+
+ private static boolean isRecursiveEnabled = true;
+
+ protected final ICdmCacher cdmCacher;
+
+ private final Cache cdmlibModelCache;
+
+
+
+ public CacheLoader(ICdmCacher cdmCacher) {
+ this.cdmCacher = cdmCacher;
+ this.cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
+
+ }
+
+
+ public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(String className) {
+ Element e = cdmlibModelCache.get(className);
+ if (e == null) {
+ return null;
+ } else {
+ return (CdmModelFieldPropertyFromClass) e.getObjectValue();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T load(T obj, boolean recursive, boolean update) {
+ if(obj == null) {
+ return null;
+ }
+ if(obj instanceof CdmBase) {
+ return (T) load((CdmBase)obj, recursive, update);
+ } else if (obj instanceof Map) {
+ return (T) load((Map<T,T>)obj, recursive, update);
+ } else if (obj instanceof Collection) {
+ return (T) load((Collection<T>)obj, recursive, update);
+ } else if(obj instanceof Pager) {
+ load(((Pager)obj).getRecords(), recursive, update);
+ return obj;
+ } else if(obj instanceof MergeResult) {
+ return (T) load((MergeResult<CdmBase>)obj, recursive, update);
+ }
+
+ return obj;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends Object> T loadRecursive(T obj, List<Object> alreadyVisitedEntities, boolean update) {
+ if(obj == null) {
+ return null;
+ }
+ if(obj instanceof CdmBase) {
+ return (T) loadRecursive((CdmBase)obj, alreadyVisitedEntities, update);
+ } else if (obj instanceof Map) {
+ return (T) load((Map<T,T>)obj, alreadyVisitedEntities, update);
+ } else if (obj instanceof Collection) {
+ return (T) load((Collection<T>)obj, alreadyVisitedEntities, update);
+ } else if (obj instanceof MergeResult) {
+ return (T) loadRecursive((MergeResult)obj, alreadyVisitedEntities, update);
+ }
+
+
+ logger.info("No caching yet for type " + obj.getClass().getName());
+
+ return obj;
+ }
+
+ public <T extends Object> Map<T,T> load(Map<T,T> map, boolean recursive, boolean update){
+
+
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity map");
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ Map<T,T> cachedMap = load(map, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity map \n");
+ return cachedMap;
+ } else {
+ return load(map, null, update);
+ }
+ }
+
+
+ private <T extends Object> Map<T,T> load(Map<T,T> map, List<Object> alreadyVisitedEntities, boolean update){
+ //map = (Map<T,T>)deproxy(map);
+
+ if(map == null || map.isEmpty()) {
+ return map;
+ }
+
+ int originalMapSize = map.size();
+ Object[] result = new Object[ map.size() * 2 ];
+ Iterator<Map.Entry<T,T>> iter = map.entrySet().iterator();
+ int i=0;
+ // to avoid ConcurrentModificationException
+ alreadyVisitedEntities.add(map);
+ while ( iter.hasNext() ) {
+ Map.Entry<T,T> e = iter.next();
+ result[i++] = e.getKey();
+ result[i++] = e.getValue();
+ }
+
+ for(i=0; i<result.length;i++) {
+ if(alreadyVisitedEntities == null) {
+ result[i] = load(result[i], false, update);
+ } else {
+ result[i] = loadRecursive(result[i], alreadyVisitedEntities, update);
+ }
+ }
+ map.clear();
+ for(i = 0; i < originalMapSize; i+=2 ) {
+ map.put(
+ (T)result[i],
+ (T)result[i+1]
+ );
+ }
+ return map;
+ }
+
+ public <T extends Object> Collection<T> load(Collection<T> collection, boolean recursive, boolean update){
+
+ Collection<T> loadedCollection;
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity collection");
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ Collection<T> cachedCollection = load(collection, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity collection \n");
+ loadedCollection = cachedCollection;
+ } else {
+ loadedCollection = load(collection, null, update);
+ }
+ return loadedCollection;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends Object> Collection<T> load(Collection<T> collection, List<Object> alreadyVisitedEntities, boolean update) {
+
+
+
+ if(collection == null || collection.isEmpty()) {
+ return collection;
+ }
+ int length = collection.size();
+ Object[] result = new Object[length];
+ Iterator<T> collectionItr = collection.iterator();
+ int count = 0;
+ // to avoid ConcurrentModificationException
+ alreadyVisitedEntities.add(collection);
+ while(collectionItr.hasNext()) {
+ Object obj = collectionItr.next();
+ if(alreadyVisitedEntities == null) {
+ result[count] = load(obj, false, update);
+ } else {
+ result[count] = loadRecursive(obj, alreadyVisitedEntities, update);
+ }
+
+ count++;
+ }
+
+ collection.clear();
+
+ for ( int i = 0; i < length; i++ ) {
+ collection.add((T)result[i]);
+ }
+
+ return collection;
+ }
+
+
+ public MergeResult<CdmBase> load(MergeResult<CdmBase> mergeResult, boolean recursive, boolean update) {
+ CdmBase cdmBase = load(mergeResult.getMergedEntity(), recursive, update);
+ load(mergeResult.getNewEntities(), recursive, update);
+ return new MergeResult(cdmBase, mergeResult.getNewEntities());
+ }
+
+ public MergeResult<CdmBase> loadRecursive(MergeResult<CdmBase> mergeResult,List<Object> alreadyVisitedEntities, boolean update) {
+ CdmBase cdmBase = loadRecursive(mergeResult.getMergedEntity(), alreadyVisitedEntities, update);
+ loadRecursive(mergeResult.getNewEntities(), alreadyVisitedEntities, update);
+ return new MergeResult(cdmBase, mergeResult.getNewEntities());
+ }
+
+ /**
+ * Puts the (Key,Value) pair of ({@link java.util.UUID}, {@link eu.etaxonomy.cdm.model.common.CdmBase}),
+ * in the cache corresponding to the given cache id
+ *
+ * @param cacheId
+ * @param uuid
+ * @param cdmEntity
+ */
+ public CdmBase load(CdmBase cdmEntity, boolean recursive, boolean update) {
+ if(cdmEntity == null) {
+ return null;
+ }
+
+ // start by looking up the cdm entity in the cache
+ CdmBase cachedCdmEntity = cdmCacher.getFromCache(cdmEntity);
+
+ if(cachedCdmEntity != null) {
+ // if cdm entity was found in cache then
+ logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " already exists");
+ // .. return if the cached and input objects are identical, else (this is a newly loaded object so) continue
+ if(cachedCdmEntity == cdmEntity) {
+ return cachedCdmEntity;
+ }
+ }
+
+ CdmBase loadedCdmBase;
+ if(isRecursiveEnabled && recursive) {
+ logger.info("---- starting recursive load for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ List<Object> alreadyVisitedEntities = new ArrayList<Object>();
+ CdmBase cb = loadRecursive(cdmEntity, alreadyVisitedEntities, update);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive load for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + "\n");
+ loadedCdmBase = cb;
+ } else {
+ loadedCdmBase = load(cdmEntity);
+ }
+ return loadedCdmBase;
+
+ }
+
+
+ protected CdmBase load(CdmBase cdmEntity) {
+ logger.info("loading object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ cdmCacher.put((CdmBase)ProxyUtils.deproxy(cdmEntity));
+ return cdmCacher.getFromCache(cdmEntity);
+ }
+
+
+ private CdmBase loadRecursive(CdmBase cdmEntity, List<Object> alreadyVisitedEntities, boolean update) {
+
+ CdmBase cachedCdmEntity = load(cdmEntity);
+
+
+ // we want to recursive through the cdmEntity (and not the cachedCdmEntity)
+ // since there could be new or deleted objects in the cdmEntity sub-graph
+
+ // start by getting the fields from the cdm entity
+ String className = cdmEntity.getClass().getName();
+ CdmModelFieldPropertyFromClass cmgmfc = getFromCdmlibModelCache(className);
+ if(cmgmfc != null) {
+ alreadyVisitedEntities.add(cdmEntity);
+ List<String> fields = cmgmfc.getFields();
+ for(String field : fields) {
+ // retrieve the actual object corresponding to the field.
+ // this object will be either a CdmBase or a Collection / Map
+ // with CdmBase as the generic type
+
+ CdmBase cdmEntityInSubGraph = getCdmBaseTypeFieldValue(cdmEntity, cachedCdmEntity, field, alreadyVisitedEntities, update);
+ if(cdmEntityInSubGraph != null) {
+ //checkForIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph);
+ if(!checkForIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph)) {
+ logger.info("recursive loading object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId());
+ loadRecursive(cdmEntityInSubGraph, alreadyVisitedEntities, update);
+ } else {
+ logger.info("object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId() + " already visited");
+ }
+ }
+ }
+ } else {
+ throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " +
+ "The cache may be corrupted or not in sync with the latest model version" );
+ }
+
+ return cachedCdmEntity;
+ }
+
+
+ private CdmBase getCdmBaseTypeFieldValue(CdmBase cdmEntity,
+ CdmBase cachedCdmEntity,
+ String fieldName,
+ List<Object> alreadyVisitedEntities,
+ boolean update) {
+
+ // this method attempts to make sure that for any two objects found in
+ // the object graph, if they are equal then they should also be the same,
+ // which is crucial for the merge to work
+ if(cachedCdmEntity == null) {
+ throw new CdmClientCacheException("When trying to set field value, the cached cdm entity cannot be null");
+ }
+
+ Class<?> clazz = cdmEntity.getClass();
+ try {
+ // this call will search in the provided class as well as
+ // the super classes until it finds the field
+ Field field = ReflectionUtils.findField(clazz, fieldName);
+
+ if(field == null) {
+ throw new CdmClientCacheException("Field '" + fieldName
+ + "' not found when searching in class '" + clazz.getName() + "' and its supercalsses");
+ }
+ field.setAccessible(true);
+ Object o = field.get(cdmEntity);
+ // resetting the value in cdm entity to the deproxied object
+ o = ProxyUtils.deproxy(o);
+ field.set(cdmEntity, o);
+ Object cachedo = field.get(cachedCdmEntity);
+ CdmBase cdmEntityInSubGraph = null;
+
+ if(update || ProxyUtils.isProxy(cachedo)) {
+ // if we are in update mode we have to make the field of the cached entity
+ // up-to-date by setting it to the value of the cdm entity being loaded
+ //
+ // if the cdm entity is a proxy then we always update to make sure that
+ // newly created entities are always up-to-date
+ //
+ // NOTE : the field is overridden in the case of the exception
+ // found below
+ field.set(cachedCdmEntity, o);
+
+ }
+
+ if(o != null && !ProxyUtils.isProxy(o)) {
+ if(CdmBase.class.isAssignableFrom(o.getClass())) {
+ logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+
+ cdmEntityInSubGraph = (CdmBase)o;
+ CdmBase cachedCdmEntityInSubGraph = cdmCacher.getFromCache(cdmEntityInSubGraph);
+
+ if(cachedCdmEntityInSubGraph != null) {
+ if(cachedCdmEntityInSubGraph != cdmEntityInSubGraph) {
+ // exception : is the case where
+ // the field has been already initialised, cached and
+ // is not the same as the one in the cache, in which case we set the value
+ // of the field to the one found in the cache
+ logger.info("setting cached + real value to '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ field.set(cachedCdmEntity, cachedCdmEntityInSubGraph);
+ field.set(cdmEntity, cachedCdmEntityInSubGraph);
+ } else {
+ // since the field value object in cdmEntity
+ // is the same as the field value object in cachedCdmEntity
+ // we are sure that the its subgraph is also correctly loaded,
+ // so we can exit the recursion
+ return null;
+ }
+ }
+ } else if(o instanceof Map && !checkForIdenticalCdmEntity(alreadyVisitedEntities, o)) {
+ loadRecursive((Map)o, alreadyVisitedEntities, update);
+ } else if(o instanceof Collection && !checkForIdenticalCdmEntity(alreadyVisitedEntities, o)) {
+ loadRecursive((Collection)o, alreadyVisitedEntities, update);
+ }
+ }
+ // we return the original cdm entity in the sub graph because we
+ // want to continue to recurse on the input cdm entity graph
+ // and not the one in the cache
+ return cdmEntityInSubGraph;
+ } catch (SecurityException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalArgumentException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmClientCacheException(e);
+ }
+ }
+
+ private boolean checkForIdenticalCdmEntity(List<Object> objList, Object objToCompare) {
+ if(objToCompare != null) {
+ for(Object obj : objList) {
+ if(obj == objToCompare) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ public static boolean isRecursiveEnabled() {
+ return isRecursiveEnabled;
+ }
+
+ public static void setRecursiveEnabled(boolean ire) {
+ isRecursiveEnabled = ire;
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+public class CdmClientCacheException extends RuntimeException {
+
+ public CdmClientCacheException(String message) {
+ super(message);
+ }
+
+ public CdmClientCacheException(Exception e) {
+ super(e);
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+public class CdmEntityCacheKey {
+
+ private Class<? extends CdmBase> persistenceClass;
+ private int persistenceId;
+
+ public CdmEntityCacheKey(CdmBase cdmBase) {
+ this.persistenceClass = cdmBase.getClass();
+ this.persistenceId = cdmBase.getId();
+ }
+
+ public CdmEntityCacheKey(Class<? extends CdmBase> clazz, int id) {
+ this.persistenceClass = clazz;
+ this.persistenceId = id;
+ }
+
+
+
+ public Class<? extends CdmBase> getPersistenceClass() {
+ return persistenceClass;
+ }
+
+ public int getPersistenceId() {
+ return persistenceId;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if(obj == null || !(obj instanceof CdmEntityCacheKey)) {
+ return false;
+ }
+
+ if(this == obj) {
+ return true;
+ }
+ CdmEntityCacheKey that = (CdmEntityCacheKey) obj;
+ if(this.persistenceClass.equals(that.persistenceClass) && this.persistenceId == that.persistenceId) {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return (this.persistenceClass.getName() + String.valueOf(this.persistenceId)).hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return this.persistenceClass.getName() + String.valueOf(this.persistenceId);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.reflect.Field;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.property.access.spi.Getter;
+import org.osgi.framework.Bundle;
+
+import org.hibernate.boot.Metadata;
+
+
+public class CdmModelCacher {
+
+
+
+
+ public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
+
+ public static final String CDM_MAP_SER_FILE_PATH = "resources/cdm.map.ser";
+
+
+
+
+ public void cacheGetterFields(Cache cache) throws IOException, ClassNotFoundException, URISyntaxException {
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = loadModelClassMap();
+
+ cache.removeAll();
+
+ for(Map.Entry<String, CdmModelFieldPropertyFromClass> entry : modelClassMap.entrySet()) {
+ cache.put(new Element(entry.getKey(), entry.getValue()));
+ }
+ }
+
+ public Map<String, CdmModelFieldPropertyFromClass> loadModelClassMap() throws URISyntaxException, IOException, ClassNotFoundException {
+
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.cdmlib");
+
+ URL modelMapFileBundleURL = bundle.getEntry(CDM_MAP_SER_FILE_PATH);
+ URL modelMapFileURL = FileLocator.resolve(modelMapFileBundleURL);
+ String modelMapFilePath = modelMapFileURL.getFile();
+
+ FileInputStream fin = new FileInputStream(modelMapFilePath);
+ ObjectInputStream ois = new ObjectInputStream(fin);
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject();
+ ois.close();
+ return modelClassMap;
+ }
+
+
+ public Map<String, CdmModelFieldPropertyFromClass> generateModelClassMap() {
+
+ // A SessionFactory is set up once for an application!
+ final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
+ .configure(HB_CONFIG_FILE_PATH) // configures settings from hibernate.cfg.xml
+ .build();
+ SessionFactory sessionFactory = null;
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = new HashMap<String, CdmModelFieldPropertyFromClass>();
+ try {
+ sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
+ Configuration configuration = buildConfiguration(HB_CONFIG_FILE_PATH);
+ Map<String, ClassMetadata> classMetaDataMap = sessionFactory.getAllClassMetadata();
+ Metadata metadata = new MetadataSources( registry ).getMetadataBuilder().applyImplicitNamingStrategy( ImplicitNamingStrategyJpaCompliantImpl.INSTANCE ).build();
+
+
+ for(ClassMetadata classMetaData :classMetaDataMap.values()) {
+ Class mappedClass = classMetaData.getMappedClass();
+
+ String mappedClassName = mappedClass.getName();
+
+ PersistentClass persistentClass =metadata.getEntityBinding(mappedClassName);
+ CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
+ System.out.println("Adding class : " + mappedClassName + " to cache");
+ addGetters(persistentClass, cmgmfc);
+ modelClassMap.put(mappedClassName, cmgmfc);
+ }
+ }
+ catch (Exception e) {
+ // The registry would be destroyed by the SessionFactory, but we had trouble building the SessionFactory
+ // so destroy it manually.
+ StandardServiceRegistryBuilder.destroy( registry );
+ }
+
+
+ return modelClassMap;
+ }
+
+
+ public static Configuration buildConfiguration(String hibernateConfigFilePath) {
+ Configuration configuration = new Configuration().configure(hibernateConfigFilePath);
+ configuration.buildMappings();
+ return configuration;
+ }
+
+ private void addGetters(PersistentClass persistentClass, CdmModelFieldPropertyFromClass cmgmfc) {
+ if (persistentClass != null) {
+ Iterator propertyIt = persistentClass.getPropertyIterator();
+
+ while(propertyIt.hasNext())
+ {
+ Property property = (Property)propertyIt.next();
+ Getter getter = property.getGetter(persistentClass.getMappedClass());
+ if(getter != null && getter.getMember() != null) {
+ Field field = (Field)getter.getMember();
+
+ //logger.info(" - contains field '" + field.getName() + "' of type '" + field.getType().getName() + "'");
+ cmgmfc.addGetMethods(field.getName());
+ }
+ }
+ addGetters(persistentClass.getSuperclass(), cmgmfc);
+ }
+ }
+
+
+
+ public static void main(String argv[]) {
+
+ // To re-create the serialised cdm map run,
+ // mvn exec:java -Dexec.mainClass="eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher"
+ // in the eu.etaxonomy.taxeditor.cdmlib project root dir
+ String CDM_MAP_SER_DIR = "resources/";
+
+ CdmModelCacher cdmModelCacher = new CdmModelCacher();
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = cdmModelCacher.generateModelClassMap();
+ try{
+
+ FileOutputStream fout = new FileOutputStream(CDM_MAP_SER_DIR + "cdm.map.ser");
+ ObjectOutputStream oos = new ObjectOutputStream(fout);
+ oos.writeObject(modelClassMap);
+ oos.close();
+ System.out.println("CDM Map serialized");
+
+ }catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CdmModelFieldPropertyFromClass implements Serializable {
+
+ private static final long serialVersionUID = 5726395976531887526L;
+ private String className;
+ private String parentClassName;
+
+ private List<String> fields = new ArrayList<String>();
+
+
+ public CdmModelFieldPropertyFromClass(String className) {
+ this.setClassName(className);
+ }
+
+ public String getParentClassName() {
+ return parentClassName;
+ }
+
+ public void setParentClassName(String parentClassName) {
+ this.parentClassName = parentClassName;
+ }
+
+ public List<String> getFields() {
+ return fields;
+ }
+
+ public void setFields(List<String> fields) {
+ this.fields = fields;
+ }
+
+ public void addGetMethods(String getMethod) {
+ this.fields.add(getMethod);
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.remoting.cache;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+
+import org.apache.log4j.Logger;
+
+
+public class CdmRemoteCacheManager {
+
+ private static final Logger logger = Logger.getLogger(CdmRemoteCacheManager.class);
+
+
+ private Cache cdmlibModelCache;
+
+ private static CdmRemoteCacheManager cdmRemoteCacheManager = null;
+
+ public static final String CDM_MODEL_CACHE_NAME = "cdmModelGetMethodsCache";
+
+ private static Thread initThread;
+
+ private static boolean cacheInitialised = false;
+
+ public enum CdmCacheManagerType {
+ CDMLIB_MODEL,
+ DEFAULT
+ }
+
+ public static CdmRemoteCacheManager getInstance(){
+
+ if(cdmRemoteCacheManager == null) {
+ cdmRemoteCacheManager = new CdmRemoteCacheManager();
+ }
+ return cdmRemoteCacheManager;
+ }
+ private CdmRemoteCacheManager() {
+
+
+ try {
+ // NOTE:Programmatically creating the cache manager may solve the problem of
+ // recreating data written to disk on startup
+ // see https://stackoverflow.com/questions/1729605/ehcache-persist-to-disk-issues
+ //String cacheFilePath = CDMLIB_CACHE_MANAGER_CONFIG_RESOURCE.getFile().getAbsolutePath();
+ //InputStream in = this.getClass().getClassLoader().getResourceAsStream("cdmlib-ehcache.xml");
+
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(1000);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ CacheConfiguration modelcc = new CacheConfiguration(CDM_MODEL_CACHE_NAME, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ cdmlibModelCache = new Cache(modelcc);
+
+ CacheManager.create().addCache(cdmlibModelCache);
+ CdmModelCacher cmdmc = new CdmModelCacher();
+ cmdmc.cacheGetterFields(cdmlibModelCache);
+
+ } catch (CacheException e) {
+ throw new CdmClientCacheException(e);
+ } catch (ClassNotFoundException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IOException e) {
+ throw new CdmClientCacheException(e);
+ } catch (URISyntaxException e) {
+ throw new CdmClientCacheException(e);
+ }
+
+ }
+
+
+ public Cache getCdmModelGetMethodsCache(){
+ return cdmlibModelCache;
+ }
+
+ public static void removeEntityCaches() {
+ CacheManager cm = CacheManager.create();
+ String[] cacheNames = CacheManager.create().getCacheNames();
+ for(String cacheName : cacheNames) {
+ if(!cacheName.equals(CDM_MODEL_CACHE_NAME)) {
+ cm.removeCache(cacheName);
+ }
+ }
+ }
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.remoting.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.Status;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.dto.CdmEntityIdentifier;
+import eu.etaxonomy.cdm.model.ICdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+/**
+ *
+ * This cache guarantees that
+ * - all objects put will be ancestors of CdmBase
+ * - all CdmBase objects in the cache will be already de-proxied
+ * - after any CdmBase object is put in the cache,
+ * all non-null / non-proxy CdmBase objects in the sub-graph
+ * will also be present in the cache.
+ *
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+
+public class CdmTransientEntityCacher implements ICdmCacher {
+
+ private static final Logger logger = Logger.getLogger(CdmTransientEntityCacher.class);
+
+
+ private final ICdmEntitySessionManager cdmEntitySessionManager;
+
+ private static CdmServiceCacher cdmServiceCacher;
+
+ private final String cacheId;
+
+ private final Cache cache;
+
+ private final CacheLoader cacheLoader;
+
+ private final Map<UUID, CdmBase> newEntitiesMap = new HashMap<UUID, CdmBase>();
+
+ public CdmTransientEntityCacher(String cacheId, ICdmEntitySessionManager cdmEntitySessionManager) {
+ this.cacheId = cacheId;
+
+ cache = new Cache(getEntityCacheConfiguration(cacheId));
+
+ CacheManager.create().removeCache(cache.getName());
+ CacheManager.create().addCache(cache);
+
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+
+ cacheLoader = new CacheLoader(this);
+
+ }
+
+ public CdmTransientEntityCacher(Object sessionOwner, ICdmEntitySessionManager cdmEntitySessionManager) {
+ this(generateCacheId(sessionOwner), cdmEntitySessionManager);
+ }
+
+ public static String generateCacheId(Object sessionOwner) {
+ return sessionOwner.getClass().getName() + String.valueOf(sessionOwner.hashCode());
+ }
+
+ /**
+ * Returns the default cache configuration.
+ *
+ * @return
+ */
+ private CacheConfiguration getEntityCacheConfiguration(String cacheId) {
+ SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
+ sizeOfConfig.setMaxDepth(100);
+ sizeOfConfig.setMaxDepthExceededBehavior("abort");
+
+ return new CacheConfiguration(cacheId, 0)
+ .eternal(true)
+ .statistics(true)
+ .sizeOfPolicy(sizeOfConfig)
+ .overflowToOffHeap(false);
+
+ }
+
+ public static void setDefaultCacher(CdmServiceCacher css) {
+ cdmServiceCacher = css;
+ }
+
+ public LiveCacheStatistics getCacheStatistics() {
+ if(cache.getStatus() == Status.STATUS_ALIVE) {
+ return cache.getLiveCacheStatistics();
+ }
+ return null;
+
+ }
+
+ /**
+ * Returns the cache corresponding to the cache id
+ *
+ * @param cacheId
+ * @return
+ */
+ private Cache getCache() {
+ return CacheManager.create().getCache(cacheId);
+ }
+
+ public <T extends Object> T load(T obj, boolean update) {
+ return cacheLoader.load(obj, true, update);
+ }
+
+ public <T extends Object> Map<T,T> load(Map<T,T> map, boolean update){
+ return cacheLoader.load(map, true, update);
+ }
+
+ public <T extends Object> Collection<T> load(Collection<T> collection, boolean update){
+ return cacheLoader.load(collection, true, update);
+ }
+
+ public CdmBase load(CdmBase cdmEntity, boolean update) {
+ return cacheLoader.load(cdmEntity, true, update);
+ }
+
+
+ private CdmBase load(CdmEntityIdentifier cei, boolean update) {
+ return CdmApplicationState.getCommonService().findWithUpdate(cei.getCdmClass(), cei.getId());
+ }
+
+
+ public UpdateResult load(UpdateResult result, boolean update) {
+ // probably a good time to broadcast to other sessions
+
+ Set<CdmBase> updatedObjects = result.getUpdatedObjects();
+ Set<CdmBase> reloadedObjects = new HashSet<CdmBase>();
+ Set<CdmEntityIdentifier> updatedCdmIds = result.getUpdatedCdmIds();
+ boolean updatedCdmIdsIsEmpty = updatedCdmIds.isEmpty();
+
+ // if the cdm identifier set contains identifiers of objects already
+ // present in the updated objects set reomve them
+ for(CdmBase updatedObject : updatedObjects) {
+ if(updatedObject != null && exists(new CdmEntityCacheKey(updatedObject.getClass(), updatedObject.getId()))) {
+ CdmEntityIdentifier cdmEntityIdentifier = new CdmEntityIdentifier(updatedObject.getId(), updatedObject.getClass());
+ if(!updatedCdmIdsIsEmpty && updatedCdmIds.contains(cdmEntityIdentifier)) {
+ updatedCdmIds.remove(cdmEntityIdentifier);
+ }
+ reloadedObjects.add(cacheLoader.load(updatedObject, true, update));
+ }
+ }
+
+ // remote load cdm identifiers of objects which already exist
+ // in the cache
+
+ for(CdmEntityIdentifier cei : updatedCdmIds) {
+ if(exists(new CdmEntityCacheKey(cei.getCdmClass(), cei.getId()))) {
+ reloadedObjects.add(load(cei, update));
+ }
+
+ }
+ updatedObjects.clear();
+ result.addUpdatedObjects(reloadedObjects);
+ return result;
+ }
+
+ public MergeResult<CdmBase> load(MergeResult<CdmBase> mergeResult, boolean update) {
+ return cacheLoader.load(mergeResult, true, update);
+ }
+
+ public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(String className) {
+ return cacheLoader.getFromCdmlibModelCache(className);
+ }
+
+
+ public void addNewEntity(CdmBase newEntity) {
+ if(newEntity != null && newEntity.getId() == 0 && newEntity.getUuid() != null) {
+ newEntitiesMap.put(newEntity.getUuid(), newEntity);
+ }
+ }
+
+ @Override
+ public void put(CdmBase cdmEntity) {
+
+ CdmBase cachedCdmEntity = cdmServiceCacher.load(cdmEntity);
+ if(cachedCdmEntity != null) {
+ logger.info("Cdm Entity with id : " + cdmEntity.getId() + " already exists in permanent cache. Ignoring put.");
+ return;
+ }
+ CdmEntityCacheKey id = new CdmEntityCacheKey(cdmEntity);
+
+ cachedCdmEntity = getFromCache(id);
+ if(cachedCdmEntity == null) {
+ CdmBase cdmEntityToCache = cdmEntity;
+ CdmBase newEntity = newEntitiesMap.get(cdmEntity.getUuid());
+ if(newEntity != null) {
+ newEntity.setId(cdmEntity.getId());
+ cdmEntityToCache = newEntity;
+ }
+ getCache().put(new Element(id, cdmEntityToCache));
+ cdmEntityToCache.initListener();
+ newEntitiesMap.remove(cdmEntity.getUuid());
+ logger.info(" - object of type " + cdmEntityToCache.getClass().getName() + " with id " + cdmEntityToCache.getId() + " put in cache");
+ return;
+ }
+ logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " already exists");
+ }
+
+
+ private Element getCacheElement(CdmEntityCacheKey key) {
+ return getCache().get(key);
+ }
+
+
+ public CdmBase getFromCache(CdmEntityCacheKey id) {
+ Element e = getCacheElement(id);
+
+ if (e == null) {
+ return null;
+ } else {
+ return (CdmBase) e.getObjectValue();
+ }
+ }
+
+ public CdmBase getFromCache(Class<? extends CdmBase> clazz, int id) {
+ CdmEntityCacheKey cacheId = generateKey(clazz,id);
+ return getFromCache(cacheId);
+ }
+
+ @Override
+ public CdmBase getFromCache(CdmBase cdmBase) {
+
+ CdmEntityCacheKey cacheId = generateKey((CdmBase)ProxyUtils.deproxy(cdmBase));
+ // first try this cache
+ CdmBase cachedCdmEntity = getFromCache(cacheId);
+
+ if(cachedCdmEntity == null) {
+ // ... then try the permanent cache
+ cachedCdmEntity = cdmServiceCacher.getFromCache(cdmBase.getUuid());
+ }
+
+ return cachedCdmEntity;
+ }
+
+ public CdmBase getFromCache(CdmBase cdmBase, Class<? extends CdmBase> clazz) {
+
+ cdmBase = CdmBase.deproxy(cdmBase, clazz);
+ return getFromCache(cdmBase);
+ }
+
+ public List<CdmBase> getAllEntities() {
+ List<CdmBase> entities = new ArrayList<CdmBase>();
+ Map<String, CdmBase> elementsMap = getCache().getAllWithLoader(getCache().getKeys(), null);
+ for (Map.Entry<String, CdmBase> entry : elementsMap.entrySet()) {
+ entities.add(entry.getValue());
+ }
+ return entities;
+ }
+
+ public boolean exists(CdmEntityCacheKey key) {
+ return (getCacheElement(key) != null);
+ }
+
+ public boolean existsAndIsNotNull(CdmEntityCacheKey id) {
+ return getFromCache(id) != null;
+ }
+
+ public void clear() {
+ cache.removeAll();
+ }
+
+ public void dispose() {
+ CacheManager.create().removeCache(cache.getName());
+ cache.dispose();
+ newEntitiesMap.clear();
+
+ }
+
+
+ public static CdmEntityCacheKey generateKey(Class<? extends CdmBase> clazz, int id) {
+ return new CdmEntityCacheKey(clazz, id);
+ }
+
+
+ public static CdmEntityCacheKey generateKey(CdmBase cdmBase) {
+ Class<? extends CdmBase> entityClass = cdmBase.getClass();
+ int id = cdmBase.getId();
+ return new CdmEntityCacheKey(entityClass, id);
+ }
+
+ @Override
+ public CdmBase load(CdmBase cdmEntity) {
+ return load(cdmEntity, true);
+ }
+
+ @Override
+ public boolean isCachable(CdmBase cdmEntity) {
+ return true;
+ }
+
+ @Override
+ public boolean exists(CdmBase cdmBase) {
+ return exists(generateKey(cdmBase));
+ }
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.api.cache.CdmCacher;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 9 Feb 2015
+ *
+ */
+public class EntityCacherDebugResult {
+
+ private static final Logger logger = Logger.getLogger(EntityCacherDebugResult.class);
+
+ private Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap;
+
+ private List<CdmEntityInfo> notInCacheList;
+
+ private CdmTransientEntityCacher cacher;
+
+ private List<CdmEntityInfo> rootElements;
+
+ StringBuilder debugOutput = new StringBuilder();
+
+ public EntityCacherDebugResult() {
+ }
+
+
+ public <T extends CdmBase> EntityCacherDebugResult(CdmTransientEntityCacher cacher, Collection<T> rootEntities) {
+ this.cacher = cacher;
+ init();
+
+ if(rootEntities != null && !rootEntities.isEmpty()) {
+ for(CdmBase rootEntity : rootEntities) {
+ debug(rootEntity, true);
+ String out = toString(duplicateCdmEntityMap, notInCacheList, rootEntity);
+ System.out.println(out);
+ debugOutput.append(out);
+ clear();
+ }
+
+ }
+ }
+
+ private void init() {
+ duplicateCdmEntityMap = new HashMap<CdmEntityInfo, CdmEntityInfo>();
+ notInCacheList = new ArrayList<CdmEntityInfo>();
+ rootElements = new ArrayList<CdmEntityInfo>();
+ }
+
+ private void clear() {
+ duplicateCdmEntityMap.clear();
+ notInCacheList.clear();
+ }
+
+ public void addDuplicateEntity(CdmEntityInfo cei, CdmEntityInfo cachedCei) {
+ duplicateCdmEntityMap.put(cei, cachedCei);
+ }
+
+ public void addEntityNotInCache(CdmEntityInfo cei) {
+ notInCacheList.add(cei);
+ }
+
+ public List<CdmEntityInfo> getRootElements() {
+ return rootElements;
+ }
+
+ private void print(Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap,
+ List<CdmEntityInfo> notInCacheList,
+ CdmBase rootEntity) {
+ System.out.println(toString(duplicateCdmEntityMap, notInCacheList, rootEntity));
+ }
+
+
+ @Override
+ public String toString() {
+ return debugOutput.toString();
+ }
+
+ private String toString(Map<CdmEntityInfo, CdmEntityInfo> duplicateCdmEntityMap,
+ List<CdmEntityInfo> notInCacheList,
+ CdmBase rootEntity) {
+
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(System.getProperty("line.separator"));
+ sb.append("<<< Root Entity " + rootEntity.getUserFriendlyTypeName() + " with id " + rootEntity.getId() + " >>>");
+ sb.append(System.getProperty("line.separator"));
+ if(duplicateCdmEntityMap.isEmpty()) {
+ sb.append("No Duplicate CDM Entities.");
+ } else {
+ sb.append("Duplicate CDM Entities,");
+
+ for (Map.Entry<CdmEntityInfo, CdmEntityInfo> entry : duplicateCdmEntityMap.entrySet())
+ {
+ sb.append(System.getProperty("line.separator"));
+ CdmEntityInfo cei = entry.getKey();
+ CdmBase cb = (CdmBase) cei.getObject();
+
+ sb.append(" - " + cei.getField().getName() + ":" + cb.getUserFriendlyTypeName() + "/" + cb.getId());
+ if(cei.getParent() != null) {
+ Object cbParent = cei.getParent().getObject();
+ sb.append(" in entity " + cbParent.getClass().getCanonicalName());
+ if(cbParent instanceof CdmBase) {
+
+ sb.append(" with id : " + ((CdmBase)cbParent).getId());
+ }
+ }
+ sb.append(System.getProperty("line.separator"));
+ sb.append(" -- entity belongs to cache(s) : " + getCachesContainingEntity(cb));
+ sb.append(System.getProperty("line.separator"));
+
+
+ CdmEntityInfo dupCei = entry.getValue();
+ CdmBase dupCb = (CdmBase) dupCei.getObject();
+
+ String dupCeiFieldName = "";
+ if(dupCei.getField() != null) {
+ dupCeiFieldName = dupCei.getField().getName();
+ }
+ sb.append(" - " + dupCeiFieldName + ":" + dupCb.getUserFriendlyTypeName() + "/" + dupCb.getId());
+ if(dupCei.getParent() != null) {
+ Object dupCbParent = dupCei.getParent().getObject();
+ sb.append(" in entity " + dupCbParent.getClass().getCanonicalName());
+ if(dupCbParent instanceof CdmBase) {
+ sb.append(" with id : " + ((CdmBase)dupCbParent).getId());
+ }
+ }
+ sb.append(System.getProperty("line.separator"));
+ sb.append(" -- entity belongs to cache(s) : " + getCachesContainingEntity(dupCb));
+ sb.append(System.getProperty("line.separator"));
+ sb.append("-----------");
+ }
+ }
+
+ sb.append(System.getProperty("line.separator"));
+ sb.append(System.getProperty("line.separator"));
+
+ if(notInCacheList.isEmpty()) {
+ sb.append("No Entities found which are not in Cache.");
+ } else {
+ sb.append("Not In Cache Entities,");
+
+ for(CdmEntityInfo cei : notInCacheList) {
+ CdmBase cb = (CdmBase) cei.getObject();
+ Object cbParent = cei.getParent().getObject();
+
+ sb.append(System.getProperty("line.separator"));
+
+ String fieldName = "";
+ if(cei.getField() != null) {
+ fieldName = cei.getField().getName();
+ }
+ sb.append(" - " + fieldName + ":" + cb.getUserFriendlyTypeName() + "/" + cb.getId());
+
+ if(cbParent instanceof CdmBase) {
+ sb.append(" of entity " + ((CdmBase)cbParent).getUserFriendlyTypeName());
+ } else {
+ sb.append(" of entity " + cbParent.getClass().getName());
+ }
+ }
+ }
+ sb.append(System.getProperty("line.separator"));
+ return sb.toString();
+ }
+
+ private String getCachesContainingEntity(CdmBase cdmEntity) {
+ Cache defaultCache = CacheManager.create().getCache(CdmCacher.DEFAULT_CACHE_NAME);
+ String caches = "";
+ Element dce = defaultCache.get(cdmEntity.getUuid());
+ if(dce != null && dce.getObjectValue() == cdmEntity) {
+ caches = "{DC}";
+ }
+
+ Object cte = cacher.getFromCache(CdmTransientEntityCacher.generateKey(cdmEntity));
+ if(cte != null && cte == cdmEntity) {
+ caches += "{TC}";
+ }
+ return caches;
+ }
+
+
+ private void debug(CdmBase cdmEntity, boolean recursive) {
+ if(cdmEntity == null) {
+ return;
+ }
+ logger.info("---- starting recursive debug for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId());
+ List<CdmEntityInfo> alreadyVisitedEntities = new ArrayList<CdmEntityInfo>();
+ CdmEntityInfo cei = new CdmEntityInfo(ProxyUtils.deproxy(cdmEntity));
+ debugRecursive(cdmEntity, alreadyVisitedEntities, cei);
+ rootElements.add(cei);
+ alreadyVisitedEntities.clear();
+ logger.info("---- ending recursive debug for cdm entity " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + "\n");
+ }
+
+ private <T extends Object> void debugRecursive(T obj,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ if(obj == null) {
+ return;
+ }
+ if(obj instanceof CdmBase) {
+ debugRecursive((CdmBase)obj, alreadyVisitedEntities, cei);
+ } else if (obj instanceof Map) {
+ debug((Map<T,T>)obj, alreadyVisitedEntities, cei);
+ } else if (obj instanceof Collection) {
+ debug((Collection<T>)obj, alreadyVisitedEntities, cei);
+ }
+
+ logger.info("No caching yet for type " + obj.getClass().getName());
+
+
+ }
+
+ private <T extends Object> void debug(Map<T,T> map,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ if(map == null || map.isEmpty()) {
+ return;
+ }
+
+ int originalMapSize = map.size();
+
+ Iterator<Map.Entry<T,T>> iter = map.entrySet().iterator();
+ int i=0;
+ while ( iter.hasNext() ) {
+ Map.Entry<T,T> e = iter.next();
+ CdmEntityInfo childCei = new CdmEntityInfo(e);
+ cei.addChild(childCei);
+
+ CdmEntityInfo keyCei = new CdmEntityInfo(ProxyUtils.deproxy(e.getKey()));
+ childCei.addChild(keyCei);
+ CdmEntityInfo valueCei = new CdmEntityInfo(ProxyUtils.deproxy(e.getValue()));
+ childCei.addChild(valueCei);
+
+ debugRecursive(e.getKey(), alreadyVisitedEntities, keyCei);
+ debugRecursive(e.getValue(), alreadyVisitedEntities, valueCei);
+ }
+ }
+
+ private <T extends Object> void debug(Collection<T> collection,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+ int length = collection.size();
+ Object[] result = new Object[length];
+ Iterator<T> collectionItr = collection.iterator();
+
+ while(collectionItr.hasNext()) {
+ Object obj = collectionItr.next();
+ CdmEntityInfo childCei = new CdmEntityInfo(ProxyUtils.deproxy(obj));
+ cei.addChild(childCei);
+ debugRecursive(obj, alreadyVisitedEntities, childCei);
+
+ }
+
+ }
+
+ private void debugRecursive(CdmBase cdmEntity,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+
+ CdmBase cachedCdmEntityInSubGraph = null;
+
+ if(cei.getObject() instanceof CdmBase) {
+ CdmBase cb = (CdmBase)cei.getObject();
+ cachedCdmEntityInSubGraph = cacher.getFromCache(cb);
+ if(cachedCdmEntityInSubGraph != cb) {
+ // found a cdm entity which is not in cache - need to record this
+ //logger.info(" - found entity not in cache " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ addEntityNotInCache(cei);
+ }
+ }
+
+
+ // we want to recursive through the cdmEntity (and not the cachedCdmEntity)
+ // since there could be new or deleted objects in the cdmEntity sub-graph
+
+ // start by getting the fields from the cdm entity
+ String className = cdmEntity.getClass().getName();
+ CdmModelFieldPropertyFromClass cmgmfc = cacher.getFromCdmlibModelCache(className);
+ if(cmgmfc != null) {
+ alreadyVisitedEntities.add(cei);
+ List<String> fields = cmgmfc.getFields();
+ for(String field : fields) {
+ // retrieve the actual object corresponding to the field.
+ // this object will be either a CdmBase or a Collection / Map
+ // with CdmBase as the generic type
+ String f = field;
+ CdmEntityInfo childCei = getDebugCdmBaseTypeFieldValue(cdmEntity, field, alreadyVisitedEntities, cei);
+ if(!childCei.isProxy()) {
+ Object object = childCei.getObject();
+ if(object != null && object instanceof CdmBase) {
+ CdmBase cdmEntityInSubGraph = (CdmBase)object;
+ if(!containsIdenticalCdmEntity(alreadyVisitedEntities, cdmEntityInSubGraph)) {
+ logger.info("recursive debugging object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId());
+ debugRecursive(cdmEntityInSubGraph, alreadyVisitedEntities, childCei);
+ } else {
+ logger.info("object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId() + " already visited");
+ }
+ }
+ }
+ }
+ } else {
+ throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " +
+ "The cache may be corrupted or not in sync with the latest model version" );
+ }
+
+ }
+
+
+ private CdmEntityInfo getDebugCdmBaseTypeFieldValue(CdmBase cdmEntity,
+ String fieldName,
+ List<CdmEntityInfo> alreadyVisitedEntities,
+ CdmEntityInfo cei) {
+
+ CdmEntityInfo childCei = null;
+ Class<?> clazz = cdmEntity.getClass();
+ try {
+ // this call will search in the provided class as well as
+ // the super classes until it finds the field
+ Field field = ReflectionUtils.findField(clazz, fieldName);
+
+ if(field == null) {
+ throw new CdmClientCacheException("Field '" + fieldName
+ + "' not found when searching in class '" + clazz.getName() + "' and its supercalsses");
+ }
+ field.setAccessible(true);
+ Object o = field.get(cdmEntity);
+ o = ProxyUtils.deproxy(o);
+ CdmBase cdmEntityInSubGraph = null;
+
+ boolean isHibernateProxy = false;
+ boolean isPersistentCollection = false;
+
+ childCei = new CdmEntityInfo(o);
+ cei.addChild(childCei);
+ childCei.setField(field);
+
+ if(o != null) {
+ boolean isProxy = ProxyUtils.isProxy(o);
+
+ childCei.setProxy(isProxy);
+ if(!isProxy) {
+ childCei.setObject(o);
+ if(CdmBase.class.isAssignableFrom(o.getClass())) {
+ logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ cdmEntityInSubGraph = (CdmBase)o;
+
+ //logger.info(" - found duplicate entity at " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
+ CdmEntityInfo dupCei = getDuplicate(alreadyVisitedEntities, cdmEntityInSubGraph);
+ if(dupCei != null) {
+ addDuplicateEntity(childCei, dupCei);
+ }
+
+ } else if(o instanceof Map) {
+ debugRecursive((Map)o, alreadyVisitedEntities, childCei);
+ } else if(o instanceof Collection) {
+ debugRecursive((Collection)o, alreadyVisitedEntities, childCei);
+ }
+
+ }
+ }
+ // we return the original cdm entity in the sub graph because we
+ // want to continue to recurse on the input cdm entity graph
+ // and not the one in the cache
+
+ return childCei;
+ } catch (SecurityException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalArgumentException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmClientCacheException(e);
+ }
+ }
+
+
+ private CdmEntityInfo getDuplicate(List<CdmEntityInfo> alreadyVisitedEntities, Object objectToCompare) {
+ if(objectToCompare != null ) {
+ for(CdmEntityInfo cei: alreadyVisitedEntities) {
+ if(objectToCompare.equals(cei.getObject()) && objectToCompare != cei.getObject()) {
+ return cei;
+ }
+ }
+ }
+ return null;
+ }
+
+ private boolean containsIdenticalCdmEntity(List<CdmEntityInfo> ceiSet, Object objectToCompare) {
+ boolean foundIdentical = false;
+ if(objectToCompare != null) {
+ for(CdmEntityInfo cei : ceiSet) {
+ if(cei.getObject() == objectToCompare) {
+ foundIdentical = true;
+ } else if(objectToCompare.equals(cei.getObject())) {
+ return false;
+ }
+ }
+ }
+ return foundIdentical;
+ }
+
+ public class CdmEntityInfo {
+
+ private Object object;
+ private CdmEntityInfo parent;
+ private List<CdmEntityInfo> children;
+ private Field field;
+ private String label;
+ private boolean isProxy;
+
+ public CdmEntityInfo(Object object) {
+ this.object = object;
+ isProxy = false;
+ children = new ArrayList<CdmEntityInfo>();
+ }
+
+ public CdmEntityInfo getParent() {
+ return parent;
+ }
+
+ public void setParent(CdmEntityInfo parent) {
+ this.parent = parent;
+ }
+
+ public List<CdmEntityInfo> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<CdmEntityInfo> children) {
+ this.children = children;
+ }
+
+ public void addChild(CdmEntityInfo cei) {
+ this.children.add(cei);
+ cei.setParent(this);
+ }
+
+ public Field getField() {
+ return field;
+ }
+
+ public void setField(Field field) {
+ this.field = field;
+ }
+
+
+ public String getLabel() {
+ String label;
+ String fieldName = "";
+ if(field != null) {
+ fieldName = field.getName();
+ }
+
+ if(object != null) {
+ String className = object.getClass().getName();
+ if(object instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)object).getHibernateLazyInitializer();
+ if(hli.isUninitialized()) {
+ className = "HibernateProxy";
+ } else {
+ className = "InitialisedHibernateProxy";
+ }
+ label = "[" + className + "] " + fieldName;
+ } else if(object instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)object);
+ if(!pc.wasInitialized()) {
+ className = "PersistentCollection";
+ } else {
+ className = "InitialisedPersistentCollection";
+ }
+ label = "[" + className + "] " + fieldName;
+ } else if(object instanceof Collection) {
+ label = "[" + className + "] " + fieldName + " : " + String.valueOf(((Collection)object).size());
+ } else if(object instanceof Map) {
+ label = "[" + className + "] " + fieldName + " : " + String.valueOf(((Map)object).size());
+ } else if(object instanceof CdmBase) {
+ label = getCachesContainingEntity((CdmBase)object) + "[" + className + ",id" + ((CdmBase)object).getId() + "] " + fieldName + " : " + object.toString();
+ } else {
+ label = "[" + className + "] " + fieldName + " : " + object.toString();
+ }
+ } else {
+ label = "[NULL] " + fieldName;
+ }
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Object getObject() {
+ return object;
+ }
+
+ public void setObject(Object object) {
+ this.object = object;
+ }
+
+ public boolean isProxy() {
+ return isProxy;
+ }
+
+ public void setProxy(boolean isProxy) {
+ this.isProxy = isProxy;
+ }
+
+
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.remoting.cache;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import org.hibernate.collection.internal.PersistentBag;
+import org.hibernate.collection.internal.PersistentList;
+import org.hibernate.collection.internal.PersistentMap;
+import org.hibernate.collection.internal.PersistentSet;
+import org.hibernate.collection.internal.PersistentSortedMap;
+import org.hibernate.collection.internal.PersistentSortedSet;
+import org.hibernate.collection.spi.PersistentCollection;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+import org.springframework.util.ReflectionUtils;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
+import eu.etaxonomy.taxeditor.remoting.CdmRemotingException;
+
+/**
+ * @author cmathew
+ * @date 17 Feb 2015
+ *
+ */
+public class ProxyUtils {
+
+
+
+ public static enum CollectionType {
+ SET,
+ LIST,
+ MAP;
+
+ @Override
+ public String toString() {
+ return this.name().toLowerCase();
+ }
+ }
+
+ public static Object getCollectionType(Object obj) {
+ if(obj != null) {
+ if(obj instanceof List) {
+ return CollectionType.LIST;
+ }
+ if(obj instanceof Set) {
+ return CollectionType.SET;
+ }
+ if(obj instanceof Map) {
+ return CollectionType.MAP;
+ }
+ throw new CdmRemotingException("Cannot get Collection Type for " + obj.getClass().getName());
+ }
+ return null;
+ }
+
+ public static Object getObject(PersistentCollection pc) {
+ if(pc != null) {
+ if(pc instanceof PersistentSet) {
+ return new HashSet((Set)pc);
+ }
+ if(pc instanceof PersistentSortedSet) {
+ return new TreeSet((Set)pc);
+ }
+ if(pc instanceof PersistentList || pc instanceof PersistentBag) {
+ return new ArrayList((List)pc);
+ }
+ if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
+ return new HashMap((Map)pc);
+ }
+ if(pc instanceof PersistentSortedMap) {
+ return new TreeMap((Map)pc);
+ }
+ throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
+ }
+ return null;
+ }
+
+ public static CollectionField getCollectionField(PersistentCollection pc) {
+ if(pc != null) {
+ if(pc instanceof PersistentSet) {
+ return new CollectionField(new HashSet((Set)pc), CollectionType.SET);
+ }
+ if(pc instanceof PersistentSortedSet) {
+ return new CollectionField(new TreeSet((Set)pc), CollectionType.SET);
+ }
+ if(pc instanceof PersistentList) {
+ return new CollectionField(new ArrayList((List)pc), CollectionType.LIST);
+ }
+ if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
+ return new CollectionField(new HashMap((Map)pc), CollectionType.MAP);
+ }
+ if(pc instanceof PersistentSortedMap) {
+ return new CollectionField(new TreeMap((Map)pc), CollectionType.MAP);
+ }
+ throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName());
+ }
+ return null;
+ }
+
+ public static class CollectionField {
+ private final Object col;
+ private final CollectionType type;
+ public CollectionField(Object col, CollectionType type) {
+ this.col = col;
+ this.type = type;
+ }
+
+ public Object getCollection() {
+ return this.col;
+ }
+
+ public CollectionType getType() {
+ return this.type;
+ }
+ }
+
+
+ public static Object deproxy(Object o) {
+ if(o != null && o instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
+ if(!hli.isUninitialized()) {
+ return hli.getImplementation();
+
+ }
+ }
+
+ if(o != null && o instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)o);
+ if(pc.wasInitialized()) {
+ return ProxyUtils.getObject(pc);
+
+ }
+ }
+ return o;
+ }
+
+ public static boolean isProxy(Object o) {
+ if(o != null && o instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
+ if(hli.isUninitialized()) {
+ return true;
+ }
+ }
+
+ if(o != null && o instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)o);
+ if(!pc.wasInitialized()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static Object remoteLoadPersistentCollectionIfProxy(Object o, UUID ownerUuid, String fieldName) throws ClassNotFoundException {
+ if(o != null && o instanceof HibernateProxy) {
+ LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer();
+ if(hli.isUninitialized()) {
+ return CdmApplicationState.getCachedCommonService().find((Class<CdmBase>)Class.forName(hli.getEntityName()),
+ ((Integer)hli.getIdentifier()).intValue());
+ }
+ }
+
+ if(o != null && o instanceof PersistentCollection) {
+ PersistentCollection pc = ((PersistentCollection)o);
+ if(!pc.wasInitialized()) {
+ return CdmApplicationState.getCachedCommonService().initializeCollection(ownerUuid, fieldName);
+ }
+ }
+
+ return o;
+ }
+
+
+
+
+ public static void setRoleValueInOwner(Object owner, String role, Object value) {
+ if(role == null || role.isEmpty()) {
+ throw new CdmRemotingException("Role cannot be null or an empty string");
+ }
+
+ String fieldName = role.substring(role.lastIndexOf(".") + 1);
+
+ Field field = ReflectionUtils.findField(owner.getClass(), fieldName);
+
+ if(field == null) {
+ throw new CdmRemotingException("Field '" + fieldName
+ + "' not found when searching in class '" + owner.getClass() + "' and its supercalsses");
+ }
+
+ field.setAccessible(true);
+
+ try {
+ field.set(owner, value);
+ } catch (IllegalArgumentException e) {
+ throw new CdmRemotingException(e);
+ } catch (IllegalAccessException e) {
+ throw new CdmRemotingException(e);
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.remoting.server;
+
+/**
+ * @author cmathew
+ * @date 23 Sep 2014
+ *
+ */
+public class CDMServerException extends Exception {
+
+ public CDMServerException(String message) {
+ super(message);
+ }
+
+ public CDMServerException(Exception e) {
+ super(e);
+ }
+
+ public CDMServerException(String message,Exception e) {
+ super(message,e);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.remoting.server;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationUtils;
+import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
+import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
+
+/**
+ * @author cmathew
+ * @date 11 Nov 2015
+ *
+ */
+public class CDMServerUtils {
+
+
+ public static String convertEditorToServerConfig() {
+ StringBuilder configStringBuilder = new StringBuilder();
+ configStringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + System.lineSeparator());
+ configStringBuilder.append("<!-- DO NOT EDIT THIS FILE MANUALLY. -->");
+ configStringBuilder.append("<!-- It is created by the Taxonomic Editor for launching a managed CDM Server. -->");
+ configStringBuilder.append("<beans xmlns=\"http://www.springframework.org/schema/beans\"" + System.lineSeparator());
+ configStringBuilder.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + System.lineSeparator());
+ configStringBuilder.append(" xmlns:tx=\"http://www.springframework.org/schema/tx\"" + System.lineSeparator());
+ configStringBuilder.append(" xmlns:context=\"http://www.springframework.org/schema/context\"" + System.lineSeparator());
+ configStringBuilder.append(" xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" + System.lineSeparator());
+ configStringBuilder.append(" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" + System.lineSeparator());
+ configStringBuilder.append(" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" + System.lineSeparator());
+ configStringBuilder.append("\">" + System.lineSeparator());
+ configStringBuilder.append(" <bean id=\"dataSourceProperties\" class=\"eu.etaxonomy.cdm.remote.config.DataSourceProperties\">" + System.lineSeparator());
+ configStringBuilder.append(" <property name=\"propsMap\">" + System.lineSeparator());
+ configStringBuilder.append(" <map/>" + System.lineSeparator());
+ configStringBuilder.append(" </property>" + System.lineSeparator());
+ configStringBuilder.append(" </bean>" + System.lineSeparator());
+
+ for(CdmPersistentDataSource dataSource : CdmPersistentDataSource.getAllDataSources()) {
+ String beanId = xmlNCNamefrom(dataSource.getName());
+ String user = dataSource.getUsername();
+ String password = dataSource.getPassword();
+ String driverClass = dataSource.getCdmSourceProperty(CdmSourceProperties.DRIVER_CLASS);
+ String jdbcUrl = StringEscapeUtils.escapeXml(dataSource.getCdmSourceProperty(CdmSourceProperties.URL));
+ configStringBuilder.append(" <bean id=\"" + beanId + "\" lazy-init=\"true\" class=\"com.mchange.v2.c3p0.ComboPooledDataSource\">" + System.lineSeparator());
+ configStringBuilder.append(" <property name=\"driverClass\" value=\"" + driverClass + "\"/>" + System.lineSeparator());
+ configStringBuilder.append(" <property name=\"user\" value=\"" + user + "\"/>" + System.lineSeparator());
+ configStringBuilder.append(" <property name=\"password\" value=\"" + password + "\"/>" + System.lineSeparator());
+ configStringBuilder.append(" <property name=\"jdbcUrl\" value=\"" + jdbcUrl + "\"/>" + System.lineSeparator());
+ configStringBuilder.append(" </bean>" + System.lineSeparator());
+
+ }
+ configStringBuilder.append("</beans>" + System.lineSeparator());
+
+ return configStringBuilder.toString();
+ }
+
+ /**
+ * Assures that the datasource name is converted into a valid XML type NCName.
+ *
+ * Prefixes the string and replaces all forbidden characters by '_'.
+ *
+ * @param dataSource
+ * @return
+ */
+ public static String xmlNCNamefrom(String beanName) {
+ return "MGD_" + beanName.replaceAll("[^a-zA-Z0-9]", "_");
+ }
+
+ public static File writeManagedServerConfig(String config, String fileName) throws IOException {
+ File managedConfigFile = new File(CdmApplicationUtils.getWritableResourceDir(), fileName);
+ if(managedConfigFile.exists()) {
+ managedConfigFile.delete();
+ }
+ if(managedConfigFile.createNewFile()) {
+ FileUtils.writeStringToFile(managedConfigFile, config);
+ }
+ return managedConfigFile;
+ }
+
+}
/**
* Copyright (C) 2014 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.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
import static eu.etaxonomy.cdm.common.XmlHelp.getBeansRoot;
import static eu.etaxonomy.cdm.common.XmlHelp.insertXmlBean;
import eu.etaxonomy.cdm.common.XmlHelp;
import eu.etaxonomy.cdm.config.CdmPersistentSourceUtils;
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource;
-import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.config.ICdmPersistentSource;
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
-import eu.etaxonomy.cdm.database.CdmDataSource;
-import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
-import eu.etaxonomy.cdm.database.DataSourceNotFoundException;
-import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.cdm.database.types.IDatabaseType;
+import eu.etaxonomy.cdm.config.ICdmPersistentSource;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
*/
public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{
private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSource.class);
-
+
public static final String REMOTESOURCE_BEAN_POSTFIX = "RemoteSource";
private String beanName;
private Properties cdmSourceProperties;
private List<Attribute> cdmSourceAttributes;
-
+
/**
* Creates a new instance of CdmPersistentRemoteSource
- *
+ *
* @param name
* @param server
* @param port
* @param contextPath
* @param nomenclaturalCode
* @return
- * @throws CdmRemoteSourceException
+ * @throws CdmRemoteSourceException
*/
public static CdmPersistentRemoteSource NewInstance(String remoteSource) throws CdmRemoteSourceException {
if(exists(remoteSource)) {
} else {
throw new CdmRemoteSourceException("Remote source '" + remoteSource + "' does not exist in sources setting file");
}
-
+
}
-
+
/**S
* Creates a new CdmPersistentRemoteSource
- *
+ *
* @param name
* @param server
* @param port
* @param contextPath
* @param nomenclaturalCode
- * @throws CdmRemoteSourceException
+ * @throws CdmRemoteSourceException
*/
- private CdmPersistentRemoteSource(String remoteSource) throws CdmRemoteSourceException {
-
+ private CdmPersistentRemoteSource(String remoteSource) throws CdmRemoteSourceException {
+
CdmPersistentXMLSource cdmPersistentXMLSource = CdmPersistentXMLSource.NewInstance(remoteSource, REMOTESOURCE_BEAN_POSTFIX);
if(cdmPersistentXMLSource.getElement() != null) {
beanName = cdmPersistentXMLSource.getBeanName();
- // properties from the persistent xml file
+ // properties from the persistent xml file
cdmSourceProperties = cdmPersistentXMLSource.getCdmSourceProperties();
cdmSourceAttributes = cdmPersistentXMLSource.getCdmSourceAttributes();
checkProperties(cdmSourceProperties);
} else {
throw new CdmRemoteSourceException("Remote source '" + remoteSource + "' does not exist in settings file");
- }
- initDatabaseConnection();
+ }
}
-
+
private static void checkProperties(Properties cdmSourceProperties) throws CdmRemoteSourceException {
if(!cdmSourceProperties.containsKey(CdmSourceProperties.SERVER.toString())) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
+ throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
}
String port = (String)cdmSourceProperties.get(CdmSourceProperties.PORT.toString());
if(port == null || port.isEmpty()) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
- }
+ throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
+ }
if(!cdmSourceProperties.containsKey(CdmSourceProperties.CONTEXTPATH.toString())) {
- throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
- }
+ throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing");
+ }
// default NomenclaturalCode is always ICNAFP
- if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) {
+ if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) {
cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), NomenclaturalCode.ICNAFP.name());
- }
+ }
}
/* (non-Javadoc)
public String getBeanName() {
return beanName;
}
-
+
@Override
public String getServer() {
return cdmSourceProperties.getProperty(CdmSourceProperties.SERVER.toString());
}
-
+
@Override
public int getPort() {
String port = CdmUtils.Nz(cdmSourceProperties.getProperty(CdmSourceProperties.PORT.toString()));
return Integer.valueOf(port);
}
}
-
+
@Override
public String getContextPath() {
return cdmSourceProperties.getProperty(CdmSourceProperties.CONTEXTPATH.toString());
}
-
+
@Override
public NomenclaturalCode getNomenclaturalCode() {
return NomenclaturalCode.fromString(cdmSourceProperties.getProperty(CdmSourceProperties.NOMENCLATURAL_CODE.toString()));
}
-
+
public static CdmPersistentRemoteSource save(String strRemoteSourceName, ICdmRemoteSource remoteSource) throws CdmRemoteSourceException {
Properties cdmSourceProperties = new Properties();
cdmSourceProperties.put(CdmSourceProperties.SERVER.toString(), remoteSource.getServer());
checkProperties(cdmSourceProperties);
return save(strRemoteSourceName, cdmSourceProperties);
}
-
+
private static CdmPersistentRemoteSource save(String strRemoteSourceName,Properties cdmSourceProperties) throws CdmRemoteSourceException {
//root
}
//save
- saveToXml(root.getDocument(),
- CdmPersistentSourceUtils.getResourceDirectory(),
- CdmPersistentXMLSource.CDMSOURCE_FILE_NAME,
+ saveToXml(root.getDocument(),
+ CdmPersistentSourceUtils.getResourceDirectory(),
+ CdmPersistentXMLSource.CDMSOURCE_FILE_NAME,
XmlHelp.prettyFormat );
return NewInstance(strRemoteSourceName) ;
}
-
+
/**
* @param strDataSourceName
* @param dataSource
- * @param code
+ * @param code
* @return
* the updated dataSource, null if not succesful
*/
CdmPersistentSourceUtils.delete(CdmPersistentSourceUtils.getBeanName(strRemoteSourceName,REMOTESOURCE_BEAN_POSTFIX));
return save(strRemoteSourceName, remoteSource);
}
-
+
/**
* Tests existing of the datsource in the according config file.
* @return true if a datasource with the given name exists in the according datasource config file.
Element bean = CdmPersistentSourceUtils.getCdmSourceBeanXml(strRemoteSourceName, REMOTESOURCE_BEAN_POSTFIX);
return (bean != null);
}
-
+
/**
* Returns a list of all datasources stored in the datasource config file
* @return all existing data sources
- * @throws CdmRemoteSourceException
+ * @throws CdmRemoteSourceException
*/
@SuppressWarnings("unchecked")
static public List<CdmPersistentRemoteSource> getAllRemoteSources() throws CdmRemoteSourceException{
List<CdmPersistentRemoteSource> remoteSources = new ArrayList<CdmPersistentRemoteSource>();
-
+
Element root = getBeansRoot(CdmPersistentSourceUtils.getCdmSourceInputStream());
if (root == null){
return null;
}else{
List<Element> lsChildren = root.getChildren("bean", root.getNamespace());
-
+
for (Element elBean : lsChildren){
String strId = elBean.getAttributeValue("id");
if (strId != null && strId.endsWith(REMOTESOURCE_BEAN_POSTFIX)){
}
return remoteSources;
}
-
+
@Override
public String toString(){
if (getName() != null){
* 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.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
* Copyright (C) 2014 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.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
import java.util.Map;
-import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
-
-import eu.etaxonomy.cdm.api.service.IDatabaseService;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.cdm.api.service.IMetadataService;
import eu.etaxonomy.cdm.config.CdmSource;
import eu.etaxonomy.cdm.config.CdmSourceException;
-import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
/**
- * Base class representing a CDM remote source.
+ * Base class representing a CDM remote source.
* This class handles all the configuration relating to the remoting aspect of
* a CDM source.
*
protected static final NomenclaturalCode DEFAULT_NOMENCLATURAL_CODE = NomenclaturalCode.ICNAFP;
private String contextPath;
private String baseUrl;
-
- private IDatabaseService databaseService;
-
+
+ private IMetadataService metadataService;
+
/**
* Constructs a CdmRemoteSourceBase object with default values.
- *
+ *
*/
protected CdmRemoteSourceBase() {
setName(DEFAULT_NAME);
setContextPath(DEFAULT_CONTEXT_PATH);
setNomenclaturalCode(DEFAULT_NOMENCLATURAL_CODE);
}
-
+
/**
* Constructs a CdmRemoteSourceBase
- *
+ *
* @param name
* @param server
* @param port
* @param contextPath
* @param nomenclaturalCode
*/
- protected CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
+ public CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
setName(name);
setServer(server);
setPort(port);
setContextPath(contextPath);
- setNomenclaturalCode(nomenclaturalCode);
- initDatabaseConnection();
+ setNomenclaturalCode(nomenclaturalCode);
+ metadataService = CdmApplicationRemoteConfiguration.getMetadataService(this);
}
-
- protected void initDatabaseConnection() {
- if(getContextPath() == null || getContextPath().equals("")) {
- setBaseUrl("http://" + getServer() + ":" + String.valueOf(getPort()));
- } else {
- setBaseUrl("http://" + getServer() + ":" + String.valueOf(getPort()) + "/" + getContextPath());
- }
- // the database service needs to be initialised (before the spring
- // application context initialsation) since it is required to
- // to make queries related to the source database
- HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean();
- proxy.setServiceInterface(IDatabaseService.class);
- proxy.setServiceUrl(baseUrl + "/remoting/database.service");
- proxy.afterPropertiesSet();
- databaseService = (IDatabaseService) proxy.getObject();
- }
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getBaseUrl()
*/
}
/**
- * Sets the base url for the http-invoker services as listed in
+ * Sets the base url for the http-invoker services as listed in
* httpInvokerServicesClients.xml.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
+ * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
* base url would be 'http://127.0.0.1:8080/col'
- *
+ *
* @param baseUrl
*/
public void setBaseUrl(String baseUrl) {
/**
* Sets the context path.
- * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
+ * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
* context path would be 'col'
- *
+ *
* @param contextPath
*/
public void setContextPath(String contextPath) {
*/
@Override
public String getDbSchemaVersion() throws CdmSourceException {
- return databaseService.getDbSchemaVersion();
+ return metadataService.getDbSchemaVersion();
}
*/
@Override
public boolean isDbEmpty() throws CdmSourceException {
- return databaseService.isDbEmpty();
+ return metadataService.isDbEmpty();
}
*/
@Override
public boolean checkConnection() throws CdmSourceException {
- // assuming that database service works implies
+ // assuming that database service works implies
// the connection is up
- // if no exception is thrown then we assume that the
+ // if no exception is thrown then we assume that the
// connection is up
// FIXME:Remoting is this really correct?
- databaseService.getDbSchemaVersion();
+ metadataService.getDbSchemaVersion();
return true;
}
*/
@Override
public String getConnectionMessage() {
- return "Conncting to Remote CDM Server " + getName();
+ return "Connecting to Remote CDM Instance " + getName() + ":" + getPort() + "/" + getContextPath();
}
-
+
@Override
public Map<MetaDataPropertyName, String> getMetaDataMap() throws CdmSourceException {
- return databaseService.getCdmMetadataMap();
+ return metadataService.getCdmMetadataMap();
}
/**
*
*/
-package eu.etaxonomy.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
/**
*
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.remoting.source;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.HttpConnectionParams;
+import org.apache.http.params.HttpParams;
+import org.apache.http.util.EntityUtils;
+import org.apache.log4j.Logger;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.config.CdmSourceException;
+import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerUtils;
+
+/**
+ * @author cmathew
+ * @date 20 Jan 2015
+ *
+ */
+public class CdmServerInfo {
+ public static final Logger logger = Logger.getLogger(CdmServerInfo.class);
+
+ private final static String CDMSERVER_PREFIX = "cdmserver/";
+ private final static String NAME_PRODUCTION = "cybertaxonomy.org";
+ private final static String SERVER_PRODUCTION = "api.cybertaxonomy.org";
+
+ private final static String NAME_INTEGRATION = "edit-integration";
+ private final static String SERVER_INTEGRATION = "int.e-taxonomy.eu";
+
+ private final static String NAME_DEMO_1 = "edit-WS I";
+ private final static String SERVER_DEMO_1 = "160.45.63.230";
+
+ private final static String NAME_DEMO_2 = "edit-WS II";
+ private final static String SERVER_DEMO_2 = "160.45.63.231";
+
+ private final static String NAME_TEST = "edit-test";
+ private final static String SERVER_TEST = "test.e-taxonomy.eu";
+
+ public final static String SERVER_LOCALHOST = "localhost";
+ private final static String NAME_LOCALHOST = "localhost";
+ public final static String NAME_LOCALHOST_MGD = "localhost mgd.";
+
+ private final static String NAME_LOCALHOST_DEV = "localhost-dev";
+ private final static String NAME_INSTANCE_LOCALHOST_DEV = "local-dev";
+ private final static String SERVER_LOCALHOST_DEV = "localhost";
+ private final static int PORT_LOCALHOST_DEV = 8080;
+ private final static String BASEPATH_LOCALHOST_DEV = "";
+
+ public final static int NULL_PORT = -1;
+ public final static String NULL_PORT_STRING = "N/A";
+
+ private static final String CDM_REMOTE_SERVERS_CONFIG_FILE = "cdm_remote_servers.json";
+
+
+ private final String name;
+ private final String server;
+ private int port;
+ private final List<CdmInstanceInfo> instances;
+
+ private String cdmlibServicesVersion = "";
+ private String cdmlibServicesLastModified = "";
+
+ private String prefix = "";
+
+ private boolean ignoreCdmLibVersion = false;
+
+
+ public CdmServerInfo(CdmServerInfoConfig parameterObject) {
+ this.name = parameterObject.getName();
+ this.server = parameterObject.getServer();
+ this.port = parameterObject.getPort();
+ this.prefix = parameterObject.getPrefix();
+ this.ignoreCdmLibVersion = parameterObject.isIgnoreCdmLibVersion();
+ instances = new ArrayList<CdmInstanceInfo>();
+ }
+
+
+ public CdmInstanceInfo addInstance(String name, String basePath) {
+ String _basePath = basePath;
+ if(isLocalhostMgd()) {
+ _basePath = "";
+ }
+ CdmInstanceInfo cii = new CdmInstanceInfo(name, _basePath);
+ instances.add(cii);
+ return cii;
+
+ }
+
+ public boolean isLocalhost() {
+ return name.startsWith(SERVER_LOCALHOST);
+ }
+
+ public boolean isLocalhostMgd() {
+ return NAME_LOCALHOST_MGD.equals(name);
+ }
+
+ public String getCdmlibServicesVersion() {
+ return cdmlibServicesVersion;
+ }
+
+ public String getCdmlibLastModified() {
+ return cdmlibServicesLastModified;
+ }
+
+ public void refreshInstances() throws CDMServerException {
+ instances.clear();
+ if(isLocalhostMgd()) {
+ addInstancesFromDataSourcesConfig();
+ } else {
+ addInstancesViaHttp();
+ }
+ Collections.sort(instances, new Comparator<CdmInstanceInfo>() {
+ @Override
+ public int compare(CdmInstanceInfo cii1, CdmInstanceInfo cii2)
+ {
+ return cii1.getName().toString().compareTo(cii2.getName().toString());
+ }
+ });
+ }
+
+ public void updateInfo() throws CDMServerException {
+ String url = "http://" + server + ":" + String.valueOf(port) + "/" + prefix + "info.jsp";
+ String responseBody = getResponse(url);
+ if(responseBody != null) {
+ try {
+ JSONObject info = new JSONObject(responseBody);
+ cdmlibServicesVersion = info.getString("cdmlibServicesVersion");
+ cdmlibServicesLastModified = info.getString("cdmlibServicesLastModified");
+ } catch (JSONException e) {
+ throw new CDMServerException(e);
+ }
+ }
+ }
+
+ public void addInstancesViaHttp() throws CDMServerException {
+ updateInfo();
+ String url = "http://" + server + ":" + String.valueOf(port) + "/" + prefix + "instances.jsp";
+ String responseBody = getResponse(url);
+ if(responseBody != null) {
+ try {
+ JSONArray array = new JSONArray(responseBody);
+ for(int i=0;i<array.length();i++) {
+ JSONObject instance = (JSONObject)array.get(i);
+ if(instance != null) {
+ JSONObject conf = (JSONObject)instance.get("configuration");
+ if(conf != null) {
+ String instanceName = conf.getString("instanceName");
+ // we need to remove the first (char) forward slash from
+ // the base path
+ String basePath = conf.getString("basePath").substring(1);
+ addInstance(instanceName, basePath);
+ logger.info("Added instance with name : " + instanceName + ", basePath : " + basePath);
+ }
+ }
+ }
+ } catch (JSONException e) {
+ throw new CDMServerException(e);
+ }
+ }
+ }
+
+ private String getResponse(String url) throws CDMServerException {
+ HttpClient client = new DefaultHttpClient();
+ HttpParams params = client.getParams();
+
+ HttpConnectionParams.setConnectionTimeout(params, 5000);
+ HttpConnectionParams.setSoTimeout(params, 5000);
+
+ HttpGet httpGet = new HttpGet(url);
+
+ logger.info("Executing request " + httpGet.getRequestLine());
+
+ // Create a custom response handler
+ ResponseHandler<String> responseHandler = new ResponseHandler<String>() {
+
+ @Override
+ public String handleResponse(
+ final HttpResponse response) throws ClientProtocolException, IOException {
+ int status = response.getStatusLine().getStatusCode();
+ if (status >= 200 && status < 300) {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ } else {
+ throw new ClientProtocolException("Unexpected response status: " + status);
+ }
+ }
+
+ };
+ String responseBody = null;
+ try {
+ responseBody = client.execute(httpGet, responseHandler);
+ } catch (ClientProtocolException e) {
+ throw new CDMServerException(e);
+ } catch (IOException e) {
+ throw new CDMServerException(e);
+ }
+ return responseBody;
+ }
+
+ public void addInstancesFromDataSourcesConfig() {
+ for(ICdmDataSource dataSource : CdmPersistentDataSource.getAllDataSources()){
+ String datasourceNCName = CDMServerUtils.xmlNCNamefrom(dataSource.getName());
+ logger.info("Adding local instance " + dataSource.getName() + " as " + datasourceNCName);
+ addInstance(datasourceNCName, datasourceNCName);
+ }
+ }
+
+ public String toString(String instanceName, int port) {
+ return server + ":" + String.valueOf(port) + "/" + instanceName;
+ }
+
+ public CdmInstanceInfo getInstanceFromName(String instanceName) {
+ if(instanceName == null) {
+ return null;
+ }
+
+ for(CdmInstanceInfo instance : instances) {
+ if(instance.getName() != null && instance.getName().equals(instanceName)) {
+ return instance;
+ }
+ }
+ return null;
+ }
+
+ public CdmRemoteSource getCdmRemoteSource(CdmInstanceInfo instance, int port) {
+ if(instance != null) {
+ return CdmRemoteSource.NewInstance(name,
+ server,
+ port,
+ instance.getBasePath(),
+ null);
+ }
+ return null;
+ }
+
+ public boolean pingServer() {
+ if(isLocalhostMgd()) {
+ return true;
+ }
+ try {
+ Socket s = new Socket(server, port);
+ logger.info("[CDM-Server] Available @ " + server + ":" + port );
+ updateInfo();
+ return true;
+ } catch (IOException ioe) {
+
+ } catch (CDMServerException e) {
+
+ }
+ return false;
+ }
+
+ public boolean pingInstance(CdmInstanceInfo instance, int port) throws CDMServerException {
+
+ ICdmRemoteSource crs = getCdmRemoteSource(instance, port);
+ try {
+ if(crs != null && crs.checkConnection()) {
+ logger.info("[CDM-Server] Running @ " + server + ":" + port + " for instance " + instance);
+ return true;
+ }
+ } catch (CdmSourceException e) {
+ throw new CDMServerException(e);
+ }
+
+ return false;
+ }
+
+ public int compareDbSchemaVersion(CdmInstanceInfo instance, int port) throws CDMServerException {
+
+ ICdmRemoteSource crs = getCdmRemoteSource(instance, port);
+ String dbSchemaVersion;
+ try {
+ dbSchemaVersion = crs.getDbSchemaVersion();
+ } catch (CdmSourceException e) {
+ throw new CDMServerException(e);
+ }
+
+
+ if(dbSchemaVersion != null) {
+ return CdmMetaData.compareVersion(dbSchemaVersion, CdmMetaData.getDbSchemaVersion(), 3, null);
+ } else {
+ throw new CDMServerException("Cannot determine editor db. schema version");
+ }
+ }
+
+ public int compareCdmlibServicesVersion() throws CdmSourceException {
+
+ String serverVersion = cdmlibServicesVersion;
+ String serverCdmlibLastModified = cdmlibServicesLastModified;
+ if(ignoreCdmLibVersion) {
+ return 0;
+ } else {
+ return compareCdmlibServicesVersion(serverVersion, serverCdmlibLastModified);
+ }
+ }
+
+
+ /**
+ * @param serverVersion
+ * @param editorVersion
+ * @throws CdmSourceException
+ */
+ public static int compareCdmlibServicesVersion(String serverVersion, String serverCdmlibLastModified) throws CdmSourceException {
+
+ String editorVersion = CdmApplicationState.getCdmlibVersion();
+ String editorCdmlibLastModified = CdmApplicationState.getCdmlibLastModified();
+
+ int result = 0;
+ if(StringUtils.isBlank(serverVersion) || StringUtils.isBlank(editorVersion)) {
+ throw new CdmSourceException("cdmlib-services server or editor version is empty");
+ }
+
+ String[] serverVersionSplit = serverVersion.split("\\.");
+ String[] editorVersionSplit = editorVersion.split("\\.");
+
+ if(serverVersionSplit.length < 3 || editorVersionSplit.length < 3 || serverVersionSplit.length > 4 || editorVersionSplit.length > 4) {
+ throw new CdmSourceException("cdmlib-services server or editor version is invalid");
+ }
+
+ Integer serverVersionPart;
+ Integer editorVersionPart;
+
+ for(int i=0 ; i<3 ; i++) {
+ serverVersionPart = Integer.valueOf(serverVersionSplit[i]);
+ editorVersionPart = Integer.valueOf(editorVersionSplit[i]);
+
+ int partCompare = serverVersionPart.compareTo(editorVersionPart);
+ if (partCompare != 0){
+ return partCompare;
+ }
+ }
+ // at this point major, minor and patch versions are matching
+
+ if(StringUtils.isBlank(serverCdmlibLastModified) || StringUtils.isBlank(editorCdmlibLastModified)) {
+ throw new CdmSourceException("cdmlib-services server or editor version is empty");
+ }
+
+ String cdmServerIgnoreVersion = System.getProperty("cdm.server.version.lm.ignore");
+ if(StringUtils.isBlank(cdmServerIgnoreVersion) || !cdmServerIgnoreVersion.equals("true")) {
+ Long serverLastModified = Long.valueOf(serverCdmlibLastModified);
+ Long editorLastModified = Long.valueOf(editorCdmlibLastModified);
+ return serverLastModified.compareTo(editorLastModified);
+ }
+
+ return 0;
+ }
+
+
+
+ public static List<CdmServerInfo> getCdmServers() {
+ List<CdmServerInfoConfig> configList = loadFromConfigFile(new File(CdmUtils.perUserCdmFolder, CDM_REMOTE_SERVERS_CONFIG_FILE));
+ List<CdmServerInfo> serverInfoList = new ArrayList<CdmServerInfo>(configList.size());
+ for(CdmServerInfoConfig config : configList) {
+ serverInfoList.add(new CdmServerInfo(config));
+ }
+ // The local host managed server must not be in the config file
+ CdmServerInfoConfig localHostManagedConfig = new CdmServerInfoConfig(NAME_LOCALHOST_MGD, SERVER_LOCALHOST, NULL_PORT, CDMSERVER_PREFIX, false);
+ serverInfoList.add(new CdmServerInfo(localHostManagedConfig));
+ return serverInfoList;
+ }
+
+
+ /**
+ * @param file
+ * @throws IOException
+ * @throws FileNotFoundException
+ * @throws JsonMappingException
+ * @throws JsonParseException
+ */
+ private static List<CdmServerInfoConfig> loadFromConfigFile(File file) {
+
+ List<CdmServerInfoConfig> serverList = null;
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ if(!file.exists()) {
+ logger.info("The remote server config file '" + file.getAbsolutePath() +
+ "' does not yet exist, it will be created based on the defaults.");
+ try {
+ serverList = createDefaultServerConfigList();
+ mapper.writerWithDefaultPrettyPrinter().writeValue(new FileOutputStream(file), serverList);
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ try {
+ serverList = mapper.readValue(new FileInputStream(file), new TypeReference<List<CdmServerInfoConfig>>(){});
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return serverList;
+
+
+ }
+
+
+ /**
+ *
+ */
+ private static List<CdmServerInfoConfig> createDefaultServerConfigList() {
+
+ List<CdmServerInfoConfig> serverInfoList = new ArrayList<CdmServerInfoConfig>();
+ // serverInfoList.add(new CdmServerInfoConfig(NAME_PRODUCTION, SERVER_PRODUCTION, 80, ""));
+ //serverInfoList.add(new CdmServerInfoConfig(NAME_INTEGRATION, SERVER_INTEGRATION, 80, CDMSERVER_PREFIX));
+ serverInfoList.add(new CdmServerInfoConfig(NAME_DEMO_1, SERVER_DEMO_1, 80, CDMSERVER_PREFIX, false));
+ // serverInfoList.add(new CdmServerInfoConfig(NAME_DEMO_2, SERVER_DEMO_2, 80, CDMSERVER_PREFIX));
+ serverInfoList.add(new CdmServerInfoConfig(NAME_TEST, SERVER_TEST, 80, CDMSERVER_PREFIX, false));
+ serverInfoList.add(new CdmServerInfoConfig(NAME_LOCALHOST, SERVER_LOCALHOST, 8080, CDMSERVER_PREFIX, true));
+ return serverInfoList;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getServer() {
+ return server;
+ }
+
+
+ public int getPort() {
+ return port;
+ }
+
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ public List<CdmInstanceInfo> getInstances() throws CDMServerException {
+ if(instances.isEmpty()) {
+ refreshInstances();
+ }
+ return instances;
+ }
+
+ public static CdmRemoteSource getDevServerRemoteSource() {
+ String value = System.getProperty("cdm.server.dev.port");
+ boolean available = false;
+ CdmInstanceInfo devInstance = null;
+ if(value != null && !value.isEmpty()) {
+ int devPort = Integer.valueOf(value);
+ CdmServerInfo devCii = new CdmServerInfo(new CdmServerInfoConfig(NAME_LOCALHOST_DEV, SERVER_LOCALHOST_DEV, devPort, "", false));
+ try {
+ devInstance = devCii.addInstance(NAME_INSTANCE_LOCALHOST_DEV, BASEPATH_LOCALHOST_DEV);
+ available = devCii.pingInstance(devInstance, devPort);
+ if(available) {
+ return devCii.getCdmRemoteSource(devInstance, devPort);
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ return null;
+ }
+
+ public class CdmInstanceInfo {
+ private final String name;
+
+ /**
+ * The full path of the instance including the the prefix (if any).
+ * E.g. for an EDIT instance this would be something like "cdmserver/remoting"
+ * For a managed local server this would simply be ""
+ */
+ private final String basePath;
+
+
+ public CdmInstanceInfo(String name, String basePath) {
+ this.name = name;
+ this.basePath = basePath;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+ public String getBasePath() {
+ return basePath;
+ }
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.remoting.source;
+
+/**
+ * @author a.kohlbecker
+ * @date Feb 10, 2016
+ */
+public class CdmServerInfoConfig {
+ /**
+ *
+ */
+ private String name;
+ /**
+ *
+ */
+ private String server;
+ /**
+ *
+ */
+ private int port;
+ /**
+ *
+ */
+ private String prefix;
+ /**
+ *
+ */
+ private boolean ignoreCdmLibVersion;
+
+ /**
+ *
+ */
+ public CdmServerInfoConfig(String name, String server, int port, String prefix, boolean ignoreCdmLibVersion) {
+ this.name = name;
+ this.server = server;
+ this.port = port;
+ this.prefix = prefix;
+ this.ignoreCdmLibVersion = ignoreCdmLibVersion;
+ }
+
+ public CdmServerInfoConfig() {
+
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the server
+ */
+ public String getServer() {
+ return server;
+ }
+
+ /**
+ * @param server the server to set
+ */
+ public void setServer(String server) {
+ this.server = server;
+ }
+
+ /**
+ * @return the port
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @param port the port to set
+ */
+ public void setPort(int port) {
+ this.port = port;
+ }
+
+ /**
+ * @return the prefix
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * @return the ignoreCdmLibVersion
+ */
+ public boolean isIgnoreCdmLibVersion() {
+ return ignoreCdmLibVersion;
+ }
+
+ /**
+ * @param ignoreCdmLibVersion the ignoreCdmLibVersion to set
+ */
+ public void setIgnoreCdmLibVersion(boolean ignoreCdmLibVersion) {
+ this.ignoreCdmLibVersion = ignoreCdmLibVersion;
+ }
+}
\ No newline at end of file
* 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.cdm.remote;
+package eu.etaxonomy.taxeditor.remoting.source;
import eu.etaxonomy.cdm.config.ICdmSource;
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.service;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+@Component
+public class CachedCommonServiceImpl implements ICachedCommonService {
+
+
+ private static boolean cacheEnabled = true;
+
+ public static boolean isCacheEnabled() {
+ return cacheEnabled;
+ }
+
+ public static void setCacheEnabled(boolean cacheEnabled) {
+ CachedCommonServiceImpl.cacheEnabled = cacheEnabled;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#find(java.lang.Class, int)
+ */
+ @Override
+ public CdmBase find(Class<? extends CdmBase> clazz, int id) {
+ CdmBase cdmEntity = CdmApplicationState.getCurrentAppConfig().getCommonService().find(clazz, id, getPropertyPaths(clazz));
+ if(cdmEntity == null) {
+ throw new NullPointerException("CDM Entity of type " + clazz.getName() + " with id " + id + " is null.");
+ }
+ return cdmEntity;
+
+ }
+
+
+ private List<String> getPropertyPaths(Object obj) {
+ List<String> propertyPaths = null;
+ ICdmEntitySession cdmEntitySession =
+ ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
+ if(cdmEntitySession != null) {
+ propertyPaths = cdmEntitySession.getPropertyPaths(obj);
+ }
+ return propertyPaths;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.service.ICachedCommonService#initializeCollection(java.util.UUID, java.lang.String)
+ */
+ @Override
+ public Object initializeCollection(UUID ownerUuid, String fieldName) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().initializeCollection(ownerUuid, fieldName, getPropertyPaths(fieldName));
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#isEmpty(org.hibernate.collection.spi.PersistentCollection)
+ */
+ @Override
+ public boolean isEmpty(UUID ownerUuid, String fieldName) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().isEmpty(ownerUuid, fieldName);
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#size(org.hibernate.collection.spi.PersistentCollection)
+ */
+ @Override
+ public int size(UUID ownerUuid, String fieldName) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().size(ownerUuid, fieldName);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#contains(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+ */
+ @Override
+ public boolean contains(UUID ownerUuid, String fieldName, Object element) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().contains(ownerUuid, fieldName, element);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsKey(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+ */
+ @Override
+ public boolean containsKey(UUID ownerUuid, String fieldName, Object key) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().containsKey(ownerUuid, fieldName, key);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsValue(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
+ */
+ @Override
+ public boolean containsValue(UUID ownerUuid, String fieldName, Object element) {
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().containsValue(ownerUuid, fieldName, element);
+ }
+
+
+
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.service;
+
+import java.io.IOException;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.http.client.methods.HttpPost;
+import org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor;
+import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+
+/**
+ * @author cmathew
+ * @date 27 Jan 2015
+ *
+ */
+public class CdmAuthenticatedHttpInvokerRequestExecutor extends HttpComponentsHttpInvokerRequestExecutor {
+
+ @Override
+ protected HttpPost createHttpPost(HttpInvokerClientConfiguration config) throws IOException {
+ HttpPost postMethod = super.createHttpPost(config);
+
+ SecurityContext securityContext = CdmApplicationState.getCurrentSecurityContext();
+ if(securityContext != null) {
+ Authentication auth = securityContext.getAuthentication();
+ if ((auth != null) && (auth.getName() != null) &&
+ (auth.getCredentials() != null)) {
+ String base64 = auth.getName() + ":" + auth.getCredentials().toString();
+ postMethod.setHeader("Authorization", "Basic " +
+ new String(Base64.encodeBase64(base64.getBytes())));
+ }
+ }
+ return postMethod;
+ }
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+public class CdmServiceInterceptorException extends RuntimeException {
+
+ public CdmServiceInterceptorException(String message) {
+ super(message);
+ }
+
+ public CdmServiceInterceptorException(Exception ex) {
+ super(ex);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
+import org.springframework.remoting.support.RemoteInvocation;
+import org.springframework.remoting.support.RemoteInvocationResult;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+@Component
+public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerRequestExecutor {
+
+ private static final Logger logger = Logger.getLogger(CdmServiceRequestExecutor.class);
+
+ private ICdmEntitySessionManager cdmEntitySessionManager ;
+
+ private RemoteInvocation currentRemoteInvocation;
+
+ protected final static Set<String> cachableMethods = new HashSet<String>();
+
+
+
+ public CdmServiceRequestExecutor() {
+ cachableMethods.add("merge");
+ cachableMethods.add("save");
+ cachableMethods.add("findWithUpdate");
+ cachableMethods.add("loadWithUpdate");
+ }
+
+ @Override
+ protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException {
+ if(cdmEntitySessionManager == null) {
+ cdmEntitySessionManager =
+ ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager();
+ }
+ currentRemoteInvocation = invocation;
+ super.writeRemoteInvocation(invocation, os);
+ }
+
+ @Override
+ protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config,
+ java.io.ByteArrayOutputStream baos)
+ throws java.io.IOException,
+ java.lang.ClassNotFoundException {
+ RemoteInvocationResult rir = fromCache(currentRemoteInvocation);
+
+ if(rir == null) {
+ logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
+ rir = super.doExecuteRequest(config, baos);
+ if(rir.getValue() != null && !rir.hasException()) {
+ if(cachableMethods.contains(currentRemoteInvocation.getMethodName())) {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), true));
+ } else if(rir.getValue() instanceof UpdateResult){
+ UpdateResult result = (UpdateResult)rir.getValue();
+ if(result.isOk()){
+ cdmEntitySessionManager.load(result, true);
+ }
+ } else {
+ rir = new RemoteInvocationResult(cdmEntitySessionManager.load(rir.getValue(), false));
+ }
+ }
+ cache(currentRemoteInvocation, rir);
+ }
+ currentRemoteInvocation = null;
+
+ return rir;
+ }
+
+ public void cache(RemoteInvocation ri, RemoteInvocationResult rir) {
+
+ }
+
+ public RemoteInvocationResult fromCache(RemoteInvocation ri) {
+ return null;
+ }
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.service;
+
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 14 Oct 2014
+ *
+ */
+public interface ICachedCommonService {
+
+ public CdmBase find(Class<? extends CdmBase> clazz, int id);
+
+
+ /**
+ * Initializes a collection or map.
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of collection or map
+ * @return initialised collection or map
+ */
+ public Object initializeCollection(UUID ownerUuid, String fieldName);
+
+ /**
+ * Checks if a collection or map is empty.
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of collection or map
+ * @return true if the collection of map is empty, else false
+ */
+ public boolean isEmpty(UUID ownerUuid, String fieldName);
+
+ /**
+ * Returns the size of requested collection or map.
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of collection or map
+ * @return the size of the persistent collection
+ */
+ public int size(UUID ownerUuid, String fieldName);
+
+ /**
+ * Checks whether an object is contained within a persistent collection.
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of collection or map
+ * @param element the element to check for
+ * @return true if the element exists in the collection, false o/w
+ */
+ public boolean contains(UUID ownerUuid, String fieldName, Object element);
+
+ /**
+ * Checks whether an index object exists within a persistent collection
+ * (usually a map)
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of map
+ * @param key the index object to look for.
+ * @return true if the index object exists in the collection, false o/w
+ */
+ public boolean containsKey(UUID ownerUuid, String fieldName, Object key);
+
+ /**
+ * checks whether an value object exists within a persistent collection
+ * (usually a map)
+ *
+ * @param ownerUuid uuid of owner cdm entity
+ * @param fieldName field name of map
+ * @param key the value object to look for.
+ * @return true if the value object exists in the collection, false o/w
+ */
+ public boolean containsValue(UUID ownerUuid, String fieldName, Object element);
+
+
+
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.remoting.support.RemoteInvocation;
+import org.springframework.remoting.support.RemoteInvocationResult;
+
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+
+
+public class TermServiceRequestExecutor extends CdmServiceRequestExecutor {
+ private static final Logger logger = Logger.getLogger(TermServiceRequestExecutor.class);
+
+ private static Map<TermType, RemoteInvocationResult> termTypeMap = new
+ HashMap<TermType, RemoteInvocationResult>();
+
+ private static CdmServiceCacher cdmServiceCacher;
+
+ public static void setDefaultCacher(CdmServiceCacher css) {
+ cdmServiceCacher = css;
+ }
+
+ @Override
+ public void cache(RemoteInvocation ri, RemoteInvocationResult rir) {
+ if(cdmServiceCacher != null) {
+ if(ri.getMethodName().equals("listByTermType")) {
+ if(ri.getArguments()[1] == null) {
+ Set<DefinedTermBase> terms = new HashSet<DefinedTermBase>();
+ if(rir.getValue() != null) {
+ terms.addAll((List<DefinedTermBase>)rir.getValue());
+
+ for(DefinedTermBase<?> term : terms) {
+ cdmServiceCacher.load(term);
+ }
+ termTypeMap.put((TermType)ri.getArguments()[0], rir);
+ }
+
+ }
+ }
+ } else {
+ logger.info("Default CdmServiceCacher is null. Cannot cache terms");
+ }
+ }
+
+
+ @Override
+ public RemoteInvocationResult fromCache(RemoteInvocation ri) {
+ return termTypeMap.get(ri.getArguments()[0]);
+ }
+
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+public class CdmClientSessionException extends RuntimeException {
+
+ public CdmClientSessionException(String message) {
+ super(message);
+ }
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.session;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+
+
+/**
+ *
+ * NOTE : It would be nice to have this class performing merge / delete operations
+ * using services, but this is only possible if we can 'intelligently'
+ * get from a model class to the correspoding service class
+ * @author cmathew
+ * @date 20 Oct 2014
+ *
+ */
+
+public class CdmEntitySession implements ICdmEntitySession {
+
+ private static final Logger logger = Logger.getLogger(CdmEntitySession.class);
+
+ private final CdmEntitySessionManager cdmEntitySessionManager;
+
+ private final ICdmEntitySessionEnabled sessionOwner;
+
+ private CdmTransientEntityCacher cdmTransientEntityCacher;
+
+ private List<ICdmEntitySessionEnabled> changeObservers;
+
+
+ public CdmEntitySession(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ this.sessionOwner = sessionOwner;
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+ init(sessionOwner, cdmEntitySessionManager);
+ }
+
+ private void init(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ this.cdmTransientEntityCacher = new CdmTransientEntityCacher(sessionOwner, cdmEntitySessionManager);
+ this.changeObservers = new ArrayList<ICdmEntitySessionEnabled>();
+ cdmEntitySessionManager.addToOwnerSessionMap(sessionOwner, this);
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.lang.Object, boolean)
+ */
+ @Override
+ public <O extends Object> O load(O obj, boolean update) {
+ return cdmTransientEntityCacher.load(obj, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.model.common.CdmBase, boolean)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ return (T)cdmTransientEntityCacher.load(cdmBase, update);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.UpdateResult, boolean)
+ */
+ @Override
+ public UpdateResult load(UpdateResult updateResult, boolean update) {
+ return cdmTransientEntityCacher.load(updateResult, update);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.persistence.dto.MergeResult, boolean)
+ */
+ @Override
+ public <T extends CdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update) {
+ return cdmTransientEntityCacher.load(mergeResult, update);
+ }
+
+ @Override
+ public <T extends CdmBase> void update() {
+ Collection<T> rootEntities = getRootEntities();
+ if(rootEntities != null) {
+ for(T rootEntity : rootEntities) {
+ load(rootEntity, true);
+ }
+ }
+ }
+
+// @Override
+// public <T extends ICdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects) {
+// addEvent(cdmBase, affectedObjects, EventType.UPDATE);
+// }
+//
+// @Override
+// public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject) {
+// Set<CdmBase> set = new HashSet<CdmBase>();
+// set.add(affectedObject);
+// addEvent(cdmBase, set, EventType.UPDATE);
+// }
+//
+//
+// @Override
+// public <T extends ICdmBase> void delete(T cdmBase, Set<CdmBase> affectedObjects) {
+// addEvent(cdmBase, affectedObjects, EventType.DELETE);
+// }
+//
+// @Override
+// public <T extends ICdmBase> void delete(Set<T> cdmBases, Set<CdmBase> affectedObjects) {
+// addEvent(cdmBases, affectedObjects, EventType.DELETE);
+// }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
+ return debug(Arrays.asList(cdmBase));
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(Collection<T> cdmBases) {
+ EntityCacherDebugResult entityCacherDebugResult =
+ new EntityCacherDebugResult(cdmTransientEntityCacher, cdmBases);
+ return entityCacherDebugResult;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug()
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug() {
+ return debug(getRootEntities());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmTransientEntityCacher.load(cdmBaseList, update);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#setEntitiesAsLatest()
+ */
+ @Override
+ public void setEntitiesAsLatest() {
+ //FIXME:Remoting need to think more about whether we really need this
+ // List<CdmBase> entities = cdmTransientEntityCacher.getAllEntities();
+ // for(CdmBase entity : entities) {
+ // cdmEntitySessionManager.setEntityAsLatest(entity);
+ // }
+ }
+
+
+ @Override
+ public void bind() {
+ logger.info("Binding session with owner " + sessionOwner.toString());
+ if(!cdmEntitySessionManager.contains(sessionOwner)) {
+ init(sessionOwner, cdmEntitySessionManager);
+ }
+ cdmEntitySessionManager.bind(sessionOwner);
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ cdmTransientEntityCacher.dispose();
+ changeObservers.clear();
+ cdmEntitySessionManager.remove(sessionOwner);
+
+ }
+
+
+// /* (non-Javadoc)
+// * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#commit()
+// */
+// @Override
+// public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType) {
+// affectedObjects = (Set<CdmBase>) load(affectedObjects, true);
+// CdmDataChangeEvent cdce = CdmDataChangeEvent.NewInstance((CdmBase)cdmBase, affectedObjects, eventType);
+// CdmPostDataChangeObservableListener.getDefault().notifyObservers(cdce);
+// }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.UUID, java.lang.Class)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
+ T cdmBase = service.load(uuid);
+ return load(cdmBase, false);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.IService, java.util.UUID, java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
+ T cdmBase = service.load(uuid, propertyPaths);
+ return load(cdmBase, false);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#save(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
+ UUID uuid = service.save(cdmBase).getUuid();
+ load(cdmBase,false);
+ return uuid;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
+ T mergedCdmBase = service.merge(cdmBase, true).getMergedEntity();
+ return mergedCdmBase;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive()
+ */
+ @Override
+ public boolean isActive() {
+ return cdmEntitySessionManager.getActiveSession() == this;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner()
+ */
+ @Override
+ public ICdmEntitySessionEnabled getOwner() {
+ return sessionOwner;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getNoOfObjectsInCache()
+ */
+ @Override
+ public LiveCacheStatistics getCacheStatistics() {
+ return cdmTransientEntityCacher.getCacheStatistics();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ return sessionOwner.getRootEntities();
+ }
+
+ public CdmTransientEntityCacher getCacher() {
+ return cdmTransientEntityCacher;
+ }
+
+ @Override
+ public List<String> getPropertyPaths(Object obj) {
+ Map<Object, List<String>> propertyPathsMap = sessionOwner.getPropertyPathsMap();
+ if(propertyPathsMap == null || propertyPathsMap.isEmpty()) {
+ return null;
+ }
+ return propertyPathsMap.get(obj);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#addNewCdmEntity(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public void addNewCdmEntity(CdmBase newEntity) {
+ cdmTransientEntityCacher.addNewEntity(newEntity);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.session;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2014
+ *
+ */
+@Component
+public class CdmEntitySessionManager implements ICdmEntitySessionManager {
+ private static final Logger logger = Logger.getLogger(CdmEntitySessionManager.class);
+
+ private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap =
+ new HashMap<ICdmEntitySessionEnabled, ICdmEntitySession>();
+
+ private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<ICdmEntitySessionManagerObserver>();
+
+ //private ICdmEntitySession activeSession;
+
+ private final InheritableThreadLocal<ICdmEntitySession> tlActiveSession = new InheritableThreadLocal<ICdmEntitySession>();
+
+ private NullSession nullSession;
+
+ @Override
+ public ICdmEntitySession getNullSession() {
+ return nullSession;
+ }
+
+ @Override
+ public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
+ ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
+ if(session == null) {
+ session = new CdmEntitySession(sessionOwner, this);
+ addToOwnerSessionMap(sessionOwner, session);
+ }
+
+ if(setAsActive) {
+ setActiveSession(session);
+ }
+
+ return session;
+ }
+
+ @Override
+ public ICdmEntitySession bindNullSession() {
+
+ if(nullSession == null) {
+ nullSession = new NullSession(null, this);
+ }
+
+ setActiveSession(nullSession);
+
+ return nullSession;
+ }
+
+ @Override
+ public ICdmEntitySession getActiveSession() {
+ return tlActiveSession.get();
+ }
+
+
+ private void setActiveSession(ICdmEntitySession activeSession) {
+ this. tlActiveSession.set(activeSession);
+ notifyObservers();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions()
+ */
+ @Override
+ public Collection<ICdmEntitySession> getSessions() {
+ return ownerSessionMap.values();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#bind(eu.etaxonomy.taxeditor.session.ISessionEventListener)
+ */
+ @Override
+ public void bind(ICdmEntitySessionEnabled sessionOwner) {
+ if(sessionOwner == null) {
+ setActiveSession(null);
+ return;
+ }
+ ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
+ if(session == null) {
+ throw new CdmClientSessionException("Trying to bind session which does not exist");
+ }
+
+ setActiveSession(session);
+
+ }
+
+ @Override
+ public boolean contains(ICdmEntitySessionEnabled sessionOwner) {
+ return ownerSessionMap.containsKey(sessionOwner);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(T)
+ */
+ @Override
+ public <T extends Object> T load(T obj, boolean update) {
+ if(tlActiveSession.get() == null) {
+ return obj;
+ } else {
+ return tlActiveSession.get().load(obj, update);
+ }
+ }
+
+
+ @Override
+ public <T extends CdmBase> void update() {
+ if(tlActiveSession.get() != null) {
+ tlActiveSession.get().update();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(T)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ if(tlActiveSession.get() == null) {
+ return cdmBase;
+ }
+ return tlActiveSession.get().load(cdmBase, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(eu.etaxonomy.cdm.api.service.UpdateResult, boolean)
+ */
+ @Override
+ public UpdateResult load(UpdateResult updateResult, boolean update) {
+ if(tlActiveSession.get() == null) {
+ return updateResult;
+ }
+ return tlActiveSession.get().load(updateResult, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(eu.etaxonomy.cdm.persistence.dto.MergeResult, boolean)
+ */
+ @Override
+ public MergeResult load(MergeResult mergeResult, boolean update) {
+ if(tlActiveSession.get() == null) {
+ return mergeResult;
+ }
+ return tlActiveSession.get().load(mergeResult, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ if(tlActiveSession.get() == null) {
+ return cdmBaseList;
+ }
+ return tlActiveSession.get().load(cdmBaseList, update);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ISessionEventListener)
+ */
+ void remove(ICdmEntitySessionEnabled owner) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session == null) {
+ logger.info("No Session connected to owner, nothing to do");
+ return;
+ }
+ if(session == tlActiveSession.get()) {
+ setActiveSession(null);
+ }
+ ownerSessionMap.remove(owner);
+ notifyObservers();
+
+ }
+
+ @Override
+ public void dispose(ICdmEntitySessionEnabled owner) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session != null) {
+ session.dispose();
+ }
+ if(nullSession != null && nullSession.getOwner() == owner) {
+ nullSession = null;
+ }
+
+ }
+
+
+ @Override
+ public void disposeAll() {
+ Set<ICdmEntitySessionEnabled> owners =
+ new HashSet<ICdmEntitySessionEnabled>(ownerSessionMap.keySet());
+ for(ICdmEntitySessionEnabled owner : owners) {
+ ICdmEntitySession session = ownerSessionMap.get(owner);
+ if(session != null) {
+ session.dispose();
+ }
+ }
+
+ }
+
+ void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, ICdmEntitySession session) {
+ ownerSessionMap.put(owner, session);
+ notifyObservers();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionListener()
+ */
+ @Override
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) {
+ sessionObservers.add(sessionObserver);
+ }
+
+ public void notifyObservers() {
+ for(ICdmEntitySessionManagerObserver sessionObserver : sessionObservers) {
+ sessionObserver.changed();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting()
+ */
+ @Override
+ public boolean isRemoting() {
+ // FIXME:Remoting stupid method to check whether we are in remoting
+ return true;
+ }
+
+}
+
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.session;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.model.NewEntityListener;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 30 Sep 2015
+ *
+ */
+public class DefaultNewEntityListener implements NewEntityListener {
+
+ private static final Logger logger = Logger.getLogger(DefaultNewEntityListener.class);
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.NewEntityListener#onCreate(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public void onCreate(CdmBase cdmBase) {
+ logger.info("New Entity created : " + cdmBase);
+ if(CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController){
+ ICdmEntitySession activeSession = ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
+ if(activeSession != null) {
+ activeSession.addNewCdmEntity(cdmBase);
+ }
+ }
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+
+public interface ICdmEntitySession {
+
+ public ICdmEntitySessionEnabled getOwner();
+
+ public LiveCacheStatistics getCacheStatistics();
+
+ public <O extends Object> O load(O obj, boolean update);
+
+ public <T extends CdmBase> T load(T cdmBase, boolean update);
+
+ public UpdateResult load(UpdateResult updateResult, boolean update);
+
+ public <T extends CdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug(Collection<T> cdmBase);
+
+ public <T extends CdmBase> EntityCacherDebugResult debug();
+
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update);
+
+ public void setEntitiesAsLatest();
+
+ public <T extends CdmBase> Collection<T> getRootEntities();
+
+ public void dispose();
+
+ public void bind();
+
+// public void addEvent(ICdmBase cdmBase, Set<CdmBase> affectedObjects, EventType eventType);
+
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid);
+
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths);
+
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase);
+
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase);
+
+
+// /**
+// * @param cdmBase
+// * @param affectedObjects
+// */
+// public <T extends ICdmBase> void update(T cdmBase, Set<CdmBase> affectedObjects);
+//
+// /**
+// * @param cdmBase
+// * @param affectedObjects
+// */
+// public <T extends ICdmBase> void delete(T cdmBase, Set<CdmBase> affectedObjects);
+//
+// /**
+// * @param cdmBase
+// * @param affectedObjects
+// */
+// public <T extends ICdmBase> void delete(Set<T> cdmBases, Set<CdmBase> affectedObjects);
+
+
+ public boolean isActive();
+
+// /**
+// * @param cdmBase
+// * @param affectedObject
+// */
+// public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject);
+
+ /**
+ *
+ */
+ public <T extends CdmBase> void update();
+
+
+ /**
+ * @param obj
+ * @return
+ */
+ public List<String> getPropertyPaths(Object obj);
+
+ public void addNewCdmEntity(CdmBase newEntity);
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+public interface ICdmEntitySessionEnabled {
+
+ public ICdmEntitySession getCdmEntitySession();
+
+ public <T extends CdmBase> Collection<T> getRootEntities();
+
+ public Map<Object, List<String>> getPropertyPathsMap();
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+
+public interface ICdmEntitySessionManager {
+
+ public abstract ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive);
+
+ /**
+ * @param sessionOwner
+ * @return
+ */
+ public ICdmEntitySession bindNullSession();
+
+
+ public abstract void bind(ICdmEntitySessionEnabled sessionOwner);
+
+
+ public abstract <T extends Object> T load(T obj, boolean update);
+
+
+ public abstract <T extends CdmBase> T load(T cdmBase, boolean update);
+
+
+ public abstract UpdateResult load(UpdateResult updateResult, boolean update);
+
+ public abstract MergeResult load(MergeResult mergeResult, boolean update);
+
+
+ public abstract <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update);
+
+
+ /**
+ * @return
+ */
+ public ICdmEntitySession getActiveSession();
+
+ public Collection<ICdmEntitySession> getSessions();
+
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver);
+
+
+
+
+ public boolean isRemoting();
+
+ /**
+ * @param owner
+ */
+ public void dispose(ICdmEntitySessionEnabled owner);
+
+ /**
+ *
+ */
+ public void disposeAll();
+
+
+ /**
+ *
+ */
+ public <T extends CdmBase> void update();
+
+ /**
+ * @param sessionOwner
+ * @return
+ */
+ public boolean contains(ICdmEntitySessionEnabled sessionOwner);
+
+ /**
+ * @return
+ */
+ public ICdmEntitySession getNullSession();
+
+
+}
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.session;
+
+/**
+ * @author cmathew
+ * @date 16 Feb 2015
+ *
+ */
+public interface ICdmEntitySessionManagerObserver {
+
+ public void changed();
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.session;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+
+/**
+ * @author cmathew
+ * @date 30 Jul 2015
+ *
+ */
+public class NullSession implements ICdmEntitySession {
+
+ private ICdmEntitySessionEnabled sessionOwner;
+ private final CdmEntitySessionManager cdmEntitySessionManager;
+
+ public NullSession(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ this.sessionOwner = sessionOwner;
+ this.cdmEntitySessionManager = cdmEntitySessionManager;
+ }
+
+ public void setOwner(ICdmEntitySessionEnabled sessionOwner) {
+ this.sessionOwner = sessionOwner;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner()
+ */
+ @Override
+ public ICdmEntitySessionEnabled getOwner() {
+ return sessionOwner;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getCacheStatistics()
+ */
+ @Override
+ public LiveCacheStatistics getCacheStatistics() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.lang.Object, boolean)
+ */
+ @Override
+ public <O> O load(O obj, boolean update) {
+ return obj;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.model.common.CdmBase, boolean)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ return cdmBase;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.UpdateResult, boolean)
+ */
+ @Override
+ public UpdateResult load(UpdateResult updateResult, boolean update) {
+ return updateResult;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(Collection<T> cdmBase) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug()
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.Collection, boolean)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmBaseList;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#setEntitiesAsLatest()
+ */
+ @Override
+ public void setEntitiesAsLatest() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose()
+ */
+ @Override
+ public void dispose() {
+ cdmEntitySessionManager.remove(sessionOwner);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#bind()
+ */
+ @Override
+ public void bind() {
+ cdmEntitySessionManager.bindNullSession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#remoteLoad(eu.etaxonomy.cdm.api.service.IService, java.util.UUID)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
+ T cdmBase = service.load(uuid);
+ return load(cdmBase, false);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#remoteLoad(eu.etaxonomy.cdm.api.service.IService, java.util.UUID, java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
+ T cdmBase = service.load(uuid, propertyPaths);
+ return load(cdmBase, false);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#remoteSave(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
+ UUID uuid = service.save(cdmBase).getUuid();
+ load(cdmBase,false);
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#remoteUpdate(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
+ T mergedCdmBase = service.merge(cdmBase, true).getMergedEntity();
+ return mergedCdmBase;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive()
+ */
+ @Override
+ public boolean isActive() {
+ return cdmEntitySessionManager.getActiveSession() == this;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update()
+ */
+ @Override
+ public <T extends CdmBase> void update() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getPropertyPaths(java.lang.Object)
+ */
+ @Override
+ public List<String> getPropertyPaths(Object obj) {
+ if(sessionOwner == null) {
+ return null;
+ }
+ Map<Object, List<String>> propertyPathsMap = sessionOwner.getPropertyPathsMap();
+ if(propertyPathsMap == null || propertyPathsMap.isEmpty()) {
+ return null;
+ }
+ return propertyPathsMap.get(obj);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#addNewCdmEntity(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public void addNewCdmEntity(CdmBase newEntity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.persistence.dto.MergeResult, boolean)
+ */
+ @Override
+ public <T extends CdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update) {
+ return mergeResult;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.session.mock;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+
+/**
+ * @author cmathew
+ * @date 29 Jan 2015
+ *
+ */
+public class MockCdmEntitySession implements ICdmEntitySession {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.lang.Object)
+ */
+ @Override
+ public <O extends Object> O load(O obj, boolean update) {
+ return obj;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T load(T cdmBase, boolean update) {
+ return cdmBase;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.Collection)
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmBaseList;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#setEntitiesAsLatest()
+ */
+ @Override
+ public void setEntitiesAsLatest() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#bind()
+ */
+ @Override
+ public void bind() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
+
+ return new EntityCacherDebugResult();
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(java.util.UUID, eu.etaxonomy.cdm.api.service.IService)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
+ return service.load(uuid);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.IService, java.util.UUID, java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
+ return service.load(uuid, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#save(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
+ return service.save(cdmBase).getUuid();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
+ return cdmBase;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner()
+ */
+ @Override
+ public ICdmEntitySessionEnabled getOwner() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getCacheStatistics()
+ */
+ @Override
+ public LiveCacheStatistics getCacheStatistics() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive()
+ */
+ @Override
+ public boolean isActive() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> List<T> getRootEntities() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug(java.util.List)
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug(Collection<T> cdmBase) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#debug()
+ */
+ @Override
+ public <T extends CdmBase> EntityCacherDebugResult debug() {
+
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update()
+ */
+ @Override
+ public <T extends CdmBase> void update() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.api.service.UpdateResult, boolean)
+ */
+ @Override
+ public UpdateResult load(UpdateResult updateResult, boolean update) {
+ return updateResult;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getPropertyPath(java.lang.Class)
+ */
+ @Override
+ public List<String> getPropertyPaths(Object obj) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#addNewCdmEntity(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public void addNewCdmEntity(CdmBase newEntity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#load(eu.etaxonomy.cdm.persistence.dto.MergeResult, boolean)
+ */
+ @Override
+ public <T extends CdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update) {
+ return mergeResult;
+ }
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session.mock;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+
+
+public class MockCdmEntitySessionManager implements ICdmEntitySessionManager {
+
+
+ @Override
+ public void bind(ICdmEntitySessionEnabled sessionOwner) {
+ }
+
+ @Override
+ public <T> T load(T obj, boolean update) {
+ return obj;
+ }
+
+ @Override
+ public <T extends CdmBase> T load(T obj, boolean update) {
+ return obj;
+ }
+
+
+ @Override
+ public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
+ return cdmBaseList;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#newSession(eu.etaxonomy.taxeditor.session.ISessionEventListener, boolean)
+ */
+ @Override
+ public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getActiveSession()
+ */
+ @Override
+ public ICdmEntitySession getActiveSession() {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions()
+ */
+ @Override
+ public Collection<ICdmEntitySession> getSessions() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionObserver(eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver)
+ */
+ @Override
+ public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting()
+ */
+ @Override
+ public boolean isRemoting() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public void dispose(ICdmEntitySessionEnabled owner) {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#disposeAll()
+ */
+ @Override
+ public void disposeAll() {
+
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#update()
+ */
+ @Override
+ public <T extends CdmBase> void update() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(eu.etaxonomy.cdm.api.service.UpdateResult, boolean)
+ */
+ @Override
+ public UpdateResult load(UpdateResult updateResult, boolean update) {
+ return updateResult;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#contains(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public boolean contains(ICdmEntitySessionEnabled sessionOwner) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#bindNullSession(eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled)
+ */
+ @Override
+ public ICdmEntitySession bindNullSession() {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getNullSession()
+ */
+ @Override
+ public ICdmEntitySession getNullSession() {
+ return new MockCdmEntitySession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#load(eu.etaxonomy.cdm.persistence.dto.MergeResult, boolean)
+ */
+ @Override
+ public MergeResult load(MergeResult mergeResult, boolean update) {
+ return mergeResult;
+ }
+
+}
package org.hibernate.collection.internal;
import java.io.Serializable;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
import javax.naming.NamingException;
import org.hibernate.type.Type;
import org.jboss.logging.Logger;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.service.ICommonService;
-import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.remoting.CdmEagerLoadingException;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
/**
* Base class implementing {@link org.hibernate.collection.spi.PersistentCollection}
*
+ * This a extended copy of the original class from hibernate. It has been extended to
+ * allow making remote service calls to spring httpinvoker services (see section at the bottom
+ * of this class).
+ *
+ *
* @author Gavin King
+ * @author Cherian Mathew
*/
public abstract class AbstractPersistentCollection implements Serializable, PersistentCollection {
private static final Logger log = Logger.getLogger( AbstractPersistentCollection.class );
- private static final long serialVersionUID = -7238232378593030571L;
+ /**
+ * <b>IMPORTANT:</b><br>
+ * This serialVersionUID must be kept in sync with the serialVersionUID which is generated
+ * on the fly for serialized AbstractPersistentCollection objects coming from the httpInvoker
+ * service.
+ * This is most probably necessary after updating hibernate to a newer version. In any case
+ * it the need for updating this <code>serialVersionUID</code> becomes obvious when the attempt
+ * to connect to the server side fails with an <code>InvalidClassException</code>:
+ *
+ * <pre>
+ * java.io.InvalidClassException: org.hibernate.collection.internal.AbstractPersistentCollection;
+ * local class incompatible:
+ * stream classdesc serialVersionUID = 2742261122392386159,
+ * local class serialVersionUID = -7238232378593030571
+ * </pre>
+ * The correct <code>serialVersionUID</code> is the <code>stream classdesc serialVersionUID</code>
+ * from the error message.
+ */
+ private static final long serialVersionUID = 2742261122392386159L;
private transient SessionImplementor session;
private boolean initialized;
if ( isTempSession ) {
// TODO: On the next major release, add an
// 'isJTA' or 'getTransactionFactory' method to Session.
- isJTA = session.getTransactionCoordinator()
+ /*isJTA = session.getTransactionCoordinator()
.getTransactionContext().getTransactionEnvironment()
.getTransactionFactory()
- .compatibleWithJtaSynchronization();
-
+ .compatibleWithJtaSynchronization();*/
+ isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
if ( !isJTA ) {
// Explicitly handle the transactions only if we're not in
// a JTA environment. A lazy loading temporary session can
* @throws LazyInitializationException if we cannot initialize
*/
protected final void initialize(final boolean writing) {
- // In remoting we are sure that session is null
- // both when using property paths and switching off conversations
- if(session == null && remoting) {
- remoteInitialize();
- }
-
- if ( initialized ) {
- return;
- }
-
-
- withTemporarySessionIfNeeded(
- new LazyInitializationWork<Object>() {
- @Override
- public Object doWork() {
- session.initializeCollection( AbstractPersistentCollection.this, writing );
- return null;
- }
- }
- );
+ if ( initialized ) {
+ return;
+ }
+
+ // In remoting we are sure that session is null
+ // both when using property paths and switching off conversations
+ if(session == null && remoting) {
+ remoteInitialize();
+ } else {
+ withTemporarySessionIfNeeded(
+ new LazyInitializationWork<Object>() {
+ @Override
+ public Object doWork() {
+ session.initializeCollection( AbstractPersistentCollection.this, writing );
+ return null;
+ }
+ }
+ );
+ }
}
private void throwLazyInitializationExceptionIfNotConnected() {
// readElementExistence(final Object element)
// readElementByIndex(final Object index)
- private static ICdmApplicationConfiguration configuration;
+ private static CdmApplicationRemoteConfiguration configuration;
private static boolean remoting = false;
- public static void setConfiguration(ICdmApplicationConfiguration conf) {
+ public static void setConfiguration(CdmApplicationRemoteConfiguration conf) {
+ remoting = true;
configuration = conf;
-
- if(conf instanceof CdmApplicationRemoteController) {
- remoting = true;
- } else {
- remoting = false;
- }
}
try {
String role = getRole();
String fieldName = role.substring(role.lastIndexOf(".") + 1);
- log.info("--> Remote Lazy Initializing " + getRole() + " , key : " + getKey() + " , field : " + fieldName);
+ log.info("--> Remote Lazy Initializing Collection " + getRole() + " , owner : " + getOwner().getClass() + "/" + getKey() + " , field : " + fieldName);
Object owner = getOwner();
-
+ CdmBase cdmBase;
+ if(owner instanceof CdmBase) {
+ cdmBase = (CdmBase)owner;
+ } else {
+ throw new HibernateException("Owner of persistent collection is not a cdm entity");
+ }
if(configuration == null) {
throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
}
- ICommonService commonService = configuration.getCommonService();
- if(commonService == null) {
+ ICachedCommonService cachedCommonService = configuration.getCachedCommonService();
+ if(cachedCommonService == null) {
throw new HibernateException("commonService not initialized (null)");
}
-// PersistentCollection col = commonService.initializeCollection(this);
-// afterInitialize();
-//
-// Class<?> clazz = getClass();
-// if (clazz != null) {
-// CollectionField cf = getCollectionField(col);
-// Field field = clazz.getDeclaredField(cf.getFieldName());
-// field.setAccessible(true);
-// field.set(this, cf.getCollection());
-// }
- } catch (Exception ex) {
- log.warn(ex.getMessage());
- }
- log.warn("This code is invalid");
- }
- }
-
+ //Object obj = ProxyUtils.deproxy(cachedCommonService.initializeCollection(this));
+ Object obj = ProxyUtils.deproxy(cachedCommonService.initializeCollection(cdmBase.getUuid(), fieldName));
+ if(ProxyUtils.isProxy(obj)) {
+ throw new HibernateException("Persistent Collection initialized but is still a proxy");
+ }
+ afterInitialize();
+
+ Class<?> clazz = getClass();
+ if (clazz != null) {
+ //CollectionField cf = cachedCommonService.getCollectionField(col);
+ //cachedCommonService.updatePersistentCollection(cf);
+ Object collectionType = ProxyUtils.getCollectionType(obj);
+ Field field = clazz.getDeclaredField(collectionType.toString());
+ field.setAccessible(true);
+ field.set(this, obj);
+ ProxyUtils.setRoleValueInOwner(owner, role, obj);
- private CollectionField getCollectionField(PersistentCollection pc) {
- if(pc != null) {
- if(pc instanceof PersistentSet) {
- return new CollectionField(new HashSet((Set)pc), "set");
- }
- if(pc instanceof PersistentSortedSet) {
- return new CollectionField(new TreeSet((Set)pc), "set");
- }
- if(pc instanceof PersistentList) {
- return new CollectionField(new ArrayList((List)pc), "list");
- }
- if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return new CollectionField(new HashMap((Map)pc), "map");
- }
- if(pc instanceof PersistentSortedMap) {
- return new CollectionField(new TreeMap((Map)pc), "map");
+ }
+ } catch (Exception ex) {
+ throw new CdmEagerLoadingException(ex);
}
}
- return null;
}
- private String getCollectionFieldName(PersistentCollection pc) {
- if(pc != null) {
- if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
- return "set";
- }
- if(pc instanceof PersistentList) {
- return "list";
- }
- if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) {
- return "map";
- }
- }
- return null;
- }
-
- private class CollectionField {
- private final Object col;
- private final String fieldName;
- public CollectionField(Object col, String fieldName) {
- this.col = col;
- this.fieldName = fieldName;
- }
-
- public Object getCollection() {
- return this.col;
- }
-
- public String getFieldName() {
- return this.fieldName;
- }
- }
-
- public static boolean isInitialized(List list) {
- return ((AbstractPersistentCollection)list).initialized;
- }
-
- public static boolean isInitialized(Map map) {
- return ((AbstractPersistentCollection)map).initialized;
- }
-
- public static boolean isInitialized(Set set) {
- return ((AbstractPersistentCollection)set).initialized;
- }
}
package org.hibernate.proxy;
import java.io.Serializable;
-import java.util.Set;
import javax.naming.NamingException;
import org.hibernate.Session;
import org.hibernate.SessionException;
import org.hibernate.TransientObjectException;
-import org.hibernate.collection.internal.AbstractPersistentCollection;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.internal.SessionFactoryRegistry;
import org.hibernate.persister.entity.EntityPersister;
import org.jboss.logging.Logger;
-import org.springframework.beans.factory.annotation.Autowire;
-import org.springframework.beans.factory.annotation.Configurable;
-import org.springframework.stereotype.Component;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils;
+import eu.etaxonomy.taxeditor.service.ICachedCommonService;
/**
* Convenience base class for lazy initialization handlers. Centralizes the basic plumbing of doing lazy
*
* @author Gavin King
*/
-@Component
-@Configurable(dependencyCheck = true,autowire = Autowire.BY_TYPE)
public abstract class AbstractLazyInitializer implements LazyInitializer {
private static final Logger log = Logger.getLogger( AbstractLazyInitializer.class );
SessionFactoryImplementor sf = (SessionFactoryImplementor)
SessionFactoryRegistry.INSTANCE.getSessionFactory( sessionFactoryUuid );
SessionImplementor session = (SessionImplementor) sf.openSession();
-
+
// TODO: On the next major release, add an
// 'isJTA' or 'getTransactionFactory' method to Session.
- boolean isJTA = session.getTransactionCoordinator()
+ /*boolean isJTA = session.getTransactionCoordinator()
.getTransactionContext().getTransactionEnvironment()
.getTransactionFactory()
.compatibleWithJtaSynchronization();
-
+ */
+ boolean isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
+
if ( !isJTA ) {
// Explicitly handle the transactions only if we're not in
// a JTA environment. A lazy loading temporary session can
public void setUnwrap(boolean unwrap) {
this.unwrap = unwrap;
}
-
+
/** Below is section of code which makes remote service calls */
-
- private static ICdmApplicationConfiguration configuration;
+
+ private static CdmApplicationRemoteConfiguration configuration;
private static boolean remoting = false;
-
- public static void setConfiguration(ICdmApplicationConfiguration conf) {
- configuration = conf;
-
- if(conf instanceof CdmApplicationRemoteController) {
- remoting = true;
- } else {
- remoting = false;
- }
+
+ public static void setConfiguration(CdmApplicationRemoteConfiguration conf) {
+ remoting = true;
+ configuration = conf;
}
-
-
- private void remoteInitialize() {
-
- if(!initialized) {
+
+
+ private void remoteInitialize() {
+
+ if(!initialized) {
int classid = ((Integer)getIdentifier()).intValue();
- log.debug("--> Remote Lazy Initializing" + getEntityName() + " with id " + classid);
+ log.info("--> Remote Lazy Initializing Object " + getEntityName() + " with id " + classid);
Class clazz;
try {
- clazz = (Class<? extends CdmBase>) Class.forName(getEntityName());
+ clazz = Class.forName(getEntityName());
} catch (ClassNotFoundException e) {
throw new HibernateException("Class for " + getEntityName() + " not found", e);
}
if(configuration == null) {
throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
}
- ICommonService commonService = configuration.getCommonService();
- if(commonService == null) {
+ ICachedCommonService cachedCommonService = configuration.getCachedCommonService();
+ if(cachedCommonService == null) {
throw new HibernateException("commonService not initialized (null)");
}
-
- CdmBase cdmBase = CdmBase.deproxy(commonService.find(clazz,classid),clazz);
+
+ CdmBase cdmBase = cachedCommonService.find(clazz,classid);
+ if(ProxyUtils.isProxy(cdmBase)) {
+ throw new HibernateException("CdmBase Object initialized but is still a proxy");
+ }
setImplementation(cdmBase);
-
+
}
}
-
+
public static boolean isInitialized(AbstractLazyInitializer obj) {
return obj.initialized;
}
<?xml version="1.0" encoding="UTF-8"?>\r
<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">\r
-\r
- \r
- <bean id="agentService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/agent.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAgentService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="annotationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/annotation.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAnnotationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="auditeventService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/auditevent.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IAuditEventService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="classificationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/classification.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IClassificationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="collectionService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/collection.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ICollectionService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="commonService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/common.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ICommonService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="descriptionService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/description.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IDescriptionService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="editGeoService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/editgeo.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.ext.geo.IEditGeoService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="featureNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featurenode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IFeatureNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="featureTreeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featuretree.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IFeatureTreeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="groupService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/group.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IGroupService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="identificationKeyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/identificationkey.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IIdentificationKeyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="locationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/location.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ILocationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="markerService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/marker.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IMarkerService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="mediaService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/media.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IMediaService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="nameService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/name.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.INameService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="occurrenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/occurrence.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IOccurrenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="polytomousKeyNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskeynode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="polytomousKeyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskey.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="referenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/reference.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IReferenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
-<!-- \r
- <bean id="serviceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/service.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IService</value>\r
- </property>\r
- </bean>\r
- -->\r
- \r
- <bean id="taxonNodeService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxonnode.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITaxonNodeService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="taxonService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxon.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITaxonService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="termService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/term.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.ITermService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="userService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/user.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IUserService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="vocabularyService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/vocabulary.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IVocabularyService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="workingSetService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/workingset.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IWorkingSetService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="grantedAuthorityService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/grantedauthority.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IGrantedAuthorityService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="databaseService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/database.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.IDatabaseService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsidAuthorityService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidauthoruty.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsidMetadataService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidmetadata.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDMetadataService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="lsiDataService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsiddata.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.lsid.LSIDDataService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
-\r
- <bean id="providerManager"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/authenticationManager.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>org.springframework.security.authentication.AuthenticationManager</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="primerService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/primer.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.IPrimerService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="amplificationService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/amplification.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.IAmplificationService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
- \r
- <bean id="sequenceService"\r
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
- <property name="serviceUrl">\r
- <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/sequence.service</value>\r
- </property>\r
- <property name="serviceInterface">\r
- <value>eu.etaxonomy.cdm.api.service.molecular.ISequenceService</value>\r
- </property>\r
- <property name="httpInvokerRequestExecutor">\r
- <bean class="org.springframework.security.remoting.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor" />\r
- </property>\r
- </bean>\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"\r
+ xmlns:tx="http://www.springframework.org/schema/tx"\r
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd\r
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd\r
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">\r
+\r
+\r
+ <bean id="agentService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/agent.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IAgentService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="annotationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/annotation.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IAnnotationService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="auditeventService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/auditevent.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IAuditEventService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="classificationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/classification.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IClassificationService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="collectionService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/collection.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ICollectionService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="commonService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/common.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ICommonService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="descriptionService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/description.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IDescriptionService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="editGeoService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/editgeo.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.ext.geo.IEditGeoService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="featureNodeService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featurenode.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IFeatureNodeService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="featureTreeService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/featuretree.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IFeatureTreeService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="groupService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/group.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IGroupService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="identificationKeyService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/identificationkey.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IIdentificationKeyService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="locationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/location.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ILocationService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="markerService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/marker.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IMarkerService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="mediaService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/media.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IMediaService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="nameService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/name.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.INameService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="occurrenceService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/occurrence.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IOccurrenceService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="polytomousKeyNodeService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskeynode.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="polytomousKeyService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/polytomouskey.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IPolytomousKeyService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="referenceService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/reference.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IReferenceService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="taxonNodeService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxonnode.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ITaxonNodeService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="taxonService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/taxon.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ITaxonService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="termService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/term.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ITermService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.TermServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="userService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting-public/user.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IUserService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean\r
+ class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="vocabularyService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/vocabulary.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IVocabularyService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="workingSetService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/workingset.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IWorkingSetService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="grantedAuthorityService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/grantedauthority.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IGrantedAuthorityService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="databaseService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/database.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IDatabaseService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="lsidAuthorityService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidauthoruty.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="lsidMetadataService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsidmetadata.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.lsid.LSIDMetadataService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="lsiDataService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/lsiddata.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.lsid.LSIDDataService</value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+\r
+\r
+ <bean id="primerService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/primer.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.molecular.IPrimerService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="amplificationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/amplification.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.molecular.IAmplificationService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="sequenceService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/sequence.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.molecular.ISequenceService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="eventBaseService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/eventbase.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IEventBaseService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="entityValidationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/entityvalidation.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IEntityValidationService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="entityConstraintViolationService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/entityconstraintviolation.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+ \r
+ <bean id="ioService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/io.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.io.service.IIOService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmAuthenticatedHttpInvokerRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="testService" lazy-init="true"\r
+ class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">\r
+ <property name="serviceUrl">\r
+ <value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/test.service\r
+ </value>\r
+ </property>\r
+ <property name="serviceInterface">\r
+ <value>eu.etaxonomy.cdm.api.service.ITestService\r
+ </value>\r
+ </property>\r
+ <property name="httpInvokerRequestExecutor">\r
+ <bean class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor">\r
+ <property name="readTimeout" value="0" />\r
+ </bean>\r
+ </property>\r
+\r
+ </bean>\r
\r
\r
\r
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
-
-
- <!-- Default application context and term initializer -->
- <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
+
+
+ <!-- Default application context and term initializer -->
+ <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml" />
<bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
<property name="omit" value="false" />
</bean>
-
- <import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/>
- <import resource="classpath:eu/etaxonomy/cdm/remote/json/jsonConfigurations.xml"/>
-
- <context:component-scan base-package="eu/etaxonomy/cdm/ext"/>
-
+
+ <context:component-scan base-package="eu/etaxonomy/taxeditor/session" />
+ <import resource="classpath:/eu/etaxonomy/cdm/remote.xml" />
+ <import resource="classpath:eu/etaxonomy/cdm/remote/json/jsonConfigurations.xml" />
+
+ <context:component-scan base-package="eu/etaxonomy/cdm/ext" />
+
<context:component-scan base-package="eu/etaxonomy/cdm/remote">
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.config\.DataSourceConfigurer" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.config\.LoggingConfigurer" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.view\.PatternViewResolver" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.vaadin\..*" />
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.remote\.controller\..*Portal.*" />
+ <context:exclude-filter type="regex"
+ expression="eu\.etaxonomy\.cdm\.remote\.config\.DataSourceConfigurer" />
+ <context:exclude-filter type="regex"
+ expression="eu\.etaxonomy\.cdm\.remote\.config\.LoggingConfigurer" />
+ <context:exclude-filter type="regex"
+ expression="eu\.etaxonomy\.cdm\.remote\.view\.PatternViewResolver" />
+ <context:exclude-filter type="regex"
+ expression="eu\.etaxonomy\.cdm\.remote\.vaadin\..*" />
+ <context:exclude-filter type="regex"
+ expression="eu\.etaxonomy\.cdm\.remote\.controller\..*Portal.*" />
</context:component-scan>
-
+
+ <context:component-scan base-package="eu/etaxonomy/taxeditor/remoting/session/mock" />
</beans>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE hibernate-configuration PUBLIC\r
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"\r
+ "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">\r
+\r
+<hibernate-configuration>\r
+ <session-factory>\r
+\r
+ <property name="connection.release_mode">after_transaction</property>\r
+\r
+ <!-- Connection Pooling -->\r
+<!-- <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property> -->\r
+ <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl</property>\r
+ <!--\r
+ Configuring the C3P0ConnectionProvider\r
+ ========================================\r
+ see http://www.mchange.com/projects/c3p0/index.html#hibernate-specific\r
+ and also org.springframework.orm.hibernate3.AbstractSessionFactoryBean.setDataSource(DataSource dataSource)\r
+\r
+ IMPORTANT:\r
+ Because of the constraint (1) the org.hibernate.connection.C3P0ConnectionProvider are not be used\r
+ for the Cdm Library because it requires the dataSource bean in some cases.\r
+\r
+ (1)\r
+ Do NOT specify the dataSource in the sessionFactory for example in the\r
+ org.springframework.orm.hibernate3.LocalSessionFactoryBean\r
+ !!!==> If *dataSource* is set, this will override corresponding settings in Hibernate properties.!!!\r
+ If this is set, the Hibernate settings should not define a connection provider to\r
+ avoid meaningless double configuration.\r
+ (2)\r
+ Hibernate uses the hibernate.c3p0.max_size property to determine if c3p0\r
+ is beeing used. Therefore the max_size property MUST be set. - maybe not need in hibernate 3.4 +\r
+\r
+ (3) If you are using Hibernate's C3P0ConnectionProvider you must set the following properties\r
+ in your hibernate configuration, using hibernate-specific configuration keys.\r
+ All other properties must be defined as usual in a c3p0.properties file.\r
+ This is confusing, and will hopefully be simplified some time in the future, but for now...\r
+ \r
+ DOCUMENTATION UPDATE (2015-05-22):\r
+ Hibernate's C3P0ConnectionProvider renames 7 c3p0 configuration properties, which, \r
+ if set in your hibernate configuration, will override any configuration you may have set \r
+ in a c3p0.properties file.\r
+ TODO: are points (2) and (3) still valid? I don't think so! (AK)\r
+\r
+ hibernate.c3p0.acquire_increment\r
+ hibernate.c3p0.idle_test_period\r
+ hibernate.c3p0.timeout\r
+ hibernate.c3p0.max_size\r
+ hibernate.c3p0.max_statements\r
+ hibernate.c3p0.min_size\r
+ hibernate.c3p0.validate\r
+ -->\r
+ <mapping package="eu.etaxonomy.cdm.model.common"/>\r
+ <!-- Annotation Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.Address"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.AgentBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.Contact"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.Institution"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.InstitutionalMembership"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.Person"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.Team"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.agent.TeamOrPersonBase"/>\r
+ <!-- Common Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Annotation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.AnnotationType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Credit"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.DefinedTerm"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.DefinedTermBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Extension"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.ExtensionType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.IdentifiableSource"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Identifier"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.IntextReference"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Group"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Language"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.LanguageString"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.LSID"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.LSIDAuthority"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Marker"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.MarkerType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.OrderedTerm"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.OrderedTermBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.OrderedTermVocabulary"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.OriginalSourceBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.RelationshipTermBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.Representation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.TermVocabulary"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.common.User"/>\r
+ <!-- Description Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.description.CategoricalData"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.CommonTaxonName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.DescriptionBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.DescriptionElementBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.DescriptionElementSource"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.Distribution"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.Feature"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.FeatureNode"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.FeatureTree"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.KeyStatement"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.MediaKey"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.IndividualsAssociation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.MeasurementUnit"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.MultiAccessKey"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.PolytomousKey"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.PolytomousKeyNode"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.QuantitativeData"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.SpecimenDescription"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.State"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.StateData"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.StatisticalMeasure"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.TaxonDescription"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.TaxonInteraction"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.TaxonNameDescription"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.TextData"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.TextFormat"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.description.WorkingSet"/>\r
+ <!-- Location Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.location.NamedArea"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.location.NamedAreaLevel"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.location.NamedAreaType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.location.ReferenceSystem"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.location.Point"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.location.Country"/>\r
+ <!-- Media Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.media.AudioFile"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.ImageFile"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.Media"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.MediaRepresentation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.MediaRepresentationPart"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.MovieFile"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.Rights"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.media.RightsType"/>\r
+ <!-- Meta Data Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.metadata.CdmMetaData"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.metadata.CdmPreference"/>\r
+ <!-- Molecular Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.PhylogeneticTree"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.DnaQuality"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.DnaSample"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.Amplification"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.AmplificationResult"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.Primer"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.Sequence"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.SequenceString"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.SingleRead"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.SingleReadAlignment"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.molecular.Cloning"/>\r
+ <!-- Name Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.name.BacterialName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.BotanicalName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.CultivarPlantName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.HomotypicalGroup"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.HybridRelationship"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.HybridRelationshipType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NameRelationship"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NameRelationshipType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NameTypeDesignation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NomenclaturalCode"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NomenclaturalStatus"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NomenclaturalStatusType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.NonViralName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.Rank"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.TaxonNameBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.TypeDesignationBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.ViralName"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.name.ZoologicalName"/>\r
+ <!-- Occurrence Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.Collection"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.DerivationEvent"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.DerivationEventType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.DerivedUnit"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.MediaSpecimen"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.DeterminationEvent"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.FieldUnit"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.GatheringEvent"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.PreservationMethod"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase"/>\r
+ <!-- Reference Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.reference.Reference"/>\r
+\r
+ <!-- Taxon Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.Synonym"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.SynonymRelationship"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.Taxon"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.TaxonBase"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNode"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.Classification"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationship"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType"/>\r
+ \r
+ <!-- Validation Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.validation.EntityValidation"/>\r
+ <mapping class="eu.etaxonomy.cdm.model.validation.EntityConstraintViolation"/>\r
+ \r
+ <!-- View Package -->\r
+ <mapping class="eu.etaxonomy.cdm.model.view.AuditEvent"/>\r
+ \r
+ <!-- for filling caches -->\r
+ <!-- since hibernate 4 listeners are not handled via hibernate.cfg.xml anymore -->\r
+ <!-- http://stackoverflow.com/questions/8616146/eventlisteners-using-hibernate-4-0-with-spring-3-1-0-release\r
+ https://community.jboss.org/wiki/HibernateCoreMigrationGuide40 -->\r
+\r
+ </session-factory>\r
+</hibernate-configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>\r
<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">\r
- \r
- \r
- <!-- <bean id="remoteTermInitializer" class="eu.etaxonomy.cdm.remote.service.RemoteTermInitializer"/>-->\r
- \r
- <context:annotation-config/>\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"\r
+ xmlns:tx="http://www.springframework.org/schema/tx"\r
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">\r
+\r
+ <import resource="classpath:/eu/etaxonomy/cdm/httpInvokerServiceClients.xml" />\r
+\r
+ <bean id="cdmEntitySessionManager" \r
+ class="eu.etaxonomy.taxeditor.session.CdmEntitySessionManager" />\r
+\r
+ <bean id="cdmApplicationRemoteConfiguration" \r
+ class="eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration" />\r
+\r
+ \r
+ <bean id="cdmServiceRequestExecutor" \r
+ class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor" />\r
+ \r
+ <bean id="cachedCommonService" \r
+ class="eu.etaxonomy.taxeditor.service.CachedCommonServiceImpl" />\r
+ \r
+ \r
+ <bean id="defaultExport"\r
+ class="eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultExport" />\r
\r
- <import resource="classpath:/eu/etaxonomy/cdm/httpInvokerServiceClients.xml"/>\r
+ <bean id="jaxbExport"\r
+ class="eu.etaxonomy.cdm.io.jaxb.JaxbExport" />\r
\r
- <bean id="cdmApplicationRemoteConfiguration" class="eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration"/> \r
+ <bean id="accessDecisionManager" \r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.UnanimousBasedUnrevokable" >\r
\r
- <import resource="classpath:/eu/etaxonomy/cdm/remoting_services_security.xml"/> \r
- \r
- <bean id="cdmTermCacher" class="eu.etaxonomy.cdm.api.cache.CdmTermCacher"/>\r
- \r
- \r
- <!-- EditGeoService was moved to ext. Therefore it will not be found by the default component scan.
- We added it here because the Editor needs it. However, this is only a temporary solution.
- In the future we want to pass in an application context with the editor. -->\r
-\r
-\r
- <!-- <bean id="conversationHolder" class="eu.etaxonomy.cdm.api.conversation.ConversationHolder" scope="prototype"/> -->\r
-\r
- <!-- TODO move to io -->\r
-<!-- \r
- <context:component-scan base-package="eu/etaxonomy/cdm/io">\r
- <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.berlinModel.*" />\r
- </context:component-scan>\r
- -->\r
- <!-- enable the configuration of transactional behavior based on annotations -->\r
- <!-- <tx:annotation-driven transaction-manager="transactionManager"/> -->\r
+ <property name="decisionVoters">\r
+ <list>\r
+ <bean\r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter" />\r
+ <bean\r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter" />\r
+ <bean\r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter" />\r
+ <bean\r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter" />\r
+ <bean\r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter" />\r
+ </list>\r
+ </property>\r
+ </bean>\r
+\r
+ <!-- CdmPermissionEvaluator.hasPermissions() evaluates the CdmPermissions \r
+ like TAXONNODE.UPDATE{20c8f083-5870-4cbd-bf56-c5b2b98ab6a7} -->\r
+ <bean id="cdmPermissionEvaluator" \r
+ class="eu.etaxonomy.cdm.persistence.hibernate.permission.CdmPermissionEvaluator">\r
+ <property name="accessDecisionManager" ref="accessDecisionManager" />\r
+ </bean>\r
+\r
+ <bean id="authenticationManager"\r
+ class="org.springframework.security.authentication.ProviderManager">\r
+ <property name="providers">\r
+ <list>\r
+ <ref local="daoAuthenticationProvider" />\r
+ </list>\r
+ </property>\r
+ </bean>\r
+\r
+ <bean id="daoAuthenticationProvider" \r
+ class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">\r
+ <property name="userDetailsService" ref="userService" />\r
+ <property name="saltSource" ref="saltSource" />\r
+ <property name="passwordEncoder" ref="passwordEncoder" />\r
+ </bean>\r
+\r
+ <bean id="passwordEncoder" \r
+ class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" />\r
+\r
+ <bean id="saltSource" \r
+ class="org.springframework.security.authentication.dao.ReflectionSaltSource">\r
+ <property name="userPropertyToUse" value="getUsername" />\r
+ </bean>\r
\r
</beans>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans\r
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd\r
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd\r
- ">\r
-\r
-\r
- <!--\r
- ============================== SECURITY ==============================\r
- -->\r
- <bean id="accessDecisionManager" class="eu.etaxonomy.cdm.persistence.hibernate.permission.UnanimousBasedUnrevokable">\r
- <property name="decisionVoters">\r
- <list>\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.GrantAlwaysVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonNodeVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.TaxonBaseVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionBaseVoter" />\r
- <bean class="eu.etaxonomy.cdm.persistence.hibernate.permission.voter.DescriptionElementVoter" />\r
- </list>\r
- </property>\r
- </bean>\r
-\r
- <!--\r
- CdmPermissionEvaluator.hasPermissions() evaluates the CdmPermissions like TAXONNODE.UPDATE{20c8f083-5870-4cbd-bf56-c5b2b98ab6a7}\r
- -->\r
- <bean id="cdmPermissionEvaluator" class="eu.etaxonomy.cdm.persistence.hibernate.permission.CdmPermissionEvaluator">\r
- <property name="accessDecisionManager" ref="accessDecisionManager" />\r
- </bean>\r
-\r
- <!-- The CdmSecurityHibernateInterceptor checks onSave() and on flushDirty() if the currently authenticated principal or token has\r
- sufficient permissions on the entity to be persisted -->\r
- <bean id="securityHibernateInterceptor" class="eu.etaxonomy.cdm.persistence.hibernate.CdmSecurityHibernateInterceptor">\r
- <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />\r
- </bean>\r
-\r
-</beans>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:context="http://www.springframework.org/schema/context"\r
- xmlns:security="http://www.springframework.org/schema/security"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd\r
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd\r
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd\r
- http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"\r
- >\r
-\r
- <import resource="classpath:/eu/etaxonomy/cdm/remoting_persistence_security.xml"/>\r
- <!--\r
- ======================================================================\r
- security specific configuration\r
- ======================================================================\r
- -->\r
- <security:global-method-security pre-post-annotations="enabled" run-as-manager-ref="runAsManager" >\r
- <security:expression-handler ref="expressionHandler" />\r
- </security:global-method-security>\r
-\r
- <!--\r
- To use "hasPermission()" in the Spring EL method annotations like @PreAuthorize we explicitly configure the permissionEvaluator\r
- the cdmPermissionEvaluator is already defined in the persistence security context\r
- -->\r
- <bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">\r
- <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />\r
- </bean>\r
-\r
- <bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">\r
- <property name="providers">\r
- <list>\r
- <ref local="daoAuthenticationProvider"/>\r
- </list>\r
- </property>\r
- </bean>\r
-\r
- <bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">\r
- <property name="userDetailsService" ref="userService"/>\r
- <property name="saltSource" ref="saltSource"/>\r
- <property name="passwordEncoder" ref="passwordEncoder"/>\r
- </bean>\r
-\r
- <bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>\r
-\r
- <bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">\r
- <property name="userPropertyToUse" value="getUsername"/>\r
- </bean>\r
-\r
- <!--\r
- Run-As Authentication Replacement for system operations\r
- as e.g. performed by the eu.etaxonomy.cdm.api.application.FirstDataInserter\r
-\r
- the key must match FirstDataInserter.RUN_AS_KEY\r
- -->\r
- <bean id="runAsManager"\r
- class="org.springframework.security.access.intercept.RunAsManagerImpl">\r
- <property name="key" value="TtlCx3pgKC4l"/>\r
- </bean>\r
-\r
-\r
-</beans>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%c] - %m%n" />
+ </layout>
+ <filter class="org.apache.log4j.filter.ExpressionFilter">
+ <param name="expression"
+ value="msg like '.*has a maxElementsInMemory of 0. This might lead to performance degradation or OutOfMemoryError at Terracotta client.*'" />
+ <param name="acceptOnMatch" value="false" />
+ </filter>
+ <filter class="org.apache.log4j.filter.ExpressionFilter">
+ <param name="expression"
+ value="msg like '.*object references was reached while attempting to calculate the size of the object graph.*'" />
+ <param name="acceptOnMatch" value="false" />
+ </filter>
+ </appender>
+ <root>
+ <priority value="WARN" />
+ <appender-ref ref="CONSOLE" />
+ </root>
+<!-- <logger name="org.hibernate.proxy.AbstractLazyInitializer"> -->
+<!-- <level value="info" /> -->
+<!-- </logger> -->
+<!-- <logger -->
+<!-- name="org.hibernate.collection.internal.AbstractPersistentCollection"> -->
+<!-- <level value="info" /> -->
+<!-- </logger> -->
+<!-- <logger -->
+<!-- name="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor"> -->
+<!-- <level value="info" /> -->
+<!-- </logger> -->
+<!-- <logger -->
+<!-- name="eu.etaxonomy.taxeditor.session.DefaultNewEntityListener"> -->
+<!-- <level value="info" /> -->
+<!-- </logger> -->
+<!-- <logger -->
+<!-- name="eu.etaxonomy.taxeditor.util.ProgressMonitorClientManager"> -->
+<!-- <level value="info" /> -->
+<!-- </logger> -->
+</log4j:configuration>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <bean id="defaultRemoteSource">
- <property name="server" value="127.0.0.1"/>
- <property name="port" value="8080"/>
- <property name="contextPath" value=""/>
- </bean>
-
- <bean id="incompleteRemoteSource">
- <property name="server" value="127.0.0.1"/>
- <property name="contextPath" value=""/>
- </bean>
-
-</beans>
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/main/java"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/java"/>\r
- <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Editor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
eu.etaxonomy.taxeditor.editor.key.polytomous,
eu.etaxonomy.taxeditor.editor.name,
eu.etaxonomy.taxeditor.editor.name.handler,
+ eu.etaxonomy.taxeditor.editor.name.operation,
eu.etaxonomy.taxeditor.editor.view.concept,
- eu.etaxonomy.taxeditor.editor.view.dataimport,
+ eu.etaxonomy.taxeditor.editor.view.derivate,
eu.etaxonomy.taxeditor.editor.view.descriptive,
eu.etaxonomy.taxeditor.editor.view.media,
eu.etaxonomy.taxeditor.editor.view.uses
org.eclipse.zest.layouts,
eu.etaxonomy.taxeditor.cdmlib,
org.eclipse.ui.ide
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.core.databinding.beans,
org.eclipse.core.databinding.observable.list,
org.eclipse.zest.core.viewers,
org.eclipse.zest.layouts,
org.osgi.framework
-Bundle-ClassPath: .,
- activation-1.1.jar,
- antlr-2.7.6.jar,
- aopalliance-1.0.jar,
- asm-attrs.jar,
- asm.jar,
- aspectjrt-1.6.3.jar,
- aspectjweaver-1.6.3.jar,
- avalon-framework-4.2.0.jar,
- batik-all-1.7.jar,
- c3p0-0.9.1.jar,
- cdmlib-commons-3.0.7-SNAPSHOT.jar,
- cdmlib-ext-3.0.7-SNAPSHOT.jar,
- cdmlib-io-3.0.7-SNAPSHOT.jar,
- cdmlib-model-3.0.7-SNAPSHOT.jar,
- cdmlib-persistence-3.0.7-SNAPSHOT.jar,
- cdmlib-print-3.0.7-SNAPSHOT.jar,
- cdmlib-remote-3.0.7-SNAPSHOT.jar,
- cglib-2.1.3.jar,
- commons-beanutils-1.7.0.jar,
- commons-collections-3.2.jar,
- commons-dbcp-1.2.2.jar,
- commons-io-1.3.1.jar,
- commons-logging-1.0.4.jar,
- commons-pool-1.3.jar,
- dom4j-1.6.1.jar,
- dozer-5.3.0-sources.jar,
- dozer-5.3.0.jar,
- ehcache-1.2.3.jar,
- ejb3-persistence.jar,
- ezmorph-1.0.4.jar,
- fop.jar,
- google-api-translate-java-0.92.jar,
- hibernate-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-commons-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-core-3.4.0-SNAPSHOT.jar,
- hibernate-envers-3.4.0-SNAPSHOT.jar,
- hibernate-search-3.1.0.GA.jar,
- hibernate-tools-3.2.0.ga.jar,
- hibernate-validator-4.0.0.CR1.jar,
- hsqldb.jar,
- httpclient-4.0.1.jar,
- httpcore-4.0.1.jar,
- javassist.jar,
- jaxb-api-2.1.6.jar,
- jaxb-impl-2.1.6.jar,
- jaxen-1.1.2.jar,
- jdbc-1.2.jar,
- jdbc2_0-stdext.jar,
- jdom.jar,
- joda-time-1.5.jar,
- joda-time-hibernate-1.0.jar,
- json-lib-2.2.3-jdk15.jar,
- jsr250-api-1.0.jar,
- jta.jar,
- jtds-1.2.2.jar,
- junit-4.4.jar,
- junit-4.8.1-sources.jar,
- junit-4.8.1.jar,
- log4j-1.2.14.jar,
- lsid-client-1.1.2.jar,
- lsid-server-1.1.2.jar,
- lucene-core-2.4.0.jar,
- lucene-spellchecker-2.4.0.jar,
- mail-1.4.jar,
- msbase-2000.3.jar,
- mssqlserver-2000.3.jar,
- msutil-2000.3.jar,
- mysql-connector-java-5.0.5.jar,
- odfdom-0.8.jar,
- opencsv-1.8.jar,
- org.springframework.aop-3.0.4.RELEASE-sources.jar,
- org.springframework.asm-3.0.4.RELEASE-sources.jar,
- org.springframework.aspects-3.0.4.RELEASE-sources.jar,
- org.springframework.beans-3.0.4.RELEASE-sources.jar,
- org.springframework.context-3.0.4.RELEASE-sources.jar,
- org.springframework.context.support-3.0.4.RELEASE-sources.jar,
- org.springframework.core-3.0.4.RELEASE-sources.jar,
- org.springframework.expression-3.0.4.RELEASE-sources.jar,
- org.springframework.jdbc-3.0.4.RELEASE-sources.jar,
- org.springframework.orm-3.0.4.RELEASE-sources.jar,
- org.springframework.oxm-3.0.4.RELEASE-sources.jar,
- org.springframework.transaction-3.0.4.RELEASE-sources.jar,
- org.springframework.web-3.0.4.RELEASE-sources.jar,
- org.springframework.web.servlet-3.0.4.RELEASE-sources.jar,
- poi-3.1-FINAL.jar,
- postgresql-8.2-504.jdbc4.jar,
- saxon9he.jar,
- serializer-2.7.0.jar,
- servlet-api-2.5.jar,
- spring-modules-cache-0.7.jar,
- spring-modules-lucene-0.8a.jar,
- wsdl4j-1.6.1.jar,
- xalan-2.7.0.jar,
- xercesImpl-2.7.1.jar,
- xercesImpl.jar,
- xml-apis-1.3.04.jar,
- xml-apis-ext-1.3.04.jar,
- xml-apis.jar,
- xml-resolver-1.2.jar,
- xmlgraphics-commons-1.3.1.jar,
- xom-1.0.jar,
- xsltc.jar,
- xstream-1.3.1.jar,
- yjp-controller-api-redist-8.0.1.jar,
- ant-antlr.jar,
- ant-apache-bcel.jar,
- ant-apache-bsf.jar,
- ant-apache-log4j.jar,
- ant-apache-oro.jar,
- ant-apache-regexp.jar,
- ant-apache-resolver.jar,
- ant-commons-logging.jar,
- ant-commons-net.jar,
- ant-jai.jar,
- ant-javamail.jar,
- ant-jdepend.jar,
- ant-jmf.jar,
- ant-jsch.jar,
- ant-junit.jar,
- ant-launcher.jar,
- ant-netrexx.jar,
- ant-nodeps.jar,
- ant-starteam.jar,
- ant-stylebook.jar,
- ant-swing.jar,
- ant-trax.jar,
- ant-weblogic.jar,
- ant.jar,
- runtime_registry_compatibility.jar,
- jdi.jar,
- jdimodel.jar,
- pdebuild.jar,
- compatibility.jar,
- junit.jar
--- /dev/null
+CreateDerivateContextMenu_ADD=Add...
+CreateDerivateContextMenu_DNA_SAMPLE=DNA Sample
+CreateDerivateContextMenu_MEDIA=Media...
+CreateDerivateContextMenu_MEDIA_EXISTING=Use existing media item
+CreateDerivateContextMenu_MEDIA_SPECIMEN=Media item
+CreateDerivateContextMenu_NO_CHILD_DERIVATE=No child derivatives
+CreateDerivateContextMenu_SEQUENCE=Consensus Sequence
+CreateDerivateContextMenu_SINGLE_READ=Single Read
+CreateDerivateContextMenu_SPECIMEN=Specimen
+CreateDerivateContextMenu_TISSUE_SAMPLE=Tissue Sample
+
+SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE=Remove from this Sequence
+SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE=Reuse for other Sequence
+SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE=Reuse SingleRead here
+
+DerivateView_DERIVATIVE_EDITOR=Derivative Editor
+DerivateView_SAVING_HIERARCHY=Saving hierarchy
+DerivateView_UNSAVED_CHANGES=View has unsaved changes
+DerivateView_YOU_NEED_TO_SAVE=You need to save before performing this action
+
+DeleteDerivateOperation_AND_CHILDREN= and its children
+DeleteDerivateOperation_CONFIRM=Confirm Deletion
+DeleteDerivateOperation_DELETE_FAILED=Deletion failed
+DeleteDerivateOperation_REALLY_DELETE=Do you really want to delete the selected element
+
+DerivateDropListener_MOVE_TO=Moving "%s" to "%s"
+
+DerivateViewEditorInput_FAIL_INIT=Failed initializing editor
+DerivateViewEditorInput_NO_ROOT=No root element found\!
+
+MoveDerivateOperation_MOVE_NOT_POSSIBLE=Moving derivatives not possible\!
+MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE=Moving "%s" to "%s" is not possible\!
+
+OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR=Could not open Derivative Editor
+OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN=Failed to open Editor
+OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED=The derivative hierarchy is corrupted\!
+OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND=No Derivatives found
+
+DeleteTaxonBaseHandler_CONFIRM_DELETION=Confirm Deletion
+DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT=Element has to be Synonym, Misapplication or Concept
+DeleteTaxonBaseHandler_REALLY_DELETE_TAXON=Are you sure you want to delete the selected taxon?
--- /dev/null
+CreateDerivateContextMenu_ADD=Hinzufügen...
+CreateDerivateContextMenu_DNA_SAMPLE=DNA Probe
+CreateDerivateContextMenu_MEDIA=Media...
+CreateDerivateContextMenu_MEDIA_EXISTING=Vorhandendes Medienobjekt verwenden
+CreateDerivateContextMenu_MEDIA_SPECIMEN=Medienobjekt
+CreateDerivateContextMenu_NO_CHILD_DERIVATE=Keine Kind-Derivate
+CreateDerivateContextMenu_SEQUENCE=Konsensussequenz
+CreateDerivateContextMenu_SINGLE_READ=Single Read
+CreateDerivateContextMenu_SPECIMEN=Beleg
+CreateDerivateContextMenu_TISSUE_SAMPLE=Gewebeprobe
+
+SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE=Von Sequenz entfernen
+SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE=Für andere Sequenz verwenden
+SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE=SingleRead hier verwenden
+
+DerivateView_DERIVATIVE_EDITOR=Derivat-Editor
+DerivateView_SAVING_HIERARCHY=Speichere Hierarchie
+DerivateView_UNSAVED_CHANGES=Ungepeicherte Änderungen
+DerivateView_YOU_NEED_TO_SAVE=Sie müssen speichern, um diese Aktion auszuführen
+
+DeleteDerivateOperation_CONFIRM=Löschen bestätigen
+DeleteDerivateOperation_DELETE_FAILED=Löschen fehlgeschlagen
+DeleteDerivateOperation_REALLY_DELETE=Wollen Sie wirklich das ausgewählte Element löschen
+DeleteDerivateOperation_AND_CHILDREN= (mit Kind-Elementen)
+
+DerivateDropListener_MOVE_TO=Verschiebe "%s" nach "%s"
+
+DerivateViewEditorInput_FAIL_INIT=Initialisierung des Editor fehlgeschlagen
+DerivateViewEditorInput_NO_ROOT=Kein Root-Element gefunden\!
+
+MoveDerivateOperation_MOVE_NOT_POSSIBLE=Verschieben von Derivaten nicht möglich\!
+MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE=Verschieben von "%s" nach "%s" nicht möglich\!
+
+OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR=Konnte Derivat-Editor nicht öffnen
+OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN=Öffnen des Editors fehlgeschlagen
+OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED=Die Derivathierarchie ist korrumpiert\!
+OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND=Keine Derivate gefunden
+
+DeleteTaxonBaseHandler_CONFIRM_DELETION=Löschen bestätigen
+DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT=Element muss Synonym, Misapplication oder Konzept sein
+DeleteTaxonBaseHandler_REALLY_DELETE_TAXON=Wollen Sie wirklich das ausgewählte Taxon löschen?
command.name.24 = New Name\r
command.name.25 = New Team\r
command.name.26 = New Person\r
-command.name.27 = New Specimen\r
category.name.5 = -- Polytomous Keys\r
command.name.28 = New Child Node\r
command.name.29 = New Sibling Node\r
command.tooltip = Show Only Individuals Associations\r
command.label.55 = Open Associated Specimens\r
command.name.41 = Show Only Individual Associations\r
-command.name.42 = Open Taxon Editor\r
+command.name.42 = Open Taxon Editor for taxon\r
command.name.43 = Create Field Unit\r
command.name.44 = Deep Delete\r
command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon\r
Bundle-Name = Editor Bundle\r
command.name.48 = delete\r
command.name.49 = delete\r
-command.name.50 = delete
\ No newline at end of file
+command.name.50 = delete\r
+command.name.51 = delete
+\r
+editor.name.DERIVATIVE_EDITOR = Derivative Editor\r
+command.label.DERIVATIVE_EDITOR = Derivative Editor\r
+command.label.LINK_WITH_TAXON_SELECTION = Link with taxon selection\r
+command.label.UNLINK_FROM_TAXON_SELECTION = Unlink from taxon selection\r
+command.label.REUSE_SINGLE_READ_HERE = Reuse single read here\r
+command.label.REUSE_SINGLE_READ_FOR_OTHER_SEQUENCE = Reuse for other sequence\r
+command.label.REMOVE_SINGLE_READ_FROM_THIS_SEQUENCE = Remove from this sequence\r
+command.label.LINK_WITH_TAXON_SELECTIO = Link with Taxon Selection\r
+command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE = Open Taxon Editor for taxonnode\r
+command.name.OPEN_DERIVATIVE_EDITOR = Open Derivative Editor\r
+command.name.LINK_WITH_TAXON_SELECTION = Link with taxon selection\r
+command.name.COPY_SINGLE_READ_TO_CLIPBOARD = Copy SingleRead to clipboard\r
+command.name.REUSE_SINGLE_READ = Reuse SingleRead\r
+command.name.REMOVE_SINGLE_READ = Remove SingleRead from sequence\r
+command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = Toggle link with taxon selection
\ No newline at end of file
command.name.24 = Neuer Name
command.name.25 = Neues Team
command.name.26 = Neue Person
-command.name.27 = Neuer Beleg
category.name.5 = -- Polytomer Bestimmungsschl\u00fcssel
command.name.28 = Neue Kinderknoten
command.name.29 = Neuer Geschwisterknoten
command.name.33 = \u00d6ffne verbundenes Konzept
category.name.7 = -- Gruppe
command.name.34 = Bearbeite CDM Rechte
-command.name.35 = \u00d6ffne Derivat-Editor
+command.name.35 = \u00d6ffne Specimen-Editor
scheme.description = Die Standard Tastenkombinationsschema f\u00fcr den Taxonomischen Editor
scheme.name = Taxonomic Editor Standard Tastenkombinationen
editor.name.6 = Specimen Import Editor
command.name.43 = Neue Field Unit
command.name.44 = L\u00f6schen (mit Kindern)
command.name.46 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
-command.label.56 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
\ No newline at end of file
+command.label.56 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
+markerContentGenerator.name = Validation Problems Marker Generator
+command.name.45 = L\u00f6schen
+command.name.47 = L\u00f6schen
+commandParameter.name = taxonUUID
+Bundle-Name = Editor Bundle
+command.name.48 = L\u00f6schen
+command.name.49 = L\u00f6schen
+command.name.50 = L\u00f6schen
+command.name.51 = L\u00f6schen
+
+editor.name.DERIVATIVE_EDITOR = Specimen-Editor
+command.label.DERIVATIVE_EDITOR = Specimen-Editor
+command.label.LINK_WITH_TAXON_SELECTION = Verknüpfe mit Taxonauswahl
+command.label.UNLINK_FROM_TAXON_SELECTION = Verknüpfung mit Taxonauswahl aufheben
+command.label.REUSE_SINGLE_READ_HERE = Single-Read hier wiederverwenden
+command.label.REUSE_SINGLE_READ_FOR_OTHER_SEQUENCE = Für ander Sequenz wiederverwenden
+command.label.REMOVE_SINGLE_READ_FROM_THIS_SEQUENCE = Von dieser Sequenz entfernen
+command.label.LINK_WITH_TAXON_SELECTIO = Verknüpfe mit Taxonauswahl
+command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE = Öffne Namenseditor für Taxonknoten
+command.name.OPEN_DERIVATIVE_EDITOR = Öffne Specimen-Editor
+command.name.LINK_WITH_TAXON_SELECTION = Verknüpfe mit Taxonauswahl
+command.name.COPY_SINGLE_READ_TO_CLIPBOARD = Kopiere Single-Read in die Zwischenablage
+command.name.REUSE_SINGLE_READ = Single-Read wiederverwenden
+command.name.REMOVE_SINGLE_READ = Entferne Single-Read von Sequenz
+command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = De-/Aktiviere Verknüpfung mit Taxonauswahl
\ No newline at end of file
+++ /dev/null
-#Properties file for taxeditor-editor\r
-Bundle-Vendor.0 = EDIT\r
-Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle\r
-command.name.17 = Set Basionym\r
-command.name.18 = Remove Basionym\r
-editor.name = Multipage Taxon Editor\r
-editor.name.0 = Taxon Name Editor\r
-editor.name.1 = Key\r
-editor.name.2 = Polytomous Key Graph Editor\r
-editor.name.3 = Polytomous Key List Editor\r
-editor.name.4 = Cdm Authority Editor\r
-editor.name.5 = Derivate View\r
-view.name = Factual Data\r
-view.name.0 = Uses\r
-view.name.1 = Media\r
-view.name.2 = Concept Relations\r
-view.name.3 = Concept Graph\r
-category.name = Taxonomic Editor\r
-command.label = Reference\r
-command.label.0 = Name\r
-command.label.1 = Team\r
-command.label.2 = Person\r
-command.label.3 = Specimen\r
-command.label.4 = Factual Data\r
-command.label.5 = Media\r
-command.label.6 = Concept\r
-command.label.7 = Concept Graph\r
-command.label.8 = Open Parent\r
-menu.label = New\r
-command.label.9 = Heterotypic Synonym\r
-command.label.10 = Homotypic Synonym\r
-command.label.11 = Synonym In Homotypical Group\r
-menu.label.0 = Change To\r
-command.label.12 = Accepted Taxon\r
-command.label.13 = Synonym\r
-command.label.14 = Misapplication\r
-command.label.15 = Delete\r
-command.label.16 = Delete All Empty Names\r
-command.label.17 = Swap Synonym With Accepted\r
-command.label.18 = Show Details\r
-command.label.19 = Save\r
-command.label.20 = New Node\r
-command.label.21 = Delete\r
-command.label.22 = Apply Layout\r
-command.label.23 = New Key Number\r
-command.label.24 = New Alternative\r
-command.label.25 = Refresh Nodes\r
-command.label.26 = Delete\r
-command.label.27 = New Factual Data\r
-menu.label.1 = New\r
-command.label.28 = Move Description to Taxon\r
-command.label.29 = Move Elements to Taxon\r
-command.label.30 = Delete\r
-command.label.31 = Save\r
-menu.label.2 = New Derivate\r
-command.label.32 = New Use\r
-command.label.33 = New Use Summary\r
-command.label.34 = New Use Record\r
-command.label.35 = Delete\r
-command.label.36 = Save\r
-command.label.37 = New Image Gallery\r
-command.label.38 = New Image\r
-command.label.39 = Move Image Up In List\r
-command.label.40 = Move Image Down In List\r
-command.label.41 = Delete\r
-command.label.42 = Save\r
-menu.label.3 = New\r
-command.label.43 = Open Related Concept\r
-command.label.44 = Delete\r
-command.label.45 = Edit Authorities\r
-extension.name = Name Commands\r
-category.name.0 = -- Name Editor\r
-command.name = Open Parent\r
-command.name.0 = Create Homotypic Synonym\r
-command.name.1 = Create Heterotypic Synonym\r
-command.name.2 = Create Synonym In Homotypical Group\r
-command.name.3 = Change To Synonym\r
-command.name.4 = Change To Accepted Taxon\r
-command.name.5 = Change To Misapplication\r
-command.name.6 = Swap Synonym With Accepted\r
-command.name.7 = Set Basionym / Original Combination\r
-command.name.8 = Remove Basionym / Original Combination\r
-command.name.9 = Delete All Empty Names\r
-category.name.1 = -- Factual\r
-command.name.10 = Create Description Element\r
-command.name.11 = New Description\r
-command.name.12 = Move Description Elements to Taxon\r
-command.name.13 = Move Description to Taxon\r
-category.name.2 = -- New Uses\r
-command.name.14 = New Use\r
-command.name.15 = New Use Summary\r
-command.name.16 = New Use Record\r
-category.name.3 = -- Media\r
-command.name.19 = Move Image Down In List\r
-command.name.20 = New Image Gallery\r
-command.name.21 = New Image\r
-command.name.22 = Move Image Up In List\r
-category.name.4 = -- New Entity\r
-command.name.23 = New Reference\r
-command.name.24 = New Name\r
-command.name.25 = New Team\r
-command.name.26 = New Person\r
-command.name.27 = New Specimen\r
-category.name.5 = -- Polytomous Keys\r
-command.name.28 = New Child Node\r
-command.name.29 = New Sibling Node\r
-command.name.30 = Refresh Node Numbering\r
-command.name.31 = Apply Layout\r
-category.name.6 = -- Concept Relations\r
-command.name.32 = Create Concept Relation\r
-command.name.33 = Open Related Concept\r
-category.name.7 = -- Group\r
-command.name.34 = Edit CDM Authorities\r
-scheme.description = The default key binding scheme for the Taxonomic Editor\r
-scheme.name = Taxonomic Editor Default Key Bindingseditor.name.6 = Specimen Import Editor\r
-editor.name.7 = Gbif Import Editor\r
-editor.name.8 = Checklist Editor\r
-view.name.4 = Specimen Import\r
-view.name.5 = GBIF Specimen Import\r
-command.label.46 = Name\r
-command.label.47 = Reference\r
-command.label.48 = Datasource\r
-command.label.49 = Misapplication\r
-command.label.50 = Use Existing Image\r
-command.name.36 = Create Misapplication\r
-command.name.37 = Use Existing Image\r
-command.name.38 = Open Checklist Editor\r
-command.name.39 = New Datasource\r
-wizard.name = Specimen Search/Import\r
-wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.\r
-command.name.40 = Validation\r
-view.name.6 = Validation\r
-marker.field.0 = Object Type\r
-marker.field.1 = Object\r
-marker.field.2 = Attribute\r
-marker.field.3 = Problematic Value\r
-marker.field.4 = Problem description\r
-marker.field.5 = Validator\r
-marker.field.6 = Entity Class\r
-marker.field.7 = Entity Id
\ No newline at end of file
plugin.xml,\
icons/,\
p2.inf,\
- OSGI-INF/l10n/plugin.properties,\
- OSGI-INF/l10n/plugin_de.properties
+ OSGI-INF/
id="eu.etaxonomy.taxeditor.editor.group.authority"
name="%editor.name.4">
</editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
- default="false"
- icon="icons/derivate_view-16x16-32.png"
- id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
- name="%editor.name.5">
- </editor>
<editor
class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"
default="false"
id="eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"
name="%editor.name.8">
</editor>
+ <editor
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
+ default="false"
+ icon="icons/derivate_view-16x16-32.png"
+ id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
+ name="%editor.name.DERIVATIVE_EDITOR">
+ </editor>
</extension>
<extension
point="org.eclipse.ui.views">
commandId="eu.etaxonomy.taxeditor.editor.command.new.name"
label="%command.label.46"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.editor.command.new.reference"
label="%command.label.47"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.editor.command.new.team"
label="%command.label.1"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.editor.command.new.person"
label="%command.label.2"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.navigation.menu.new.separator2"
visible="true">
</separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.specimen"
- label="%command.label.3"
- style="push">
- </command>
<separator
name="eu.etaxonomy.navigation.menu.new.separator3"
visible="true">
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.editor.view.descriptive">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.views.showView"
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.editor.view.media">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.views.showView"
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.editor.view.concept">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.views.showView"
value="eu.etaxonomy.taxeditor.editor.view.concept.graph">
</parameter>
<visibleWhen
- checkEnabled="false">
+ checkEnabled="true">
+ <and>
+ <reference
+ definitionId="isShowExperimentalFeatures">
+ </reference>
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </and>
+ </visibleWhen>
+ </command>
+ <separator
+ name="eu.etaxonomy.taxeditor.store.separator_derivative_start"
+ visible="true">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditorFromMenu"
+ label="%command.label.DERIVATIVE_EDITOR"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </command>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator1"
+ visible="true">
+ </separator>
+ </menuContribution>
+ <menuContribution
+ locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.store.showViewMenu.internal">
+ <separator
+ name="eu.etaxonomy.taxeditor.store.showViewMenu.validation.separator"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.views.showView"
+ label="%command.name.40"
+ style="push">
+ <parameter
+ name="org.eclipse.ui.views.showView.viewId"
+ value="eu.etaxonomy.taxeditor.editor.view.validation.problems">
+ </parameter>
+ <visibleWhen
+ checkEnabled="true">
<reference
- definitionId="isShowExperimentalFeatures">
+ definitionId="isCdmStoreConnected">
</reference>
</visibleWhen>
</command>
<reference
definitionId="isMisapplication">
</reference>
+ <reference
+ definitionId="isHomotypicSynonymOfAcceptedTaxon">
+ </reference>
</or>
</not>
</visibleWhen>
label="%command.label.27"
style="push">
</command>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator3"
- visible="true">
- </separator>
<menu
label="%menu.label.1">
<dynamic
</visibleWhen>
</menu>
<separator
- name="taxeditor-editor.separator1"
+ name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator3"
visible="true">
</separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
- label="%command.label.51"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <with
- variable="selection">
- <count
- value="+">
- </count>
- </with>
- <reference
- definitionId="isIndividualsAssociation">
- </reference>
- </and>
- </visibleWhen>
- </command>
<command
commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon"
label="%command.label.28"
</or>
</visibleWhen>
</command>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator1">
+ </separator>
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.editor.descriptive.cdmViewerContextMenu">
+ </dynamic>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator1">
+ </separator>
<separator
name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterNew"
visible="true">
commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.delete"
label="%command.label.30"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <count
+ value="+">
+ </count>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterDelete"
</menuContribution>
<menuContribution
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator4"
+ visible="true">
+ </separator>
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.editor.derivativeEditor.CdmViewerContextMenu">
+ </dynamic>
+ <dynamic
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu.DerivateViewContextMenu"
+ id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu">
+ </dynamic>
<command
- commandId="eu.etaxonomy.taxeditor.editor.derivate.delete"
- label="%command.label.52"
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection"
+ label="%command.label.LINK_WITH_TAXON_SELECTION"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <not>
+ <reference
+ definitionId="isDerivativeEditorLinkedToTaxonSelection">
+ </reference>
+ </not>
+ </visibleWhen>
</command>
<command
- commandId="eu.etaxonomy.taxeditor.editor.derivate.createFieldUnit"
- label="%command.label.53"
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection"
+ label="%command.label.UNLINK_FROM_TAXON_SELECTION"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isDerivativeEditorLinkedToTaxonSelection">
+ </reference>
+ </visibleWhen>
+ </command>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator3"
+ visible="true">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.reuseSingleRead"
+ id="eu.etaxonomy.taxeditor.editor.derivative.reuseSingleReadMenuItem"
+ label="%command.label.REUSE_SINGLE_READ_HERE"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isSingleReadReusableHere">
+ </reference>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard"
+ label="%command.label.REUSE_SINGLE_READ_FOR_OTHER_SEQUENCE"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isSingleRead">
+ </reference>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence"
+ label="%command.label.REMOVE_SINGLE_READ_FROM_THIS_SEQUENCE"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isSingleReadReused">
+ </reference>
+ </visibleWhen>
+ </command>
+ <separator
+ name="eu.etaxonomy.taxeditor.editor.separator7"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.delete"
+ label="%command.label.52"
style="push">
</command>
<command
label="%command.label.54"
style="push">
</command>
- <dynamic
- class="eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu.DerivateViewContextMenu"
- id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu">
- </dynamic>
</menuContribution>
<menuContribution
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor">
</menuContribution>
<menuContribution
allPopups="false"
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup?after=taxeditor-navigation.separator2">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
- label="%command.label.55"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- <reference
- definitionId="isTaxonNode">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.editor.separator1"
- visible="true">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?after=org.eclipse.ui.views.showView.supplemental">
- <separator
- name="eu.etaxonomy.taxeditor.store.showViewMenu.validation.separator"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="%command.name.40"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.editor.view.validation.problems">
- </parameter>
- </command>
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=eu.etaxonomy.taxeditor.navigation.search.toolbar">
+ <toolbar
+ id="eu.etaxonomy.taxeditor.editor.derivativeViewToolbar">
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.derivative.listenToSelectionChange"
+ icon="icons/synced.gif"
+ label="%command.label.LINK_WITH_TAXON_SELECTIO"
+ style="toggle">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activePartId">
+ <equals
+ value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
+ </equals>
+ </with>
+ </visibleWhen>
+ </command>
+ </toolbar>
</menuContribution>
</extension>
<extension
</handler>
<handler
class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
- commandId="eu.etaxonomy.taxeditor.editor.view.derivate.command.delete">
+ commandId="org.eclipse.ui.edit.delete">
<activeWhen>
<with
variable="activePartId">
</activeWhen>
</handler>
<handler
- class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivateEditorForTaxonHandler"
- commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView">
+ class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
+ commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.RemotingCreateChildPolytomousKeyNodeHandler"
+ commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.child">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.RemotingCreateSiblingPolytomousKeyNodeHandler"
+ commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
+ commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView">
<activeWhen>
<with
variable="activePartId">
<equals
- value="eu.etaxonomy.taxeditor.navigation.navigator">
+ value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
</equals>
</with>
</activeWhen>
</handler>
<handler
- class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
- commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement"
+ commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="eu.etaxonomy.taxeditor.editor.view.descriptive">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForTaxonNode"
+ commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor">
+ <activeWhen>
+ <with
+ variable="selection">
+ <reference
+ definitionId="isTaxonNode">
+ </reference>
+ </with>
+ </activeWhen>
</handler>
</extension>
<extension
id="eu.etaxonomy.taxeditor.editor.command.new.person"
name="%command.name.26">
</command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.create.NewSpecimenHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.specimen"
- name="%command.name.27">
- </command>
<category
id="eu.etaxonomy.taxeditor.editor.key.category"
name="%category.name.5">
id="eu.etaxonomy.taxeditor.editor.view.concept.command.open"
name="%command.name.33">
</command>
+ <command
+ categoryId="eu.etaxonomy.taxeditor.editor.view.concept.category"
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.DeleteConceptRelationHandler"
+ id="eu.etaxonomy.taxeditor.editor.view.concept.command.delete"
+ name="%command.name.51">
+ </command>
<category
id="eu.etaxonomy.taxeditor.bulkeditor.group.category"
name="%category.name.7">
defaultHandler="eu.etaxonomy.taxeditor.editor.group.authority.handler.EditCdmAuthoritiesHandler"
id="eu.etaxonomy.taxeditor.group.cdmauthorities.edit"
name="%command.name.34">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
- id="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
- name="%command.name.35">
</command>
<command
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
name="%command.name.41">
</command>
<command
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenTaxonEditorHandler"
- id="eu.etaxonomy.taxeditor.editor.openTaxonEditor"
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonHandler"
+ id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"
name="%command.name.42">
<commandParameter
- id="eu.etaxonomy.taxeditor.editor.taxonParameter"
+ id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon.uuid"
name="%commandParameter.name"
optional="false"
- typeId="eu.etaxonomy.taxeditor.editor.taxonParameterType">
+ typeId="eu.etaxonomy.taxeditor.uuidParameterType">
</commandParameter>
</command>
- <commandParameterType
- converter="eu.etaxonomy.taxeditor.editor.handler.TaxonParameterConverter"
- id="eu.etaxonomy.taxeditor.editor.taxonParameterType"
- type="eu.etaxonomy.cdm.model.taxon.TaxonBase">
- </commandParameterType>
<command
- defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler"
- id="eu.etaxonomy.taxeditor.editor.derivate.createFieldUnit"
- name="%command.name.43">
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonNodeHandler"
+ id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode"
+ name="%command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE">
+ <commandParameter
+ id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode.uuid"
+ name="taxon node uuid"
+ optional="true"
+ typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+ </commandParameter>
</command>
<command
defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements"
name="%command.name.12">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
+ id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor"
+ name="%command.name.OPEN_DERIVATIVE_EDITOR">
+ <commandParameter
+ id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor.uuid"
+ name="Specimen Uuids"
+ optional="true"
+ typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+ </commandParameter>
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
+ id="eu.etaxonomy.taxeditor.editor.openSpecimenEditorFromMenu"
+ name="%command.name.OPEN_DERIVATIVE_EDITOR">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.ListenToSelectionChangeHandler"
+ id="eu.etaxonomy.taxeditor.editor.derivative.listenToSelectionChange"
+ name="%command.name.LINK_WITH_TAXON_SELECTION">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler"
+ id="eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard"
+ name="%command.name.COPY_SINGLE_READ_TO_CLIPBOARD">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler"
+ id="eu.etaxonomy.taxeditor.editor.derivative.reuseSingleRead"
+ name="%command.name.REUSE_SINGLE_READ">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler"
+ id="eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence"
+ name="%command.name.REMOVE_SINGLE_READ">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.ToggleLinkWithTaxonSelectionHandler"
+ id="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection"
+ name="%command.name.TOGGLE_LINK_WITH_TAXON_SELECTION">
+ </command>
</extension>
<extension
</test>
</with>
</definition>
+ <definition
+ id="isNotHomotypicSynonymOfAcceptedTaxon">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isHomotypicSynonymOfAcceptedTaxon">
+ </test>
+ </with>
+ </definition>
<definition
id="isSynonym">
<with
</test>
</with>
</definition>
+ <definition
+ id="isRemoting">
+ <test
+ property="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester.isRemoting">
+ </test>
+ </definition>
<definition
id="isSequence">
<with
</test>
</with>
</definition>
+ <definition
+ id="isSingleReadReusableHere">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester.isSingleReadReusableHere">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isSingleReadReused">
+ <with
+ variable="selection">
+ <test
+ property="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester.isSingleReadReused">
+ </test>
+ </with>
+ </definition>
+ <definition
+ id="isDerivativeEditorLinkedToTaxonSelection">
+ <with
+ variable="activeEditor">
+ <test
+ property="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester.isLinkedWithTaxonSelection">
+ </test>
+ </with>
+ </definition>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
class="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
id="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
namespace="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
- properties="isSequence,isSingleRead"
+ properties="isSequence,isSingleRead,isSingleReadReusableHere,isSingleReadReused"
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
+ <propertyTester
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester"
+ id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester"
+ namespace="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester"
+ properties="isLinkedWithTaxonSelection"
+ type="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
+ </propertyTester>
</extension>
<extension
point="org.eclipse.ui.bindings">
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-->
+ <extension
point="eu.etaxonomy.taxeditor.store.cdmViewer">
- <cdmViewer
- class="eu.etaxonomy.taxeditor.editor.EditorCdmViewer">
- </cdmViewer>
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode"
+ selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
+ viewerName="Name Editor">
+ </viewCommandMapping>
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"
+ selection="eu.etaxonomy.cdm.model.taxon.TaxonBase"
+ viewerName="Name Editor">
+ </viewCommandMapping>
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor"
+ selection="eu.etaxonomy.cdm.model.description.IndividualsAssociation"
+ viewerName="Derivative Editor">
+ </viewCommandMapping>
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor"
+ selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
+ viewerName="Derivative Editor">
+ </viewCommandMapping>
</extension>
</plugin>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>eclipse-plugin</packaging>
<name>Editor Bundle</name>
- <description />
+ <description></description>
<url>http://dev.e-taxonomy.eu/trac/wiki/TaxonomicEditorEditorBundle</url>
</project>
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2015 EDIT
-* 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.editor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.view.ICdmViewer;
-
-/**
- * @author pplitzner
- * @date Feb 23, 2015
- *
- */
-public class EditorCdmViewer implements ICdmViewer {
-
- private final Logger logger = Logger.getLogger(EditorCdmViewer.class);
-
- @Override
- public void show(Object input, Class<?> viewerClass) {
- try {
- if(viewerClass.equals(MultiPageTaxonEditor.class)){
- if(input instanceof TaxonBase){
- TaxonEditorInput editorInput = TaxonEditorInput.NewInstanceFromTaxonBase(((TaxonBase<?>) input).getUuid());
- EditorUtil.open(editorInput);
- }
- }
- else if(viewerClass.equals(DerivateView.class)){
- if(input instanceof SpecimenOrObservationBase){
- }
- }
- } catch (PartInitException e) {
- String errorMessage = "Could not open editor";
- logger.error(errorMessage, e);
- MessagingUtils.error(EditorCdmViewer.class, errorMessage, e);
- }
- }
-
- @Override
- public Map<Class<?>, String> getViewerClasses(Object input) {
- Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
- if(input instanceof TaxonBase){
- viewerNameMap.put(MultiPageTaxonEditor.class, "Taxon Editor");
- }
- return viewerNameMap;
- }
-
-}
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.ITreeNode;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.BioCaseEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor;
+//import eu.etaxonomy.taxeditor.store.view.dataimport.BioCaseEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.DataImportEditor;
+//import eu.etaxonomy.taxeditor.view.dataimport.DataImportEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.GbifImportEditor;
+//import eu.etaxonomy.taxeditor.view.dataimport.GbifImportEditorInput;
+//import eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
*/
private static IEditorPart open(final IEditorInput input,
final String editorId) throws PartInitException {
- return getActivePage().openEditor(input, editorId);
+ IEditorPart editor = getActivePage().openEditor(input, editorId);
+ if(input != null &&
+ editor.getEditorInput() != null &&
+ input != editor.getEditorInput() &&
+ input instanceof CdmEntitySessionInput) {
+ ((CdmEntitySessionInput)input).dispose();
+ }
+ return editor;
}
/**
* @param input a {@link DataImportEditorInput}
* @throws PartInitException
*/
- public static void open(DataImportEditorInput<?> input)
- throws PartInitException {
- if(input instanceof BioCaseEditorInput){
- open(input, SpecimenImportEditor.ID);
- }
- else if(input instanceof GbifImportEditorInput){
- open(input, GbifImportEditor.ID);
- }
- }
+// public static void open(DataImportEditorInput<?> input)
+// throws PartInitException {
+// if(input instanceof BioCaseEditorInput){
+// open(input, SpecimenImportEditor.ID);
+// }
+// else if(input instanceof GbifImportEditorInput){
+// open(input, GbifImportEditor.ID);
+// }
+// }
/**
* Taxon Editors may be opened by supplying a taxon node uuid. Session gets
open(input);
}
+// public static void openPolytomousKeyEditor(UUID polytomousKeyUuid, String name)
+// throws Exception {
+// PolytomousKeyEditorInput input = new PolytomousKeyEditorInput(polytomousKeyUuid, name);
+// open(input);
+// }
+
public static void openCdmAuthorities(UUID groupUuid)
throws Exception {
CdmAuthorityEditorInput input = CdmAuthorityEditorInput.NewInstance(groupUuid);
}
}
- /**
- * Iterates recursively over all originals having the given specimen as a derivate.
- * If a {@link FieldUnit} is found it is returned
- * @param specimen the start element for which the originals are iterated recursively
- * @return the FieldUnit if found, <code>null</code> otherwise
- */
- public static FieldUnit getFieldUnit(SpecimenOrObservationBase<?> specimen){
- SpecimenOrObservationBase<?> topMostDerivate = getTopMostDerivate(specimen);
- if(topMostDerivate instanceof FieldUnit) {
- return (FieldUnit) topMostDerivate;
- }
- return null;
- }
-
/**
* If the current selection is a single {@link TreeNode} it will be returned.
* @param selection the selection to check
openTaxonBase(((TaxonBase<?>) object).getUuid());
}
}
+
+ public static boolean closeObsoleteEditor(TaxonNode taxonNode, IWorkbenchPage activePage){
+ boolean result = true;
+ for (IEditorReference ref : activePage.getEditorReferences()) {
+ try {
+ String treeIndex = ((ITreeNode)taxonNode).treeIndex();
+
+
+ IEditorInput input = ref.getEditorInput();
+ if (input instanceof TaxonEditorInput) {
+ TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
+ //if node is a child of taxonNode then close the editor
+ if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
+ //if (taxonNode.equals(node)) {
+ result &= activePage.closeEditor(ref.getEditor(false), true);
+
+ }
+ }
+ } catch (PartInitException e) {
+ continue;
+ }
+ }
+ return result;
+ }
}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.editor;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author pplitzner
+ * @date 09.09.2015
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "OSGI-INF/l10n/messages"; //$NON-NLS-1$
+ public static String CreateDerivateContextMenu_ADD;
+ public static String CreateDerivateContextMenu_DNA_SAMPLE;
+ public static String CreateDerivateContextMenu_MEDIA;
+ public static String CreateDerivateContextMenu_MEDIA_EXISTING;
+ public static String CreateDerivateContextMenu_MEDIA_SPECIMEN;
+ public static String CreateDerivateContextMenu_NO_CHILD_DERIVATE;
+ public static String CreateDerivateContextMenu_SEQUENCE;
+ public static String CreateDerivateContextMenu_SINGLE_READ;
+ public static String CreateDerivateContextMenu_SPECIMEN;
+ public static String CreateDerivateContextMenu_TISSUE_SAMPLE;
+ public static String DeleteDerivateOperation_AND_CHILDREN;
+ public static String DeleteDerivateOperation_CONFIRM;
+ public static String DeleteDerivateOperation_DELETE_FAILED;
+ public static String DeleteDerivateOperation_REALLY_DELETE;
+ public static String DeleteTaxonBaseHandler_CONFIRM_DELETION;
+ public static String DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT;
+ public static String DeleteTaxonBaseHandler_REALLY_DELETE_TAXON;
+ public static String DerivateDropListener_MOVE_TO;
+ public static String DerivateView_DERIVATIVE_EDITOR;
+ public static String DerivateView_SAVING_HIERARCHY;
+ public static String DerivateView_UNSAVED_CHANGES;
+ public static String DerivateView_YOU_NEED_TO_SAVE;
+ public static String DerivateViewEditorInput_FAIL_INIT;
+ public static String DerivateViewEditorInput_NO_ROOT;
+ public static String MoveDerivateOperation_MOVE_NOT_POSSIBLE;
+ public static String MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE;
+ public static String OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR;
+ public static String OpenDerivateEditorForTaxonHandler_FAILED_TO_OPEN;
+ public static String OpenDerivateEditorForTaxonHandler_HIERARCHY_CORRUPTED;
+ public static String OpenDerivateEditorForTaxonHandler_NO_DERIVATIVES_FOUND;
+ public static String SingleReadSequenceContextMenu_REMOVE_FROM_SEQUENCE;
+ public static String SingleReadSequenceContextMenu_REUSE_FOR_SEQUENCE;
+ public static String SingleReadSequenceContextMenu_REUSE_SINGLE_READ_HERE;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
* @version 1.0
*/
public class MultiPageTaxonEditor extends FormEditor implements
- IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled,
- IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
-
- /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
- public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon";
-
- private boolean dirty;
-
- private ConversationHolder conversation;
- private IDataChangeBehavior dataChangeBehavior;
- private IUndoContext undoContext;
-
- private TaxonEditorInput input;
-
- /**
- * <p>
- * Constructor for MultiPageTaxonEditor.
- * </p>
- */
- public MultiPageTaxonEditor() {
- super();
- undoContext = new UndoContext();
- }
-
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- super.dispose();
- }
-
- /** {@inheritDoc} */
- @Override
- protected void addPages() {
- input = (TaxonEditorInput) getEditorInput();
- conversation = input.getConversationHolder();
- conversation.registerForDataStoreChanges(this);
-
- try {
- addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
- getEditorInput());
- // setPageText(Page.NAME.getIndex(), Page.NAME.getTitle());
-
- // TODO lazy create
- // addPage(Page.DESCRIPTIVE.getIndex(), new
- // TaxonDescriptionTreeEditor(this), getEditorInput());
- // setPageText(Page.DESCRIPTIVE.getIndex(),
- // Page.DESCRIPTIVE.getTitle());
-
- // EditorUtil.showPropertySheet();
-
- } catch (PartInitException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSave(IProgressMonitor monitor) {
- monitor.beginTask("Saving Editor", 4);
- try {
- if (!conversation.isBound()) {
- conversation.bind();
- }
- monitor.worked(1);
+IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled,
+IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
+
+ /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon";
+
+ private boolean dirty;
+
+ private ConversationHolder conversation;
+ private IDataChangeBehavior dataChangeBehavior;
+ private IUndoContext undoContext;
+
+ private TaxonEditorInput input;
+
+ /**
+ * <p>
+ * Constructor for MultiPageTaxonEditor.
+ * </p>
+ */
+ public MultiPageTaxonEditor() {
+ super();
+ undoContext = new UndoContext();
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ input.dispose();
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.close();
+ super.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void addPages() {
+ input = (TaxonEditorInput) getEditorInput();
+ conversation = input.getConversationHolder();
+ conversation.registerForDataStoreChanges(this);
+
+ try {
+ addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
+ getEditorInput());
+ // setPageText(Page.NAME.getIndex(), Page.NAME.getTitle());
+
+ // TODO lazy create
+ // addPage(Page.DESCRIPTIVE.getIndex(), new
+ // TaxonDescriptionTreeEditor(this), getEditorInput());
+ // setPageText(Page.DESCRIPTIVE.getIndex(),
+ // Page.DESCRIPTIVE.getTitle());
+
+ // EditorUtil.showPropertySheet();
+
+ } catch (PartInitException e) {
+ MessagingUtils.error(getClass(), e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ monitor.beginTask("Saving Editor", 4);
+ try {
+ if (!conversation.isBound()) {
+ conversation.bind();
+ }
+ monitor.worked(1);
for (IEditorPart editorPage : getPages()) {
if (editorPage instanceof TaxonNameEditor) {
monitor.worked(1);
}
- // commit the conversation and start a new transaction immediately
- conversation.commit(true);
- monitor.worked(1);
+ // commit the conversation and start a new transaction immediately
+
+ input.merge();
+ conversation.commit(true);
+ monitor.worked(1);
this.setDirty(false);
monitor.worked(1);
} finally {
monitor.done();
}
- }
-
- private void disableEditor(boolean isOnError) {
- for (IMultiPageTaxonEditorPage editorPage : getPages()) {
- if(isOnError){
- editorPage.setOnError();
- }else {
- editorPage.setDisabled();
- }
- }
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- setDirty(false);
- }
-
- private void setDirty(boolean dirty) {
- this.dirty = dirty;
- firePropertyChange(PROP_DIRTY);
- }
-
- @Override
+ }
+
+ private void disableEditor(boolean isOnError) {
+ for (IMultiPageTaxonEditorPage editorPage : getPages()) {
+ if(isOnError){
+ editorPage.setOnError();
+ }else {
+ editorPage.setDisabled();
+ }
+ }
+
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.close();
+ setDirty(false);
+ }
+
+ private void setDirty(boolean dirty) {
+ this.dirty = dirty;
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty()
+ */
+ /**
+ * <p>
+ * isDirty
+ * </p>
+ *
+ * @return a boolean.
+ */
+ @Override
public boolean isDirty() {
- return dirty;
- }
-
- /** {@inheritDoc} */
- @Override
- public void editorDirtyStateChanged() {
- dirty = true;
- super.editorDirtyStateChanged();
- }
-
- /**
- * {@inheritDoc}
- *
- * Checks whether nested editors are calling
- * <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken
- * place before passing property change along to
- * <code>super.handlePropertyChange(int propertyId)</code>.
- */
- @Override
+ return dirty;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void editorDirtyStateChanged() {
+ dirty = true;
+ super.editorDirtyStateChanged();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Checks whether nested editors are calling
+ * <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken
+ * place before passing property change along to
+ * <code>super.handlePropertyChange(int propertyId)</code>.
+ */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int)
+ */
+ @Override
protected void handlePropertyChange(int propertyId) {
- if (propertyId == PROP_DIRTY) {
- setDirty(true);
- }
- super.handlePropertyChange(propertyId);
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSaveAs() {
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
-
- if (!(input instanceof TaxonEditorInput)) {
+ if (propertyId == PROP_DIRTY) {
+ setDirty(true);
+ }
+ super.handlePropertyChange(propertyId);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void doSaveAs() {
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+
+ if (!(input instanceof TaxonEditorInput)) {
throw new PartInitException(
- "Invalid Input: Must be TaxonEditorInput");
+ "Invalid Input: Must be TaxonEditorInput");
+ }
+
+ this.input = (TaxonEditorInput) input;
+
+
+ // try {
+ // // Listen for name changes,
+ // // change tab for this taxon editor accordingly
+ // getTaxon().addPropertyChangeListener("name",
+ // new PropertyChangeListener() {
+ // public void propertyChange(PropertyChangeEvent e) {
+ // setPartName();
+ // }
+ // });
+ // } catch (NullPointerException e) {
+ // EditorUtil.warn(getClass(),
+ // "Caught an NPE while initing an editor. This is most " +
+ // "likely due to the unsuccesful attempt to restore the former " +
+ // "state of the application. We ignore this because the workbench " +
+ // "will simply be reset.");
+ // }
+ setPartName();
+
+ super.init(site, input);
+ }
+
+ /**
+ * Calls <code>MultiPageEditorPart.setPartName(String partName)</code> with
+ * text appropriate to the state of the taxon: any taxon that has been saved
+ * will by necessity have a name to display; a new taxon should display
+ * "New taxon" in the editor tab.
+ */
+ protected void setPartName() {
+
+ String partName = null;
+ TaxonNameBase<?, ?> name = getTaxon().getName();
+
+ if (name != null) {
+ partName = name.getTitleCache();
+ }
+
+ if (partName == null || partName.equals("")) {
+ partName = ("New taxon");
}
- this.input = (TaxonEditorInput) input;
-
- // try {
- // // Listen for name changes,
- // // change tab for this taxon editor accordingly
- // getTaxon().addPropertyChangeListener("name",
- // new PropertyChangeListener() {
- // public void propertyChange(PropertyChangeEvent e) {
- // setPartName();
- // }
- // });
- // } catch (NullPointerException e) {
- // EditorUtil.warn(getClass(),
- // "Caught an NPE while initing an editor. This is most " +
- // "likely due to the unsuccesful attempt to restore the former " +
- // "state of the application. We ignore this because the workbench " +
- // "will simply be reset.");
- // }
- setPartName();
-
- super.init(site, input);
- }
-
- /**
- * Calls <code>MultiPageEditorPart.setPartName(String partName)</code> with
- * text appropriate to the state of the taxon: any taxon that has been saved
- * will by necessity have a name to display; a new taxon should display
- * "New taxon" in the editor tab.
- */
- protected void setPartName() {
-
- String partName = null;
- TaxonNameBase<?, ?> name = getTaxon().getName();
-
- if (name != null) {
- partName = name.getTitleCache();
- }
-
- if (partName == null || partName.equals("")) {
- partName = ("New taxon");
- }
-
- setPartName(partName);
- }
+ setPartName(partName);
+ }
/**
* {@inheritDoc}
setPartName();
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
+ */
@Override
public void forceDirty() {
changed(null);
}
- /**
- * The accepted taxon that is the input for this editor
- *
- * @return the accepted taxon
- */
- public Taxon getTaxon() {
- return input.getTaxon();
- }
+ /**
+ * The accepted taxon that is the input for this editor
+ *
+ * @return the accepted taxon
+ */
+ public Taxon getTaxon() {
+ return input.getTaxon();
+ }
- @Override
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
+ * ()
+ */
+ /**
+ * <p>
+ * getConversationHolder
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ @Override
public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- public void setConversationHolder(ConversationHolder conversation) {
- this.conversation = conversation;
- }
-
- public IUndoContext getUndoContext() {
- return undoContext;
- }
-
- public void setUndoContext(IUndoContext undoContext) {
- this.undoContext = undoContext;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setFocus() {
- // logger.warn("Setting focus to editor");
- // bind the conversation
- getConversationHolder().bind();
- // pass focus to the active editor page
- getActiveEditor().setFocus();
- }
-
- /** {@inheritDoc} */
+ return conversation;
+ }
+
+ /**
+ * <p>
+ * setConversationHolder
+ * </p>
+ *
+ * @param conversation
+ * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ public void setConversationHolder(ConversationHolder conversation) {
+ this.conversation = conversation;
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>undoContext</code>.
+ * </p>
+ *
+ * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
+ * object.
+ */
+ public IUndoContext getUndoContext() {
+ return undoContext;
+ }
+
+ /**
+ * <p>
+ * Setter for the field <code>undoContext</code>.
+ * </p>
+ *
+ * @param undoContext
+ * a {@link org.eclipse.core.commands.operations.IUndoContext}
+ * object.
+ */
+ public void setUndoContext(IUndoContext undoContext) {
+ this.undoContext = undoContext;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setFocus() {
+ // logger.warn("Setting focus to editor");
+ // bind the conversation
+ getConversationHolder().bind();
+ input.bind();
+ // pass focus to the active editor page
+ getActiveEditor().setFocus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu
+ * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
+ */
+ /** {@inheritDoc} */
@Override
public void update(CdmDataChangeMap events) {
if (dataChangeBehavior == null) {
DataChangeBridge.handleDataChange(events, dataChangeBehavior);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation
+ * ()
+ */
/** {@inheritDoc} */
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
return false;
}
- /**
- * Returns an <code>IEditorPart</code> implementation by type
- *
- * @param page
- * the page type
- * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage}
- * object.
- */
- public IMultiPageTaxonEditorPage getPage(Page page) {
- for (IEditorPart editor : this.getPages()) {
- if (editor.getClass().equals(page.getClazz())) {
- return (IMultiPageTaxonEditorPage) editor;
- }
- }
- return null;
- }
-
- /**
- * Return a list of <code>AbstractTaxonEditor</code>s registered with this
- * <code>MultiPageTaxonEditor</code>.
- *
- * @return a {@link java.util.List} object.
- */
- public List<IMultiPageTaxonEditorPage> getPages() {
- ArrayList<IMultiPageTaxonEditorPage> editors = new ArrayList<IMultiPageTaxonEditorPage>();
- for (int i = 0; i < this.getPageCount(); i++) {
-
- editors.add((IMultiPageTaxonEditorPage) this.getEditor(i));
- }
- return editors;
- }
-
- /**
- * Refreshes a certain page of the MultipageTaxonEditor
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @return a boolean.
- */
- public boolean redraw(Page page) {
- return redraw(page, true);
- }
-
- /**
- * Refreshes a certain page of the MultipageTaxonEditor and sets focus to
- * that page
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @param focus
- * a boolean.
- * @return a boolean.
- */
- public boolean redraw(Page page, boolean focus) {
- IMultiPageTaxonEditorPage editorPage = getPage(page);
- return editorPage != null && editorPage.redraw(focus);
- }
-
- @Override
+ /**
+ * Returns an <code>IEditorPart</code> implementation by type
+ *
+ * @param page
+ * the page type
+ * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage}
+ * object.
+ */
+ public IMultiPageTaxonEditorPage getPage(Page page) {
+ for (IEditorPart editor : this.getPages()) {
+ if (editor.getClass().equals(page.getClazz())) {
+ return (IMultiPageTaxonEditorPage) editor;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return a list of <code>AbstractTaxonEditor</code>s registered with this
+ * <code>MultiPageTaxonEditor</code>.
+ *
+ * @return a {@link java.util.List} object.
+ */
+ public List<IMultiPageTaxonEditorPage> getPages() {
+ ArrayList<IMultiPageTaxonEditorPage> editors = new ArrayList<IMultiPageTaxonEditorPage>();
+ for (int i = 0; i < this.getPageCount(); i++) {
+
+ editors.add((IMultiPageTaxonEditorPage) this.getEditor(i));
+ }
+ return editors;
+ }
+
+ /**
+ * Refreshes a certain page of the MultipageTaxonEditor
+ *
+ * @param page
+ * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
+ * @return a boolean.
+ */
+ public boolean redraw(Page page) {
+ return redraw(page, true);
+ }
+
+ /**
+ * Refreshes a certain page of the MultipageTaxonEditor and sets focus to
+ * that page
+ *
+ * @param page
+ * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
+ * @param focus
+ * a boolean.
+ * @return a boolean.
+ */
+ public boolean redraw(Page page, boolean focus) {
+ IMultiPageTaxonEditorPage editorPage = getPage(page);
+ return editorPage != null && editorPage.redraw(focus);
+ }
+
+ /**
+ * <p>
+ * onComplete
+ * </p>
+ *
+ * @return a boolean.
+ */
+ @Override
public boolean onComplete() {
- return false;
- }
+ return false;
+ }
/**
* Reloads the data for this
}
}
- @Override
- public String toString() {
- return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput());
- }
-
- @Override
- public boolean permissionsSatisfied() {
- IEditorPart activeEditor = getActiveEditor();
- if(activeEditor != null && ISecuredEditor.class.isAssignableFrom(activeEditor.getClass())){
- return ((ISecuredEditor)activeEditor).permissionsSatisfied();
- }
- return true;
- }
-
- @Override
- public boolean canAttachMedia() {
- return true;
- }
+ @Override
+ public String toString() {
+ return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput());
+ }
+
+ @Override
+ public boolean permissionsSatisfied() {
+ IEditorPart activeEditor = getActiveEditor();
+ if(activeEditor != null && ISecuredEditor.class.isAssignableFrom(activeEditor.getClass())){
+ return ((ISecuredEditor)activeEditor).permissionsSatisfied();
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.model.IPartContentHasMedia#canAttachMedia()
+ */
+ @Override
+ public boolean canAttachMedia() {
+ return true;
+ }
+
}
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.editor;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
* @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 enum CdmType {
+ TAXON_NODE,
+ TAXON_BASE,
+ PARENT_TAXON_NODE
+ }
+ private TaxonEditorInput(UUID uuid, CdmType type) {
+ super(true);
+ this.conversation = CdmStore.createConversation();
+ 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 = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, null);
+ TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths());
- if(taxonNode == null){
- MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not of type TaxonNode but [null].");
- return null;
- }
+ if(taxonNode == null){
+ MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase.");
+ }
+ init(taxonNode);
+
+ }
- return new TaxonEditorInput(taxonNode, conversation);
+ private void initForTaxonBase(UUID taxonBaseUuid) {
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths());
+ 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.
*/
- 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 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 = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
+
+ initForTaxonNode(newTaxonNodeUuid);
}
- 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 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.");
+ }
}
/**
- * <p>NewEmptyInstance</p>
+ * <p>NewInstance</p>
*
- * @param parentNodeUuid a {@link java.util.UUID} object.
+ * @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 NewEmptyInstance(UUID parentNodeUuid){
- ConversationHolder conversation = CdmStore.createConversation();
+ public static TaxonEditorInput NewInstance(UUID taxonNodeUuid) throws Exception {
+ return new TaxonEditorInput(taxonNodeUuid, CdmType.TAXON_NODE);
- 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());
+ /**
+ * <p>NewInstanceFromTaxonBase</p>
+ *
+ * @param taxonBaseUuid a {@link java.util.UUID} object.
+ * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
+ */
+ public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){
+ return new TaxonEditorInput(taxonBaseUuid, CdmType.TAXON_BASE);
+ }
- // add the new taxon to the editors persistence context
- UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
- return new TaxonEditorInput(newTaxonNode, conversation);
+ /**
+ * <p>NewEmptyInstance</p>
+ *
+ * @param parentNodeUuid a {@link java.util.UUID} object.
+ * @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
+ */
+ public static TaxonEditorInput NewEmptyInstance(UUID parentNodeUuid){
+ return new TaxonEditorInput(parentNodeUuid, CdmType.PARENT_TAXON_NODE);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- /**
- * <p>exists</p>
- *
- * @return a boolean.
- */
- @Override
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ /**
+ * <p>exists</p>
+ *
+ * @return a boolean.
+ */
+ @Override
public boolean exists() {
- return taxonNode != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- /**
- * <p>getImageDescriptor</p>
- *
- * @return a {@link org.eclipse.jface.resource.ImageDescriptor} object.
- */
- @Override
+ return taxonNode != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ /**
+ * <p>getImageDescriptor</p>
+ *
+ * @return a {@link org.eclipse.jface.resource.ImageDescriptor} object.
+ */
+ @Override
public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- /**
- * <p>getName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ /**
+ * <p>getName</p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ @Override
public String getName() {
- if(getTaxon() == null){
- return null;
- }
- TaxonNameBase<?, ?> name = getTaxon().getName();
- if (name == null || name.getTitleCache() == null) {
- return "New taxon";
- } else {
- return name.getTitleCache();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- /**
- * <p>getPersistable</p>
- *
- * @return a {@link org.eclipse.ui.IPersistableElement} object.
- */
- @Override
+ if(getTaxon() == null){
+ return null;
+ }
+ TaxonNameBase<?, ?> name = getTaxon().getName();
+ if (name == null || name.getTitleCache() == null) {
+ return "New taxon";
+ } else {
+ return name.getTitleCache();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ /**
+ * <p>getPersistable</p>
+ *
+ * @return a {@link org.eclipse.ui.IPersistableElement} object.
+ */
+ @Override
public IPersistableElement getPersistable() {
-// if(CdmStore.isActive()){
-// TaxonNode test = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid());
-// boolean isPersistable = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid()) != null;
-// if (isPersistable) {
-// return this;
-// }
-// }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- /**
- * <p>getToolTipText</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ // if(CdmStore.isActive()){
+ // TaxonNode test = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid());
+ // boolean isPersistable = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid()) != null;
+ // if (isPersistable) {
+ // return this;
+ // }
+ // }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ /**
+ * <p>getToolTipText</p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ @Override
public String getToolTipText() {
- return getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- /** {@inheritDoc} */
- @Override
+ return getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ /** {@inheritDoc} */
+ @Override
public Object getAdapter(Class adapter) {
- if (adapter == Taxon.class) {
- return taxonNode.getTaxon();
- }
+ if (adapter == Taxon.class) {
+ return getTaxon();
+ }
- if (adapter == TaxonNode.class) {
- return taxonNode;
- }
+ if (adapter == TaxonNode.class) {
+ return taxonNode;
+ }
- return null;
- }
+ return null;
+ }
- /**
- * {@inheritDoc}
- *
- * Overrides equals to ensure that a taxon can only be edited by
- * one editor at a time.
- */
- @Override
+ /**
+ * {@inheritDoc}
+ *
+ * Overrides equals to ensure that a taxon can only be edited by
+ * one editor at a time.
+ */
+ @Override
public boolean equals(Object obj) {
- if (TaxonEditorInput.class.equals(obj.getClass())
- && getTaxon() != null
- && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())){
- if(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
- setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase());
- }
- return true;
- }
- return false;
- }
-
- /**
- * <p>getTaxon</p>
- *
- * @return the taxon
- */
- public Taxon getTaxon(){
- return taxonNode.getTaxon();
- }
-
- /**
- * <p>Getter for the field <code>taxonNode</code>.</p>
- *
- * @return the taxonNode
- */
- public TaxonNode getTaxonNode() {
- return taxonNode;
- }
-
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
+ if (TaxonEditorInput.class.equals(obj.getClass())
+ && getTaxon() != null
+ && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())){
+ if(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
+ setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase());
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * <p>getTaxon</p>
+ *
+ * @return the taxon
+ */
+ public Taxon getTaxon(){
+ Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon(), Taxon.class);
+ return taxon;
+ }
+
+ /**
+ * <p>Getter for the field <code>taxonNode</code>.</p>
+ *
+ * @return the taxonNode
+ */
+ public TaxonNode getTaxonNode() {
+ return taxonNode;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
- */
- /** {@inheritDoc} */
- @Override
+ return conversation;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
public void update(CdmDataChangeMap events) {
- if(dataChangeBehavior == null){
- dataChangeBehavior = new TaxonEditorInputDataChangeBehaviour(this);
- }
-
- DataChangeBridge.handleDataChange(events, dataChangeBehavior);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistableElement#getFactoryId()
- */
- /**
- * <p>getFactoryId</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ if(dataChangeBehavior == null){
+ dataChangeBehavior = new TaxonEditorInputDataChangeBehaviour(this);
+ }
+
+ DataChangeBridge.handleDataChange(events, dataChangeBehavior);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPersistableElement#getFactoryId()
+ */
+ /**
+ * <p>getFactoryId</p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ @Override
public String getFactoryId() {
- return TaxonEditorInputFactory.getFactoryId();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
- */
- /** {@inheritDoc} */
- @Override
+ return TaxonEditorInputFactory.getFactoryId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
+ */
+ /** {@inheritDoc} */
+ @Override
public void saveState(IMemento memento) {
- TaxonEditorInputFactory.saveState(memento, this);
- }
+ TaxonEditorInputFactory.saveState(memento, this);
+ }
/**
* @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
*/
public void setInitiallySelectedTaxonBase(TaxonBase taxonBase) {
- this.initiallySelectedTaxonBase = taxonBase;
- }
-
- /**
- * <p>Getter for the field <code>initiallySelectedTaxonBase</code>.</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
- */
- public TaxonBase getInitiallySelectedTaxonBase() {
- return initiallySelectedTaxonBase;
- }
-
- @Override
- public String toString() {
- return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon());
- }
+ this.initiallySelectedTaxonBase = taxonBase;
+ }
+
+ /**
+ * <p>Getter for the field <code>initiallySelectedTaxonBase</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
+ */
+ public TaxonBase getInitiallySelectedTaxonBase() {
+ return initiallySelectedTaxonBase;
+ }
+
+// @Override
+// public String toString() {
+// return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon());
+// }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<TaxonNode> getRootEntities() {
+ return Arrays.asList(taxonNode);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+ }
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ return null;
+ }
+
+ private List<String> getTaxonNodePropertyPaths() {
+ List<String> taxonNodePropertyPaths = new ArrayList<String>();
+ for(String propertyPath : getTaxonBasePropertyPaths()) {
+ taxonNodePropertyPaths.add("taxon." + propertyPath);
+ }
+ return taxonNodePropertyPaths;
+ }
+
+ private List<String> getTaxonBasePropertyPaths() {
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "sec",
+ "createdBy",
+ "updatedBy",
+ "annotations",
+ "markers",
+ "credits",
+ "extensions",
+ "rights",
+ "sources",
+ "descriptions",
+ "relationsToThisTaxon",
+ "relationsFromThisTaxon",
+ "taxonNodes",
+ "descriptions.descriptionElements.feature",
+ "descriptions.descriptionElements.area",
+ "descriptions.descriptionElements.status",
+ "descriptions.markers",
+ "name.descriptions",
+ "name.typeDesignations",
+ "name.status",
+ "name.nomenclaturalReference.inReference",
+ "name.taxonBases.taxonNodes",
+ "name.relationsFromThisName",
+ "name.relationsToThisName",
+ "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status",
+ "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName",
+ "synonymRelations.synonym.name.status.type",
+ "synonymRelations.synonym.name.relationsToThisName.fromName",
+ "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship",
+ "synonymRelations.synonym.name.nomenclaturalReference.authorship",
+ "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations"
+ });
+
+ return taxonBasePropertyPaths;
+ }
+
}
@Override
public void setFocus() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
+ ((CdmAuthorityEditorInput) getEditorInput()).bind();
}
/* (non-Javadoc)
try {
monitor.beginTask("Saving CDM Authority Editor", 1);
getConversationHolder().commit(true);
+ ((CdmAuthorityEditorInput) getEditorInput()).merge();
dirty = false;
firePropertyChange(PROP_DIRTY);
monitor.worked(1);
public void dispose() {
conversation.unregisterForDataStoreChanges(this);
conversation.close();
+ ((CdmAuthorityEditorInput) getEditorInput()).getCdmEntitySession().dispose();
super.dispose();
}
}
/**
* 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.editor.group.authority;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* Editor input for the {@link CdmAuthorityEditor}.
- *
+ *
* @author cmathew
* @created Mar 28, 2013
*
*/
-public class CdmAuthorityEditorInput implements IEditorInput, IConversationEnabled {
+public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
private ConversationHolder conversation;
private Group group;
-
+
protected CdmAuthorityEditorInput(ConversationHolder conversation, Group group) {
+ super(true);
this.conversation = conversation;
- this.group = group;
-
+ this.group = CdmApplicationState.getCurrentAppConfig().getGroupService().load(group.getUuid());
+
}
-
+
/**
* Creates a new instance of the input for a given group.
- *
+ *
* @param groupUuid
* @return
* @throws Exception
*/
public static CdmAuthorityEditorInput NewInstance(UUID groupUuid) throws Exception{
ConversationHolder conversation = CdmStore.createConversation();
- Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null);
+ Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null);
return new CdmAuthorityEditorInput(conversation, group);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
if (adapter == Group.class) {
return this.group;
- }
-
+ }
+
return null;
}
/* (non-Javadoc)
@Override
public void update(CdmDataChangeMap changeEvents) {
// TODO Auto-generated method stub
-
+
}
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
@Override
public String getToolTipText() {
return getName();
- }
-
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
}
return super.equals(object);
}
-
+
/**
* Getter method for group member.
- *
+ *
* @return
*/
public Group getGroup() {
return this.group;
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public Collection<Group> getRootEntities() {
+ return Arrays.asList(group);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
+ }
+ }
}
package eu.etaxonomy.taxeditor.editor.handler;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.UUID;
-
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
public class OpenDerivateViewHandler extends AbstractHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if(currentSelection instanceof IStructuredSelection){
- Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
- Set<UUID> selectedElementUUIDs = new HashSet<UUID>();
- while(selectionIterator.hasNext()){
- Object object = selectionIterator.next();
- if(object instanceof SpecimenOrObservationBase<?>){
- selectedElementUUIDs.add(((SpecimenOrObservationBase<?>) object).getUuid());
- }
- else if(object instanceof IndividualsAssociation){
- SpecimenOrObservationBase specimen = ((IndividualsAssociation) object).getAssociatedSpecimenOrObservation();
- if(specimen!=null){
- selectedElementUUIDs.add(specimen.getUuid());
- }
- }
- }
- if(!selectedElementUUIDs.isEmpty()){
- DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs);
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivative Editor", e);
- } catch (NullPointerException npe){
- MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivative Editor. The derivate hierarchy is corrupted!", npe);
- }
- }
- else{
- MessagingUtils.informationDialog("Empty selection", "No Specimen selected.");
- }
+ try {
+ EditorUtil.open(new DerivateViewEditorInput());
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e);
}
return null;
}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.handler;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.ParameterType;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-
-public class OpenTaxonEditorHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object object = event.getObjectParameterForExecution("eu.etaxonomy.taxeditor.editor.taxonParameter");
-
- try {
- ParameterType parameterType = event.getCommand().getParameterType("eu.etaxonomy.taxeditor.editor.taxonParameter");
- if(parameterType.isCompatible(object)){
- EditorUtil.openTaxonEditor(object);
- }
- } catch (NotDefinedException e) {
- MessagingUtils.error(this.getClass(), "Parameter type not defined", e);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenTaxonEditorHandler.class, "Error opening the editor", e);
- }
- return null;
- }
-
-}
import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
public class SpecimenPropertyTester extends PropertyTester {
private static final String SEQUENCE = "isSequence";
private static final String SINGLE_READ = "isSingleRead";
+ private static final String IS_SINGLEREAD_REUSABLE_HERE = "isSingleReadReusableHere";
+ private static final String IS_SINGLEREAD_REUSED = "isSingleReadReused";
public SpecimenPropertyTester() {}
else if (SINGLE_READ.equals(property)) {
return isSingleReadAlignment(treeNodeOfSelection.getValue());
}
+ else if (IS_SINGLEREAD_REUSABLE_HERE.equals(property)) {
+ return isSingleReadReusableHere(treeNodeOfSelection.getValue());
+ }
+ else if (IS_SINGLEREAD_REUSED.equals(property)) {
+ return isSingleReadReused(treeNodeOfSelection.getValue());
+ }
}
}
return false;
}
- private boolean isSequence(Object object) {
+ private boolean isSingleReadReused(Object value) {
+ final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ final IEditorPart activeEditor = window.getActivePage().getActiveEditor();
+ if(value instanceof SingleRead){
+ if(activeEditor instanceof DerivateView
+ && ((DerivateView) activeEditor).getMultiLinkSingleReads().contains(value)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isSingleReadReusableHere(Object value) {
+ TreeNode clipboardNode = EditorUtil.getTreeNodeOfSelection(LocalSelectionTransfer.getTransfer().getSelection());
+ if(value instanceof Sequence && clipboardNode!=null && clipboardNode.getValue() instanceof SingleRead
+ && !((Sequence) value).getSingleReads().contains(clipboardNode.getValue())){
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isSequence(Object object) {
return (object instanceof Sequence);
}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import java.util.UUID;
-
-import org.eclipse.core.commands.AbstractParameterValueConverter;
-import org.eclipse.core.commands.ParameterValueConversionException;
-
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-public class TaxonParameterConverter extends AbstractParameterValueConverter {
-
- public TaxonParameterConverter() {
- }
-
- @Override
- public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
- return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
- }
-
- @Override
- public String convertToString(Object parameterValue) throws ParameterValueConversionException {
- if(parameterValue instanceof TaxonBase<?>){
- return ((TaxonBase<?>) parameterValue).getUuid().toString();
- }
- return null;
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.editor.handler.create;
-
-import java.util.Collections;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeFieldUnitCacheStrategy;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>NewSpecimenHandler class.</p>
- *
- * @author n.hoffmann
- * @created Jun 16, 2010
- * @version 1.0
- */
-public class NewSpecimenHandler extends AbstractHandler {
- private static final Logger logger = Logger
- .getLogger(NewSpecimenHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ConversationHolder conversation = CdmStore.createConversation();
- conversation.bind();
- FieldUnit fieldUnit = FieldUnit.NewInstance();
- DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
- DerivationEvent.NewSimpleInstance(fieldUnit, derivedUnit, DerivationEventType.GATHERING_IN_SITU());
- fieldUnit.setCacheStrategy(new DerivedUnitFacadeFieldUnitCacheStrategy());
- derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
- CdmStore.getService(IOccurrenceService.class).save(fieldUnit);
- CdmStore.getService(IOccurrenceService.class).save(derivedUnit);
- conversation.commit();
- DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singleton(fieldUnit.getUuid()));
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-// NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard();
-// wizard.init(null, null);
-// WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-// dialog.open();
- return null;
- }
-}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class DefaultOpenTaxonEditorForTaxonHandler extends DefaultOpenHandlerBase<TaxonBase> {
+
+ @Override
+ protected TaxonBase getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, TaxonBase entity) {
+ try {
+ EditorUtil.openTaxonBase(entity.getUuid());
+ } catch (PartInitException e) {
+ MessagingUtils.error(DefaultOpenTaxonEditorForTaxonHandler.class, "Could not open taxon editor for taxon/synonym "+entity, e);
+ }
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class DefaultOpenTaxonEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
+
+ @Override
+ protected TaxonNode getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, TaxonNode entity) {
+ TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(entity.getTaxon().getUuid());
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, "Could not open taxon editor for taxon "+input.getTaxon(), e);
+ }
+ }
+
+}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.editor.key;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
/**
* @author n.hoffmann
- *
+ *
*/
public abstract class AbstractIdentificationEditorInput<T extends IIdentificationKey>
- implements IEditorInput, IConversationEnabled {
+ extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
private final ConversationHolder conversation;
protected AbstractIdentificationEditorInput(ConversationHolder conversation) {
+ super(true);
this.conversation = conversation;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IEditorInput#exists()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IEditorInput#getImageDescriptor()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IEditorInput#getPersistable()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.IEditorInput#getName()
*/
@Override
@Override
public void update(CdmDataChangeMap changeEvents) {
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
package eu.etaxonomy.taxeditor.editor.key;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
* @version 1.0
*/
public class KeyEditor extends FormEditor implements IConversationEnabled,
- IDirtyMarkable, IPartContentHasDetails {
+ IDirtyMarkable, IPartContentHasDetails, ICdmChangeListener {
public static final String ID = "eu.etaxonomy.taxeditor.editor.key";
private KeyEditorDataChangeBehaviour dataChangeBehavior;
+ private PolytomousKeyEditorInput polytomousKeyEditorInput;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ polytomousKeyEditorInput = (PolytomousKeyEditorInput)input;
+ CdmApplicationState.getCurrentDataChangeService().register(this);
+ super.init(site, input);
+ }
+
/*
* (non-Javadoc)
*
monitor.beginTask("Saving Editor", 1);
getConversationHolder().bind();
getConversationHolder().commit(true);
+ polytomousKeyEditorInput.merge();
setDirty(false);
monitor.worked(1);
} finally {
public void setFocus() {
getConversationHolder().commit(true);
getConversationHolder().bind();
+ polytomousKeyEditorInput.bind();
super.setFocus();
}
/*
public void dispose() {
conversation.unregisterForDataStoreChanges(this);
conversation.close();
+ polytomousKeyEditorInput.dispose();
+ CdmApplicationState.getCurrentDataChangeService().unregister(this);
super.dispose();
}
*/
@Override
protected void addPages() {
- AbstractIdentificationEditorInput input = (AbstractIdentificationEditorInput) getEditorInput();
- conversation = input.getConversationHolder();
+ conversation = polytomousKeyEditorInput.getConversationHolder();
conversation.registerForDataStoreChanges(this);
try {
- addPage(0, new PolytomousKeyListEditor(this), input);
+ addPage(0, new PolytomousKeyListEditor(this), polytomousKeyEditorInput);
setPageText(0, "List");
- addPage(1, new PolytomousKeyGraphEditor(this), input);
+ addPage(1, new PolytomousKeyGraphEditor(this), polytomousKeyEditorInput);
setPageText(1, "Graph");
} catch (PartInitException e) {
MessagingUtils.error(getClass(), e);
*
*/
public void setPartName() {
- AbstractIdentificationEditorInput input = (AbstractIdentificationEditorInput) getEditorInput();
- PolytomousKey key = (PolytomousKey) input.getKey();
+ PolytomousKey key = polytomousKeyEditorInput.getKey();
setPartName(key.getTitleCache());
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+ */
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ editorDirtyStateChanged();
+ IEditorPart activeEditor = getActiveEditor();
+ if (activeEditor instanceof IDirtyMarkable) {
+ for(CdmBase cdmBase : event.getChangedObjects()) {
+ ((IDirtyMarkable) activeEditor).changed(cdmBase);
+ }
+ }
+ }
}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.editor.key.polytomous;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.UUID;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
*/
public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<PolytomousKey> {
- private PolytomousKey key;
-
- protected PolytomousKeyEditorInput(ConversationHolder conversation,
- PolytomousKey key) {
- super(conversation);
- this.key = key;
- }
-
-
-
- public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid) throws Exception{
- try{
- ConversationHolder conversation = CdmStore.createConversation();
-
- return NewInstance(polytomousKeyUuid, conversation);
- }catch(Exception e){
- throw e;
- }
- }
-
- public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid, ConversationHolder conversation) throws Exception{
- PolytomousKey polytomousKey = CdmStore.getService(IPolytomousKeyService.class).load(polytomousKeyUuid, null);
-
- return new PolytomousKeyEditorInput(conversation, polytomousKey);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return key.getTitleCache();
- }
-
- @Override
- public PolytomousKey getKey() {
- return key;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object object) {
- if (object instanceof PolytomousKeyEditorInput
- && getKey() != null
- && getKey().equals(((PolytomousKeyEditorInput) object).getKey())
- ){
- return true;
- }
- return super.equals(object);
- }
+ private final String name;
+ private final UUID keyUuid;
+ private PolytomousKey key;
+
+
+ protected PolytomousKeyEditorInput(ConversationHolder conversation,
+ UUID polytomousKeyUuid) {
+ super(conversation);
+ this.keyUuid = polytomousKeyUuid;
+ this.key = CdmStore.getService(IPolytomousKeyService.class).load(polytomousKeyUuid, null);
+ this.name = key.getTitleCache();
+ }
+
+// public PolytomousKeyEditorInput(UUID polytomousKeyUuid, String name) {
+// super(CdmStore.createConversation());
+// this.keyUuid = polytomousKeyUuid;
+// this.name = name;
+// }
+
+
+ public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid) throws Exception{
+ try{
+ ConversationHolder conversation = CdmStore.createConversation();
+ return new PolytomousKeyEditorInput(conversation, polytomousKeyUuid);
+ }catch(Exception e){
+ throw e;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public PolytomousKey getKey() {
+ return key;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (object instanceof PolytomousKeyEditorInput
+ && getKey() != null
+ && getKey().equals(((PolytomousKeyEditorInput) object).getKey())
+ ){
+ return true;
+ }
+ return super.equals(object);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<PolytomousKey> getRootEntities() {
+ return Arrays.asList(key);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
+ }
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ Map<Object,List<String>> propertyPathsMap = new HashMap<Object,List<String>>();
+
+ List<String> polytomousKeyNodePropertyPaths = Arrays.asList(new String[] {
+ "statement"
+ });
+ propertyPathsMap.put("children", polytomousKeyNodePropertyPaths);
+ return propertyPathsMap;
+ }
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.editor.key.polytomous;
+
+/**
+ * @author cmathew
+ * @date 21 Jul 2015
+ *
+ */
+public interface PolytomousKeyEditorLabels {
+
+ public static final String CREATE_CHILD_POLYTOMOUS_KEY_NODE_LABEL = "Create Child Polytomous Key Node";
+ public static final String CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL = "Create Sibling Polytomous Key Node";
+
+ public static final String NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE = "No Key Node Selected.Please right-click on a specific key node to create a new child key node.";
+ public static final String NO_KEY_NODE_FOR_SIBLING_SELECTED_MESSAGE = "No Key Node Selected.Please right-click on a specific key node to create a new sibling key node.";
+}
// $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.
*/
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
/**
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
* .viewers.Viewer, java.lang.Object, java.lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
* .lang.Object)
*/
@Override
public Object[] getElements(Object inputElement) {
- if (inputElement instanceof PolytomousKey) {
+ if (inputElement instanceof PolytomousKeyEditorInput) {
List<PolytomousKeyNode> result = new ArrayList<PolytomousKeyNode>();
- PolytomousKeyNode root = ((PolytomousKey) inputElement).getRoot();
+ PolytomousKeyNode root = ((PolytomousKeyEditorInput) inputElement).getKey().getRoot();
getChildrenBreadthFirst(result, root);
return result.toArray();
private void getChildrenBreadthFirst(List<PolytomousKeyNode> result,
PolytomousKeyNode node) {
+ if (node == null){
+ return;
+ }
if (!node.getChildren().isEmpty()) {
result.addAll(node.getChildren());
for (PolytomousKeyNode internalNode : node.getChildren()) {
Point point = new Point(event.x, event.y);
int selectedColumn = getSelectedColumn(table, point);
+
+ if (table == null || point == null ){
+ return;
+ }
+
PolytomousKeyNode node = (PolytomousKeyNode) getTableItem(
table, point).getData();
*/
@Override
public void doSave(IProgressMonitor monitor) {
-
}
/*
setPartName(key.getTitleCache());
- viewer.setInput(key);
+ viewer.setInput(getEditorInput());
}
public int getTableItemCount() {
}
public PolytomousKey getViewerInputKey() {
- return (PolytomousKey) viewer.getInput();
+ return ((PolytomousKeyEditorInput) viewer.getInput()).getKey();
}
private void createMenu() {
// register context menu
*/
@Override
public void changed(Object element) {
- if(element != null) {
- viewer.update(element, null);
- }
-
- if (element instanceof PolytomousKeyNode) {
- List<PolytomousKeyNode> children = ((PolytomousKeyNode) element)
- .getParent().getChildren();
- for (PolytomousKeyNode child : children) {
- viewer.update(child, null);
- }
- }
+ if(element != null) {
+ viewer.update(element, null);
+ }
+ if (element instanceof PolytomousKeyNode) {
+ List<PolytomousKeyNode> children = ((PolytomousKeyNode) element)
+ .getParent().getChildren();
+ for (PolytomousKeyNode child : children) {
+ viewer.update(child, null);
+ }
+ }
+ viewer.refresh();
}
/* (non-Javadoc)
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.editor.key.polytomous.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.RemotingCreatePolytomousKeyNodeOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+
+/**
+ * @author cmathew
+ * @date 21 Jul 2015
+ *
+ */
+public class RemotingCreateChildPolytomousKeyNodeHandler extends RemotingCdmHandler {
+
+ private PolytomousKeyNode parentNode;
+
+ public RemotingCreateChildPolytomousKeyNodeHandler() {
+ super(PolytomousKeyEditorLabels.CREATE_CHILD_POLYTOMOUS_KEY_NODE_LABEL);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+
+ if (editor instanceof KeyEditor) {
+ IPolytomousKeyEditorPage editorPage = (IPolytomousKeyEditorPage) ((KeyEditor) editor)
+ .getActiveEditor();
+
+ if (editorPage instanceof PolytomousKeyListEditor) {
+ PolytomousKeyListEditor klEditor = (PolytomousKeyListEditor) editorPage;
+ if(klEditor.getTableItemCount() == 0) {
+ PolytomousKey pk = klEditor.getViewerInputKey();
+ parentNode = pk.getRoot();
+
+ } else {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+ if (selection.getFirstElement() instanceof PolytomousKeyNode) {
+ parentNode = (PolytomousKeyNode) selection.getFirstElement();
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_CHILD_SELECTED_MESSAGE);
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingCreatePolytomousKeyNodeOperation(event.getTrigger(), false, parentNode);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.editor.key.polytomous.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.RemotingCreatePolytomousKeyNodeOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+
+/**
+ * @author cmathew
+ * @date 21 Jul 2015
+ *
+ */
+public class RemotingCreateSiblingPolytomousKeyNodeHandler extends RemotingCdmHandler {
+
+ private PolytomousKeyNode parentNode;
+
+ public RemotingCreateSiblingPolytomousKeyNodeHandler() {
+ super(PolytomousKeyEditorLabels.CREATE_SIBLING_POLYTOMOUS_KEY_NODE_LABEL);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+
+ if (selection.getFirstElement() instanceof PolytomousKeyNode) {
+ parentNode = (PolytomousKeyNode) selection.getFirstElement();
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_SIBLING_SELECTED_MESSAGE);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingCreatePolytomousKeyNodeOperation(event.getTrigger(), false, parentNode.getParent());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation;
PolytomousKeyNode parentNode;
private PolytomousKeyNode childNode;
-
+
public CreateNodeOperation(String label,
IUndoContext undoContext, PolytomousKeyNode parentNode, IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, postOperationEnabled);
throws ExecutionException {
childNode = PolytomousKeyNode.NewInstance();
-
+
parentNode.addChild(childNode);
return postExecute(childNode);
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.editor.key.polytomous.operation;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
* @author n.hoffmann
- *
+ *
*/
public class DeleteNodeOperation extends AbstractPostTaxonOperation {
/*
* (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 {
-
+
//parent.removeChild(node);
ICdmApplicationConfiguration controller;
-
- controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
-
+
+ controller = CdmStore.getCurrentApplicationConfiguration();
+
IPolytomousKeyNodeService service = controller.getPolytomousKeyNodeService();
DeleteResult result;
if (node.getChildren().size()>0){
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
* .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.editor.key.polytomous.operation;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmDefaultOperation;
+
+/**
+ * @author cmathew
+ * @date 21 Jul 2015
+ *
+ */
+public class RemotingCreatePolytomousKeyNodeOperation extends RemotingCdmDefaultOperation {
+
+ private final PolytomousKeyNode parentNode;
+
+ private final static String LABEL = "Create new polytomous key node";
+
+ public RemotingCreatePolytomousKeyNodeOperation(Object source,
+ boolean async,
+ PolytomousKeyNode parentNode){
+ super(LABEL, Action.Create, source, async);
+ this.parentNode = parentNode;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmSimpleOperation#doSimpleExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CdmBase doSimpleExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ PolytomousKeyNode childNode = PolytomousKeyNode.NewInstance();
+ parentNode.addChild(childNode);
+ return childNode;
+ }
+
+}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.IDropTargetable;
import eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage;
import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
import eu.etaxonomy.taxeditor.model.TaxeditorPartService;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.security.RequiredPermissions;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
* <p>
private TaxonBase objectAffectedByLastOperation;
+ private ICdmEntitySession cdmEntitySession;
+
/**
* <p>
* Constructor for TaxonNameEditor.
* </p>
*/
public void createOrUpdateNameComposites() {
- //this.taxon = (Taxon)CdmStore.getService(ITaxonService.class).load(this.getTaxon().getUuid());
- //this.taxon = HibernateProxyHelper.deproxy(this.taxon, Taxon.class);
+// this.taxon = (Taxon)CdmStore.getService(ITaxonService.class).load(this.getTaxon().getUuid());
ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
ContainerFactory.createOrUpdateHeterotypicSynonymyGroups(this);
ContainerFactory.createOrUpdateMisapplicationsGroup(this);
+
// Redraw composite
managedForm.reflow(true);
}
}
if (input.getAdapter(Taxon.class) != null) {
- taxon = (Taxon) input.getAdapter(Taxon.class);
+ taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class);
} else {
throw new PartInitException("Invalid Input: Taxon cannot be null");
}
Color background = AbstractUtility.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
setEnabled(enabled, background);
}
+
+
+
}
/**
* 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.
*/
* @version 1.0
*/
public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
-
+
/**
* <p>Constructor for MisapplicationContainer.</p>
*
public MisapplicationContainer(AbstractGroup group, Taxon misappliedName) {
super(misappliedName);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
protected void initializeComposite() {
setIsDraggable(true);
setFont(getViewerFont());
-
- showSec();
-
+
+ showSec();
+
initTextViewer();
}
protected void updateIcon() {
setIcon(MISAPPLIEDNAME_ICON);
}
-
+
private void showSec() {
if (getMisappliedName() == null) {
return;
}
-
+
if (getMisappliedName().getSec() == null) {
- setNonEditableInfo("sec. ???", false);
+ if (getMisappliedName().getAppendedPhrase() != null ){
+ setNonEditableInfo(getMisappliedName().getAppendedPhrase(), false);
+ }else{
+ setNonEditableInfo("sec. ???", false);
+ }
} else {
String title = getMisappliedName().getSec().getTitleCache();
- setNonEditableInfo("sec. " + title, false);
+ title = title.replace("&", "&&");
+ String sec = "sec. ";
+ if (getMisappliedName().getAppendedPhrase() != null ){
+ sec = getMisappliedName().getAppendedPhrase() + " "+sec;
+ }
+ setNonEditableInfo(sec + title, false);
}
}
-
+
/**
* <p>getMisappliedName</p>
*
protected Font getViewerFont() {
return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer#showAnnotations()
*/
}
super.showAnnotations();
}
-
+
/** {@inheritDoc} */
@Override
// $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.editor.name.handler;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
/**
private static final Logger logger = Logger
.getLogger(ChangeSynonymToAcceptedTaxonHandler.class);
private MultiPageTaxonEditor editor;
-
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);
Shell shell = HandlerUtil.getActiveShell(event);
IEditorInput input = editor.getEditorInput();
-
+
if (!(input instanceof TaxonEditorInput)) {
logger.error("Editor input is not TaxonEditorInput");
return null;
}
Synonym synonym = (Synonym) selection.getFirstElement();
-
+
// Force user to save taxon - not really necessary though, is it?
if (!EditorUtil.forceUserSave(editor, shell)) {
return null;
// Get taxon
Taxon taxon = ((TaxonEditorInput) input).getTaxon();
-
+
TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
-
- List<UUID> excludeTaxa = null;
-
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select parent", excludeTaxa, null, null);
-
+
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ //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", null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
+
+
if(newParentNode != null){
-
+
// TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon
// apply confirmation dialog
HomotypicalGroup group = synonym.getHomotypicGroup();
Set<TaxonNameBase> namesInGroup = group.getTypifiedNames();
// FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
- AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(),
- taxon, newParentNode, synonym, namesInGroup, this, editor); //$NON-NLS-1$
+ AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation("Change synonym to accepted taxon", EditorUtil.getUndoContext(),
+ taxon, newParentNode, synonym, namesInGroup, this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); //$NON-NLS-1$
+
EditorUtil.executeOperation(operation);
}
-
+
return null;
}
* @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
*/
/** {@inheritDoc} */
- public boolean postOperation(CdmBase objectAffectedByOperation) {
-
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+
// Redraw existing editor
((IPostOperationEnabled) editor).postOperation(null);
-
+
editor.doSave(EditorUtil.getMonitor());
-
+
if (objectAffectedByOperation instanceof TaxonNode) {
-
+
// Open new unsaved editor with existing taxon's parent as temporary parent
TaxonNode newNode = (TaxonNode) objectAffectedByOperation;
// TaxonNode newNode = parentNode.addChild(newTaxon);
-
+
try {
// TODO
/*
* doesn't work yet.
*/
EditorUtil.openTaxonNode(newNode.getUuid());
-
+
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
*
* @return a boolean.
*/
- public boolean onComplete() {
+ @Override
+ public boolean onComplete() {
// TODO Auto-generated method stub
return false;
}
// $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.
*/
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.Page;
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
Page.NAME);
-
+ Shell shell = HandlerUtil.getActiveShell(event);
+ MultiPageTaxonEditor multiPageTaxonEditor = EditorUtil.getActiveMultiPageTaxonEditor();
+ if (!EditorUtil.forceUserSave(multiPageTaxonEditor, shell)) {
+ return null;
+ }
Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
-
+
AbstractPostOperation operation = null;
try {
if(selectedElement instanceof Taxon){
- operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
+ operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
}
if(selectedElement instanceof Synonym){
- operation = new ChangeSynonymToMisapplicationOperation(event.getCommand().getName(),
+ operation = new ChangeSynonymToMisapplicationOperation(event.getCommand().getName(),
editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
}
-
+
EditorUtil.executeOperation(operation);
} catch (NotDefinedException e) {
logger.warn("Command name not set");
}
-
+
return null;
}
}
/**
* 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.
*/
import org.eclipse.core.commands.common.NotDefinedException;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.Page;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
Page.NAME);
Taxon taxon = editor.getTaxon();
HomotypicalGroup group = taxon.getHomotypicGroup();
- TaxonNameBase newSynonymName = ParseHandler.createEmptyName();
-
+ NonViralName newSynonymName = ParseHandler.createEmptyName();
+
AbstractPostOperation operation;
try {
- operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(),
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(),
editor.getUndoContext(), taxon, group, newSynonymName, editor);
EditorUtil.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.error(getClass(), e);
}
-
+
return null;
}
// $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.
*/
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.Page;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
Page.NAME);
ISelection menuSelection = HandlerUtil.getCurrentSelection(event);
-
+
Object selecteObject = ((StructuredSelection) menuSelection).getFirstElement();
-
+
if(! (selecteObject instanceof Synonym)){
return null;
}
-
-
+
+
Synonym synonym = (Synonym) selecteObject;
-
+
HomotypicalGroup group = synonym.getHomotypicGroup();
-
- TaxonNameBase newSynonymName = ParseHandler.createEmptyName();
-
+
+ NonViralName newSynonymName = ParseHandler.createEmptyName();
+
AbstractPostOperation operation;
-
+
try {
operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(), editor.getUndoContext(),
editor.getTaxon(), group, newSynonymName, editor);
} catch (NotDefinedException e) {
logger.warn("Command name not set");
}
-
+
return null;
}
}
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.Messages;
import eu.etaxonomy.taxeditor.editor.Page;
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
- * <p>DeleteTaxonBaseHandler class.</p>
- *
* @author n.hoffmann
* @created 21.04.2009
* @version 1.0
public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler, IPostOperationEnabled {
TaxonNameEditor editor;
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
- /**
- * @param editor
- * @param selectedElement
- * @param operation
- * @param commandName
- */
protected void doExecute(ExecutionEvent event, TaxonNameEditor editor, Object selectedElement) {
AbstractPostOperation operation = null;
String commandName = null;
}
else if (selectedElement instanceof Taxon){
//TODO: how to get the actual classification
- if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Are you sure you want to delete the selected taxon?")){
+ if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_TAXON)){
return ;
}
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- operation = new DeleteTaxonOperation(commandName, editor.getUndoContext(),(Taxon) selectedElement, new TaxonDeletionConfigurator(), null, activePage, this, editor);
+ operation = new DeleteTaxonOperation(commandName,
+ editor.getUndoContext(),
+ (Taxon) selectedElement,
+ new TaxonDeletionConfigurator(),
+ null,
+ activePage,
+ this,
+ editor,
+ (ICdmEntitySessionEnabled)editor.getEditorInput());
//editor.dispose();
}
else {
- throw new IllegalArgumentException("Element has to be Synonym, Misapplication or Concept");
+ throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT);
}
AbstractUtility.executeOperation(operation);
-package eu.etaxonomy.taxeditor.editor.name.handler;\r
-\r
-import java.util.UUID;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.common.NotDefinedException;\r
-import org.eclipse.core.commands.operations.IUndoContext;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.jface.viewers.StructuredSelection;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.cdm.model.common.CdmBase;\r
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;\r
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;\r
-import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;\r
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;\r
-\r
-public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler implements IPostOperationEnabled {\r
- private static final Logger logger = Logger\r
- .getLogger(MoveSynonymToAnotherAcceptedTaxonHandler.class);\r
- private MultiPageTaxonEditor editor;\r
- \r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);\r
- Shell shell = HandlerUtil.getActiveShell(event);\r
- IEditorInput input = editor.getEditorInput();\r
- if (!EditorUtil.forceUserSave(editor, shell)) {\r
- return null;\r
- }\r
- \r
- if (!(input instanceof TaxonEditorInput)) {\r
- logger.error("Editor input is not TaxonEditorInput");\r
- return null;\r
- }\r
-\r
- // Get synonym from selection\r
- StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event);\r
- if (!(selection.getFirstElement() instanceof Synonym)) {\r
- logger.error("Selection does not contain a Synonym");\r
- return null;\r
- }\r
-\r
- Synonym synonym = (Synonym) selection.getFirstElement();\r
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select new accepted taxon", null, null, null);\r
- Taxon oldParent = ((TaxonEditorInput)input).getTaxon();\r
- \r
- MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon of Synonym", EditorUtil.getUndoContext(),\r
- oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);\r
- \r
- EditorUtil.executeOperation(operation);\r
- \r
-\r
- return null;\r
- }\r
-\r
- @Override\r
- public boolean postOperation(CdmBase objectAffectedByOperation) {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
-\r
- @Override\r
- public boolean onComplete() {\r
- // TODO Auto-generated method stub\r
- return false;\r
- }\r
- \r
- \r
-\r
-}\r
+package eu.etaxonomy.taxeditor.editor.name.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler implements IPostOperationEnabled {
+ private static final Logger logger = Logger
+ .getLogger(MoveSynonymToAnotherAcceptedTaxonHandler.class);
+ private MultiPageTaxonEditor editor;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);
+ Shell shell = HandlerUtil.getActiveShell(event);
+ IEditorInput input = editor.getEditorInput();
+ // Get synonym from selection before possible save dialog
+ // because the selection will be null if save dialog is shown
+ StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event);
+
+ if (!EditorUtil.forceUserSave(editor, shell)) {
+ return null;
+ }
+
+ if (!(input instanceof TaxonEditorInput)) {
+ logger.error("Editor input is not TaxonEditorInput");
+ return null;
+ }
+
+ if (selection==null || !(selection.getFirstElement() instanceof Synonym)) {
+ MessagingUtils.warningDialog("No selection", this, "No synonym selected");
+ logger.error("Selection does not contain a Synonym");
+ return null;
+ }
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+ Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(oldParent.getUuid());
+
+
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), "Select new accepted taxon", excludeTaxa, null, ((TaxonEditorInput)input).getTaxonNode().getClassification());
+
+ if(newParentNode!=null){
+ MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation("Change accepted Taxon of Synonym", EditorUtil.getUndoContext(),
+ oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);
+
+ AbstractUtility.executeOperation(operation);
+
+ }
+ return null;
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean onComplete() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+
+}
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>
}
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;
}
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
// $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.
*/
import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* <p>SwapSynonymAndAcceptedHandler class.</p>
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
editor = EditorUtil.getActiveMultiPageTaxonEditor();
Shell shell = HandlerUtil.getActiveShell(event);
Synonym synonym = (Synonym) EditorUtil.getSelection(event).getFirstElement();
-
+
// Force user to save taxon - not really necessary though, is it?
if (!EditorUtil.forceUserSave(editor, shell)) {
return null;
}
-
+
try {
- SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(event.getCommand().getName(), editor.getUndoContext(),
- editor.getTaxon(), synonym, this);
-
+ SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(event.getCommand().getName(),
+ editor.getUndoContext(),
+ editor.getTaxon(),
+ synonym,
+ this,
+ (ICdmEntitySessionEnabled)editor.getEditorInput());
+
EditorUtil.executeOperation(operation);
-
+
} catch (NotDefinedException e) {
logger.warn("Command name not set");
- }
+ }
return null;
}
public boolean postOperation(CdmBase objectAffectedByOperation) {
// Redraw existing editor
//((IPostOperationEnabled) editor).postOperation(null);
-
+
editor.doSave(EditorUtil.getMonitor());
editor.close(true);
-
+
if (objectAffectedByOperation instanceof Taxon) {
-
+
taxon = (Taxon) objectAffectedByOperation;
-
-
+
+
}
return true;
}
public boolean onComplete() {
Display display = Display.getCurrent();
display.asyncExec(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
try {
EditorUtil.openTaxonBase(taxon.getUuid());
-
+
} catch (Exception e) {
MessagingUtils.warningDialog("Could not open editor for taxon", this, e.getMessage());
}
-
+
}
});
return true;
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
TaxonNameBase<?, ?> synonymName = concept.getName();
Synonym synonym = null;
try {
- synonym = CdmStore.getService(ITaxonService.class).changeRelatedTaxonToSynonym(concept, element, taxonRelationship.getType(), null);
+ synonym =
+ (Synonym) CdmStore.getService(ITaxonService.class).changeRelatedTaxonToSynonym(concept.getUuid(),
+ element.getUuid(),
+ taxonRelationship.getType(),
+ null).getCdmEntity();
} catch (DataChangeNoRollbackException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
-
+
+
return postExecute(synonym);
}
/**
* 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.
*/
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
*/
public class ChangeHomotypicalGroupBasionymOperation extends
AbstractPostTaxonOperation {
- private TaxonBase taxonBase;
+ private final TaxonBase taxonBase;
/**
* <p>Constructor for ChangeHomotypicalGroupBasionymOperation.</p>
public ChangeHomotypicalGroupBasionymOperation(String text,
IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
super(text, undoContext, taxon, postOperationEnabled);
-
+
this.taxonBase = taxonBase;
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+
TaxonNameBase<?, ?> name = taxonBase.getName();
-
+
monitor.worked(20);
name = HibernateProxyHelper.deproxy(name, TaxonNameBase.class);
HomotypicalGroup group = HibernateProxyHelper.deproxy(name.getHomotypicalGroup(), HomotypicalGroup.class);
TaxonNameBase oldBasionym = name.getBasionym();
-
+
name.setAsGroupsBasionym();
-
+
monitor.worked(40);
oldBasionym = HibernateProxyHelper.deproxy(oldBasionym, TaxonNameBase.class);
if (oldBasionym != null){
postExecute(oldBasionymTaxonBase);
}
}
+
return postExecute(taxonBase);
}
// TODO replace w method from cdmlib
// FIXME this is also old code: reimplement
// CdmUtil.setGroupBasionym(synonym.getName());
-
+
return postExecute(taxonBase);
}
-
-
+
+
}
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPostOperation {
private Taxon newTaxon;
- private Synonym synonym;
+ private final Synonym synonym;
private final ITaxonTreeNode parentNode;
private TaxonNode newNode;
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
- public ChangeSynonymToAcceptedTaxonOperation(String label, IUndoContext undoContext,
- Taxon taxon, ITaxonTreeNode parentNode, Synonym synonym, Set<TaxonNameBase> namesInHomotypicalGroup, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
+ public ChangeSynonymToAcceptedTaxonOperation(String label,
+ IUndoContext undoContext,
+ Taxon taxon,
+ ITaxonTreeNode parentNode,
+ Synonym synonym,
+ Set<TaxonNameBase> namesInHomotypicalGroup,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.element = taxon;
this.parentNode = parentNode;
throws ExecutionException {
try {
- newTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym, element, true, true, null, null);
+ newNode = (TaxonNode) CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym.getUuid(),
+ element.getUuid(),
+ parentNode.getUuid(),
+ true,
+ true,
+ null,
+ null).getCdmEntity();
} catch (HomotypicalGroupChangeException e) {
MessagingUtils.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage());
return postExecute(null);
}
monitor.worked(20);
+ //newTaxon = (Taxon) CdmStore.getService(ITaxonService.class).merge(newTaxon);
+ //element.removeSynonym(synonym);
- element.removeSynonym(synonym);
- newNode = parentNode.addChildTaxon(newTaxon, null, null);
/*if(namesInHomotypicGroup != null){
Taxon taxon = newNode.getTaxon();
for (TaxonNameBase synonymName : namesInHomotypicGroup){
taxon.addHomotypicSynonymName(synonymName, null, null);
-
+
}
}*/
+ //newNode = CdmStore.getService(ITaxonNodeService.class).merge(newNode);
monitor.worked(40);
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
// add misapplied name to taxon
// TODO add microcitation for misapplied name to property sheet (if microcitation is indeed needed?!)
element.addMisappliedName(misapplication, null, null);*/
- misapplication = CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym, element, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), null, null);
+ misapplication =
+ (Taxon) CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym.getUuid(),
+ element.getUuid(),
+ TaxonRelationshipType.MISAPPLIED_NAME_FOR(),
+ null,
+ null).getCdmEntity();
// redraw editor if exists
return postExecute(misapplication);
}
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
AbstractPostTaxonOperation {
private final HomotypicalGroup group;
- private final TaxonNameBase newSynonymName;
+ private final NonViralName newSynonymName;
private SynonymRelationship synonymRelationship;
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public CreateSynonymInExistingHomotypicalGroupOperation(String label,
- IUndoContext undoContext, Taxon taxon, HomotypicalGroup group, TaxonNameBase newSynonymName, IPostOperationEnabled postOperationEnabled) {
+ IUndoContext undoContext, Taxon taxon, HomotypicalGroup group, NonViralName newSynonymName, IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, taxon, postOperationEnabled);
this.group = group;
this.newSynonymName = newSynonymName;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
// Find misapplication relation, save citation information
- for (TaxonRelationship relationship : element.getTaxonRelations()) {
- if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
- && relationship.getFromTaxon().equals(misapplication)) {
- citation = relationship.getCitation();
- microcitation = relationship.getCitationMicroReference();
- }
- }
+// for (TaxonRelationship relationship : element.getTaxonRelations()) {
+// if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
+// && relationship.getFromTaxon().equals(misapplication)) {
+// citation = relationship.getCitation();
+// microcitation = relationship.getCitationMicroReference();
+// }
+// }
monitor.worked(20);
// Remove misapplied name relation from taxon
element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
ICdmApplicationConfiguration controller;
- controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
+ controller = CdmStore.getCurrentApplicationConfiguration();
ITaxonService service = controller.getTaxonService();
TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
ICdmApplicationConfiguration controller;
- controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
+ controller = CdmStore.getCurrentApplicationConfiguration();
ITaxonService service = controller.getTaxonService();
if (synonym.getId() == 0){
element.removeSynonym(synonym);
} else {
-
- DeleteResult result = service.deleteSynonym(synonym, null);
+//TODO: this should be moved to the handler, the operations should not contain ui code
+ DeleteResult result = service.deleteSynonym(synonym.getUuid(), element.getUuid(), null);
if (result.isError()){
- MessageDialog.openError(null, "Delete failed", result.toString());
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "Delete failed", TaxeditorEditorPlugin.PLUGIN_ID);
} else if (!result.getUpdatedObjects().isEmpty()){
- MessageDialog.openInformation(null, "Delete successfull", "The Synonym could be deleted, but there is an updated object: " + result.toString());
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "The Synonym could be deleted, but related object(s) could not be deleted", TaxeditorEditorPlugin.PLUGIN_ID);
}
}
// taxon.removeSynonym(synonym);
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;\r
\r
public class DeleteTaxonBaseOperation extends AbstractPersistentPostOperation {\r
\r
protected TaxonDeletionConfigurator configurator;\r
\r
- public DeleteTaxonBaseOperation(String label, IUndoContext undoContext,\r
- TaxonDeletionConfigurator configurator, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {\r
- super(label, undoContext, postOperationEnabled,\r
- conversationEnabled);\r
+ public DeleteTaxonBaseOperation(String label,\r
+ IUndoContext undoContext,\r
+ TaxonDeletionConfigurator configurator,\r
+ IWorkbenchPage activePage,\r
+ IPostOperationEnabled postOperationEnabled,\r
+ IConversationEnabled conversationEnabled,\r
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);\r
this.configurator = configurator;\r
\r
}\r
import org.eclipse.core.runtime.IAdaptable;\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.ui.IWorkbenchPage;\r
\r
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;\r
import eu.etaxonomy.cdm.model.taxon.Classification;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;\r
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{\r
\r
private final Classification classification;\r
\r
- public DeleteTaxonOperation(String label, IUndoContext undoContext,\r
- Taxon taxon, TaxonDeletionConfigurator configurator, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {\r
- super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled);\r
+ public DeleteTaxonOperation(String label,\r
+ IUndoContext undoContext,\r
+ Taxon taxon,\r
+ TaxonDeletionConfigurator configurator,\r
+ Classification classification,\r
+ IWorkbenchPage activePage,\r
+ IPostOperationEnabled postOperationEnabled,\r
+ IConversationEnabled conversationEnabled,\r
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
+ super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);\r
this.element = taxon;\r
\r
Set<TaxonNode> nodes = taxon.getTaxonNodes();\r
\r
ITaxonService service = controller.getTaxonService();\r
\r
-\r
DeleteResult result = service.deleteTaxon(element.getUuid(), configurator, classification.getUuid());\r
+
if (result.isError()){\r
- MessageDialog.openError(null, "Delete failed", result.toString());\r
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "Delete failed", TaxeditorEditorPlugin.PLUGIN_ID);\r
} else if (!result.getUpdatedObjects().isEmpty()){\r
- MessagingUtils.informationDialog("Delete successfull", result.toString());\r
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "The Taxon was deleted, but related object(s) could not be deleted", TaxeditorEditorPlugin.PLUGIN_ID);\r
}\r
\r
monitor.worked(40);\r
import org.eclipse.core.runtime.IStatus;\r
\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
+import eu.etaxonomy.cdm.api.service.UpdateResult;\r
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;\r
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
import eu.etaxonomy.cdm.model.taxon.Synonym;\r
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;\r
-import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;\r
private final Synonym synonym;\r
\r
private final Taxon oldTaxon;\r
- \r
- \r
+\r
+\r
/**\r
* <p>Constructor for MoveSynonymToAnotherAcceptedTaxon.</p>\r
*\r
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.\r
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.\r
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.\r
- \r
+\r
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.\r
*/\r
public MoveSynonymToAnotherAcceptedTaxonOperation(String label, IUndoContext undoContext,\r
UUID oldTaxonUUID, UUID synonymUUID, Taxon taxon, IPostOperationEnabled postOperationEnabled) {\r
- \r
+\r
super(label, undoContext, taxon, postOperationEnabled);\r
List<String> propertyPaths = new ArrayList<String>();\r
propertyPaths.add("synonymRelations");\r
TaxonNameBase<?, ?> synonymName = synonym.getName();\r
monitor.worked(20);\r
\r
- \r
+\r
\r
// Switch groups\r
- \r
+\r
monitor.worked(40);\r
SynonymRelationship synRel = synonym.getSynonymRelations().iterator().next();\r
- \r
- \r
- \r
+\r
+\r
+\r
((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();\r
- \r
- \r
- \r
+ UpdateResult result;\r
+\r
+\r
try {\r
- synRel = CdmStore.getService(ITaxonService.class).moveSynonymToAnotherTaxon(synRel, this.element, true, synRel.getType(), null, null, true);\r
+ result = CdmStore.getService(ITaxonService.class).moveSynonymToAnotherTaxon(synRel,\r
+ this.element.getUuid(),\r
+ true,\r
+ synRel.getType(),\r
+ null,\r
+ null,\r
+ true);\r
} catch (HomotypicalGroupChangeException e) {\r
// TODO Auto-generated catch block\r
e.printStackTrace();\r
}\r
((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();\r
- \r
- \r
+\r
+\r
\r
// Redraw editor if it exists\r
return postExecute(synRel.getSynonym());\r
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
*/
public SwapSynonymAndAcceptedOperation(String label, IUndoContext undoContext,
- Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
- super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled);
+ Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled);
this.synonym = synonym;
}
monitor.worked(20);
- CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym, element);
+ UpdateResult result = CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym.getUuid(), element.getUuid());
monitor.worked(40);
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @version 1.0
*/
public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData,
- IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable {
+ IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable, ICdmEntitySessionEnabled {
private static final Logger logger = Logger.getLogger(ChecklistEditor.class);
/**
private Label statusLabel;
+ private final ICdmEntitySession cdmEntitySession;
+
private SortedSet<DefinedTermBase> terms = null;
private ToolItem toolItem;
private ChecklistDropdownSelectionListener dropListener;
* </p>
*/
public ChecklistEditor() {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
public void dispose() {
+ cdmEntitySession.dispose();
super.dispose();
}
/** {@inheritDoc} */
@Override
public void setFocus() {
+ cdmEntitySession.bind();
viewer.getControl().setFocus();
}
public boolean isDirty() {
return dirty;
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
getViewer().refresh();
super.changed(object);
}
+
}
return layoutAlgoritm;
}
+
}
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.dto.FindByIdentifierDTO;
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
}
@Override
- public Team convertPerson2Team(Person arg0) throws MergeException,
+ public UpdateResult convertPerson2Team(Person arg0) throws MergeException,
IllegalArgumentException {
return defaultService.convertPerson2Team(arg0);
}
@Override
- public Person convertTeam2Person(Team arg0) throws MergeException,
+ public UpdateResult convertTeam2Person(Team arg0) throws MergeException,
IllegalArgumentException {
return defaultService.convertTeam2Person(arg0);
}
return defaultService.merge(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<AgentBase>> merge(List<AgentBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<AgentBase> merge(AgentBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public AgentBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IAgentService#convertPerson2Team(java.util.UUID)
+ */
+ @Override
+ public UpdateResult convertPerson2Team(UUID arg0) throws MergeException, IllegalArgumentException {
+ return defaultService.convertPerson2Team(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IAgentService#convertTeam2Person(java.util.UUID)
+ */
+ @Override
+ public UpdateResult convertTeam2Person(UUID arg0) throws MergeException {
+ return defaultService.convertTeam2Person(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<AgentBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+ @Override
+ public List<Person> getAllAgentsUsedAsUser(){
+ return defaultService.getAllAgentsUsedAsUser();
+ }
}
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.IAnnotationService;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.ICollectionService;
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;
import eu.etaxonomy.cdm.api.service.IEntityValidationService;
+import eu.etaxonomy.cdm.api.service.IEventBaseService;
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
import eu.etaxonomy.cdm.api.service.IIdentificationKeyService;
import eu.etaxonomy.cdm.api.service.ILocationService;
import eu.etaxonomy.cdm.api.service.IMediaService;
+import eu.etaxonomy.cdm.api.service.IMetadataService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
return defaultApplicationConfiguration.getSequenceService();
}
+ @Override
+ public IEventBaseService getEventBaseService() {
+ return defaultApplicationConfiguration.getEventBaseService();
+ }
+
@Override
public IEntityConstraintViolationService getEntityConstraintViolationService() {
return defaultApplicationConfiguration.getEntityConstraintViolationService();
public IEntityValidationService getEntityValidationService() {
return defaultApplicationConfiguration.getEntityValidationService();
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration#getAnnotationService()
+ */
+ @Override
+ public IAnnotationService getAnnotationService() {
+ return defaultApplicationConfiguration.getAnnotationService();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IProgressMonitorService getProgressMonitorService() {
+ return defaultApplicationConfiguration.getProgressMonitorService();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IMetadataService getMetadataService() {
+ return defaultApplicationConfiguration.getMetadataService();
+ }
}
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
* @see eu.etaxonomy.cdm.api.service.IClassificationService#getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(eu.etaxonomy.cdm.model.taxon.Classification)
*/
@Override
- public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification) {
- return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification);
+ public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(Classification classification, List<UUID> excludeTaxa) {
+ return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification, excludeTaxa);
}
/**
return defaultService.merge(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<Classification>> merge(List<Classification> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<Classification> merge(Classification arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public Classification loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+
+ @Override
+ public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(
+ UUID classificationUuid, List<UUID> excludeTaxa) {
+
+ return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classificationUuid, excludeTaxa);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Classification> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
}
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
return defaultService.merge(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<Collection>> merge(List<Collection> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<Collection> merge(Collection arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public Collection loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Collection> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+
}
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
*/
@Deprecated
@Override
- public Pager<DescriptionElementBase> getDescriptionElements(DescriptionBase description, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+ public <T extends DescriptionElementBase> Pager<T> getDescriptionElements(DescriptionBase description, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
return defaultService.getDescriptionElements(description, features, type, pageSize, pageNumber, propertyPaths);
}
* @see eu.etaxonomy.cdm.api.service.IDescriptionService#pageDescriptionElements(eu.etaxonomy.cdm.model.description.DescriptionBase, java.lang.Class, java.util.Set, java.lang.Class, java.lang.Integer, java.lang.Integer, java.util.List)
*/
@Override
- public Pager<DescriptionElementBase> pageDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+ public <T extends DescriptionElementBase> Pager<T> pageDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
return defaultService.pageDescriptionElements(description, descriptionType, features, type, pageSize, pageNumber, propertyPaths);
}
*/
@Deprecated
@Override
- public List<DescriptionElementBase> listDescriptionElements(DescriptionBase description, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+ public <T extends DescriptionElementBase> List<T> listDescriptionElements(DescriptionBase description, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
return defaultService.listDescriptionElements(description, features, type, pageSize, pageNumber, propertyPaths);
}
* @see eu.etaxonomy.cdm.api.service.IDescriptionService#listDescriptionElements(eu.etaxonomy.cdm.model.description.DescriptionBase, java.lang.Class, java.util.Set, java.lang.Class, java.lang.Integer, java.lang.Integer, java.util.List)
*/
@Override
- public List<DescriptionElementBase> listDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<? extends DescriptionElementBase> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+ public <T extends DescriptionElementBase> List<T> listDescriptionElements(DescriptionBase description, Class<? extends DescriptionBase> descriptionType, Set<Feature> features, Class<T> type, Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
return defaultService.listDescriptionElements(description, descriptionType, features, type, pageSize, pageNumber, propertyPaths);
}
* @param descriptionElements
* @param targetDescription
* @param isPaste
+ * @return
* @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveDescriptionElementsToDescription(java.util.Collection, eu.etaxonomy.cdm.model.description.DescriptionBase, boolean)
*/
@Override
- public void moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements, DescriptionBase targetDescription, boolean isPaste) {
- defaultService.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isPaste);
+ public UpdateResult moveDescriptionElementsToDescription(Collection<DescriptionElementBase> descriptionElements, DescriptionBase targetDescription, boolean isPaste) {
+ return defaultService.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isPaste);
}
/* (non-Javadoc)
return defaultService.merge(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveDescriptionElementsToDescription(java.util.Set, java.util.UUID, boolean)
+ */
+ @Override
+ public UpdateResult moveDescriptionElementsToDescription(Set<UUID> arg0, UUID arg1, boolean arg2) {
+ return defaultService.moveDescriptionElementsToDescription(arg0, arg1, arg2);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveDescriptionElementsToDescription(java.util.Set, java.util.UUID, java.lang.String, boolean)
+ */
+ @Override
+ public UpdateResult moveDescriptionElementsToDescription(Set<UUID> arg0, UUID arg1, String arg2, boolean arg3) {
+ return defaultService.moveDescriptionElementsToDescription(arg0, arg1, arg2, arg3);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<DescriptionBase>> merge(List<DescriptionBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<DescriptionBase> merge(DescriptionBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public DescriptionBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveTaxonDescription(java.util.UUID, java.util.UUID)
+ */
+ @Override
+ public UpdateResult moveTaxonDescription(UUID arg0, UUID arg1) {
+
+ return defaultService.moveTaxonDescriptions(arg0, arg1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<DescriptionBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
}
import java.util.UUID;
import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryparser.classic.ParseException;
import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
* @see eu.etaxonomy.cdm.api.service.INameService#deleteTypeDesignation(eu.etaxonomy.cdm.model.name.TaxonNameBase, eu.etaxonomy.cdm.model.name.TypeDesignationBase)
*/
@Override
- public void deleteTypeDesignation(TaxonNameBase name, TypeDesignationBase typeDesignation) {
- defaultService.deleteTypeDesignation(name, typeDesignation);
+ public DeleteResult deleteTypeDesignation(TaxonNameBase name, TypeDesignationBase typeDesignation) {
+ return defaultService.deleteTypeDesignation(name, typeDesignation);
+ }
+
+ @Override
+ public DeleteResult deleteTypeDesignation(UUID arg0, UUID arg1) {
+ return defaultService.deleteTypeDesignation(arg0, arg1);
}
/**
public List<TaxonNameBase> merge(List<TaxonNameBase> arg0) {
return defaultService.merge(arg0);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<TaxonNameBase>> merge(List<TaxonNameBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<TaxonNameBase> merge(TaxonNameBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public TaxonNameBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<TaxonNameBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
}
import java.util.UUID;
import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryparser.classic.ParseException;
import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import eu.etaxonomy.cdm.api.service.util.TaxonRelationshipEdge;
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.ISourceable;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
return defaultService.getNonCascadedAssociatedElements(specimen);
}
- @Override
- public DeleteResult deleteDerivateHierarchy(CdmBase from, SpecimenDeleteConfigurator config) {
- return defaultService.deleteDerivateHierarchy(from, config);
- }
-
@Override
public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config) {
return defaultService.delete(specimen, config);
return defaultService.listIndividualsAssociations(specimen, limit, start, orderHints, propertyPaths);
}
- @Override
- public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen,
- Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
- return defaultService.listTypeDesignations(specimen, limit, start, orderHints, propertyPaths);
- }
-
@Override
public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(
SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints,
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
- */
@Override
public DeleteResult delete(UUID uuid) {
return defaultService.delete(uuid);
return defaultService.delete(arg0);
}
- @Override
- public DeleteResult deleteSingleRead(SingleRead singleRead, Sequence sequence){
- return defaultService.deleteSingleRead(singleRead, sequence);
- }
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
- */
@Override
public List<SpecimenOrObservationBase> merge(List<SpecimenOrObservationBase> arg0) {
return defaultService.merge(arg0);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#deleteDerivateHierarchy(java.util.UUID, eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator)
+ @Override
+ public UpdateResult moveDerivate(UUID arg0, UUID arg1, UUID arg2) {
+ return defaultService.moveDerivate(arg0, arg1, arg2);
+ }
+
+ @Override
+ public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate) {
+ return defaultService.moveDerivate(from, to, derivate);
+ }
+
+ @Override
+ public UpdateResult moveSequence(UUID arg0, UUID arg1, UUID arg2) {
+ return defaultService.moveSequence(arg0, arg1, arg2);
+ }
+
+ @Override
+ public Pager<Media> getMediainHierarchy(SpecimenOrObservationBase arg0, Integer arg1, Integer arg2,
+ List<String> arg3) {
+ return defaultService.getMediainHierarchy(arg0, arg1, arg2, arg3);
+ }
+
+ @Override
+ public List<MergeResult<SpecimenOrObservationBase>> merge(List<SpecimenOrObservationBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ @Override
+ public MergeResult<SpecimenOrObservationBase> merge(SpecimenOrObservationBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /**
+ * {@inheritDoc}
*/
@Override
- public DeleteResult deleteDerivateHierarchy(UUID arg0, SpecimenDeleteConfigurator arg1) {
- return defaultService.deleteDerivateHierarchy(arg0, arg1);
+ public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> arg0, Integer arg1, Integer arg2,
+ List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listAssociatedTaxa(arg0, arg1, arg2, arg3, arg4);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#deleteSingleRead(java.util.UUID, java.util.UUID)
+ @Override
+ public SpecimenOrObservationBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
*/
@Override
- public DeleteResult deleteSingleRead(UUID arg0, UUID arg1) {
- return defaultService.deleteSingleRead(arg0, arg1);
+ public DeleteResult delete(UUID arg0, SpecimenDeleteConfigurator arg1) {
+ return defaultService.delete(arg0, arg1);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveDerivate(java.util.UUID, java.util.UUID, java.util.UUID)
+ /**
+ * {@inheritDoc}
*/
@Override
- public UpdateResult moveDerivate(UUID arg0, UUID arg1, UUID arg2) {
- return defaultService.moveDerivate(arg0, arg1, arg2);
+ public Pager<SpecimenOrObservationBase> list(Class<? extends SpecimenOrObservationBase> arg0, TaxonNameBase arg1,
+ Integer arg2, Integer arg3, List<OrderHint> arg4, List<String> arg5) {
+ return defaultService.list(arg0, arg1, arg2, arg3, arg4, arg5);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveDerivate(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
+ /**
+ * {@inheritDoc}
*/
@Override
- public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate) {
- return defaultService.moveDerivate(from, to, derivate);
+ public Collection<DeterminationEvent> listDeterminationEvents(SpecimenOrObservationBase<?> arg0, Integer arg1,
+ Integer arg2, List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listDeterminationEvents(arg0, arg1, arg2, arg3, arg4);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveSequence(java.util.UUID, java.util.UUID, java.util.UUID)
+ @Override
+ public Collection<TaxonBase<?>> listDeterminedTaxa(SpecimenOrObservationBase<?> arg0, Integer arg1, Integer arg2,
+ List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listDeterminedTaxa(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public Collection<TaxonBase<?>> listIndividualsAssociationTaxa(SpecimenOrObservationBase<?> arg0, Integer arg1,
+ Integer arg2, List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listIndividualsAssociationTaxa(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ /**
+ * {@inheritDoc}
*/
@Override
- public UpdateResult moveSequence(UUID arg0, UUID arg1, UUID arg2) {
- return defaultService.moveSequence(arg0, arg1, arg2);
+ public List<SpecimenOrObservationBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+ @Override
+ public Collection<TaxonBase<?>> listTypeDesignationTaxa(DerivedUnit arg0, Integer arg1, Integer arg2,
+ List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listTypeDesignationTaxa(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public Map<DerivedUnit, Collection<SpecimenTypeDesignation>> listTypeDesignations(Collection<DerivedUnit> arg0,
+ Integer arg1, Integer arg2, List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listTypeDesignations(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public Collection<SpecimenTypeDesignation> listTypeDesignations(DerivedUnit arg0, Integer arg1, Integer arg2,
+ List<OrderHint> arg3, List<String> arg4) {
+ return defaultService.listTypeDesignations(arg0, arg1, arg2, arg3, arg4);
+ }
+
+ @Override
+ public List<DerivedUnit> getAllChildDerivatives(UUID arg0) {
+ return defaultService.getAllChildDerivatives(arg0);
}
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
public List<Reference> merge(List<Reference> arg0) {
return defaultService.merge(arg0);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
+ */
+ @Override
+ public List<MergeResult<Reference>> merge(List<Reference> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<Reference> merge(Reference arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public Reference loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Reference> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+
}
import java.util.UUID;
import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryparser.classic.ParseException;
import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.fetch.CdmFetch;
import eu.etaxonomy.cdm.persistence.query.Grouping;
* @see eu.etaxonomy.cdm.api.service.ITaxonService#moveSynonymToAnotherTaxon(eu.etaxonomy.cdm.model.taxon.SynonymRelationship, eu.etaxonomy.cdm.model.taxon.Taxon, boolean, eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String, boolean)
*/
@Override
- public SynonymRelationship moveSynonymToAnotherTaxon(SynonymRelationship oldSynonymRelation, Taxon newTaxon, boolean moveHomotypicGroup, SynonymRelationshipType newSynonymRelationshipType, Reference newReference, String newReferenceDetail, boolean keepReference) throws HomotypicalGroupChangeException {
+ public UpdateResult moveSynonymToAnotherTaxon(SynonymRelationship oldSynonymRelation, Taxon newTaxon, boolean moveHomotypicGroup, SynonymRelationshipType newSynonymRelationshipType, Reference newReference, String newReferenceDetail, boolean keepReference) throws HomotypicalGroupChangeException {
return defaultService.moveSynonymToAnotherTaxon(oldSynonymRelation, newTaxon, moveHomotypicGroup, newSynonymRelationshipType, newReference, newReferenceDetail, keepReference);
}
public List<List<Synonym>> getSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths) {
return defaultService.getSynonymsByHomotypicGroup(taxon, propertyPaths);
}
-
+
@Override
public Synonym changeRelatedTaxonToSynonym(Taxon fromTaxon, Taxon toTaxon,
TaxonRelationshipType oldRelationshipType,
return defaultService.deleteSynonym(arg0, arg1);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#changeSynonymToRelatedTaxon(java.util.UUID, java.util.UUID, eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)
+ */
+ @Override
+ public UpdateResult changeSynonymToRelatedTaxon(UUID arg0, UUID arg1, TaxonRelationshipType arg2, Reference arg3,
+ String arg4) {
+ return defaultService.changeSynonymToRelatedTaxon(arg0, arg1, arg2, arg3, arg4);
+ }
+
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ITaxonService#changeRelatedTaxonToSynonym(java.util.UUID, java.util.UUID, eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType, eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType)
*/
public UpdateResult changeRelatedTaxonToSynonym(UUID arg0, UUID arg1, TaxonRelationshipType arg2,
SynonymRelationshipType arg3) throws DataChangeNoRollbackException {
return defaultService.changeRelatedTaxonToSynonym(arg0, arg1, arg2, arg3);
+
}
/* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ITaxonService#changeSynonymToAcceptedTaxon(java.util.UUID, java.util.UUID, boolean, boolean, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#changeSynonymToAcceptedTaxon(java.util.UUID, java.util.UUID, java.util.UUID, boolean, boolean, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)
*/
@Override
- public Taxon changeSynonymToAcceptedTaxon(UUID arg0, UUID arg1, boolean arg2, boolean arg3, Reference arg4,
- String arg5) throws HomotypicalGroupChangeException {
- return defaultService.changeSynonymToAcceptedTaxon(arg0, arg1, arg2, arg3, arg4, arg5);
+ public UpdateResult changeSynonymToAcceptedTaxon(UUID arg0, UUID arg1, UUID arg2, boolean arg3, boolean arg4,
+ Reference arg5, String arg6) throws HomotypicalGroupChangeException {
+ return defaultService.changeSynonymToAcceptedTaxon(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
}
/* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ITaxonService#changeSynonymToRelatedTaxon(java.util.UUID, java.util.UUID, eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType, eu.etaxonomy.cdm.model.reference.Reference, java.lang.String)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List, boolean)
*/
@Override
- public UpdateResult changeSynonymToRelatedTaxon(UUID arg0, UUID arg1, TaxonRelationshipType arg2, Reference arg3,
- String arg4) {
- return defaultService.changeSynonymToRelatedTaxon(arg0, arg1, arg2, arg3, arg4);
+ public List<MergeResult<TaxonBase>> merge(List<TaxonBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(eu.etaxonomy.cdm.model.common.ICdmBase, boolean)
+ */
+ @Override
+ public MergeResult<TaxonBase> merge(TaxonBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#loadWithUpdate(java.util.UUID)
+ */
+ @Override
+ public TaxonBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<TaxonBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+
}
import eu.etaxonomy.cdm.model.view.AuditEvent;
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.Grouping;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
return defaultService.isDeletable(object, config);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ITermService#listByTermType(eu.etaxonomy.cdm.model.common.TermType, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
- */
@Override
- public List<DefinedTermBase<?>> listByTermType(TermType termType, Integer limit, Integer start,
+ public <T extends DefinedTermBase> List<T> listByTermType(TermType termType, Integer limit, Integer start,
List<OrderHint> orderHints, List<String> propertyPaths) {
return defaultService.listByTermType(termType, limit, start, orderHints, propertyPaths);
}
return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
- */
@Override
public DeleteResult delete(UUID uuid) {
return defaultService.delete(uuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
- */
@Override
public DeleteResult delete(Collection<UUID> arg0) {
return defaultService.delete(arg0);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
- */
@Override
public List<DefinedTermBase> merge(List<DefinedTermBase> arg0) {
return defaultService.merge(arg0);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ITermService#delete(java.util.UUID, eu.etaxonomy.cdm.api.service.config.TermDeletionConfigurator)
- */
@Override
public DeleteResult delete(UUID arg0, TermDeletionConfigurator arg1) {
return defaultService.delete(arg0, arg1);
}
+
+ @Override
+ public List<MergeResult<DefinedTermBase>> merge(List<DefinedTermBase> arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ @Override
+ public MergeResult<DefinedTermBase> merge(DefinedTermBase arg0, boolean arg1) {
+ return defaultService.merge(arg0, arg1);
+ }
+
+ @Override
+ public DefinedTermBase loadWithUpdate(UUID arg0) {
+ return defaultService.loadWithUpdate(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Language getLanguageByLabel(String arg0) {
+ return defaultService.getLanguageByLabel(arg0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<DefinedTermBase> load(List<UUID> arg0, List<String> arg1) {
+ return defaultService.load(arg0, arg1);
+ }
+
+
}
this.derivateView = derivateView;
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
- */
@Override
public void dragSetData(DragSourceEvent event) {
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
- */
@Override
public void dragStart(DragSourceEvent event) {
if(derivateView.isDirty()){
event.doit = false;
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
return;
}
ISelection selection = derivateView.getViewer().getSelection();
import org.eclipse.swt.dnd.TransferData;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.Messages;
import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
this.derivateView = derivateView;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
- */
@Override
public boolean performDrop(Object data) {
if(derivateView.isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
return false;
}
Object target = getCurrentTarget();
TreeNode targetNode = (TreeNode) target;
TreeNode draggedNode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
if(draggedNode!=null){
- MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation("Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\"", EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
+ MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation(String.format(Messages.DerivateDropListener_MOVE_TO, derivateView.getLabelProvider().getDerivateText(draggedNode), derivateView.getLabelProvider().getDerivateText(targetNode)), EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
return AbstractUtility.executeOperation(moveDerivateOperation).equals(Status.OK_STATUS)?true:false;
}
}
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
- */
@Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
package eu.etaxonomy.taxeditor.editor.view.derivate;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
-import java.util.Map.Entry;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.Messages;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
+import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateContentProvider;
import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
* Displays the derivate hierarchy of the specimen specified in the editor input.
*
*/
-public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkable,
- IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia,
- ISelectionChangedListener, IPostOperationEnabled {
-
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
+public class DerivateView extends EditorPart implements IPartContentHasFactualData, IConversationEnabled,
+ ICdmEntitySessionEnabled, IDirtyMarkable, IPostOperationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia,
+ IContextListener, ISelectionListener {
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"; //$NON-NLS-1$
+
+ public static final String YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION = Messages.DerivateView_YOU_NEED_TO_SAVE;
+ public static final String VIEW_HAS_UNSAVED_CHANGES = Messages.DerivateView_UNSAVED_CHANGES;
+
+ private static final List<String> SPECIMEN_INIT_STRATEGY = Arrays.asList(new String[] {
+ "descriptions",
+ "annotations",
+ "markers",
+ "credits",
+ "extensions",
+ "rights",
+ "sources",
+ "derivationEvents.derivatives.annotations",
+ "derivationEvents.derivatives.markers",
+ "derivationEvents.derivatives.credits",
+ "derivationEvents.derivatives.extensions",
+ "derivationEvents.derivatives.rights",
+ "derivationEvents.derivatives.sources"
+ });
private ConversationHolder conversation;
private DerivateLabelProvider labelProvider;
- private Set<SingleRead> multiLinkSingleReads;
+ private DerivateContentProvider contentProvider;
+
+ private DerivateSearchCompositeController derivateSearchCompositeController;
+
+ /**
+ * A map with keys being the derivative entities belonging to the {@link UUID}s passed to the constructor
+ * and values being the root elements of the hierarchy (may be the same objects as the derivative entities)
+ */
+ private Map<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>> derivateToRootEntityMap;
+
+ /**
+ * The set of root elements
+ */
+ private Set<SpecimenOrObservationBase<?>> rootElements;
+
+ private ICdmEntitySession cdmEntitySession;
- private ISelection selection = null;
+ /**
+ * <code>true</code> if this view is listening to selection changes
+ */
+ private boolean listenToSelectionChange;
+
+ private Taxon selectedTaxon;
+
+ private ISelectionService selectionService;
/**
* Default constructor
public DerivateView() {
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ this.setSite(site);
+ this.setInput(input);
+ this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
+ this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+
+ if (CdmStore.isActive() && conversation == null) {
+ conversation = CdmStore.createConversation();
+ }
+ if (CdmStore.isActive()) {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ }
+ //listen to context changes
+ CdmStore.getContextManager().addContextListener(this);
+ }
+
@Override
public void createPartControl(Composite parent) {
+
+ parent.setLayout(new GridLayout());
+
+ //---search and filter---
+ derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
+ GridData gridDataSearchBar = new GridData();
+ gridDataSearchBar.horizontalAlignment = GridData.FILL;
+ gridDataSearchBar.grabExcessHorizontalSpace = true;
+ derivateSearchCompositeController.setLayoutData(gridDataSearchBar);
+ derivateSearchCompositeController.setEnabled(CdmStore.isActive());
+
+ //---tree viewer---
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
- viewer.setContentProvider(new DerivateContentProvider());
+ GridData gridDataTree = new GridData();
+ gridDataTree.horizontalAlignment = GridData.FILL;
+ gridDataTree.verticalAlignment = GridData.FILL;
+ gridDataTree.grabExcessVerticalSpace = true;
+ gridDataTree.grabExcessHorizontalSpace = true;
+ viewer.getTree().setLayoutData(gridDataTree);
+ contentProvider = new DerivateContentProvider();
+ viewer.setContentProvider(contentProvider);
labelProvider = new DerivateLabelProvider();
labelProvider.setConversation(conversation);
viewer.setLabelProvider(labelProvider);
viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+ viewer.getTree().setEnabled(CdmStore.isActive());
// Propagate selection from viewer
getSite().setSelectionProvider(viewer);
+
//listen to selection changes
- viewer.addSelectionChangedListener(this);
+ selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(this);
//create context menu
MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
getSite().registerContextMenu(menuManager, viewer);
Control control = viewer.getControl();
Menu menu = menuManager.createContextMenu(control);
control.setMenu(menu);
- generateMultiLinkSingleReads();
- labelProvider.setMultiLinkSingleReads(multiLinkSingleReads);
- IEditorInput editorInput = getEditorInput();
- viewer.setInput(((DerivateViewEditorInput) editorInput).getRootUUIDs());
- //set selection to selected derivate if only one was selected
- if(editorInput instanceof DerivateViewEditorInput){
- Set<UUID> derivateUUIDs = ((DerivateViewEditorInput) editorInput).getDerivateUUIDs();
- if(derivateUUIDs.size()==1){
- SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(derivateUUIDs.iterator().next());
- if(specimen!=null){
- viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
- }
- }
- }
+ //init tree
+ updateRootEntities(((DerivateViewEditorInput)getEditorInput()).getDerivativeUuids());
+ //set taxon filter
+ derivateSearchCompositeController.setTaxonFilter(((DerivateViewEditorInput) getEditorInput()).getTaxonUuid());
+ //reset status bar
+ getEditorSite().getActionBars().getStatusLineManager().setMessage("");
//add drag'n'drop support
Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer(),};
viewer.addDropSupport(dndOperations, transfers, new DerivateDropListener(this));
}
+ public void updateRootEntities() {
+ updateRootEntities((Collection)null);
+ }
+
+ public void updateRootEntities(Collection<UUID> derivativeUuids) {
+ if(conversation!=null){
+ if (!conversation.isBound()) {
+ conversation.bind();
+ }
+ /*
+ * If the active session is not the session of the Derivative Editor
+ * then we will save the active session for later, bind temporarily
+ * to our session and rebind to the original session when we are
+ * done. This happens e.g. if a selection change happens in the
+ * taxon editor and "Link with editor" is enabled. The selection
+ * change event and thus the loading in updateRootEntities() happens
+ * in the session of the taxon editor.
+ */
+ ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
+
+ List<SpecimenOrObservationBase> derivates = null;
+ if(derivativeUuids!=null){
+ this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
+ this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+ derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
+ }
+ updateRootEntities(derivates);
+ previousCdmEntitySession.bind();
+ }
+ }
+
+
+ public void updateRootEntities(List<SpecimenOrObservationBase> derivates) {
+ if(derivates!=null){
+ this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
+ this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+ for (SpecimenOrObservationBase derivate : derivates) {
+
+ if(derivate instanceof FieldUnit){
+ derivateToRootEntityMap.put(derivate, derivate);
+ }
+ else {
+ SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
+ if(topMostDerivate!=null){
+ derivateToRootEntityMap.put(derivate, topMostDerivate);
+ }
+ else{
+ derivateToRootEntityMap.put(derivate, derivate);
+ }
+ }
+ }
+ for (SpecimenOrObservationBase<?> specimen : derivateToRootEntityMap.values()) {
+ rootElements.add(specimen);
+ }
+ }
+ labelProvider.updateLabelCache(rootElements);
+ viewer.setInput(rootElements);
+
+ getEditorSite().getActionBars().getStatusLineManager().setMessage(rootElements.size() +" derivative hierarchies found");
+
+ //set selection to derivatives if the filter criteria
+ //taxon assignment or derivative type are set
+ if(derivates!=null && !derivateSearchCompositeController.isDefaultSearch()){
+ List<TreeNode> nodesToSelect = new ArrayList<TreeNode>();
+ for (SpecimenOrObservationBase specimenOrObservationBase : derivates) {
+ nodesToSelect.add(new TreeNode(specimenOrObservationBase));
+ }
+ viewer.setSelection(new StructuredSelection(nodesToSelect));
+ }
+ else{
+ viewer.setSelection(null);
+ }
+
+ }
+
+ public void updateLabelCache(){
+ labelProvider.updateLabelCache(rootElements);
+ }
+
@Override
public void doSave(IProgressMonitor monitor) {
- String taskName = "Saving hierarchy";
- if(getEditorInput() instanceof DerivateViewEditorInput){
- DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
- taskName += " "+derivateViewEditorInput.getName();
- }
+ String taskName = Messages.DerivateView_SAVING_HIERARCHY;
monitor.beginTask(taskName, 3);
if (!conversation.isBound()) {
conversation.bind();
// commit the conversation and start a new transaction immediately
conversation.commit(true);
+
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge(new ArrayList<SpecimenOrObservationBase>(rootElements), true);
+ }
monitor.worked(1);
this.setDirty(false);
@Override
public String getTitleToolTip() {
- if(getEditorInput() instanceof DerivateViewEditorInput){
- DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
- return derivateViewEditorInput.getName();
- }
- return "Derivative Editor";
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- if(input instanceof DerivateViewEditorInput){
- DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) input;
- conversation = derivateViewEditorInput.getConversationHolder();
- setPartName(derivateViewEditorInput.getName());
- }
+ return Messages.DerivateView_DERIVATIVE_EDITOR;
}
@Override
public void setFocus() {
viewer.getControl().setFocus();
//make sure to bind again if maybe in another view the conversation was unbound
- if(!conversation.isBound()){
+ if(conversation!=null && !conversation.isBound()){
conversation.bind();
}
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
}
@Override
return conversation;
}
- /**
- * @return the viewer
- */
- public TreeViewer getViewer() {
- return viewer;
- }
-
@Override
public void changed(Object element) {
setDirty(true);
firePropertyChange(IEditorPart.PROP_DIRTY);
- viewer.refresh();
+ viewer.update(new TreeNode(element), null);
}
@Override
changed(null);
}
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ List<String> specimenPropertyPaths = Arrays.asList(new String[] {
+ "descriptions",
+ "derivationEvents.derivates",
+ "annotations",
+ "markers",
+ "credits",
+ "extensions",
+ "rights",
+ "sources"
+ });
+ Map<Object, List<String>> specimenPropertyPathMap =
+ new HashMap<Object, List<String>>();
+ specimenPropertyPathMap.put(SpecimenOrObservationBase.class,specimenPropertyPaths);
+ return specimenPropertyPathMap;
+ }
+
/**
* Refreshes the derivate hierarchy tree and expands the tree
* to show and select the given object.
* Refreshes the derivate hierarchy tree
*/
public void refreshTree(){
- generateMultiLinkSingleReads();
- labelProvider.setMultiLinkSingleReads(multiLinkSingleReads);
viewer.refresh();
}
- private void generateMultiLinkSingleReads() {
- Set<SingleRead> multiLinkSingleReads = new HashSet<SingleRead>();
- for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
- if(entry.getValue().size()>1){
- multiLinkSingleReads.add(entry.getKey());
- }
- }
- this.multiLinkSingleReads = multiLinkSingleReads;
+ //FIXME:Remoting hack to make this work for remoting
+ //This should actually be resolved using remoting post operations
+ public void remove(Object obj) {
+ rootElements.remove(obj);
+ viewer.setInput(rootElements);
}
/**
* @return a set of {@link SingleRead}s that have multiple parents
*/
public Set<SingleRead> getMultiLinkSingleReads() {
- return this.multiLinkSingleReads;
+ return DerivateLabelProvider.getMultiLinkSingleReads();
}
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- this.selection = event.getSelection();
- }
-
- public ISelection getSelection() {
- return selection;
+ public Object getSelectionInput() {
+ return selectedTaxon;
}
public DerivateLabelProvider getLabelProvider() {
return true;
}
+
@Override
public boolean canAttachMedia() {
return true;
}
+ public void addFieldUnit(FieldUnit fieldUnit) {
+ rootElements.add(fieldUnit);
+ derivateToRootEntityMap.put(fieldUnit, fieldUnit);
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if(conversation!=null){
+ conversation.close();
+ }
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ }
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if(part == this){
+ return;
+ }
+ if(viewer.getTree().isDisposed()){
+ return;
+ }
+ if(listenToSelectionChange){
+ if(part instanceof MultiPageTaxonEditor){
+ selectedTaxon = ((MultiPageTaxonEditor) part).getTaxon();
+ }
+ else if(selection instanceof IStructuredSelection){
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if(selectedElement instanceof CdmBase){
+ if(((CdmBase) selectedElement).isInstanceOf(TaxonNode.class)){
+ selectedTaxon = HibernateProxyHelper.deproxy(selectedElement, TaxonNode.class).getTaxon();
+ }
+ else if(((CdmBase) selectedElement).isInstanceOf(Taxon.class)){
+ selectedTaxon = HibernateProxyHelper.deproxy(selectedElement, Taxon.class);
+ }
+ }
+ }
+ if(selectedTaxon!=null){
+ Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon(selectedTaxon, null, null);
+ Collection<UUID> uuids = new HashSet<UUID>();
+ for (SpecimenOrObservationBase specimenOrObservationBase : fieldUnits) {
+ uuids.add(specimenOrObservationBase.getUuid());
+ }
+ updateRootEntities(uuids);
+ setPartName("Derivative Editor: " + selectedTaxon.getName());
+ }
+ }
+ }
+
+ public TreeViewer getViewer() {
+ return viewer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<SpecimenOrObservationBase<?>> getRootEntities() {
+ return new ArrayList<SpecimenOrObservationBase<?>>(rootElements);
+ }
+
+ public void toggleListenToSelectionChange() {
+ listenToSelectionChange = !listenToSelectionChange;
+ derivateSearchCompositeController.setEnabled(!listenToSelectionChange);
+ if(!listenToSelectionChange){
+ selectedTaxon = null;
+ setPartName("Derivative Editor");
+ }
+ else if(selectedTaxon==null){
+ setPartName("Derivative Editor [no taxon selected]");
+ }
+ }
+
+ public boolean isListenToSelectionChange(){
+ return listenToSelectionChange;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ derivateSearchCompositeController.setEnabled(false);
+ if(!viewer.getTree().isDisposed()) {
+ viewer.getTree().setEnabled(false);
+ viewer.setInput(null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+ derivateSearchCompositeController.setEnabled(!listenToSelectionChange);
+ if(!viewer.getTree().isDisposed()){
+ viewer.getTree().setEnabled(true);
+ }
+ refreshTree();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextRefresh(IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ }
+
}
*/
package eu.etaxonomy.taxeditor.editor.view.derivate;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Collection;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
-
/**
- * Editor input for the {@link DerivateView} which holds the currently selected derivate for which
- * the derivate hierarchy should be shown in the DerivateView.<br>
- * It also holds a {@link SpecimenOrObservationBase} which is the root of the hierarchy. (both may be the same object)
+ * Editor input for the {@link DerivateView}
+ *
* @author pplitzner
- * @date 25.11.2013
+ * @date Nov 11, 2015
*
*/
-public class DerivateViewEditorInput implements IEditorInput{
-
- /**
- * The selected derivate {@link UUID}s
- */
- private final Set<UUID> derivateUUIDs;
- /**
- * List of the {@link UUID}s of the root elements of the hierarchy (may be the same objects as the derivates)
- */
- private Set<UUID> rootUUIDs;
-
- private final ConversationHolder conversationHolder;
-
- /**
- * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
- * corresponding {@link FieldUnit}s (both may be the same object).
- * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
- * @param rootUUIDs the root of the hierarchy
- */
- public DerivateViewEditorInput(Set<UUID> derivateUuids) {
- super();
- this.conversationHolder = CdmStore.createConversation();
- this.derivateUUIDs = derivateUuids;
- this.rootUUIDs = new HashSet<UUID>();
- for (UUID uuid : derivateUuids) {
- SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(uuid);
- if(derivate instanceof FieldUnit){
- rootUUIDs.add(uuid);
- }
- else if(derivate instanceof DerivedUnit){
- SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
- if(topMostDerivate!=null){
- rootUUIDs.add(topMostDerivate.getUuid());
- }
- }
- }
- if(rootUUIDs.isEmpty()){
- rootUUIDs = derivateUUIDs;
- }
- if(rootUUIDs.isEmpty()){
- MessagingUtils.messageDialog("Failed initializing editor", DerivateViewEditorInput.class, "No root element found!");
- }
+public class DerivateViewEditorInput implements IEditorInput {
+
+ private Collection<UUID> derivativeUuids;
+ private UUID taxonUuid;
+
+ public DerivateViewEditorInput() {
+ }
+
+ public DerivateViewEditorInput(Collection<UUID> derivativeUuids, UUID taxonUuid) {
+ this.derivativeUuids = derivativeUuids;
+ this.taxonUuid = taxonUuid;
+ }
+
+ public DerivateViewEditorInput(Collection<UUID> derivativeUuids) {
+ this(derivativeUuids, null);
+ }
+
+ public Collection<UUID> getDerivativeUuids() {
+ return derivativeUuids;
+ }
+
+ public UUID getTaxonUuid() {
+ return taxonUuid;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
@Override
public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
@Override
public boolean exists() {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
@Override
public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
@Override
public String getName() {
return getEditorName();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
@Override
public IPersistableElement getPersistable() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
@Override
public String getToolTipText() {
return getEditorName();
}
private String getEditorName() {
- String name = null;
- for(UUID uuid:rootUUIDs){
- SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(uuid);
- if(specimen!=null){
- if(name==null){
- name = DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
- }
- else{
- name += " + "+DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
- }
- }
- }
- return name;
- }
-
- public Set<UUID> getRootUUIDs() {
- return rootUUIDs;
+ return "Derivative Editor";
}
- public Set<UUID> getDerivateUUIDs() {
- return derivateUUIDs;
- }
-
- public void addRootUuid(UUID root){
- rootUUIDs.add(root);
- }
-
-
- public ConversationHolder getConversationHolder() {
- return conversationHolder;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((rootUUIDs == null) ? 0 : rootUUIDs.hashCode());
- return result;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
- if (rootUUIDs == null) {
- if (other.rootUUIDs != null) {
- return false;
- }
- } else if (!rootUUIDs.equals(other.rootUUIDs)) {
- return false;
- }
- return true;
- }
-
-
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate;
+
+import org.eclipse.core.expressions.PropertyTester;
+
+public class DerivativeEditorPropertyTester extends PropertyTester {
+
+ public DerivativeEditorPropertyTester() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ DerivateView derivateView = (DerivateView)receiver;
+ if(property.equals("isLinkedWithTaxonSelection")){
+ return derivateView.isListenToSelectionChange();
+ }
+ return false;
+ }
+
+}
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.CompoundContributionItem;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.Messages;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
/**
*/
public class CreateDerivateContextMenu extends CompoundContributionItem {
+ private static final String SINGLE_READ = Messages.CreateDerivateContextMenu_SINGLE_READ;
+ private static final String CONSENSUS_SEQUENCE = Messages.CreateDerivateContextMenu_SEQUENCE;
+ private static final String MEDIA_SPECIMEN = Messages.CreateDerivateContextMenu_MEDIA_SPECIMEN;
+ private static final String DNA_SAMPLE = Messages.CreateDerivateContextMenu_DNA_SAMPLE;
+ private static final String TISSUE_SAMPLE = Messages.CreateDerivateContextMenu_TISSUE_SAMPLE;
+ private static final String SPECIMEN = Messages.CreateDerivateContextMenu_SPECIMEN;
+
@Override
protected IContributionItem[] getContributionItems() {
IContributionItem[] contributionItems = new IContributionItem[] {
@Override
public void fill(Menu menu, int index) {
MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
- addItem.setText("Add...");
+ addItem.setText(Messages.CreateDerivateContextMenu_ADD);
Menu addMenu = new Menu(menu);
addItem.setMenu(addMenu);
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if(selectedTreeNode!=null){
//context menu for FieldUnit
if(selectedTreeNode.getValue() instanceof FieldUnit){
- createMenuItem(addMenu, "Specimen", selectedTreeNode, DerivedUnit.class, SpecimenOrObservationType.PreservedSpecimen, DerivationEventType.GATHERING_IN_SITU());
+ createMenuItem(addMenu, SPECIMEN, selectedTreeNode, DerivedUnit.class, SpecimenOrObservationType.PreservedSpecimen, DerivationEventType.GATHERING_IN_SITU());
new MenuItem(addMenu, SWT.SEPARATOR);
- createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample, DerivationEventType.PREPARATION());
- createMenuItem(addMenu, "DNA Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
- createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ createMenuItem(addMenu, TISSUE_SAMPLE, selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample, DerivationEventType.PREPARATION());
+ createMenuItem(addMenu, DNA_SAMPLE, selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
+ createMenuItem(addMenu, MEDIA_SPECIMEN, selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ return;
}
//context menu for Specimen
else if(selectedTreeNode.getValue() instanceof DerivedUnit && ((DerivedUnit)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
- createMenuItem(addMenu, "Tissue Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample, DerivationEventType.PREPARATION());
- createMenuItem(addMenu, "DNA Sample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
- createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ createMenuItem(addMenu, TISSUE_SAMPLE, selectedTreeNode, DnaSample.class, SpecimenOrObservationType.TissueSample, DerivationEventType.PREPARATION());
+ createMenuItem(addMenu, DNA_SAMPLE, selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
+ createMenuItem(addMenu, MEDIA_SPECIMEN, selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ return;
}
//context menu for TissueSample
else if(selectedTreeNode.getValue() instanceof DnaSample && ((DnaSample)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.TissueSample){
- createMenuItem(addMenu, "DnaSample", selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
- createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ createMenuItem(addMenu, DNA_SAMPLE, selectedTreeNode, DnaSample.class, SpecimenOrObservationType.DnaSample, DerivationEventType.DNA_EXTRACTION());
+ createMenuItem(addMenu, MEDIA_SPECIMEN, selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ return;
}
//context menu for DnaSample
else if(selectedTreeNode.getValue() instanceof DnaSample && ((DnaSample)selectedTreeNode.getValue()).getRecordBasis()==SpecimenOrObservationType.DnaSample){
- createMenuItem(addMenu, "Consensus Sequence", selectedTreeNode, Sequence.class, null, null);
- createMenuItem(addMenu, "Media Specimen", selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ createMenuItem(addMenu, CONSENSUS_SEQUENCE, selectedTreeNode, Sequence.class, null, null);
+ createMenuItem(addMenu, MEDIA_SPECIMEN, selectedTreeNode, MediaSpecimen.class, SpecimenOrObservationType.Media, DerivationEventType.ACCESSIONING());
+ return;
}
//context menu for Sequence
else if(selectedTreeNode.getValue() instanceof Sequence){
- createMenuItem(addMenu, "Single Read", selectedTreeNode, SingleRead.class, null, null);
- }
- //default
- else{
- MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
- menuItem.setText("No child derivates");
- menuItem.setEnabled(false);
+ createMenuItem(addMenu, SINGLE_READ, selectedTreeNode, SingleRead.class, null, null);
+ return;
}
}
+ MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
+ menuItem.setText(Messages.CreateDerivateContextMenu_NO_CHILD_DERIVATE);
+ menuItem.setEnabled(false);
}
if(specimenType!=null && specimenType.equals(SpecimenOrObservationType.Media)){
//media submenu
MenuItem mediaItem = new MenuItem(menu, SWT.CASCADE);
- mediaItem.setText("Media...");
+ mediaItem.setText(Messages.CreateDerivateContextMenu_MEDIA);
Menu mediaMenu = new Menu(menu);
mediaItem.setMenu(mediaMenu);
//existing media menu
MenuItem existingMediaItem = new MenuItem(mediaMenu, SWT.NONE);
- existingMediaItem.setText("Media Specimen with existing media");
+ existingMediaItem.setText(Messages.CreateDerivateContextMenu_MEDIA_EXISTING);
existingMediaItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//select media
Media media = MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
- //create MediaSpecimen
- MediaSpecimen mediaSpecimen = MediaSpecimen.NewInstance(specimenType);
- mediaSpecimen.setMediaSpecimen(media);
+ if(media!=null){
+ //create MediaSpecimen
+ MediaSpecimen mediaSpecimen = MediaSpecimen.NewInstance(specimenType);
+ mediaSpecimen.setMediaSpecimen(media);
- //attach to parent
- if(selectedNode.getValue() instanceof SpecimenOrObservationBase){
- SpecimenOrObservationBase<?> specimenOrObservationBase = (SpecimenOrObservationBase<?>)selectedNode.getValue();
+ //attach to parent
+ if(selectedNode.getValue() instanceof SpecimenOrObservationBase){
+ SpecimenOrObservationBase<?> specimenOrObservationBase = (SpecimenOrObservationBase<?>)selectedNode.getValue();
- specimenOrObservationBase.addDerivationEvent(DerivationEvent.NewSimpleInstance(specimenOrObservationBase, mediaSpecimen, derivationEventType));
- mediaSpecimen.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
- mediaSpecimen.getTitleCache(); //update title cache
- }
+ specimenOrObservationBase.addDerivationEvent(DerivationEvent.NewSimpleInstance(specimenOrObservationBase, mediaSpecimen, derivationEventType));
+ mediaSpecimen.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
+ mediaSpecimen.getTitleCache(); //update title cache
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge(specimenOrObservationBase, true);
+ }
+ }
- //refresh view
- DerivateView derivateView = null;
- if(AbstractUtility.getActivePart() instanceof DerivateView){
- derivateView = (DerivateView) AbstractUtility.getActivePart();
- }
- if(derivateView!=null){
- derivateView.getConversationHolder().commit();
- derivateView.refreshTree(mediaSpecimen);
+ //refresh view
+ DerivateView derivateView = null;
+ if(AbstractUtility.getActivePart() instanceof DerivateView){
+ derivateView = (DerivateView) AbstractUtility.getActivePart();
+ }
+ if(derivateView!=null){
+
+ derivateView.getConversationHolder().commit();
+ derivateView.refreshTree(mediaSpecimen);
+ }
}
}
});
if(derivateView!=null){
if(derivateView.isDirty()){
e.doit = false;
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
return;
}
}
if(selectedDerivate instanceof DnaSample && ((DnaSample) selectedDerivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
DnaSample dnaSample = (DnaSample)selectedDerivate;
if(childClass.equals(Sequence.class)){
- Sequence newInstance = Sequence.NewInstance(dnaSample, "", 0);
+ Sequence newInstance = Sequence.NewInstance(dnaSample, "", 0); //$NON-NLS-1$
createdElement = newInstance;
}
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
+ }
}
else if(selectedDerivate instanceof Sequence){
SingleRead newInstance = SingleRead.NewInstance();
((Sequence) selectedDerivate).addSingleRead(newInstance);
createdElement = newInstance;
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmApplicationState.getCurrentAppConfig().getSequenceService().merge((Sequence)selectedDerivate, true);
+ }
}
- else if(selectedDerivate instanceof SpecimenOrObservationBase && DerivedUnit.class.isAssignableFrom(childClass)){
+ if(selectedDerivate instanceof SpecimenOrObservationBase && DerivedUnit.class.isAssignableFrom(childClass)){
SpecimenOrObservationBase<?> specimenOrObservationBase = (SpecimenOrObservationBase<?>)selectedDerivate;
DerivedUnit derivedUnit;
if(childClass.equals(DnaSample.class)){
derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
derivedUnit.getTitleCache(); //update title cache
createdElement = derivedUnit;
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge((SpecimenOrObservationBase) selectedDerivate, true);
+ }
}
//refresh view
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * Context menu for the SingleReads in the derivate hierarchy.
+ *
+ */
+public class CreateFieldUnitContextMenu extends CompoundContributionItem {
+
+ private enum CommandType {
+ COPY_TO_CLIPBOARD, REMOVE_FROM_SEQUENCE, ADD_TO_SEQUENCE
+ }
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IContributionItem[] contributionItems = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPart activePart = window.getActivePage().getActivePart();
+ if(activePart instanceof DerivateView){
+ final DerivateView derivateView = (DerivateView) activePart;
+ if(derivateView.isListenToSelectionChange()){
+ Object selectionInput = derivateView.getSelectionInput();
+ if(selectionInput instanceof CdmBase && ((CdmBase) selectionInput).isInstanceOf(Taxon.class)){
+ final Taxon taxon = HibernateProxyHelper.deproxy(CdmStore.getService(ITaxonService.class).load(((CdmBase)selectionInput).getUuid()), Taxon.class);
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText("Create FieldUnit for "+taxon.getName());
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(derivateView.isDirty()){
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
+ return;
+ }
+
+ FieldUnit fieldUnit = FieldUnit.NewInstance();
+ fieldUnit = CdmBase.deproxy(CdmStore.getService(IOccurrenceService.class).save(fieldUnit), FieldUnit.class);
+ IndividualsAssociation association = IndividualsAssociation.NewInstance(fieldUnit);
+ TaxonDescription description;
+ if(!taxon.getDescriptions().isEmpty()){
+ description = taxon.getDescriptions().iterator().next();
+ }
+ else{
+ description = TaxonDescription.NewInstance(taxon);
+ }
+ description.addElement(association);
+ if(CdmStore.getCurrentSessionManager().isRemoting()){
+ CdmStore.getService(ITaxonService.class).merge(taxon);
+ }
+ else{
+ CdmStore.getService(ITaxonService.class).saveOrUpdate(taxon);
+ }
+
+ derivateView.getConversationHolder().commit();
+ derivateView.addFieldUnit(fieldUnit);
+ derivateView.refreshTree(fieldUnit);
+ }
+ });
+ }
+ }
+ else{
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText("Create FieldUnit");
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(derivateView.isDirty()){
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
+ return;
+ }
+ FieldUnit fieldUnit = FieldUnit.NewInstance();
+ fieldUnit = CdmBase.deproxy(CdmStore.getService(IOccurrenceService.class).save(fieldUnit), FieldUnit.class);
+ derivateView.getConversationHolder().commit();
+ derivateView.addFieldUnit(fieldUnit);
+ derivateView.updateRootEntities();
+ derivateView.refreshTree(fieldUnit);
+ }
+ });
+ }
+ }
+ }
+ }
+ };
+ return contributionItems;
+ }
+}
+
package eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu;
import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
import org.eclipse.ui.actions.CompoundContributionItem;
public class DerivateViewContextMenu extends CompoundContributionItem {
@Override
protected IContributionItem[] getContributionItems() {
IContributionItem[] contributionItems = new IContributionItem[] {
+ new CreateFieldUnitContextMenu(),
new CreateDerivateContextMenu(),
- new SingleReadSequenceContextMenu()
+ new Separator(),
+// new ListenToSelectionChangeContextMenu(),
};
return contributionItems;
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu;
+
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * Context menu for the SingleReads in the derivate hierarchy.
+ *
+ */
+public class ListenToSelectionChangeContextMenu extends CompoundContributionItem {
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ IContributionItem[] contributionItems = new IContributionItem[] {
+ new ContributionItem() {
+ @Override
+ public void fill(Menu menu, int index) {
+ final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ IWorkbenchPart activePart = window.getActivePage().getActivePart();
+ if(activePart instanceof DerivateView){
+ final DerivateView derivateView = (DerivateView) activePart;
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ if(derivateView.isListenToSelectionChange()){
+ item.setText("Unlink from taxon selection");
+ }
+ else{
+ item.setText("Link with taxon selection");
+ }
+ item.setImage(ImageResources.getImage(ImageResources.SYNCED));
+ item.addSelectionListener(new SelectionAdapterExtension(derivateView));
+ }
+ }
+ }
+ };
+ return contributionItems;
+ }
+
+ private final class SelectionAdapterExtension extends SelectionAdapter {
+
+ private final DerivateView derivateView;
+
+ private SelectionAdapterExtension(DerivateView derivateView) {
+ this.derivateView = derivateView;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ derivateView.toggleListenToSelectionChange();
+ }
+ }
+}
+
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * Context menu for the SingleReads in the derivate hierarchy.
- *
- */
-public class SingleReadSequenceContextMenu extends CompoundContributionItem {
-
- private enum CommandType{
- COPY_TO_CLIPBOARD,
- REMOVE_FROM_SEQUENCE,
- ADD_TO_SEQUENCE
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- @Override
- protected IContributionItem[] getContributionItems() {
- IContributionItem[] contributionItems = new IContributionItem[] {
- new ContributionItem() {
- @Override
- public void fill(Menu menu, int index) {
- final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final IEditorPart activeEditor = window.getActivePage().getActiveEditor();
- final ISelection selection = window.getActivePage().getSelection();
- TreeNode selectedTreeNode = EditorUtil.getTreeNodeOfSelection(selection);
- TreeNode clipboardNode = EditorUtil.getTreeNodeOfSelection(LocalSelectionTransfer.getTransfer().getSelection());
- if(selectedTreeNode!=null){
- //context menu for Sequence
- if(selectedTreeNode.getValue() instanceof Sequence
- && clipboardNode!=null && clipboardNode.getValue() instanceof SingleRead){
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText("Reuse SingleRead here");
- item.addSelectionListener(new WidgetSelectionListener(CommandType.ADD_TO_SEQUENCE));
- }
- else if(selectedTreeNode.getValue() instanceof SingleRead){
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setText("Reuse for other Sequence");
- item.addSelectionListener(new WidgetSelectionListener(CommandType.COPY_TO_CLIPBOARD));
- if(activeEditor instanceof DerivateView
- && ((DerivateView) activeEditor).getMultiLinkSingleReads().contains(selectedTreeNode.getValue())){
- MenuItem unlinkItem = new MenuItem(menu, SWT.NONE);
- unlinkItem.setText("Remove from this Sequence");
- unlinkItem.addSelectionListener(new WidgetSelectionListener(CommandType.REMOVE_FROM_SEQUENCE));
- }
- }
- }
- }
- }
- };
- return contributionItems;
- }
-
- private class WidgetSelectionListener extends SelectionAdapter{
- private final CommandType commandType;
-
- /**
- * @param selectedTreeNode
- * @param clipboardNode
- * @param commandType
- */
- public WidgetSelectionListener(CommandType commandType) {
- this.commandType = commandType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- ISelection clipBoardSelection = LocalSelectionTransfer.getTransfer().getSelection();
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
- TreeNode clipBoardTreeNode = EditorUtil.getTreeNodeOfSelection(clipBoardSelection);
- TreeNode selectedTreeNode = EditorUtil.getTreeNodeOfSelection(selection);
- switch (commandType) {
- case REMOVE_FROM_SEQUENCE:
- if(activeEditor.isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
- return;
- }
- if(selectedTreeNode!=null && selectedTreeNode.getParent()!=null &&
- selectedTreeNode.getValue() instanceof SingleRead && selectedTreeNode.getParent().getValue() instanceof Sequence) {
- Sequence sequence = (Sequence) selectedTreeNode.getParent().getValue();
- sequence.removeSingleRead((SingleRead) selectedTreeNode.getValue());
- CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
- if(activeEditor instanceof DerivateView) {
- DerivateView derivateView = (DerivateView)activeEditor;
- derivateView.getConversationHolder().commit();
- derivateView.refreshTree();
- }
- }
-
- break;
- case ADD_TO_SEQUENCE:
- if(activeEditor.isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
- return;
- }
- if(clipBoardTreeNode!=null && clipBoardTreeNode.getValue() instanceof SingleRead
- && selectedTreeNode!=null && selectedTreeNode.getValue() instanceof Sequence){
- SingleRead singleRead = (SingleRead)clipBoardTreeNode.getValue();
- Sequence sequence = (Sequence)selectedTreeNode.getValue();
- sequence.addSingleRead(singleRead);
- CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
- if(activeEditor instanceof DerivateView) {
- DerivateView derivateView = (DerivateView)activeEditor;
- derivateView.getConversationHolder().commit();
- derivateView.refreshTree();
- LocalSelectionTransfer.getTransfer().setSelection(null);
- }
- }
- break;
- case COPY_TO_CLIPBOARD:
- LocalSelectionTransfer.getTransfer().setSelection(selection);
- break;
- }
- }
- }
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-public class CreateFieldUnitHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- if(AbstractUtility.getActivePart() instanceof DerivateView){
- DerivateView derivateView = (DerivateView)AbstractUtility.getActivePart();
- if(derivateView.isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
- return null;
- }
- FieldUnit fieldUnit = FieldUnit.NewInstance();
- CdmStore.getService(IOccurrenceService.class).save(fieldUnit);
- derivateView.getConversationHolder().commit();
- DerivateViewEditorInput input = (DerivateViewEditorInput) derivateView.getEditorInput();
- input.addRootUuid(fieldUnit.getUuid());
- derivateView.refreshTree();
- }
- return null;
- }
-
-}
*/
public class DeleteDerivateHandler extends AbstractHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if(value instanceof SpecimenOrObservationBase<?> || value instanceof Sequence || value instanceof SingleRead){
if(postOperationEnabled instanceof IConversationEnabled){
ConversationHolder conversationHolder = ((IConversationEnabled) postOperationEnabled).getConversationHolder();
- label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder);
+ label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder); //$NON-NLS-1$
}
SpecimenDeleteConfigurator config = new SpecimenDeleteConfigurator();
- boolean deepDelete = event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivate.deepDelete");
+ boolean deepDelete = event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivate.deepDelete"); //$NON-NLS-1$
config.setDeleteChildren(deepDelete);
config.setDeleteMolecularData(deepDelete);
DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, (TreeNode) object, postOperationEnabled, config);
}
} catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set.");
+ MessagingUtils.warn(getClass(), "Command name not set");
}
return null;
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+
+public class ListenToSelectionChangeHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if(activePart instanceof DerivateView){
+ DerivateView derivativeEditor = (DerivateView)activePart;
+ derivativeEditor.toggleListenToSelectionChange();
+ }
+ return null;
+ }
+
+}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2014 EDIT
-* 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.editor.view.derivate.handler;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author pplitzner
- * @date Nov 25, 2014
- *
- */
-public class OpenDerivateEditorForTaxonHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if(currentSelection instanceof IStructuredSelection){
- Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
- Set<UUID> derivateUuids = new HashSet<UUID>();
- while(selectionIterator.hasNext()){
- Object object = selectionIterator.next();
- if(object instanceof TaxonNode){
- TaxonNode node = (TaxonNode)object;
- Taxon taxon = node.getTaxon();
- List<SpecimenOrObservationBase> listByAssociatedTaxon = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(null, null, taxon, null, null, null, null, null);
- for (SpecimenOrObservationBase specimenOrObservationBase : listByAssociatedTaxon) {
- derivateUuids.add(specimenOrObservationBase.getUuid());
- }
- }
- }
- if(derivateUuids.isEmpty()){
- MessagingUtils.warningDialog("Could not open Derivative Editor", this, "No Derivatives found");
- return null;
- }
- DerivateViewEditorInput input = new DerivateViewEditorInput(derivateUuids);
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivative Editor", e);
- } catch (NullPointerException npe){
- MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivative Editor. The derivative hierarchy is corrupted!", npe);
- }
- }
- return null;
- }
-
-}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import java.util.Collections;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandlerBase<IndividualsAssociation> {
+
+ @Override
+ protected IndividualsAssociation getEntity(UUID uuid) {
+ DescriptionElementBase descriptionElement = CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null);
+ if(descriptionElement!=null && descriptionElement.isInstanceOf(IndividualsAssociation.class)){
+ return (IndividualsAssociation) descriptionElement;
+ }
+ return null;
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, IndividualsAssociation entity) {
+ if(entity==null || entity.getAssociatedSpecimenOrObservation()==null){
+ MessagingUtils.messageDialog("No specimens found", this, "No specimens found for the selected object. (Maybe there are unsaved changes)");
+ return;
+ }
+ SpecimenOrObservationBase associatedSpecimenOrObservation = entity.getAssociatedSpecimenOrObservation();
+ if(associatedSpecimenOrObservation!=null){
+ UUID specimenUuid = associatedSpecimenOrObservation.getUuid();
+ try {
+ EditorUtil.open(new DerivateViewEditorInput(Collections.singletonList(specimenUuid)));
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e);
+ }
+ }
+
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase<TaxonNode> {
+
+ @Override
+ protected TaxonNode getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, TaxonNode entity) {
+ FindOccurrencesConfigurator config = new FindOccurrencesConfigurator();
+ UUID taxonUuid = entity.getTaxon().getUuid();
+ config.setAssociatedTaxonUuid(taxonUuid);
+ List<SpecimenOrObservationBase> specimens = CdmStore.getService(IOccurrenceService.class).findByTitle(config).getRecords();
+ Collection<UUID> specimenUuids = new ArrayList<UUID>();
+ for (SpecimenOrObservationBase specimenOrObservationBase : specimens) {
+ specimenUuids.add(specimenOrObservationBase.getUuid());
+ }
+ try {
+ EditorUtil.open(new DerivateViewEditorInput(specimenUuids, taxonUuid));
+ } catch (PartInitException e) {
+ MessagingUtils.error(OpenDerivateViewHandler.class, "Derivative Editor could not be opened", e);
+ }
+
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class SingleReadHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ISelection clipBoardSelection = LocalSelectionTransfer.getTransfer().getSelection();
+ final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
+ TreeNode clipBoardTreeNode = EditorUtil.getTreeNodeOfSelection(clipBoardSelection);
+ TreeNode selectedTreeNode = EditorUtil.getTreeNodeOfSelection(selection);
+ if(activeEditor instanceof DerivateView) {
+ DerivateView derivateView = (DerivateView)activeEditor;
+ if(event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard")){
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ }
+ else if(event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivative.reuseSingleRead")){
+ if(activeEditor.isDirty()){
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
+ return null;
+ }
+ if(clipBoardTreeNode!=null && clipBoardTreeNode.getValue() instanceof SingleRead
+ && selectedTreeNode!=null && selectedTreeNode.getValue() instanceof Sequence){
+ SingleRead singleRead = (SingleRead)clipBoardTreeNode.getValue();
+ Sequence sequence = (Sequence)selectedTreeNode.getValue();
+ sequence.addSingleRead(singleRead);
+ if(CdmStore.getCurrentSessionManager().isRemoting()){
+ CdmStore.getService(ISequenceService.class).merge(sequence);
+ }
+ else{
+ CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
+ }
+ if(activeEditor instanceof DerivateView) {
+ derivateView.getConversationHolder().commit();
+ derivateView.refreshTree();
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ }
+ }
+ }
+ else if(event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence")){
+ if(activeEditor.isDirty()){
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
+ return null;
+ }
+ if(selectedTreeNode!=null && selectedTreeNode.getParent()!=null &&
+ selectedTreeNode.getValue() instanceof SingleRead && selectedTreeNode.getParent().getValue() instanceof Sequence) {
+ Sequence sequence = (Sequence) selectedTreeNode.getParent().getValue();
+ sequence.removeSingleRead((SingleRead) selectedTreeNode.getValue());
+ if(CdmStore.getCurrentSessionManager().isRemoting()){
+ CdmStore.getService(ISequenceService.class).merge(sequence);
+ }
+ else{
+ CdmStore.getService(ISequenceService.class).saveOrUpdate(sequence);
+ }
+ if(activeEditor instanceof DerivateView) {
+ derivateView.getConversationHolder().commit();
+ derivateView.refreshTree();
+ }
+ }
+ }
+ derivateView.updateLabelCache();
+ derivateView.refreshTree();
+ }
+ return null;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+
+public class ToggleLinkWithTaxonSelectionHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ DerivateView derivateView = (DerivateView) HandlerUtil.getActiveEditor(event);
+ derivateView.toggleListenToSelectionChange();
+ return null;
+ }
+
+}
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.editor.Messages;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
if(getPostOperationEnabled() instanceof ISaveablePart){
- String confirmationQuestion = "Do you really want to delete the selected element";
+ String confirmationQuestion = Messages.DeleteDerivateOperation_REALLY_DELETE;
if(deleteConfigurator.isDeleteChildren()){
- confirmationQuestion += " and its children";
+ confirmationQuestion += Messages.DeleteDerivateOperation_AND_CHILDREN;
}
- confirmationQuestion += "?";
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfigurator, null, "Confirm Deletion", confirmationQuestion)){
+ confirmationQuestion += "?"; //$NON-NLS-1$
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfigurator, null, Messages.DeleteDerivateOperation_CONFIRM, confirmationQuestion)){
return Status.CANCEL_STATUS;
}
if(((ISaveablePart) getPostOperationEnabled()).isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
return Status.CANCEL_STATUS;
}
}
&& treeNode.getValue().equals(element)
&& treeNode.getParent()!=null
&& treeNode.getParent().getValue() instanceof Sequence){
- deleteResult = CdmStore.getService(IOccurrenceService.class).deleteSingleRead((SingleRead)element, (Sequence) treeNode.getParent().getValue());
- }
- else{
- deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
+ deleteResult = CdmStore.getService(ISequenceService.class).deleteSingleRead(((SingleRead)element).getUuid(),
+ ((Sequence) treeNode.getParent().getValue()).getUuid());
+ } else if(element instanceof Sequence){
+ deleteResult = CdmStore.getService(ISequenceService.class).delete(element.getUuid());
+ } else {
+ deleteResult = CdmStore.getService(IOccurrenceService.class).delete(element.getUuid(), deleteConfigurator);
}
if(deleteResult.isOk()){
if(getPostOperationEnabled() instanceof DerivateView){
DerivateView derivateView = (DerivateView) getPostOperationEnabled();
+ derivateView.remove(element);
//update DerivateView
derivateView.getConversationHolder().commit();
IStatus returnStatus = postExecute(null);
- //close if no more items left
- if(derivateView.getViewer().getTree().getItemCount()<1){
- AbstractUtility.close(derivateView);
- }
return returnStatus;
}
}
else{
- MessagingUtils.warningDialog("Deletion failed", this, deleteResult.toString());
+ MessagingUtils.warningDialog(Messages.DeleteDerivateOperation_DELETE_FAILED, this, deleteResult.toString());
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
*/
package eu.etaxonomy.taxeditor.editor.view.derivate.operation;
+import java.util.UUID;
+
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IAdaptable;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.editor.Messages;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
this.targetNode = targetNode;
}
- /* (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 {
DerivateView derivateView = null;
derivateView = (DerivateView) getPostOperationEnabled();
}
if(derivateView==null){
- MessagingUtils.operationDialog(this, new NullPointerException("Derivative Editor was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
+ MessagingUtils.operationDialog(this, new NullPointerException("Derivative Editor was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel()); //$NON-NLS-1$
return Status.CANCEL_STATUS;
}
if(derivateView.isDirty()){
- MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+ MessagingUtils.warningDialog(DerivateView.VIEW_HAS_UNSAVED_CHANGES, this, DerivateView.YOU_NEED_TO_SAVE_BEFORE_PERFORMING_THIS_ACTION);
return Status.CANCEL_STATUS;
}
fromNode = draggedNode.getParent();
if(moveTreeNode(draggedNode, fromNode, targetNode)){
+ //special case if derivative with no parent was moved
+ if(fromNode==null && draggedNode!=null && draggedNode.getValue()!=null){
+ derivateView.remove(draggedNode.getValue());
+ }
//update DerivateView
derivateView.getConversationHolder().commit();
LocalSelectionTransfer.getTransfer().setSelection(null);
return postExecute(null);
}
else{
- MessagingUtils.warningDialog("Moving derivatives not possible!", derivateView, "Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\" is not possible!");
+ MessagingUtils.warningDialog(Messages.MoveDerivateOperation_MOVE_NOT_POSSIBLE, derivateView, String.format(Messages.MoveDerivateOperation_MOVE_TO_NOT_POSSIBLE, derivateView.getLabelProvider().getDerivateText(draggedNode), derivateView.getLabelProvider().getDerivateText(targetNode)));
}
return Status.CANCEL_STATUS;
}
DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
//check if type is a sub derivate type
- if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
- && fromNode!=null
- && !fromNode.equals(targetNode)){//don't drag on direct parent node)
- return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
+ if(fromNode==null || !fromNode.equals(targetNode)){//don't drag on direct parent node)
+ UUID fromUuid = null;
+ if(fromParentSpecimen!=null){
+ fromUuid = ((SpecimenOrObservationBase<?>)fromParentSpecimen).getUuid();
+ }
+ return occurrenceService.moveDerivate(fromUuid,
+ targetSpecimen.getUuid(),
+ draggedSpecimen.getUuid()).isOk();
}
}
else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
SingleRead singleRead = (SingleRead) draggedNodeValue;
if(fromParentSpecimen instanceof Sequence){
- return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead).isOk();
+ return CdmStore.getService(ISequenceService.class).moveSingleRead(((Sequence)fromParentSpecimen).getUuid(),
+ ((Sequence)targetNodeValue).getUuid(),
+ singleRead.getUuid()).isOk();
+
}
}
else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
Sequence sequence = (Sequence)draggedNodeValue;
if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
- return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence).isOk();
+ return occurrenceService.moveSequence(((DnaSample)fromParentSpecimen).getUuid(),
+ ((DnaSample)targetNodeValue).getUuid(),
+ sequence.getUuid()).isOk();
+
}
}
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
//swap fromNode and targetNode
return execute(new NullProgressMonitor(), null);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
//swap fromNode and targetNode
* 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.view.derivateSearch;
+package eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter;
-import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.wb.swt.ResourceManager;
*
*/
public class DerivateSearchComposite extends Composite {
+
+ public static final int ALL_SPECIMENS = 0;
+ public static final int ASSIGNED_SPECIMENS = 1;
+ public static final int UNASSIGNED_SPECIMENS = 2;
+
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
private final Text searchField;
- private final Table table;
- private final TableViewer resultViewer;
private final Combo comboDerivateType;
private final Button buttonSearch;
- private final Button btnFilterUndeterminedSpecimen;
private final Text textTaxonName;
private final Button btnBrowseTaxa;
private final Label lblTaxon;
private final Label lblDerivateType;
private final Button btnClearTaxon;
+ private Label lbltaxonAssignment;
+ private Combo comboTaxonAssignment;
+ private Label lblTitleCache;
/**
* Create the composite.
+ *
* @param parent
* @param style
*/
public DerivateSearchComposite(Composite parent, int style) {
super(parent, style);
- setLayout(new GridLayout(4, false));
+ setLayout(new GridLayout(7, false));
lblTaxon = new Label(this, SWT.NONE);
lblTaxon.setText("Taxon");
- textTaxonName = formToolkit.createText(this, "New Text", SWT.NONE);
+ textTaxonName = formToolkit.createText(this, "New Text", SWT.BORDER);
textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textTaxonName.setEnabled(false);
textTaxonName.setText("");
btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE);
- btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+ btnBrowseTaxa.setAlignment(SWT.RIGHT);
+ btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/prj_obj.gif"));
btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE);
- btnClearTaxon.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ btnClearTaxon.setAlignment(SWT.RIGHT);
+ btnClearTaxon.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+ lbltaxonAssignment = new Label(this, SWT.NONE);
+ lbltaxonAssignment.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lbltaxonAssignment.setText("Taxon assignment");
+
+ comboTaxonAssignment = new Combo(this, SWT.NONE);
+ comboTaxonAssignment.setItems(new String[] { "All", "Yes", "No" });
+ comboTaxonAssignment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ formToolkit.adapt(comboTaxonAssignment);
+ formToolkit.paintBordersFor(comboTaxonAssignment);
+ comboTaxonAssignment.select(ALL_SPECIMENS);
+ new Label(this, SWT.NONE);
+
+ lblTitleCache = new Label(this, SWT.NONE);
+ lblTitleCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblTitleCache.setText("Title Cache");
+
+ searchField = formToolkit.createText(this, "New Text", SWT.BORDER);
+ searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1));
+ searchField.setText("");
+
lblDerivateType = new Label(this, SWT.NULL);
+ lblDerivateType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblDerivateType.setText("Derivative Type");
comboDerivateType = new Combo(this, SWT.READ_ONLY);
comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
formToolkit.paintBordersFor(comboDerivateType);
- btnFilterUndeterminedSpecimen = new Button(this, SWT.CHECK);
- btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
- btnFilterUndeterminedSpecimen.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- }
- });
- btnFilterUndeterminedSpecimen.setText("Determined");
-
- buttonSearch = new Button(this, SWT.NONE);
- formToolkit.adapt(buttonSearch, true, true);
- buttonSearch.setText("Search");
-
- searchField = formToolkit.createText(this, "New Text", SWT.NONE);
- searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
- searchField.setText("");
- new Label(this, SWT.NONE);
- new Label(this, SWT.NONE);
-
- resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
- table = resultViewer.getTable();
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
+ buttonSearch = new Button(this, SWT.NONE);
+ formToolkit.adapt(buttonSearch, true, true);
+ buttonSearch.setText("Search");
}
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}
+
public Text getSearchField() {
return searchField;
}
- public TableViewer getResultViewer() {
- return resultViewer;
- }
+
public Combo getComboDerivateType() {
return comboDerivateType;
}
+
public Button getButtonSearch() {
return buttonSearch;
}
@Override
- public void setEnabled(boolean enabled){
+ public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
searchField.setEnabled(enabled);
- table.setEnabled(enabled);
- // resultViewer.setEnabled(enabled);
comboDerivateType.setEnabled(enabled);
+ comboTaxonAssignment.setEnabled(enabled);
buttonSearch.setEnabled(enabled);
- btnFilterUndeterminedSpecimen.setEnabled(enabled);
btnBrowseTaxa.setEnabled(enabled);
+ btnClearTaxon.setEnabled(enabled);
lblTaxon.setEnabled(enabled);
+ lblTitleCache.setEnabled(enabled);
+ lbltaxonAssignment.setEnabled(enabled);
lblDerivateType.setEnabled(enabled);
}
- public Button getBtnFilterUndeterminedSpecimen() {
- return btnFilterUndeterminedSpecimen;
- }
+
+
public Button getBtnBrowseTaxa() {
return btnBrowseTaxa;
}
+
public Text getTextTaxonName() {
return textTaxonName;
}
+
public Button getBtnClearTaxon() {
return btnClearTaxon;
}
+ public Combo getComboTaxonAssignment() {
+ return comboTaxonAssignment;
+ }
+
+ public Label getLbltaxonAssignment() {
+ return lbltaxonAssignment;
+ }
}
* 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.view.derivateSearch;
+package eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter;
-import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.handlers.IHandlerService;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator.AssignmentStatus;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.SearchManager;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
/**
* Controller class for the {@link DerivateSearchComposite}.<br>
private final DerivateSearchComposite derivateSearchComposite;
private EnumTermComboController<SpecimenOrObservationType> comboSpecimenTypeController;
- private final DerivateSearchView derivateSearchView;
private DerivateLabelProvider labelProvider;
private Taxon selectedTaxon;
+ private DerivateView derivativeEditor;
- /**
- * @param parent
- * @param derivateSearchView
- */
- public DerivateSearchCompositeController(Composite parent, DerivateSearchView derivateSearchView) {
+ public DerivateSearchCompositeController(Composite parent, DerivateView derivativeEditor) {
this.derivateSearchComposite = new DerivateSearchComposite(parent, SWT.NONE);
- this.derivateSearchView = derivateSearchView;
+ this.derivativeEditor = derivativeEditor;
init();
}
derivateSearchComposite.getBtnBrowseTaxa().addListener(SWT.Selection, this);
derivateSearchComposite.getBtnClearTaxon().addListener(SWT.Selection, this);
-
- //result table
- TableViewer resultViewer = derivateSearchComposite.getResultViewer();
- resultViewer.setContentProvider(new ArrayContentProvider());
- labelProvider = new DerivateLabelProvider();
- resultViewer.setLabelProvider(labelProvider);
- resultViewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- String commandId = "eu.etaxonomy.taxeditor.editor.handler.openDerivateView";
-
- IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
- try {
- handlerService.executeCommand(commandId, null);
- } catch (ExecutionException e) {
- MessagingUtils.error(DerivateSearchCompositeController.class, e);
- } catch (NotDefinedException e) {
- MessagingUtils.error(DerivateSearchCompositeController.class, e);
- } catch (NotEnabledException e) {
- MessagingUtils.error(DerivateSearchCompositeController.class, e);
- } catch (NotHandledException e) {
- MessagingUtils.error(DerivateSearchCompositeController.class, e);
- }
-
- }
- });
-
}
private void searchDerivates(){
- if(!derivateSearchView.getConversationHolder().isBound()){
- derivateSearchView.setFocus(); //rebind the conversation
- }
-
String queryString = derivateSearchComposite.getSearchField().getText();
SpecimenOrObservationType specimenType = comboSpecimenTypeController.getSelection();
config.setSpecimenType(specimenType.equals(SpecimenOrObservationType.Unknown)?null:specimenType);//unknown := all types
config.setTitleSearchString(queryString);
if(selectedTaxon!=null){
- config.setRetrieveIndirectlyAssociatedSpecimens(true);
config.setSpecimenType(null);
}
-
- SearchManager searchManager = new SearchManager();
- List<SpecimenOrObservationBase> occurrences = searchManager.findOccurrences(config);
-
- //filter out specimens of wrong type (only if an associated taxon was selected)
- if(selectedTaxon!=null && !specimenType.equals(SpecimenOrObservationType.Unknown)){
- List<SpecimenOrObservationBase> specimensOfCorrectType = new ArrayList<SpecimenOrObservationBase>();
- for(SpecimenOrObservationBase<?> occurrence:occurrences){
- if(occurrence.getRecordBasis().equals(specimenType)
- || occurrence.getRecordBasis().isKindOf(specimenType)){
- specimensOfCorrectType.add(occurrence);
- }
- }
- occurrences = specimensOfCorrectType;
+ switch (derivateSearchComposite.getComboTaxonAssignment().getSelectionIndex()) {
+ case DerivateSearchComposite.ALL_SPECIMENS:
+ config.setAssignmentStatus(AssignmentStatus.ALL_SPECIMENS);
+ break;
+ case DerivateSearchComposite.ASSIGNED_SPECIMENS:
+ config.setAssignmentStatus(AssignmentStatus.ASSIGNED_SPECIMENS);
+ break;
+ case DerivateSearchComposite.UNASSIGNED_SPECIMENS:
+ config.setAssignmentStatus(AssignmentStatus.UNASSIGNED_SPECIMENS);
+ break;
+ default:
+ break;
}
- //filter out assigned specimens
- if(derivateSearchComposite.getBtnFilterUndeterminedSpecimen().getSelection()){
- List<SpecimenOrObservationBase> specimensWithNoDetermination = new ArrayList<SpecimenOrObservationBase>();
- for(SpecimenOrObservationBase<?> result:occurrences){
- if(CdmStore.getService(IOccurrenceService.class).countDeterminations(result, null)==0){
- specimensWithNoDetermination.add(result);
- }
- }
- occurrences = specimensWithNoDetermination;
- }
- derivateSearchComposite.getResultViewer().setInput(occurrences);
+ SearchManager searchManager = new SearchManager();
+ List<SpecimenOrObservationBase> occurrences = searchManager.findOccurrences(config, true);
+ derivativeEditor.updateRootEntities(occurrences);
}
@Override
searchDerivates();
}
else if(eventSource==derivateSearchComposite.getBtnBrowseTaxa()){
- selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, derivateSearchView.getSite().getShell(), derivateSearchView.getConversationHolder(), null);
+ selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, this.derivateSearchComposite.getShell(), derivativeEditor.getConversationHolder(), null);
if(selectedTaxon!=null){
derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
}
+ derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS);
+ derivateSearchComposite.getComboTaxonAssignment().setEnabled(false);
+ derivateSearchComposite.getLbltaxonAssignment().setEnabled(false);
}
else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){
selectedTaxon = null;
derivateSearchComposite.getTextTaxonName().setText("");
+ derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS);
+ derivateSearchComposite.getComboTaxonAssignment().setEnabled(true);
+ derivateSearchComposite.getLbltaxonAssignment().setEnabled(true);
}
}
*/
public void setEnabled(boolean enabled) {
if(!derivateSearchComposite.isDisposed()){
- derivateSearchComposite.setEnabled(enabled);
+ GridData layoutData = (GridData) derivateSearchComposite.getLayoutData();
+ layoutData.exclude = !enabled;
+ derivateSearchComposite.setVisible(enabled);
+ derivateSearchComposite.getParent().layout(true);
}
}
+ public void setLayoutData(Object layoutData){
+ derivateSearchComposite.setLayoutData(layoutData);
+ }
+
+ /**
+ * Checks whether or not the search criteria are set to their default value.<br>
+ * This does not consider the title search field.
+ * @return <code>true</code> if search criteria are set to default.
+ */
+ public boolean isDefaultSearch(){
+ boolean isDefault = true;
+ isDefault &= comboSpecimenTypeController.getSelection()==SpecimenOrObservationType.Unknown;
+ isDefault &= derivateSearchComposite.getComboTaxonAssignment().getSelectionIndex()==DerivateSearchComposite.ALL_SPECIMENS;
+ isDefault &= selectedTaxon==null;
+ return isDefault;
+ }
/**
* Resets all input fields
*/
public void reset(){
if(!derivateSearchComposite.isDisposed()){
- derivateSearchComposite.getResultViewer().setInput(null);
derivateSearchComposite.getSearchField().setText("");
derivateSearchComposite.getComboDerivateType().deselectAll();
comboSpecimenTypeController.setSelection(SpecimenOrObservationType.Unknown);
selectedTaxon = null;
}
- public TableViewer getResultViewer() {
- return derivateSearchComposite.getResultViewer();
- }
-
- public void setFocus() {
- derivateSearchComposite.getResultViewer().getControl().setFocus();
- }
-
- /**
- * @param conversationHolder
- */
public void setConversation(ConversationHolder conversationHolder) {
labelProvider.setConversation(conversationHolder);
}
+ public void setTaxonFilter(UUID taxonUuid) {
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonUuid);
+ if(taxonBase!=null && taxonBase.isInstanceOf(Taxon.class)){
+ selectedTaxon = HibernateProxyHelper.deproxy(taxonBase, Taxon.class);
+ derivateSearchComposite.getTextTaxonName().setText(taxonBase.getTitleCache());
+ derivateSearchComposite.getLbltaxonAssignment().setEnabled(false);
+ derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ASSIGNED_SPECIMENS);
+ derivateSearchComposite.getComboTaxonAssignment().setEnabled(false);
+ }
+ }
+
}
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
public class DescriptionElementDragListener extends DragSourceAdapter {
private DescriptiveViewPart part;
+ private DescriptionBase description;
public DescriptionElementDragListener(DescriptiveViewPart part){
this.part = part;
return;
// FIXME what to do here?
if (event.detail != DND.DROP_NONE) {
- IStructuredSelection selection = (IStructuredSelection) part.getViewer()
- .getSelection();
- part.changed(null);
+ //IStructuredSelection selection = (IStructuredSelection) part.getViewer().getSelection();
+ part.getViewer().refresh();
+
+ part.changed(null);
}
}
List<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>();
for (Object object : selection.toList()){
if(object instanceof DescriptionBase){
- descriptionElements.addAll(((DescriptionBase) object).getElements());
+ if (!((DescriptionBase) object).getElements().isEmpty()){
+ descriptionElements.addAll(((DescriptionBase) object).getElements());
+ }
+ description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
+
}else if(object instanceof FeatureNodeContainer){
descriptionElements.addAll(((FeatureNodeContainer) object).getDescriptionElements());
}else if(object instanceof DescriptionElementBase){
}
if (DescriptionElementTransfer.getInstance().isSupportedType(
event.dataType)) {
- event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]);
+ if (!descriptionElements.isEmpty()){
+ event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]);
+ }
+
}
+
}
/**
// $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.
*/
public boolean performDrop(Object data) {
TaxonDescription target = (TaxonDescription) getCurrentTarget();
Object[] droppedElements = (Object[]) data;
-
+
Collection<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>();
-
+
boolean isCopy = getCurrentOperation() == DND.DROP_COPY ? true : false;
-
+
// cannot drop a feature node onto itself
- for (Object droppedElement : droppedElements) {
- if (droppedElement == null){
- MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work.");
- return false;
- }
- if(! (droppedElement instanceof DescriptionElementBase)){
- return false;
- }else{
- DescriptionElementBase descriptionElement = (DescriptionElementBase) droppedElement;
-
- if (descriptionElement.getInDescription().equals(target)) {
+ if (droppedElements != null){
+ for (Object droppedElement : droppedElements) {
+ if (droppedElement == null){
+ MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work.");
return false;
}
-
- descriptionElements.add(descriptionElement);
- }
+ if(! (droppedElement instanceof DescriptionElementBase)){
+ return false;
+ }else{
+ DescriptionElementBase descriptionElement = (DescriptionElementBase) droppedElement;
+
+ if (descriptionElement.getInDescription().equals(target)) {
+ return false;
+ }
+
+ descriptionElements.add(descriptionElement);
+ }
+ }
+
+ AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
+
+ EditorUtil.executeOperation(operation);
+ return true;
}
-
- AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
-
- EditorUtil.executeOperation(operation);
-
- return true;
+ MessagingUtils.warningDialog("Operation not supported yet", this, "We are unable to drag and drop empty descriptions");
+
+ return false;
+
}
/* (non-Javadoc)
TransferData transferData) {
boolean transferDataIsSupported = DescriptionElementTransfer.getInstance().isSupportedType(
transferData);
- System.out.println(target);
return target instanceof TaxonDescription && transferDataIsSupported;
}
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.description.IDescribable;
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
+import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache;
private boolean showOnlyIndividualAssociations;
+
public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
this(featureNodeContainerCache, false);
}
* @return
*/
private FeatureTree getFeatureTree(DescriptionBase description){
- FeatureTree featureTree = null;
+ FeatureTree featureTree;
// TODO change this to the feature tree associated with this taxon description
if (description.hasStructuredData()){
featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
// create a transient tree with all features if none was selected
if(featureTree == null){
- featureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
+ featureTree = TermEditorInput.getDefaultFeatureTree();
}
return featureTree;
package eu.etaxonomy.taxeditor.editor.view.descriptive;
import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.IDescribable;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
/**
- * <p>DescriptiveViewPart class.</p>
- *
* @author n.hoffmann
* @created Jun 9, 2010
* @version 1.0
createToolbar();
- // set initial input
-// if(getEditor() != null){
-// viewer.setInput(getEditor().getEditorInput());
-// }
-
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- //Open derivate editor when specimen description element is double clicked
- TreeSelection selection = (TreeSelection) viewer.getSelection();
- Iterator iterator = selection.iterator();
- Set<UUID> specimenUuids = new HashSet<UUID>();
- while(iterator.hasNext()){
- Object next = iterator.next();
- if(next instanceof IndividualsAssociation){
- SpecimenOrObservationBase<?> specimen = ((IndividualsAssociation)next).getAssociatedSpecimenOrObservation();
- if(specimen!=null){
- specimenUuids.add(specimen.getUuid());
- }
- }
- }
- try {
- if(!specimenUuids.isEmpty()){
- EditorUtil.open(new DerivateViewEditorInput(specimenUuids));
- }
- } catch (PartInitException e) {
- MessagingUtils.error(DescriptiveViewPart.class, "Could not open Derivative Editor", e);
- }
-
-
- //TODO: extend command to accept parameter to open editor
-// String commandId = "eu.etaxonomy.taxeditor.editor.handler.openDerivateView";
-// IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
-// try {
-// handlerService.executeCommand(commandId, null);
-// } catch (ExecutionException e) {
-// MessagingUtils.error(DerivateSearchCompositeController.class, e);
-// } catch (NotDefinedException e) {
-// MessagingUtils.error(DerivateSearchCompositeController.class, e);
-// } catch (NotEnabledException e) {
-// MessagingUtils.error(DerivateSearchCompositeController.class, e);
-// } catch (NotHandledException e) {
-// MessagingUtils.error(DerivateSearchCompositeController.class, e);
-// }
-
- }
- });
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#getInitialSelection()
- */
/** {@inheritDoc} */
@Override
protected ISelection getInitialSelection() {
*/
protected void createMenu(){
MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
getSite().registerContextMenu(menuManager, viewer);
if(part == this){
return;
}
- if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
- // do not show empty page as these views are also used to edit the description selected in this view
- return;
- }
+ if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+ || part instanceof MediaViewPart) {
+ // do not show empty page as these views are also used to edit the
+ // description selected in this view
+ return;
+ }
// unpackage TreeNode of DerivateView
else if(part instanceof DerivateView){
TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(selection);
}
if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
((BulkEditor) part).forceDirty();
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
+ ((BulkEditor) part).changed(selection.getFirstElement());
+ }
}
+
super.changed(object);
}
return viewer;
}
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
@Override
public boolean onComplete() {
return false;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* <p>DeleteDescriptionHandler class.</p>
IWorkbenchPart part = HandlerUtil.getActivePart(event);
IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled = (part instanceof ICdmEntitySessionEnabled) ? (ICdmEntitySessionEnabled) part : null;
try {
String label = event.getCommand().getName();
// TaxonDescription
if(object instanceof TaxonDescription){
- operations.add(new DeleteTaxonDescriptionOperation(label, undoContext, (TaxonDescription) object, postOperationEnabled));
+ operations.add(new DeleteTaxonDescriptionOperation(label, undoContext, (TaxonDescription) object, postOperationEnabled, cdmEntitySessionEnabled));
}
else if(object instanceof SpecimenDescription){
- operations.add(new DeleteSpecimenDescriptionOperation(label, undoContext, (SpecimenDescription) object, postOperationEnabled));
+ operations.add(new DeleteSpecimenDescriptionOperation(label, undoContext, (SpecimenDescription) object, postOperationEnabled, cdmEntitySessionEnabled)) ;
}
// DescriptionElementBase
else if(object instanceof DescriptionElementBase){
- operations.add(new DeleteDescriptionElementOperation(label, undoContext, (DescriptionElementBase) object, postOperationEnabled));
+ operations.add(new DeleteDescriptionElementOperation(label, undoContext, (DescriptionElementBase) object, postOperationEnabled, cdmEntitySessionEnabled));
}
else if(object instanceof FeatureNodeContainer){
List<DescriptionElementBase> descriptions = ((FeatureNodeContainer) object).getDescriptionElementsForEntireBranch();
for(DescriptionElementBase description : descriptions){
- operations.add(new DeleteDescriptionElementOperation(label, undoContext, description, postOperationEnabled));
+ operations.add(new DeleteDescriptionElementOperation(label, undoContext, description, postOperationEnabled, cdmEntitySessionEnabled));
}
}
// Media
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.AnnotationType;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
public class MoveDescriptionElementsHandler extends AbstractHandler implements IPostOperationEnabled{
private UUID newAcceptedTaxonNodeUuid;
private TaxonNameEditor editor;
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
+
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
}
DescriptionBase description = elements.get(0).getInDescription();
List<UUID> excludeTaxa = new ArrayList<UUID>();
- if (description.isInstanceOf(TaxonDescription.class)){
+ if (description!=null && description.isInstanceOf(TaxonDescription.class)){
TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(description, TaxonDescription.class);
actualTaxon = taxonDescription.getTaxon();
excludeTaxa.add(actualTaxon.getUuid());
}
Classification classification = null;
+ TaxonNode actualNode = null;
if (actualTaxon != null){
if (!actualTaxon.getTaxonNodes().isEmpty() && actualTaxon.getTaxonNodes().size() ==1){
- classification = actualTaxon.getTaxonNodes().iterator().next().getClassification();
+ actualNode = actualTaxon.getTaxonNodes().iterator().next();
+ classification = actualNode.getClassification();
+
}
}
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
editor.getConversationHolder(),
"Choose the accepted taxon",
excludeTaxa,
- null,classification
+ null, classification
);
if (newAcceptedTaxonNode != null){
Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
return null;
}
newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
- TaxonDescription targetDescription = TaxonDescription.NewInstance(targetTaxon);
+
String moveMessage = String.format("Elements moved from %s", EditorUtil.getActiveMultiPageTaxonEditor().getTaxon());
- targetDescription.setTitleCache(moveMessage, true);
- Annotation annotation = Annotation.NewInstance(moveMessage, Language.getDefaultLanguage());
- annotation.setAnnotationType(AnnotationType.TECHNICAL());
- targetDescription.addAnnotation(annotation);
try {
AbstractPostOperation operation = new MoveDescriptionElementsOperation(
event.getCommand().getName(), EditorUtil.getUndoContext(),
- targetDescription, elements, false, this);
+ targetTaxon.getUuid(), moveMessage, elements, false, this);
- EditorUtil.executeOperation(operation);
+ AbstractUtility.executeOperation(operation);
//CdmStore.getService(ITaxonService.class).saveOrUpdate(targetTaxon);
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
- */
/** {@inheritDoc} */
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
@Override
public boolean onComplete() {
- // TODO Auto-generated method stub
return false;
}
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
private MoveDescriptionToOtherTaxonOperation operation;
private UUID newAcceptedTaxonNodeUuid;
- private TaxonNameEditor editor;
+ private MultiPageTaxonEditor editor;
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
+ editor = EditorUtil.getActiveMultiPageTaxonEditor();
+ if (this.editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+ if (proceed) {
+ editor.doSave(EditorUtil.getMonitor());
+ } else {
+ return null;
+ }
+
+ }
+
if(selection instanceof IStructuredSelection){
} else if (element instanceof DescriptionBase){
uuid = ((DescriptionBase)element).getUuid();
}
-
+
if (uuid != null){
descriptions.add((TaxonDescription) CdmStore.getService(IDescriptionService.class).load(uuid, null));
}
// Choose the target taxon
List<UUID> excludeTaxa = new ArrayList<UUID>();
- editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
+
+
excludeTaxa.add(descriptions.get(0).getTaxon().getUuid());
+
+ //get current taxon node
+ TaxonNode node = null;
+ Classification classification = null;
+ MultiPageTaxonEditor taxonEditor = EditorUtil.getActiveMultiPageTaxonEditor();
+ if(taxonEditor!=null){
+ node = ((TaxonEditorInput) taxonEditor.getEditorInput()).getTaxonNode();
+ classification = node.getClassification();
+ }
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
editor.getConversationHolder(),
"Choose the accepted taxon",
excludeTaxa,
- null,
- null);
+ node,
+ classification);
if (newAcceptedTaxonNode == null) {
return null;
try {
for(TaxonDescription description : descriptions){
operation = new MoveDescriptionToOtherTaxonOperation(event.getCommand().getName(),
- editor.getUndoContext(), description, newAcceptedTaxonNode, this, editor);
+ editor.getUndoContext(),
+ description,
+ newAcceptedTaxonNode,
+ this,
+ editor,
+ (ICdmEntitySessionEnabled)editor.getEditorInput());
AbstractUtility.executeOperation(operation);
}
@Override
public void run() {
- AbstractUtility.close(editor.getMultiPageTaxonEditor());
+ AbstractUtility.close(editor);
try {
MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
/**
* 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.
*/
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* <p>DeleteDescriptionElementOperation class.</p>
* @version 1.0
*/
public class DeleteDescriptionElementOperation extends AbstractPostTaxonOperation {
-
- private DescriptionElementBase element;
+
+ private final DescriptionElementBase element;
private DescriptionBase description = null;
/**
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public DeleteDescriptionElementOperation(String label, IUndoContext undoContext,
- DescriptionElementBase element, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, postOperationEnabled);
-
+ DescriptionElementBase element, IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
+
this.element = element;
}
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
-
+
description = element.getInDescription();
-
+
monitor.worked(20);
-
+
// Remove element from description
if (description == null) {
MessagingUtils.error(this.getClass(), "Couldn't find element's description!", null);
throws ExecutionException {
description.addElement(element);
-
+
return postExecute(element);
}
}
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
private final SpecimenDescription description;
- public DeleteSpecimenDescriptionOperation(String label, IUndoContext undoContext,
- SpecimenDescription description, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, description.getDescribedSpecimenOrObservation(), postOperationEnabled);
+ public DeleteSpecimenDescriptionOperation(String label,
+ IUndoContext undoContext,
+ SpecimenDescription description,
+ IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, description.getDescribedSpecimenOrObservation(), postOperationEnabled, cdmEntitySessionEnabled);
this.description = description;
}
package eu.etaxonomy.taxeditor.editor.view.descriptive.operation;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IAdaptable;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public DeleteTaxonDescriptionOperation(String label, IUndoContext undoContext,
- TaxonDescription description, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, postOperationEnabled);
+ public DeleteTaxonDescriptionOperation(String label,
+ IUndoContext undoContext,
+ TaxonDescription description,
+ IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.description = description;
element = description.getTaxon();
monitor.worked(20);
if (description != null){
- List<String> propertyPaths = new ArrayList<String>();
- propertyPaths.add("taxon");
- TaxonDescription loadedDescription = (TaxonDescription) CdmStore.getService(IDescriptionService.class).load(description.getUuid(), propertyPaths);
- CdmStore.getService(IDescriptionService.class).deleteDescription(loadedDescription);
+ CdmStore.getService(IDescriptionService.class).deleteDescription(description.getUuid());
return postExecute(description);
}
return null;
-
+
}
/* (non-Javadoc)
// $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.editor.view.descriptive.operation;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
private Collection<DescriptionElementBase> descriptionElements;
private DescriptionBase targetDescription;
private IDescriptionService service;
+ private UUID targetTaxonUuid;
+ private String moveMessage;
private boolean isCopy;
/**
- *
+ *
* @param label
* @param undoContext
* @param targetDescription
* @param postOperationEnabled
*/
public MoveDescriptionElementsOperation(String label,
- IUndoContext undoContext, DescriptionBase targetDescription,
+ IUndoContext undoContext, DescriptionBase targetDescription,
Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, postOperationEnabled);
this.targetDescription = targetDescription;
this.descriptionElements = descriptionElements;
this.isCopy = isCopy;
-
+
service = CdmStore.getService(IDescriptionService.class);
}
+ public MoveDescriptionElementsOperation(String label,
+ IUndoContext undoContext, UUID targetTaxonUuid,String moveMessage,
+ Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
+ IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, postOperationEnabled);
+ this.targetTaxonUuid = targetTaxonUuid;
+ this.descriptionElements = descriptionElements;
+ this.moveMessage = moveMessage;
+ this.isCopy = isCopy;
+
+ service = CdmStore.getService(IDescriptionService.class);
+ }
+
/* (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 {
-
-
- service.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isCopy);
-
-
+
+ Set<UUID> descriptionElementsUuid = new HashSet<UUID>();
+ for(DescriptionElementBase deBase : descriptionElements) {
+ descriptionElementsUuid.add(deBase.getUuid());
+ }
+ UpdateResult result;
+ if(targetDescription == null){
+ result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetTaxonUuid, moveMessage, isCopy);
+
+ } else {
+ UUID targetDescriptionUuid = targetDescription.getUuid();
+ result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetDescriptionUuid, isCopy);
+
+ }
return postExecute(targetDescription);
}
// TODO Auto-generated method stub
return null;
}
-
-
+
+
}
// $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.
*/
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.model.common.Annotation;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
public class MoveDescriptionToOtherTaxonOperation extends
AbstractPersistentPostOperation {
-
- private TaxonNode newAcceptedTaxonNode;
- private TaxonDescription description;
-
+ private final TaxonNode newAcceptedTaxonNode;
+
+ private final TaxonDescription description;
+
/**
* <p>Constructor for ChangeAcceptedTaxonToSynonymOperation.</p>
*
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public MoveDescriptionToOtherTaxonOperation(String label,
- IUndoContext undoContext, TaxonDescription description, TaxonNode targetTaxonNode,
- IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled); // FIXME is this the right constructor ???
+ IUndoContext undoContext,
+ TaxonDescription description,
+ TaxonNode targetTaxonNode,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); // FIXME is this the right constructor ???
this.description = description;
this.newAcceptedTaxonNode = targetTaxonNode;
}
monitor.worked(20);
bind();
-
+
String moveMessage = String.format("Description moved from %s", EditorUtil.getActiveMultiPageTaxonEditor().getTaxon());
if(description.isProtectedTitleCache()){
String separator = "";
annotation.setAnnotationType(AnnotationType.TECHNICAL());
description.addAnnotation(annotation);
newAcceptedTaxonNode.getTaxon().addDescription(description);
- CdmStore.getService(IDescriptionService.class).saveOrUpdate(description);
+ if (CdmApplicationState.getCurrentAppConfig() instanceof CdmApplicationRemoteController) {
+ CdmStore.getService(IDescriptionService.class).merge(description, true);
+ } else {
+ CdmStore.getService(IDescriptionService.class).saveOrUpdate(description);
+ }
+
+ // CdmStore.getService(IDescriptionService.class).moveTaxonDescription(description.getUuid(), newAcceptedTaxonNode.getTaxon().getUuid());
monitor.worked(40);
-
+
return postExecute(description);
}
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
+import eu.etaxonomy.cdm.model.description.IDescribable;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
/**
- * <p>MediaViewPart class.</p>
- *
* @author n.hoffmann
* @created Jun 15, 2010
* @version 1.0
*/
public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
- /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.medi"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.media";
private TreeViewer viewer;
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createViewer(Composite parent) {
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#getInitialSelection()
- */
/** {@inheritDoc} */
@Override
protected ISelection getInitialSelection() {
return;
}
- if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
- // do not show empty page as these views are also used to edit the description selected in this view
+ if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+ || part instanceof DescriptiveViewPart) {
+ // do not show empty page as these views are also used to edit the
+ // description selected in this view
return;
}
if(part instanceof IPartContentHasMedia && ((IPartContentHasMedia) part).canAttachMedia()){
- if(part instanceof MultiPageTaxonEditor){
- IEditorInput input = ((IEditorPart) part).getEditorInput();
- showViewer(part, new StructuredSelection(input));
- }
- else if(selection instanceof IStructuredSelection){
+ if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if(firstElement instanceof TreeNode){
showViewer(part, new StructuredSelection(((TreeNode) firstElement).getValue()));
+ return;
}
- else{
+ else if(firstElement!=null
+ && firstElement instanceof IDescribable<?>){
showViewer(part, (IStructuredSelection) selection);
+ return;
}
- }else{
- showEmptyPage();
}
}
- else{
- showEmptyPage();
- }
+ showEmptyPage();
}
/** {@inheritDoc} */
// take a look at ISaveblePart
if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
((BulkEditor) part).forceDirty();
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
+ ((BulkEditor) part).changed(selection.getFirstElement());
+ }
}
super.changed(object);
}
return viewer;
}
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
@Override
public boolean onComplete() {
return true;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.AddDerivedUnitFacadeMediaOperation;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateSpecimenDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
/**
- * <p>AddImageGalleryHandler class.</p>
- *
* @author p.ciardelli
* @version $Id: $
*/
public class AddImageGalleryHandler extends AbstractHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+ if(part instanceof MediaViewPart){
+ Object viewerInput = ((MediaViewPart)part).getViewer().getInput();
+ try {
+ if(viewerInput instanceof CdmBase){
+ if(((CdmBase) viewerInput).isInstanceOf(Taxon.class)){
+ Taxon taxon = HibernateProxyHelper.deproxy(viewerInput, Taxon.class);
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- IEditorInput input = editor.getEditorInput();
+ AbstractPostOperation<?> operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(),
+ EditorUtil.getUndoContext(), taxon, postOperationEnabled, true);
- if (input instanceof TaxonEditorInput) {
- Taxon taxon = ((TaxonEditorInput) input).getTaxon();
- AbstractPostOperation<?> operation;
- try {
- // TODO use undo context specific to editor
- operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(),
- EditorUtil.getUndoContext(), taxon, postOperationEnabled, true);
- AbstractUtility.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set.");
- }
- }
- else if(input instanceof OccurrenceEditorInput){
- BulkEditor bulkEditor = (BulkEditor) editor;
- ISelection selection = bulkEditor.getSelectionProvider().getSelection();
- invokeOperation(event, postOperationEnabled, selection);
- }
- else if(input instanceof DerivateViewEditorInput){
- ISelection selection = ((DerivateView)editor).getSelection();
- invokeOperation(event, postOperationEnabled, selection);
- } else if(part instanceof MediaViewPart){
- Object viewerInput = ((MediaViewPart)part).getViewer().getInput();
-
- if(viewerInput instanceof Taxon){
- Taxon taxon = HibernateProxyHelper.deproxy(viewerInput, Taxon.class);
- AbstractPostOperation<?> operation;
- try {
- // TODO use undo context specific to editor
- operation = new CreateTaxonDescriptionOperation(event.getCommand().getName(),
- EditorUtil.getUndoContext(), taxon, postOperationEnabled, true);
- AbstractUtility.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set.");
- }
-
- }
- }
-
- return null;
- }
+ AbstractUtility.executeOperation(operation);
+ }
+ else if(((CdmBase) viewerInput).isInstanceOf(SpecimenOrObservationBase.class)){
+ SpecimenOrObservationBase<?> specimen = HibernateProxyHelper.deproxy(viewerInput, SpecimenOrObservationBase.class);
- /**
- * @param event
- * @param postOperationEnabled
- * @param selection
- */
- private void invokeOperation(ExecutionEvent event, IPostOperationEnabled postOperationEnabled, ISelection selection) {
- if(selection instanceof IStructuredSelection){
- Object element = ((IStructuredSelection) selection).getFirstElement();
- if(element instanceof TreeNode){
- element = ((TreeNode) element).getValue();
- }
- if(element instanceof SpecimenOrObservationBase<?>){
- try {
- AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(event.getCommand().getName(),
- BulkEditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>)element, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set.");
- }
- }
- }
- }
+ AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(event.getCommand().getName(),
+ BulkEditorUtil.getUndoContext(), specimen, postOperationEnabled);
+
+ AbstractUtility.executeOperation(operation);
+ }
+ }
+ } catch (NotDefinedException e) {
+ MessagingUtils.warn(getClass(), "Command name not set.");
+ }
+ }
+ return null;
+ }
-}
+}
\ No newline at end of file
+++ /dev/null
-### ************ APPENDER ***********************************###\r
-\r
-### direct log messages to stdout ###\r
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
-log4j.appender.stdout.Target=System.out\r
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n\r
-\r
-### direct messages to file hibernate.log ###\r
-log4j.appender.file=org.apache.log4j.FileAppender\r
-log4j.appender.file.File=taxeditor.log\r
-log4j.appender.file.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n\r
-\r
-### ************* LOG LEVELS *********************************###\r
-\r
-### set log levels - for more verbose logging change 'info' to 'debug' ###\r
-### levels: error, warn, debug, info\r
-log4j.rootLogger=INFO, stdout\r
-\r
-### set directory-specific levels below\r
-\r
-### basic level for editor directory\r
-log4j.logger.eu.etaxonomy.taxeditor.editor = WARN, stdout \r
-\r
-log4j.logger.eu.etaxonomy.taxeditor.editor.handler = DEBUG, stdout\r
-\r
-### log level for conversation handler\r
-#log4j.logger.eu.etaxonomy.cdm.api.application = DEBUG, stdout\r
-\r
-log4j.logger.org.springframework.orm.hibernate3 = WARN, stdout \r
-\r
-\r
// $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.
*/
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
/**
*/
public class CreateSynonymInExisitingHomotypicalGroupOperationTest extends AbstractTaxeditorOperationTestBase {
- private TaxonNameBase newSynonymName;
+ private NonViralName newSynonymName;
private HomotypicalGroup homotypicalGroup;
private NonViralName<?> taxonName;
-
+
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
-
+
taxonName = NonViralName.NewInstance(null);
taxon = Taxon.NewInstance(taxonName, null);
-
+
homotypicalGroup = HomotypicalGroup.NewInstance();
newSynonymName = NonViralName.NewInstance(null);
-
+
operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
undoContext, taxon, homotypicalGroup, newSynonymName, postOperation);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- *
+ *
* Homotypic group is the Taxons homotypic group, so we expect the synonym to be homotypic to the accepted taxon.
- *
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
- public void testExecuteTaxonHomotypicGroup() throws ExecutionException {
+ public void testExecuteTaxonHomotypicGroup() throws ExecutionException {
homotypicalGroup.addTypifiedName(taxonName);
operation.execute(monitor, info);
-
+
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic synonym now", taxon.getHomotypicSynonymsByHomotypicGroup().size() > 0);
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- *
+ *
* Homotypic group is not the accepted taxons. Heterotypic synonym should be created.
- *
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
- public void testExecuteSynonymHomotypicGroup() throws ExecutionException {
+ public void testExecuteSynonymHomotypicGroup() throws ExecutionException {
// test heterotypic synonym
operation.execute(monitor, info);
-
+
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic group", taxon.getHomotypicSynonymyGroups().size() > 0);
Assert.assertEquals("Synonym relationship should be heterotypic", SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF(), taxon.getSynonymRelations().toArray(new SynonymRelationship[0])[0].getType());
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testUndoTaxonHomotypicGroup() throws ExecutionException {
homotypicalGroup.addTypifiedName(taxonName);
-
+
operation.execute(monitor, info);
operation.undo(monitor, info);
-
+
Assert.assertTrue("There should not be synonym relationships for the taxon", taxon.getSynonyms().size() == 0);
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testUndoSynonymHomotypicGroup() throws ExecutionException {
operation.execute(monitor, info);
operation.undo(monitor, info);
-
+
Assert.assertTrue("There should not be synonym relationships for the taxon", taxon.getSynonyms().size() == 0);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testRedoTaxonHomotypicGroup() throws ExecutionException {
homotypicalGroup.addTypifiedName(taxonName);
-
+
operation.execute(monitor, info);
- operation.undo(monitor, info);
+ operation.undo(monitor, info);
operation.redo(monitor, info);
-
+
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic synonym now", taxon.getHomotypicSynonymsByHomotypicGroup().size() > 0);
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testRedoSynonymHomotypicGroup() throws ExecutionException {
operation.execute(monitor, info);
- operation.undo(monitor, info);
+ operation.undo(monitor, info);
operation.redo(monitor, info);
-
+
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic group", taxon.getHomotypicSynonymyGroups().size() > 0);
Assert.assertEquals("Synonym relationship should be heterotypic", SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF(), taxon.getSynonymRelations().toArray(new SynonymRelationship[0])[0].getType());
// $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.
*/
private static DescriptionElementBase descriptionElement;
private static TaxonDescription description;
-
+
/**
* @throws java.lang.Exception
*/
public static void setUpBeforeClass() throws Exception {
taxon = Taxon.NewInstance(null, null);
descriptionElement = TextData.NewInstance();
-
+
description = TaxonDescription.NewInstance();
-
+
description.addElement(descriptionElement);
-
+
taxon.addDescription(description);
-
-
- operation = new DeleteDescriptionElementOperation("", undoContext, descriptionElement, postOperation);
+
+
+ operation = new DeleteDescriptionElementOperation("", undoContext, descriptionElement, postOperation, cdmEntitySessionEnabled);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
operation.execute(monitor, info);
-
+
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() == 0);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
operation.undo(monitor, info);
-
+
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() > 0);
Assert.assertEquals(descriptionElement, taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().toArray(new DescriptionElementBase[0])[0]);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
operation.redo(monitor, info);
-
+
Assert.assertTrue(taxon.getDescriptions().toArray(new TaxonDescription[0])[0].getElements().size() == 0);
}
}
/**
* 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.
*/
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
public class SwapSynonymAndAcceptedOperationTest extends AbstractTaxeditorOperationTestBase {
private static final Logger logger = Logger
.getLogger(SwapSynonymAndAcceptedOperationTest.class);
-
+
private static AbstractPostOperation operation;
private static Taxon taxon;
private static NonViralName<?> oldTaxonName;
-
+
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
-
+
(new DefaultTermInitializer()).initialize();
-
+
// Create the original accepted taxon
oldTaxonName = NonViralName.NewInstance(null);
taxon = Taxon.NewInstance(oldTaxonName, null);
-
+
// Create its parent taxon
parentTaxon = Taxon.NewInstance(NonViralName.NewInstance(null), null);
parentTaxon.addTaxonomicChild(taxon, null, null);
// Give it a child taxon
childTaxon = Taxon.NewInstance(NonViralName.NewInstance(null), null);
childTaxon.setTaxonomicParent(taxon, null, null);
-
+
// Create a homotypic synonym for the accepted taxon
taxon.addHomotypicSynonymName(NonViralName.NewInstance(null), null, null);
// homotypicSynonym = Synonym.NewInstance(NonViralName.NewInstance(null), null);
// HomotypicalGroup acceptedHomotypicalGroup = HomotypicalGroup.NewInstance();
// acceptedHomotypicalGroup.addTypifiedName(oldTaxon.getName());
// acceptedHomotypicalGroup.addTypifiedName(homotypicSynonym.getName());
-
+
// Create a heterotypic synonym that will be used to create the new accepted taxon
oldSynonymName = NonViralName.NewInstance(null);
oldHeterotypicSynonym = Synonym.NewInstance(oldSynonymName, null);
heteroypicalGroup = HomotypicalGroup.NewInstance();
heteroypicalGroup.addTypifiedName(oldHeterotypicSynonym.getName());
taxon.addSynonym(oldHeterotypicSynonym, SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF());
-
+
// Create a misapplication
misapplication = Taxon.NewInstance(NonViralName.NewInstance(null), null);
- taxon.addMisappliedName(misapplication, null, null);
-
+ taxon.addMisappliedName(misapplication, null, null);
+
// Create a concept relation
concept = Taxon.NewInstance(NonViralName.NewInstance(null), null);
conceptRelationshipType = TaxonRelationshipType.CONGRUENT_TO();
- concept.addTaxonRelation(taxon, conceptRelationshipType, null, null);
-
+ concept.addTaxonRelation(taxon, conceptRelationshipType, null, null);
+
// Create a description
description = TaxonDescription.NewInstance();
taxon.addDescription(description);
-
+
operation = new SwapSynonymAndAcceptedOperation
- (null, undoContext, taxon, oldHeterotypicSynonym, postOperation);
+ (null, undoContext, taxon, oldHeterotypicSynonym, postOperation, cdmEntitySessionEnabled);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testExecute() throws ExecutionException {
operation.execute(null, null);
-
- // New taxon has correct name?
+
+ // New taxon has correct name?
Assert.assertEquals(taxon.getName(), oldSynonymName);
-
+
// New taxon has correct parent?
Assert.assertEquals(taxon.getTaxonomicParent(), parentTaxon);
-
+
// New taxon has correct child?
Assert.assertTrue(taxon.getTaxonomicChildren().contains(childTaxon));
-
+
// New taxon has 2 synonyms?
Assert.assertEquals(taxon.getSynonyms().size(), 2);
-
+
// New taxon has a synonym with the name of the previous accepted taxon?
Assert.assertTrue(taxon.getSynonymNames().contains(oldTaxonName));
-
+
// New taxon has misapplication?
Assert.assertTrue(taxon.getMisappliedNames().contains(misapplication));
-
+
// New taxon has 1 concept relation?
int conceptRelCount = 0;
for (TaxonRelationship relation : taxon.getTaxonRelations()) {
conceptRelCount++;
}
Assert.assertEquals(conceptRelCount, 1);
-
+
// New taxon has description?
taxon.getDescriptions().contains(description);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testUndo() throws ExecutionException {
operation.undo(null, null);
-
+
// Assert.assertEquals(oldHomotypicalGroup, synonym.getHomotypicGroup());
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testRedo() throws ExecutionException {
operation.redo(null, null);
-
+
// Assert.assertEquals(newHomotypicalGroup, synonym.getHomotypicGroup());
}
--- /dev/null
+<projectDescription>
+ <name>eu.etaxonomy.taxeditor.feature.jre.linux64</name>
+ <comment></comment>
+ <projects>
+ <project>eu.etaxonomy.taxeditor.application</project>
+ <project>eu.etaxonomy.taxeditor.bulkeditor</project>
+ <project>eu.etaxonomy.taxeditor.cdmlib</project>
+ <project>eu.etaxonomy.taxeditor.editor</project>
+ <project>eu.etaxonomy.taxeditor.feature.platform</project>
+ <project>eu.etaxonomy.taxeditor.navigation</project>
+ <project>eu.etaxonomy.taxeditor.printpublisher</project>
+ <project>eu.etaxonomy.taxeditor.store</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
--- /dev/null
+The contents of this feature are subject to the Eclipse Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+http://www.eclipse.org/legal/epl-v10.html
+
+Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
\ No newline at end of file
--- /dev/null
+bin.includes = feature.xml,\
+ p2.inf,\
+ jre/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="eu.etaxonomy.taxeditor.feature.jre.linux64"
+ label="Taxonomic Editor JRE Linux64"
+ version="4.0.0.qualifier"
+ provider-name="EDIT"
+ plugin="eu.etaxonomy.taxeditor.application"
+ os="linux"
+ ws="gtk"
+ arch="x86_64">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.equinox.ds"/>
+ <import plugin="org.eclipse.equinox.util"/>
+ <import plugin="org.eclipse.equinox.p2.core"/>
+ <import plugin="org.eclipse.equinox.p2.ui"/>
+ <import plugin="org.eclipse.equinox.p2.ui.sdk"/>
+ <import plugin="org.eclipse.equinox.p2.updatechecker"/>
+ <import plugin="org.eclipse.equinox.p2.operations"/>
+ <import plugin="org.eclipse.equinox.app"/>
+ <import plugin="org.eclipse.osgi"/>
+ <import plugin="org.eclipse.ui.editors"/>
+ <import plugin="org.eclipse.core.expressions"/>
+ <import plugin="eu.etaxonomy.taxeditor.cdmlib" version="3.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.jface.text"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.ui.forms"/>
+ <import plugin="org.eclipse.core.databinding.beans"/>
+ <import plugin="org.eclipse.core.databinding.observable"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.jface.databinding"/>
+ <import plugin="org.eclipse.ui.navigator"/>
+ <import plugin="org.eclipse.ui.navigator.resources"/>
+ <import plugin="org.eclipse.core.jobs"/>
+ <import plugin="org.eclipse.pde.runtime"/>
+ <import plugin="org.eclipse.core.commands"/>
+ <import plugin="org.eclipse.jface"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.eclipse.equinox.common" version="3.6.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.update.configurator"/>
+ <import plugin="org.eclipse.equinox.p2.publisher.eclipse"/>
+ </requires>
+
+</feature>
--- /dev/null
+instructions.configure=\
+org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:features/eu.etaxonomy.taxeditor.feature.jre.linux64_3.12.0/jre/bin);
+instructions.unconfigure=\
+org.eclipse.equinox.p2.touchpoint.eclipse.setJvm(jvm:null);
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>taxeditor-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>eu.etaxonomy.taxeditor.feature.jre.linux64</artifactId>
+ <packaging>eclipse-feature</packaging>
+
+ <name>Taxonomic Editor Feature JRE Linux 64</name>
+ <description />
+ <url>http://dev.e-taxonomy.eu/trac/wiki/TaxonomicEditorEditorBundle</url>
+</project>
<feature
id="eu.etaxonomy.taxeditor.feature.platform"
label="Taxeditor Dependencies"
- version="3.8.0.qualifier"
+ version="4.0.0.qualifier"
os="linux,macosx,win32"
ws="cocoa,gtk,win32"
arch="x86,x86_64">
<update label="EDIT Taxonomic Editor" url="http://wp5.e-taxonomy.eu/taxeditor/update"/>
</url>
- <plugin
- id="com.ibm.icu"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.eclipse.ant.core"
download-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.sat4j.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.sat4j.pb"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.eclipse.equinox.p2.metadata.repository"
download-size="0"
fragment="true"
unpack="false"/>
- <plugin
- id="org.apache.lucene"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.lucene.analysis"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.eclipse.help.base"
download-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.apache.lucene.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.eclipse.equinox.jsp.jasper"
download-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.apache.commons.httpclient"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.apache.httpcomponents.httpclient"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.eclipse.ecf.provider.filetransfer.httpclient"
download-size="0"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
+++ /dev/null
-when updating the build.properties file make sure to apply the updates on both
-build.properties.with.jre and
-build.properties.wo.jre
root.win32.win32.x86=win-32
root.win32.win32.x86.permissions.755=jre/bin/**
root.macosx.cocoa.x86_64=mac-64
-root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/jre/bin/**
\ No newline at end of file
+root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/jre/bin/**
<feature
id="eu.etaxonomy.taxeditor.feature"
label="Taxonomic Editor"
- version="3.8.0.qualifier"
+ version="4.0.0.qualifier"
provider-name="EDIT"
plugin="eu.etaxonomy.taxeditor.application"
os="linux,macosx,win32"
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="eu.etaxonomy.taxeditor.webapp"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry kind="src" path="src"/>\r
- <classpathentry kind="output" path="target"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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"/>
+ <classpathentry kind="output" path="target"/>
+</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Help
Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
Bundle-Vendor: EDIT
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.help.ui,
org.eclipse.help.webapp
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <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 exported="true" kind="lib" path="lib/bioinfweb-commons-bio-2-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bioinfweb-commons-core-2-SNAPSHOT.jar"/>
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-ClassPath: .,
lib/bioinfweb-commons-bio-2-SNAPSHOT.jar,
lib/bioinfweb-commons-core-2-SNAPSHOT.jar,
Bundle-ActivationPolicy: lazy
Import-Package: javax.swing
Require-Bundle: org.eclipse.swt
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<build>
timestamp</echo>
<move todir="./lib">
<fileset dir="./lib" />
- <mapper type="regexp"
- from="(^bioinfweb\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+ <mapper type="regexp" from="(^bioinfweb\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
</move>
<move todir="./lib">
<fileset dir="./lib" />
- <mapper type="regexp"
- from="(^libralign\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+ <mapper type="regexp" from="(^libralign\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
</move>
<move todir="./lib">
<fileset dir="./lib" />
- <mapper type="regexp"
- from="(^tic\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+ <mapper type="regexp" from="(^tic\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
</move>
<move todir="./lib">
<fileset dir="./lib" />
- <mapper type="regexp"
- from="(^core\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
+ <mapper type="regexp" from="(^core\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
</move>
<move todir="./lib">
<fileset dir="./lib" />
- <mapper type="regexp"
- from="(^sequencing\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
+ <mapper type="regexp" from="(^sequencing\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
</move>
</target>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
Bundle-ManifestVersion: 2
Bundle-Name: Molecular Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.store,
eu.etaxonomy.taxeditor.molecular.lib
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.molecular,
eu.etaxonomy.taxeditor.molecular.editor,
eu.etaxonomy.taxeditor.molecular.handler
-Bundle-ClassPath: .
--- /dev/null
+#Properties file for eu.etaxonomy.taxeditor.molecular
+editor.ALIGNMENT_EDITOR = Alignment Editor
+view.PHEROGRAM_VIEW = Pherogram View
+command.EDIT_SEQUENCE = Edit Sequence
+command.name.SHOW_PHEROGRAM = Show Pherogram
+command.name.CUT_PHEROGRAM_LEFT = Cut pherogram left
+command.name.CUT_PHEROGRAM_RIGHT = Cut pherogram right
+command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Reverse complement selected rows
+command.name.CREATE_CONSENUS_SEQUENCE = (Re)create consensus sequence
+command.name.UPDATE_CONSENSUS_SEQUENCE = Update consensus sequence
+command.name.TOGGLE_SHOW_PROBABILITY_VALUES = Toggle show probability values
+command.name.TOGGLE_SHOW_BASE_CALL_LINES = Toggle show base call lines
+command.name.CHANGE_QUALITY_OUTPUT = Change quality output
+command.name.LOAD_PHEROGRAM = Load Pherogram
+command.name.TOGGLE_INSERT_OVERWRITE = Toggle insert/overwrite
+command.name.TOGGLE_LEFT_RIGHT_INSERTION = Toggle left/right insertion in base call sequence
+command.TOGGLE_INSERT_OVERWRITE = Toggle insert/overwrite
+menu.ALIGNMENT_EDITOR = Alignment Editor
+menu.label.PHEROGRAM_VIEW = Pherogram View
+command.label.EDIT_SEQUENCE = Edit Sequence
+command.label.SHOW_PHEROGRAM = Show Pherogram
\ No newline at end of file
--- /dev/null
+#Properties file for eu.etaxonomy.taxeditor.molecular
+editor.ALIGNMENT_EDITOR = Alignment Editor
+view.PHEROGRAM_VIEW = PherogramView
+command.EDIT_SEQUENCE = Edit Sequence
+command.name.SHOW_PHEROGRAM = Show Pherogram
+command.name.CUT_PHEROGRAM_LEFT = Cut pherogram left
+command.name.CUT_PHEROGRAM_RIGHT = Cut pherogram right
+command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Reverse complement selected rows
+command.name.CREATE_CONSENUS_SEQUENCE = (Re)create consensus sequence
+command.name.UPDATE_CONSENSUS_SEQUENCE = Update consensus sequence
+command.name.TOGGLE_SHOW_PROBABILITY_VALUES = Toggle show probability values
+command.name.TOGGLE_SHOW_BASE_CALL_LINES = Toggle show base call lines
+command.name.CHANGE_QUALITY_OUTPUT = Change quality output
+command.name.LOAD_PHEROGRAM = Load Pherogram
+command.name.TOGGLE_INSERT_OVERWRITE = Toggle insert/overwrite
+command.name.TOGGLE_LEFT_RIGHT_INSERTION = Toggle left/right insertion in base call sequence
+command.TOGGLE_INSERT_OVERWRITE = Toggle insert/overwrite
+menu.ALIGNMENT_EDITOR = Alignment Editor
+menu.label.PHEROGRAM_VIEW = Pherogram View
+command.label.EDIT_SEQUENCE = Edit Sequence
+command.label.SHOW_PHEROGRAM = Show Pherogram
\ No newline at end of file
+++ /dev/null
-#Properties file for taxeditor-editor
-Bundle-Vendor.0 = EDIT
-Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle
-command.name.17 = Set Basionym
-command.name.18 = Remove Basionym
-editor.name = Multipage Taxon Editor
-editor.name.0 = Taxon Name Editor
-editor.name.1 = Key
-editor.name.2 = Polytomous Key Graph Editor
-editor.name.3 = Polytomous Key List Editor
-editor.name.4 = Cdm Authority Editor
-editor.name.5 = Derivative View
-view.name = Factual Data
-view.name.0 = Uses
-view.name.1 = Media
-view.name.2 = Concept Relations
-view.name.3 = Concept Graph
-category.name = Taxonomic Editor
-command.label = Reference
-command.label.0 = Name
-command.label.1 = Team
-command.label.2 = Person
-command.label.3 = Specimen
-command.label.4 = Factual Data
-command.label.5 = Media
-command.label.6 = Concept
-command.label.7 = Concept Graph
-command.label.8 = Open Parent
-menu.label = New
-command.label.9 = Heterotypic Synonym
-command.label.10 = Homotypic Synonym
-command.label.11 = Synonym In Homotypical Group
-menu.label.0 = Change To
-command.label.12 = Accepted Taxon
-command.label.13 = Synonym
-command.label.14 = Misapplication
-command.label.15 = Delete
-command.label.16 = Delete All Empty Names
-command.label.17 = Swap Synonym With Accepted
-command.label.18 = Show Details
-command.label.19 = Save
-command.label.20 = New Node
-command.label.21 = Delete
-command.label.22 = Apply Layout
-command.label.23 = New Key Number
-command.label.24 = New Alternative
-command.label.25 = Refresh Nodes
-command.label.26 = Delete
-command.label.27 = New Factual Data
-menu.label.1 = New
-command.label.28 = Move Description to Taxon
-command.label.29 = Move Elements to Taxon
-command.label.30 = Delete
-command.label.31 = Save
-menu.label.2 = New Derivative
-command.label.32 = New Use
-command.label.33 = New Use Summary
-command.label.34 = New Use Record
-command.label.35 = Delete
-command.label.36 = Save
-command.label.37 = New Image Gallery
-command.label.38 = New Image
-command.label.39 = Move Image Up In List
-command.label.40 = Move Image Down In List
-command.label.41 = Delete
-command.label.42 = Save
-menu.label.3 = New
-command.label.43 = Open Related Concept
-command.label.44 = Delete
-command.label.45 = Edit Authorities
-extension.name = Name Commands
-category.name.0 = -- Name Editor
-command.name = Open Parent
-command.name.0 = Create Homotypic Synonym
-command.name.1 = Create Heterotypic Synonym
-command.name.2 = Create Synonym In Homotypical Group
-command.name.3 = Change To Synonym
-command.name.4 = Change To Accepted Taxon
-command.name.5 = Change To Misapplication
-command.name.6 = Swap Synonym With Accepted
-
-command.name.7 = Set Basionym / Original Combination
-command.name.8 = Remove Basionym / Original Combination
-command.name.9 = Delete All Empty Names
-category.name.1 = -- Factual
-command.name.10 = Create Description Element
-command.name.11 = New Description
-command.name.12 = Move Description Elements to Taxon
-command.name.13 = Move Description to Taxon
-category.name.2 = -- New Uses
-command.name.14 = New Use
-command.name.15 = New Use Summary
-command.name.16 = New Use Record
-category.name.3 = -- Media
-command.name.19 = Move Image Down In List
-command.name.20 = New Image Gallery
-command.name.21 = New Image
-command.name.22 = Move Image Up In List
-category.name.4 = -- New Entity
-command.name.23 = New Reference
-command.name.24 = New Name
-command.name.25 = New Team
-command.name.26 = New Person
-command.name.27 = New Specimen
-category.name.5 = -- Polytomous Keys
-command.name.28 = New Child Node
-command.name.29 = New Sibling Node
-command.name.30 = Refresh Node Numbering
-command.name.31 = Apply Layout
-category.name.6 = -- Concept Relations
-command.name.32 = Create Concept Relation
-command.name.33 = Open Related Concept
-category.name.7 = -- Group
-command.name.34 = Edit CDM Authorities
-command.name.35 = Open Derivative View
-scheme.description = The default key binding scheme for the Taxonomic Editor
-scheme.name = Taxonomic Editor Default Key Bindings
-editor.name.6 = Specimen Import Editor
-editor.name.7 = Gbif Import Editor
-editor.name.8 = Checklist Editor
-view.name.4 = Specimen Import
-view.name.5 = GBIF Specimen Import
-command.label.46 = Name
-command.label.47 = Reference
-command.label.48 = Datasource
-command.label.49 = Misapplication
-command.label.50 = Use Existing Image
-command.name.36 = Create Misapplication
-command.name.37 = Use Existing Image
-command.name.38 = Open Checklist Editor
-command.name.39 = New Datasource
-wizard.name = Specimen Search/Import
-wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
-command.name.40 = Validation
-view.name.6 = Validation
-marker.field.0 = Object Type
-marker.field.1 = Object
-marker.field.2 = Attribute
-marker.field.3 = Problematic Value
-marker.field.4 = Problem description
-marker.field.5 = Validator
-marker.field.6 = Entity Class
-marker.field.7 = Entity Id
-extension.name.0 = Validation Error
-command.label.51 = Open in Specimen Editor
-command.label.52 = Delete
-command.label.53 = Create Field Unit
-command.label.54 = Delete (with children)
-command.tooltip = Show Only Individuals Associations
-command.label.55 = Open Associated Specimens
-command.name.41 = Show Only Individual Associations
-command.name.42 = Open Taxon Editor
-command.name.43 = Create Field Unit
-command.name.44 = Deep Delete
-command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon
-command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon
-markerContentGenerator.name = Validation Problems Marker Generator
-command.name.45 = Delete
-command.name.47 = Delete
-commandParameter.name = taxonUUID
-Bundle-Name = Editor Bundle
-command.name.48 = delete
-command.name.49 = delete
-command.name.50 = delete
\ No newline at end of file
+++ /dev/null
-# Properties file for taxeditor-editor
-Bundle-Vendor.0 = EDIT
-Bundle-Name.0 = EDIT Taxonomischer Editor - Editor Bundle
-command.name.17 = Setze Basionym
-command.name.18 = Entferne Basionym
-editor.name = Multipage Taxon Editor
-editor.name.0 = Editor Taxonname
-editor.name.1 = Bestimmungsschl\u00fcssel
-editor.name.2 = Polytomer Bestimmungsschl\u00fcssel Graph Editor
-editor.name.3 = Polytomer Bestimmungsschl\u00fcssel List Editor
-editor.name.4 = CDM Rechtemanagement
-editor.name.5 = Ansicht Derivate
-view.name = Faktendaten
-view.name.0 = Nutzung
-view.name.1 = Medien
-view.name.2 = Konzeptrelationen
-view.name.3 = Konzeptgraph
-category.name = Taxonomischer Editor
-command.label = Referenz
-command.label.0 = Name
-command.label.1 = Team
-command.label.2 = Person
-command.label.3 = Beleg
-command.label.4 = Faktendaten
-command.label.5 = Medien
-command.label.6 = Konzeptrelationen
-command.label.7 = Konzeptgraph
-command.label.8 = \u00d6ffne Parent
-menu.label = Neue
-command.label.9 = Heterotypisches Synonym
-command.label.10 = Homotypisches Synonym
-command.label.11 = Synonym in Homotypischer Gruppe
-menu.label.0 = \u00c4ndere zu
-command.label.12 = Akzeptiertes Taxon
-command.label.13 = Synonym
-command.label.14 = Misapplication
-command.label.15 = L\u00f6schen
-command.label.16 = L\u00f6sche alle leeren Namen
-command.label.17 = Tausche Synonym mit akzeptiertem Namen
-command.label.18 = Zeige Details
-command.label.19 = Speichern
-command.label.20 = Neue Knoten
-command.label.21 = L\u00f6schen
-command.label.22 = Wende Layout an
-command.label.23 = Neue Bestimmungsschl\u00fcsselnummer
-command.label.24 = Neue Alternative
-command.label.25 = Erneuere Knoten
-command.label.26 = L\u00f6schen
-command.label.27 = Neue Faktendaten
-menu.label.1 = Neue
-command.label.28 = Verschiebe Eigenschaften zu Taxon
-command.label.29 = Verschiebe Elemente zu Taxon
-command.label.30 = L\u00f6schen
-command.label.31 = Speichern
-menu.label.2 = Neue Derivate
-command.label.32 = Neue Nutzung
-command.label.33 = Neue Zusammenfassung
-command.label.34 = Neuer Nutzungsdatensatz
-command.label.35 = L\u00f6schen
-command.label.36 = Speichern
-command.label.37 = Neue Bildergalerie
-command.label.38 = Neues Bild
-command.label.39 = Bild nach oben
-command.label.40 = Bild nach unten
-command.label.41 = L\u00f6schen
-command.label.42 = Speichern
-menu.label.3 = Neue
-command.label.43 = \u00d6ffne verbundenes Konzept
-command.label.44 = L\u00f6schen
-command.label.45 = Bearbeite Rechte
-extension.name = Namensbefehle
-category.name.0 = -- Namenseditor
-command.name = \u00d6ffne Elter
-command.name.0 = Erstelle homotypisches Synonym
-command.name.1 = Erstelle heterotypisches Synonym
-command.name.2 = Erstelle Synonym in homotypischer Gruppe
-command.name.3 = \u00c4ndere zu Synonym
-command.name.4 = \u00c4ndere zu akzeptiertem Taxon
-command.name.5 = \u00c4ndere zu Misapplication
-command.name.6 = Tausche Synonym mit akzeptiertem Namen
-
-command.name.7 = Setze Basionym / Originalkombination
-command.name.8 = Entferne Basionym / Originalkombination
-command.name.9 = L\u00f6sche alle leeren Namen
-category.name.1 = -- Fakten
-command.name.10 = Erstelle Beschreibungselement
-command.name.11 = Neue Beschreibung
-command.name.12 = Bewege Beschreibungselement zu Taxon
-command.name.13 = Bewege Beschreibung zu Taxon
-category.name.2 = -- Neue Nutzung
-command.name.14 = Neue Nutzung
-command.name.15 = Neue Zusammenfassung
-command.name.16 = Neuer Nutzungsdatensatz
-category.name.3 = -- Media
-command.name.19 = Bewege Bild nach unten
-command.name.20 = Neue Bildergalerie
-command.name.21 = Neues Bild
-command.name.22 = Bewege Bild nach oben
-category.name.4 = -- Neue Entit\u00e4t
-command.name.23 = Neue Referenz
-command.name.24 = Neuer Name
-command.name.25 = Neues Team
-command.name.26 = Neue Person
-command.name.27 = Neuer Beleg
-category.name.5 = -- Polytomer Bestimmungsschl\u00fcssel
-command.name.28 = Neue Kinderknoten
-command.name.29 = Neuer Geschwisterknoten
-command.name.30 = Knotennummerierung aktualisieren
-command.name.31 = Layout anwenden
-category.name.6 = -- Konzeptbeziehungen
-command.name.32 = Erstelle Konzeptrelationen
-command.name.33 = \u00d6ffne verbundenes Konzept
-category.name.7 = -- Gruppe
-command.name.34 = Bearbeite CDM Rechte
-command.name.35 = \u00d6ffne Derivate Ansicht
-scheme.description = Die Standard Tastenkombinationsschema f\u00fcr den Taxonomischen Editor
-scheme.name = Taxonomic Editor Standard Tastenkombinationen
-editor.name.6 = Specimen Import Editor
-editor.name.7 = GBIF Import Editor
-editor.name.8 = Checklist Editor
-view.name.4 = Specimen Import
-view.name.5 = GBIF Specimen Import
-command.label.46 = Name
-command.label.47 = Referenz
-command.label.48 = Datenquelle
-command.label.49 = Misapplication
-command.label.50 = Benutze vorhandenes Bild
-command.name.36 = Erstelle Misapplication
-command.name.37 = Benutze vorhandenes Bild
-command.name.38 = \u00d6ffne Checklist Editor
-command.name.39 = Neue Datenquelle
-wizard.name = Specimen Suche/Import
-wizard.description = Sendet eine Anfrage mit den eingegebenen Parametern an den Datenprovider.\nHinweis: Die Anzahl der Anfrageergebnisse sind auf 100 begrenzt.
-command.name.40 = Validierung
-view.name.6 = Validierung
-marker.field.0 = Objekttyp
-marker.field.1 = Objekt
-marker.field.2 = Attribut
-marker.field.3 = Problematischer Wert
-marker.field.4 = Problembeschreibung
-marker.field.5 = Validierer
-marker.field.6 = Entit�tsklasse
-marker.field.7 = Entit�ts ID
-extension.name.0 = Validierungs-Fehler
-command.label.51 = \u00d6ffne Specimen-Editor
-command.label.52 = L\u00f6schen
-command.label.53 = Neue Field Unit
-command.label.54 = L\u00f6schen (mit Kindern)
-command.tooltip = Nur Individuals Associations anzeigen
-command.label.55 = \u00d6ffne zugeh\u00f6rige Specimens
-command.name.41 = Nur Individuals Associations anzeigen
-command.name.42 = \u00d6ffne Taxon Editor
-command.name.43 = Neue Field Unit
-command.name.44 = L\u00f6schen (mit Kindern)
-command.name.46 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
-command.label.56 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
\ No newline at end of file
+++ /dev/null
-#Properties file for taxeditor-editor
-Bundle-Vendor.0 = EDIT
-Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle
-command.name.17 = Set Basionym
-command.name.18 = Remove Basionym
-editor.name = Multipage Taxon Editor
-editor.name.0 = Taxon Name Editor
-editor.name.1 = Key
-editor.name.2 = Polytomous Key Graph Editor
-editor.name.3 = Polytomous Key List Editor
-editor.name.4 = Cdm Authority Editor
-editor.name.5 = Derivate View
-view.name = Factual Data
-view.name.0 = Uses
-view.name.1 = Media
-view.name.2 = Concept Relations
-view.name.3 = Concept Graph
-category.name = Taxonomic Editor
-command.label = Reference
-command.label.0 = Name
-command.label.1 = Team
-command.label.2 = Person
-command.label.3 = Specimen
-command.label.4 = Factual Data
-command.label.5 = Media
-command.label.6 = Concept
-command.label.7 = Concept Graph
-command.label.8 = Open Parent
-menu.label = New
-command.label.9 = Heterotypic Synonym
-command.label.10 = Homotypic Synonym
-command.label.11 = Synonym In Homotypical Group
-menu.label.0 = Change To
-command.label.12 = Accepted Taxon
-command.label.13 = Synonym
-command.label.14 = Misapplication
-command.label.15 = Delete
-command.label.16 = Delete All Empty Names
-command.label.17 = Swap Synonym With Accepted
-command.label.18 = Show Details
-command.label.19 = Save
-command.label.20 = New Node
-command.label.21 = Delete
-command.label.22 = Apply Layout
-command.label.23 = New Key Number
-command.label.24 = New Alternative
-command.label.25 = Refresh Nodes
-command.label.26 = Delete
-command.label.27 = New Factual Data
-menu.label.1 = New
-command.label.28 = Move Description to Taxon
-command.label.29 = Move Elements to Taxon
-command.label.30 = Delete
-command.label.31 = Save
-menu.label.2 = New Derivate
-command.label.32 = New Use
-command.label.33 = New Use Summary
-command.label.34 = New Use Record
-command.label.35 = Delete
-command.label.36 = Save
-command.label.37 = New Image Gallery
-command.label.38 = New Image
-command.label.39 = Move Image Up In List
-command.label.40 = Move Image Down In List
-command.label.41 = Delete
-command.label.42 = Save
-menu.label.3 = New
-command.label.43 = Open Related Concept
-command.label.44 = Delete
-command.label.45 = Edit Authorities
-extension.name = Name Commands
-category.name.0 = -- Name Editor
-command.name = Open Parent
-command.name.0 = Create Homotypic Synonym
-command.name.1 = Create Heterotypic Synonym
-command.name.2 = Create Synonym In Homotypical Group
-command.name.3 = Change To Synonym
-command.name.4 = Change To Accepted Taxon
-command.name.5 = Change To Misapplication
-command.name.6 = Swap Synonym With Accepted
-command.name.7 = Set Basionym / Original Combination
-command.name.8 = Remove Basionym / Original Combination
-command.name.9 = Delete All Empty Names
-category.name.1 = -- Factual
-command.name.10 = Create Description Element
-command.name.11 = New Description
-command.name.12 = Move Description Elements to Taxon
-command.name.13 = Move Description to Taxon
-category.name.2 = -- New Uses
-command.name.14 = New Use
-command.name.15 = New Use Summary
-command.name.16 = New Use Record
-category.name.3 = -- Media
-command.name.19 = Move Image Down In List
-command.name.20 = New Image Gallery
-command.name.21 = New Image
-command.name.22 = Move Image Up In List
-category.name.4 = -- New Entity
-command.name.23 = New Reference
-command.name.24 = New Name
-command.name.25 = New Team
-command.name.26 = New Person
-command.name.27 = New Specimen
-category.name.5 = -- Polytomous Keys
-command.name.28 = New Child Node
-command.name.29 = New Sibling Node
-command.name.30 = Refresh Node Numbering
-command.name.31 = Apply Layout
-category.name.6 = -- Concept Relations
-command.name.32 = Create Concept Relation
-command.name.33 = Open Related Concept
-category.name.7 = -- Group
-command.name.34 = Edit CDM Authorities
-command.name.35 = Open Derivate View
-scheme.description = The default key binding scheme for the Taxonomic Editor
-scheme.name = Taxonomic Editor Default Key Bindingseditor.name.6 = Specimen Import Editor
-editor.name.7 = Gbif Import Editor
-editor.name.8 = Checklist Editor
-view.name.4 = Specimen Import
-view.name.5 = GBIF Specimen Import
-command.label.46 = Name
-command.label.47 = Reference
-command.label.48 = Datasource
-command.label.49 = Misapplication
-command.label.50 = Use Existing Image
-command.name.36 = Create Misapplication
-command.name.37 = Use Existing Image
-command.name.38 = Open Checklist Editor
-command.name.39 = New Datasource
-wizard.name = Specimen Search/Import
-wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
-command.name.40 = Validation
-view.name.6 = Validation
-marker.field.0 = Object Type
-marker.field.1 = Object
-marker.field.2 = Attribute
-marker.field.3 = Problematic Value
-marker.field.4 = Problem description
-marker.field.5 = Validator
-marker.field.6 = Entity Class
-marker.field.7 = Entity Id
\ No newline at end of file
class="eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor"
default="false"
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor"
- name="Alignment Editor">
+ name="%editor.ALIGNMENT_EDITOR">
</editor>
</extension>
<extension
allowMultiple="true"
class="eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart"
id="eu.etaxonomy.taxeditor.molecular.PherogramView"
- name="PherogramView"
+ name="%view.PHEROGRAM_VIEW"
restorable="true">
</view>
</extension>
<command
defaultHandler="eu.etaxonomy.taxeditor.molecular.handler.EditSequenceHandler"
id="eu.etaxonomy.taxeditor.molecular.editSequence"
- name="Edit Sequence">
+ name="%command.EDIT_SEQUENCE">
</command>
<command
defaultHandler="eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler"
id="eu.etaxonomy.taxeditor.molecular.showPherogram"
- name="Show Pherogram">
+ name="%command.name.SHOW_PHEROGRAM">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
- name="Cut pherogram left">
+ name="%command.name.CUT_PHEROGRAM_LEFT">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
- name="Cut pherogram right">
+ name="%command.name.CUT_PHEROGRAM_RIGHT">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows"
- name="Reverse complement selected rows">
+ name="%command.name.REVERSE_COMPLEMENT_SELECTED_ROWS">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus"
- name="(Re)create consensus sequence">
+ name="%command.name.CREATE_CONSENUS_SEQUENCE">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus"
- name="Update consensus sequence">
+ name="%command.name.UPDATE_CONSENSUS_SEQUENCE">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities"
- name="Toggle show probability values">
+ name="%command.name.TOGGLE_SHOW_PROBABILITY_VALUES">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines"
- name="Toggle show base call lines">
+ name="%command.name.TOGGLE_SHOW_BASE_CALL_LINES">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
- name="Change quality output">
+ name="%command.name.CHANGE_QUALITY_OUTPUT">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
- name="Load Pherogram">
+ name="%command.name.LOAD_PHEROGRAM">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"
- name="Toggle insert/overwrite">
+ name="%command.name.TOGGLE_INSERT_OVERWRITE">
</command>
<command
id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"
- name="Toggle left/right insertion in base call sequence">
+ name="%command.name.TOGGLE_LEFT_RIGHT_INSERTION">
</command>
</extension>
<extension
id="eu.etaxonomy.taxeditor.molecular.alignmentToolbar">
<command
commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"
- label="Toggle insert/overwrite"
+ label="%command.TOGGLE_INSERT_OVERWRITE"
style="push">
<visibleWhen
checkEnabled="true">
allPopups="false"
locationURI="menu:org.eclipse.ui.main.menu">
<menu
- label="Alignment Editor">
+ label="%menu.ALIGNMENT_EDITOR">
<command
commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
style="push">
</visibleWhen>
</menu>
<menu
- label="Pherogram View">
+ label="%menu.label.PHEROGRAM_VIEW">
<command
commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
style="push">
</menu>
</menuContribution>
<menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView?before=eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu">
+ locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView?before=eu.etaxonomy.taxeditor.editor.derivative.reuseSingleReadMenuItem">
+ <separator
+ name="eu.etaxonomy.taxeditor.molecular.separator5"
+ visible="true">
+ </separator>
<command
commandId="eu.etaxonomy.taxeditor.molecular.editSequence"
- label="Edit Sequence"
+ label="%command.label.EDIT_SEQUENCE"
style="push">
<visibleWhen
checkEnabled="true">
</command>
<command
commandId="eu.etaxonomy.taxeditor.molecular.showPherogram"
- label="Show Pherogram"
+ label="%command.label.SHOW_PHEROGRAM"
style="push">
<visibleWhen
checkEnabled="true">
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
public static final String DEFAULT_READ_NAME_PREFIX = "Read ";
public static final String CONSENSUS_NAME = "Consensus";
-
+
private final ConversationHolder conversationHolder;
private final AlignmentModelChangeListener DIRTY_LISTENER = new AlignmentModelChangeListener() {
@Override
}
};
private final AlignmentEditorActionUpdater ACTION_UPDATER = new AlignmentEditorActionUpdater();
- public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent()); //TODO Move to global EDITor class.
-
+ public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent()); //TODO Move to global EDITor class.
+
private MultipleAlignmentsContainer alignmentsContainer = null;
private final Map<Integer, SingleReadAlignment> cdmMap = new TreeMap<Integer, SingleReadAlignment>(); //TODO Move this to ContigSequenceDataProvider
//conversationHolder = null;
}
-
+
private void refreshToolbarElement(String id) {
ICommandService commandService =
(ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
}
}
-
+
private void registerEditSettingListener(MultipleAlignmentsContainer container) {
container.getEditSettings().addListener(new EditSettingsListener() {
@Override
return result;
}
-
+
private AlignmentArea createConsensusHintArea(MultipleAlignmentsContainer container,
AlignmentArea labeledArea) {
return result;
}
-
+
private MultipleAlignmentsContainer getAlignmentsContainer() {
if (alignmentsContainer == null) {
alignmentsContainer = new MultipleAlignmentsContainer();
-
+
AlignmentAreaList list = alignmentsContainer.getAlignmentAreas();
AlignmentArea readsArea = createEditableAlignmentArea(alignmentsContainer, true);
readsArea.getSelection().addSelectionListener(ACTION_UPDATER);
editableConsensusArea.getSelection().addSelectionListener(ACTION_UPDATER);
list.add(editableConsensusArea); // Make sure COMSENSUS_AREA_INDEX is correct.
list.add(createConsensusHintArea(alignmentsContainer, readsArea));
-
+
registerEditSettingListener(alignmentsContainer);
}
return alignmentsContainer;
}
-
+
public AlignmentArea getReadsArea() {
return getAlignmentsContainer().getAlignmentAreas().get(READS_AREA_INDEX);
}
-
+
public AlignmentArea getEditableConsensusArea() {
return getAlignmentsContainer().getAlignmentAreas().get(EDITABLE_CONSENSUS_AREA_INDEX);
}
-
-
+
+
/**
* Checks whether {@link #getReadsArea()} or {@link #getEditableConsensusArea()} currently
- * have the user focus and returns the according component.
- *
+ * have the user focus and returns the according component.
+ *
* @return either the reads or the consensus alignment area or {@code null} if none of these
* components is currently focused
*/
}
}
}
-
-
+
+
/**
* Checks whether the specified alignment area or one of its subcomponents currently has the
* focus.
- *
- * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or
+ *
+ * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or
* {@link #getEditableConsensusArea()}.)
* @return {@code true} if the specified component is focused and is either equal to
* {@link #getReadsArea()} or {@link #getEditableConsensusArea()}or {@code false} otherwise
private boolean hasFocus(AlignmentArea area) {
return SWTUtils.childHasFocus((Composite)area.getToolkitComponent());
}
-
-
+
+
public boolean hasPherogram(int sequenceID) {
return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX;
}
-
+
public PherogramArea getPherogramArea(int sequenceID) {
if (hasPherogram(sequenceID)) {
return (PherogramArea)getReadsArea().getDataAreas().getSequenceAreas(sequenceID).get(PHEROGRAM_AREA_INDEX);
}
}
-
+
private ConsensusSequenceArea getConsensusHintDataArea() {
return (ConsensusSequenceArea)getAlignmentsContainer().getAlignmentAreas().
get(CONSENSUS_HINT_AREA_INDEX).getDataAreas().getBottomAreas().
get(CONSENSUS_DATA_AREA_INDEX);
}
-
+
@Deprecated //TODO Remove as soon as testing period is over
private void createTestContents() {
// Just for testing:
}
}
-
+
private void readCDMData(Sequence sequenceNode) {
//TODO If called from somewhere else than createPartControl() the editorInput needs to be checked and previous contents need to be cleared (or updated).
//TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
}
-
+
@Override
public void createPartControl(Composite parent) {
SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
}
}
-
+
@Override
public void dispose() {
Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER);
Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER);
CLIPBOARD.dispose();
+ ((AlignmentEditorInput)getEditorInput()).dispose();
super.dispose();
}
(getReadsArea().getEditSettings().isInsertLeftInDataArea() ? "Left" : "Right"));
}
-
+
private SingleReadAlignment.Shift[] convertToCDMShifts(PherogramAreaModel model) {
Iterator<ShiftChange> iterator = model.shiftChangeIterator();
List<Shift> shifts = new ArrayList<SingleReadAlignment.Shift>();
return shifts.toArray(new Shift[]{});
}
-
+
@Override
public void doSave(IProgressMonitor monitor) {
if (getEditorInput() instanceof AlignmentEditorInput) {
//re-loading sequence to avoid session conflicts
Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(((AlignmentEditorInput)getEditorInput()).getSequenceNodeUuid());
+ ((AlignmentEditorInput)getEditorInput()).setSequenceNode(sequenceNode);
StringAdapter stringProvider = new StringAdapter(getEditableConsensusArea().getAlignmentModel(), false); // Throws an exception if a token has more than one character.
// Write consensus sequence:
}
monitor.worked(1);
+ ((AlignmentEditorInput)getEditorInput()).merge();
// Commit the conversation and start a new transaction immediately:
conversationHolder.commit(true);
monitor.worked(1);
}
}
-
+
@Override
public void doSaveAs() {}
-
+
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
setSite(site);
setInput(input);
}
-
+
@Override
public boolean isDirty() {
return dirty;
}
-
+
private void setDirty() {
dirty = true;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
-
+
@Override
public boolean isSaveAsAllowed() {
return false; // "Save as" not allowed.
}
-
+
@Override
public void setFocus() {
if(conversationHolder != null){
conversationHolder.bind();
}
+ ((AlignmentEditorInput)getEditorInput()).bind();
}
-
public boolean isInsertMode() {
return getAlignmentsContainer().getEditSettings().isInsert();
}
return getAlignmentsContainer().getEditSettings().isInsertLeftInDataArea();
}
-
+
public void toggleLeftRightInsertionInPherogram() {
getAlignmentsContainer().getEditSettings().toggleInsertLeftInDataArea();
}
-
+
public void toggleInsertOverwrite() {
getAlignmentsContainer().getEditSettings().toggleInsert();
}
-
+
private String cutPherogram(boolean left) {
SelectionModel selection = getReadsArea().getSelection();
if (selection.getCursorHeight() != 1) {
}
}
-
+
public String cutPherogramLeft() {
return cutPherogram(true);
}
-
+
public String cutPherogramRight() {
return cutPherogram(false);
}
-
+
public void reverseComplementSelectedSequences() {
SelectionModel selection = getReadsArea().getSelection();
AlignmentModel<?> model = getReadsArea().getAlignmentModel();
}
}
-
+
/**
* Recreates the whole consensus sequence from all single read sequences. The previous consensus
* sequence is overwritte.
model.insertTokensAt(sequenceID, 0, tokens);
}
-
+
/**
* Updates the current consensus sequence by replacing gaps by the according consensus tokens
* calculated from the single read sequences and extends the consensus sequence if necessary.
}
}
-
+
public static PherogramProvider readPherogram(URI uri) throws IOException, UnsupportedChromatogramFormatException {
PherogramProvider result;
InputStream stream = uri.toURL().openStream();
return result;
}
-
+
private String newReadName() {
int index = 1;
while (getReadsArea().getAlignmentModel().sequenceIDByName(DEFAULT_READ_NAME_PREFIX + index)
return DEFAULT_READ_NAME_PREFIX + index;
}
-
+
public void addRead(URI pherogramURI, boolean reverseComplemented) throws IOException, UnsupportedChromatogramFormatException {
addRead(newReadName(), pherogramURI, reverseComplemented, null, null, null, null, null);
}
-
+
/**
* Adds a new sequence with attached phergram data area to the reads alignment.
* <p>
package eu.etaxonomy.taxeditor.molecular.editor;
+import java.util.Arrays;
+import java.util.List;
import java.util.UUID;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
/**
* @author Ben Stöver
* @date 04.08.2014
*/
-public class AlignmentEditorInput implements IEditorInput {
+public class AlignmentEditorInput extends CdmEntitySessionInput implements IEditorInput {
private static final String name = "AlignmentEditor";
private final UUID sequenceNodeUuid;
-
+ private Sequence sequenceNode;
public AlignmentEditorInput(UUID sequenceNodeUuid) {
- super();
+ super(false);
this.sequenceNodeUuid = sequenceNodeUuid;
+ initSession();
}
}
return true;
}
+
+
+ public void setSequenceNode(Sequence sequenceNode) {
+ this.sequenceNode = sequenceNode;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<Sequence> getRootEntities() {
+ return Arrays.asList(sequenceNode);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
+ */
+ @Override
+ public void merge() {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(ISequenceService.class).merge(sequenceNode, true);
+ }
+ }
}
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/main/java"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/java"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/resources"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Navigation Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
eu.etaxonomy.taxeditor.navigation,
eu.etaxonomy.taxeditor.navigation.internal,
eu.etaxonomy.taxeditor.navigation.key.polytomous,
+ eu.etaxonomy.taxeditor.navigation.key.polytomous.operation,
eu.etaxonomy.taxeditor.navigation.navigator,
+ eu.etaxonomy.taxeditor.navigation.navigator.operation,
eu.etaxonomy.taxeditor.navigation.search
Require-Bundle: org.eclipse.ui,
org.eclipse.ui.navigator,
org.eclipse.ui.forms.widgets,
org.osgi.framework
Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ClassPath: .,
- activation-1.1.jar,
- antlr-2.7.6.jar,
- aopalliance-1.0.jar,
- asm-attrs.jar,
- asm.jar,
- aspectjrt-1.6.3.jar,
- aspectjweaver-1.6.3.jar,
- avalon-framework-4.2.0.jar,
- batik-all-1.7.jar,
- c3p0-0.9.1.jar,
- cdmlib-commons-3.0.7-SNAPSHOT.jar,
- cdmlib-ext-3.0.7-SNAPSHOT.jar,
- cdmlib-io-3.0.7-SNAPSHOT.jar,
- cdmlib-model-3.0.7-SNAPSHOT.jar,
- cdmlib-persistence-3.0.7-SNAPSHOT.jar,
- cdmlib-print-3.0.7-SNAPSHOT.jar,
- cdmlib-remote-3.0.7-SNAPSHOT.jar,
- cglib-2.1.3.jar,
- commons-beanutils-1.7.0.jar,
- commons-collections-3.2.jar,
- commons-dbcp-1.2.2.jar,
- commons-io-1.3.1.jar,
- commons-logging-1.0.4.jar,
- commons-pool-1.3.jar,
- dom4j-1.6.1.jar,
- dozer-5.3.0-sources.jar,
- dozer-5.3.0.jar,
- ehcache-1.2.3.jar,
- ejb3-persistence.jar,
- ezmorph-1.0.4.jar,
- fop.jar,
- google-api-translate-java-0.92.jar,
- hibernate-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-commons-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-core-3.4.0-SNAPSHOT.jar,
- hibernate-envers-3.4.0-SNAPSHOT.jar,
- hibernate-search-3.1.0.GA.jar,
- hibernate-tools-3.2.0.ga.jar,
- hibernate-validator-4.0.0.CR1.jar,
- hsqldb.jar,
- httpclient-4.0.1.jar,
- httpcore-4.0.1.jar,
- javassist.jar,
- jaxb-api-2.1.6.jar,
- jaxb-impl-2.1.6.jar,
- jaxen-1.1.2.jar,
- jdbc-1.2.jar,
- jdbc2_0-stdext.jar,
- jdom.jar,
- joda-time-1.5.jar,
- joda-time-hibernate-1.0.jar,
- json-lib-2.2.3-jdk15.jar,
- jsr250-api-1.0.jar,
- jta.jar,
- jtds-1.2.2.jar,
- junit-4.4.jar,
- junit-4.8.1-sources.jar,
- junit-4.8.1.jar,
- log4j-1.2.14.jar,
- lsid-client-1.1.2.jar,
- lsid-server-1.1.2.jar,
- lucene-core-2.4.0.jar,
- lucene-spellchecker-2.4.0.jar,
- mail-1.4.jar,
- msbase-2000.3.jar,
- mssqlserver-2000.3.jar,
- msutil-2000.3.jar,
- mysql-connector-java-5.0.5.jar,
- odfdom-0.8.jar,
- opencsv-1.8.jar,
- org.springframework.aop-3.0.4.RELEASE-sources.jar,
- org.springframework.asm-3.0.4.RELEASE-sources.jar,
- org.springframework.aspects-3.0.4.RELEASE-sources.jar,
- org.springframework.beans-3.0.4.RELEASE-sources.jar,
- org.springframework.context-3.0.4.RELEASE-sources.jar,
- org.springframework.context.support-3.0.4.RELEASE-sources.jar,
- org.springframework.core-3.0.4.RELEASE-sources.jar,
- org.springframework.expression-3.0.4.RELEASE-sources.jar,
- org.springframework.jdbc-3.0.4.RELEASE-sources.jar,
- org.springframework.orm-3.0.4.RELEASE-sources.jar,
- org.springframework.oxm-3.0.4.RELEASE-sources.jar,
- org.springframework.transaction-3.0.4.RELEASE-sources.jar,
- org.springframework.web-3.0.4.RELEASE-sources.jar,
- org.springframework.web.servlet-3.0.4.RELEASE-sources.jar,
- poi-3.1-FINAL.jar,
- postgresql-8.2-504.jdbc4.jar,
- saxon9he.jar,
- serializer-2.7.0.jar,
- servlet-api-2.5.jar,
- spring-modules-cache-0.7.jar,
- spring-modules-lucene-0.8a.jar,
- wsdl4j-1.6.1.jar,
- xalan-2.7.0.jar,
- xercesImpl-2.7.1.jar,
- xercesImpl.jar,
- xml-apis-1.3.04.jar,
- xml-apis-ext-1.3.04.jar,
- xml-apis.jar,
- xml-resolver-1.2.jar,
- xmlgraphics-commons-1.3.1.jar,
- xom-1.0.jar,
- xsltc.jar,
- xstream-1.3.1.jar,
- yjp-controller-api-redist-8.0.1.jar,
- ant-antlr.jar,
- ant-apache-bcel.jar,
- ant-apache-bsf.jar,
- ant-apache-log4j.jar,
- ant-apache-oro.jar,
- ant-apache-regexp.jar,
- ant-apache-resolver.jar,
- ant-commons-logging.jar,
- ant-commons-net.jar,
- ant-jai.jar,
- ant-javamail.jar,
- ant-jdepend.jar,
- ant-jmf.jar,
- ant-jsch.jar,
- ant-junit.jar,
- ant-launcher.jar,
- ant-netrexx.jar,
- ant-nodeps.jar,
- ant-starteam.jar,
- ant-stylebook.jar,
- ant-swing.jar,
- ant-trax.jar,
- ant-weblogic.jar,
- ant.jar,
- runtime_registry_compatibility.jar,
- jdi.jar,
- jdimodel.jar,
- pdebuild.jar,
- compatibility.jar,
- junit.jar
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
SearchBar_0=Use "*" for wildcard searching\r
SearchBar_1=Search\r
SearchBar_2=Could not execute search\r
-SearchBar_3=Please type at least one character when using the "*" wildcard.\r
+SearchBar_3=Please type at least one character\r
SearchBar_4=Error opening search result.\r
SearchBar_6=Taxa\r
SearchBar_7=Synonyms\r
SearchBar_0=Benutze "*" f\u00FCr Platzhalter-Suche\r
SearchBar_1=Suche\r
SearchBar_2=Suche konnte nicht ausgef\u00FChrt werden\r
-SearchBar_3=Bitte geben Sie mindestens ein Zeichen ein, wenn Sie den "*" Platzhalter benutzen wollen\r
+SearchBar_3=Bitte geben Sie mindestens einen Buchstaben ein\r
SearchBar_4=Fehler beim f\u00fcffnen des Suchergebnisses\r
SearchBar_6=Taxa\r
SearchBar_7=Synonyme\r
<dynamic
class="eu.etaxonomy.taxeditor.navigation.RecentNamesContributionItem"
id="eu.etaxonomy.taxeditor.navigation.recentnames">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</dynamic>
</menuContribution>
<menuContribution
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.navigation.navigator">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.views.showView"
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:eu.etaxonomy.taxeditor.navigation.search.searchResultView">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
- label="%command.label.1"
- style="push">
- </command>
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
+ </dynamic>
+ <separator
+ name="eu.etaxonomy.taxeditor.navigation.separator2">
+ </separator>
</menuContribution>
<menuContribution
locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup">
name="taxeditor-navigation.separator1"
visible="true">
</separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
- label="%command.label.5"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <or>
- <reference
- definitionId="isTaxonNode">
- </reference>
- <reference
- definitionId="isTaxonomicTree">
- </reference>
- </or>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.open"
- label="Edit"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="selection">
- <reference
- definitionId="isClassification">
- </reference>
- </with>
- </visibleWhen>
- </command>
+ <dynamic
+ class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+ id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
+ </dynamic>
+ <separator
+ name="eu.etaxonomy.taxeditor.navigation.separator2">
+ </separator>
<command
commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
label="%command.label.6"
commandId="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
label="%command.label.13"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.navigation.menu.new.separator1"
id="eu.etaxonomy.taxeditor.navigation.create.classificationHandler"
label="%command.label.14"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
</menuContribution>
<menuContribution
</extension>
<extension
point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.EditHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
- name="%command.name.1">
- </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.MoveTaxonHandler"
id="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon"
</with>
</activeWhen>
</handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingChangeAcceptedTaxonToSynonymHandler"
+ commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingMoveFactualDataHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.moveFactualData">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingMoveTaxonNodeHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingDeleteTaxonNodeHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.command.delete">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingDeletePolytomousKeyHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingUpdatePolytomousKeyAllNodesHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingEditPolytomousKeyNodesHandler"
+ commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
</extension>
class="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
id="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
namespace="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
- properties="isCdmStoreConnected"
+ properties="isCdmStoreConnected,isRemoting,isStandAlone"
type="java.lang.Object">
</propertyTester>
</extension>
</test>
</with>
</definition>
- </extension>
- <extension
- point="eu.etaxonomy.taxeditor.store.cdmViewer">
- <cdmViewer
- class="eu.etaxonomy.taxeditor.navigation.NavigationCdmViewer">
- </cdmViewer>
+ <definition
+ id="isRemoting">
+ <test
+ property="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester.isRemoting">
+ </test>
+ </definition>
+ <definition
+ id="isStandAlone">
+ <test
+ property="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester.isStandAlone">
+ </test>
+ </definition>
</extension>
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
+++ /dev/null
-package eu.etaxonomy.taxeditor.navigation;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-import eu.etaxonomy.taxeditor.view.ICdmViewer;
-
-public class NavigationCdmViewer implements ICdmViewer {
-
-
- @SuppressWarnings("unused")
- private final Logger logger = Logger.getLogger(NavigationCdmViewer.class);
-
- @Override
- public void show(Object input, Class<?> viewerClass) {
- if(viewerClass.equals(NewClassificationWizard.class)){
- if(input instanceof Classification){
- Classification classification = (Classification)input;
- NewClassificationWizard classificationWizard = new NewClassificationWizard();
- classificationWizard.init(null, null);
- classificationWizard.setEntity(classification);
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
- dialog.open();
- }
- }
- }
-
- @Override
- public Map<Class<?>, String> getViewerClasses(Object input) {
- Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
- if(input instanceof Classification){
- viewerNameMap.put(NewClassificationWizard.class, "Classification Wizard");
- }
- return viewerNameMap;
- }
-
-}
import java.util.Set;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.UndoContext;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonViewer;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* <p>NavigationUtil class.</p>
public class NavigationUtil extends AbstractUtility{
private static IUndoContext defaultUndoContext;
- /**
- * <p>executeEditHandler</p>
- */
- public static void executeEditHandler(){
-
- String commandId = "eu.etaxonomy.taxeditor.navigation.command.update.editSelection";
-
- IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
- try {
- handlerService.executeCommand(commandId, null);
- } catch (ExecutionException e) {
- MessagingUtils.error(NavigationUtil.class, e);
- } catch (NotDefinedException e) {
- MessagingUtils.error(NavigationUtil.class, e);
- } catch (NotEnabledException e) {
- MessagingUtils.error(NavigationUtil.class, e);
- } catch (NotHandledException e) {
- MessagingUtils.error(NavigationUtil.class, e);
- }
- }
-
/**
* <p>openEditor</p>
*
public static void openEditor(ICdmBase selectedObject){
UUID entityUuid = selectedObject.getUuid();
try {
- if(selectedObject instanceof TaxonNode){
+ if(selectedObject instanceof Classification){
+ NewClassificationWizard classificationWizard = new NewClassificationWizard();
+ classificationWizard.init(null, null);
+ classificationWizard.setEntity((Classification) selectedObject);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
+ dialog.open();
+ }
+ else if(selectedObject instanceof TaxonNode){
EditorUtil.openTaxonNode(entityUuid);
}else if(selectedObject instanceof TaxonBase){
EditorUtil.openTaxonBase(entityUuid);
} catch (PartInitException e) {
MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
} catch (Exception e) {
- MessagingUtils.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
- }
- }
+ MessagingUtils.errorDialog("Could not create Taxon",
+ NavigationUtil.class,
+ e.getMessage(), TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
- public static void openEditor(Object selectedObject){
- if (selectedObject instanceof UuidAndTitleCache){
- Class type = ((UuidAndTitleCache) selectedObject).getType();
- if(type == Taxon.class || type == Synonym.class){
- try {
- EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid());
- } catch (PartInitException e) {
- MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
- }
- }
- }else if(selectedObject instanceof ICdmBase){
- openEditor((ICdmBase) selectedObject);
- }else{
- MessagingUtils.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
}
}
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
+import eu.etaxonomy.taxeditor.preference.CdmPreferences;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* <p>NavigatorStateManager class.</p>
TaxonNavigator navigator = NavigationUtil.getNavigator(true);
if(navigator != null){
navigator.init();
- navigator.restore(memento, monitor);
+ if (PreferencesUtil.isStoreNavigatorState()){
+ navigator.restore(memento, monitor);
+ } else {
+ navigator.restore(null, monitor);
+ }
+
}
}
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
saveNavigatorState(memento, monitor);
+
}
/**
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous;
+
+/**
+ * @author cmathew
+ * @date 25 Jun 2015
+ *
+ */
+public interface PolytomousKeyViewLabels {
+
+ public static final String DELETE_POLYTOMOUS_KEY_LABEL = "Delete Polytomous Key";
+ public static final String UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL = "Update All Polytomous Key Nodes";
+
+ public static final String ERROR_OPENING_KEY_EDITOR_MESSAGE = "Error opening Polytomous Key Editor";
+
+
+}
package eu.etaxonomy.taxeditor.navigation.key.polytomous;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.ViewPart;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*
*/
public class PolytomousKeyViewPart extends ViewPart implements
- IConversationEnabled, IPostOperationEnabled {
+ IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled,
+ ICdmChangeListener {
private class FilterModifyListener implements ModifyListener{
@Override
private IContextListener contextListener;
private final CdmFormFactory formFactory;
private Text text_filter;
+ private ICdmEntitySession cdmEntitySession;
private PolytomousKeyViewPartDataChangeBehavior dataChangeBehavior;
private void setInput() {
conversation = CdmStore.createConversation();
conversation.registerForDataStoreChanges(this);
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ CdmApplicationState.getCurrentDataChangeService().register(this);
+
List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
if(!viewer.getControl().isDisposed()){
viewer.setInput(input);
*/
@Override
public void setFocus() {
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
viewer.getControl().setFocus();
}
conversation.close();
CdmStore.getContextManager().removeContextListener(contextListener);
}
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ CdmApplicationState.getCurrentDataChangeService().unregister(this);
super.dispose();
}
return (List<PolytomousKey>)viewer.getInput();
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<PolytomousKey> getRootEntities() {
+ return getKeys();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+ */
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ if(event.getAction() == Action.Delete && PolytomousKey.class.equals(event.getEntityType())) {
+ refresh();
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
*/
public class DeleteHandler extends AbstractHandler {
- protected IWorkbenchPage activePage;
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
- activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+
List<PolytomousKey> keys = selection.toList();
if(keys.isEmpty()){
return null;
}
- for (PolytomousKey key : keys){
- closeObsoleteEditor(key);
- }
- boolean confirmation = MessagingUtils.confirmDialog("Confirm deletion", "Do you want to delete the selected key" + (keys.size() == 1 ? "" : "s") + "?");
+
+ boolean confirmation = MessagingUtils.confirmDialog("Confirm deletaion", "Do you want to delete the selected key" + (keys.size() == 1 ? "" : "s") + "?");
if(confirmation){
for(PolytomousKey key : keys){
try {
+ PolytomousKeyViewPart pkvp = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
AbstractPostOperation operation = new DeleteOperation(
event.getCommand().getName(),
NavigationUtil.getUndoContext(), key,
- (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false),
- (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false));
+ pkvp,
+ pkvp,
+ pkvp);
NavigationUtil.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.error(getClass(), e);
return null;
}
-
- protected boolean closeObsoleteEditor(PolytomousKey key){
- boolean result = true;
- for (IEditorReference ref : activePage.getEditorReferences()) {
- try {
-
- IEditorInput input = ref.getEditorInput();
- if (input instanceof PolytomousKeyEditorInput) {
- PolytomousKey pKey = ((PolytomousKeyEditorInput)input).getKey();
- //if node is a child of taxonNode then close the editor
- if(key.equals(pKey)){
- //if (taxonNode.equals(node)) {
- result &= activePage.closeEditor(ref.getEditor(false), true);
-
- }
- }
- } catch (PartInitException e) {
- continue;
- }
- }
- return result;
- }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.handler;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.util.OperationsUtil;
+
+/**
+ * @author cmathew
+ * @date 25 Jun 2015
+ *
+ */
+public class RemotingDeletePolytomousKeyHandler extends RemotingCdmHandler {
+
+ List<UUID> keysToDelete;
+ /**
+ * @param label
+ */
+ public RemotingDeletePolytomousKeyHandler() {
+ super(PolytomousKeyViewLabels.DELETE_POLYTOMOUS_KEY_LABEL);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+
+ keysToDelete = OperationsUtil.convertToUuidList(selection.toList());
+
+ if(keysToDelete.isEmpty()){
+ return Status.CANCEL_STATUS;
+ }
+
+ boolean confirmation = MessagingUtils.confirmDialog("Confirm deletaion", "Do you want to delete the selected key" + (keysToDelete.size() == 1 ? "" : "s") + "?");
+
+ if(!confirmation) {
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingDeletePolytomousKeyOperation(event.getTrigger(),
+ false,
+ keysToDelete);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingEditPolytomousKeyNodesHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+
+ ISelection selection = view.getSite().getSelectionProvider().getSelection();
+ if(selection instanceof StructuredSelection){
+
+ final StructuredSelection structuredSelection = (StructuredSelection) selection;
+
+ Job job = new Job("Opening Polytomous Keys"){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Opening Polytomous Keys", structuredSelection.size());
+
+ for(final Object selectedObject : structuredSelection.toArray()){
+ if(selectedObject instanceof PolytomousKey){
+
+ Display.getDefault().asyncExec(new Runnable(){
+
+ @Override
+ public void run() {
+ try {
+ PolytomousKey key = (PolytomousKey) selectedObject;
+ EditorUtil.openPolytomousKey(key.getUuid());
+ } catch(Exception ex) {
+ MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE,
+ event.getTrigger(),
+ ex.getLocalizedMessage());
+ ex.printStackTrace();
+ }
+ }
+
+ });
+ monitor.worked(1);
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();
+
+ }
+ return null;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingUpdatePolytomousKeyAllNodesOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingUpdatePolytomousKeyAllNodesHandler extends RemotingCdmHandler {
+
+ /**
+ * @param label
+ */
+ public RemotingUpdatePolytomousKeyAllNodesHandler() {
+ super(PolytomousKeyViewLabels.UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingUpdatePolytomousKeyAllNodesOperation(event.getTrigger(), false);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
public class DeleteOperation extends AbstractPersistentPostOperation {
private final PolytomousKey key;
+ private final ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
/**
* @param label
*/
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;
}
@Override
bind();
DeleteResult result = CdmStore.getService(IPolytomousKeyService.class).delete(key);
+
if (result.isError() && !result.getExceptions().isEmpty()){
MessageDialog.openError(null, "Delete failed", result.getExceptions().iterator().next().getMessage());
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.operation;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 25 Jun 2015
+ *
+ */
+public class RemotingDeletePolytomousKeyOperation extends RemotingCdmUpdateOperation {
+
+ private final static String LABEL = "Delete Polytomous Key operation";
+
+ private final List<UUID> keysToDelete;
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingDeletePolytomousKeyOperation(Object source,
+ boolean async,
+ List<UUID> keysToDelete) {
+ super(LABEL, Action.Delete, source, async);
+ this.keysToDelete = keysToDelete;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ entityType = PolytomousKey.class;
+ return CdmStore.getService(IPolytomousKeyService.class).delete(keysToDelete);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.operation;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingUpdatePolytomousKeyAllNodesOperation extends RemotingCdmUpdateOperation {
+
+ private final UUID polytomousKeyUuid;
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingUpdatePolytomousKeyAllNodesOperation(Object source,
+ boolean async,
+ UUID polytomousKeyUuid) {
+ super(LABEL, Action.Update, source, async);
+ this.polytomousKeyUuid = polytomousKeyUuid;
+
+ }
+
+ public RemotingUpdatePolytomousKeyAllNodesOperation(Object source,
+ boolean async) {
+ super(LABEL, Action.Update, source, async);
+ // this implies that we have to update all nodes of all keys
+ this.polytomousKeyUuid = null;
+ }
+
+ private final static String LABEL = "Update All Polytomous Key Nodes operation";
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ if(polytomousKeyUuid == null) {
+ return CdmStore.getService(IPolytomousKeyService.class).updateAllNodeNumberings();
+ } else {
+ return CdmStore.getService(IPolytomousKeyService.class).updateAllNodeNumberings(polytomousKeyUuid);
+ }
+ }
+
+}
// $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.
*/
*/
public class Root extends PlatformObject implements IAdaptable, IPersistableElement, IElementFactory, IConversationEnabled {
- private ConversationHolder conversation;
-
+ private final ConversationHolder conversation;
+
/**
* <p>Constructor for Root.</p>
*
public Root (ConversationHolder conversation){
this.conversation = conversation;
}
-
+
/**
* <p>getParentBeans</p>
*
* @return a {@link java.util.List} object.
*/
public List<Classification> getParentBeans() {
- List<String> propertyPaths = Arrays.asList(new String[]{"name"});
-
+ List<String> propertyPaths = Arrays.asList(new String[]{
+ "name",
+ "rootNode.childNodes"});
+
List<Classification> classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths);
-
+
if(classifications.size() == 0){
Classification classification = Classification.NewInstance("My Classification");
- AbstractPostOperation operation = new CreateClassification("Creating initial classification", NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
+ AbstractPostOperation operation = new CreateClassification("Creating initial classification", NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
NavigationUtil.executeOperation(operation);
-
+
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths);
}
-
- return classifications;
+
+ return classifications;
}
/* (non-Javadoc)
*
* @return a {@link java.lang.String} object.
*/
- public String getFactoryId() {
+ @Override
+ public String getFactoryId() {
return null;
}
* @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
*/
/** {@inheritDoc} */
- public void saveState(IMemento memento) {
+ @Override
+ public void saveState(IMemento memento) {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
*/
/** {@inheritDoc} */
- public IAdaptable createElement(IMemento memento) {
+ @Override
+ public IAdaptable createElement(IMemento memento) {
return null;
}
// $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.
*/
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.navigator.ILinkHelper;
/** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.taxon"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.navigation.taxonlinkhelper"; //$NON-NLS-1$
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void activateEditor(IWorkbenchPage page,
+ @Override
+ public void activateEditor(IWorkbenchPage page,
IStructuredSelection selection) {
try {
if (selection == null || selection.isEmpty()) {
return;
}
- if (selection.getFirstElement() instanceof TaxonNode) {
- TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
- TaxonEditorInput taxonEditorInput;
-
- taxonEditorInput = TaxonEditorInput.NewInstance(taxonNode.getUuid());
-
- IEditorPart editor = null;
- if ((editor = page.findEditor(taxonEditorInput)) != null) {
- page.bringToTop(editor);
- }
- }
+// if (selection.getFirstElement() instanceof TaxonNode) {
+// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
+// TaxonEditorInput taxonEditorInput;
+//
+// taxonEditorInput = TaxonEditorInput.NewInstance(taxonNode.getUuid());
+//
+// IEditorPart editor = null;
+// if ((editor = page.findEditor(taxonEditorInput)) != null) {
+// page.bringToTop(editor);
+// }
+// }
} catch (Exception e) {
MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
}
* @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput)
*/
/** {@inheritDoc} */
- public IStructuredSelection findSelection(IEditorInput editorInput) {
+ @Override
+ public IStructuredSelection findSelection(IEditorInput editorInput) {
if (editorInput instanceof TaxonEditorInput) {
TaxonNode taxonNode = ((TaxonEditorInput) editorInput).getTaxonNode();
if (taxonNode != null) {
package eu.etaxonomy.taxeditor.navigation.navigator;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.navigator.CommonNavigator;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator;
import eu.etaxonomy.cdm.model.taxon.TaxonNodeByRankAndNameComparator;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.LoginManager;
+import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
/**
* Taxonomic tree implementation using Common Navigator Framework.
* @version 1.0
*/
public class TaxonNavigator extends CommonNavigator implements
- IPostOperationEnabled, IConversationEnabled, Observer {
+ IPostOperationEnabled, IConversationEnabled, Observer,
+ ICdmEntitySessionEnabled, ICdmChangeListener {
/**
* Constant
private ConversationHolder conversation;
+ private ICdmEntitySession cdmEntitySession;
+
private String partNameCache;
private IDataChangeBehavior dataChangeBehavior;
+ private Root root;
+
/*
* (non-Javadoc)
*
Comparator<TaxonNode> comparator;
if (PreferencesUtil.getSortNodesNaturally()){
comparator = new TaxonNaturalComparator();
- } else{
+ } else if (PreferencesUtil.getSortNodesStrictlyAlphabetically()){
+ comparator = new TaxonNodeByNameComparator();
+ }else {
comparator = new TaxonNodeByRankAndNameComparator();
}
TaxonNodeNavigatorComparator viewerComparator = new TaxonNodeNavigatorComparator(comparator);
// we do not preserve state. Closing the view, in contrary to
// closing the whole application
// should be handled by the state manager too
-
- return new Root(conversation);
+ root = new Root(conversation);
+ return root;
}
return new EmptyRoot();
}
* </p>
*/
public void init() {
+
if (CdmStore.isActive() && conversation == null) {
conversation = CdmStore.createConversation();
conversation.registerForDataStoreChanges(TaxonNavigator.this);
}
+ if (CdmStore.isActive()) {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ CdmApplicationState.getCurrentDataChangeService().register(this);
+ }
CdmStore.getLoginManager().addObserver(this);
}
getCommonViewer().refresh();
}
+ /**
+ * Refresh this navigators viewer
+ */
+ public void refresh(Set objects) {
+ for(Object obj : objects) {
+ getCommonViewer().refresh(obj);
+ }
+ }
+
/**
* Removes all content
*/
* a {@link org.eclipse.core.runtime.IProgressMonitor} object.
*/
public void restore(IMemento memento, IProgressMonitor monitor) {
+ root = new Root(conversation);
if (memento == null) {
- getCommonViewer().setInput(new Root(conversation));
+ getCommonViewer().setInput(root);
return;
}
int mementoWork = 0;
subProgressMonitor.worked(1);
conversation.registerForDataStoreChanges(TaxonNavigator.this);
subProgressMonitor.worked(1);
- getCommonViewer().setInput(new Root(conversation));
+ getCommonViewer().setInput(root);
subProgressMonitor.worked(1);
getCommonViewer().refresh();
subProgressMonitor.worked(1);
if (conversation != null) {
conversation.unregisterForDataStoreChanges(this);
}
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ if(CdmApplicationState.getCurrentDataChangeService() != null) {
+ CdmApplicationState.getCurrentDataChangeService().unregister(this);
+ }
}
/*
if (getConversationHolder() != null) {
getConversationHolder().bind();
}
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
}
/*
/** {@inheritDoc} */
@Override
- protected void handleDoubleClick(DoubleClickEvent anEvent) {
- NavigationUtil.executeEditHandler();
+ protected void handleDoubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if(firstElement instanceof ICdmBase){
+ NavigationUtil.openEditor((ICdmBase) firstElement);
+ }
+ }
// If the double click is passed up to the super-class it will
// expand/collapse trees.
// We do not want that
}
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<Classification> getRootEntities() {
+ if(root != null) {
+ return root.getParentBeans();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+ */
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ if(event.getAction() == Action.Delete && Classification.class.equals(event.getEntityType())) {
+ refresh();
+ return;
+ }
+ for(CdmBase cb : event.getChangedObjects()) {
+ if(cb instanceof TaxonNode) {
+ TaxonNode tn = (TaxonNode)cb;
+ if(tn.getTaxon() == null) {
+ getCommonViewer().refresh(tn.getClassification());
+ } else {
+ getCommonViewer().refresh(cb);
+ }
+ } else if (cb instanceof Classification) {
+ getCommonViewer().refresh();
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
+ List<String> taxonNodePropertyPaths = Arrays.asList(new String[] {
+ "taxon.name"
+ });
+ propertyPathsMap.put("childNodes", taxonNodePropertyPaths);
+ return propertyPathsMap;
+ }
}
/**
* 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.
*/
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
* @created 01.04.2009
* @version 1.0
*/
-public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviour implements
+public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviour implements
IDataChangeBehavior {
- private TaxonNavigator source;
+ private final TaxonNavigator source;
private Set<CdmBase> staleObjects;
-
+
/**
* <p>Constructor for TaxonNavigatorDataChangeBehavior.</p>
*
public TaxonNavigatorDataChangeBehavior(TaxonNavigator taxonNavigator) {
source = taxonNavigator;
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#isRelevant(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
*/
* @return a boolean.
*/
public boolean isRelevant(CdmDataChangeMap events) {
-
+
// TODO react only on insert/update/delete of taxon and synonym objects
// and on update of name objects
boolean relevant = false;
staleObjects = new HashSet<CdmBase>();
-
+
for(CdmDataChangeEvent event : events.getAllEvents()){
EventType eventType = event.getEventType();
CdmBase eventEntity = event.getEntity();
-
+
+ Set<CdmBase> affectedObjects = event.getAffectedObjects();
+ if(affectedObjects != null) {
+ for(CdmBase cb : affectedObjects) {
+ staleObjects.add((CdmBase)HibernateProxyHelper.deproxy(cb));
+ }
+ }
+
// all tree node changes are relevant
- if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
+ if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
&& event.getEntity() instanceof ITaxonTreeNode){
return true;
}
-
+
// name updates of the accepted taxon of open editors are relevant
if(eventType == EventType.UPDATE && event.getEntity() instanceof TaxonNameBase){
TaxonNameBase name = null;
}else{
continue;
}
-
+
Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
/*for(IEditorPart editor : openEditors){
-
+
if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){
return true;
}
if (eventType == EventType.DELETE){
return true;
}
-
+
+
+
if(eventType == EventType.UPDATE && event.getEntity() instanceof Taxon){
TaxonNameBase name = null;
if(eventEntity instanceof Taxon){
}else{
continue;
}
-
- Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
+
+ // Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
/*for(IEditorPart editor : openEditors){
-
+
if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){
return true;
}
}*/
}
-
+
// if(eventType == EventType.UPDATE){
// relevant = true;
// CdmBase entity = event.getEntity();
// }
// }
}
-
+
return false;
-
+
// @deprecated
// react on everything except load
// if(events.sizeByEventType(EventType.INSERT) > 0){
final Display display = Display.getCurrent();
Job job = new Job("Updating Taxon Navigator") {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Updating Taxon Navigator", 3);
monitor.worked(1);
-
+
// clear the session completely
monitor.subTask("Clearing Taxon Navigators session");
display.asyncExec(new Runnable() {
public void run() {
source.getConversationHolder().clear();
}
- });
- // FIXME completely clearing the session is a brute force approach.
+ });
+ // FIXME completely clearing the session is a brute force approach.
// It would be much more elegant to clear only those elements that have been changed.
// I could not get that to work but we should consider workin on this because we might
// run into serious performance issues, especially when it comes to large trees
// at least, we moved this to a job so it can run in a background thred
// seems to improve the situation but not sure if final solution
monitor.worked(1);
-
+
monitor.subTask("Refreshing viewer");
-
+
display.asyncExec(new Runnable() {
@Override
public void run() {
- source.refresh();
+ if(staleObjects != null && staleObjects.size() > 0) {
+ source.refresh(staleObjects);
+ } else {
+ source.refresh();
+ }
}
});
-
-
-
+
+
+
monitor.worked(1);
monitor.done();
return Status.OK_STATUS;
}
};
-
+
job.setPriority(Job.SHORT);
job.schedule();
-
+
}
}
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator;
+
+/**
+ * @author cmathew
+ * @date 19 Jun 2015
+ *
+ */
+public interface TaxonNavigatorLabels {
+
+ public static final String CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL = "Change Accepted Taxon to Synonym";
+ public static final String MOVE_TAXON_LABEL = "Move Taxon";
+ public static final String MOVE_FACTUAL_DATA_LABEL = "Move Factual Data";
+ public static final String DELETE_TAXON_NODE_LABEL = "Delete Taxon Node";
+
+ public static final String NO_TAXON_SELECTION_MESSAGE = "No taxon tree node selected for operation.";
+ public static final String SINGLE_TAXON_SELECTION_MESSAGE = "The chosen operation is available only for a single taxon.";
+ public static final String SOURCE_TAXON_HAS_CHILDREN_MESSAGE = "The chosen taxon must not have any childen. You need to move all childen to " +
+ "another taxon node in the TaxonNavigator before attempting to turn the accepted " +
+ "taxon into a synonym.";
+ public static final String RELATED_EDITOR_NOT_CLOSED_MESSAGE = "Could not close related taxon name editor. " +
+ "Please close it manually and try again.";
+ public static final String SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE = "Selected object is not a taxon tree node";
+ public static final String UNSAVED_CHANGES_MESSAGE = "There are unsaved changes in the source taxon. Please save first.";
+
+
+
+}
package eu.etaxonomy.taxeditor.navigation.navigator;
+import java.util.List;
+
import org.apache.log4j.Logger;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
if(parentElement instanceof ITaxonTreeNode){
ITaxonTreeNode treeNode = (ITaxonTreeNode) HibernateProxyHelper.deproxy(parentElement);
- children = treeNode.getChildNodes().toArray();
+ List<TaxonNode> childrenSet = treeNode.getChildNodes();
+ while (childrenSet.contains(null)){
+ childrenSet.remove(null);
+ }
+ children = childrenSet.toArray();
+
}
return children != null ? children : NO_CHILDREN;
TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetNode.getParent(), this, taxonNavigator, false);
+ ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, false);
NavigationUtil.executeOperation(operation);
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
import java.util.UUID;
import org.apache.log4j.Logger;
+import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
return Status.CANCEL_STATUS;
}
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, true);
- NavigationUtil.executeOperation(operation);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, true);
+ NavigationUtil.executeOperation(operation, null);
+ } else {
+ AbstractPostOperation operation = new MoveTaxonOperation
+ ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, true);
+ NavigationUtil.executeOperation(operation);
+ }
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
return Status.CANCEL_STATUS;
}
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, true);
- NavigationUtil.executeOperation(operation);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, true);
+ NavigationUtil.executeOperation(operation, null);
+ } else {
+ AbstractPostOperation operation = new MoveTaxonOperation
+ ("Move Taxon", workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, true);
+ NavigationUtil.executeOperation(operation);
+ }
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
return Status.CANCEL_STATUS;
}
TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, uuids, targetNode.getParent(), this, taxonNavigator, false);
- NavigationUtil.executeOperation(operation);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, false);
+ NavigationUtil.executeOperation(operation, null);
+ } else {
+ AbstractPostOperation operation = new MoveTaxonOperation
+ ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, false);
+ NavigationUtil.executeOperation(operation);
+ }
logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
return Status.OK_STATUS;
} else{
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.navigation.navigator.handler;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.ChangeAcceptedTaxonToSynonymOperation;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.DeleteOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
private UUID newAcceptedTaxonNodeUuid;
private TaxonNameEditor editor;
-
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
-
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+
activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
taxonNavigator = NavigationUtil.showNavigator();
String plural = selection.size() > 1 ? "s" : "";
// Prompt user for confirmation
-
-
+
+
Iterator selectionIterator = selection.iterator();
Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
AbstractPostOperation operation = null;
if (treeNodes.size() == 1 ){
try {
-
+
ITaxonTreeNode treeNode = treeNodes.iterator().next();
ITaxonTreeNode oldAcceptedTaxonNode =treeNode;
-
+
// check if taxon has no children
if(((TaxonNode)oldAcceptedTaxonNode).getCountChildren() > 0) {
- MessagingUtils.warningDialog("Prerequisite not met", this,
+ MessagingUtils.warningDialog("Prerequisite not met", this,
"The accepted taxon must not have any childen. You need to move all childen to " +
"another taxon node in the TaxonNavigator before attempting to turn the accepted " +
"taxon into a synonym.");
return null;
}
/*if(((TaxonNode)oldAcceptedTaxonNode).getTaxon().hasSynonyms()) {
- EditorUtil.warningDialog("Prerequisite not met", this,
+ EditorUtil.warningDialog("Prerequisite not met", this,
"The accepted taxon must not have any synonyms. You need to move all synonyms to " +
"another taxon before attempting to turn the accepted " +
"taxon into a synonym.");
return null;
}*/
-
+
List<UUID> excludeTaxa = new ArrayList<UUID>();
- excludeTaxa.add(oldAcceptedTaxonNode.getUuid());
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
- taxonNavigator.getConversationHolder(),
- "Choose the accepted taxon",
- excludeTaxa,
- null,
- ((TaxonNode)oldAcceptedTaxonNode).getClassification());
+ excludeTaxa.add(((TaxonNode)oldAcceptedTaxonNode).getTaxon().getUuid());
+ TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+ taxonNavigator.getConversationHolder(),
+ "Choose the accepted taxon",
+ excludeTaxa,
+ null,
+ ((TaxonNode)oldAcceptedTaxonNode).getClassification());
if (newAcceptedTaxonNode == null) {
return null;
}
-
+
if (allEditorsClosed){
-
- operation = new ChangeAcceptedTaxonToSynonymOperation(event.getCommand().getName(), NavigationUtil.getUndoContext(), oldAcceptedTaxonNode, newAcceptedTaxonNode,
- taxonNavigator, taxonNavigator);
-
+
+ operation = new ChangeAcceptedTaxonToSynonymOperation(event.getCommand().getName(),
+ NavigationUtil.getUndoContext(),
+ oldAcceptedTaxonNode,
+ newAcceptedTaxonNode,
+ taxonNavigator,
+ taxonNavigator,
+ taxonNavigator);
+
NavigationUtil.executeOperation(operation);
//}
}
-
-
-
+
+
+
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set");
}
return null;
}
}
-
-
+
+
return null;
-
+
}
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
*/
/** {@inheritDoc} */
- public boolean postOperation(CdmBase objectAffectedByOperation) {
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
Display.getDefault().asyncExec(new Runnable(){
- public void run() {
+ @Override
+ public void run() {
EditorUtil.close(editor.getMultiPageTaxonEditor());
-
+
try {
MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
if(possibleOpenEditor != null){
MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
}
}
-
+
});
-
-
+
+
return true;
}
*
* @return a boolean.
*/
- public boolean onComplete() {
+ @Override
+ public boolean onComplete() {
// TODO Auto-generated method stub
return false;
- }
+ }
}
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
-import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator.ChildHandling;
+import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
import eu.etaxonomy.cdm.model.common.ITreeNode;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+
+ String plural = selection.size() > 1 ? "s" : "";
+ // Prompt user for confirmation
+
+
+
Iterator selectionIterator = selection.iterator();
Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
}
AbstractPostOperation operation = null;
TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+ config.setDeleteInAllClassifications(false);
+
if (treeNodes.size() == 1 ){
try {
ITaxonTreeNode treeNode = treeNodes.iterator().next();
ITaxonTreeNode taxonNode =treeNode;
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+
//configNodes.setDeleteTaxon(false);
if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){
"Do you really want to delete the selected node? It has childnodes, they will be deleted, too.",
MessageDialog.WARNING, new String[] { "Delete all children",
"Move children to parent node", "Skip" }, 0);
- int result = dialog.open();
+ int dialog_result = dialog.open();
- if (result == 0){
+ if (dialog_result == 0){
//delete all children
configNodes.setChildHandling(ChildHandling.DELETE);
config.setTaxonNodeConfig(configNodes);
- } else if (result == 1){
+ } else if (dialog_result == 1){
//move children
configNodes.setChildHandling(ChildHandling.MOVE_TO_PARENT);
config.setTaxonNodeConfig(configNodes);
- } else if (result == 2){
+ } else if (dialog_result == 2){
//skip
return null;
/*if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected nodes?")){
return null;
}*/
- operation = new DeleteOperation(
- event.getCommand().getName(), NavigationUtil.getUndoContext(),
- taxonNode, config, taxonNavigator, taxonNavigator);
- AbstractUtility.executeOperation(operation);
+ operation = new DeleteOperation(event.getCommand().getName(),
+ NavigationUtil.getUndoContext(),
+ taxonNode,
+ config,
+ taxonNavigator,
+ taxonNavigator,
+ taxonNavigator);
+
+ NavigationUtil.executeOperation(operation);
+
//}
}
return null;
}
if (allEditorsClosed){
- operation = new DeleteOperation(
- event.getCommand().getName(), NavigationUtil.getUndoContext(),
- treeNodes, new TaxonDeletionConfigurator(), taxonNavigator, taxonNavigator);
- AbstractUtility.executeOperation(operation);
+ operation = new DeleteOperation(event.getCommand().getName(),
+ NavigationUtil.getUndoContext(),
+ treeNodes,
+ new TaxonDeletionConfigurator(),
+ taxonNavigator,
+ taxonNavigator,
+ taxonNavigator);
+
+ NavigationUtil.executeOperation(operation);
+
}
}catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set");
+++ /dev/null
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
-
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-
-/**
- * <p>EditHandler class.</p>
- *
- * @author n.hoffmann
- * @created May 12, 2010
- * @version 1.0
- */
-public class EditHandler extends AbstractHandler implements IHandler{
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
- if(selection instanceof IStructuredSelection){
- final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
- Classification classification = (Classification) structuredSelection.getFirstElement();
-
- NewClassificationWizard classificationWizard = new NewClassificationWizard();
- classificationWizard.init(null, null);
- classificationWizard.setEntity(classification);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
- dialog.open();
-
- }
- else{
-
- Job job = new Job("Opening editor") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- for(final Object selectedObject : structuredSelection.toArray()){
-
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- NavigationUtil.openEditor(selectedObject);
- }
-
- });
- }
- return Status.OK_STATUS;
- }
- };
-
- job.schedule();
- }
- }
-
- return null;
- }
-}
import java.util.List;
import java.util.UUID;
-import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.AnnotationType;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
navigator.getConversationHolder(),
"Choose the accepted taxon",
excludeTaxa,
- null,
- null);
+ sourceTaxonNode,
+ sourceTaxonNode.getClassification());
if (dialogTaxonNode == null) {
return null;
}
"changes in the target taxon. Please save first.");
return null;
}
- for(TaxonDescription description : taxon.getDescriptions()){
- //reload to avoid session conflicts
- description = HibernateProxyHelper.deproxy(CdmStore.getService(IDescriptionService.class).load(description.getUuid()), TaxonDescription.class);
+ CdmStore.getService(IDescriptionService.class).moveTaxonDescriptions(taxon.getUuid(),targetTaxonNode.getTaxon().getUuid());
- String moveMessage = String.format("Description moved from %s", taxon);
- if(description.isProtectedTitleCache()){
- String separator = "";
- if(!StringUtils.isBlank(description.getTitleCache())){
- separator = " - ";
- }
- description.setTitleCache(description.getTitleCache() + separator + moveMessage, true);
- }
- Annotation annotation = Annotation.NewInstance(moveMessage, Language.getDefaultLanguage());
- annotation.setAnnotationType(AnnotationType.TECHNICAL());
- description.addAnnotation(annotation);
- targetTaxonNode.getTaxon().addDescription(description);
- CdmStore.getService(IDescriptionService.class).saveOrUpdate(description);
- navigator.getConversationHolder().bind();
- navigator.getConversationHolder().commit();
- }
+ navigator.getConversationHolder().bind();
+ navigator.getConversationHolder().commit();
Display.getDefault().asyncExec(new Runnable(){
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
if (taxonNodes.size() >= 1){
+ Classification classification = taxonNodes.iterator().next().getClassification();
boolean moveToNewParent = true;
if (PreferencesUtil.getSortNodesNaturally()){
if(!MessageDialog.openQuestion(null, "Target node", "The choosen target node should be the parent?")){
moveToNewParent = false;
}
- parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose the taxon above the moved taxon.", excludeTaxa, null, null);
+ parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose the taxon above the moved taxon.", excludeTaxa, null, classification);
}else{
- parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose new parent", excludeTaxa, null, null);
+ parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), "Choose new parent", excludeTaxa, null, classification);
}
if(parentTaxonNode != null){
if(NavigationUtil.isDirty(parentTaxonNode)){
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.common.ITreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+
+/**
+ * @author cmathew
+ * @date 16 Jun 2015
+ *
+ */
+public class NavigatorHandlerUtils {
+
+ protected static boolean closeObsoleteEditor(ExecutionEvent event, TaxonNode taxonNode){
+ IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+ boolean result = true;
+ for (IEditorReference ref : activePage.getEditorReferences()) {
+ try {
+ String treeIndex = ((ITreeNode)taxonNode).treeIndex();
+
+
+ IEditorInput input = ref.getEditorInput();
+ if (input instanceof TaxonEditorInput) {
+ TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
+ //if node is a child of taxonNode then close the editor
+ if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
+ //if (taxonNode.equals(node)) {
+ result &= activePage.closeEditor(ref.getEditor(false), true);
+
+ }
+ }
+ } catch (PartInitException e) {
+ continue;
+ }
+ }
+ return result;
+ }
+
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ * <p>ChangeAcceptedTaxonToSynonymHandler class.</p>
+ *
+ * @author n.hoffmann
+ * @created Jan 4, 2010
+ * @version 1.0
+ */
+public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHandler {
+
+ private static final Logger logger = Logger
+ .getLogger(RemotingChangeAcceptedTaxonToSynonymHandler.class);
+
+
+ private ITaxonTreeNode oldTaxonNode;
+
+ /**
+ * @param label
+ */
+ public RemotingChangeAcceptedTaxonToSynonymHandler() {
+ super(TaxonNavigatorLabels.CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ // check that only a single taxon tree node has been selected
+ if(selection.size() > 1) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check that selected object is a taxon node
+ Object obj = selection.iterator().next();
+ if(obj instanceof ITaxonTreeNode) {
+ oldTaxonNode = (ITaxonTreeNode)obj;
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+ // check that the source taxon node does not have children
+ if(((TaxonNode)oldTaxonNode).getCountChildren() > 0) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SOURCE_TAXON_HAS_CHILDREN_MESSAGE);
+
+ }
+
+ // check if corresponding name editor is closed
+ boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) oldTaxonNode);
+ if(editorClosed != true) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
+ }
+
+ return Status.OK_STATUS;
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(((TaxonNode)oldTaxonNode).getTaxon().getUuid());
+ TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+ new ConversationHolderMock(),
+ "Choose the accepted taxon",
+ excludeTaxa,
+ null,
+ ((TaxonNode)oldTaxonNode).getClassification());
+
+ if (newAcceptedTaxonNode == null) {
+ return null;
+ }
+
+ RemotingChangeAcceptedTaxonToSynonymOperation rcattso =
+ new RemotingChangeAcceptedTaxonToSynonymOperation(event.getTrigger(),
+ false,
+ oldTaxonNode.getUuid(),
+ newAcceptedTaxonNode.getUuid());
+
+ return rcattso;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.navigation.navigator.handler;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog;
+
+/**
+ * @author cmathew
+ * @date 22 Jun 2015
+ *
+ */
+public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
+
+ private TaxonDeletionConfigurator config;
+ private Set<ITaxonTreeNode> treeNodes;
+
+ /**
+ * @param label
+ */
+ public RemotingDeleteTaxonNodeHandler() {
+ super(TaxonNavigatorLabels.DELETE_TAXON_NODE_LABEL);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+
+ Iterator selectionIterator = selection.iterator();
+ treeNodes = new HashSet<ITaxonTreeNode>();
+
+ while (selectionIterator.hasNext()){
+ Object object = selectionIterator.next();
+ if(object instanceof ITaxonTreeNode) {
+ treeNodes.add((ITaxonTreeNode) object);
+ }
+ }
+ boolean allEditorsClosed = true;
+ IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+ for (ITaxonTreeNode treeNode : treeNodes) {
+ if(treeNode instanceof TaxonNode) {
+ allEditorsClosed &= EditorUtil.closeObsoleteEditor((TaxonNode) treeNode, activePage);
+ }
+ }
+ if(!allEditorsClosed) {
+ return new Status(IStatus.WARNING,
+ "unknown",
+ TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
+ }
+
+ config = new TaxonDeletionConfigurator();
+
+ if (treeNodes.size() == 1 ){
+ ITaxonTreeNode treeNode = treeNodes.iterator().next();
+ ITaxonTreeNode taxonNode = treeNode;
+ if (taxonNode instanceof Classification){
+ taxonNode = CdmApplicationState.getCurrentAppConfig().getClassificationService().load(taxonNode.getUuid());
+ }else{
+ taxonNode = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(taxonNode.getUuid());
+ }
+ if (taxonNode == null){
+ MessagingUtils.informationDialog("Node already deleted", "The taxon node was already deleted. Please reopen the taxon navigator to refresh the view.");
+ return Status.CANCEL_STATUS;
+
+ }
+ TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+ if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){
+ return Status.CANCEL_STATUS;
+ }
+ } else if (taxonNode instanceof Classification && !taxonNode.hasChildNodes()){
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification?")){
+ return Status.CANCEL_STATUS;
+ }
+ } else {
+
+ if (taxonNode.hasChildNodes()){
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
+ config,
+ HandlerUtil.getActiveShell(event),
+ "Confirm Deletion",
+ null,
+ "Do you really want to delete the selected node? It has childnodes, they will be deleted, too.",
+ MessageDialog.WARNING, new String[] { "Delete all children",
+ "Move children to parent node", "Skip" }, 0);
+ int result = dialog.open();
+
+ if (result == 0){
+ //delete all children
+ configNodes.setChildHandling(ChildHandling.DELETE);
+ config.setTaxonNodeConfig(configNodes);
+ } else if (result == 1){
+ //move children
+ configNodes.setChildHandling(ChildHandling.MOVE_TO_PARENT);
+ config.setTaxonNodeConfig(configNodes);
+ } else if (result == 2){
+ return Status.CANCEL_STATUS;
+ }
+ } else{
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
+ return Status.CANCEL_STATUS;
+ }
+ config.setTaxonNodeConfig(configNodes);
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingDeleteTaxonNodeOperation(event.getTrigger(),
+ false,
+ treeNodes,
+ config);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveFactualDataOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ * @author cmathew
+ * @date 19 Jun 2015
+ *
+ */
+public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
+
+
+ private TaxonNode sourceTaxonNode;
+ private TaxonNode targetTaxonNode;
+ /**
+ * @param label
+ */
+ public RemotingMoveFactualDataHandler() {
+ super(TaxonNavigatorLabels.MOVE_FACTUAL_DATA_LABEL);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ // check that only a single taxon tree node has been selected
+ if(selection.size() > 1) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check that selected object is a taxon node
+ Object obj = selection.iterator().next();
+ if(obj instanceof ITaxonTreeNode) {
+ sourceTaxonNode = (TaxonNode)obj;
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+
+ if(NavigationUtil.isDirty(sourceTaxonNode)) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE);
+ }
+
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(sourceTaxonNode.getTaxon().getUuid());
+
+ targetTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+ new ConversationHolderMock(),
+ "Choose the accepted taxon",
+ excludeTaxa,
+ null,
+ sourceTaxonNode.getClassification());
+
+ if(targetTaxonNode == null) {
+ return new Status(IStatus.CANCEL,
+ "unknown",
+ "");
+ }
+ if(NavigationUtil.isDirty(targetTaxonNode)){
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE);
+ }
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ return new RemotingMoveFactualDataOperation(event.getTrigger(),
+ false,
+ sourceTaxonNode.getTaxon().getUuid(),
+ targetTaxonNode.getTaxon().getUuid());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ Display.getDefault().asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ try {
+ //close and re-open to refresh factual data view
+ MultiPageTaxonEditor sourceEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(sourceTaxonNode.getUuid());
+ MultiPageTaxonEditor targetEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(targetTaxonNode.getUuid());
+ if(targetEditor != null){
+ AbstractUtility.close(sourceEditor);
+ AbstractUtility.close(targetEditor);
+ }
+ EditorUtil.openTaxonNode(sourceTaxonNode.getUuid());
+ EditorUtil.openTaxonNode(targetTaxonNode.getUuid());
+ } catch (PartInitException e) {
+ MessagingUtils.error(this.getClass(), e);
+ throw new RuntimeException(e);
+ } catch (Exception e) {
+ MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
+ }
+ }
+
+ });
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.navigation.navigator.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ * @author cmathew
+ * @date 19 Jun 2015
+ *
+ */
+public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
+
+ private TaxonNode oldTaxonNode;
+
+ public RemotingMoveTaxonNodeHandler() {
+ super(TaxonNavigatorLabels.MOVE_TAXON_LABEL);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public IStatus allowOperations(ExecutionEvent event) {
+ TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ // check that only a single taxon tree node has been selected
+ if(selection.size() > 1) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+ // check that selected object is a taxon node
+ Object obj = selection.iterator().next();
+ if(obj instanceof TaxonNode) {
+ oldTaxonNode = (TaxonNode)obj;
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown",
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+ return Status.OK_STATUS;
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public AbstractOperation prepareOperation(ExecutionEvent event) {
+ Shell activeShell = HandlerUtil.getActiveShell(event);
+ TaxonNode parentTaxonNode;
+
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(oldTaxonNode.getTaxon().getUuid());
+
+ boolean moveToNewParent = true;
+
+ if (PreferencesUtil.getSortNodesNaturally()){
+ if(!MessageDialog.openQuestion(activeShell, "Target node", "Should the choosen target node be the parent of this taxon node?")){
+ moveToNewParent = false;
+ }
+ parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+ new ConversationHolderMock(),
+ "Choose the taxon above the moved taxon.",
+ excludeTaxa,
+ null,
+ oldTaxonNode.getClassification());
+ } else {
+ parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+ new ConversationHolderMock(),
+ "Choose new parent",
+ excludeTaxa,
+ null,
+ oldTaxonNode.getClassification());
+ }
+
+
+ if(parentTaxonNode != null){
+ if(NavigationUtil.isDirty(parentTaxonNode)){
+ MessageDialog.openWarning(activeShell,
+ "Unsaved Parent Taxon",
+ "There are unsaved changes in the parent taxon. Please save first.");
+ return null;
+ }
+
+ return new RemotingMoveTaxonOperation(event.getTrigger(),
+ false,
+ oldTaxonNode.getUuid(),
+ parentTaxonNode.getUuid(),
+ moveToNewParent);
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
+ */
+ @Override
+ public void onComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
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;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
DeleteOperation {
private final TaxonNode newAcceptedTaxonNode;
+ private final ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
//private TaxonNode oldTaxonNode;
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public ChangeAcceptedTaxonToSynonymOperation(String label,
- IUndoContext undoContext, ITaxonTreeNode oldTaxonNode, TaxonNode newAcceptedTaxonNode,
- IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
- super(label, undoContext, oldTaxonNode, new TaxonDeletionConfigurator(),postOperationEnabled, conversationEnabled);
+ IUndoContext undoContext,
+ ITaxonTreeNode oldTaxonNode,
+ TaxonNode newAcceptedTaxonNode,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, oldTaxonNode, new TaxonDeletionConfigurator(),postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.newAcceptedTaxonNode = newAcceptedTaxonNode;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
}
monitor.worked(20);
bind();
- Taxon oldTaxon = (Taxon) HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon());
+
+ Taxon oldTaxon = HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon(), Taxon.class);
+ Taxon newAcceptedTaxon = HibernateProxyHelper.deproxy(newAcceptedTaxonNode.getTaxon(), Taxon.class);
+
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);
+
+
if (!result.getExceptions().isEmpty() && result.isOk()){
String separator = ", ";
String exceptionString = "";
+ int count = result.getExceptions().size();
+ int n = 0;
for (Exception exception : result.getExceptions()) {
- exceptionString += exception.getLocalizedMessage()+separator;
+ n++;
+ exceptionString += exception.getLocalizedMessage();
+ if (n<count){
+ exceptionString += separator;
+ }
}
-
- MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);
+
+ MessagingUtils.informationDialog("Synonym created but taxon deletion not possible.", exceptionString);
} else if (result.isAbort() || result.isError()){
- MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true);
+ MessagingUtils.errorDialog("Synonym creation not possible", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true);
}
} catch (IllegalArgumentException e) {
MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false);
return Status.CANCEL_STATUS;
}
-
+
monitor.worked(40);
return postExecute(oldTaxon);
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.navigation.navigator.operation;
+import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
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;
+ }
- /**
- * <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;
- }
-
- /**
- * <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;
- }
/* (non-Javadoc)
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 = "";
- int count = 1;
- for (Exception exception : result.getExceptions()) {
- exceptionString += exception.getLocalizedMessage();
- if (count < result.getExceptions().size()){
- exceptionString += separator;
- }
- }
- MessagingUtils.informationDialog("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()){
- String separator = ", ";
- String exceptionString = "";
- for (Exception exception : result.getExceptions()) {
- exceptionString += exception.getLocalizedMessage()+separator;
- }
- MessagingUtils.error(null, exceptionString, result.getExceptions().iterator().next());
- }
-
- /*}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()){
- String separator = ", ";
- String exceptionString = "";
- for (Exception exception : result.getExceptions()) {
- exceptionString += exception.getLocalizedMessage()+separator;
- }
- MessagingUtils.error(null, exceptionString, result.getExceptions().iterator().next());
- }
+ 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()){
+
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
+ } else if (!result.getExceptions().isEmpty()){
+ String separator = ", ";
+ String exceptionString = "";
+ for (Exception exception : result.getExceptions()) {
+ exceptionString += exception.getLocalizedMessage()+separator;
+ }
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode was successfully deleted, but related object(s) could not be deleted", TaxeditorNavigationPlugin.PLUGIN_ID);
}
- 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;
- }
+ }else if(taxonNode != null && taxonNode instanceof Classification){
+ Classification taxonomicTree = (Classification) taxonNode;
+
+ DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree.getUuid());
+ if (result.isError() && !result.getExceptions().isEmpty()){
+ //TODO:Error message!
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
+ }
+ } else {
+ Set<UUID> treeNodeUuids = new HashSet<UUID>();
+ ITaxonTreeNode entity = null;
+ for(ITaxonTreeNode treeNode : treeNodes) {
+ if(entity == null) {
+ entity = treeNode;
+ }
+ treeNodeUuids.add(treeNode.getUuid());
+ }
+
+ DeleteResult result = service.deleteTaxonNodes(treeNodeUuids, config);
+ if (result.isError() && !result.getExceptions().isEmpty()){
+ //TODO:Error message!
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "TaxonNode could not be deleted.", TaxeditorNavigationPlugin.PLUGIN_ID);
+ }
- /* (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;
+ }
}
// $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.
*/
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @version 1.0
*/
public class EditClassificationOperation extends AbstractPersistentPostOperation {
- private Classification classification;
+ private final Classification classification;
/**
* <p>Constructor for EditTaxonomicTreeOperation.</p>
*/
public EditClassificationOperation(String label, IUndoContext undoContext, Classification classification,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
-
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+
this.classification = classification;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
*/
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
bind();
-
+
CdmStore.getService(IClassificationService.class).save(classification);
-
+
monitor.worked(40);
return postExecute(classification);
-
+
}
/* (non-Javadoc)
bind();
monitor.worked(20);
- UpdateResult result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid());
+ UpdateResult result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), moveToParentNode);
// try {
// for (TaxonNode taxonNode : taxonNodes){
// TaxonNode newTaxonNode = newParentTreeNode.addChildNode(taxonNode,
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.operation;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+
+/**
+ * @author cmathew
+ * @date 17 Jun 2015
+ *
+ */
+public class RemotingChangeAcceptedTaxonToSynonymOperation extends RemotingCdmUpdateOperation {
+
+ private final UUID oldTaxonNodeUuid;
+ private final UUID newAcceptedTaxonNodeUuid;
+
+
+ private final static String LABEL = "Change Accepted Taxon to Synonym operation";
+
+ /**
+ * @param label
+ */
+ public RemotingChangeAcceptedTaxonToSynonymOperation(Object source,
+ boolean async,
+ UUID oldTaxonNodeUuid,
+ UUID newAcceptedTaxonNodeUuid) {
+ super(LABEL, Action.Update, source, async);
+ this.oldTaxonNodeUuid = oldTaxonNodeUuid;
+ this.newAcceptedTaxonNodeUuid = newAcceptedTaxonNodeUuid;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ return CdmApplicationState.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(oldTaxonNodeUuid,
+ newAcceptedTaxonNodeUuid,
+ null,
+ null,
+ null);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.operation;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author cmathew
+ * @date 22 Jun 2015
+ *
+ */
+public class RemotingDeleteTaxonNodeOperation extends RemotingCdmUpdateOperation {
+
+ private final static String LABEL = "Delete Taxon Node operation";
+
+ private final Set<ITaxonTreeNode> treeNodes;
+ private final TaxonDeletionConfigurator config;
+
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingDeleteTaxonNodeOperation(Object source,
+ boolean async,
+ Set<ITaxonTreeNode> treeNodes,
+ TaxonDeletionConfigurator config) {
+ super(LABEL, Action.Delete, source, async);
+ this.treeNodes = treeNodes;
+ this.config = config;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+
+
+ if(treeNodes.size() == 1) {
+ // when single node this is either a taxon or a classification
+ ITaxonTreeNode node = treeNodes.iterator().next();
+ if(node instanceof TaxonNode) {
+ return CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNode(((TaxonNode)node).getUuid(), config);
+ } else if(node instanceof Classification) {
+ entityType = Classification.class;
+ return CdmApplicationState.getCurrentAppConfig().getClassificationService().delete(((Classification)node).getUuid());
+ }
+ } else {
+ // when list we assume all are taxon nodes
+ Set<UUID> treeNodeUuids = new HashSet<UUID>();
+ ITaxonTreeNode entity = null;
+ for(ITaxonTreeNode treeNode : treeNodes) {
+ if(entity == null) {
+ entity = treeNode;
+ }
+ treeNodeUuids.add(treeNode.getUuid());
+ }
+
+ return CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().deleteTaxonNodes(treeNodeUuids, new TaxonDeletionConfigurator());
+ }
+ return null;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.operation;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author cmathew
+ * @date 19 Jun 2015
+ *
+ */
+public class RemotingMoveFactualDataOperation extends RemotingCdmUpdateOperation {
+
+ private final static String LABEL = "Move Factual Data operation";
+
+ private final UUID sourceTaxonUuid;
+ private final UUID targetParentTaxonUuid;
+
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingMoveFactualDataOperation(Object source,
+ boolean async,
+ UUID sourceTaxonUuid,
+ UUID targetParentTaxonUuid) {
+ super(LABEL, Action.Update, source, async);
+ this.sourceTaxonUuid = sourceTaxonUuid;
+ this.targetParentTaxonUuid = targetParentTaxonUuid;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ return CdmApplicationState.getService(IDescriptionService.class).moveTaxonDescriptions(sourceTaxonUuid,
+ targetParentTaxonUuid);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.navigator.operation;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author cmathew
+ * @date 19 Jun 2015
+ *
+ */
+public class RemotingMoveTaxonOperation extends RemotingCdmUpdateOperation {
+
+ private final static String LABEL = "Move Taxon operation";
+
+ private final Set<UUID> taxonNodesToMoveUuid;
+ private final UUID newParentTreeNodeUuid;
+ private final boolean moveToParentNode;
+
+ public RemotingMoveTaxonOperation(Object source,
+ boolean async,
+ UUID taxonNodeToMoveUuid,
+ UUID newParentTreeNodeUuid,
+ boolean moveToParentNode) {
+ super(LABEL, Action.Update, source,async);
+ taxonNodesToMoveUuid = new HashSet<UUID>();
+ taxonNodesToMoveUuid.add(taxonNodeToMoveUuid);
+ this.newParentTreeNodeUuid = newParentTreeNodeUuid;
+ this.moveToParentNode = moveToParentNode;
+ }
+
+ public RemotingMoveTaxonOperation(Object source,
+ boolean async,
+ TaxonNode taxonNodeToMove,
+ TaxonNode newParentTreeNode,
+ boolean moveToParentNode) {
+ super(LABEL, Action.Update, source,async);
+ taxonNodesToMoveUuid = new HashSet<UUID>();
+ taxonNodesToMoveUuid.add(taxonNodeToMove.getUuid());
+ this.newParentTreeNodeUuid = newParentTreeNode.getUuid();
+ this.moveToParentNode = moveToParentNode;
+ }
+
+ public RemotingMoveTaxonOperation(Object source,
+ boolean async,
+ Set<UUID> taxonNodesToMoveUuid,
+ TaxonNode newParentTreeNode,
+ boolean moveToParentNode) {
+ super(LABEL, Action.Update, source,async);
+ this.taxonNodesToMoveUuid = taxonNodesToMoveUuid;
+ this.newParentTreeNodeUuid = newParentTreeNode.getUuid();
+ this.moveToParentNode = moveToParentNode;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ return CdmApplicationState.getService(ITaxonNodeService.class).moveTaxonNodes(taxonNodesToMoveUuid,
+ newParentTreeNodeUuid, moveToParentNode);
+ }
+
+}
// $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.
*/
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
@Deprecated // we do not undo creation of elements
public class CreateClassification extends AbstractPersistentPostOperation {
- private Classification classification;
-
+ private final Classification classification;
+
/**
* <p>Constructor for SaveClassificationOperation.</p>
*
*/
public CreateClassification(String label, IUndoContext undoContext, Classification classification,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
-
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitiySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitiySessionEnabled);
+
this.classification = classification;
-
+
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
*/
throws ExecutionException {
bind();
monitor.worked(20);
-
+
if(classification.getReference() == null){
Reference reference = ReferenceFactory.newGeneric();
reference.setTitleCache(classification.getTitleCache());
classification.setReference(reference);
}
-
+
CdmStore.getService(IClassificationService.class).saveOrUpdate(classification);
-
+
monitor.worked(40);
return postExecute(classification);
// $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.
*/
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
@Deprecated // we do not undo creation of elements
public class CreatePolytomousKey extends AbstractPersistentPostOperation {
- private PolytomousKey key;
+ private final PolytomousKey key;
/**
* @param label
IUndoContext undoContext,
PolytomousKey key,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.key = key;
}
monitor.worked(20);
CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(key);
monitor.worked(40);
-
+
return postExecute(key);
}
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
@Deprecated // we do not undo creation of elements
public class CreateTaxonNode extends AbstractPersistentPostOperation {
- private Taxon newTaxon;
+ private final Taxon newTaxon;
private TaxonNode childTaxonNode;
* @param parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
- public CreateTaxonNode(String label, IUndoContext undoContext,
- ITaxonTreeNode parentNode, TaxonNameBase<?, ?> name, IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled);
+ public CreateTaxonNode(String label,
+ IUndoContext undoContext,
+ ITaxonTreeNode parentNode, TaxonNameBase<?, ?> name,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
newTaxon = Taxon.NewInstance(name, null);
}
* @param parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
- public CreateTaxonNode(String label, IUndoContext undoContext,
- ITaxonTreeNode parentNode, Taxon taxon, IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled);
+ public CreateTaxonNode(String label,
+ IUndoContext undoContext,
+ ITaxonTreeNode parentNode,
+ Taxon taxon,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.newTaxon = taxon;
}
package eu.etaxonomy.taxeditor.navigation.search;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.swt.IFocusService;
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>SearchBar class.</p>
- *
* @author n.hoffmann
* @author e.-m.lee
* @created 15.04.2009
* @version 1.0
*/
-public class SearchBar extends WorkbenchWindowControlContribution{
+public class SearchBar extends WorkbenchWindowControlContribution implements IContextListener{
private Text text_search;
private String secondaryId;
+ private ToolBar toolBar;
private final String defaultText = Messages.SearchBar_0;
createSearchTextField(composite);
createToolBar(composite);
registerAtFocusService();
+ //register for context refreshes
+ CdmStore.getContextManager().addContextListener(this);
return composite;
}
* @param composite
*/
private void createToolBar(Composite composite) {
- final ToolBar toolBar = new ToolBar(composite, SWT.NULL);
+ toolBar = new ToolBar(composite, SWT.NULL);
ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN | SWT.BORDER);
toolItem.setText(Messages.SearchBar_1);
+ toolBar.setEnabled(false);
DropdownSelectionListener dropdownListener = new DropdownSelectionListener(
toolItem);
// is applied. I am not sure how to get rid of this.
text_search = new Text(composite, SWT.BORDER | SWT.SINGLE
| SWT.FULL_SELECTION);
- text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
+ text_search.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND));
text_search.setText(defaultText);
+ text_search.setEnabled(false);
addTextListeners();
}
@Override
public void focusGained(FocusEvent e) {
- text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOCUS));
+ text_search.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOCUS));
if (defaultText.equals(text_search.getText())) {
text_search.setText("");
}
@Override
public void focusLost(FocusEvent e) {
if (text_search.getText() == "") {
- text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
+ text_search.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND));
text_search.setText(defaultText);
}
}
});
text_search.addKeyListener(new KeyAdapter() {
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.KeyAdapter#keyPressed(org.eclipse.swt.events.KeyEvent)
- */
@Override
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.CR) {
return;
}
- if("*".equals(searchString.trim())){
+ if(!searchString.trim().matches(".*\\p{L}+.*")){
MessagingUtils.warningDialog(Messages.SearchBar_2, this, Messages.SearchBar_3);
return;
}
private IFindTaxaAndNamesConfigurator configurator = PreferencesUtil.getSearchConfigurator();
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent e) {
SearchOption option = (SearchOption) e.widget.getData();
public boolean getPreference() {
if (!PreferencesUtil.getPreferenceStore().contains(
- PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
// initializes the search configurator
PreferencesUtil.initializeSearchConfigurator();
}
switch (this) {
case TAXON:
boolean result = PreferencesUtil.getPreferenceStore().getBoolean(
- PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_TAXA);
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA);
return result;
case SYNONYM:
return PreferencesUtil.getPreferenceStore().getBoolean(
- PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
case NAME:
return PreferencesUtil.getPreferenceStore().getBoolean(
- PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_NAMES);
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_NAMES);
case COMMON_NAME:
return PreferencesUtil.getPreferenceStore().getBoolean(
- PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
}
return true;
}
}
+
+ @Override
+ public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
+ }
+
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ if(!text_search.isDisposed()){
+ text_search.setEnabled(false);
+ }
+ if(!toolBar.isDisposed()){
+ toolBar.setEnabled(false);
+ }
+ }
+
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+ text_search.setEnabled(true);
+ toolBar.setEnabled(true);
+ }
+
+ @Override
+ public void contextRefresh(IProgressMonitor monitor) {
+ }
+
+ @Override
+ public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ }
}
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
import eu.etaxonomy.taxeditor.model.IContextListener;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.search.SearchBar.SearchOption;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
/**
* <p>SearchResultView class.</p>
resultViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
- NavigationUtil.executeEditHandler();
+ if(event.getSelection() instanceof IStructuredSelection){
+ Object selectedObject = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ CdmViewerChooser chooser = new CdmViewerChooser(getSite().getShell());
+ chooser.chooseViewer(selectedObject);
+ }
}
});
if(configurator.isDoTaxaByCommonNames()){
includedEntities.add(SearchOption.COMMON_NAME.getLabel());
}
+ configurator.setMatchMode(MatchMode.LIKE);
String includedEntitiesString = "";
for (int i = 0; i < includedEntities.size(); i++){
+++ /dev/null
-### ************ APPENDER ***********************************###
-
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=taxeditor.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### ************* LOG LEVELS *********************************###
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-### levels: error, warn, debug, info
-log4j.rootLogger=WARN, stdout
-
-### set directory-specific levels below
-
-### basic level for editor directory
-log4j.logger.eu.etaxonomy.taxeditor.editor = INFO, stdout
-
-log4j.logger.eu.etaxonomy.taxeditor.editor.handler = INFO, stdout
-
-### log level for conversation handler
-#log4j.logger.eu.etaxonomy.cdm.api.application = DEBUG, stdout
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
Bundle-ManifestVersion: 2
Bundle-Name: Printpublisher Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Require-Bundle: org.eclipse.osgi,
org.eclipse.ui,
eu.etaxonomy.taxeditor.cdmlib,
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Bundle-Activator: eu.etaxonomy.taxeditor.printpublisher.internal.PrintpublisherPlugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ClassPath: .,
- activation-1.1.jar,
- antlr-2.7.6.jar,
- aopalliance-1.0.jar,
- asm-attrs.jar,
- asm.jar,
- aspectjrt-1.6.3.jar,
- aspectjweaver-1.6.3.jar,
- avalon-framework-4.2.0.jar,
- batik-all-1.7.jar,
- c3p0-0.9.1.jar,
- cdmlib-commons-3.0.7-SNAPSHOT.jar,
- cdmlib-ext-3.0.7-SNAPSHOT.jar,
- cdmlib-io-3.0.7-SNAPSHOT.jar,
- cdmlib-model-3.0.7-SNAPSHOT.jar,
- cdmlib-persistence-3.0.7-SNAPSHOT.jar,
- cdmlib-print-3.0.7-SNAPSHOT.jar,
- cdmlib-remote-3.0.7-SNAPSHOT.jar,
- cglib-2.1.3.jar,
- commons-beanutils-1.7.0.jar,
- commons-collections-3.2.jar,
- commons-dbcp-1.2.2.jar,
- commons-io-1.3.1.jar,
- commons-logging-1.0.4.jar,
- commons-pool-1.3.jar,
- dom4j-1.6.1.jar,
- dozer-5.3.0-sources.jar,
- dozer-5.3.0.jar,
- ehcache-1.2.3.jar,
- ejb3-persistence.jar,
- ezmorph-1.0.4.jar,
- fop.jar,
- google-api-translate-java-0.92.jar,
- hibernate-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-commons-annotations-3.4.0-SNAPSHOT.jar,
- hibernate-core-3.4.0-SNAPSHOT.jar,
- hibernate-envers-3.4.0-SNAPSHOT.jar,
- hibernate-search-3.1.0.GA.jar,
- hibernate-tools-3.2.0.ga.jar,
- hibernate-validator-4.0.0.CR1.jar,
- hsqldb.jar,
- httpclient-4.0.1.jar,
- httpcore-4.0.1.jar,
- javassist.jar,
- jaxb-api-2.1.6.jar,
- jaxb-impl-2.1.6.jar,
- jaxen-1.1.2.jar,
- jdbc-1.2.jar,
- jdbc2_0-stdext.jar,
- jdom.jar,
- joda-time-1.5.jar,
- joda-time-hibernate-1.0.jar,
- json-lib-2.2.3-jdk15.jar,
- jsr250-api-1.0.jar,
- jta.jar,
- jtds-1.2.2.jar,
- junit-4.4.jar,
- junit-4.8.1-sources.jar,
- junit-4.8.1.jar,
- log4j-1.2.14.jar,
- lsid-client-1.1.2.jar,
- lsid-server-1.1.2.jar,
- lucene-core-2.4.0.jar,
- lucene-spellchecker-2.4.0.jar,
- mail-1.4.jar,
- msbase-2000.3.jar,
- mssqlserver-2000.3.jar,
- msutil-2000.3.jar,
- mysql-connector-java-5.0.5.jar,
- odfdom-0.8.jar,
- opencsv-1.8.jar,
- org.springframework.aop-3.0.4.RELEASE-sources.jar,
- org.springframework.asm-3.0.4.RELEASE-sources.jar,
- org.springframework.aspects-3.0.4.RELEASE-sources.jar,
- org.springframework.beans-3.0.4.RELEASE-sources.jar,
- org.springframework.context-3.0.4.RELEASE-sources.jar,
- org.springframework.context.support-3.0.4.RELEASE-sources.jar,
- org.springframework.core-3.0.4.RELEASE-sources.jar,
- org.springframework.expression-3.0.4.RELEASE-sources.jar,
- org.springframework.jdbc-3.0.4.RELEASE-sources.jar,
- org.springframework.orm-3.0.4.RELEASE-sources.jar,
- org.springframework.oxm-3.0.4.RELEASE-sources.jar,
- org.springframework.transaction-3.0.4.RELEASE-sources.jar,
- org.springframework.web-3.0.4.RELEASE-sources.jar,
- org.springframework.web.servlet-3.0.4.RELEASE-sources.jar,
- poi-3.1-FINAL.jar,
- postgresql-8.2-504.jdbc4.jar,
- saxon9he.jar,
- serializer-2.7.0.jar,
- servlet-api-2.5.jar,
- spring-modules-cache-0.7.jar,
- spring-modules-lucene-0.8a.jar,
- wsdl4j-1.6.1.jar,
- xalan-2.7.0.jar,
- xercesImpl-2.7.1.jar,
- xercesImpl.jar,
- xml-apis-1.3.04.jar,
- xml-apis-ext-1.3.04.jar,
- xml-apis.jar,
- xml-resolver-1.2.jar,
- xmlgraphics-commons-1.3.1.jar,
- xom-1.0.jar,
- xsltc.jar,
- xstream-1.3.1.jar,
- yjp-controller-api-redist-8.0.1.jar,
- ant-antlr.jar,
- ant-apache-bcel.jar,
- ant-apache-bsf.jar,
- ant-apache-log4j.jar,
- ant-apache-oro.jar,
- ant-apache-regexp.jar,
- ant-apache-resolver.jar,
- ant-commons-logging.jar,
- ant-commons-net.jar,
- ant-jai.jar,
- ant-javamail.jar,
- ant-jdepend.jar,
- ant-jmf.jar,
- ant-jsch.jar,
- ant-junit.jar,
- ant-launcher.jar,
- ant-netrexx.jar,
- ant-nodeps.jar,
- ant-starteam.jar,
- ant-stylebook.jar,
- ant-swing.jar,
- ant-trax.jar,
- ant-weblogic.jar,
- ant.jar,
- runtime_registry_compatibility.jar,
- jdi.jar,
- jdimodel.jar,
- pdebuild.jar,
- compatibility.jar,
- junit.jar
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/main/java"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/java"/>\r
- <classpathentry kind="src" path="src/main/resources"/>\r
- <classpathentry including="**/*.java" kind="src" path="src/test/resources"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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 including="**/*.java" kind="src" path="src/main/java"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: DataStore Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 3.8.0.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
eu.etaxonomy.taxeditor.dnd.transfer,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.editor.definedterm,
+ eu.etaxonomy.taxeditor.editor.definedterm.input,
eu.etaxonomy.taxeditor.featuretree,
eu.etaxonomy.taxeditor.handler,
+ eu.etaxonomy.taxeditor.handler.defaultHandler,
eu.etaxonomy.taxeditor.io,
eu.etaxonomy.taxeditor.io.wizard,
eu.etaxonomy.taxeditor.labels,
eu.etaxonomy.taxeditor.ui.dialog.selection,
eu.etaxonomy.taxeditor.ui.element,
eu.etaxonomy.taxeditor.ui.group.grantedauthority,
+ eu.etaxonomy.taxeditor.ui.mvc.combo,
eu.etaxonomy.taxeditor.ui.section,
eu.etaxonomy.taxeditor.ui.section.agent,
eu.etaxonomy.taxeditor.ui.section.classification,
eu.etaxonomy.taxeditor.ui.section.supplemental,
eu.etaxonomy.taxeditor.ui.section.taxon,
eu.etaxonomy.taxeditor.ui.selection,
+ eu.etaxonomy.taxeditor.util,
eu.etaxonomy.taxeditor.view,
eu.etaxonomy.taxeditor.view.datasource,
eu.etaxonomy.taxeditor.view.datasource.handler,
eu.etaxonomy.taxeditor.view.derivateSearch,
eu.etaxonomy.taxeditor.view.detail,
eu.etaxonomy.taxeditor.view.specimenSearch,
- eu.etaxonomy.taxeditor.view.supplementaldata
+ eu.etaxonomy.taxeditor.view.supplementaldata,
+ org.eclipse.wb.swt
Require-Bundle: org.eclipse.osgi,
org.eclipse.ui,
org.eclipse.jface.text,
org.eclipse.core.databinding.observable,
org.eclipse.core.databinding.property,
org.eclipse.jface.databinding
-Import-Package: org.eclipse.core.commands,
+Import-Package: eu.etaxonomy.taxeditor.webapp,
+ org.eclipse.core.commands,
org.eclipse.core.commands.operations,
org.eclipse.core.expressions,
org.eclipse.core.runtime,
org.eclipse.ui.editors.text,
org.eclipse.ui.forms.widgets,
org.eclipse.ui.ide.undo,
- org.osgi.framework
+ org.osgi.framework,
+ org.osgi.service.prefs;version="1.1.1"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ClassPath: .,
- activation-1.1.1.jar,
- antlr-2.7.7.jar,
- aopalliance-1.0.jar,
- aspectjrt-1.7.1.jar,
- aspectjweaver-1.7.1.jar,
- avro-1.6.3.jar,
- batik-anim-1.7.jar,
- batik-awt-util-1.7.jar,
- batik-bridge-1.7.jar,
- batik-css-1.7.jar,
- batik-dom-1.7.jar,
- batik-ext-1.7.jar,
- batik-extension-1.7.jar,
- batik-gvt-1.7.jar,
- batik-js-1.7.jar,
- batik-parser-1.7.jar,
- batik-script-1.7.jar,
- batik-svg-dom-1.7.jar,
- batik-svggen-1.7.jar,
- batik-transcoder-1.7.jar,
- batik-util-1.7.jar,
- batik-xml-1.7.jar,
- c3p0-0.9.2.jar,
- cdmlib-commons-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-commons-3.3.1-SNAPSHOT.jar,
- cdmlib-ext-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-ext-3.3.1-SNAPSHOT.jar,
- cdmlib-io-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-io-3.3.1-SNAPSHOT.jar,
- cdmlib-model-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-model-3.3.1-SNAPSHOT.jar,
- cdmlib-persistence-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-persistence-3.3.1-SNAPSHOT.jar,
- cdmlib-print-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-print-3.3.1-SNAPSHOT.jar,
- cdmlib-remote-3.3.1-SNAPSHOT-sources.jar,
- cdmlib-remote-3.3.1-SNAPSHOT.jar,
- cdmlib-services-3.3.1-SNAPSHOT-sources.jar,
- cglib-nodep-2.2.2.jar,
- commons-codec-20041127.091804.jar,
- concurrent-1.3.4.jar,
- dbunit-2.4.9.jar,
- dom4j-1.6.1.jar,
- doxia-core-1.3.jar,
- doxia-logging-api-1.3.jar,
- doxia-module-apt-1.3.jar,
- doxia-module-xhtml-1.3.jar,
- doxia-sink-api-1.3.jar,
- dozer-5.3.0.jar,
- easymockclassextension-2.3.jar,
- ehcache-core-2.4.3.jar,
- ezmorph-1.0.6.jar,
- fop-1.1.jar,
- google-api-translate-java-0.92.jar,
- guava-r05.jar,
- hamcrest-core-1.3.jar,
- hibernate-c3p0-4.1.10.Final.jar,
- hibernate-cglib-repack-2.1_3.jar,
- hibernate-commons-annotations-4.0.1.Final.jar,
- hibernate-core-4.1.10.Final.jar,
- hibernate-ehcache-4.1.10.Final.jar,
- hibernate-entitymanager-4.1.10.Final.jar,
- hibernate-envers-4.1.10.Final.jar,
- hibernate-jpa-2.0-api-1.0.1.Final.jar,
- hibernate-search-4.2.0.Final.jar,
- hibernate-search-analyzers-4.2.0.Final.jar,
- hibernate-search-engine-4.2.0.Final.jar,
- hibernate-search-orm-4.2.0.Final.jar,
- hsqldb-1.8.0.10.jar,
- httpclient-4.2.3.jar,
- httpcore-4.2.4.jar,
- icu4j-2.6.1.jar,
- identificationKeyAPI-1.0-SNAPSHOT-sources.jar,
- identificationKeyAPI-1.0-SNAPSHOT.jar,
- jakarta-regexp-1.4.jar,
- jaxb-api-2.2.7.jar,
- jaxb-impl-2.2-EA.jar,
- jaxb-xjc-2.2-EA.jar,
- jaxb1-impl-2.2-EA.jar,
- jaxen-1.1.4.jar,
- jboss-transaction-api_1.1_spec-1.0.0.Final.jar,
- jdbc4-2.0.jar,
- jdom-1.1.3.jar,
- json-lib-2.4-jdk15.jar,
- jsr250-api-1.0.jar,
- jtds-1.3.0.jar,
- junit-4.11.jar,
- junit-benchmarks-0.5.0.jar,
- lsid-client-1.1.2.jar,
- lsid-server-1.1.2.jar,
- lucene-analyzers-3.6.2.jar,
- lucene-core-3.6.2.jar,
- lucene-facet-3.6.2.jar,
- lucene-grouping-3.6.2.jar,
- lucene-highlighter-3.6.2.jar,
- lucene-kuromoji-3.6.2.jar,
- lucene-memory-3.6.2.jar,
- lucene-misc-3.6.2.jar,
- lucene-phonetic-3.6.2.jar,
- lucene-queries-3.6.2.jar,
- lucene-smartcn-3.6.2.jar,
- lucene-spatial-3.6.2.jar,
- lucene-spellchecker-3.6.2.jar,
- lucene-stempel-3.6.2.jar,
- mchange-commons-java-0.2.3.3.jar,
- odfdom-0.8.jar,
- odfdom-java-0.8.7.jar,
- ognl-2.6.9.jar,
- opencsv-2.3.jar,
- p6spy-1.3.jar,
- paranamer-2.3.jar,
- plexus-classworlds-1.2-alpha-9.jar,
- plexus-container-default-1.0-alpha-30.jar,
- plexus-utils-2.0.5.jar,
- poi-3.9.jar,
- postgresql-9.1-901.jdbc4.jar,
- servlet-api-2.5.jar,
- solr-analysis-extras-3.6.2.jar,
- solr-core-3.6.2.jar,
- solr-solrj-3.6.2.jar,
- spring-aop-3.2.2.RELEASE.jar,
- spring-beans-3.2.2.RELEASE.jar,
- spring-context-3.2.2.RELEASE.jar,
- spring-context-support-3.2.2.RELEASE.jar,
- spring-core-3.2.2.RELEASE.jar,
- spring-expression-3.2.2.RELEASE.jar,
- spring-modules-cache-0.7.jar,
- stax-1.2.0.jar,
- stax-api-1.0.1.jar,
- unitils-core-3.3.jar,
- unitils-database-3.3.jar,
- unitils-dbmaintainer-3.3.jar,
- unitils-dbunit-3.3.jar,
- unitils-easymock-3.3.jar,
- unitils-inject-3.3.jar,
- unitils-mock-3.3.jar,
- unitils-orm-3.3.jar,
- unitils-spring-3.3.jar,
- usertype.jodatime-2.0.1.jar,
- usertype.spi-2.0.1.jar,
- validation-api-1.0.0.GA.jar,
- wsdl4j-1.6.2.jar,
- xalan-2.6.0.jar,
- xercesImpl-2.11.0.jar,
- xml-apis-1.0.b2.jar,
- xml-apis-ext-1.3.04.jar,
- xml-resolver-1.2.jar,
- xmlParserAPIs-2.6.2.jar,
- xmlgraphics-commons-1.5.jar,
- xmlpull-1.1.3.1.jar,
- xmlunit-1.4.jar,
- xom-1.0.jar,
- xpp3-1.1.4c.jar,
- xpp3_min-1.1.4c.jar,
- xstream-1.4.4.jar,
- yjp-controller-api-redist-9.0.8.jar
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Localization: OSGI-INF/l10n/bundle
extension.name.0 = Popup Menu Commands\r
command.name.8 = Clone Datasource\r
command.name.9 = Open Feature Tree Editor Wizard\r
-command.name.10 = Open Password Wizzard\r
+command.name.10 = Open Password Wizard\r
command.name.11 = Open Distribution Editor Wizard\r
command.name.12 = Connect\r
wizard.name.18 = CSV\r
activity.name.2 = UserManagement\r
activity.description.3 = ROLE_PROJECT_MANAGER dependent ui contributions\r
activity.name.3 = ProjectManagement\r
-extension-point.name = Cdm Viewer\r
Bundle-Vendor = EDIT\r
Bundle-Name = DataStore Bundle\r
command.name.13 = delete\r
command.name.14 = delete\r
-page.name.32 = TaxonNavigator\r
+page.name.32 = Taxon Navigator\r
page.name.33 = Sort of Taxonnodes\r
-command.name.15 = Open
\ No newline at end of file
+page.name.34 = Debug Preferences\r
+command.name.15 = Open\r
+view.name.SESSIONS = Sessions\r
+command.label.SESSION = Sessions\r
+command.label.CONNECT = Connect\r
+command.label.RE_CONNECT = Re-Connect\r
+command.name.CONNECT = Connect\r
+command.name.RE_CONNECT = Re-Connect\r
+command.name.OPEN_CLASSIFICATION_WIZARD = Open Classification Wizard\r
+command.name.OPEN_TAXONNODE_WIZARD = Open Taxon Node Wizard
\ No newline at end of file
page.name.28 = Checklisten Editor
page.name.29 = Editor Profil
page.name.30 = Sprache
-page.name.32 = TaxonNavigator
+page.name.32 = Taxon Navigator
page.name.33 = Sortierung im TaxonNavigator
+page.name.34 = Debug Einstellungen
command.label.clone = Klonen
-command.label.openInSpecimenEditor = \u00d6ffnen im Specimen-Editor
\ No newline at end of file
+command.label.openInSpecimenEditor = \u00d6ffnen im Specimen-Editor
+page.name.31 = Taxon-Node-Reihenfolge
+extension.name.0 = Popup Menu Befehle
+command.name.8 = Datenquelle klonen
+command.name.9 = \u00d6ffne Feature Tree-Wizard
+command.name.10 = \u00d6ffne Passwort-Wizard
+command.name.11 = \u00d6ffne Verbreitungs-Wizard
+command.name.12 = Verbinden
+wizard.name.18 = CSV
+wizard.name.19 = CSV_NAME
+wizard.name.20 = CSV_PRINT
+command.name.13 = L\u00f6schen
+command.name.14 = L\u00f6schen
+page.name.32 = Taxon Navigator
+page.name.33 = Reihenfolge der Taxon-Nodes
+command.name.15 = \u00d6ffnen
+view.name.SESSIONS = Sessions
+command.label.SESSION = Sessions
+command.label.CONNECT = Verbinden
+command.label.RE_CONNECT = Aktualisiere Verbindung
+command.name.CONNECT = Verbinden
+command.name.RE_CONNECT = Aktualisiere Verbindung
+command.name.OPEN_CLASSIFICATION_WIZARD = \u00d6ffne Klassifikations-Wizardcommand.name.OPEN_TAXONNODE_WIZARD = \u00d6ffne Taxon Node-Wizard
\ No newline at end of file
LanguageEditorPreferencePage_RestartRequired=After changing the default language, a restart is required,\nin order for the new settings to take effect.\r
OrderPreferencePage_NewNavigatorWindowRequired=After changing the order of the taxon nodes, closing and reopen of the taxon navigator is required.\r
OrderPreferencePage_PleaseReopenNavigator=Please close and reopen the taxon navigator.\r
-UriWithLabelElement_URL_NOT_SAVED=URL won't be saved\! \r
-UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Could not open external browser. URL is invalid.\r
-UriWithLabelElement_INVALID_URL=Invalid URL\r
+UriWithLabelElement_URL_NOT_SAVED=URI won't be saved\! \r
+UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Could not open external browser. URI is invalid.\r
+UriWithLabelElement_INVALID_URL=Invalid URI\r
UriWithLabelElement_OPEN_EXTERNAL_BROWSER=Open in external browser\r
+\r
+ChangeConnectionHandler_ALREADY_CONNECTING=Already connecting\r
+ChangeConnectionHandler_CONFIRM_DATASOURCE=Confirm Datasource Connection\r
+ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY=You are currently connecting to a different datasource already.\r
+ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE=Chosen datasource is not available\r
+ChangeConnectionHandler_REALLY_WANT_TO_CONNECT=Do you really want to connect to this datasource?\n\n\r
+ChangeConnectionHandler_NOT_AVAILABLE_REASONS=This could mean that either the database server is not running or the machine is not reachable.\n\n Please also make sure that you are connected to the network when trying to connect to a remote datasource.\r
+\r
+LoginDialog_CANCEL_MESSAGE=Aborting the login procedure will close the database.\r
+LoginDialog_LOGIN=Login\r
+LoginDialog_PASSWORD=Password\r
+LoginDialog_REALLY_CANCEL=Do you really want to cancel?\r
+LoginDialog_USER_LOGIN=User Login\r
+LoginDialog_USER_NAME=Username\r
+\r
+CdmViewerContextMenu_OPEN=Open (%s)\r
+CdmViewerContextMenu_OPEN_IN=Open in...\r
LanguageEditorPreferencePage_PleaseRestart=Bitte neu starten
LanguageEditorPreferencePage_RestartRequired=Nach dem Wechsel der Standardsprache ist ein Neustart erforderlich.
OrderPreferencePage_NewNavigatorWindowRequired=Nach dem Ändern der Taxon Sortierung, ist das Schließen und erneute Öffnen des taxon Navigators erforderlich.
-UriWithLabelElement_URL_NOT_SAVED=URL wird nicht gespeichert\!
-UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Externer Browser konnt nicht geöffnet werden. URL is ung\u00FCtlig.
-UriWithLabelElement_INVALID_URL=Ung\u00FCltiger URL
-UriWithLabelElement_OPEN_EXTERNAL_BROWSER=Im Browser öffnen
\ No newline at end of file
+UriWithLabelElement_URL_NOT_SAVED=URI wird nicht gespeichert\!
+UriWithLabelElement_COULD_NOT_OPEN_BROWSER=Externer Browser konnte nicht geöffnet werden. URI ist ung\u00FCtlig.
+UriWithLabelElement_INVALID_URL=Ung\u00FCltige URI
+UriWithLabelElement_OPEN_EXTERNAL_BROWSER=Im Browser öffnen
+
+ChangeConnectionHandler_ALREADY_CONNECTING=Verbindung wird aufgebaut
+ChangeConnectionHandler_CONFIRM_DATASOURCE=Verbindung bestätigen
+ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY=Es wird schon eine Verbindung zu einer Datenquelle aufgebaut
+ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE=Gewählte Datenquelle nicht verfügbar
+ChangeConnectionHandler_REALLY_WANT_TO_CONNECT=Wollen Sie sich wirklich mit dieser Datenquelle verbinden?\n\n
+ChangeConnectionHandler_NOT_AVAILABLE_REASONS=Eventuell ist der Server nicht verfügbar oder erreichbar.\n\nStellen Sie bitte auch sicher, dass sie Netzzugang haben, wenn sie sich zu einer Remote-Datenquelle verbinden.
+
+LoginDialog_CANCEL_MESSAGE=Ein Abbruch wird die Verbindung zur Datenquelle schließen.
+LoginDialog_LOGIN=Login
+LoginDialog_PASSWORD=Passwort
+LoginDialog_REALLY_CANCEL=Wollen Sie wirklich abbrechen?
+LoginDialog_USER_LOGIN=Benutzer Login
+LoginDialog_USER_NAME=Benutzername
+
+CdmViewerContextMenu_OPEN=\u00d6ffnen (%s)
+CdmViewerContextMenu_OPEN_IN=\u00d6ffnen in...
+
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension-point id="eu.etaxonomy.taxeditor.store.cdmViewer" name="%extension-point.name" schema="schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd"/>
+ <extension-point id="eu.etaxonomy.taxeditor.store.cdmViewer" name="Cdm Viewer" schema="schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
<page
id="eu.etaxonomy.taxeditor.preferences.nomenclatural"
name="%page.name.4">
</page>
+
<!--page
class="eu.etaxonomy.taxeditor.store.preference.CdmPreferences"
id="eu.etaxonomy.taxeditor.preferences.cdm"
id="eu.etaxonomy.taxeditor.preference.TaxonNavigator"
name="%page.name.32">
</page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.DebugPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.debug"
+ name="%page.name.34">
+ </page>
</extension>
<extension
point="org.eclipse.ui.views">
restorable="true">
</view>
<view
- class="eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView"
- icon="icons/derivate_search_view-16x16-32.png"
- id="eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView"
- name="%view.name.6"
- restorable="true">
+ allowMultiple="false"
+ class="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"
+ id="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"
+ name="%view.name.SESSIONS"
+ restorable="false">
</view>
</extension>
<extension
label="%menu.label">
<command
commandId="org.eclipse.ui.views.showView"
- label="%command.label"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView">
- </parameter>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.store.showViewMenu.details"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.views.showView"
+ id="eu.etaxonomy.taxeditor.store.showViewMenu.details"
label="%command.label.0"
style="push">
<parameter
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.view.detail">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<command
commandId="org.eclipse.ui.views.showView"
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.view.supplementalData">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
</command>
<!-- Originally used by validation framework, currently not in use -->
<!-- <command
name="org.eclipse.ui.views.showView.viewId"
value="eu.etaxonomy.taxeditor.reporting.viewPart">
</parameter>
+ <visibleWhen
+ checkEnabled="true">
+ <and>
+ <reference
+ definitionId="isShowExperimentalFeatures">
+ </reference>
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.ui.views.showView"
+ label="%command.label.SESSION"
+ style="push">
+ <parameter
+ name="org.eclipse.ui.views.showView.viewId"
+ value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart">
+ </parameter>
<visibleWhen
checkEnabled="true">
<reference
- definitionId="isShowExperimentalFeatures">
+ definitionId="isCdmStoreConnected">
</reference>
</visibleWhen>
</command>
</menu>
</menuContribution>
- <menuContribution
- class="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermMenuFactory"
- locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">
+ <dynamic
+ class="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermMenu"
+ id="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermMenu">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </visibleWhen>
+ </dynamic>
</menuContribution>
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu.file?after=eu.etaxonomy.taxeditor.application.filemenu.io">
+ <command
+ commandId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"
+ label="%command.label.CONNECT"
+ style="push">
+ </command>
<command
commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
label="%command.label.5"
style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isUserLoggedIn">
+ </reference>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.store.operations.reconnect"
+ label="%command.label.RE_CONNECT"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <reference
+ definitionId="isUserLoggedIn">
+ </reference>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.taxeditor.application.filemenu.login"
</visibleWhen>
</command>
</menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
- label="%command.label.openInSpecimenEditor"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="selection">
- <count
- value="+">
- </count>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
</activeWhen>
</handler>
<handler
- class="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
- commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow">
- <enabledWhen>
- <reference
- definitionId="isUserLoggedIn">
- </reference></enabledWhen>
+ class="eu.etaxonomy.taxeditor.handler.ShowRemotingLoginWindowHandler"
+ commandId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow">
</handler>
<handler
class="eu.etaxonomy.taxeditor.handler.OpenPasswordWizzardHandler"
</reference>
</activeWhen>
</handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.handler.SwitchUserHandler"
+ commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow">
+ <activeWhen>
+ <reference
+ definitionId="isRemoting">
+ </reference>
+ </activeWhen>
+ </handler>
</extension>
<extension
name="%extension.name.0"
name="%command.name.3">
</command>
<command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
id="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
name="%command.name.4">
</command>
+ <command
+ id="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"
+ name="%command.name.CONNECT">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.ReconnectHandler"
+ id="eu.etaxonomy.taxeditor.store.operations.reconnect"
+ name="%command.name.RE_CONNECT">
+ </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.OpenDefinedTermEditorHandler"
id="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
id="eu.etaxonomy.taxeditor.editor.definedTerms.delete"
name="%command.name.14">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.OpenInspectSessionsHandler"
+ id="eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog"
+ name="Inspect Active Session">
+ </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.handler.OpenHandler"
id="eu.etaxonomy.taxeditor.store.open"
name="%command.name.15">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenClassificationWizardHandler"
+ id="eu.etaxonomy.taxeditor.command.openClassificationWizard"
+ name="%command.name.OPEN_CLASSIFICATION_WIZARD">
+ <commandParameter
+ id="eu.etaxonomy.taxeditor.command.openClassificationWizard.uuid"
+ name="Classification Uuid"
+ optional="true"
+ typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+ </commandParameter>
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenTaxonNodeWizardHandler"
+ id="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard"
+ name="%command.name.OPEN_TAXONNODE_WIZARD">
+ <commandParameter
+ id="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard.uuid"
+ name="TaxonNode Uuid"
+ optional="true"
+ typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+ </commandParameter>
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <commandParameterType
+ converter="eu.etaxonomy.taxeditor.handler.UuidsParameterTypeConverter"
+ id="eu.etaxonomy.taxeditor.uuidParameterType"
+ type="java.util.UUID">
+ </commandParameterType>
+ <commandParameterType
+ converter="eu.etaxonomy.taxeditor.handler.UuidsParameterTypeConverter"
+ id="eu.etaxonomy.taxeditor.uuidsParameterType"
+ type="java.util.List">
+ </commandParameterType>
</extension>
<extension
point="org.eclipse.ui.importWizards">
</variable>
</sourceProvider>
</extension>
+<extension
+ point="eu.etaxonomy.taxeditor.store.cdmViewer">
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.command.openClassificationWizard"
+ selection="eu.etaxonomy.cdm.model.taxon.Classification"
+ viewerName="Classification Wizard">
+ </viewCommandMapping>
+ <viewCommandMapping
+ commandId="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard"
+ selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
+ viewerName="TaxonNode Wizard">
+ </viewCommandMapping>
+</extension>
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
</annotation>
<complexType>
<sequence>
- <element ref="cdmViewer" minOccurs="1" maxOccurs="unbounded"/>
+ <element ref="viewCommandMapping" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
</complexType>
</element>
- <element name="cdmViewer">
+ <element name="viewCommandMapping">
<annotation>
<documentation>
- A Cdm Viewer knows what viewer or editor can show which input.
+ Maps a viewing class, like editors or views, to a command which opens it.
</documentation>
</annotation>
<complexType>
- <sequence>
- </sequence>
- <attribute name="class" type="string" use="required">
+ <attribute name="commandId" type="string" use="required">
<annotation>
<documentation>
- The class of the viewer.
+ The command which opens the viewer to show the selected object
</documentation>
<appInfo>
- <meta.attribute kind="java" basedOn=":eu.etaxonomy.taxeditor.view.ICdmViewer"/>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="viewerName" type="string">
+ <annotation>
+ <documentation>
+ The name of the viewer which shows the selected element
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="selection" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the selected element
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
public static String LanguageEditorPreferencePage_EditorHasToRestart;
public static String LanguageEditorPreferencePage_PleaseRestart;
public static String LanguageEditorPreferencePage_RestartRequired;
+ public static String LoginDialog_CANCEL_MESSAGE;
+ public static String LoginDialog_LOGIN;
+ public static String LoginDialog_PASSWORD;
+ public static String LoginDialog_REALLY_CANCEL;
+ public static String LoginDialog_USER_LOGIN;
+ public static String LoginDialog_USER_NAME;
public static String OrderPreferencePage_NewNavigatorWindowRequired;
public static String OrderPreferencePage_PleaseReopenNavigator;
public static String CdmDataSourceViewPart_1;
public static String CdmDataSourceViewPart_7;
public static String CdmDataSourceViewPart_8;
public static String CdmDataSourceViewPart_9;
+ public static String CdmViewerContextMenu_OPEN;
+ public static String CdmViewerContextMenu_OPEN_IN;
+ public static String ChangeConnectionHandler_ALREADY_CONNECTING;
+ public static String ChangeConnectionHandler_CONFIRM_DATASOURCE;
+ public static String ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY;
+ public static String ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE;
+ public static String ChangeConnectionHandler_REALLY_WANT_TO_CONNECT;
+ public static String ChangeConnectionHandler_NOT_AVAILABLE_REASONS;
public static String UriWithLabelElement_COULD_NOT_OPEN_BROWSER;
public static String UriWithLabelElement_INVALID_URL;
public static String UriWithLabelElement_OPEN_EXTERNAL_BROWSER;
import eu.etaxonomy.cdm.database.DataSourceNotFoundException;
import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-import eu.etaxonomy.cdm.remote.CdmPersistentRemoteSource;
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
+
import eu.etaxonomy.taxeditor.model.MementoHelper;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.remoting.source.CdmPersistentRemoteSource;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
public class CdmDataSourceRepository{
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.editor;
+
+import java.util.List;
+import java.util.Map;
+
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 5 Feb 2015
+ *
+ */
+public abstract class CdmEntitySessionInput implements ICdmEntitySessionEnabled {
+
+ private ICdmEntitySession cdmEntitySession;
+
+ public CdmEntitySessionInput(boolean init) {
+ if(init) {
+ initSession();
+ }
+ }
+
+ protected void initSession() {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ public void bind() {
+ cdmEntitySession.bind();
+ }
+
+ public void dispose() {
+ cdmEntitySession.dispose();
+ }
+
+ public abstract void merge();
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\r
TermBase target = (TermBase) getCurrentTarget();//can be vocab\r
int currentLocation = getCurrentLocation();\r
- System.out.println("current location : " + currentLocation + " , target : " + target.getTitleCache());\r
//DefinedTermBase[] droppedElements = (DefinedTermBase[]) data;\r
Object[] droppedTerms = (Object[]) data;\r
Collection<DefinedTermBase> sourceTerms = new ArrayList<DefinedTermBase>(); //Arrays.asList(droppedElements)\r
private boolean dirty;\r
\r
\r
-\r
private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;\r
/**\r
*\r
@Override\r
public void doSave(IProgressMonitor monitor) {\r
getConversationHolder().commit();\r
+ getDefinedTermEditorInput().merge();\r
setDirty(false);\r
getDefinedTermEditorInput().initialiseVocabularies();\r
+ viewer.refresh();\r
}\r
\r
\r
public void setFocus() {\r
viewer.getControl().setFocus();\r
getConversationHolder().bind();\r
+ getDefinedTermEditorInput().bind();\r
}\r
\r
@Override\r
OrderedTermBase otbe2 = (OrderedTermBase)e2;\r
if(otbe1.getOrderIndex() == otbe2.getOrderIndex()) {\r
return 0;\r
- } else if(otbe1.isHigher(otbe2)) {\r
- return 1;\r
- } else {\r
- return -1;\r
+ } else if (otbe1.getOrderIndex() < otbe2.getOrderIndex()){\r
+ return -1;\r
+ } else{\r
+ return 1;\r
}\r
} else {\r
return super.compare(viewer, e1, e2);\r
}\r
}\r
\r
-\r
+ @Override\r
+ public void dispose() {\r
+ getDefinedTermEditorInput().dispose();\r
+ super.dispose();\r
+ }\r
}
\ No newline at end of file
// $Id$
/**
* Copyright (C) 2009 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.editor.definedterm;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.EnumSet;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.SWT;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.menus.CommandContributionItem;
import org.eclipse.ui.menus.CommandContributionItemParameter;
-import org.eclipse.ui.menus.ExtensionContributionFactory;
-import org.eclipse.ui.menus.IContributionRoot;
-import org.eclipse.ui.services.IServiceLocator;
import eu.etaxonomy.cdm.model.common.TermType;
/**
- * Menu factory used in the store plugin xml to dynamically generate menu (sub-menu) contribution items
+ * Menu used in the store plugin xml to dynamically generate menu (sub-menu) contribution items
* for term types which when clicked open the defined term editor for the chosen term type
- *
- * @author c.mathew
- * @date 18 Jul 2013
+ *
+ * @author pplitzner
+ * @date 21 Jul 2015
*
*/
-public class DefinedTermMenuFactory extends ExtensionContributionFactory {
-
- @Override
- public void createContributionItems(IServiceLocator serviceLocator,
- IContributionRoot additions) {
-
- MenuManager dtMenuManager =
- new MenuManager("Term Editor","eu.etaxonomy.taxeditor.store.definedTermEditorMenu");
-
- dtMenuManager.setVisible(true);
-
- additions.addContributionItem(dtMenuManager, null);
- List<TermType> ttList = new ArrayList<TermType>(EnumSet.allOf(TermType.class));
- Collections.sort(ttList,new SortByTermTypeMessage());
- for (TermType tt : ttList)
- {
- // if term type has a parent, do not add it
- // it will be added in the recursive call
- if(tt.getKindOf() == null) {
- IContributionItem ici = addChildTermsToMenuManager(tt, serviceLocator);
- if(ici != null) {
- dtMenuManager.add(ici);
- }
- }
- }
+public class DefinedTermMenu extends CompoundContributionItem {
+
+
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ Collection<IContributionItem> items = new ArrayList<IContributionItem>();
+ MenuManager dtMenuManager =
+ new MenuManager("Term Editor","eu.etaxonomy.taxeditor.store.definedTermEditorMenu");
+
+ dtMenuManager.setVisible(true);
+
+ items.add(dtMenuManager);
+ List<TermType> ttList = new ArrayList<TermType>(EnumSet.allOf(TermType.class));
+ Collections.sort(ttList,new SortByTermTypeMessage());
+ for (TermType tt : ttList)
+ {
+ // if term type has a parent, do not add it
+ // it will be added in the recursive call
+ if(tt.getKindOf() == null) {
+ IContributionItem ici = addChildTermsToMenuManager(tt);
+ if(ici != null) {
+ dtMenuManager.add(ici);
+ }
+ }
+ }
+ return items.toArray(new IContributionItem[]{});
}
-
- private IContributionItem addChildTermsToMenuManager(TermType termType, IServiceLocator serviceLocator) {
-
+
+ private IContributionItem addChildTermsToMenuManager(TermType termType) {
+
//FIXME : need a better way to find out if a term type can be editable (ticket 3853)
if(termType.getEmptyDefinedTermBase() != null) {
Set<TermType> children = termType.getGeneralizationOf();
// term type has no children, so create menu item
- if(children.isEmpty()) {
- return createMenuItem(termType, serviceLocator);
+ if(children.isEmpty()) {
+ return createMenuItem(termType);
}
- // term type has children, so create sub menu
- MenuManager dtMenuManager =
- new MenuManager(termType.getMessage(),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu");
+ // term type has children, so create sub menu
+ MenuManager dtMenuManager =
+ new MenuManager(termType.getMessage(),"eu.etaxonomy.taxeditor.store." + termType.getKey() + "Menu");
dtMenuManager.setVisible(true);
- dtMenuManager.add(createDefaultMenuItem(termType, serviceLocator));
+ dtMenuManager.add(createDefaultMenuItem(termType));
Separator sep = new Separator();
dtMenuManager.add(sep);
// add child items to the sub menu
- for(TermType tt : children) {
- IContributionItem item = addChildTermsToMenuManager(tt,serviceLocator);
- if(item != null) {
+ for(TermType tt : children) {
+ IContributionItem item = addChildTermsToMenuManager(tt);
+ if(item != null) {
dtMenuManager.add(item);
- }
- }
+ }
+ }
return dtMenuManager;
} else {
return null;
}
-
+
}
-
- private CommandContributionItem createMenuItem(TermType termType, IServiceLocator serviceLocator) {
-
+
+ private CommandContributionItem createMenuItem(TermType termType) {
+
Map<String, String> params = new HashMap<String, String>();
params.put("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid",
- termType.getUuid().toString());
-
+ termType.getUuid().toString());
+
CommandContributionItemParameter p = new CommandContributionItemParameter(
- serviceLocator,
+ PlatformUI.getWorkbench(),
"",
"eu.etaxonomy.taxeditor.store.openDefinedTermEditor",
params,
null,
termType.getMessage(),
"",
- "",
+ "",
SWT.PUSH,
"",
true);
-
- CommandContributionItem item = new CommandContributionItem(p);
+
+ CommandContributionItem item = new CommandContributionItem(p);
return item;
-
+
}
-
- private CommandContributionItem createDefaultMenuItem(TermType termType, IServiceLocator serviceLocator) {
-
+
+ private CommandContributionItem createDefaultMenuItem(TermType termType) {
+
Map<String, String> params = new HashMap<String, String>();
params.put("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid",
- termType.getUuid().toString());
-
+ termType.getUuid().toString());
+
CommandContributionItemParameter p = new CommandContributionItemParameter(
- serviceLocator,
+ PlatformUI.getWorkbench(),
"",
"eu.etaxonomy.taxeditor.store.openDefinedTermEditor",
params,
null,
"Other " + termType.getMessage() + "s",
"",
- "",
+ "",
SWT.PUSH,
"",
true);
-
-
-
- CommandContributionItem item = new CommandContributionItem(p);
+
+
+
+ CommandContributionItem item = new CommandContributionItem(p);
return item;
-
+
}
-
+
private class SortByTermTypeMessage implements Comparator<TermType> {
- public int compare(TermType t1, TermType t2) {
+ @Override
+ public int compare(TermType t1, TermType t2) {
return t1.getMessage().compareTo(t2.getMessage());
}
}
-
+
}
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.commands.common.NotDefinedException;\r
import org.eclipse.core.commands.operations.IUndoContext;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
+import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.ui.IEditorPart;\r
import org.eclipse.ui.handlers.HandlerUtil;\r
\r
import eu.etaxonomy.cdm.model.common.TermBase;\r
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
import eu.etaxonomy.taxeditor.editor.definedterm.operation.DeleteTermBaseOperation;\r
+import eu.etaxonomy.taxeditor.model.AbstractUtility;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
*/\r
public class DeleteTermBaseHandler extends AbstractHandler {\r
\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
- */\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
- DefinedTermEditor editor = (DefinedTermEditor) HandlerUtil\r
+ IEditorPart editor = HandlerUtil\r
.getActiveEditor(event);\r
\r
+ if (editor.isDirty()){\r
+ boolean proceed = MessageDialog.openQuestion(null,\r
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");\r
+ if (proceed) {\r
+ editor.doSave(null);\r
+ } else {\r
+ return null;\r
+ }\r
+ }\r
if (editor instanceof DefinedTermEditor){\r
- DefinedTermEditor dfe = (DefinedTermEditor) editor;\r
- try {\r
- String label = event.getCommand().getName();\r
- IUndoContext undoContext = StoreUtil.getUndoContext();\r
+ DefinedTermEditor dfe = (DefinedTermEditor) editor;\r
+ try {\r
+ String label = event.getCommand().getName();\r
+ IUndoContext undoContext = StoreUtil.getUndoContext();\r
\r
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil\r
- .getCurrentSelection(event);\r
+ ISelection selection = dfe.getViewer().getSelection();\r
+ if(selection instanceof IStructuredSelection){\r
\r
- Iterator<TermBase> selectionIterator = selection.iterator();\r
+ Iterator<TermBase> selectionIterator = ((IStructuredSelection) selection).iterator();\r
\r
- while (selectionIterator.hasNext()){\r
+ while (selectionIterator.hasNext()){\r
\r
- TermBase term = selectionIterator.next();\r
+ TermBase term = selectionIterator.next();\r
\r
\r
- AbstractPostOperation operation = \r
- new DeleteTermBaseOperation(label, \r
- undoContext,\r
- term,\r
- dfe.getDefinedTermEditorInput(), \r
- editor);\r
- StoreUtil.executeOperation(operation);\r
-\r
- } \r
- } catch (NotDefinedException e) {\r
- MessagingUtils.error(getClass(), e);\r
- }\r
+ AbstractPostOperation operation =\r
+ new DeleteTermBaseOperation(label,\r
+ undoContext,\r
+ term,\r
+ dfe.getDefinedTermEditorInput(),\r
+ dfe);\r
+ AbstractUtility.executeOperation(operation);\r
+ }\r
+ }\r
+ } catch (NotDefinedException e) {\r
+ MessagingUtils.error(getClass(), e);\r
+ }\r
}\r
return null;\r
}\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
- * European Distributed Institute of Taxonomy \r
+ * European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
- * \r
+ *\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import org.eclipse.ui.IPersistableElement;\r
\r
import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;\r
\r
/**\r
* @author l.morris\r
* @date 3 Jan 2012\r
*\r
*/\r
-public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase> implements IEditorInput {\r
+public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase> extends CdmEntitySessionInput implements IEditorInput {\r
\r
/**\r
- * \r
+ *\r
*/\r
public AbstractDefinedTermEditorInput() {\r
- super();\r
+ super(true);\r
}\r
\r
@Override\r
/**\r
* @return\r
*/\r
- public abstract List<String> getTermClasses(); \r
+ public abstract List<String> getTermClasses();\r
+\r
\r
- \r
}
\ No newline at end of file
// $Id$
/**
* Copyright (C) 2009 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.editor.definedterm.input;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.TermStore;
private TermType termType;
private Set<TermVocabulary<DefinedTermBase>> vocabularies;
+
+ // FIXME: the default feature should be move to CdmApplicationState
+ // where it is a singleton instance variable
+ private static FeatureTree defaultFeatureTree = null;
+
private List<String> termClasses = Arrays.asList(new String[]{
DefinedTerm.class.getName()
});
-
+
public TermEditorInput(TermType termType) {
this.termType = termType;
vocabularies = new HashSet<TermVocabulary<DefinedTermBase>>();
public List<String> getTermClasses() {
return termClasses;
}
-
+
public TermType getTermType() {
return termType;
}
-
+
public void initialiseVocabularies() {
if(vocabularies != null) {
vocabularies.clear();
- }
+ }
List<TermVocabulary<DefinedTermBase>> vocs = CdmStore.getService(IVocabularyService.class).findByTermType(termType);
- vocabularies.addAll(vocs);
+ vocabularies.addAll(vocs);
}
-
+
public Set<TermVocabulary<DefinedTermBase>> getVocabularies() {
return vocabularies;
}
+ public void updateDefaultFeatureTree() {
+ for(TermVocabulary vocab : getVocabularies()) {
+ if(vocab != null && TermType.Feature.equals(vocab.getTermType())) {
+ defaultFeatureTree = null;
+ }
+ }
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<TermVocabulary<DefinedTermBase>> getRootEntities() {
+ return getVocabularies();
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void merge() {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IVocabularyService.class).merge(new ArrayList<TermVocabulary>(getRootEntities()), true);
+ updateDefaultFeatureTree();
+ }
+ }
+
+ public static FeatureTree getDefaultFeatureTree() {
+ if(defaultFeatureTree == null) {
+ defaultFeatureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
+ }
+ return defaultFeatureTree;
+ }
}
\ No newline at end of file
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
\r
/**\r
*/\r
public class CreateDefinedTermOperation extends AbstractPostTaxonOperation {\r
\r
- \r
\r
- private TermBase parentTermBase;\r
- private TermEditorInput definedTermInput;\r
+\r
+ private final TermBase parentTermBase;\r
+ private final TermEditorInput definedTermInput;\r
\r
/**\r
* @param label\r
* @param postOperationEnabled\r
*/\r
public CreateDefinedTermOperation(String label,\r
- IUndoContext undoContext, \r
+ IUndoContext undoContext,\r
TermBase termBase,\r
TermEditorInput definedTermInput,\r
IPostOperationEnabled postOperationEnabled) {\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
- \r
+\r
DefinedTermBase newTerm = definedTermInput.getTermType().getEmptyDefinedTermBase();\r
if (newTerm == null) {\r
- IStatus status = \r
- new Status(IStatus.CANCEL, \r
- StoreUtil.getPluginId(), \r
+ IStatus status =\r
+ new Status(IStatus.CANCEL,\r
+ StoreUtil.getPluginId(),\r
"Creation of term corresponding to type '" + definedTermInput.getTermType().getMessage() + "' is not yet supported");\r
MessagingUtils.warningDialog("Cannot create term", newTerm, status);\r
return status;\r
}\r
- \r
+ newTerm = CdmStore.getCurrentApplicationConfiguration().getTermService().save(newTerm);\r
+\r
if (parentTermBase instanceof TermVocabulary){\r
TermVocabulary vocabulary = (TermVocabulary) parentTermBase;\r
vocabulary.addTerm(newTerm);\r
} else if (parentTermBase instanceof DefinedTermBase) {\r
- DefinedTermBase parent = (DefinedTermBase) parentTermBase; \r
- parent.addIncludes(newTerm); \r
+ DefinedTermBase parent = (DefinedTermBase) parentTermBase;\r
+ parent.addIncludes(newTerm);\r
TermVocabulary vocabulary = parent.getVocabulary();\r
vocabulary.addTerm(newTerm);\r
}\r
- \r
+\r
return postExecute(newTerm);\r
}\r
\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
*/\r
public class CreateTermVocabularyOperation extends AbstractPostTaxonOperation {\r
\r
- private TermEditorInput definedEditorInput;\r
- \r
+ private final TermEditorInput definedEditorInput;\r
+\r
/**\r
* @param label\r
* @param undoContext\r
* @param postOperationEnabled\r
*/\r
public CreateTermVocabularyOperation(String label,\r
- IUndoContext undoContext, \r
- TermEditorInput definedEditorInput, \r
+ IUndoContext undoContext,\r
+ TermEditorInput definedEditorInput,\r
IPostOperationEnabled postOperationEnabled) {\r
super(label, undoContext, postOperationEnabled);\r
this.definedEditorInput = definedEditorInput;\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
- \r
- TermVocabulary termVocabulary = \r
+\r
+ TermVocabulary termVocabulary =\r
TermVocabulary.NewInstance(definedEditorInput.getTermType(),\r
- null, \r
- "Untitled", \r
- null, \r
- null); \r
- \r
- CdmStore.getService(IVocabularyService.class).save(termVocabulary);\r
+ null,\r
+ "Untitled",\r
+ null,\r
+ null);\r
+\r
+ termVocabulary = CdmStore.getService(IVocabularyService.class).save(termVocabulary);\r
definedEditorInput.getVocabularies().add(termVocabulary);\r
- \r
+\r
return postExecute(termVocabulary);\r
}\r
\r
// $Id$\r
/**\r
* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import eu.etaxonomy.cdm.api.service.DeleteResult;\r
import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
-import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;\r
-import eu.etaxonomy.cdm.model.common.DefinedTerm;\r
import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
import eu.etaxonomy.cdm.model.common.TermBase;\r
import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
*/\r
public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {\r
\r
- private TermEditorInput definedEditorInput;\r
- private TermBase termBase;\r
+ private final TermEditorInput definedEditorInput;\r
+ private final TermBase termBase;\r
private DefinedTermEditor definedTermEditor;\r
/**\r
* @param label\r
* @param undoContext\r
* @param postOperationEnabled\r
*/\r
- public DeleteTermBaseOperation(String label, \r
- IUndoContext undoContext, \r
+ public DeleteTermBaseOperation(String label,\r
+ IUndoContext undoContext,\r
TermBase termBase,\r
TermEditorInput definedEditorInput,\r
IPostOperationEnabled postOperationEnabled) {\r
super(label, undoContext, postOperationEnabled);\r
this.termBase = termBase;\r
- this.definedEditorInput = definedEditorInput; \r
+ this.definedEditorInput = definedEditorInput;\r
}\r
\r
/* (non-Javadoc)\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
- \r
- \r
- \r
+\r
+\r
+\r
if (termBase instanceof TermVocabulary) {\r
if (((TermVocabulary)termBase).getCreatedBy() == null) {\r
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This is a CDM system vocabulary");\r
MessagingUtils.warningDialog("Cannot delete vocabulary", termBase, status);\r
return status;\r
}\r
- \r
+\r
if (!((TermVocabulary)termBase).getTerms().isEmpty()) {\r
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "Delete all terms from this vocaulary before deleting the vocabulary.");\r
MessagingUtils.warningDialog("Vocabulary not empty", termBase, status);\r
return status;\r
- } \r
+ }\r
\r
- definedEditorInput.getVocabularies().remove((TermVocabulary)termBase); \r
- \r
- DeleteResult result = CdmStore.getService(IVocabularyService.class).delete((TermVocabulary)termBase);\r
+ definedEditorInput.getVocabularies().remove(termBase);\r
+\r
+ DeleteResult result = CdmStore.getService(IVocabularyService.class).delete(termBase.getUuid());\r
if (result.isError()){\r
StringBuffer errorString = new StringBuffer();\r
for (Exception e:result.getExceptions()){\r
}\r
MessageDialog.openError(null, "Delete failed", errorString.toString());\r
}\r
- \r
+\r
} else if (termBase instanceof DefinedTermBase) {\r
- \r
- \r
+\r
+\r
DefinedTermBase definedTermBase = (DefinedTermBase) termBase;\r
- \r
+\r
if (((DefinedTermBase)termBase).getCreatedBy() == null) {\r
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This is a CDM system defined term");\r
MessagingUtils.warningDialog("Cannot delete defined term", termBase, status);\r
return status;\r
}\r
if(!definedTermBase.getIncludes().isEmpty()){\r
- IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This term includes other terms. Please delete the included terms before deleting this term."); \r
+ IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This term includes other terms. Please delete the included terms before deleting this term.");\r
MessagingUtils.warningDialog("Term has included terms", termBase, status);\r
return status;\r
- } \r
- \r
+ }\r
+\r
\r
DefinedTermBase partOf = definedTermBase.getPartOf();\r
if(partOf != null){\r
partOf.removeIncludes(definedTermBase);\r
}\r
- \r
+\r
DefinedTermBase kindOf = definedTermBase.getKindOf();\r
if(kindOf != null){\r
definedTermBase.removeGeneralization(kindOf);\r
}\r
- \r
+\r
TermVocabulary vocabulary = definedTermBase.getVocabulary();\r
if(vocabulary != null){\r
vocabulary.removeTerm(definedTermBase);\r
}\r
- \r
- DeleteResult result = CdmStore.getService(ITermService.class).delete((DefinedTermBase)termBase);\r
- \r
+\r
+ DeleteResult result = CdmStore.getService(ITermService.class).delete(termBase.getUuid());\r
+\r
if (result.isError()){\r
StringBuffer errorString = new StringBuffer();\r
for (Exception e:result.getExceptions()){\r
MessageDialog.openError(null, "Delete failed", errorString.toString());\r
}\r
}\r
- \r
+\r
return postExecute(termBase);\r
}\r
\r
// DefinedTermEditor's ViewerSorter (DefinedTermSorter) class\r
if(currentLocation == ViewerDropAdapter.LOCATION_BEFORE) {\r
otVoc.addTermBelow((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary);\r
+ ((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term);\r
}\r
\r
if(currentLocation == ViewerDropAdapter.LOCATION_AFTER) {\r
otVoc.addTermAbove((OrderedTermBase)term, (OrderedTermBase)targetTermOrVocabulary);\r
+ ((DefinedTermBase) targetTermOrVocabulary).getPartOf().addIncludes(term);\r
}\r
+ if(currentLocation == ViewerDropAdapter.LOCATION_ON) {\r
+ targetDefinedTerm.addIncludes(term);\r
+ targetDefinedTerm.getVocabulary().addTerm(term);\r
+ }\r
}\r
- }\r
- if(currentLocation == ViewerDropAdapter.LOCATION_ON) {\r
- targetDefinedTerm.addIncludes(term);\r
+ } else{\r
+ targetDefinedTerm.addIncludes(term);\r
targetDefinedTerm.getVocabulary().addTerm(term);\r
}\r
+ \r
}\r
\r
}\r
// $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.
*/
* <p>
* EditFeatureTreeWizardPage class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Aug 5, 2010
* @version 1.0
* <p>
* Constructor for EditFeatureTreeWizardPage.
* </p>
- *
+ *
* @param pageName
* a {@link java.lang.String} object.
*/
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
* .Composite)
* <p>
* setSelectedTree
* </p>
- *
+ *
* @param featureTree
* a {@link eu.etaxonomy.cdm.model.description.FeatureTree}
* object.
viewer.setInput(featureTree);
text_title.removeModifyListener(this);
- text_title.setText(featureTree.getTitleCache());
+ if (featureTree != null){
+ text_title.setText(featureTree.getTitleCache());
+ }
text_title.addModifyListener(this);
}
.getAdditionalFeatures();
for (Feature feature : additionalFeatures) {
FeatureNode child = FeatureNode.NewInstance(feature);
- CdmStore.getService(IFeatureNodeService.class)
- .saveOrUpdate(child);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IFeatureNodeService.class).merge(child, true);
+ } else {
+ CdmStore.getService(IFeatureNodeService.class).saveOrUpdate(child);
+ }
parent.addChild(child);
}
viewer.refresh();
*/
@Override
public void dragFinished(DragSourceEvent event) {
- if (!event.doit)
- return;
+ if (!event.doit) {
+ return;
+ }
// if the featureNode was moved, remove it from the source viewer
if (event.detail == DND.DROP_MOVE) {
IStructuredSelection selection = (IStructuredSelection) viewer
// $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.featuretree;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.jface.wizard.Wizard;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @created Aug 5, 2010
* @version 1.0
*/
-public class FeatureTreeEditorWizard extends Wizard {
-
+public class FeatureTreeEditorWizard extends Wizard implements ICdmEntitySessionEnabled {
+
private SelectFeatureTreeWizardPage selectFeatureTreePage;
private EditFeatureTreeWizardPage editFeatureTreePage;
-
+
private FeatureTree selectedFeatureTree;
private ConversationHolder conversation;
-
+ private ICdmEntitySession cdmEntitySession;
+ private ICdmEntitySession previousCdmEntitySession;
+
/**
* <p>Constructor for FeatureTreeEditorWizard.</p>
*/
public FeatureTreeEditorWizard(){
conversation = CdmStore.createConversation();
+ previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
setWindowTitle("Feature Tree Editor");
}
-
+
/**
* <p>addPages</p>
*/
- public void addPages() {
+ @Override
+ public void addPages() {
selectFeatureTreePage = new SelectFeatureTreeWizardPage("SELECT");
addPage(selectFeatureTreePage);
-
+
editFeatureTreePage = new EditFeatureTreeWizardPage("EDIT");
addPage(editFeatureTreePage);
}
public boolean performFinish() {
try{
if (selectedFeatureTree != null){
- CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(selectedFeatureTree);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IFeatureTreeService.class).merge(selectedFeatureTree, true);
+ } else {
+ CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(selectedFeatureTree);
+ }
}
conversation.commit();
}finally{
conversation.close();
+ cdmEntitySession.dispose();
+ if(previousCdmEntitySession != null) {
+ previousCdmEntitySession.bind();
+ }
}
-
+
return true;
}
+ /** {@inheritDoc} */
+ @Override
+ public boolean performCancel() {
+ cdmEntitySession.dispose();
+ if(previousCdmEntitySession != null) {
+ previousCdmEntitySession.bind();
+ }
+ return true;
+ }
+
/**
* <p>Setter for the field <code>selectedFeatureTree</code>.</p>
*
public FeatureTree getSelectedFeatureTree() {
return selectedFeatureTree;
}
-
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<FeatureTree> getRootEntities() {
+ return Arrays.asList(selectedFeatureTree);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
// $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.featuretree;
import java.util.List;
+import java.util.logging.ErrorManager;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ListViewer;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
-import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
* <p>SelectFeatureTreeWizardPage class.</p>
super(pageName);
setMessage("Select a Feature Tree or create a new one.");
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
-
+
composite.setLayout(new GridLayout());
-
+
Composite composite_treeContent = new Composite(composite, SWT.NULL);
composite_treeContent.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
composite_treeContent.setLayout(new GridLayout(2, false));
-
+
viewer = new ListViewer(composite_treeContent);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
+
button_remove = new Button(composite_treeContent, SWT.PUSH);
button_remove.setText("Remove");
button_remove.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
-
+
Composite composite_treeTitle = new Composite(composite, SWT.NULL);
composite_treeTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
false));
composite_treeTitle.setLayout(new GridLayout(3, false));
-
-
+
+
Label label_title = new Label(composite_treeTitle, SWT.NULL);
label_title.setText("New Feature Tree");
text_title = new Text(composite_treeTitle, SWT.NULL);
text_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
+
button_add = new Button(composite_treeTitle, SWT.PUSH);
button_add.setText("Add");
-
+
viewer.setContentProvider(new FeatureTreeContentProvider());
viewer.setLabelProvider(new FeatureTreeLabelProvider());
-
+
viewer.addSelectionChangedListener(this);
-
+
text_title.addModifyListener(this);
button_add.addSelectionListener(new AddButtonSelectionListener());
button_remove.addSelectionListener(new RemoveButtonSelectionListener());
-
+
List<FeatureTree> input = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null);
-
+
viewer.setInput(input);
modifyText(null);
setControl(composite);
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
-
+
if(selection.size() == 1){
FeatureTree selectedFeatureTree = (FeatureTree) selection.getFirstElement();
((FeatureTreeEditorWizard) getWizard()).setSelectedFeatureTree(selectedFeatureTree);
-
+
}
-
+
setPageComplete(true);
-
+
button_remove.setEnabled(selection.size() >= 1);
}
public boolean canFlipToNextPage() {
return ((IStructuredSelection) viewer.getSelection()).size() == 1;
}
-
+
/** {@inheritDoc} */
@Override
public void modifyText(ModifyEvent e) {
button_add.setEnabled(! text_title.getText().isEmpty());
}
-
+
private class AddButtonSelectionListener extends SelectionAdapter {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
FeatureTree featureTree = FeatureTree.NewInstance();
featureTree.setTitleCache(text_title.getText(), true);
-
+
viewer.add(featureTree);
- CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IFeatureTreeService.class).merge(featureTree, true);
+ } else {
+ CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
+ }
text_title.setText("");
viewer.setSelection(new StructuredSelection(featureTree));
-
+
}
}
-
+
private class RemoveButtonSelectionListener extends SelectionAdapter {
- public void widgetSelected(SelectionEvent e) {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ Object source = e.getSource();
for(Object element : selection.toArray()){
viewer.remove(element);
-
- DeleteResult result = CdmStore.getService(IFeatureTreeService.class).delete((FeatureTree) element);
-
+ ((FeatureTreeEditorWizard) getWizard()).setSelectedFeatureTree(null);
+ DeleteResult result = CdmStore.getService(IFeatureTreeService.class).delete(((FeatureTree) element).getUuid());
+
if (result.isError()){
-
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, "The delete of the feature tree was not successful.", null);
}
viewer.setSelection(new StructuredSelection(new Object[0]));
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.handler;
+
+import java.util.Collection;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.swt.SWT;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.sessions.InspectSessionsDialog;
+
+/**
+ * @author cmathew
+ * @date 18 Feb 2015
+ *
+ */
+public class OpenInspectSessionsHandler extends AbstractHandler implements IHandler {
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
+
+ ICdmEntitySession activeSession = CdmStore.getCurrentSessionManager().getActiveSession();
+
+ if(activeSession == null) {
+ MessagingUtils.warningDialog("No Active Session", this, "Active Session is null");
+ } else {
+ Collection<CdmBase> rootEntities = activeSession.getRootEntities();
+ if(rootEntities == null || rootEntities.isEmpty()) {
+ MessagingUtils.warningDialog("No Root Entities", this, "No root entities to inspect");
+ } else {
+ InspectSessionsDialog dialog = new InspectSessionsDialog(AbstractUtility.getShell(), SWT.NONE);
+ dialog.open();
+ }
+
+ }
+
+ return null;
+
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ *
+ * @author c.mathew
+ */
+public class ReconnectHandler extends AbstractHandler implements IHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+ loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), true, true);
+
+ return null;
+
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ *
+ * @author c.mathew
+ */
+public class ShowRemotingLoginWindowHandler extends AbstractHandler implements IHandler{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ loginDialog.open();
+
+
+ return null;
+
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ *
+ * @author c.mathew
+ */
+public class SwitchUserHandler extends AbstractHandler implements IHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+ loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), false, false);
+
+ return null;
+
+ }
+}
+
--- /dev/null
+package eu.etaxonomy.taxeditor.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+
+/**
+ * Converts either a single {@link UUID} or a list of UUIDSs to a string representation
+ * and vica versa.
+ *
+ * @author pplitzner
+ * @date Sep 15, 2015
+ *
+ */
+public class UuidsParameterTypeConverter extends AbstractParameterValueConverter {
+
+ private static final String SEPARATOR = ",";
+
+ public UuidsParameterTypeConverter() {
+ }
+
+ @Override
+ public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+ if(parameterValue.endsWith(SEPARATOR)){
+ List<UUID> uuids = new ArrayList<UUID>();
+ String[] split = parameterValue.split(SEPARATOR);
+ for (String string : split) {
+ uuids.add(UUID.fromString(string));
+ }
+ return uuids;
+ }
+ else{
+ return UUID.fromString(parameterValue);
+ }
+ }
+
+ @Override
+ public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+ if(parameterValue instanceof List){
+ List list = (List)parameterValue;
+ String stringList = "";
+ for (Object object : list) {
+ stringList += parameterValue.toString()+SEPARATOR;
+ }
+ }
+ else if(parameterValue instanceof UUID){
+ return parameterValue.toString();
+ }
+ else{
+ throw new ParameterValueConversionException("Parameter is of wrong type: "+parameterValue.getClass().toString());
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class DefaultOpenClassificationWizardHandler extends DefaultOpenHandlerBase<Classification> {
+
+ @Override
+ protected Classification getEntity(UUID uuid) {
+ return CdmStore.getService(IClassificationService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, Classification entity) {
+ NewClassificationWizard classificationWizard = new NewClassificationWizard();
+ classificationWizard.init(null, null);
+ classificationWizard.setEntity(entity);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
+ dialog.open();
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.ParameterType;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+public abstract class DefaultOpenHandlerBase <T> extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ String commandId = event.getCommand().getId();
+ String uuidParameterId = commandId+".uuid";
+ //check if uuid parameter is set
+ if(event.getParameter(uuidParameterId)!=null){
+ Object object = event.getObjectParameterForExecution(uuidParameterId);
+ ParameterType parameterType;
+ try {
+ parameterType = event.getCommand().getParameterType(uuidParameterId);
+ if(parameterType.isCompatible(object)){
+ T entity = getEntity((UUID) object);
+ open(event, entity);
+ }
+ } catch (NotDefinedException e) {
+ MessagingUtils.error(DefaultOpenHandlerBase.class, "Error while opening entity!", e);
+ }
+ }
+ //if not try current selection
+ else{
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if(selection instanceof IStructuredSelection){
+ open(event, (T) ((IStructuredSelection) selection).getFirstElement());
+ }
+ }
+ return null;
+ }
+
+
+ protected abstract T getEntity(UUID uuid);
+
+ protected abstract void open(ExecutionEvent event, T entity);
+
+}
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.handler.defaultHandler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.section.classification.EditTaxonNodeWizard;
+
+/**
+ * @author k.luther
+ * @date 22.03.2016
+ *
+ */
+public class DefaultOpenTaxonNodeWizardHandler extends DefaultOpenHandlerBase<TaxonNode> {
+ @Override
+ protected TaxonNode getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(ExecutionEvent event, TaxonNode entity) {
+ EditTaxonNodeWizard taxonNodeWizard = new EditTaxonNodeWizard();
+ taxonNodeWizard.init(null, null);
+ taxonNodeWizard.setEntity(entity);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), taxonNodeWizard);
+ dialog.open();
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+
+public class OpenReferencingObjectsView extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ return AbstractUtility.showView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects");
+ }
+
+}
// $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.
*/
* <p>
* Abstract AbstractIOHandler class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Sep 11, 2009
* @version 1.0
protected ICdmApplicationConfiguration applicationConfiguration;
public static enum TYPE {
- Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name
+ Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch
}
/**
* <p>
* Constructor for AbstractIOHandler.
* </p>
- *
+ *
* @param applicationController
* a
* {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
/**
* Starts the IO process
- *
+ *
* @param configurator
* a CONFIGURATOR object.
*/
public void run(final CONFIGURATOR configurator) {
- // create job
- Job job = createIOJob(configurator);
- // configure the job
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
- job.setUser(true);
- // schedule job
- job.schedule();
+ // create job
+ Job job = createIOJob(configurator);
+ run(job);
+ }
+ public void run(Job job) {
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
}
/**
* <p>
* createIOJob
* </p>
- *
+ *
* @param configurator
* a CONFIGURATOR object.
* @return a {@link org.eclipse.core.runtime.jobs.Job} object.
*/
protected abstract Job createIOJob(CONFIGURATOR configurator);
+
}
package eu.etaxonomy.taxeditor.io;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.List;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPart;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
+import eu.etaxonomy.cdm.io.common.ExportResult;
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
+import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* <p>
return job;
}
+ public Job createIOServiceJob(final IExportConfigurator configurator, final File exportFile) {
+ Assert.isNotNull(configurator, "Configuration may not be null");
+
+ final Display display = Display.getCurrent();
+
+ Job job = new Job("Export: " + configurator.getClass().getSimpleName()) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Exporting database. This will take some time.", IProgressMonitor.UNKNOWN);
+ try {
+ IIOService ioService = CdmApplicationState.getIOService();
+
+ ExportResult result = ioService.export(configurator);
+ List<byte[]> dataList = result.getExportData();
+ byte[] exportData = dataList.get(0);
+
+ FileOutputStream stream = new FileOutputStream(exportFile);
+ try {
+ stream.write(exportData);
+ } finally {
+ stream.close();
+ }
+
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error exporting data",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ return job;
+ }
/**
* @param jaxb
* @return
return (SDDExportConfigurator) getConfigurator(TYPE.Sdd);
}
+
+
}
// $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.io;
+import java.io.File;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.common.ImportResult;
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator;
import eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator;
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
+import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.ui.dialog.ReportTextDialog;
/**
* <p>
* ImportHandler class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Sep 11, 2009
* @version 1.0
*/
-public class ImportManager extends AbstractIOManager<IImportConfigurator> {
+public class ImportManager extends AbstractIOManager<IImportConfigurator> implements IPostMoniteredOperationEnabled {
/**
* @param applicationConfiguration
* <p>
* NewInstance
* </p>
- *
+ *
* @param applicationConfiguration
* a
* {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
/**
* Use when importing data into the current application context
- *
+ *
* @param configurator
* a {@link eu.etaxonomy.cdm.io.common.IImportConfigurator}
* object.
monitor.worked(5);
CdmDefaultImport<IImportConfigurator> importer = new CdmDefaultImport<IImportConfigurator>();
- importer.setCdmAppController((ICdmApplicationConfiguration) applicationConfiguration);
+ importer.setCdmAppController(applicationConfiguration);
monitor.worked(5);
-
+ ImportResult importResult = null;
try {
- importer.invoke(configurator);
+ importResult = importer.invoke(configurator);
+
monitor.worked(80);
} catch (RuntimeException e) {
MessagingUtils.messageDialog(
monitor.worked(5);
monitor.done();
+
+ final StringBuilder reportText = new StringBuilder();
+ if(importResult!=null){
+ List<byte[]> reports = importResult.getReports();
+ for (byte[] bs : reports) {
+ reportText.append(new String(bs));
+ }
+ }
display.asyncExec(new Runnable() {
@Override
public void run() {
+ // display reports with possibility to save
+ ReportTextDialog dialog = new ReportTextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ dialog.setTitle(configurator.getClass().getSimpleName()+" Report");
+ dialog.setReportText(reportText.toString());
+ dialog.open();
CdmStore.getContextManager().notifyContextRefresh();
}
});
}
+ public Job createIOServiceJob(IImportConfigurator configurator, InputStream is, SOURCE_TYPE type) {
+
+ try {
+ return createIOServiceJob(configurator, IOUtils.toByteArray(is), type);
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error importing input stream",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+ return null;
+ }
+
+ public Job createIOServiceJob(IImportConfigurator configurator, File importFile, SOURCE_TYPE type) {
+ Path path = Paths.get(importFile.toURI());
+ try {
+ return createIOServiceJob(configurator, Files.readAllBytes(path), type);
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error importing file",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+ return null;
+ }
+
+ public Job createIOServiceJob(final IImportConfigurator configurator, final byte[] data, final SOURCE_TYPE type) {
+ Assert.isNotNull(configurator, "Configuration may not be null");
+ final Display display = Display.getDefault();
+ Job job = new Job("Import: " + configurator.getClass().getSimpleName()) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Importing data", IProgressMonitor.UNKNOWN);
+ IIOService ioService = CdmApplicationState.getIOService();
+
+ ioService.importData(configurator, data, type);
+
+ monitor.done();
+
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ CdmStore.getContextManager().notifyContextRefresh();
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ return job;
+
+ }
+
+ public void runMoniteredOperation(IImportConfigurator configurator, InputStream is, SOURCE_TYPE type) {
+
+ try {
+ runMoniteredOperation(configurator, IOUtils.toByteArray(is), type);
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error importing input stream",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+
+ }
+
+ public void runMoniteredOperation(IImportConfigurator configurator, SOURCE_TYPE type) {
+ byte[] data = new byte[1];
+ try {
+ runMoniteredOperation(configurator, data, type);
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error importing input stream",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+
+ }
+
+ public void runMoniteredOperation(IImportConfigurator configurator, File importFile, SOURCE_TYPE type) {
+ Path path = Paths.get(importFile.toURI());
+ try {
+ runMoniteredOperation(configurator, Files.readAllBytes(path), type);
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error importing input stream",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+
+ }
+
+ public void runMoniteredOperation(final IImportConfigurator configurator, final byte[] data, final SOURCE_TYPE type) {
+ IIOService ioService = CdmApplicationState.getIOService();
+ final UUID uuid = ioService.monitImportData(configurator, data, type);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ AbstractUtility.executeMoniteredOperation("Import: " + configurator.getClass().getSimpleName(),
+ uuid,
+ 1000,
+ false,
+ ImportManager.this,
+ null);
+ }
+ });
+
+ }
+
private IImportConfigurator getConfigurator(TYPE type) {
Assert.isNotNull(type, "Type should not be null");
return SDDImportConfigurator.NewInstance(null, null);
case SpecimenCdmExcel:
return SpecimenCdmExcelImportConfigurator.NewInstance(null, null);
+ case SpecimenSearch:
+ return Abcd206ImportConfigurator.NewInstance(null, null);
default:
MessagingUtils.notImplementedMessage(this);
throw new IllegalArgumentException("Import not supported yet");
* <p>
* JaxbConfigurator
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator} object.
*/
public final JaxbImportConfigurator JaxbConfigurator() {
* <p>
* TcsConfigurator
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator}
* object.
*/
* <p>
* EndnoteConfigurator
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator}
* object.
* <p>
* NormalExplicitConfigurator
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator}
* object.
* <p>
* SddConfigurator
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator}
* object.
*/
* <p>
* AbcdConfigurator
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator}
* object.
return (SpecimenCdmExcelImportConfigurator) getConfigurator(TYPE.SpecimenCdmExcel);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void postOperation(IRemotingProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ CdmStore.getContextManager().notifyContextRefresh();
+ }
+ });
+
+ }
+
+
}
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- * <p>AbcdImportWizard class.</p>
*
* @author n.hoffmann
* @created Jun 16, 2010
private static final Logger logger = Logger.getLogger(AbcdImportWizard.class);
private Abcd206ImportConfigurator configurator;
- private ImportFromFileDataSourceWizardPage dataSourcePage;
+ private AbcdSourceSelectionPage dataSourcePage;
private ClassificationChooserWizardPage classificationChooserWizardPage;
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
- */
/** {@inheritDoc} */
@Override
public Abcd206ImportConfigurator getConfigurator() {
return configurator;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
/** {@inheritDoc} */
@Override
public boolean performFinish() {
- URI source = dataSourcePage.getUri();
- try {
- configurator.setSource(new FileInputStream(new File(source)));
- } catch (FileNotFoundException e) {
- MessagingUtils.errorDialog("File not found.", this, "Import file was not found.", TaxeditorStorePlugin.PLUGIN_ID, e, false);
- logger.error("File not found!", e);
- return false;
- }
- configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
- if(classificationChooserWizardPage.getClassification()!=null){
- configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
- }
- configurator.setReportUri(classificationChooserWizardPage.getReportUri());
-
- CdmStore.getImportManager().run(configurator);
- return true;
+ URI source = dataSourcePage.getUri();
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+
+ if(classificationChooserWizardPage.getClassification()!=null){
+ configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
+ }
+
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+ //CdmStore.getImportManager().run(job);
+ CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+ } else {
+ try {
+ configurator.setSource(new FileInputStream(new File(source)));
+ } catch (FileNotFoundException e) {
+ MessagingUtils.errorDialog("File not found.", this, "Import file was not found.", TaxeditorStorePlugin.PLUGIN_ID, e, false);
+ logger.error("File not found!", e);
+ return false;
+ }
+ CdmStore.getImportManager().run(configurator);
+ }
+ return true;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
/** {@inheritDoc} */
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
configurator = CdmStore.getImportManager().AbcdConfigurator();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.io.AbstractImportWizard#addPages()
- */
/** {@inheritDoc} */
@Override
public void addPages() {
super.addPages();
classificationChooserWizardPage = ClassificationChooserWizardPage.createPage();
+
dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
+
addPage(classificationChooserWizardPage);
addPage(dataSourcePage);
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.io.wizard;
+
+import java.net.URI;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author k.luther
+ * @date 29.03.2016
+ *
+ */
+public abstract class AbcdSourceSelectionPage extends WizardPage {
+
+ protected Text text_source;
+
+ /**
+ * @param pageName
+ */
+ protected AbcdSourceSelectionPage(String pageName) {
+ super(pageName);
+
+ }
+
+ public abstract URI getUri();
+
+
+
+
+
+
+
+}
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
/**
- * <p>Abstract AbstractImportWizard class.</p>
- *
* @author n.hoffmann
* @created 24.06.2009
* @version 1.0
private IStructuredSelection selection;
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
/** {@inheritDoc} */
@Override
public void addPages() {
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#setContainer(org.eclipse.jface.wizard.IWizardContainer)
- */
@Override
public void setContainer(IWizardContainer wizardContainer) {
if(existUnsavedEditors()){
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.setWorkbench(workbench);
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
@Override
public boolean canFinish() {
- return !existUnsavedEditors();
+ return !existUnsavedEditors() && super.canFinish();
}
- /**
- * <p>getConfigurator</p>
- *
- * @return a CONFIG object.
- */
public abstract CONFIG getConfigurator();
- /**
- * @param selection the selection to set
- */
public void setSelection(IStructuredSelection selection) {
this.selection = selection;
}
- /**
- * @return the selection
- */
public IStructuredSelection getSelection() {
return selection;
}
- /**
- * @param workbench the workbench to set
- */
public void setWorkbench(IWorkbench workbench) {
this.workbench = workbench;
}
- /**
- * @return the workbench
- */
public IWorkbench getWorkbench() {
return workbench;
}
package eu.etaxonomy.taxeditor.io.wizard;
-import java.io.File;
-import java.net.URI;
-
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
private Button btnClear;
- //report
- private FileDialog fileDialogReport;
- private Text textFileReport;
-
- /**
- * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
- *
- * @param title a {@link java.lang.String} object.
- * @param description a {@link java.lang.String} object.
- * @param extensions an array of {@link java.lang.String} objects.
- */
protected ClassificationChooserWizardPage(String title, String description) {
super(PAGE_NAME);
}
- /**
- * <p>XML</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ClassificationChooserWizardPage} object.
- */
protected static ClassificationChooserWizardPage createPage(){
return new ClassificationChooserWizardPage("Configure import destinations", "Note: Selecting no classification will create a default one.");
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
btnClear.addListener(SWT.Selection, this);
- //report
- Label labelReportFile = new Label(composite, SWT.NONE);
- labelReportFile.setText("Report File");
-
- fileDialogReport = new FileDialog(parent.getShell());
-
- fileDialogReport.setFilterExtensions(new String[]{"*.*"});
-
- textFileReport = new Text(composite, SWT.BORDER);
- textFileReport.setEditable(false);
- textFileReport.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-
-
- Button buttonReport = new Button(composite, SWT.PUSH);
- buttonReport.setText("Browse...");
-
- buttonReport.addSelectionListener(new SelectionAdapter(){
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e) {
- String path = fileDialogReport.open();
- if(path!=null){
- textFileReport.setText(path);
- setPageComplete(true);
- }
- }
-
- });
-
setControl(composite);
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
- */
@Override
public void handleEvent(Event event) {
if(event.widget==btnBrowseClassification){
return classification;
}
- public URI getReportUri(){
- String text = textFileReport.getText();
- if(text==null || text.isEmpty()){
- return null;
- }
- return new File(text).toURI();
- }
}
import java.util.List;
import java.util.UUID;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
import eu.etaxonomy.cdm.model.taxon.Classification;
configurator.setLastChange(true);
}
}
- configurator.setDestination(new File(urlString));
-
- CdmStore.getExportManager().run(configurator);
-
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+ } else {
+
+ configurator.setDestination(new File(urlString));
+ CdmStore.getExportManager().run(configurator);
+ }
return true;
}
\r
import java.io.File;\r
\r
+import org.eclipse.core.runtime.jobs.Job;\r
import org.eclipse.jface.viewers.IStructuredSelection;\r
import org.eclipse.swt.widgets.Combo;\r
import org.eclipse.ui.IWorkbench;\r
+import org.eclipse.ui.progress.IProgressConstants;\r
\r
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
@Override\r
public void init(IWorkbench workbench, IStructuredSelection selection) {\r
configurator = CsvNameExportConfigurator.NewInstance(null,null);\r
+ configurator.setNamesOnly(true);\r
}\r
\r
/*\r
*/\r
@Override\r
public boolean performFinish() {\r
- String urlString = page.getFolderText() + File.separator\r
- + page.getExportFileName();\r
-\r
- final Combo combo = page.getCombo();\r
- \r
- configurator.setDestination(new File(urlString));\r
-\r
- CdmStore.getExportManager().run(configurator);\r
-\r
+ String urlString = page.getFolderText() + File.separator\r
+ + page.getExportFileName();\r
+\r
+ final Combo combo = page.getCombo();\r
+\r
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
+ // create job\r
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
+ // configure the job\r
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
+ job.setUser(true);\r
+ // schedule job\r
+ job.schedule();\r
+ } else {\r
+ configurator.setDestination(new File(urlString));\r
+ CdmStore.getExportManager().run(configurator);\r
+ }\r
return true;\r
}\r
\r
import java.util.List;\r
import java.util.UUID;\r
\r
+import org.eclipse.core.runtime.jobs.Job;\r
import org.eclipse.jface.viewers.IStructuredSelection;\r
import org.eclipse.swt.widgets.Combo;\r
import org.eclipse.ui.IWorkbench;\r
+import org.eclipse.ui.progress.IProgressConstants;\r
\r
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;\r
import eu.etaxonomy.cdm.model.taxon.Classification;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
public class CsvPrintExportWizard extends CsvNameExportWizard{\r
- \r
- \r
+\r
+\r
private final String description = "Export the contents of the currently selected database into Semicolon Separated Value format.";\r
@Override\r
public void init(IWorkbench workbench, IStructuredSelection selection) {\r
\r
@Override\r
public CsvNameExportConfigurator getConfigurator() {\r
- \r
+\r
return configurator;\r
}\r
\r
- \r
+\r
\r
/*\r
* (non-Javadoc)\r
set.add(c.getUuid());\r
}\r
}\r
- \r
+\r
configurator.setHasHeaderLines(true);\r
- \r
+\r
}\r
- } else{ \r
+ } else{\r
configurator.setClassificationUUID(listClassifications.get(0).getUuid());\r
}\r
- configurator.setDestination(new File(urlString));\r
-\r
- CdmStore.getExportManager().run(configurator);\r
\r
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {\r
+ // create job\r
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));\r
+ // configure the job\r
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);\r
+ job.setUser(true);\r
+ // schedule job\r
+ job.schedule();\r
+ } else {\r
+ configurator.setDestination(new File(urlString));\r
+ CdmStore.getExportManager().run(configurator);\r
+ }\r
return true;\r
}\r
\r
package eu.etaxonomy.taxeditor.io.wizard;
+import java.io.File;
import java.net.URI;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
- CdmStore.getImportManager().run(configurator);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+ } else {
+ CdmStore.getImportManager().run(configurator);
+ }
+
return true;
}
import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
import java.io.File;
import java.net.URI;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.cdm.common.CdmUtils;
+
/**
- * <p>ImportFromFileDataSourceWizardPage class.</p>
*
* @author n.hoffmann
* @created 04.08.2009
* @version 1.0
*/
-public class ImportFromFileDataSourceWizardPage extends WizardPage {
+public class ImportFromFileDataSourceWizardPage extends AbcdSourceSelectionPage {
/** Constant <code>PAGE_NAME="CdmXmlDataSourceWizardPage"</code> */
public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage";
private FileDialog fileDialog;
- private Text text_file;
- /**
- * <p>Constructor for ImportFromFileDataSourceWizardPage.</p>
- *
- * @param title a {@link java.lang.String} object.
- * @param description a {@link java.lang.String} object.
- * @param extensions an array of {@link java.lang.String} objects.
- */
protected ImportFromFileDataSourceWizardPage(String title, String description, String[] extensions) {
super(PAGE_NAME);
this.extensions = extensions;
}
- /**
- * <p>XML</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.io.wizard.ImportFromFileDataSourceWizardPage} object.
- */
protected static ImportFromFileDataSourceWizardPage XML(){
return new ImportFromFileDataSourceWizardPage("Xml File", "Select XML file.", new String[]{"*.xml","*.*"});
}
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
fileDialog.setFilterExtensions(extensions);
- text_file = new Text(composite, SWT.BORDER);
- text_file.setEditable(false);
- text_file.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text_source = new Text(composite, SWT.BORDER);
+ text_source.setEditable(false);
+ text_source.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Button button = new Button(composite, SWT.PUSH);
button.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent e) {
String path = fileDialog.open();
if(path!=null){
- text_file.setText(path);
+ text_source.setText(path);
setPageComplete(true);
}
}
setControl(composite);
}
- /**
- * <p>getFile</p>
- *
- * @return a {@link java.io.File} object.
- */
public File getFile() {
- return new File(text_file.getText());
+ return new File(text_source.getText());
}
- /**
- * <p>getUri</p>
- *
- * @return a {@link java.net.URI} object.
- */
- public URI getUri() {
+ @Override
+ public URI getUri() {
return getFile().toURI();
}
+ @Override
+ public boolean isPageComplete() {
+ return CdmUtils.isNotBlank(text_source.getText());
+ }
}
// $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.
*/
import java.io.File;
import java.net.URI;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
this.setWindowTitle("JAXB Export");
this.configurator = CdmStore.getExportManager().JaxbConfigurator();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
boolean performFinish = false;
- URI urlString;
- File savePath = new File(page.getFolderText() + File.separator + page.getExportFileName());
- urlString = savePath.toURI();
- //orig: urlString = new URI(page.getFolderText() + File.separator + page.getExportFileName());
+
+ File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
+ URI urlString = exportFile.toURI();
configurator.setDestination(urlString);
- CdmStore.getExportManager().run(configurator);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+ } else {
+ CdmStore.getExportManager().run(configurator);
+ }
performFinish = true;
return performFinish;
}
@Override
public void addPages() {
super.addPages();
-
+
page = ExportToFileDestinationWizardPage.Jaxb();
addPage(page);
}
public JaxbExportConfigurator getConfigurator() {
return configurator;
}
-
+
}
// $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.
*/
import java.io.File;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
public class SddExportWizard extends AbstractExportWizard<SDDExportConfigurator> {
private ExportToFileDestinationWizardPage page;
-
+
private SDDExportConfigurator configurator;
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
*/
/** {@inheritDoc} */
@Override
public boolean performFinish() {
- File file = new File(page.getFolderText() + File.separator + page.getExportFileName());
-
- configurator.setDestination(file);
-
- CdmStore.getExportManager().run(configurator);
-
- return true;
+ File file = new File(page.getFolderText() + File.separator + page.getExportFileName());
+
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, file);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+ } else {
+ configurator.setDestination(file);
+ CdmStore.getExportManager().run(configurator);
+ }
+ return true;
}
/*
@Override
public void addPages() {
super.addPages();
-
+
page = ExportToFileDestinationWizardPage.Sdd();
addPage(page);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
this.setWindowTitle("SDD Export");
this.configurator = CdmStore.getExportManager().SddConfigurator();
}
// $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.io.wizard;
+import java.io.File;
import java.net.URI;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
public class SddImportWizard extends AbstractImportWizard<SDDImportConfigurator> {
private SDDImportConfigurator configurator;
-
+
private ImportFromFileDataSourceWizardPage dataSourcePage;
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.io.wizard.AbstractImportWizard#getConfigurator()
*/
public SDDImportConfigurator getConfigurator() {
return configurator;
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
@Override
public void addPages() {
super.addPages();
-
- dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose File",
+
+ dataSourcePage = new ImportFromFileDataSourceWizardPage("Choose File",
"Please choose an XML file in the SDD format.", new String[]{"*.xml", "*.sdd"});
addPage(dataSourcePage);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
URI source = dataSourcePage.getUri();
configurator.setSource(source);
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
- CdmStore.getImportManager().run(configurator);
-
+
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+ } else {
+ CdmStore.getImportManager().run(configurator);
+ }
+
return true;
}
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
super.init(workbench, selection);
configurator = CdmStore.getImportManager().SddConfigurator();
}
// $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.io.wizard;
+import java.io.File;
import java.net.URI;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created 15.06.2009
* @version 1.0
*/
-public class TcsImportWizard extends AbstractImportWizard<TcsXmlImportConfigurator>{
-
+public class TcsImportWizard extends AbstractImportWizard<TcsXmlImportConfigurator> {
+
private TcsXmlImportConfigurator configurator;
private ImportFromFileDataSourceWizardPage dataSourcePage;
/** {@inheritDoc} */
@Override
public boolean performFinish() {
- URI source = dataSourcePage.getUri();
- configurator.setSource(source);
- configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
- CdmStore.getImportManager().run(configurator);
-
- return true;
+ URI source = dataSourcePage.getUri();
+ configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+ } else {
+ CdmStore.getImportManager().run(configurator);
+ }
+
+ return true;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
/** {@inheritDoc} */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
super.init(workbench, selection);
configurator = CdmStore.getImportManager().TcsConfigurator();
}
@Override
public void addPages() {
super.addPages();
-
+
dataSourcePage = ImportFromFileDataSourceWizardPage.XML();
addPage(dataSourcePage);
}
import java.util.LinkedHashMap;
import java.util.List;
import java.util.TreeSet;
+import java.util.UUID;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.themes.ITheme;
import org.eclipse.ui.themes.IThemeManager;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
+import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.model.common.IEnumTerm;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
+import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.ui.dialog.ReportTextDialog;
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
*/
public abstract class AbstractUtility {
+ private static final Logger logger = Logger.getLogger(AbstractUtility.class);
+
/** Constant <code>statusLineManager</code> */
protected static IStatusLineManager statusLineManager;
- /**
- * <p>
- * closeAll
- * </p>
- *
- * @return a boolean.
- */
- public static boolean closeAll() {
- return getActivePage().closeAllEditors(true);
- }
-
- /**
- * Close the given editor.
- *
- * @param editor
- * The <tt>MultipageTaxonEditor</tt> to close.
- * @return <tt>true</tt> on success
- */
- public static boolean close(EditorPart editor) {
- return getActivePage().closeEditor(editor, true);
- }
-
- /**
- * <p>
- * getShell
- * </p>
- *
- * @return a {@link org.eclipse.swt.widgets.Shell} object.
- */
- public static Shell getShell() {
-
- return TaxeditorStorePlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- }
-
- /**
- * <p>
- * getActivePage
- * </p>
- *
- * @return a {@link org.eclipse.ui.IWorkbenchPage} object.
- */
- public static IWorkbenchPage getActivePage() {
-
- return TaxeditorStorePlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- }
-
- /**
- * <p>
- * getActivePart
- * </p>
- *
- * @return a {@link org.eclipse.ui.IWorkbenchPart} object.
- */
- public static IWorkbenchPart getActivePart() {
- return getActivePage() != null ? getActivePage().getActivePart() : null;
- }
-
- public static IWorkbench getWorkbench() {
- return TaxeditorStorePlugin.getDefault().getWorkbench();
- }
-
- /**
- * <p>
- * getWorkbenchWindow
- * </p>
- *
- * @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
- */
- public static ApplicationWindow getWorkbenchWindow() {
- if (getWorkbench().getWorkbenchWindowCount() > 1) {
- throw new IllegalStateException("More than one workbench window");
- }
- return (ApplicationWindow) getWorkbench().getWorkbenchWindows()[0];
- }
-
- /**
- * <p>
- * showView
- * </p>
- *
- * @param id
- * a {@link java.lang.String} object.
- * @return a {@link org.eclipse.ui.IViewPart} object.
- */
- public static IViewPart showView(String id) {
- try {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage()
- .showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
- } catch (PartInitException e) {
- MessagingUtils.messageDialog("Error opening view", AbstractUtility.class, "Could not open view: " + id, e);
- return null;
- }
- }
-
- /**
- * <p>
- * hideView
- * </p>
- *
- * @param view
- * a {@link org.eclipse.ui.IViewPart} object.
- */
- public static void hideView(IViewPart view) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .hideView(view);
- }
-
- /**
- * <p>
- * getView
- * </p>
- *
- * @param id
- * a {@link java.lang.String} object.
- * @param restore
- * a boolean.
- * @return a {@link org.eclipse.ui.IViewPart} object.
- */
- public static IViewPart getView(String id, boolean restore) {
- IViewReference[] references = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getViewReferences();
- for (IViewReference reference : references) {
- if (reference.getId().equals(id)) {
- return reference.getView(restore);
- }
- }
- return null;
- }
-
- /**
- * <p>
- * getService
- * </p>
- *
- * @param api
- * a {@link java.lang.Class} object.
- * @return a {@link java.lang.Object} object.
- */
- public static Object getService(Class api) {
- return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
- }
-
- /**
- * <p>
- * getCurrentTheme
- * </p>
- *
- * @return a {@link org.eclipse.ui.themes.ITheme} object.
- */
- public static ITheme getCurrentTheme() {
- IThemeManager themeManager = TaxeditorStorePlugin.getDefault()
- .getWorkbench().getThemeManager();
- return themeManager.getCurrentTheme();
- }
-
- /**
- * Fonts registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus fonts are chooseable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the FontRegistry for the current theme
- */
- public static FontRegistry getFontRegistry() {
- return getCurrentTheme().getFontRegistry();
- }
-
- /**
- * <p>
- * getFont
- * </p>
- *
- * @param symbolicName
- * a {@link java.lang.String} object.
- * @return a {@link org.eclipse.swt.graphics.Font} object.
- */
- public static Font getFont(String symbolicName) {
- return getFontRegistry().get(symbolicName);
- }
-
- /**
- * Color registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus colors are editable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the ColorRegistry for the current theme
- */
- public static ColorRegistry getColorRegistry() {
- return getCurrentTheme().getColorRegistry();
- }
-
- /**
- * <p>
- * getColor
- * </p>
- *
- * @param symbolicName
- * a {@link java.lang.String} object.
- * @return a {@link org.eclipse.swt.graphics.Color} object.
- */
- public static Color getColor(String symbolicName) {
- return getColorRegistry().get(symbolicName);
- }
-
- /**
- * <p>
- * executeOperation
- * </p>
- *
- * @param operation
- * a
- * {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation}
- * object.
- * @return a {@link org.eclipse.core.runtime.IStatus} object.
- */
- public static IStatus executeOperation(final AbstractPostOperation operation) {
- if (getOperationHistory() == null) {
- throw new IllegalArgumentException(
- "There is no operation history for this context");
- }
-
- final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
- .getUIInfoAdapter(getShell());
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- @Override
+ /**
+ * <p>
+ * closeAll
+ * </p>
+ *
+ * @return a boolean.
+ */
+ public static boolean closeAll() {
+ return getActivePage().closeAllEditors(true);
+ }
+
+ /**
+ * Close the given editor.
+ *
+ * @param editor
+ * The <tt>MultipageTaxonEditor</tt> to close.
+ * @return <tt>true</tt> on success
+ */
+ public static boolean close(EditorPart editor) {
+ return getActivePage().closeEditor(editor, true);
+ }
+
+ /**
+ * <p>
+ * getShell
+ * </p>
+ *
+ * @return a {@link org.eclipse.swt.widgets.Shell} object.
+ */
+ public static Shell getShell() {
+
+ return TaxeditorStorePlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ }
+
+ /**
+ * <p>
+ * getActivePage
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.IWorkbenchPage} object.
+ */
+ public static IWorkbenchPage getActivePage() {
+
+ return TaxeditorStorePlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ }
+
+ /**
+ * <p>
+ * getActivePart
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.IWorkbenchPart} object.
+ */
+ public static IWorkbenchPart getActivePart() {
+ return getActivePage() != null ? getActivePage().getActivePart() : null;
+ }
+
+ public static IWorkbench getWorkbench() {
+ return TaxeditorStorePlugin.getDefault().getWorkbench();
+ }
+
+ /**
+ * <p>
+ * getWorkbenchWindow
+ * </p>
+ *
+ * @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
+ */
+ public static ApplicationWindow getWorkbenchWindow() {
+ if (getWorkbench().getWorkbenchWindowCount() > 1) {
+ throw new IllegalStateException("More than one workbench window");
+ }
+ return (ApplicationWindow) getWorkbench().getWorkbenchWindows()[0];
+ }
+
+ /**
+ * <p>
+ * showView
+ * </p>
+ *
+ * @param id
+ * a {@link java.lang.String} object.
+ * @return a {@link org.eclipse.ui.IViewPart} object.
+ */
+ public static IViewPart showView(String id) {
+ try {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
+ } catch (PartInitException e) {
+ MessagingUtils.messageDialog("Error opening view", AbstractUtility.class, "Could not open view: " + id, e);
+ return null;
+ }
+ }
+
+ /**
+ * <p>
+ * hideView
+ * </p>
+ *
+ * @param view
+ * a {@link org.eclipse.ui.IViewPart} object.
+ */
+ public static void hideView(IViewPart view) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .hideView(view);
+ }
+
+ /**
+ * <p>
+ * getView
+ * </p>
+ *
+ * @param id
+ * a {@link java.lang.String} object.
+ * @param restore
+ * a boolean.
+ * @return a {@link org.eclipse.ui.IViewPart} object.
+ */
+ public static IViewPart getView(String id, boolean restore) {
+ IViewReference[] references = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getViewReferences();
+ for (IViewReference reference : references) {
+ if (reference.getId().equals(id)) {
+ return reference.getView(restore);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <p>
+ * getService
+ * </p>
+ *
+ * @param api
+ * a {@link java.lang.Class} object.
+ * @return a {@link java.lang.Object} object.
+ */
+ public static Object getService(Class api) {
+ return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
+ }
+
+ /**
+ * <p>
+ * getCurrentTheme
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.themes.ITheme} object.
+ */
+ public static ITheme getCurrentTheme() {
+ IThemeManager themeManager = TaxeditorStorePlugin.getDefault()
+ .getWorkbench().getThemeManager();
+ return themeManager.getCurrentTheme();
+ }
+
+ /**
+ * Fonts registered to the plugin may be obtained with the Eclipse themeing
+ * functionality. Thus fonts are chooseable by the user via
+ * Preferences->General->Appearance->Colors and Fonts
+ *
+ * @return the FontRegistry for the current theme
+ */
+ public static FontRegistry getFontRegistry() {
+ return getCurrentTheme().getFontRegistry();
+ }
+
+ /**
+ * <p>
+ * getFont
+ * </p>
+ *
+ * @param symbolicName
+ * a {@link java.lang.String} object.
+ * @return a {@link org.eclipse.swt.graphics.Font} object.
+ */
+ public static Font getFont(String symbolicName) {
+ return getFontRegistry().get(symbolicName);
+ }
+
+ /**
+ * Color registered to the plugin may be obtained with the Eclipse themeing
+ * functionality. Thus colors are editable by the user via
+ * Preferences->General->Appearance->Colors and Fonts
+ *
+ * @return the ColorRegistry for the current theme
+ */
+ public static ColorRegistry getColorRegistry() {
+ return getCurrentTheme().getColorRegistry();
+ }
+
+ /**
+ * <p>
+ * getColor
+ * </p>
+ *
+ * @param symbolicName
+ * a {@link java.lang.String} object.
+ * @return a {@link org.eclipse.swt.graphics.Color} object.
+ */
+ public static Color getColor(String symbolicName) {
+ return getColorRegistry().get(symbolicName);
+ }
+
+ /**
+ * <p>
+ * executeOperation
+ * </p>
+ *
+ * @param operation
+ * a
+ * {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation}
+ * object.
+ * @return a {@link org.eclipse.core.runtime.IStatus} object.
+ */
+ public static IStatus executeOperation(final AbstractPostOperation operation) {
+ if (getOperationHistory() == null) {
+ throw new IllegalArgumentException(
+ "There is no operation history for this context");
+ }
+
+ final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
+ .getUIInfoAdapter(getShell());
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ @Override
public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- String operationlabel = operation.getLabel();
+ throws InvocationTargetException, InterruptedException {
+ String operationlabel = operation.getLabel();
monitor.beginTask(operationlabel, 100);
- IStatus status = Status.CANCEL_STATUS;
- try {
- operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
- status = getOperationHistory().execute(operation, monitor,
- uiInfoAdapter);
- } catch (ExecutionException e) {
-
- MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
-
- } finally {
- monitor.done();
- }
-
- String statusString = status.equals(Status.OK_STATUS) ? "completed"
- : "cancelled";
- setStatusLine(operationlabel + " " + statusString + ".");
-
- }
- };
-
- try {
- runInUI(runnable, null);
- } catch (Exception e) {
- MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
- }
-
- IPostOperationEnabled postOperationEnabled = operation
- .getPostOperationEnabled();
- if (postOperationEnabled != null) {
- postOperationEnabled.onComplete();
- }
- return Status.OK_STATUS;
- }
-
- /**
- * <p>
- * getOperationHistory
- * </p>
- *
- * @return a {@link org.eclipse.core.commands.operations.IOperationHistory}
- * object.
- */
- public static IOperationHistory getOperationHistory() {
- return getWorkbench().getOperationSupport().getOperationHistory();
- }
-
- /**
- * <p>
- * setStatusLine
- * </p>
- *
- * @param message
- * a {@link java.lang.String} object.
- */
- public static void setStatusLine(final String message) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
+ IStatus status = Status.CANCEL_STATUS;
+ try {
+ operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
+ status = getOperationHistory().execute(operation, monitor,
+ uiInfoAdapter);
+ } catch (ExecutionException e) {
+
+ MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
+
+ } finally {
+ monitor.done();
+ }
+
+ String statusString = status.equals(Status.OK_STATUS) ? "completed"
+ : "cancelled";
+ setStatusLine(operationlabel + " " + statusString + ".");
+
+ }
+ };
+
+ try {
+ runInUI(runnable, null);
+ } catch (Exception e) {
+ MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
+ }
+
+ IPostOperationEnabled postOperationEnabled = operation
+ .getPostOperationEnabled();
+ if (postOperationEnabled != null) {
+ postOperationEnabled.onComplete();
+ }
+ return Status.OK_STATUS;
+ }
+
+ public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandler handler) {
+ if (getOperationHistory() == null) {
+ throw new IllegalArgumentException(
+ "There is no operation history for this context");
+ }
+
+ final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
+ .getUIInfoAdapter(getShell());
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ String operationlabel = operation.getLabel();
+ monitor.beginTask(operationlabel, 100);
+ IStatus status = Status.CANCEL_STATUS;
+ try {
+ operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
+ status = getOperationHistory().execute(operation, monitor,
+ uiInfoAdapter);
+ if(handler != null) {
+ handler.postOperation(status);
+ }
+ } catch (ExecutionException e) {
+ MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
+ } finally {
+ monitor.done();
+ }
+
+ String statusString = status.equals(Status.OK_STATUS) ? "completed"
+ : "cancelled";
+ setStatusLine(operationlabel + " " + statusString + ".");
+
+ }
+ };
+
+ try {
+ runInUI(runnable, null);
+ } catch (Exception e) {
+ MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Executes a remoting monitored operation
+ *
+ * @param label for the operation
+ * @param uuid of the remoting monitor already started on the server
+ * @param pollInterval in milliseconds
+ * @param cancelable flag which determines whether the operation can be cancelled
+ * @param postOp callback for running post operation logic
+ * @return
+ */
+ public static IStatus executeMoniteredOperation(final String label,
+ final UUID uuid,
+ final int pollInterval,
+ final boolean cancelable,
+ final IPostMoniteredOperationEnabled postOp,
+ final IFeedbackGenerator feedbackGenerator) {
+
+ try {
+ // get the remoting monitor the first time to make sure that the
+ // operation is valid
+ final IProgressMonitorService progressMonitorService = CdmApplicationState.getCurrentAppConfig().getProgressMonitorService();
+ final IRemotingProgressMonitor firstRemotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ if(firstRemotingMonitor == null) {
+ throw new IllegalStateException("Remoting progress monitor is null");
+ }
+
+ Job job = new Job(label) {
+
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ // run the monitor until the operation is finished
+ IRemotingProgressMonitor remotingMonitor;
+ try {
+ remotingMonitor = CdmStore.getProgressMonitorClientManager().pollMonitor(label,
+ uuid,
+ pollInterval,
+ postOp,
+ feedbackGenerator,
+ monitor);
+ } catch (Exception ex) {
+ return new Status(Status.ERROR, TaxeditorStorePlugin.PLUGIN_ID, "Operation Interrupted", ex);
+ }
+ final StringBuilder reportSb = new StringBuilder();
+ // collect reports
+ for(String report : remotingMonitor.getReports()) {
+ reportSb.append(report);
+ }
+ if(!StringUtils.isBlank(reportSb.toString())) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ // display reports with possibility to save
+ ReportTextDialog dialog = new ReportTextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+ dialog.setTitle(label + " Report");
+ dialog.setReportText(reportSb.toString());
+ dialog.open();
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected void canceling() {
+ CdmStore.getCurrentApplicationConfiguration().getProgressMonitorService().cancel(uuid);
+ }
+ };
+
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error executing operation",
+ AbstractUtility.class,
+ "An error occured while executing " + label,
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+
+ /**
+ * <p>
+ * getOperationHistory
+ * </p>
+ *
+ * @return a {@link org.eclipse.core.commands.operations.IOperationHistory}
+ * object.
+ */
+ public static IOperationHistory getOperationHistory() {
+ return getWorkbench().getOperationSupport().getOperationHistory();
+ }
+
+ /**
+ * <p>
+ * setStatusLine
+ * </p>
+ *
+ * @param message
+ * a {@link java.lang.String} object.
+ */
+ public static void setStatusLine(final String message) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
public void run() {
- statusLineManager.setMessage(message);
- }
-
- });
-
- }
-
- /**
- * <p>
- * getMonitor
- * </p>
- *
- * @return a {@link org.eclipse.core.runtime.IProgressMonitor} object.
- */
- public static IProgressMonitor getMonitor() {
- statusLineManager.setCancelEnabled(false);
- return statusLineManager.getProgressMonitor();
- }
-
- /**
- * Starts either the given {@link IProgressMonitor} if it's not
- * <code>null</code> or a new {@link NullProgressMonitor}.
- *
- * @param progressMonitor
- * The {@link IProgressMonitor} or <code>null</code> if no
- * progress should be reported.
- * @param taskName
- * The name of the main task.
- * @param steps
- * The number of steps this task is subdivided into.
- * @return The {@link IProgressMonitor}.
- */
- public static IProgressMonitor startMainMonitor(
- IProgressMonitor progressMonitor, String taskName, int steps) {
- IProgressMonitor newMonitor = progressMonitor;
- if (newMonitor == null) {
- newMonitor = new NullProgressMonitor();
- }
- newMonitor.beginTask(taskName == null ? "" : taskName, steps);
- newMonitor.subTask(" ");
- return newMonitor;
- }
-
- /**
- * Creates a {@link SubProgressMonitor} if the given
- * {@link IProgressMonitor} is not <code>null</code> and not a
- * {@link NullProgressMonitor}.
- *
- * @param progressMonitor
- * The parent {@link IProgressMonitor} of the
- * {@link SubProgressMonitor} to be created.
- * @param ticks
- * The number of steps this subtask is subdivided into. Must be a
- * positive number and must not be
- * {@link IProgressMonitor#UNKNOWN}.
- * @return The {@link IProgressMonitor}.
- */
- public static IProgressMonitor getSubProgressMonitor(
- IProgressMonitor progressMonitor, int ticks) {
- if (progressMonitor == null) {
- return new NullProgressMonitor();
- }
- if (progressMonitor instanceof NullProgressMonitor) {
- return progressMonitor;
- }
-
- return new SubProgressMonitor(progressMonitor, ticks);
- }
-
- /**
- * Checks whether the user canceled this operation. If not canceled, the
- * given number of steps are declared as done.
- *
- * @param newMonitor
- * a {@link org.eclipse.core.runtime.IProgressMonitor} object.
- * @param steps
- * a int.
- */
- public static void workedChecked(IProgressMonitor newMonitor, int steps) {
- // In case the progress monitor was canceled throw an exception.
- if (newMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- // Otherwise declare this step as done.
- newMonitor.worked(steps);
- }
-
- /**
- * Present a progress dialog to the user. This dialog will block the UI
- *
- * @param runnable
- * an implementation of {@link IRunnableWithProgress}
- * @throws java.lang.InterruptedException
- * if any.
- * @throws java.lang.reflect.InvocationTargetException
- * if any.
- */
- public static void busyCursorWhile(IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- getProgressService().busyCursorWhile(runnable);
- }
-
- /**
- * <p>
- * runInUI
- * </p>
- *
- * @see {@link IProgressService#runInUI(org.eclipse.jface.operation.IRunnableContext, IRunnableWithProgress, ISchedulingRule)}
- * @param runnable
- * a {@link org.eclipse.jface.operation.IRunnableWithProgress}
- * object.
- * @param rule
- * a {@link org.eclipse.core.runtime.jobs.ISchedulingRule}
- * object.
- * @throws java.lang.reflect.InvocationTargetException
- * if any.
- * @throws java.lang.InterruptedException
- * if any.
- */
- public static void runInUI(IRunnableWithProgress runnable,
- ISchedulingRule rule) throws InvocationTargetException,
- InterruptedException {
- getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);
- }
-
- /**
- * <p>
- * run
- * </p>
- *
- * @param fork
- * a boolean.
- * @param cancelable
- * a boolean.
- * @param runnable
- * a {@link org.eclipse.jface.operation.IRunnableWithProgress}
- * object.
- * @throws java.lang.reflect.InvocationTargetException
- * if any.
- * @throws java.lang.InterruptedException
- * if any.
- */
- public static void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- getProgressService().run(fork, cancelable, runnable);
- }
-
- /**
- * <p>
- * getProgressService
- * </p>
- *
- * @return a {@link org.eclipse.ui.progress.IProgressService} object.
- */
- public static IProgressService getProgressService() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- return workbench.getProgressService();
- }
-
- /**
- * <p>
- * getProgressService2
- * </p>
- *
- * @return a {@link org.eclipse.ui.progress.IWorkbenchSiteProgressService}
- * object.
- */
- public static IWorkbenchSiteProgressService getProgressService2() {
- return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
- }
-
- /**
- * <p>
- * getPluginId
- * </p>
- *
- * @return a {@link java.lang.String} object.
- */
- public static String getPluginId() {
- return "eu.taxeditor";
- }
-
- /**
- * <p>
- * getActiveEditor
- * </p>
- *
- * @return a {@link org.eclipse.ui.IEditorPart} object.
- */
- public static IEditorPart getActiveEditor() {
- return getActivePage() != null ? getActivePage().getActiveEditor()
- : null;
- }
-
- /**
- * <p>
- * getDetailsView
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart}
- * object.
- */
- public static DetailsViewPart getDetailsView() {
- return (DetailsViewPart) getView(DetailsViewPart.ID, false);
- }
-
- /**
- * <p>
- * refreshDetailsViewer
- * </p>
- */
- public static void refreshDetailsViewer() {
- if (getDetailsView() != null) {
- ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
- }
- }
-
- /**
- * <p>
- * reflowDetailsViewer
- * </p>
- */
- public static void reflowDetailsViewer() {
- if (getDetailsView() != null) {
- ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
- }
- }
-
- public static SupplementalDataViewPart getSupplementalDataView() {
- return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID,
- false);
- }
-
- public static void reflowSupplementalViewer() {
- if (getSupplementalDataView() != null) {
- ((AbstractCdmDataViewer) getSupplementalDataView().getViewer())
- .reflow();
- }
- }
+ statusLineManager.setMessage(message);
+ }
+
+ });
+
+ }
+
+ /**
+ * <p>
+ * getMonitor
+ * </p>
+ *
+ * @return a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ */
+ public static IProgressMonitor getMonitor() {
+ statusLineManager.setCancelEnabled(false);
+ return statusLineManager.getProgressMonitor();
+ }
+
+ /**
+ * Starts either the given {@link IProgressMonitor} if it's not
+ * <code>null</code> or a new {@link NullProgressMonitor}.
+ *
+ * @param progressMonitor
+ * The {@link IProgressMonitor} or <code>null</code> if no
+ * progress should be reported.
+ * @param taskName
+ * The name of the main task.
+ * @param steps
+ * The number of steps this task is subdivided into.
+ * @return The {@link IProgressMonitor}.
+ */
+ public static IProgressMonitor startMainMonitor(
+ IProgressMonitor progressMonitor, String taskName, int steps) {
+ IProgressMonitor newMonitor = progressMonitor;
+ if (newMonitor == null) {
+ newMonitor = new NullProgressMonitor();
+ }
+ newMonitor.beginTask(taskName == null ? "" : taskName, steps);
+ newMonitor.subTask(" ");
+ return newMonitor;
+ }
+
+ /**
+ * Creates a {@link SubProgressMonitor} if the given
+ * {@link IProgressMonitor} is not <code>null</code> and not a
+ * {@link NullProgressMonitor}.
+ *
+ * @param progressMonitor
+ * The parent {@link IProgressMonitor} of the
+ * {@link SubProgressMonitor} to be created.
+ * @param ticks
+ * The number of steps this subtask is subdivided into. Must be a
+ * positive number and must not be
+ * {@link IProgressMonitor#UNKNOWN}.
+ * @return The {@link IProgressMonitor}.
+ */
+ public static IProgressMonitor getSubProgressMonitor(
+ IProgressMonitor progressMonitor, int ticks) {
+ if (progressMonitor == null) {
+ return new NullProgressMonitor();
+ }
+ if (progressMonitor instanceof NullProgressMonitor) {
+ return progressMonitor;
+ }
+
+ return new SubProgressMonitor(progressMonitor, ticks);
+ }
+
+ /**
+ * Checks whether the user canceled this operation. If not canceled, the
+ * given number of steps are declared as done.
+ *
+ * @param newMonitor
+ * a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ * @param steps
+ * a int.
+ */
+ public static void workedChecked(IProgressMonitor newMonitor, int steps) {
+ // In case the progress monitor was canceled throw an exception.
+ if (newMonitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+ // Otherwise declare this step as done.
+ newMonitor.worked(steps);
+ }
+
+ /**
+ * Present a progress dialog to the user. This dialog will block the UI
+ *
+ * @param runnable
+ * an implementation of {@link IRunnableWithProgress}
+ * @throws java.lang.InterruptedException
+ * if any.
+ * @throws java.lang.reflect.InvocationTargetException
+ * if any.
+ */
+ public static void busyCursorWhile(IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ getProgressService().busyCursorWhile(runnable);
+ }
+
+ /**
+ * <p>
+ * runInUI
+ * </p>
+ *
+ * @see {@link IProgressService#runInUI(org.eclipse.jface.operation.IRunnableContext, IRunnableWithProgress, ISchedulingRule)}
+ * @param runnable
+ * a {@link org.eclipse.jface.operation.IRunnableWithProgress}
+ * object.
+ * @param rule
+ * a {@link org.eclipse.core.runtime.jobs.ISchedulingRule}
+ * object.
+ * @throws java.lang.reflect.InvocationTargetException
+ * if any.
+ * @throws java.lang.InterruptedException
+ * if any.
+ */
+ public static void runInUI(IRunnableWithProgress runnable,
+ ISchedulingRule rule) throws InvocationTargetException,
+ InterruptedException {
+ getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);
+ }
+
+ /**
+ * <p>
+ * run
+ * </p>
+ *
+ * @param fork
+ * a boolean.
+ * @param cancelable
+ * a boolean.
+ * @param runnable
+ * a {@link org.eclipse.jface.operation.IRunnableWithProgress}
+ * object.
+ * @throws java.lang.reflect.InvocationTargetException
+ * if any.
+ * @throws java.lang.InterruptedException
+ * if any.
+ */
+ public static void run(boolean fork, boolean cancelable,
+ IRunnableWithProgress runnable) throws InvocationTargetException,
+ InterruptedException {
+ getProgressService().run(fork, cancelable, runnable);
+ }
+
+ /**
+ * <p>
+ * getProgressService
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.progress.IProgressService} object.
+ */
+ public static IProgressService getProgressService() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ return workbench.getProgressService();
+ }
+
+ /**
+ * <p>
+ * getProgressService2
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.progress.IWorkbenchSiteProgressService}
+ * object.
+ */
+ public static IWorkbenchSiteProgressService getProgressService2() {
+ return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
+ }
+
+ /**
+ * <p>
+ * getPluginId
+ * </p>
+ *
+ * @return a {@link java.lang.String} object.
+ */
+ public static String getPluginId() {
+ return "eu.taxeditor";
+ }
+
+ /**
+ * <p>
+ * getActiveEditor
+ * </p>
+ *
+ * @return a {@link org.eclipse.ui.IEditorPart} object.
+ */
+ public static IEditorPart getActiveEditor() {
+ return getActivePage() != null ? getActivePage().getActiveEditor()
+ : null;
+ }
+
+ /**
+ * <p>
+ * getDetailsView
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart}
+ * object.
+ */
+ public static DetailsViewPart getDetailsView() {
+ return (DetailsViewPart) getView(DetailsViewPart.ID, false);
+ }
+
+ /**
+ * <p>
+ * refreshDetailsViewer
+ * </p>
+ */
+ public static void refreshDetailsViewer() {
+ if (getDetailsView() != null) {
+ ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
+ }
+ }
+
+ /**
+ * <p>
+ * reflowDetailsViewer
+ * </p>
+ */
+ public static void reflowDetailsViewer() {
+ if (getDetailsView() != null) {
+ ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
+ }
+ }
+
+ public static SupplementalDataViewPart getSupplementalDataView() {
+ return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID,
+ false);
+ }
+
+ public static void reflowSupplementalViewer() {
+ if (getSupplementalDataView() != null) {
+ ((AbstractCdmDataViewer) getSupplementalDataView().getViewer())
+ .reflow();
+ }
+ }
/**
}
+ public static void executeCommand(String commandId, Object source, String pluginId) {
+ IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
+ Exception exception = null;
+ try {
+ handlerService.executeCommand(commandId, null);
+ } catch (ExecutionException e) {
+ exception = e;
+ } catch (NotDefinedException e) {
+ exception = e;
+ } catch (NotEnabledException e) {
+ exception = e;
+ } catch (NotHandledException e) {
+ exception = e;
+ } finally {
+ if(exception != null) {
+ MessagingUtils.errorDialog("Error executing command",
+ source,
+ "Could not execute command with id " + commandId ,
+ pluginId,
+ exception,
+ true);
+ }
+ }
+ }
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.model;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-
-/**
- * Utility class for handling of authorship related elements.
- *
- * @author n.hoffmann
- * @created Sep 8, 2010
- * @version 1.0
- */
-public class AuthorHelper {
-
- /**
- * If the given {@link TeamOrPersonBase} is a {@link Person} this methods
- * creates a new {@link Team} with this person. If it already a team the
- * team is returned.
- *
- * @param teamOrPerson
- * a team or a person
- * @return the given team or a newly created team with the given person
- */
- public static Team getAuthor(TeamOrPersonBase<?> teamOrPerson){
- if(teamOrPerson == null){
- return null;
- }
- Object deproxiedObject = HibernateProxyHelper.deproxy(teamOrPerson);
- if(deproxiedObject instanceof Person){
- Person person = (Person) deproxiedObject;
- Team team = Team.NewInstance();
- team.addTeamMember(person);
- return team;
- }
- else if(deproxiedObject instanceof Team){
- return (Team) deproxiedObject;
- }else{
- throw new IllegalArgumentException("Given object os of the wrong type");
- }
- }
-}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.model;
+
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * @author k.luther
+ * @date Oct 7, 2015
+ *
+ */
+public class CdmDeleteErrorDialog extends ErrorDialog {
+
+
+ private static final int DIALOG_MAX_HEIGHT = 500;
+
+ private final String stackTrace;
+
+
+
+ /**
+ * @param parentShell
+ * @param dialogTitle
+ * @param message
+ * @param status
+ * @param stackTrace
+ */
+ public CdmDeleteErrorDialog(Shell parentShell,
+ String dialogTitle,
+ String message,
+ IStatus status,
+ String stackTrace,
+ Object[] updatedObjects) {
+ super(parentShell,
+ dialogTitle,
+ message, status,
+ IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
+ this.stackTrace = stackTrace;
+ this.message = message == null ? status.getMessage()
+ : message + "\n " + status.getMessage(); //$NON-NLS-1$
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
+ */
+ @Override
+ protected void buttonPressed(int id) {
+ super.buttonPressed(id);
+ if (id == IDialogConstants.DETAILS_ID) {
+ Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ // set height to max allowed
+ if(getShell().getSize().y > DIALOG_MAX_HEIGHT) {
+ getShell().setSize(getShell().getSize().x, 500);
+ } else {
+ getShell().setSize(getShell().getSize().x, oldSize.y);
+ }
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+}
String dialogTitle,
String message,
IStatus status,
- String stackTrace) {
+ String stackTrace,
+ boolean showStatusMessage) {
super(parentShell,
dialogTitle,
message, status,
IStatus.OK| IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
this.stackTrace = stackTrace;
+ String statusMessage = "";
+ if(showStatusMessage) {
+ statusMessage = status.getMessage();
+ }
+ this.message = message == null ? statusMessage : message + "\n " + statusMessage;
}
+
/**
* @param parentShell
* @param dialogTitle
String dialogTitle,
String message,
IStatus status) {
- this(parentShell, dialogTitle, message, status, "");
+ this(parentShell, dialogTitle, message, status, "", true);
}
/* (non-Javadoc)
new Transfer[] { TextTransfer.getInstance() });
}
}
+
+
}
*/
@Override
protected void javaToNative(Object object, TransferData transferData) {
- byte[] bytes = toByteArray((T[]) object);
- if (bytes != null)
- super.javaToNative(bytes, transferData);
+ if (object != null){
+ byte[] bytes = toByteArray((T[]) object);
+ if (bytes != null)
+ super.javaToNative(bytes, transferData);
+ }
}
/* (non-Javadoc)
@Override
protected Object nativeToJava(TransferData transferData) {
byte[] bytes = (byte[]) super.nativeToJava(transferData);
- return fromByteArray(bytes);
+ if (bytes != null){
+ return fromByteArray(bytes);
+ }
+ return null;
}
+
protected byte[] toByteArray(T[] elements) {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.model;
+import java.io.Serializable;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
* @version 1.0
*/
public class CdmProgressMonitorAdapter implements eu.etaxonomy.cdm.common.monitor.IProgressMonitor {
-
+
private IProgressMonitor progressMonitor;
private CdmProgressMonitorAdapter (IProgressMonitor monitor){
if(monitor == null){
monitor = new NullProgressMonitor();
}
-
+
this.progressMonitor = monitor;
}
-
+
/**
* <p>CreateMonitor</p>
*
public static CdmProgressMonitorAdapter CreateMonitor (IProgressMonitor monitor){
return new CdmProgressMonitorAdapter(monitor);
}
-
+
/**
* <p>CreateSubMonitor</p>
*
IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, ticks);
return new CdmProgressMonitorAdapter(subMonitor);
}
-
+
/** {@inheritDoc} */
@Override
public void beginTask(String name, int totalWork) {
public void internalWorked(double arg0) {
progressMonitor.internalWorked(arg0);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Serializable getFeedback() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean getIsWaitingForFeedback() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFeedback(Serializable arg0) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void waitForFeedback() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getOwner() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasFeedbackWaitTimedOut() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void interrupt() {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setOwner(String arg0) {
+
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void waitForFeedback(long arg0) {
+
+ }
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.model;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import eu.etaxonomy.cdm.api.service.DeleteResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+
+/**
+ * @author k.luther
+ * @date Oct 5, 2015
+ *
+ */
+public class DeleteResultMessagingUtils extends MessagingUtils {
+ /**
+ * Displays a message {@link org.eclipse.jface.dialogs.MessageDialog}.
+ *
+ * @param title
+ * @param source
+ * @param message
+ */
+ public static void messageDialogWithDetails(DeleteResult result, String message, String pluginId) {
+ if (result.isOk() && result.getExceptions().isEmpty()){
+ return;
+ }
+ List<String> details = new ArrayList<String>();
+ String title= "";
+
+ if (result.getExceptions().size() > 0){
+ for (Exception e:result.getExceptions()){
+ details.add(e.getMessage());
+ }
+ if (result.isOk()){
+ title = "Delete was successfull.";
+ } else {
+ title = "Delete was aborted.";
+ }
+ }
+ StringBuffer relatedObjectsString = new StringBuffer();
+ List<String> relatedObjects = new ArrayList<String>();
+ if (result.getUpdatedObjects().size() > 0){
+ Iterator<CdmBase> objects = result.getRelatedObjects().iterator();
+ while (objects.hasNext()){
+ CdmBase object = objects.next();
+ if (object instanceof IdentifiableEntity){
+
+ relatedObjects.add(((IdentifiableEntity)object).getTitleCache() );
+ } else{
+ relatedObjects.add(object.getUserFriendlyTypeName());
+ }
+
+ }
+
+ for (String relatedObject: relatedObjects){
+
+ relatedObjectsString.append(relatedObject);
+ relatedObjectsString.append(System.lineSeparator());
+ }
+ }
+ message = message + "\n" ;
+ String stackTraceWithContext = getContextInfo(details);
+ CdmDeleteErrorDialog ced = new CdmDeleteErrorDialog(AbstractUtility.getShell(), title, message,new Status(IStatus.INFO, pluginId, relatedObjectsString.toString(), result.getExceptions().iterator().next()), stackTraceWithContext, result.getUpdatedObjects().toArray());
+
+ ced.open();
+
+
+
+ }
+}
text = "No label provided";
}
- return "Description: " + text;
+ return text;
}
/**
if(derivedUnit != null){
return derivedUnit.getTitleCache();
}
- return "No text provided";
+ return "No unit chosen";
}
/**
/** Constant <code>LOCK_ICON="locked"</code> */
public static final String LOCK_ICON = "lock";
+ public static final String SYNCED = "synced";
+
/** Constant <code>LOCK_OPEN_ICON="lock_open"</code> */
public static final String LOCK_OPEN_ICON = "lock_open";
public static final String FIELD_UNIT = "field_unit";
public static final String FIELD_UNIT_CHARACTER_DATA = "field_unit_character_data";
public static final String SPECIMEN_DERIVATE = "specimen_derivate";
+ public static final String SPECIMEN_DERIVATE_TYPE = "specimen_derivate_type";
public static final String SPECIMEN_DERIVATE_CHARACTER_DATA = "specimen_derivate_character_data";
public static final String ARTWORK_DERIVATE = "artwork_derivate";
public static final String ARTWORK_DERIVATE_CHARACTER_DATA = "artwork_derivate_character_data";
"prj_obj.gif");
registerImage(registry, LOCK_ICON,
"lock.png");
+ registerImage(registry, SYNCED,
+ "synced.gif");
registerImage(registry, LOCK_OPEN_ICON,
"lock_open.png");
registerImage(registry, SWITCH_VIEW_TYPE,
"fieldunit_data-16x16-32.png");
registerImage(registry, SPECIMEN_DERIVATE,
"specimen_derivate-16x16-32.png");
+ registerImage(registry, SPECIMEN_DERIVATE_TYPE,
+ "specimen_derivate_type-16x16-32.png");
registerImage(registry, SPECIMEN_DERIVATE_CHARACTER_DATA,
"specimen_derivate_data-16x16-32.png");
registerImage(registry, ARTWORK_DERIVATE,
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.persistence.hibernate.permission.SecurityExceptionUtils;
+import eu.etaxonomy.cdm.test.integration.SecurityExceptionUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
public final static String CONTACT_MESSAGE = System.getProperty("line.separator") + "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
public final static String DEFAULT_MESSAGE = "Error thrown but no associated message";
+ public final static String CONNECTION_FAILURE_MESSAGE = "The connection to the remote server has been broken";
+ public final static String REMOTE_ACCESS_FAILURE_MESSAGE = "Problem accessing remote server";
+ public static final String WIDGET_IS_DISPOSED_MESSAGE = "A widget was called, which was already disposed";
/**
* Gets the Log4J logger for a given class
return stackTraceAndContextInfo.toString();
}
+ public static String getContextInfo(List<String> contextInfo) {
+ StringBuffer scontextInfoStringBuffer = new StringBuffer();
+
+
+ for(String infoItem : contextInfo) {
+ scontextInfoStringBuffer.append(infoItem + System.getProperty("line.separator"));
+ }
+
+
+
+ return scontextInfoStringBuffer.toString();
+ }
+
private static Throwable getDefaultThrowable() {
return new Throwable("Error thrown but no associated exception");
}
final Throwable t,
final List<String> contextInfo,
final String message,
- final MultiStatus status) {
+ final MultiStatus status,
+ final boolean showReason) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
String stackTraceWithContext = getStackTraceAndContextInfo(t, contextInfo);
- CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status, stackTraceWithContext);
+ CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status, stackTraceWithContext, showReason);
ced.open();
Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
});
}
+ public static void errorDialog(final String title,
+ final Object source,
+ final String message,
+ final String pluginId,
+ final Throwable t,
+ boolean addContactMesg) {
+ errorDialog(title, source, message, pluginId, t, addContactMesg, true);
+
+ }
/**
* Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
*
final String message,
final String pluginId,
final Throwable t,
- boolean addContactMesg) {
+ boolean addContactMesg,
+ boolean showReason) {
Throwable throwable = t;
StringBuffer sbStackTrace = new StringBuffer();
throwable.toString(),
throwable);
- errorDialog(title, source, throwable, contextInfo, finalMessage, ms);
+ errorDialog(title, source, throwable, contextInfo, finalMessage, ms, showReason);
}
/**
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IAmplificationService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IAmplificationService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IAmplificationService.class).save(getEntity());
+ }
}
/** {@inheritDoc} */
// $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.newWizard;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+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.model.taxon.Classification;
import eu.etaxonomy.taxeditor.store.CdmStore;
entity = CdmStore.getService(IClassificationService.class).load(entity.getUuid());
super.setEntity(entity);
}
-
+
@Override
public void addPages() {
classificationWizardPage = new ClassificationWizardPage(formFactory, getConversationHolder(), getEntity());
addPage(classificationWizardPage);
}
-
+
@Override
protected void saveEntity() {
- CdmStore.getService(IClassificationService.class).saveOrUpdate(getEntity());
+ //CdmStore.getService(IClassificationService.class).saveOrUpdate(getEntity());
+ Classification classification = getEntity();
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IClassificationService.class).merge(getEntity(), true);
+ CdmApplicationState.getCurrentDataChangeService()
+ .fireChangeEvent(new CdmChangeEvent(Action.Create, classification, NewTaxonNodeWizard.class), true);
+ } else {
+ CdmStore.getService(IClassificationService.class).save(getEntity());
+ }
+
}
@Override
// $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.
*/
public void addPages() {
addPage(new CollectionWizardPage(formFactory, getConversationHolder(), getEntity()));
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
*/
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(ICollectionService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(ICollectionService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(ICollectionService.class).save(getEntity());
+ }
}
/* (non-Javadoc)
protected String getEntityName() {
return "Collection";
}
-
+
}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.newWizard;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
/**
- * <p>NewDerivedUnitBaseWizard class.</p>
- *
* @author n.hoffmann
* @created Jun 16, 2010
* @version 1.0
*/
public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> implements IDerivedUnitFacadePart{
- private SpecimenOrObservationType specOrObsType = null;
+ private SpecimenOrObservationType specOrObsType = null;
- public NewDerivedUnitBaseWizard() {
- super();
- }
+ public NewDerivedUnitBaseWizard() {
+ super();
+ CdmStore.getCurrentSessionManager().bindNullSession();
+ }
- public NewDerivedUnitBaseWizard(SpecimenOrObservationType specOrObsType) {
- super();
- this.specOrObsType = specOrObsType;
- }
- /** {@inheritDoc} */
- @Override
- public void addPages() {
- DerivedUnitFacade facade = null;
- try {
- if(getEntity() instanceof DerivedUnit) {
- facade = DerivedUnitFacade.NewInstance((DerivedUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
- addPage(new DerivedUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new DerivedUnitBaseWizardPage(formFactory, getConversationHolder(), facade));
- }
- else if(getEntity() instanceof FieldUnit){
- facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
- addPage(new FieldUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
- }
- } catch (DerivedUnitFacadeNotSupportedException e) {
- // we should never get here
- throw new IllegalStateException();
- }
- }
+ public NewDerivedUnitBaseWizard(SpecimenOrObservationType specOrObsType) {
+ super();
+ this.specOrObsType = specOrObsType;
+ }
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ DerivedUnitFacade facade = null;
+ try {
+ if(getEntity() instanceof DerivedUnit) {
+ facade = DerivedUnitFacade.NewInstance((DerivedUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
+ addPage(new DerivedUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new DerivedUnitBaseWizardPage(formFactory, getConversationHolder(), facade));
+ }
+ else if(getEntity() instanceof FieldUnit){
+ facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
+ addPage(new FieldUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
+ }
+ } catch (DerivedUnitFacadeNotSupportedException e) {
+ // we should never get here
+ throw new IllegalStateException();
+ }
+ }
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#
- * createNewEntity()
- */
/** {@inheritDoc} */
@Override
protected SpecimenOrObservationBase createNewEntity() {
} else {
if (SpecimenOrObservationType.Media.equals(specOrObsType)
|| ((specOrObsType.getKindOf() != null) && specOrObsType.getKindOf().equals(SpecimenOrObservationType.Media))) {
- MediaSpecimen mediaSpecimen = MediaSpecimen.NewInstance(specOrObsType);
- //a MediaSpecimen with no media attached does not make sense. Hence, we add one
+ MediaSpecimen mediaSpecimen = MediaSpecimen.NewInstance(specOrObsType);
+ //a MediaSpecimen with no media attached does not make sense. Hence, we add one
mediaSpecimen.setMediaSpecimen(Media.NewInstance());
return mediaSpecimen;
} else if (specOrObsType.equals(SpecimenOrObservationType.FieldUnit)) {
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
- */
+
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IOccurrenceService.class).save(getEntity());
+ }
}
- @Override
- protected String getEntityName() {
- return "Specimen";
- }
+ @Override
+ protected String getEntityName() {
+ return "Specimen";
+ }
}
// $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.
*/
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IOccurrenceService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IOccurrenceService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IOccurrenceService.class).save(getEntity());
+ }
}
@Override
// $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.
*/
* @created Sept 13 2012
*/
public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
-
+
private GrantedAuthorityDetailWizardPage authorityPage;
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
*/
@Override
protected void saveEntity() {
- CdmStore.getService(IGrantedAuthorityService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IGrantedAuthorityService.class).save(getEntity());
+ }
}
/* (non-Javadoc)
// $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.
*/
public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
private GroupDetailWizardPage groupPage;
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
super.addPage(groupPage);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
*/
@Override
protected void saveEntity() {
- CdmStore.getService(IGroupService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IGroupService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IGroupService.class).save(getEntity());
+ }
}
/* (non-Javadoc)
// $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.
*/
public void addPages() {
addPage(new InstitutionWizardPage(formFactory, getConversationHolder(), getEntity()));
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
*/
@Override
protected void saveEntity() {
- CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IAgentService.class).save(getEntity());
+ }
}
/* (non-Javadoc)
// $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.
*/
public void addPages() {
addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
}
-
+
/** {@inheritDoc} */
@Override
protected NonViralName createNewEntity() {
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(INameService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(INameService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(INameService.class).save(getEntity());
+ }
}
@Override
// $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.
*/
public void addPages() {
addPage(new PersonWizardPage(formFactory, getConversationHolder(), getEntity()));
}
-
+
/** {@inheritDoc} */
@Override
protected Person createNewEntity() {
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IAgentService.class).save(getEntity());
+ }
}
@Override
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.newWizard;
public class NewPolytomousKeyWizard extends AbstractNewEntityWizard<PolytomousKey> {
private PolytomousKeyWizardPage polytomousKeyPage;
-
+
@Override
public void addPages() {
polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
super.addPage(polytomousKeyPage);
}
-
+
public String getPolytomousKeyName() {
return polytomousKeyPage.getPolytomousKeyName();
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
*/
@Override
protected void saveEntity() {
if(!polytomousKeyPage.getPolytomousKeyName().equals("")) {
- CdmStore.getService(IPolytomousKeyService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IPolytomousKeyService.class).save(getEntity());
+ }
}
}
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IPrimerService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IPrimerService.class).merge(getEntity(),true);
+ } else {
+ CdmStore.getService(IPrimerService.class).save(getEntity());
+ }
}
/** {@inheritDoc} */
// $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.
*/
* @version 1.0
*/
public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
-
+
private ReferenceWizardPage referencePage;
-
+
/** {@inheritDoc} */
@Override
public void addPages() {
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IReferenceService.class).saveOrUpdate(getEntity());
+ CdmStore.getService(IReferenceService.class).save(getEntity());
}
/** {@inheritDoc} */
*/
package eu.etaxonomy.taxeditor.newWizard;
+import java.util.HashSet;
+import java.util.Set;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+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;
*/
public class NewTaxonNodeWizard extends AbstractNewEntityWizard<ITaxonTreeNode>{
- private TaxonNodeWizardPage taxonNodePage;
- private boolean openEmptyEditor;
- private UUID generatedTaxonNodeUuid;
+ private TaxonNodeWizardPage taxonNodePage;
+ private boolean openEmptyEditor;
+ private UUID generatedTaxonNodeUuid;
private IWizardPageListener wizardPageListener;
- @Override
- public void addPages() {
- taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener);
- addPage(taxonNodePage);
- }
-
- @Override
- protected void saveEntity() {
- if(taxonNodePage.getTaxon() == null || StringUtils.isEmpty(taxonNodePage.getTaxon().getName().getFullTitleCache())){
- openEmptyEditor = true;
- }else{
- getConversationHolder().bind();
- ITaxonTreeNode parent = getParentTreeNode();
- Taxon taxon = taxonNodePage.getTaxon();
- try{
- TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference());
- generatedTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).saveOrUpdate(taxonNode);
- }catch(IllegalArgumentException e){
- MessagingUtils.warningDialog("Taxon already exists in classfication", getClass(), e.getMessage());
- }
- }
- }
-
- @Override
- protected ITaxonTreeNode createNewEntity() {
- if(getSelection() != null){
- Object selectedObject = getSelection().getFirstElement();
- if(selectedObject instanceof ITaxonTreeNode){
- ITaxonTreeNode treeNode = (ITaxonTreeNode) selectedObject;
-
- if(treeNode instanceof Classification){
- return CdmStore.getService(IClassificationService.class).load(treeNode.getUuid());
- }
- else if(treeNode instanceof TaxonNode){
- return CdmStore.getService(ITaxonNodeService.class).load(treeNode.getUuid());
- }
- }
- }
-
- return null;
- }
-
- /**
- * <p>openInEditor</p>
- *
- * @return a boolean.
- */
- public boolean openInEditor(){
- return taxonNodePage.openInEditor();
- }
-
- /**
- * <p>openEmpty</p>
- *
- * @return a boolean.
- */
- public boolean openEmpty(){
- return openInEditor() && openEmptyEditor;
- }
-
- /**
- * <p>getTaxonNode</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- */
- public TaxonNode getTaxonNode(){
- if(generatedTaxonNodeUuid != null){
- return CdmStore.getService(ITaxonNodeService.class).load(generatedTaxonNodeUuid);
- }
- return null;
- }
-
- public ITaxonTreeNode getParentTreeNode(){
- return taxonNodePage.getParentTreeNode();
- }
-
- @Override
- protected String getEntityName() {
- return "Taxon";
- }
-
- public void addWizardPageListener(IWizardPageListener wizardPageListener){
- this.wizardPageListener = wizardPageListener;
- }
+ @Override
+ public void addPages() {
+ taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener, true);
+
+ addPage(taxonNodePage);
+ }
+
+ @Override
+ protected void saveEntity() {
+ if(taxonNodePage.getTaxon() == null || StringUtils.isEmpty(taxonNodePage.getTaxon().getName().getFullTitleCache())){
+ openEmptyEditor = true;
+ }else{
+ getConversationHolder().bind();
+ ITaxonTreeNode parent = getParentTreeNode();
+ Taxon taxon = taxonNodePage.getTaxon();
+ Reference sec = taxon.getSec();
+ taxon.setSec(null);
+ try{
+ 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);
+ }*/
+ if (result.isOk()){
+ 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());
+ }
+ affectedObjects.add(parentNode);
+ }
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmApplicationState.getCurrentDataChangeService()
+ .fireChangeEvent(new CdmChangeEvent(Action.Create, affectedObjects, NewTaxonNodeWizard.class), true);
+ }
+ }else{
+ if (!result.isOk()){
+ if (!result.getExceptions().isEmpty()){
+ MessagingUtils.error(getClass(), "Taxon could not be created", result.getExceptions().iterator().next());
+ }else{
+ MessagingUtils.warn(getClass(), "Taxon could not be created");
+ }
+ }
+ }
+ }catch(IllegalArgumentException e){
+ MessagingUtils.warningDialog("Taxon already exists in classfication", getClass(), e.getMessage());
+ }
+ }
+ }
+
+ @Override
+ protected ITaxonTreeNode createNewEntity() {
+ if(getSelection() != null){
+ Object selectedObject = getSelection().getFirstElement();
+ if(selectedObject instanceof ITaxonTreeNode){
+ ITaxonTreeNode treeNode = (ITaxonTreeNode) selectedObject;
+
+ if(treeNode instanceof Classification){
+ return CdmStore.getService(IClassificationService.class).load(treeNode.getUuid());
+ }
+ else if(treeNode instanceof TaxonNode){
+ return CdmStore.getService(ITaxonNodeService.class).load(treeNode.getUuid());
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * <p>openInEditor</p>
+ *
+ * @return a boolean.
+ */
+ public boolean openInEditor(){
+ return taxonNodePage.openInEditor();
+ }
+
+ /**
+ * <p>openEmpty</p>
+ *
+ * @return a boolean.
+ */
+ public boolean openEmpty(){
+ return openInEditor() && openEmptyEditor;
+ }
+
+ /**
+ * <p>getTaxonNode</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
+ */
+ public TaxonNode getTaxonNode(){
+ if(generatedTaxonNodeUuid != null){
+ return CdmStore.getService(ITaxonNodeService.class).load(generatedTaxonNodeUuid);
+ }
+ return null;
+ }
+
+ public ITaxonTreeNode getParentTreeNode(){
+ return taxonNodePage.getParentTreeNode();
+ }
+
+ @Override
+ protected String getEntityName() {
+ return "Taxon";
+ }
+
+ public void addWizardPageListener(IWizardPageListener wizardPageListener){
+ this.wizardPageListener = wizardPageListener;
+ }
}
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.newWizard;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
+import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonWizardPage;
+
+/**
+ *
+ * @author pplitzner
+ * @date Jan 18, 2016
+ *
+ */
+public class NewTaxonWizard extends AbstractNewEntityWizard<Taxon> {
+
+ private TaxonWizardPage taxonWizardPage;
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), (NonViralName) getEntity().getName()));
+ taxonWizardPage = new TaxonWizardPage(formFactory, getConversationHolder(), getEntity());
+ addPage(taxonWizardPage);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected Taxon createNewEntity() {
+ return Taxon.NewInstance(NonViralName.NewInstance(null), null);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void saveEntity() {
+ CdmStore.getService(ITaxonService.class).save(getEntity());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(Taxon entity) {
+ super.setEntity(entity);
+ }
+
+ @Override
+ protected String getEntityName() {
+ return "Taxon";
+ }
+}
// $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.
*/
public void addPages() {
addPage(new TeamWizardPage(formFactory, getConversationHolder(), getEntity()));
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
*/
/** {@inheritDoc} */
@Override
protected void saveEntity() {
- CdmStore.getService(IAgentService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IAgentService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IAgentService.class).save(getEntity());
+ }
}
@Override
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.newWizard;
public class NewUserWizard extends AbstractNewEntityWizard<User> {
private UserDetailWizardPage userPage;
-
+
@Override
public void addPages() {
userPage = new UserDetailWizardPage(formFactory, getConversationHolder(), getEntity());
addPage(userPage);
}
-
+
@Override
protected void saveEntity() {
- CdmStore.getService(IUserService.class).saveOrUpdate(getEntity());
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmStore.getService(IUserService.class).merge(getEntity(), true);
+ } else {
+ CdmStore.getService(IUserService.class).save(getEntity());
+ }
}
@Override
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* Superclass for all operation that have to be committed imediately after execution.
* @version 1.0
*/
public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation {
- private IConversationEnabled conversationEnabled;
+ private final IConversationEnabled conversationEnabled;
protected ITaxonTreeNode parentNode;
+ /**
+ * <p>Constructor for AbstractPersistentPostOperation.</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.
+ */
+ protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
+ IPostOperationEnabled postOperationEnabled,
+ IConversationEnabled conversationEnabled) {
+ this(label, undoContext, postOperationEnabled, conversationEnabled, null);
+ }
+
/**
* <p>Constructor for AbstractPersistentPostOperation.</p>
*
*/
protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled);
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.conversationEnabled = conversationEnabled;
}
public AbstractPersistentPostOperation(String label,
IUndoContext undoContext, TaxonNode taxonNode,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, taxonNode, postOperationEnabled);
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, taxonNode, postOperationEnabled, cdmEntitySessionEnabled);
this.conversationEnabled = conversationEnabled;
+
}
/**
public AbstractPersistentPostOperation(String label,
IUndoContext undoContext, ITaxonTreeNode parentNode,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled);
+ IConversationEnabled conversationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.parentNode = parentNode;
this.conversationEnabled = conversationEnabled;
+
}
/* (non-Javadoc)
protected IStatus postExecute(CdmBase objectAffectedByOperation) {
Assert.isNotNull(conversationEnabled, "Operation has to have a valid conversation attached.");
-
+
if (!conversationEnabled.getConversationHolder().isClosed()){
conversationEnabled.getConversationHolder().bind();
conversationEnabled.getConversationHolder().commit(true);
*/
public void bind(){
conversationEnabled.getConversationHolder().bind();
+ if(getCdmEntitySessionEnabled() != null) {
+ getCdmEntitySessionEnabled().getCdmEntitySession().bind();
+ }
}
}
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* @author pplitzner
*/
protected IPostOperationEnabled postOperationEnabled;
+ private ICdmEntitySessionEnabled cdmEntitySessionEnabled;
+
/**
* <p>Constructor for AbstractPostOperation.</p>
this.postOperationEnabled = postOperationEnabled;
}
+ public AbstractPostOperation(String label, IUndoContext undoContext,
+ T element, IPostOperationEnabled postOperationEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ this(label, undoContext);
+ this.element = element;
+ this.postOperationEnabled = postOperationEnabled;
+ this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
+ }
+
/**
* This method will try to call the post operation on a possibly registered
* IPostOperationEnabled implementor. Objects that were affected by the operation
* @return a {@link org.eclipse.core.runtime.IStatus} object.
*/
protected IStatus postExecute(CdmBase objectAffectedByOperation) {
- if(postOperationEnabled != null){
- return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
+
+ if(postOperationEnabled != null){
+ return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
}
/**
* @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public IPostOperationEnabled getPostOperationEnabled() {
- return postOperationEnabled;
+ return postOperationEnabled;
+ }
+
+// protected IStatus updateSession(CdmBase clientObjectAffectedByOperation, UpdateResult updateResult) {
+// Set<CdmBase> affectedObjects;
+// if(updateResult == null) {
+// affectedObjects = new HashSet<CdmBase>();
+// } else {
+// affectedObjects = updateResult.getUpdatedObjects();
+// }
+//
+// if(cdmEntitySessionEnabled != null) {
+// cdmEntitySessionEnabled.getCdmEntitySession().update(clientObjectAffectedByOperation, affectedObjects);
+// }
+// return Status.OK_STATUS;
+// }
+//
+// protected IStatus updateSession(UUID uuid) {
+//
+// if(cdmEntitySessionEnabled != null) {
+// CdmBase cdmBase = cdmEntitySessionEnabled.getCdmEntitySession().remoteLoad(CdmStore.getService(IService.class),uuid);
+// cdmEntitySessionEnabled.getCdmEntitySession().update(null, cdmBase);
+// }
+// return Status.OK_STATUS;
+// }
+
+ public ICdmEntitySessionEnabled getCdmEntitySessionEnabled() {
+ return cdmEntitySessionEnabled;
}
}
\ No newline at end of file
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.operation;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* <p>Abstract AbstractPostOperation class.</p>
*/
public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<Taxon> {
- /**
- * A reference to the taxons TaxonNode
- */
- protected ITaxonTreeNode taxonNode;
-
- protected UUID parentNodeUuid;
-
-
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
- Taxon taxon, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, taxon, postOperationEnabled);
- }
-
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){
- this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled);
- this.taxonNode = taxonNode;
- }
-
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param parentNodeUuid a {@link java.util.UUID} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
- super(label, undoContext, null, postOperationEnabled);
- this.parentNodeUuid = parentNodeUuid;
- }
-
- /**
- * <p>Constructor for AbstractPostOperation.</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.
- */
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
- IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, null, postOperationEnabled);
- }
+ /**
+ * A reference to the taxons TaxonNode
+ */
+ protected ITaxonTreeNode taxonNode;
+
+ protected UUID parentNodeUuid;
+
+
+ /**
+ * <p>Constructor for AbstractPostOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ */
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+ Taxon taxon, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, taxon, postOperationEnabled, null);
+ }
+
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+ Taxon taxon, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled);
+ }
+
+ /**
+ * <p>Constructor for AbstractPostOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ */
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){
+ this(label, undoContext, taxonNode, postOperationEnabled, null);
+ }
+
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled){
+ this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled, cdmEntitySessionEnabled);
+ this.taxonNode = taxonNode;
+ }
+
+ /**
+ * <p>Constructor for AbstractPostOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param parentNodeUuid a {@link java.util.UUID} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ */
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
+ super(label, undoContext, null, postOperationEnabled, null);
+ this.parentNodeUuid = parentNodeUuid;
+ }
+
+ /**
+ * <p>Constructor for AbstractPostOperation.</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.
+ */
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+ IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, null, postOperationEnabled, null);
+ }
+
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
+ IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, null, postOperationEnabled, cdmEntitySessionEnabled);
+ }
/**
* @param text
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+
+/**
+ * Default implementation of the {@link IFeedbackGenerator} interface.
+ *
+ * @author cmathew
+ * @date 29 Oct 2015
+ *
+ */
+public abstract class FeedbackGenerator implements IFeedbackGenerator {
+
+
+ /**
+ * Generates feedback for a waiting remoting progress monitor
+ *
+ * @return feedback object
+ */
+ public abstract Serializable generateFeedback();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFeedbackForMonitor(final UUID uuid) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ CdmApplicationState.getCurrentAppConfig().getProgressMonitorService().setFeedback(uuid, generateFeedback());
+ }
+ });
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.util.UUID;
+
+/**
+ * Generates feeback for waiting remoting progress monitors.
+ * The default implementation of this interface is {@link FeedbackGenerator}
+ *
+ * @author cmathew
+ * @date 28 Oct 2015
+ *
+ */
+public interface IFeedbackGenerator {
+
+ /**
+ * Generates and sets feedback for a waiting remoting progress
+ * monitor corresponding to the given uuid.
+ *
+ * @param uuid of target waiting remoting progress monitor
+ */
+ public void setFeedbackForMonitor(UUID uuid);
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+
+/**
+ * @author cmathew
+ * @date 22 Oct 2015
+ *
+ */
+public interface IPostMoniteredOperationEnabled {
+
+
+ public void postOperation(IRemotingProgressMonitor monitor);
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 21 Jul 2015
+ *
+ */
+public abstract class RemotingCdmDefaultOperation extends RemotingCdmOperation {
+
+ private CdmBase cdmEntity;
+
+ public RemotingCdmDefaultOperation(String label, Action action, Object source, boolean async) {
+ super(label, action, source, async);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected boolean doExecute(IProgressMonitor monitor, IAdaptable info) {
+ try {
+ cdmEntity = doSimpleExecute(monitor, info);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return true;
+ }
+
+ protected abstract CdmBase doSimpleExecute(IProgressMonitor monitor, IAdaptable info) throws Exception;
+
+ @Override
+ protected void postExecute(boolean success) {
+ if(success && cdmEntity != null) {
+ fireDataChangeEvent(cdmEntity);
+ }
+
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#onComplete(boolean)
+ */
+ @Override
+ protected IStatus onComplete(boolean success) {
+ return Status.OK_STATUS;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ * @author cmathew
+ * @date 16 Jun 2015
+ *
+ */
+public abstract class RemotingCdmHandler extends AbstractHandler {
+
+ private final String label;
+
+ public RemotingCdmHandler(String label) {
+ this.label = label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStatus allowStatus = allowOperations(event);
+ if(allowStatus.isOK()) {
+ AbstractOperation op = prepareOperation(event);
+ if(op != null) {
+ AbstractUtility.executeOperation(op, this);
+ }
+ } else if(allowStatus.getSeverity() == IStatus.ERROR ||
+ allowStatus.getSeverity() == IStatus.WARNING ||
+ allowStatus.getSeverity() == IStatus.INFO) {
+ MessagingUtils.warningDialog("Can not perform " + label, event.getTrigger(), allowStatus);
+ }
+ return null;
+ }
+
+ public void postOperation(IStatus status) {
+
+ switch(status.getSeverity()) {
+ case IStatus.WARNING:
+ ErrorDialog.openError(null, "Operation successful but with warnings", null, status);
+ break;
+ case IStatus.ERROR:
+ ErrorDialog.openError(null, "Error executing operation", null, status);
+ break;
+ default:
+ }
+
+ onComplete();
+ }
+
+ public abstract IStatus allowOperations(ExecutionEvent event);
+
+ public abstract AbstractOperation prepareOperation(ExecutionEvent event);
+
+ public abstract void onComplete();
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 16 Jun 2015
+ *
+ */
+public abstract class RemotingCdmOperation extends AbstractOperation {
+
+ private final Object source;
+ private final Action action;
+ private final boolean async;
+ protected Class entityType;
+
+ public RemotingCdmOperation(String label, Action action, Object source, boolean async) {
+ super(label);
+ this.source = source;
+ this.action = action;
+ this.async = async;
+ }
+
+ /* (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 {
+
+ boolean success = doExecute(monitor, info);
+ postExecute(success);
+ return onComplete(success);
+ }
+
+ protected abstract boolean doExecute(IProgressMonitor monitor, IAdaptable info);
+
+ protected void postExecute(boolean success) {}
+
+ protected abstract IStatus onComplete(boolean success);
+
+ protected void fireDataChangeEvent(Set<CdmBase> changedObjects) {
+ if(changedObjects != null && !changedObjects.isEmpty()) {
+ CdmApplicationState.getCurrentDataChangeService().fireChangeEvent(new CdmChangeEvent(action, changedObjects, source.getClass()), async);
+ }
+ }
+
+ protected void fireDataChangeEvent(UpdateResult updateResult) {
+ Set<CdmBase> updatedObjects = updateResult.getUpdatedObjects();
+ CdmApplicationState.getCurrentDataChangeService()
+ .fireChangeEvent(new CdmChangeEvent(action, updatedObjects, source.getClass(), entityType), async);
+ }
+
+ protected void fireDataChangeEvent(CdmBase cdmBase) {
+ if(cdmBase != null) {
+ CdmApplicationState.getCurrentDataChangeService().fireChangeEvent(new CdmChangeEvent(action, cdmBase, source.getClass()), async);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.operation;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+
+/**
+ * @author cmathew
+ * @date 16 Jun 2015
+ *
+ */
+public abstract class RemotingCdmUpdateOperation extends RemotingCdmOperation {
+
+ private UpdateResult updateResult;
+ public static boolean throwExceptions = false;
+
+ /**
+ * @param label
+ */
+ public RemotingCdmUpdateOperation(String label, Action action, Object source, boolean async) {
+ super(label, action, source, async);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected boolean doExecute(IProgressMonitor monitor, IAdaptable info) {
+ try {
+ updateResult = doUpdateExecute(monitor, info);
+ } catch (Exception e) {
+ if(throwExceptions) {
+ throw new RuntimeException(e);
+ } else {
+ UpdateResult exceptionResult = new UpdateResult();
+ exceptionResult.addException(e);
+ exceptionResult.setAbort();
+ updateResult = exceptionResult;
+ }
+ }
+ return updateResult.isOk();
+ }
+
+ protected abstract UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception;
+
+ @Override
+ protected void postExecute(boolean success) {
+ if(success && updateResult != null) {
+ fireDataChangeEvent(updateResult);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmOperation#onComplete(boolean)
+ */
+ @Override
+ protected IStatus onComplete(boolean success) {
+
+ if(updateResult != null) {
+ int statusFlag = IStatus.OK;
+
+ Collection<Exception> exceptions = updateResult.getExceptions();
+ StringBuffer statusMsg = new StringBuffer();
+ if(success && updateResult.isOk()) {
+ if(exceptions.isEmpty()) {
+ return Status.OK_STATUS;
+ } else {
+ statusFlag = IStatus.WARNING;
+ statusMsg.append(getLabel() + " executed sucessfully but with warnings." + System.lineSeparator());
+ }
+ } else if (updateResult.isError()) {
+ statusFlag = IStatus.ERROR;
+ statusMsg.append(getLabel() + " failed." + System.lineSeparator());
+ } else if (updateResult.isAbort()) {
+ statusFlag = IStatus.ERROR;
+ statusMsg.append(getLabel() + " aborted." + System.lineSeparator());
+ }
+
+ Status[] childStatus = new Status[exceptions.size()];
+ int count = 0;
+ Set<String> messages = new HashSet<String>();
+ for(Exception ex : exceptions) {
+ Status status = new Status(statusFlag,
+ "unknown",
+ statusFlag,
+ ex.getLocalizedMessage(),
+ ex);
+ messages.add(ex.getLocalizedMessage());
+ childStatus[count] = status;
+ count++;
+ }
+
+ statusMsg.append("Please click on the 'Details' button to see all the errors / warnings");
+
+ MultiStatus multiStatus = new MultiStatus("unknown",
+ statusFlag,
+ childStatus,
+ statusMsg.toString(),
+ null);
+ return multiStatus;
+ }
+ return null;
+ }
+}
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.strategy.match.MatchException;
+import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator.MatchStrategy;
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
* @param unparsedNameString a {@link java.lang.String} object.
* @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
*/
- public static TaxonNameBase parseReferencedName(String unparsedNameString, Rank rank){
- TaxonNameBase name = nonViralNameParser.parseReferencedName(unparsedNameString,
+ public static NonViralName parseReferencedName(String unparsedNameString, Rank rank){
+ NonViralName name = nonViralNameParser.parseReferencedName(unparsedNameString,
PreferencesUtil.getPreferredNomenclaturalCode(), rank);
// if (name.hasProblem()) {
return name;
}
- public static TaxonNameBase parseName(String unparsedNameString, Rank rank){
- TaxonNameBase name = nonViralNameParser.parseFullName(unparsedNameString,
+ public static NonViralName parseName(String unparsedNameString, Rank rank){
+ NonViralName name = nonViralNameParser.parseFullName(unparsedNameString,
PreferencesUtil.getPreferredNomenclaturalCode(), rank);
return name;
*
* @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
*/
- public static TaxonNameBase createEmptyName(){
+ public static NonViralName createEmptyName(){
return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode());
}
return new ArrayList<INomenclaturalReference>();
}
try{
- return CdmStore.getCommonService().findMatching(nomenclaturalReference, MatchStrategyConfigurator.ReferenceMatchStrategy());
+
+ return CdmStore.getCommonService().findMatching(nomenclaturalReference, MatchStrategy.Reference);
+
}catch (MatchException e) {
MessagingUtils.error(this.getClass(), "Error finding matching references", e);
}
}
try{
- return CdmStore.getCommonService().findMatching(authorTeam, MatchStrategyConfigurator.TeamOrPersonMatchStrategy());
+
+ return CdmStore.getCommonService().findMatching(authorTeam, MatchStrategy.TeamOrPerson);
+
}catch (MatchException e) {
MessagingUtils.error(this.getClass(), "Error finding matching authors", e);
}
private List<TaxonNameBase> findMatchingLatinNames(TaxonNameBase taxonNameBase) {
try {
- return CdmStore.getCommonService().findMatching(taxonNameBase, MatchStrategyConfigurator.NonViralNameMatchStrategy());
+
+ return CdmStore.getCommonService().findMatching(taxonNameBase, MatchStrategy.NonViralName);
+
} catch (MatchException e) {
MessagingUtils.error(this.getClass(), "Error finding matching names", e);
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.preference;
*/
public class CdmStorePropertyTester extends PropertyTester {
- private static final String EDITOR_IS_CONNECTED_TO_DB = "isCdmStoreConnected";
+ private static final String EDITOR_IS_CONNECTED_TO_DB = "isCdmStoreConnected";
+ private static final String IS_REMOTING = "isRemoting";
+ private static final String IS_STANDALONE = "isStandAlone";
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+
+ if(EDITOR_IS_CONNECTED_TO_DB.equals(property)){
+ return isCdmStoreConnected();
+ }
+
+ if(IS_REMOTING.equals(property)){
+ if(!isCdmStoreConnected()) {
+ return false;
+ } else {
+ return isRemoting();
+ }
+ }
+
+ if(IS_STANDALONE.equals(property)){
+ if(!isCdmStoreConnected()) {
+ return false;
+ } else {
+ return !isRemoting();
+ }
+ }
+ return false;
+ }
+
+ private boolean isCdmStoreConnected(){
+ boolean active = CdmStore.isActive();
+ return active;
+ }
+
+ private boolean isRemoting() {
+ return CdmStore.getCurrentSessionManager().isRemoting();
- @Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
+ }
- if(EDITOR_IS_CONNECTED_TO_DB.equals(property)){
- return isCdmStoreConnected();
- }
- return false;
- }
- private boolean isCdmStoreConnected(){
- boolean active = CdmStore.isActive();
- return active;
- }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.preference;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author k.luther
+ * @date 01.04.2016
+ *
+ */
+public class DebugPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(IPreferenceKeys.IS_SHOW_UP_WIDGET_IS_DISPOSED,
+ "Show up widget is disposed error messages.",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.DISABLE_SERVICES_API_TIMESTAMP_CHECK,
+ "Disable services api timestamp check",
+ getFieldEditorParent()));
+
+ }
+
+}
import java.util.List;
-import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ListViewer;
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @created Sep 16, 2010
* @version 1.0
*/
-public class DefaultFeatureTreePreferenecs extends PreferencePage implements IWorkbenchPreferencePage {
+public class DefaultFeatureTreePreferenecs extends CdmPreferencePage implements IWorkbenchPreferencePage {
private FeatureTree defaultFeatureTreeForTextualDescription;
private FeatureTree defaultFeatureTreeForStructuredDescription;
package eu.etaxonomy.taxeditor.preference;
-import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
* @created Aug 5, 2010
* @version 1.0
*/
-public class FeatureTreePreferences extends PreferencePage implements
+public class FeatureTreePreferences extends CdmPreferencePage implements
IWorkbenchPreferencePage {
/**
public static final String SORT_RANKS_HIERARCHICHALLY = "eu.etaxonomy.taxeditor.menus.sortRanksHierarchichally";
/** Constant <code>SORT_NODES_NATURALL="eu.etaxonomy.taxeditor.menus.sortNodesN"{trunked}</code> */
public static final String SORT_NODES_NATURALLY = "eu.etaxonomy.taxeditor.menus.sortNodesNaturally";
-
+ /** Constant <code>SORT_NODES_NATURALL="eu.etaxonomy.taxeditor.menus.sortNodesN"{trunked}</code> */
+ public static final String SORT_NODES_ALPHABETICALLY = "eu.etaxonomy.taxeditor.menus.sortNodesAlphabetically";
+ /** Constant <code>RESTORE_NAVIGATOR_STATE="eu.etaxonomy.taxeditor.taxonnavigator.restoreState"{trunked}</code> */
+ public static final String RESTORE_NAVIGATOR_STATE = "eu.etaxonomy.taxeditor.taxonnavigator.restoreState";
/**
* Whether multilanguage text fields should be editable in multiple languages.
*/
public static final String SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS = "eu.etaxonomy.taxeditor.navigation.search.openResultInSeparateWindows";
+ public static final String DISABLE_SERVICES_API_TIMESTAMP_CHECK = "eu.etaxonomy.taxeditor.cdmlib.remoting.disableServicesApiTimestampCheck";
+
public static final String ADD_TYPES_TO_ALL_NAMES = "eu.etaxonomy.taxeditor.store.addTypeToAllNames";
public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
+ public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
+
// TODO RL
public static final String IS_RL = "eu.etaxonomy.taxeditor.isRL";
public static final String DEFAULT_LANGUAGE_EDITOR = "eu.etaxonomy.taxeditor.default.language";
+ public static final String IS_SHOW_UP_WIDGET_IS_DISPOSED = "eu.etaxonomy.taxeditor.isShowUpWidgetIsDisposed";
+
/**
* Key for the saved P2 repositories
*/
@Override
public void widgetSelected(SelectionEvent e) {
int selectionIndex = combo_globalLanguage.getSelectionIndex();
- globalLanguage = Language.getLanguageByLabel(combo_globalLanguage.getItem(selectionIndex));
+ globalLanguage = CdmStore.getCurrentApplicationConfiguration().getTermService().getLanguageByLabel(combo_globalLanguage.getItem(selectionIndex));
}
});
}
// $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.preference;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
* @created Feb 4, 2011
* @version 1.0
*/
-public class MobotOpenUrlPreferences extends PreferencePage implements
+public class MobotOpenUrlPreferences extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
- private String openUrlServiceAccessPoint;
- private String openUrlImageMaxWidth;
- private String openUrlImageMaxHeight;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- @Override
- public void init(IWorkbench workbench) {
- setPreferenceStore(PreferencesUtil.getPreferenceStore());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
- * .swt.widgets.Composite)
- */
- @Override
- protected Control createContents(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- final GridLayout gridLayout = new GridLayout();
- container.setLayout(gridLayout);
-
- creatOpenUrlServiceAccessPoint(container);
-
- createOpenUrlImageSize(container);
-
- return container;
- }
-
- /**
- * @param container
- */
- private void createOpenUrlImageSize(Composite container) {
- openUrlImageMaxWidth = getPreferenceStore().getString(
- IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH);
- openUrlImageMaxHeight = getPreferenceStore().getString(
- IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT);
-
- Composite composite = new Composite(container, SWT.NULL);
- final GridLayout gridLayout = new GridLayout(2, false);
- composite.setLayout(gridLayout);
-
- final CLabel labelWidth = new CLabel(composite, SWT.NULL);
- labelWidth.setText("Image Maximum Width: ");
-
- final Text textWidth = new Text(composite, SWT.BORDER);
- textWidth.setText(openUrlImageMaxWidth);
- textWidth.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- textWidth.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- openUrlImageMaxWidth = textWidth.getText();
- }
- });
-
- final CLabel labelHeight = new CLabel(composite, SWT.NULL);
- labelHeight.setText("Image Maximum Height: ");
-
- final Text textHeight = new Text(composite, SWT.BORDER);
- textHeight.setText(openUrlImageMaxHeight);
- textHeight.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- textHeight.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- openUrlImageMaxHeight = textHeight.getText();
- }
- });
- }
-
- private void creatOpenUrlServiceAccessPoint(Composite composite) {
- openUrlServiceAccessPoint = getPreferenceStore().getString(
- IPreferenceKeys.OPENURL_ACCESS_POINT);
-
- final CLabel label = new CLabel(composite, SWT.NULL);
- label.setText("Mobot Open Url Service Access Point:");
-
- final Text text = new Text(composite, SWT.BORDER);
- text.setText(openUrlServiceAccessPoint);
- text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- text.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- openUrlServiceAccessPoint = text.getText();
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_ACCESS_POINT,
- openUrlServiceAccessPoint);
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH,
- openUrlImageMaxWidth);
- getPreferenceStore().setValue(IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT,
- openUrlImageMaxHeight);
-
- return super.performOk();
- }
+ @Override
+ protected void createFieldEditors() {
+ addField(new StringFieldEditor(
+ IPreferenceKeys.OPENURL_ACCESS_POINT,
+ "Mobot Open Url Service Access Point:", getFieldEditorParent()));
+ addField(new IntegerFieldEditor(
+ IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH,
+ "Image Maximum Width:",
+ getFieldEditorParent()));
+ addField(new IntegerFieldEditor(
+ IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT,
+ "Image Maximum Height:",
+ getFieldEditorParent()));
+
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ }
}
package eu.etaxonomy.taxeditor.preference;\r
\r
-import java.io.IOException;\r
-\r
import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.jface.preference.PreferencePage;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.events.SelectionAdapter;\r
import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.layout.GridLayout;\r
import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Label;\r
import org.eclipse.ui.IWorkbench;\r
import org.eclipse.ui.IWorkbenchPreferencePage;\r
-import org.eclipse.ui.PlatformUI;\r
\r
import eu.etaxonomy.taxeditor.Messages;\r
\r
public class OrderPreferences extends PreferencePage implements IWorkbenchPreferencePage {\r
- \r
+\r
\r
boolean isNaturalOrderActivated;\r
+ boolean isAlphabeticalOrderActivated;\r
+ boolean isRankAndNameOrderActivated;\r
+ boolean isRestoreTaxonNavigator;\r
boolean isSelectionChanged = false;\r
+ boolean isStrictlyAlphabeticallyOrdered;\r
/*\r
* (non-Javadoc)\r
*\r
@Override\r
protected Control createContents(Composite parent) {\r
\r
- Composite composite = new Composite(parent, SWT.NULL);\r
+ isRestoreTaxonNavigator = PreferencesUtil.isStoreNavigatorState();\r
+\r
+ Composite secondComposite = new Composite(parent, SWT.NULL);\r
+ secondComposite.setLayout(new GridLayout());\r
+\r
+ final Button activateRestoreNavigatorButton = new Button(secondComposite, SWT.CHECK | SWT.LEFT);\r
+ activateRestoreNavigatorButton.setText("Restore the last Taxon Navigator state.");\r
+ activateRestoreNavigatorButton.setSelection(isRestoreTaxonNavigator);\r
+ activateRestoreNavigatorButton.addSelectionListener(new SelectionAdapter(){\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if(isRestoreTaxonNavigator != activateRestoreNavigatorButton.getSelection()) {\r
+ isRestoreTaxonNavigator = activateRestoreNavigatorButton.getSelection();\r
+ PreferencesUtil.setStoreNavigatorState(isRestoreTaxonNavigator);\r
+ }\r
+ }\r
+\r
+ });\r
+\r
+\r
+ Composite composite = new Composite(parent, SWT.NULL);\r
composite.setLayout(new GridLayout());\r
- final Label description = new Label(parent, SWT.NONE);\r
- description.setText(Messages.OrderPreferencePage_NewNavigatorWindowRequired);\r
- isNaturalOrderActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SORT_NODES_NATURALLY);\r
- final Button activateCheckButton = new Button(composite, SWT.CHECK);\r
- activateCheckButton.setText("Enable Natural Order");\r
- activateCheckButton.setSelection(isNaturalOrderActivated);\r
- activateCheckButton.addSelectionListener(new SelectionAdapter(){\r
+\r
+ isNaturalOrderActivated = PreferencesUtil.getSortNodesNaturally();\r
+ final Button activateNaturalOrderCheckButton = new Button(composite, SWT.RADIO);\r
+ activateNaturalOrderCheckButton.setText("Enable Natural Order");\r
+ activateNaturalOrderCheckButton.setSelection(isNaturalOrderActivated);\r
+\r
+ isRankAndNameOrderActivated = !PreferencesUtil.getSortNodesStrictlyAlphabetically() && !PreferencesUtil.getSortNodesNaturally();\r
+ final Button activateRankAndNameOrderActivatedCheckButton = new Button(composite, SWT.RADIO);\r
+ activateRankAndNameOrderActivatedCheckButton.setText("Enable Rank and Aplhabetical Order");\r
+ activateRankAndNameOrderActivatedCheckButton.setSelection(isRankAndNameOrderActivated);\r
+\r
+ isAlphabeticalOrderActivated = PreferencesUtil.getSortNodesStrictlyAlphabetically();\r
+ final Button activateAlphabeticallyOrderedCheckButton = new Button(composite, SWT.RADIO);\r
+ activateAlphabeticallyOrderedCheckButton.setText("Enable Alphabetical Order");\r
+ activateAlphabeticallyOrderedCheckButton.setSelection(isAlphabeticalOrderActivated);\r
+\r
+ activateNaturalOrderCheckButton.addSelectionListener(new SelectionAdapter(){\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if(isNaturalOrderActivated != activateNaturalOrderCheckButton.getSelection()) {\r
+ isNaturalOrderActivated = activateNaturalOrderCheckButton.getSelection();\r
+ if (isAlphabeticalOrderActivated && isNaturalOrderActivated){\r
+ isAlphabeticalOrderActivated = false;\r
+ PreferencesUtil.setSortNodesStrictlyAlphabetically(isAlphabeticalOrderActivated);\r
+ }\r
+ if (isRankAndNameOrderActivated && isNaturalOrderActivated){\r
+ isRankAndNameOrderActivated = false;\r
+ }\r
+ PreferencesUtil.setSortNodesNaturally(isNaturalOrderActivated);\r
+ isSelectionChanged = true;\r
+ }else{\r
+ isSelectionChanged = false;\r
+ }\r
+\r
+ }\r
+ });\r
+ activateAlphabeticallyOrderedCheckButton.addSelectionListener(new SelectionAdapter(){\r
@Override\r
public void widgetSelected(SelectionEvent e) {\r
- if(isNaturalOrderActivated != activateCheckButton.getSelection()) {\r
- isNaturalOrderActivated = activateCheckButton.getSelection();\r
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SORT_NODES_NATURALLY, isNaturalOrderActivated);\r
+ if(isAlphabeticalOrderActivated != activateAlphabeticallyOrderedCheckButton.getSelection()) {\r
+ isAlphabeticalOrderActivated = activateAlphabeticallyOrderedCheckButton.getSelection();\r
+ if (isNaturalOrderActivated && isAlphabeticalOrderActivated){\r
+ isNaturalOrderActivated = false;\r
+ PreferencesUtil.setSortNodesNaturally(isNaturalOrderActivated);\r
+ }\r
+ if (isRankAndNameOrderActivated && isAlphabeticalOrderActivated){\r
+ isRankAndNameOrderActivated = false;\r
+ }\r
+ PreferencesUtil.setSortNodesStrictlyAlphabetically(isAlphabeticalOrderActivated);\r
isSelectionChanged = true;\r
}else{\r
isSelectionChanged = false;\r
}\r
});\r
\r
- \r
+ activateRankAndNameOrderActivatedCheckButton.addSelectionListener(new SelectionAdapter(){\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ if(isRankAndNameOrderActivated != activateRankAndNameOrderActivatedCheckButton.getSelection()) {\r
+ isRankAndNameOrderActivated = activateRankAndNameOrderActivatedCheckButton.getSelection();\r
+ if (isAlphabeticalOrderActivated && isRankAndNameOrderActivated){\r
+ isAlphabeticalOrderActivated = false;\r
+ }\r
+ if (isNaturalOrderActivated && isRankAndNameOrderActivated){\r
+ isNaturalOrderActivated = false;\r
+ }\r
+\r
+ if (isRankAndNameOrderActivated ||(!isNaturalOrderActivated && !isAlphabeticalOrderActivated)){\r
+ PreferencesUtil.setSortNodesStrictlyAlphabetically(false);\r
+ PreferencesUtil.setSortNodesNaturally(false);\r
+ }\r
+ isSelectionChanged = true;\r
+ }else{\r
+ isSelectionChanged = false;\r
+ }\r
+\r
+ }\r
+ });\r
+\r
+\r
+\r
+\r
+\r
+ final Label description = new Label(parent, SWT.NONE);\r
+ description.setText(Messages.OrderPreferencePage_NewNavigatorWindowRequired);\r
\r
return composite;\r
}\r
\r
- \r
+\r
@Override\r
public void init(IWorkbench workbench) {\r
// TODO Auto-generated method stub\r
- \r
+\r
}\r
\r
/* (non-Javadoc)\r
@Override\r
public boolean performOk() {\r
if(isSelectionChanged){\r
- MessageDialog.openInformation(getShell(), null, Messages.OrderPreferencePage_PleaseReopenNavigator); \r
+ MessageDialog.openInformation(getShell(), null, Messages.OrderPreferencePage_PleaseReopenNavigator);\r
+ isSelectionChanged = false;\r
return super.performOk();\r
}\r
return true;\r
* @return
*/
private static String getPreferenceKey(ICdmBase cdmBase) {
- cdmBase = (ICdmBase) HibernateProxyHelper.deproxy(cdmBase);
+ cdmBase = HibernateProxyHelper.deproxy(cdmBase);
String key = cdmBase.getClass().getName().concat(".")
.concat(cdmBase.getUuid().toString());
* @return
*/
public static String getPreferenceKey(ISimpleTerm simpleTerm) {
- simpleTerm = (ISimpleTerm) HibernateProxyHelper.deproxy(simpleTerm);
+ simpleTerm = HibernateProxyHelper.deproxy(simpleTerm);
String key = simpleTerm.getClass().getName().concat(".")
.concat(simpleTerm.getUuid().toString());
if (key.contains("javassist")) {
* @return
*/
public static String getPreferenceKey(IDefinedTerm definedTerm) {
- definedTerm = (IDefinedTerm) HibernateProxyHelper.deproxy(definedTerm);
+ definedTerm = HibernateProxyHelper.deproxy(definedTerm);
String key = definedTerm.getClass().getName().concat(".")
.concat(definedTerm.getUuid().toString());
if (key.contains("javassist")) {
private static String getMarkerTypeEditingPreferenceKey(
MarkerType markerType) {
- markerType = (MarkerType) HibernateProxyHelper.deproxy(markerType);
+ markerType = HibernateProxyHelper.deproxy(markerType);
return markerType.getClass().getName() + EDIT_MARKER_TYPE_PREFIX;
}
ctrl.setEnabled(enabled);
}
}
-
+
/**
* <p>
* getSortRanksNaturally
public static boolean getSortNodesNaturally() {
return getPreferenceStore().getBoolean(SORT_NODES_NATURALLY);
}
-
+
/**
* <p>
* setSortRanksNaturally
public static void setSortNodesNaturally(boolean selection) {
getPreferenceStore().setValue(SORT_NODES_NATURALLY, selection);
}
+
+
+ /**
+ * <p>
+ * getSortRanksNaturally
+ * </p>
+ *
+ * @return a boolean.
+ */
+ public static boolean getSortNodesStrictlyAlphabetically() {
+ return getPreferenceStore().getBoolean(SORT_NODES_ALPHABETICALLY);
+ }
+
+ /**
+ * <p>
+ * setSortRanksNaturally
+ * </p>
+ *
+ * @param selection
+ * a boolean.
+ */
+ public static void setSortNodesStrictlyAlphabetically(boolean selection) {
+ getPreferenceStore().setValue(SORT_NODES_ALPHABETICALLY, selection);
+ }
+
+ /**
+ * <p>
+ * setStoreNavigatorState
+ * </p>
+ *
+ * @param selection
+ * a boolean.
+ */
+ public static boolean isStoreNavigatorState() {
+ return getPreferenceStore().getBoolean(RESTORE_NAVIGATOR_STATE);
+
+ }
+
+ /**
+ * <p>
+ * setStoreNavigatorState
+ * </p>
+ *
+ * @param selection
+ * a boolean.
+ */
+ public static void setStoreNavigatorState(boolean selection) {
+ getPreferenceStore().setValue(RESTORE_NAVIGATOR_STATE, selection);
+
+ }
+
+ /**
+ * @return
+ */
+ public static boolean isShowUpWidgetIsDisposedMessages() {
+ return getPreferenceStore().getBoolean(IS_SHOW_UP_WIDGET_IS_DISPOSED);
+ }
+ public static void setShowUpWidgetIsDisposedMessages(boolean selection) {
+ getPreferenceStore().setValue(IS_SHOW_UP_WIDGET_IS_DISPOSED, selection);
+ }
+
+
+
}
*/
public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(PreferencesUtil.getPreferenceStore());
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
"Show taxon associations of a specimen in the details view",
getFieldEditorParent()));
-
}
addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
"Open search results in separate windows",
getFieldEditorParent()));
+
+
}
/*
import java.util.List;
import java.util.Map;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.strategy.match.MatchException;
import eu.etaxonomy.cdm.strategy.match.MatchMode;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>Abstract AbstractMatchingPreferences class.</p>
- *
* @author n.hoffmann
* @created Jan 22, 2010
* @version 1.0
*/
-public abstract class AbstractMatchingPreferences<T extends IdentifiableEntity> extends PreferencePage implements
+public abstract class AbstractMatchingPreferences<T extends IdentifiableEntity> extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
/**
protected Map<String, Combo> matchModeCombos = new HashMap<String, Combo>();
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ }
+
+ /**
+ * {@inheritDoc}
*/
- /** {@inheritDoc} */
@Override
- protected Control createContents(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NULL);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- if(!CdmStore.isActive()) {
+ protected void createFieldEditors() {
+ if(!CdmStore.isActive()) {
MessagingUtils.noDataSourceWarningDialog(null);
}else{
for(String fieldName : getFieldNames()){
- createFieldWidget(composite, fieldName);
+ String[][] comboValues = new String[getMatchModeList().size()][2];
+ for (int i=0;i<getMatchModeList().size();i++) {
+ comboValues[i][0] = getMatchModeList().get(i).name();
+ comboValues[i][1] = getMatchModeList().get(i).name();
+ }
+ addField(new ComboFieldEditor(this.getClass().getCanonicalName()+fieldName,
+ fieldName, comboValues,
+ getFieldEditorParent()));
}
}
-
- return composite;
- }
-
- /**
- * Creates a widget for a field consisting of the label and a combo
- *
- * @see {@link #createMatchModeCombo(Composite, String, MatchMode)}
- * @param composite
- * @param fieldName
- */
- private void createFieldWidget(Composite parent, String fieldName) {
- CLabel label = new CLabel(parent, SWT.NONE);
- label.setText(fieldName);
- MatchMode matchMode = matchStrategy.getMatchMode(fieldName);
-
- createMatchModeCombo(parent, fieldName, matchMode);
- }
-
- /**
- * Creates a combo for a field with the currently selected match mode for that field preselected
- *
- * @param parent
- * @param matchMode
- */
- private void createMatchModeCombo(Composite parent, String fieldName, MatchMode selectedMatchMode) {
- Combo matchModeCombo = new Combo(parent, SWT.NULL);
-
- for (MatchMode matchMode : getMatchModeList()) {
- matchModeCombo.add(matchMode.name());
- }
-
- int index = getMatchModeList().indexOf(selectedMatchMode);
-
- matchModeCombo.select(index);
-
- matchModeCombo.addSelectionListener(new MatchModeComboSelectionListener(matchModeCombo, fieldName));
-
- matchModeCombos.put(fieldName, matchModeCombo);
- }
-
- /**
- * This listener updates the cache strategy when a value was changed in one of the combos
- *
- * @author n.hoffmann
- * @created Jan 28, 2010
- * @version 1.0
- */
- private class MatchModeComboSelectionListener extends SelectionAdapter{
-
- private final Combo matchModeCombo;
- private final String fieldName;
-
- MatchModeComboSelectionListener(Combo matchModeCombo, String fieldName){
- this.matchModeCombo = matchModeCombo;
- this.fieldName = fieldName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent event) {
- super.widgetSelected(event);
- MatchMode matchMode = getMatchModeList().get(matchModeCombo.getSelectionIndex());
- try {
- matchStrategy.setMatchMode(fieldName, matchMode);
- } catch (MatchException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- }
- }
}
/**
return fields;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performApply()
- */
- /** {@inheritDoc} */
- @Override
- protected void performApply() {
- MatchStrategyConfigurator.setMatchStrategy(matchStrategy);
- super.performApply();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- /** {@inheritDoc} */
- @Override
- protected void performDefaults() {
- try {
- // set match strategy to default
- matchStrategy = getDefaultMatchStrategy();
-
- // set combos to their default values
- for(String fieldName : matchModeCombos.keySet()){
- Combo combo = matchModeCombos.get(fieldName);
- MatchMode matchMode = matchStrategy.getMatchMode(fieldName);
- combo.select(matchModeList.indexOf(matchMode));
- }
-
- } catch (MatchException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- }
- super.performDefaults();
- }
-
/**
* Returns the default match strategy for the respective class
*
// $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.
*/
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
import eu.etaxonomy.cdm.strategy.match.MatchException;
+import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator;
/**
* <p>NonViralNameMatchingPreference class.</p>
*/
public class NonViralNameMatchingPreference extends AbstractMatchingPreferences<NonViralName>{
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
/** {@inheritDoc} */
- public void init(IWorkbench workbench) {
+ @Override
+ public void init(IWorkbench workbench) {
+ super.init(workbench);
clazz = NonViralName.class;
-
+
try {
matchStrategy = MatchStrategyConfigurator.NonViralNameMatchStrategy();
} catch (MatchException e) {
throw new RuntimeException(e);
}
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.preference.matching.AbstractMatchingPreferences#getDefaultMatchStrategy()
- */
+
/** {@inheritDoc} */
@Override
protected IMatchStrategy getDefaultMatchStrategy() throws MatchException {
// $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.
*/
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
import eu.etaxonomy.cdm.strategy.match.MatchException;
+import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator;
/**
- * <p>ReferenceMatchingPreference class.</p>
- *
* @author n.hoffmann
* @created Jan 22, 2010
* @version 1.0
*/
public class ReferenceMatchingPreference extends AbstractMatchingPreferences<Reference> {
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
/** {@inheritDoc} */
- public void init(IWorkbench workbench) {
+ @Override
+ public void init(IWorkbench workbench) {
+ super.init(workbench);
clazz = Reference.class;
-
+
try {
matchStrategy = MatchStrategyConfigurator.ReferenceMatchStrategy();
} catch (MatchException e) {
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.preference.matching.AbstractMatchingPreferences#getDefaultMatchStrategy()
- */
/** {@inheritDoc} */
@Override
protected IMatchStrategy getDefaultMatchStrategy() throws MatchException {
// $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.
*/
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
import eu.etaxonomy.cdm.strategy.match.MatchException;
+import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator;
/**
- * <p>TeamOrPersonMatchingPreference class.</p>
- *
* @author n.hoffmann
* @created Jan 22, 2010
* @version 1.0
public class TeamOrPersonMatchingPreference extends
AbstractMatchingPreferences<TeamOrPersonBase> {
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
/** {@inheritDoc} */
- public void init(IWorkbench workbench) {
-
+ @Override
+ public void init(IWorkbench workbench) {
+ super.init(workbench);
clazz = TeamOrPersonBase.class;
-
+
try {
matchStrategy = MatchStrategyConfigurator.TeamOrPersonMatchStrategy();
} catch (MatchException e) {
MessagingUtils.error(this.getClass(), e);
throw new RuntimeException(e);
}
- }
+ }
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.preference.matching.AbstractMatchingPreferences#getDefaultMatchStrategy()
- */
/** {@inheritDoc} */
@Override
protected IMatchStrategy getDefaultMatchStrategy() throws MatchException {
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import eu.etaxonomy.taxeditor.store.TermStore;
/**
- * <p>Abstract AbstractMenuPreferences class.</p>
- *
* @author n.hoffmann
* @created 12.06.2009
* @version 1.0
*/
-public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends PreferencePage implements
+public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends CdmPreferencePage implements
IWorkbenchPreferencePage, IConversationEnabled{
private Button toggleButton;
toggleButton = new Button(buttonContainer, SWT.PUSH);
toggleButton.setText("Toggle");
toggleButton.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent e) {
state = state ? false : true;
return container;
}
-
- /**
- * <p>refresh</p>
- *
- * @param definedTerms a {@link java.util.List} object.
- */
protected void refresh(List<T> definedTerms) {
tableViewer.setInput(definedTerms);
tableViewer.setCheckedElements(preferedTerms.toArray());
}
- /**
- * <p>createAdditionalContent</p>
- *
- * @param container a {@link org.eclipse.swt.widgets.Composite} object.
- */
protected void createAdditionalContent(Composite container) {
// implement where needed
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createButtons(org.eclipse.swt.widgets.Composite)
- */
- /**
- * <p>createEditButtons</p>
- *
- * @param buttonContainer a {@link org.eclipse.swt.widgets.Composite} object.
- */
protected void createEditButtons(Composite buttonContainer) {
editButton = new Button(buttonContainer, SWT.PUSH);
*/
protected void addNewButtonListeners() {
newButton.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent e) {
VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), getConversationHolder());
}
}
-
});
}
*/
protected void addEditButtonListeners() {
editButton.addSelectionListener(new SelectionAdapter(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent event) {
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
/**
* <p>performDefaults</p>
*/
tableViewer.setAllChecked(true);
}
- /**
- * <p>Getter for the field <code>tableViewer</code>.</p>
- *
- * @return the tableViewer
- */
public CheckboxTableViewer getTableViewer() {
return tableViewer;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
/** {@inheritDoc} */
@Override
public boolean performOk() {
PreferencesUtil.firePreferencesChanged(this.getClass());
- return true;
+
+ return super.performOk();
}
private boolean checkNoneChecked(){
}
}
- /**
- * <p>getTermClass</p>
- *
- * @return a {@link java.lang.Class} object.
- */
protected abstract Class<T> getTermClass();
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
@Override
public ConversationHolder getConversationHolder() {
if(conversation == null){
return conversation;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
@Override
public void update(CdmDataChangeMap changeEvents) {
// implement where needed
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.preference.menu;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 30 Jul 2015
+ *
+ */
+public abstract class CdmPreferencePage extends PreferencePage implements ICdmEntitySessionEnabled {
+
+ private ICdmEntitySession previousCdmEntitySession;
+ private boolean isApply;
+
+ public CdmPreferencePage() {
+ initSession();
+ }
+
+ public CdmPreferencePage(String title) {
+ super(title);
+ initSession();
+ }
+
+ public CdmPreferencePage(String title, ImageDescriptor image) {
+ super(title, image);
+ initSession();
+ }
+
+ private void initSession() {
+ previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ bindNullSession();
+ }
+
+ private void bindNullSession() {
+ if(CdmStore.isActive()) {
+ CdmStore.getCurrentSessionManager().bindNullSession();
+ }
+ }
+
+ @Override
+ public boolean performOk() {
+ if(previousCdmEntitySession != null && !isApply) {
+ previousCdmEntitySession.bind();
+ }
+ return super.performOk();
+ }
+
+ @Override
+ public boolean performCancel() {
+ if(previousCdmEntitySession != null) {
+ previousCdmEntitySession.bind();
+ }
+ return super.performCancel();
+ }
+
+ @Override
+ public void performApply() {
+ isApply = true;
+ super.performApply();
+ isApply = false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return CdmStore.getCurrentSessionManager().getNullSession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ return null;
+ }
+
+}
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
import eu.etaxonomy.taxeditor.editor.definedterm.TermContentProvider;
import eu.etaxonomy.taxeditor.editor.definedterm.TermLabelProvider;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @date 21.07.2014
*
*/
-public class AvailableDistributionPage extends WizardPage {
+public class AvailableDistributionPage extends WizardPage implements ICdmEntitySessionEnabled {
private CheckboxTreeViewer viewer;
protected AvailableDistributionPage(String pageName) {
super(pageName);
// TODO check if configuration exists
+ CdmStore.getCurrentSessionManager().bindNullSession();
}
/*
}
}
+ @Override
+ public void dispose() {
+ CdmStore.getCurrentSessionManager().dispose(this);
+ super.dispose();
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return CdmStore.getCurrentSessionManager().getNullSession();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
+ List<String> termsPropertyPaths = Arrays.asList(new String[] {
+ "includes"
+ });
+ propertyPathsMap.put("includes", termsPropertyPaths);
+ propertyPathsMap.put("terms", termsPropertyPaths);
+ return propertyPathsMap;
+ }
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.store;
+
+/**
+ * @author cmathew
+ * @date 24 Jul 2015
+ *
+ */
+public class CdmAuthenticationException extends RuntimeException {
+
+ public CdmAuthenticationException(String message, Throwable t) {
+ super(message,t);
+ }
+
+}
package eu.etaxonomy.taxeditor.store;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
import java.util.EnumSet;
import org.eclipse.core.runtime.IProgressMonitor;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.security.access.PermissionEvaluator;
-import org.springframework.security.authentication.ProviderManager;
+import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
+import eu.etaxonomy.cdm.api.application.CdmApplicationException;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.ICollectionService;
import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
+import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
-import eu.etaxonomy.cdm.ext.geo.IEditGeoService;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.molecular.Amplification;
+import eu.etaxonomy.cdm.model.molecular.Primer;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.occurrence.Collection;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
-import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
import eu.etaxonomy.taxeditor.io.ExportManager;
import eu.etaxonomy.taxeditor.io.ImportManager;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySessionManager;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+import eu.etaxonomy.taxeditor.util.ProgressMonitorClientManager;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
+import eu.etaxonomy.taxeditor.webapp.CDMServer;
/**
* This implementation of ICdmDataRepository depends on hibernate sessions to
*/
public class CdmStore {
- private static final Resource DEFAULT_APPLICATION_CONTEXT = new ClassPathResource(
- "/eu/etaxonomy/cdm/editorApplicationContext.xml",
- TaxeditorStorePlugin.class);
- private static final DbSchemaValidation DEFAULT_DB_SCHEMA_VALIDATION = DbSchemaValidation.VALIDATE;
-
- private static CdmStore instance;
-
- private final ICdmApplicationConfiguration applicationConfiguration;
-
- private static ContextManager contextManager = new ContextManager();
-
- private static LoginManager loginManager = new LoginManager();
-
- private static TermManager termManager = new TermManager();
-
- private static SearchManager searchManager = new SearchManager();
-
- private static EditorManager editorManager = new EditorManager();
-
- private static UseObjectStore useObjectInitializer = new UseObjectStore();
-
- private static CdmStoreConnector job;
-
- private Language language;
-
- private ICdmSource cdmSource;
-
- private boolean isConnected;
-
- /**
- * <p>
- * getDefault
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
- */
- protected static CdmStore getDefault() {
- if (instance != null && instance.isConnected) {
- return instance;
- } else{// if (instance == null || !instance.isConnected) {
-
- MessagingUtils.noDataSourceWarningDialog(instance);
-
- AbstractUtility.showView(CdmDataSourceViewPart.ID);
- return null;
- }
- }
-
- /**
- * Initialize the with the last edited datasource
- */
- public static void connect() {
-
- ICdmSource cdmSource;
- try {
- cdmSource = CdmDataSourceRepository.getCurrentCdmSource();
- connect(cdmSource);
- } catch (CdmRemoteSourceException e) {
- MessagingUtils.messageDialog("Connection to CDM Source Failed", CdmStore.class, "Could not connect to target CDM Source", e);
- }
-
-
- }
-
- /**
- * Initialize with a specific datasource
- *
- * @param datasource
- * a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
- */
- public static void connect(ICdmSource cdmSource) {
- connect(cdmSource, DEFAULT_DB_SCHEMA_VALIDATION,
- DEFAULT_APPLICATION_CONTEXT);
- }
-
- /**
- * Initialize and provide
- *
- * @param datasource
- * @param dbSchemaValidation
- * @param applicationContextBean
- */
- private static void connect(final ICdmSource cdmSource,
- final DbSchemaValidation dbSchemaValidation,
- final Resource applicationContextBean) {
- MessagingUtils.info("Connecting to datasource: " + cdmSource);
-
- job = new CdmStoreConnector(Display.getDefault(), cdmSource,
- dbSchemaValidation, applicationContextBean);
- job.setUser(true);
- job.setPriority(Job.BUILD);
- job.schedule();
-
- }
-
- public static boolean isConnecting() {
- return job != null && job.getState() == Job.RUNNING;
- }
-
- /**
- * Closes the current application context
- *
- * @param monitor
- * a {@link org.eclipse.core.runtime.IProgressMonitor} object.
- */
- public static void close(final IProgressMonitor monitor) {
- Display.getDefault().asyncExec(new Runnable() {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- getContextManager().notifyContextAboutToStop(monitor);
- if ((monitor == null || (!monitor.isCanceled()) && isActive())) {
- getContextManager().notifyContextStop(monitor);
- instance.close();
- }
- }
- });
- }
-
- private void close() {
- isConnected = false;
- cdmSource = null;
- }
-
- static void setInstance(ICdmApplicationConfiguration applicationController,
- ICdmSource cdmSource) {
- instance = new CdmStore(applicationController, cdmSource);
- }
-
- private CdmStore(ICdmApplicationConfiguration applicationController,
- ICdmSource cdmSource) {
- this.applicationConfiguration = applicationController;
- this.cdmSource = cdmSource;
- isConnected = true;
- }
-
- /**
- * All calls to the datastore require
- *
- * @return
- */
- private ICdmApplicationConfiguration getApplicationConfiguration() {
- try {
- return applicationConfiguration;
- } catch (Exception e) {
- MessagingUtils.error(CdmStore.class, e);
- }
- return null;
- }
-
- /**
- * <p>
- * getCurrentApplicationController
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.cdm.remote.api.application.CdmApplicationController}
- * object.
- */
- public static ICdmApplicationConfiguration getCurrentApplicationConfiguration() {
- if (getDefault() != null) {
- return getDefault().getApplicationConfiguration();
- }
- return null;
- }
-
- /*
- * CONVERSATIONS
- */
-
- /**
- * Creates a new conversation, binds resources to the conversation and start
- * a transaction for this conversation.
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- public static ConversationHolder createConversation() {
- ConversationHolder conversation = getCurrentApplicationConfiguration()
- .NewConversation();
- try{
- conversation.startTransaction();
- }catch(Exception e){
- MessagingUtils.messageDialog("No database connection", CdmStore.class, "No database connection available", e);
- }
- return conversation;
- }
-
- /**
- * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
- * interface. If a matching getter is found the according service implementation is returned by
- * invoking the getter otherwise the method returns <code>null</code>.
- *
- * @param <T>
- * @param serviceClass
- * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
- */
- public static <T extends IService> T getService(Class<T> serviceClass) {
- ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
-
- Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
-
- T service = null;
-
- for (Method method : methods) {
- Type type = method.getGenericReturnType();
-
- if (type.equals(serviceClass)) {
- try {
- service = (T) method.invoke(configuration, null);
- break;
- } catch (IllegalArgumentException e) {
- MessagingUtils.error(CdmStore.class, e);
- } catch (IllegalAccessException e) {
- MessagingUtils.error(CdmStore.class, e);
- } catch (InvocationTargetException e) {
- MessagingUtils.error(CdmStore.class, e);
- }
- }
- }
-
- return service;
- }
-
- /**
- * @see #getService(Class)
- * As ICommonService is not extending IService we need a specific request here
- */
- public static ICommonService getCommonService() {
- ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
-
- return configuration.getCommonService();
-
- }
-
- /**
- * <p>
- * getAuthenticationManager
- * </p>
- *
- * @return a
- * {@link org.springframework.security.authentication.ProviderManager}
- * object.
- */
- public static ProviderManager getAuthenticationManager() {
- return getCurrentApplicationConfiguration().getAuthenticationManager();
- }
-
- /**
- * <p>
- * getAuthenticationManager
- * </p>
- *
- * @return a
- * {@link ICdmPermissionEvaluator} object.
- */
- public static ICdmPermissionEvaluator getPermissionEvaluator() {
- return getCurrentApplicationConfiguration().getPermissionEvaluator();
- }
-
- /**
- * <p>
- * getGeoService
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.ext.geo.IEditGeoService} object.
- */
- public static IEditGeoService getGeoService() {
- return (IEditGeoService) getCurrentApplicationConfiguration().getBean(
- "editGeoService");
- }
-
- /*
- * SECURITY RELATED CONVENIENCE METHODS
- */
-
- /**
- * @see org.springframework.security.access.PermissionEvaluator#hasPermission(org.springframework.security.core.Authentication, java.lang.Object, java.lang.Object)
+ private static final Resource DEFAULT_APPLICATION_CONTEXT = new ClassPathResource(
+ "/eu/etaxonomy/cdm/editorApplicationContext.xml",
+ TaxeditorStorePlugin.class);
+ private static final DbSchemaValidation DEFAULT_DB_SCHEMA_VALIDATION = DbSchemaValidation.VALIDATE;
+
+ private static CdmStore instance;
+
+ //private final ICdmApplicationConfiguration applicationConfiguration;
+
+ private static ContextManager contextManager = new ContextManager();
+
+ private static LoginManager loginManager = new LoginManager();
+
+ private static TermManager termManager = new TermManager();
+
+ private static SearchManager searchManager = new SearchManager();
+
+ private static EditorManager editorManager = new EditorManager();
+
+ private static UseObjectStore useObjectInitializer = new UseObjectStore();
+
+ private static ProgressMonitorClientManager progressMonitorClientManager = new ProgressMonitorClientManager();
+
+ private static CdmStoreConnector job;
+
+ private static CDMServer managedServer;
+
+ private Language language;
+
+ private ICdmSource cdmSource;
+
+ private boolean isConnected;
+
+
+
+ /**
+ * <p>
+ * getDefault
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
+ */
+ protected static CdmStore getDefault() {
+ if (instance != null && instance.isConnected) {
+ return instance;
+ } else{// if (instance == null || !instance.isConnected) {
+
+ MessagingUtils.noDataSourceWarningDialog(instance);
+
+ AbstractUtility.showView(CdmDataSourceViewPart.ID);
+ return null;
+ }
+ }
+
+ /**
+ * Initialize the with the last edited datasource
+ */
+ public static void connect() {
+
+ ICdmSource cdmSource;
+ try {
+
+ cdmSource = CdmDataSourceRepository.getCurrentCdmSource();
+ connect(cdmSource);
+ } catch (Exception e) {
+ MessagingUtils.messageDialog("Connection to CDM Source Failed", CdmStore.class, "Could not connect to target CDM Source", e);
+ }
+
+
+ }
+
+ /**
+ * Initialize with a specific datasource
+ *
+ * @param datasource
+ * a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
+ */
+ public static void connect(ICdmSource cdmSource) {
+ connect(cdmSource, DEFAULT_DB_SCHEMA_VALIDATION,
+ DEFAULT_APPLICATION_CONTEXT);
+ }
+
+ public static void connect(ICdmSource cdmSource, RemotingLoginDialog loginDialog) {
+ connect(cdmSource,
+ DEFAULT_DB_SCHEMA_VALIDATION,
+ DEFAULT_APPLICATION_CONTEXT,
+ loginDialog);
+ }
+
+ /**
+ * Initialize and provide
+ *
+ * @param datasource
+ * @param dbSchemaValidation
+ * @param applicationContextBean
+ */
+ private static void connect(final ICdmSource cdmSource,
+ final DbSchemaValidation dbSchemaValidation,
+ final Resource applicationContextBean) {
+
+ MessagingUtils.info("Connecting to datasource: " + cdmSource);
+
+ job = new CdmStoreConnector(Display.getDefault(), cdmSource,
+ dbSchemaValidation, applicationContextBean);
+ job.setUser(true);
+ job.setPriority(Job.BUILD);
+ job.schedule();
+
+ }
+
+ private static void connect(final ICdmSource cdmSource,
+ final DbSchemaValidation dbSchemaValidation,
+ final Resource applicationContextBean,
+ RemotingLoginDialog remotingLoginDialog) {
+ RemotingLoginDialog loginDialog = remotingLoginDialog;
+ if(isActive()) {
+ // before we connect we clear the entity caches and the sessions
+ CdmRemoteCacheManager.removeEntityCaches();
+ if(getCurrentSessionManager() != null) {
+ getCurrentSessionManager().disposeAll();
+ }
+ }
+ MessagingUtils.info("Connecting to datasource: " + cdmSource);
+
+ job = new CdmStoreConnector(Display.getDefault(),
+ cdmSource,
+ dbSchemaValidation,
+ applicationContextBean);
+ job.start(loginDialog);
+
+ }
+
+ public static boolean isConnecting() {
+ return job != null && job.getState() == Job.RUNNING;
+ }
+
+ /**
+ * Closes the current application context
+ *
+ * @param monitor
+ * a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ */
+ public static void close(final IProgressMonitor monitor) {
+ Display.getDefault().asyncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ getContextManager().notifyContextAboutToStop(monitor);
+ if ((monitor == null || (!monitor.isCanceled()) && isActive())) {
+ getContextManager().notifyContextStop(monitor);
+ instance.close();
+ }
+ }
+ });
+ }
+
+ public static void close(IProgressMonitor monitor, boolean async) {
+ if(async) {
+ close(monitor);
+ } else {
+ getContextManager().notifyContextAboutToStop(monitor);
+ if ((monitor == null || (!monitor.isCanceled()) && isActive())) {
+ getContextManager().notifyContextStop(monitor);
+ instance.close();
+ }
+ }
+
+ }
+ private void close() {
+ isConnected = false;
+ cdmSource = null;
+ CdmApplicationState.dispose();
+ }
+
+ static void setInstance(ICdmApplicationConfiguration applicationController,
+ ICdmSource cdmSource) {
+ instance = new CdmStore(applicationController, cdmSource);
+ if(getCurrentSessionManager().isRemoting()) {
+ CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+ }
+ }
+
+ private CdmStore(ICdmApplicationConfiguration applicationController,
+ ICdmSource cdmSource) {
+ CdmApplicationState.setCurrentAppConfig(applicationController);
+ CdmApplicationState.setCurrentDataChangeService(new CdmUIDataChangeService());
+ this.cdmSource = cdmSource;
+ isConnected = true;
+ }
+
+ /**
+ * All calls to the datastore require
+ *
+ * @return
+ */
+ private ICdmApplicationConfiguration getApplicationConfiguration() {
+ try {
+ return CdmApplicationState.getCurrentAppConfig();
+ } catch (Exception e) {
+ MessagingUtils.error(CdmStore.class, e);
+ }
+ return null;
+ }
+
+ /**
+ * <p>
+ * getCurrentApplicationController
+ * </p>
*
- * @param targetDomainObject
- * @param permission
- * @return
- */
- public static boolean currentAuthentiationHasPermission(CdmBase targetDomainObject, EnumSet<CRUD> permission){
- //TODO use getCurrentApplicationConfiguration().currentAuthentiationHasPermission(CdmBase targetDomainObject, Operation permission) instead
- SecurityContext context = SecurityContextHolder.getContext();
- PermissionEvaluator pe = getPermissionEvaluator();
- boolean hasPermission = false;
- try {
+ * @return a
+ * {@link eu.etaxonomy.cdm.remote.api.application.CdmApplicationController}
+ * object.
+ */
+ public static ICdmApplicationConfiguration getCurrentApplicationConfiguration() {
+ if (getDefault() != null) {
+ return getDefault().getApplicationConfiguration();
+ }
+ return null;
+ }
+
+ /*
+ * CONVERSATIONS
+ */
+
+ /**
+ * Creates a new conversation, binds resources to the conversation and start
+ * a transaction for this conversation.
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ public static ConversationHolder createConversation() {
+ ConversationHolder conversation = getCurrentApplicationConfiguration()
+ .NewConversation();
+ try {
+ conversation.startTransaction();
+ }catch(Exception e){
+ MessagingUtils.messageDialog("No database connection", CdmStore.class, "No database connection available", e);
+ }
+ return conversation;
+ }
+
+ //FIXME:Remoting should be removed after moving completely to remoting
+ private MockCdmEntitySessionManager mockCdmEntitySessionManager;
+
+ private ICdmEntitySessionManager getSessionManager() {
+ //FIXME:Remoting we should only have CdmApplicationRemoteConfiguration after move to remoting
+ // bad hack which should be finally removed
+ if(getCurrentApplicationConfiguration() instanceof CdmApplicationRemoteController) {
+ return ((CdmApplicationRemoteController)getCurrentApplicationConfiguration()).getCdmEntitySessionManager();
+ } else {
+ if(mockCdmEntitySessionManager == null) {
+ mockCdmEntitySessionManager = new MockCdmEntitySessionManager();
+ }
+ return mockCdmEntitySessionManager;
+ }
+ }
+
+ public static ICdmEntitySessionManager getCurrentSessionManager() {
+ if (getDefault() != null) {
+ return getDefault().getSessionManager();
+ }
+ return null;
+
+ }
+
+ /**
+ * Generic method that will scan the getters of {@link ICdmApplicationConfiguration} for the given service
+ * interface. If a matching getter is found the according service implementation is returned by
+ * invoking the getter otherwise the method returns <code>null</code>.
+ *
+ * @param <T>
+ * @param serviceClass
+ * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
+ */
+ public static <T extends IService> T getService(Class<T> serviceClass) {
+ T service = null;
+ try {
+ service = CdmApplicationState.getService(serviceClass);
+ } catch (CdmApplicationException cae) {
+ MessagingUtils.error(CdmStore.class, cae);
+ }
+
+ return service;
+ }
+
+ /**
+ * @see #getService(Class)
+ * As ICommonService is not extending IService we need a specific request here
+ */
+ public static ICommonService getCommonService() {
+ return CdmApplicationState.getCommonService();
+
+ }
+
+ /**
+ * <p>
+ * getAuthenticationManager
+ * </p>
+ *
+ * @return a
+ * {@link org.springframework.security.authentication.ProviderManager}
+ * object.
+ */
+ public static AuthenticationManager getAuthenticationManager() {
+ return getCurrentApplicationConfiguration().getAuthenticationManager();
+ }
+
+ /**
+ * <p>
+ * getAuthenticationManager
+ * </p>
+ *
+ * @return a
+ * {@link ICdmPermissionEvaluator} object.
+ */
+ public static ICdmPermissionEvaluator getPermissionEvaluator() {
+ return getCurrentApplicationConfiguration().getPermissionEvaluator();
+ }
+
+
+ /*
+ * SECURITY RELATED CONVENIENCE METHODS
+ */
+
+ /**
+ * @see org.springframework.security.access.PermissionEvaluator#hasPermission(org.springframework.security.core.Authentication, java.lang.Object, java.lang.Object)
+ *
+ * @param targetDomainObject
+ * @param permission
+ * @return
+ */
+ public static boolean currentAuthentiationHasPermission(CdmBase targetDomainObject, EnumSet<CRUD> permission){
+ //TODO use getCurrentApplicationConfiguration().currentAuthentiationHasPermission(CdmBase targetDomainObject, Operation permission) instead
+ SecurityContext context = SecurityContextHolder.getContext();
+ PermissionEvaluator pe = getPermissionEvaluator();
+ boolean hasPermission = false;
+ try {
hasPermission = getPermissionEvaluator().hasPermission(context.getAuthentication(), targetDomainObject,
permission);
} catch (org.springframework.security.access.AccessDeniedException e) {
/* IGNORE */
}
return hasPermission;
- }
+ }
- /**
- * @see org.springframework.security.access.PermissionEvaluator#hasPermission(org.springframework.security.core.Authentication, java.lang.Object, java.lang.Object)
+ /**
+ * @see org.springframework.security.access.PermissionEvaluator#hasPermission(org.springframework.security.core.Authentication, java.lang.Object, java.lang.Object)
*
- * @param targetDomainObject
- * @param permission
- * @return
- */
- public static boolean currentAuthentiationHasPermission(Class<? extends CdmBase> targetType, EnumSet<CRUD> permission){
- boolean hasPermission = false;
+ * @param targetDomainObject
+ * @param permission
+ * @return
+ */
+ public static boolean currentAuthentiationHasPermission(Class<? extends CdmBase> targetType, EnumSet<CRUD> permission){
+ boolean hasPermission = false;
try {
hasPermission = getPermissionEvaluator().hasPermission(getCurrentAuthentiation(), null, targetType.getName(), permission);
} catch (org.springframework.security.access.AccessDeniedException e) {
/* IGNORE */
}
return hasPermission;
- }
+ }
- public static boolean currentAuthentiationHasOneOfRoles(Role ... roles){
- boolean hasPermission = false;
+ public static boolean currentAuthentiationHasOneOfRoles(Role ... roles){
+ boolean hasPermission = false;
try {
hasPermission = getPermissionEvaluator().hasOneOfRoles(getCurrentAuthentiation(), roles);
} catch (org.springframework.security.access.AccessDeniedException e) {
/* IGNORE */
}
return hasPermission;
- }
-
- public static Authentication getCurrentAuthentiation() {
- SecurityContext context = SecurityContextHolder.getContext();
- return context.getAuthentication();
- }
-
- /*
- * LANGUAGE
- */
-
- /**
- * Provides access to the global default language set in the application preferences.
- *
- * @return a {@link eu.etaxonomy.cdm.model.common.Language} object.
- */
- public static Language getDefaultLanguage() {
- if (getDefault().getLanguage() == null) {
- getDefault().setLanguage(PreferencesUtil.getGlobalLanguage());
- }
- return getDefault().getLanguage();
- }
-
- /**
- * <p>
- * setDefaultLanguage
- * </p>
- *
- * @param language
- * a {@link eu.etaxonomy.cdm.model.common.Language} object.
- */
- public static void setDefaultLanguage(Language language) {
- getDefault().setLanguage(language);
- }
-
- /**
- * @return the language
- */
- private Language getLanguage() {
- return language;
- }
-
- /**
- * @param language
- * the language to set
- */
- private void setLanguage(Language language) {
- this.language = language;
- }
-
- /*
- * LOGIN
- */
-
- /**
- * <p>
- * Getter for the field <code>loginManager</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.store.LoginManager} object.
- */
- public static LoginManager getLoginManager() {
- return loginManager;
- }
-
- /**
- * <p>
- * Getter for the field <code>contextManager</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.store.ContextManager} object.
- */
- public static ContextManager getContextManager() {
- return contextManager;
- }
-
- public static TermManager getTermManager() {
- return termManager;
- }
-
- public static SearchManager getSearchManager() {
- return searchManager;
- }
-
- public static EditorManager getEditorManager() {
- return editorManager;
- }
-
- /*
- * IMPORT/EXPORT FACTORIES
- */
-
- /**
- * <p>
- * Getter for the field <code>importHandler</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.io.ImportManager} object.
- */
- public static ImportManager getImportManager() {
- return ImportManager.NewInstance(getCurrentApplicationConfiguration());
- }
-
- /**
- * <p>
- * Getter for the field <code>exportHandler</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.io.ExportManager} object.
- */
- public static ExportManager getExportManager() {
- return ExportManager.NewInstance(getCurrentApplicationConfiguration());
- }
-
- /**
- * Whether this CdmStore is currently connected to a datasource
- *
- * @return a boolean.
- */
- public static boolean isActive() {
- return instance != null && instance.isConnected;
- }
-
- public static ICdmSource getActiveCdmSource() {
- if (isActive()) {
- return instance.getCdmSource();
- }
- return null;
- }
-
- /**
- * <p>
- * getDataSource
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
- * @deprecated currently retained for backward compatibility - use {@link getActiveCdmSource()} instead
- */
-// public static ICdmDataSource getDataSource() {
-// if (isActive()) {
-// return (ICdmDataSource)instance.getCdmSource();
-// }
-// return null;
-// }
-
- /**
- * @return
- */
- private ICdmSource getCdmSource() {
- return cdmSource;
- }
+ }
+
+ public static Authentication getCurrentAuthentiation() {
+ SecurityContext context = SecurityContextHolder.getContext();
+ return context.getAuthentication();
+ }
+
+ /*
+ * LANGUAGE
+ */
+
+ /**
+ * Provides access to the global default language set in the application preferences.
+ *
+ * @return a {@link eu.etaxonomy.cdm.model.common.Language} object.
+ */
+ public static Language getDefaultLanguage() {
+ if (getDefault().getLanguage() == null) {
+ getDefault().setLanguage(PreferencesUtil.getGlobalLanguage());
+ }
+ return getDefault().getLanguage();
+ }
+
+ /**
+ * <p>
+ * setDefaultLanguage
+ * </p>
+ *
+ * @param language
+ * a {@link eu.etaxonomy.cdm.model.common.Language} object.
+ */
+ public static void setDefaultLanguage(Language language) {
+ getDefault().setLanguage(language);
+ }
+
+ /**
+ * @return the language
+ */
+ private Language getLanguage() {
+ return language;
+ }
+
+ /**
+ * @param language
+ * the language to set
+ */
+ private void setLanguage(Language language) {
+ this.language = language;
+ }
+
+ /*
+ * LOGIN
+ */
+
+ /**
+ * <p>
+ * Getter for the field <code>loginManager</code>.
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.store.LoginManager} object.
+ */
+ public static LoginManager getLoginManager() {
+ return loginManager;
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>contextManager</code>.
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.store.ContextManager} object.
+ */
+ public static ContextManager getContextManager() {
+ return contextManager;
+ }
+
+ public static TermManager getTermManager() {
+ return termManager;
+ }
+
+ public static SearchManager getSearchManager() {
+ return searchManager;
+ }
+
+ public static EditorManager getEditorManager() {
+ return editorManager;
+ }
+
+ public static ProgressMonitorClientManager getProgressMonitorClientManager() {
+ return progressMonitorClientManager;
+ }
+
+ /*
+ * IMPORT/EXPORT FACTORIES
+ */
+
+ /**
+ * <p>
+ * Getter for the field <code>importHandler</code>.
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.io.ImportManager} object.
+ */
+ public static ImportManager getImportManager() {
+ return ImportManager.NewInstance(getCurrentApplicationConfiguration());
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>exportHandler</code>.
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.io.ExportManager} object.
+ */
+ public static ExportManager getExportManager() {
+ return ExportManager.NewInstance(getCurrentApplicationConfiguration());
+ }
+
+ /**
+ * Whether this CdmStore is currently connected to a datasource
+ *
+ * @return a boolean.
+ */
+ public static boolean isActive() {
+ return instance != null && instance.isConnected;
+ }
+
+ public static ICdmSource getActiveCdmSource() {
+ if (isActive()) {
+ return instance.getCdmSource();
+ }
+ return null;
+ }
+
+ /**
+ * <p>
+ * getDataSource
+ * </p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
+ * @deprecated currently retained for backward compatibility - use {@link getActiveCdmSource()} instead
+ */
+ // public static ICdmDataSource getDataSource() {
+ // if (isActive()) {
+ // return (ICdmDataSource)instance.getCdmSource();
+ // }
+ // return null;
+ // }
+
+ /**
+ * @return
+ */
+ private ICdmSource getCdmSource() {
+ return cdmSource;
+ }
+
+
+ public static <T extends CdmBase> IService<T> getService(T cdmBase){
+ IService<T> service = null;
+ if(cdmBase!=null){
+ //get corresponding service
+ if(cdmBase.isInstanceOf(Reference.class)){
+ service = (IService<T>) getService(IReferenceService.class);
+ }
+ else if (cdmBase.isInstanceOf(AgentBase.class)){
+ service = (IService<T>) getService(IAgentService.class);
+ }
+ else if (cdmBase instanceof NonViralName) {
+ service = (IService<T>) getService(INameService.class);
+ }
+ else if (cdmBase instanceof SpecimenOrObservationBase) {
+ service = (IService<T>) getService(IOccurrenceService.class);
+ }
+ else if (cdmBase instanceof Collection) {
+ service = (IService<T>) getService(ICollectionService.class);
+ }
+ else if (cdmBase instanceof User) {
+ service = (IService<T>) getService(IUserService.class);
+ }
+ else if (cdmBase instanceof Primer) {
+ service = (IService<T>) getService(IPrimerService.class);
+ }
+ else if (cdmBase instanceof Amplification) {
+ service = (IService<T>) getService(IAmplificationService.class);
+ }
+ }
+ return service;
+ }
+
+ public static void setManagedServer(CDMServer server) {
+ managedServer = server;
+ }
+
+ public static CDMServer getManagedServer() {
+ return managedServer;
+ }
}
package eu.etaxonomy.taxeditor.store;
+import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.concurrent.CancellationException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.springframework.core.io.Resource;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
-import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
+import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
+
/**
* @author n.hoffmann
* @created Dec 8, 2010
* @version 1.0
*/
class CdmStoreConnector extends Job {
- private final Display display;
- private final ICdmSource cdmSource;
- private DbSchemaValidation dbSchemaValidation;
- private final Resource applicationContextBean;
-
- /**
- * @param datasource
- * @param dbSchemaValidation
- * @param applicationContextBean
- */
- public CdmStoreConnector(Display display, ICdmSource cdmSource,
- DbSchemaValidation dbSchemaValidation,
- Resource applicationContextBean) {
- super("Connecting to datasource: " + cdmSource);
- this.display = display;
- this.cdmSource = cdmSource;
- this.dbSchemaValidation = dbSchemaValidation;
- this.applicationContextBean = applicationContextBean;
- }
-
- @Override
- public IStatus run(final IProgressMonitor monitor) {
-
- monitor.beginTask(getConnectionMessage(), 10);
-
- // check if database is up and running
- checkDatabaseReachable(monitor);
-
- if (!monitor.isCanceled()) {
- // check if the datasource actually holds data
- checkIsNonEmptyCdmDatabase(monitor);
- }
-
- if (dbSchemaValidation != DbSchemaValidation.CREATE
- && !monitor.isCanceled()) {
- // if we do not create the datasource, we want to check if the
- // datasource is compatible with this editor
- checkDbSchemaVersionCompatibility(monitor);
- }
-
- // we are done with our low level checking and will free resources now
- cdmSource.closeOpenConnections();
-
- if (!monitor.isCanceled()) {
- CdmStore.close(monitor);
- }
-
- ICdmApplicationConfiguration applicationController = null;
-
- if (!monitor.isCanceled()) {
- CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
- .CreateSubMonitor(monitor, 7);
- // This is where we instantiate the application controller
- int oldPriority = Thread.currentThread().getPriority();
- try {
- Thread.currentThread().setPriority(10);
- applicationController = getApplicationController(cdmSource,subprogressMonitor);
- } catch (Exception e) {
- if(! causeIsCancelationExceptionRecursive(e)){
- return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + cdmSource.getName(), e);
- }
- } finally {
- monitor.done();
- Thread.currentThread().setPriority(oldPriority);
- }
- }
-
-
-
- if (!monitor.isCanceled()) {
- CdmStore.setInstance(applicationController, cdmSource);
-
- display.asyncExec(new Runnable() {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- authenticate();
-
- startContext();
- }
- });
-
- MessagingUtils.info("Application context initialized.");
- return Status.OK_STATUS;
- } else {
- // Show datasource view if not shown yet
- display.asyncExec(new Runnable() {
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- @Override
- public void run() {
- StoreUtil.showView(CdmDataSourceViewPart.ID);
- }
- });
- return Status.CANCEL_STATUS;
- }
-
- }
-
- private ICdmApplicationConfiguration getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
- if(cdmSource instanceof ICdmDataSource) {
- return CdmApplicationController.NewInstance(applicationContextBean,
- (ICdmDataSource)cdmSource,
- dbSchemaValidation,
- false,
- subprogressMonitor);
- } else if(cdmSource instanceof ICdmRemoteSource) {
- return CdmApplicationRemoteController.NewInstance((ICdmRemoteSource)cdmSource,
- false,
- subprogressMonitor,
- null);
- } else {
- throw new UnsupportedOperationException("Cannot create application controller for " + cdmSource.getName());
- }
- }
- private void authenticate() {
- LoginDialog loginDialog = new LoginDialog(StoreUtil.getShell());
- loginDialog.open();
- }
-
- private void startContext() {
- CdmStore.getContextManager().notifyContextStart();
- }
-
- /**
- * @return
- */
- private String getConnectionMessage() {
- return cdmSource.getConnectionMessage();
- }
-
- /**
- * @return
- * @throws SQLException
- */
- private void checkDbSchemaVersionCompatibility(IProgressMonitor monitor) {
- monitor.subTask("Checking if datasource is compatible with this editor.");
- String dbSchemaVersion;
-
- String message = null;
- try {
- dbSchemaVersion = cdmSource.getDbSchemaVersion();
- // we assume that empty dbSchemaVersion means an empty database and
- // skip version checking
-
- if(dbSchemaVersion != null) {
- int compareVersion = CdmMetaData.compareVersion(dbSchemaVersion, CdmMetaData.getDbSchemaVersion(), 3, null);
- // if the datasource version is greater than the taxeditor compatible version then the taxeditor needs to
- // be updated else the datasource needs to be updated
- if(compareVersion > 0) {
- message = "Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible datasource";
- } else if (compareVersion < 0) {
- message = "Please update the chosen datasource or choose a new data source to connect to in the Datasource View.";
- }
- }
- monitor.worked(1);
- } catch (CdmSourceException e) {
- //
- }
-
- if (message != null) {
- // Show an error message
- MessagingUtils
- .messageDialog(
- "Datasource Compatibility Check failed",
- this,
- "The database schema for the chosen "
- + "datasource '"
- + cdmSource
- + "' \n is not compatible for this version of the taxonomic editor. \n\n"
- + message,
- null);
-
- monitor.setCanceled(true);
- }
-
- }
-
- private void checkIsNonEmptyCdmDatabase(IProgressMonitor monitor) {
- monitor.subTask("Checking if datasource is a non empty CDM database.");
- boolean isDbEmpty = false;
- try {
- isDbEmpty = cdmSource.isDbEmpty();
- } catch (CdmSourceException e) {
- isDbEmpty = true;
- }
- if(isDbEmpty) {
- dbSchemaValidation = DbSchemaValidation.CREATE;
- }
- }
-
- private boolean causeIsCancelationExceptionRecursive(Throwable throwable){
- if(throwable == null){
- return false;
- }else if(throwable instanceof CancellationException){
- return true;
- }else{
- return causeIsCancelationExceptionRecursive(throwable.getCause());
- }
- }
-
- private void checkDatabaseReachable(IProgressMonitor monitor) {
- try {
- monitor.subTask("Checking if datasource is reachable.");
- cdmSource.checkConnection();
- monitor.worked(1);
- } catch (CdmSourceException e) {
- MessagingUtils.messageDialog("Could not connect to chosen datasource",
- this, "Reason: " + e.getMessage(), e);
- monitor.setCanceled(true);
- }
- }
+ private final Display display;
+ private final ICdmSource cdmSource;
+ private DbSchemaValidation dbSchemaValidation;
+ private final Resource applicationContextBean;
+
+
+ /**
+ * @param datasource
+ * @param dbSchemaValidation
+ * @param applicationContextBean
+ */
+ public CdmStoreConnector(Display display,
+ ICdmSource cdmSource,
+ DbSchemaValidation dbSchemaValidation,
+ Resource applicationContextBean) {
+ super("Connecting to datasource: " + cdmSource);
+ this.display = display;
+ this.cdmSource = cdmSource;
+ this.dbSchemaValidation = dbSchemaValidation;
+ this.applicationContextBean = applicationContextBean;
+ }
+
+
+
+ @Override
+ public IStatus run(final IProgressMonitor monitor) {
+
+ monitor.beginTask(getConnectionMessage(), 10);
+
+ // check if database is up and running
+ checkDatabaseReachable(monitor);
+
+ if (!monitor.isCanceled()) {
+ // check if the datasource actually holds data
+ checkIsNonEmptyCdmDatabase(monitor);
+ }
+
+ if (dbSchemaValidation != DbSchemaValidation.CREATE
+ && !monitor.isCanceled()) {
+ // if we do not create the datasource, we want to check if the
+ // datasource is compatible with this editor
+ checkDbSchemaVersionCompatibility(monitor);
+ }
+
+ // we are done with our low level checking and will free resources now
+ cdmSource.closeOpenConnections();
+
+ if (!monitor.isCanceled()) {
+ CdmStore.close(monitor);
+ }
+
+ ICdmApplicationConfiguration applicationController = null;
+
+ if (!monitor.isCanceled()) {
+ CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
+ .CreateSubMonitor(monitor, 7);
+ // This is where we instantiate the application controller
+ int oldPriority = Thread.currentThread().getPriority();
+ try {
+ Thread.currentThread().setPriority(10);
+ applicationController = getApplicationController(cdmSource,subprogressMonitor);
+ } catch (Exception e) {
+ if(! causeIsCancelationExceptionRecursive(e)){
+ return new Status(IStatus.ERROR, "Could not connect to CDM Store", "An error occurred while trying to connect to datasource: " + cdmSource.getName(), e);
+ }
+ } finally {
+ monitor.done();
+ Thread.currentThread().setPriority(oldPriority);
+ }
+ }
+
+
+
+ if (!monitor.isCanceled()) {
+ CdmStore.setInstance(applicationController, cdmSource);
+
+ display.asyncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ authenticate();
+
+ startContext();
+ }
+ });
+
+ MessagingUtils.info("Application context initialized.");
+ return Status.OK_STATUS;
+ } else {
+ // Show datasource view if not shown yet
+ display.asyncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ StoreUtil.showView(CdmDataSourceViewPart.ID);
+ }
+ });
+ return Status.CANCEL_STATUS;
+ }
+
+ }
+
+ public void start(final RemotingLoginDialog loginDialog) {
+ // hide login dialog and start connection dialog
+ loginDialog.setMessage(null);
+ loginDialog.hide(true);
+
+
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
+
+ try {
+ dialog.run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(final IProgressMonitor monitor) {
+ try {
+ monitor.beginTask(getConnectionMessage(), 7);
+
+ // check if database is up and running
+ checkDatabaseReachable(monitor);
+
+ // check if the datasource actually holds data
+ checkIsNonEmptyCdmDatabase(monitor);
+
+ if (dbSchemaValidation != DbSchemaValidation.CREATE) {
+ // if we do not create the datasource, we want to check if the
+ // datasource is compatible with this editor
+ checkDbSchemaVersionCompatibility(monitor);
+ }
+
+ // we are done with our low level checking and will free resources now
+ cdmSource.closeOpenConnections();
+
+ display.syncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+ // close the current context
+ CdmStore.close(monitor, false);
+ }
+ });
+
+ ICdmApplicationConfiguration applicationController = null;
+
+ if (!monitor.isCanceled()) {
+ CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
+ .CreateSubMonitor(monitor, 3);
+ // genrerate new application controller
+ applicationController = getApplicationController(cdmSource,subprogressMonitor);
+ }
+
+
+ if (!monitor.isCanceled()) {
+ CdmStore.setInstance(applicationController, cdmSource);
+ monitor.subTask("Authenticating user");
+ display.syncExec(new Runnable() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ @Override
+ public void run() {
+
+ try {
+ // create new security context
+ CdmStore.getLoginManager().doAuthenticate(loginDialog.getUsername(), loginDialog.getPassword());
+ loginDialog.onComplete();
+ CdmStore.getContextManager().notifyContextStart();
+ Rank.initDefaultTerms();
+ } catch(CdmAuthenticationException cae) {
+ loginDialog.hide(false);
+ loginDialog.setMessage(cae.getMessage());
+ }
+
+ }
+ });
+ } else {
+ throw new RuntimeException("Login cancelled");
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ loginDialog.hide(false);
+ loginDialog.setMessage(e.getMessage());
+ } catch (InterruptedException e) {
+ loginDialog.hide(false);
+ loginDialog.setMessage(e.getMessage());
+ }
+ }
+
+
+ private ICdmApplicationConfiguration getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
+ if(cdmSource instanceof ICdmDataSource) {
+ return CdmApplicationController.NewInstance(applicationContextBean,
+ (ICdmDataSource)cdmSource,
+ dbSchemaValidation,
+ false,
+ subprogressMonitor);
+ } else if(cdmSource instanceof ICdmRemoteSource) {
+ return CdmApplicationRemoteController.NewInstance((ICdmRemoteSource)cdmSource,
+ subprogressMonitor,
+ null);
+ } else {
+ throw new UnsupportedOperationException("Cannot create application controller for " + cdmSource.getName());
+ }
+ }
+
+ private void authenticate() {
+ LoginDialog saloginDialog = new LoginDialog(StoreUtil.getShell());
+ saloginDialog.open();
+ }
+
+ private void startContext() {
+ CdmStore.getContextManager().notifyContextStart();
+ }
+
+ /**
+ * @return
+ */
+ private String getConnectionMessage() {
+ return cdmSource.getConnectionMessage();
+ }
+
+ /**
+ * @return
+ * @throws SQLException
+ */
+ private void checkDbSchemaVersionCompatibility(IProgressMonitor monitor) {
+ monitor.subTask("Checking if datasource is compatible with this editor.");
+ String dbSchemaVersion;
+
+ String message = null;
+ try {
+ dbSchemaVersion = cdmSource.getDbSchemaVersion();
+ // we assume that empty dbSchemaVersion means an empty database and
+ // skip version checking
+
+ if(dbSchemaVersion != null) {
+ int compareVersion = CdmMetaData.compareVersion(dbSchemaVersion, CdmMetaData.getDbSchemaVersion(), 3, null);
+ // if the datasource version is greater than the taxeditor compatible version then the taxeditor needs to
+ // be updated else the datasource needs to be updated
+ if(compareVersion > 0) {
+ message = "Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible datasource";
+ } else if (compareVersion < 0) {
+ message = "Please update the chosen datasource or choose a new data source to connect to in the Datasource View.";
+ }
+ }
+ monitor.worked(1);
+ } catch (CdmSourceException e) {
+ //
+ }
+
+ if (message != null) {
+ // Show an error message
+ MessagingUtils
+ .messageDialog(
+ "Datasource Compatibility Check failed",
+ this,
+ "The database schema for the chosen "
+ + "datasource '"
+ + cdmSource
+ + "' \n is not compatible for this version of the taxonomic editor. \n\n"
+ + message,
+ null);
+
+ monitor.setCanceled(true);
+ }
+
+ }
+
+ private void checkIsNonEmptyCdmDatabase(IProgressMonitor monitor) {
+ monitor.subTask("Checking if datasource is a non empty CDM database.");
+ boolean isDbEmpty = false;
+ try {
+ isDbEmpty = cdmSource.isDbEmpty();
+ } catch (CdmSourceException e) {
+ isDbEmpty = true;
+ }
+ if(isDbEmpty) {
+ dbSchemaValidation = DbSchemaValidation.CREATE;
+ }
+ }
+
+ private boolean causeIsCancelationExceptionRecursive(Throwable throwable){
+ if(throwable == null){
+ return false;
+ }else if(throwable instanceof CancellationException){
+ return true;
+ }else{
+ return causeIsCancelationExceptionRecursive(throwable.getCause());
+ }
+ }
+
+ private void checkDatabaseReachable(IProgressMonitor monitor) {
+ try {
+ monitor.subTask("Checking if datasource is reachable.");
+ cdmSource.checkConnection();
+ monitor.worked(1);
+ } catch (CdmSourceException e) {
+ MessagingUtils.messageDialog("Could not connect to chosen datasource",
+ this, "Reason: " + e.getMessage(), e);
+ monitor.setCanceled(true);
+ }
+ }
+
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.store;
+
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
+
+/**
+ * @author cmathew
+ * @date 18 Jun 2015
+ *
+ */
+public class CdmUIDataChangeService extends CdmDataChangeService {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireChangeEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent, boolean)
+ */
+ @Override
+ public void fireChangeEvent(final CdmChangeEvent event, boolean async) {
+
+ for(final ICdmChangeListener listener : listeners) {
+ // Update the user interface asynchronously
+ if(async) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ listener.onChange(event);
+ }
+ });
+ } else {
+ // Update the user interface synchronously
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ listener.onChange(event);
+ }
+ });
+ }
+ }
+ }
+
+}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.store;
import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.XMLMemento;
+import org.eclipse.ui.internal.Workbench;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MementoHelper;
* @version 1.0
*/
public class ContextManager implements IWorkbenchListener{
-
- private ListenerList contextListeners = new ListenerList();
-
- private IMemento memento;
-
- /**
- * <p>Constructor for ContextManager.</p>
- */
- protected ContextManager() {
- PlatformUI.getWorkbench().addWorkbenchListener(this);
- }
-
- /**
- * <p>addContextListener</p>
- *
- * @param listener a {@link eu.etaxonomy.taxeditor.model.IContextListener} object.
- */
- public void addContextListener(IContextListener listener){
- contextListeners.add(listener);
- }
-
- /**
- * <p>removeContextListener</p>
- *
- * @param listener a {@link eu.etaxonomy.taxeditor.model.IContextListener} object.
- */
- public void removeContextListener(IContextListener listener) {
- contextListeners.remove(listener);
- }
-
- /**
- * <p>notifyContextStart</p>
- */
- public void notifyContextStart() {
- MessagingUtils.info("Notifying context listeners, that the context has started.");
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
-
- try {
- dialog.run(false, false, new IRunnableWithProgress() {
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- monitor.beginTask("Starting context", contextListeners.size());
-
-
- readMemento();
-
- for(final Object listener : contextListeners.getListeners()){
- ((IContextListener) listener).contextStart(memento, monitor);
- monitor.worked(1);
- }
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- MessagingUtils.error(getClass(), e);
- } catch (InterruptedException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
-
-
- /**
- *
- */
- public void notifyContextRefresh() {
- MessagingUtils.info("Notifying context listeners, that the context needs to be refreshed.");
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
-
- try {
- dialog.run(false, false, new IRunnableWithProgress() {
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- monitor.beginTask("Refreshing context", contextListeners.size());
-
- for(final Object listener : contextListeners.getListeners()){
- ((IContextListener) listener).contextRefresh(monitor);
- monitor.worked(1);
- }
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- MessagingUtils.error(getClass(), e);
- } catch (InterruptedException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
-
- /**
- * <p>notifyContextAboutToStop</p>
- *
- * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
- */
- public void notifyContextAboutToStop(final IProgressMonitor monitor){
-
- IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
-
- subMonitor.beginTask("Stoping context", contextListeners.size());
- // we are creating the memento here; even if the context is not stopped
- createMemento();
-
- for(final Object listener : contextListeners.getListeners()){
- ((IContextListener) listener).contextAboutToStop(memento, subMonitor);
- subMonitor.worked(1);
- }
-
- subMonitor.done();
- }
-
- /**
- * <p>notifyContextStop</p>
- *
- * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
- */
- public void notifyContextStop(IProgressMonitor monitor) {
-
- IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
-
- subMonitor.beginTask("Stoping context", contextListeners.size());
- MessagingUtils.info("Notifying context listeners, that the context has stopped.");
-
- for(Object listener : contextListeners.getListeners()){
- ((IContextListener) listener).contextStop(memento, subMonitor);
- subMonitor.worked(1);
- }
-
- saveMemento();
- subMonitor.done();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchListener#preShutdown(org.eclipse.ui.IWorkbench, boolean)
- */
- /** {@inheritDoc} */
- @Override
- public boolean preShutdown(IWorkbench workbench, boolean forced) {
-
- createMemento();
-
- IProgressMonitor monitor = null;
-
- for(Object listener : contextListeners.getListeners()){
- ((IContextListener) listener).workbenchShutdown(memento, monitor);
- }
-
- saveMemento();
-
- // return true in any case, otherwise the application will not stop
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchListener#postShutdown(org.eclipse.ui.IWorkbench)
- */
- /** {@inheritDoc} */
- @Override
- public void postShutdown(IWorkbench workbench) {
-
-
- }
-
-
- private void readMemento(){
- try {
- memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase());
- } catch (FileNotFoundException e) {
- // no memento -> no previous state
- MessagingUtils.info("No state file for datasource");
- }
- }
-
- private void createMemento(){
-
- if (CdmStore.getActiveCdmSource() != null) {
-
- try {
- String name = CdmStore.getActiveCdmSource().getName();
- name = name.trim();
- name = name.replace(" ", "_");
- memento = XMLMemento.createWriteRoot(name);
-
- MessagingUtils.info("DataSource found. Memento created.");
- } catch (Exception e) {
- // The memento could not be created, but a not closable editor is avoided for this case.
- MessagingUtils.error(this.getClass(), "The memento could not be created", e);
- }
- } else {
- MessagingUtils.info("Not storing state data, because no DataSource present.");
- }
-
- }
-
- private boolean saveMemento(){
- return MementoHelper.saveMementoToFile(memento, getStateFileForCurrentDatabase()) != null;
- }
-
- /**
- * <p>getStateFileForCurrentDatabase</p>
- *
- * @return a {@link java.io.File} object.
- */
- protected File getStateFileForCurrentDatabase() {
- if(CdmStore.getActiveCdmSource() == null){
- return null;
- }
-
- IPath path = TaxeditorStorePlugin.getDefault().getStateLocation();
- if (path == null) {
- return null;
- }
- path = path.append("editor_state_" + CdmStore.getActiveCdmSource().getName() + ".xml");
- return path.toFile();
- }
+
+ private final ListenerList contextListeners = new ListenerList();
+
+ private IMemento memento;
+
+ /**
+ * <p>Constructor for ContextManager.</p>
+ */
+ protected ContextManager() {
+ if(Workbench.getInstance() != null) {
+ PlatformUI.getWorkbench().addWorkbenchListener(this);
+ }
+ }
+
+ /**
+ * <p>addContextListener</p>
+ *
+ * @param listener a {@link eu.etaxonomy.taxeditor.model.IContextListener} object.
+ */
+ public void addContextListener(IContextListener listener){
+ contextListeners.add(listener);
+ }
+
+ /**
+ * <p>removeContextListener</p>
+ *
+ * @param listener a {@link eu.etaxonomy.taxeditor.model.IContextListener} object.
+ */
+ public void removeContextListener(IContextListener listener) {
+ contextListeners.remove(listener);
+ }
+
+ public void notifyContextStartWithoutDialog(IProgressMonitor monitor) {
+ MessagingUtils.info("Notifying context listeners, that the context has started.");
+
+ readMemento();
+
+ for(final Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).contextStart(memento, monitor);
+ }
+ }
+ /**
+ * <p>notifyContextStart</p>
+ */
+ public void notifyContextStart() {
+ MessagingUtils.info("Notifying context listeners, that the context has started.");
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
+
+ try {
+ dialog.run(false, false, new IRunnableWithProgress() {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Starting context", contextListeners.size());
+
+
+ readMemento();
+
+ for(final Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).contextStart(memento, monitor);
+ monitor.worked(1);
+ }
+ monitor.done();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ MessagingUtils.error(getClass(), e);
+ } catch (InterruptedException e) {
+ MessagingUtils.error(getClass(), e);
+ }
+ }
+
+
+ /**
+ *
+ */
+ public void notifyContextRefresh() {
+ MessagingUtils.info("Notifying context listeners, that the context needs to be refreshed.");
+ ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
+
+ try {
+ dialog.run(false, false, new IRunnableWithProgress() {
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ monitor.beginTask("Refreshing context", contextListeners.size());
+
+ for(final Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).contextRefresh(monitor);
+ monitor.worked(1);
+ }
+ monitor.done();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ MessagingUtils.error(getClass(), e);
+ } catch (InterruptedException e) {
+ MessagingUtils.error(getClass(), e);
+ }
+ }
+
+ /**
+ * <p>notifyContextAboutToStop</p>
+ *
+ * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ */
+ public void notifyContextAboutToStop(final IProgressMonitor monitor){
+
+ IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
+
+ subMonitor.beginTask("Stoping context", contextListeners.size());
+ // we are creating the memento here; even if the context is not stopped
+ createMemento();
+
+ for(final Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).contextAboutToStop(memento, subMonitor);
+ subMonitor.worked(1);
+ }
+
+ subMonitor.done();
+ }
+
+ /**
+ * <p>notifyContextStop</p>
+ *
+ * @param monitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+ */
+ public void notifyContextStop(IProgressMonitor monitor) {
+
+ IProgressMonitor subMonitor = StoreUtil.getSubProgressMonitor(monitor, 1);
+
+ subMonitor.beginTask("Stoping context", contextListeners.size());
+ MessagingUtils.info("Notifying context listeners, that the context has stopped.");
+
+ for(Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).contextStop(memento, subMonitor);
+ subMonitor.worked(1);
+ }
+
+ saveMemento();
+ subMonitor.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchListener#preShutdown(org.eclipse.ui.IWorkbench, boolean)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public boolean preShutdown(IWorkbench workbench, boolean forced) {
+
+ createMemento();
+
+ IProgressMonitor monitor = null;
+
+ for(Object listener : contextListeners.getListeners()){
+ ((IContextListener) listener).workbenchShutdown(memento, monitor);
+ }
+
+ saveMemento();
+
+ // return true in any case, otherwise the application will not stop
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchListener#postShutdown(org.eclipse.ui.IWorkbench)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void postShutdown(IWorkbench workbench) {
+
+
+ }
+
+
+ private void readMemento(){
+ try {
+ memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase());
+ } catch (FileNotFoundException e) {
+ // no memento -> no previous state
+ MessagingUtils.info("No state file for datasource");
+ }
+ }
+
+ private void createMemento(){
+
+ if (CdmStore.getActiveCdmSource() != null) {
+
+ try {
+ String name = CdmStore.getActiveCdmSource().getName();
+ name = name.trim();
+ name = name.replace(" ", "_");
+ memento = XMLMemento.createWriteRoot(name);
+
+ MessagingUtils.info("DataSource found. Memento created.");
+ } catch (Exception e) {
+ // The memento could not be created, but a not closable editor is avoided for this case.
+ MessagingUtils.error(this.getClass(), "The memento could not be created", e);
+ }
+ } else {
+ MessagingUtils.info("Not storing state data, because no DataSource present.");
+ }
+
+ }
+
+ private boolean saveMemento(){
+ return MementoHelper.saveMementoToFile(memento, getStateFileForCurrentDatabase()) != null;
+ }
+
+ /**
+ * <p>getStateFileForCurrentDatabase</p>
+ *
+ * @return a {@link java.io.File} object.
+ */
+ protected File getStateFileForCurrentDatabase() {
+ if(CdmStore.getActiveCdmSource() == null){
+ return null;
+ }
+
+ IPath path = TaxeditorStorePlugin.getDefault().getStateLocation();
+ if (path == null) {
+ return null;
+ }
+ path = path.append("editor_state_" + CdmStore.getActiveCdmSource().getName() + ".xml");
+ return path.toFile();
+ }
}
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.Group;
private ConversationHolder conversation;
+ public static final String INCORRECT_CREDENTIALS_MESSAGE = "Login and/or Password incorrect";
+ public static final String ACCOUNT_LOCKED_MESSAGE = "Account is locked";
+ public static final String EMPTY_CREDENTIALS_MESSAGE = "Login and/or Password empty";
+
public LoginManager(){
- CdmStore.getContextManager().addContextListener(this);
+ CdmStore.getContextManager().addContextListener(this);
}
/**
*/
public boolean authenticate(String username, String password){
- // close all open editors
- if(!AbstractUtility.closeAll()){
- return false;
- }
-
-
- try{
- SecurityContextHolder.clearContext();
-
- Authentication lastAuthentication = CdmStore.getCurrentAuthentiation();
-
- UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
- Authentication authentication = CdmStore.getAuthenticationManager().authenticate(token);
+ // close all open editors
+ if(!AbstractUtility.closeAll()){
+ return false;
+ }
- User user = (User) authentication.getPrincipal();
- /* circumventing problem with hibernate not refreshing the transient collection authorities in this case,
- * see http://dev.e-taxonomy.eu/trac/ticket/4053 */
- user.initAuthorities();
- if(logger.isDebugEnabled()){
- StringBuilder gaText = new StringBuilder();
- String indent = " ";
- Set<GrantedAuthority> gaSet = user.getGrantedAuthorities();
- _logGrantedAuthotities(gaText, indent, gaSet);
- for(Group gr : user.getGroups()){
- gaText.append(indent).append("gr[").append(gr.hashCode()).append("] \"").append(gr.getName()).append("\" ").append(gr.toString()).append("\n");
- _logGrantedAuthotities(gaText, indent + indent, gr.getGrantedAuthorities());
- }
- logger.debug("User authenticated: " + user.getUsername() + "\n" + gaText.toString());
- }
+ try{
+ doAuthenticate(username, password);
+ } catch (CdmAuthenticationException e) {
+ MessagingUtils.warningDialog("Could not authenticate", this, e.getMessage());
+ return false;
+ }
+ return true;
+ }
- SecurityContextHolder.getContext().setAuthentication(authentication);
+ public void doAuthenticate(String username, String password) throws CdmAuthenticationException {
+ try {
+ SecurityContextHolder.clearContext();
+ Authentication lastAuthentication = CdmStore.getCurrentAuthentiation();
+
+ UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
+ Authentication authentication = CdmStore.getAuthenticationManager().authenticate(token);
+
+ User user = (User) authentication.getPrincipal();
+ /* circumventing problem with hibernate not refreshing the transient collection authorities in this case,
+ * see http://dev.e-taxonomy.eu/trac/ticket/4053 */
+ user.initAuthorities();
+
+ if(logger.isDebugEnabled()){
+ StringBuilder gaText = new StringBuilder();
+ String indent = " ";
+ Set<GrantedAuthority> gaSet = user.getGrantedAuthorities();
+ _logGrantedAuthotities(gaText, indent, gaSet);
+ for(Group gr : user.getGroups()){
+ gaText.append(indent).append("gr[").append(gr.hashCode()).append("] \"").append(gr.getName()).append("\" ").append(gr.toString()).append("\n");
+ _logGrantedAuthotities(gaText, indent + indent, gr.getGrantedAuthorities());
+ }
+ logger.debug("User authenticated: " + user.getUsername() + "\n" + gaText.toString());
+ }
+
+ authentication = new UsernamePasswordAuthenticationToken(user,password, authentication.getAuthorities());
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+ CdmApplicationState.setCurrentSecurityContext(SecurityContextHolder.getContext());
+
+ if(!authentication.equals(lastAuthentication)){
+ this.setChanged();
+ this.notifyObservers();
+ }
+ } catch(BadCredentialsException e){
+ throw new CdmAuthenticationException(INCORRECT_CREDENTIALS_MESSAGE, e);
+ } catch(LockedException e){
+ throw new CdmAuthenticationException(ACCOUNT_LOCKED_MESSAGE, e);
+ } catch(IllegalArgumentException e){
+ throw new CdmAuthenticationException(EMPTY_CREDENTIALS_MESSAGE, e);
+ }
- if(!authentication.equals(lastAuthentication)){
- this.setChanged();
- this.notifyObservers();
- }
- return true;
- }
- catch(BadCredentialsException e){
- MessagingUtils.warningDialog("Could not authenticate", this, "Could not authenticate. Reason: Bad Credentials.");
- }
- catch(LockedException e){
- MessagingUtils.warningDialog("Could not authenticate", this, "Could not authenticate. Reason: Account is locked.");
- }
- catch(IllegalArgumentException e){
- MessagingUtils.warningDialog("Could not authenticate", this, "Could not authenticate. Reason: Username and/or Password empty.");
- }
- return false;
}
+
private void _logGrantedAuthotities(StringBuilder gaText, String indent,
Set<GrantedAuthority> gaSet) {
for(GrantedAuthority ga : gaSet){
* @return a {@link eu.etaxonomy.cdm.model.common.User} object.
*/
public User getAuthenticatedUser(){
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if(authentication != null
&& authentication.getPrincipal() != null
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.RelationshipBase;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
if(checkLargeResult(CdmStore.getService(INameService.class).countByTitle(configurator))){
List<TaxonNameBase> records = CdmStore.getService(INameService.class).findByTitle(configurator).getRecords();
- TaxonNameBase uuidSearchResult = addUuidSearchResults(configurator, INameService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, INameService.class);
return records;
}
return NO_RESULTS;
public List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
if(checkLargeResult(CdmStore.getService(IReferenceService.class).countByTitle(configurator))){
List<Reference> records = CdmStore.getService(IReferenceService.class).findByTitle(configurator).getRecords();
- Reference uuidSearchResult = addUuidSearchResults(configurator, IReferenceService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, IReferenceService.class);
return records;
}
return NO_RESULTS;
public List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
if(checkLargeResult(CdmStore.getService(IAgentService.class).countByTitle(configurator))){
List<AgentBase> records = CdmStore.getService(IAgentService.class).findByTitle(configurator).getRecords();
- AgentBase uuidSearchResult = addUuidSearchResults(configurator, IAgentService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, IAgentService.class);
return records;
}
return NO_RESULTS;
/**
* Check search string if it is a {@link UUID} and, if <code>true</code>, search for the corresponding entity.
+ * @param records the list to which the search results are added
* @param configurator the configurator holding the search string
* @param service the service to use for searching
*/
- private <T extends ICdmBase> T addUuidSearchResults(IIdentifiableEntityServiceConfigurator configurator, Class<? extends IService<T>> service) {
+ private <T extends ICdmBase> void addUuidSearchResults(List<T> records, IIdentifiableEntityServiceConfigurator configurator, Class<? extends IService<T>> service) {
String titleSearchString = configurator.getTitleSearchString();
try {
UUID uuid = UUID.fromString(titleSearchString);
- return CdmStore.getService(service).find(uuid);
+ T foundRecord = CdmStore.getService(service).find(uuid);
+ if(foundRecord!=null){
+ records.add(foundRecord);
+ }
} catch (IllegalArgumentException e) {
//search string was no UUID
}
- return null;
}
@SuppressWarnings("unchecked")
*/
public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> configurator, boolean showFieldUnits){
List<SpecimenOrObservationBase> records = new ArrayList<SpecimenOrObservationBase>();
- if(configurator.getClazz()==null){
- if(showFieldUnits){
- configurator.setClazz(SpecimenOrObservationBase.class);
- }
- else{
- configurator.setClazz(DerivedUnit.class);
- }
+ final List<String> BASE_OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
+ "collection",
+ "descriptions",
+ "identifiers",
+ "derivationEvents.originals",
+ "derivedFrom.originals",
+ "gatheringEvent.country.representations",
+ "gatheringEvent.collector",
+ "gatheringEvent.locality",
+ "descriptions.descriptionElements",
+ "kindOfUnit",
+ "amplificationResults",
+ "sequences.singleReadAlignments",
+ "mediaSpecimen"
+ });
+
+ List<String> occurrencePropertyPaths = new ArrayList<String>();
+ occurrencePropertyPaths.addAll(BASE_OCCURRENCE_INIT_STRATEGY);
+ for(String propertyPath:BASE_OCCURRENCE_INIT_STRATEGY) {
+ occurrencePropertyPaths.add("derivationEvents.derivatives." + propertyPath);
}
- if(configurator.getClazz().equals(SpecimenOrObservationBase.class)){
- //get FieldUnits + DerivedUnits
- configurator.setClazz(DerivedUnit.class);
- int derivedUnitCount = CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator);
- configurator.setClazz(FieldUnit.class);
- int fieldUnitCount = CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator);
-
- if(checkLargeResult(derivedUnitCount+fieldUnitCount)){
- configurator.setClazz(DerivedUnit.class);
- records.addAll(CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords());
- configurator.setClazz(FieldUnit.class);
- records.addAll(CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords());
- }
+ configurator.setPropertyPaths(occurrencePropertyPaths);
- }
- else if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
+ if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countOccurrences(configurator))){
records = CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords();
}
- SpecimenOrObservationBase uuidSearchResult = addUuidSearchResults(configurator, IOccurrenceService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, IOccurrenceService.class);
return records;
}
String userNameSearchString = sqlizeTitleSearchString(configurator);
// TODO why are users not identifiable entities?
List<User> records = CdmStore.getService(IUserService.class).listByUsername(userNameSearchString, null, null, null, null, null, null);
- User uuidSearchResult = addUuidSearchResults(configurator, IUserService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, IUserService.class);
return records;
}
String groupNameSearchString = sqlizeTitleSearchString(configurator);
// TODO why are groups not identifiable entities?
List<Group> records = CdmStore.getService(IGroupService.class).listByName(groupNameSearchString, null, null, null, null, null, null);
- Group uuidSearchResult = addUuidSearchResults(configurator, IGroupService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, IGroupService.class);
return records;
}
private boolean checkLargeResult(int count) {
- if(count > MAX_RESULTS_BEFORE_WARNING){
+ return checkLargeResult(count, MAX_RESULTS_BEFORE_WARNING);
+ }
+
+ private boolean checkLargeResult(int count, int maxBeforWarning) {
+ if(count > maxBeforWarning){
return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Large result expected",
String.format("The current search will return %s objects. This will " +
"take a long time and/or might render the editor unusable. Please consider refining your search.", count));
public List findTaxa(IIdentifiableEntityServiceConfigurator configurator) {
if(checkLargeResult(CdmStore.getService(ITaxonService.class).countByTitle(configurator))){
List<TaxonBase> records = CdmStore.getService(ITaxonService.class).findByTitle(configurator).getRecords();
- TaxonBase uuidSearchResult = addUuidSearchResults(configurator, ITaxonService.class);
- if(uuidSearchResult!=null){
- records.add(uuidSearchResult);
- }
+ addUuidSearchResults(records, configurator, ITaxonService.class);
return records;
}
return NO_RESULTS;
}
+ public List findMedia(IIdentifiableEntityServiceConfigurator configurator) {
+ if(checkLargeResult(CdmStore.getService(IMediaService.class).countByTitle(configurator))){
+ List<Media> records = CdmStore.getService(IMediaService.class).findByTitle(configurator).getRecords();
+ addUuidSearchResults(records, configurator, IMediaService.class);
+ return records;
+ }
+ return NO_RESULTS;
+ }
+
}
* @param clazz
* @return
*/
- public List<DefinedTermBase<?>> getPreferredTerms(TermType termType){
- return getFilteredTerms(TermStore.getTerms(termType, null));
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(TermType termType){
+ return getFilteredTerms(TermStore.<T>getTerms(termType, null));
}
/**
* @param termType the term type
* @return an alphabetically sorted list of terms
*/
- public static List<DefinedTermBase<?>> getTerms(TermType termType, Comparator<DefinedTermBase<?>> comparator){
+ public static <TERM extends DefinedTermBase> List<TERM> getTerms(TermType termType, Comparator<TERM> comparator){
return getTermsFromService(termType, comparator);
}
* @param comparator
* @return
*/
- private static List<DefinedTermBase<?>> getTermsFromService(TermType termType, Comparator<DefinedTermBase<?>> comparator){
+ private static <T extends DefinedTermBase> List<T> getTermsFromService(TermType termType, Comparator<T> comparator){
if (comparator == null){
- comparator = new DefaultTermComparator<DefinedTermBase<?>>();
+ comparator = new DefaultTermComparator<T>();
}
- List<DefinedTermBase<?>> terms = CdmStore.getService(ITermService.class).listByTermType(termType, null, null, null, null);
+ List<T> terms = CdmStore.getService(ITermService.class).listByTermType(termType, null, null, null, null);
Collections.sort(terms, comparator);
return terms;
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.ui;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.RootElement;
+
+/**
+ * @author pplitzner
+ * @date Mar 30, 2016
+ *
+ */
+public abstract class AbstractEntityCollectionElementWizardPage extends WizardPage implements
+IPropertyChangeListener {
+
+ protected CdmFormFactory formFactory;
+
+ protected RootElement rootElement;
+
+ protected AbstractEntityCollectionElementWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControl(Composite parent) {
+ this.setPageComplete(false);
+
+ Composite control = formFactory.createComposite(parent);
+
+ TableWrapLayout layout = LayoutConstants.LAYOUT(2, false);
+ layout.horizontalSpacing = 5;
+ control.setLayout(layout);
+
+ rootElement = new RootElement(formFactory, control);
+
+
+ setControl(control);
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ rootElement.removeElements();
+ formFactory.removePropertyChangeListener(this);
+ super.dispose();
+ }
+
+}
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.ui.bar;
import java.util.Observer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.util.ApplicationUtil;
/**
* Shows the currently logged in user in status bar
*/
public class AuthenticatedUserBar extends WorkbenchWindowControlContribution implements Observer{
- private Label label_authenticatedUser;
-
- /**
- * <p>Constructor for AuthenticatedUserBar.</p>
- */
- public AuthenticatedUserBar(){
- CdmStore.getLoginManager().addObserver(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
- */
- /** {@inheritDoc} */
- @Override
- protected Control createControl(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- final GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- label_authenticatedUser = new Label(composite, SWT.NULL);
-
- update(null, null);
-
- return composite;
- }
-
- /* (non-Javadoc)
- * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
- */
- /** {@inheritDoc} */
- public void update(Observable o, Object arg) {
- User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
- // TODO find a method to recompute width for parental toolbar item
- String text = authenticatedUser == null ? "Not logged in " :
- "Logged in as: " + authenticatedUser.getUsername() + " ";
- label_authenticatedUser.setText(text);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.ContributionItem#dispose()
- */
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- super.dispose();
-
- CdmStore.getLoginManager().deleteObserver(this);
- }
-
+ private Label label_authenticatedUser;
+
+ /**
+ * <p>Constructor for AuthenticatedUserBar.</p>
+ */
+ public AuthenticatedUserBar(){
+ CdmStore.getLoginManager().addObserver(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected Control createControl(Composite parent) {
+
+ label_authenticatedUser = new Label(parent, SWT.NULL);
+
+ update(null, null);
+
+ return label_authenticatedUser;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void update(Observable o, Object arg) {
+ User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
+ // TODO find a method to recompute width for parental toolbar item
+ String text = "";
+ if(authenticatedUser == null) {
+ text = "Not logged in " ;
+ } else {
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ CdmRemoteSource source = (CdmRemoteSource) CdmStore.getActiveCdmSource();
+ String loginInfo = authenticatedUser.getUsername() + "@" + source.getName() + ":" + source.getContextPath();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(ApplicationUtil.getTitle() + " " + loginInfo);
+ }
+ text = "Logged in as: " + authenticatedUser.getUsername() + " ";
+ }
+
+ label_authenticatedUser.setText(text);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.ContributionItem#dispose()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ super.dispose();
+ CdmStore.getLoginManager().deleteObserver(this);
+ }
+
}
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
private Comparator<T> termComparator;
+ private final TermType termType;
+ private final TermVocabulary termVocabulary;
private final Class<T> termClass;
private List<T> customPreferredTerms;
int style) {
super(formFactory, parentElement);
- if(termClass!=null){
- this.termClass = termClass;
- }
- else{
- this.termClass = (Class<T>) DefinedTerm.class;
- }
+ this.termType = termType;
+ this.termVocabulary = termVocabulary;
+ this.termClass = termClass;
this.addEmptyElement = addEmptyElement;
if (labelString != null) {
* @return a {@link java.util.List} object.
*/
protected List<T> getPreferredTerms(){
+ List<T> preferredTerms = new ArrayList<T>();
if (customPreferredTerms != null){
return customPreferredTerms;
}
- return getTermManager().getPreferredTerms(termClass);
+ else if(termType!=null){
+ preferredTerms = getTermManager().getPreferredTerms(termType);
+ }
+ else if(termVocabulary!=null){
+ preferredTerms = getTermManager().getPreferredTerms(termVocabulary);
+ }
+ if(termClass!=null){
+ preferredTerms = getTermManager().getPreferredTerms(termClass);
+ }
+ return preferredTerms;
}
/**
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.ui.dialog;
+
+import java.io.Serializable;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.operation.FeedbackGenerator;
+
+/**
+ * Feedback Generator corresponding to a {@link MessageBox}
+ *
+ * @author cmathew
+ * @date 29 Oct 2015
+ *
+ */
+public class FeedbackMessageBox extends FeedbackGenerator {
+
+ private Shell shell;
+ /**
+ * @param parent
+ */
+ public FeedbackMessageBox(Shell parent) {
+ this.shell = parent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Serializable generateFeedback() {
+
+ // create a dialog with ok and cancel buttons and a question icon
+ MessageBox dialog =
+ new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK| SWT.CANCEL);
+ dialog.setText("Monitor Feedback");
+ dialog.setMessage("Do you really want to continue?");
+
+ // open dialog and await user selection
+ return dialog.open();
+ }
+}
// $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.
*/
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.taxeditor.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
* TODO wrap in a LoginModule
* @version 1.0
*/
public class LoginDialog extends Dialog {
-
+
private static Text text_password;
private static Text text_username;
- private String title;
+ private final String title;
- /**
- * <p>Constructor for LoginDialog.</p>
- *
- * @param parentShell a {@link org.eclipse.swt.widgets.Shell} object.
- */
public LoginDialog(Shell parentShell) {
super(parentShell);
- title = "Login";
+ title = Messages.LoginDialog_LOGIN;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
+
/** {@inheritDoc} */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
//add controls to composite as necessary
-
+
// Label for the heading
final CLabel titleLabel = new CLabel(composite, SWT.NONE);
- titleLabel.setText("User Login");
+ titleLabel.setText(Messages.LoginDialog_USER_LOGIN);
// Label for the username
final CLabel userNameLabel = new CLabel(composite, SWT.NONE);
- userNameLabel.setText("Username");
+ userNameLabel.setText(Messages.LoginDialog_USER_NAME);
// Textfield for the username
text_username = new Text(composite, SWT.BORDER);
// Label for the password
final CLabel passwordLabel = new CLabel(composite, SWT.NONE);
- passwordLabel.setText("Password");
+ passwordLabel.setText(Messages.LoginDialog_PASSWORD);
// Textfield for the password
text_password = new Text(composite, SWT.PASSWORD | SWT.BORDER);
text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
-
+
+
return composite;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
/** {@inheritDoc} */
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null) {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
/** {@inheritDoc} */
@Override
protected void okPressed() {
String username = text_username.getText();
String password = text_password.getText();
-
+
boolean result = CdmStore.getLoginManager().authenticate(username, password);
-
+
if(result){
super.okPressed();
}
-
- }
-
+
+ }
+
@Override
- protected void cancelPressed() {
+ protected void cancelPressed() {
if(CdmStore.getLoginManager().getAuthenticatedUser() != null){
super.cancelPressed();
}else{
// if there is no active user and the current user chooses to cancel, we close the connection
- boolean result = MessageDialog.openConfirm(getShell(), "Do you really want to cancel", "Aborting the login procedure will close the database.");
-
+ boolean result = MessageDialog.openConfirm(getShell(), Messages.LoginDialog_REALLY_CANCEL, Messages.LoginDialog_CANCEL_MESSAGE);
+
if(result){
- CdmStore.close(StoreUtil.getMonitor());
+ CdmStore.close(AbstractUtility.getMonitor());
super.cancelPressed();
}
}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.ui.dialog;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.IExpansionListener;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.LockedException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerUtils;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.LoginManager;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.webapp.CDMEmbeddedServerException;
+import eu.etaxonomy.taxeditor.webapp.CDMServer;
+import eu.etaxonomy.taxeditor.webapp.ICDMServerError;
+
+
+/**
+ * @author cmathew
+ * @date 20 Jan 2015
+ *
+ */
+public class RemotingLoginDialog extends Dialog implements ICDMServerError {
+
+ protected Object result;
+ protected Shell shlConnect;
+ private Text txtCdmServerStatus;
+ private Text txtCdmInstanceStatus;
+ private Combo comboCdmServer;
+ private Combo comboCdmInstance;
+ private Button btnConnect;
+
+ private final Map<String, CdmServerInfo> csiiMap = new HashMap<String, CdmServerInfo>();
+
+ private final static String STATUS_AVAILABLE = "Available";
+ private final static String STATUS_NOT_AVAILABLE = "Not Available";
+ private final static String STATUS_STARTED = "Started";
+ private final static String STATUS_NOT_STARTED = "Not Started";
+ private final static String STATUS_RETRIEVING = "Retrieving ...";
+ private final static String STATUS_CHECKING_AVAILABILITY = "Checking ...";
+ private final static String STATUS_NO_INSTANCES = "No Instances Found";
+ private final static String STATUS_ERROR = "Error";
+ private final static String STATUS_REMOTING_NOT_ACTIVATED = "Remoting not activated";
+ private final static String STATUS_NOT_COMPATIBLE = "Not Compatible";
+
+ private final static String MESG_COMPATIBLE_EDITOR_OLD = "Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible cdm-server";
+ private final static String MESG_COMPATIBLE_SERVER_OLD = "Please choose a compatible cdm-server or update the chosen cdm-server";
+
+ private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store";
+
+ private final static String LOGIN_NODE = "login";
+ private final static String USERNAME_SUFFIX = "_username";
+ private final static String PASSWORD_SUFFIX = "_password";
+
+ private final static String LAST_SERVER_INSTANCE_NODE = "lastServerInstance";
+ private final static String LAST_SERVER_KEY = "lastServerKey";
+ private final static String LAST_INSTANCE_KEY = "lastInstanceKey";
+
+ private final static String REFRESH_LABEL = "Refresh";
+
+ private Composite remotingComposite;
+ private CdmServerInfo selectedCsii;
+ private CdmInstanceInfo selectedCdmInstance;
+ private Button btnCdmServerRefresh;
+ private Button btnCdmInstanceRefresh;
+ private Button btnStopServer;
+ private Composite loginComposite;
+ private Label lblLogin;
+ private Text txtLogin;
+ private Label lblPassword;
+ private Text txtPassword;
+ private Button btnRememberMe;
+ private Composite compAdvanced;
+ private Label lblPort;
+ private Text txtPort;
+ private Label lblServerVersion;
+ private Text txtServerVersion;
+ private ExpandableComposite xpndblcmpstAdvanced;
+ private StyledText styledTxtMessage;
+
+
+ private final int MIN_WIDTH = 530;
+ private final int MIN_HEIGHT = 220;
+ private final int MIN_EXP_HEIGHT = 380;
+ private final int MESSAGE_HEIGHT = 25;
+ private Label lblEditorVersion;
+ private Text txtEditorVersion;
+ private Label lblServerCDMVersion;
+ private Text txtServerCDMVersion;
+ private Label lblEditorCDMVersion;
+ private Text txtEditorCDMVersion;
+
+ private String serverName, instanceName;
+ private boolean autoConnect = false;
+ private boolean loadLoginPrefs = true;
+ private boolean isDevRemoteSource = false;
+ private Job serverJob;
+ /**
+ * Create the dialog.
+ * @param parent
+ * @param style
+ */
+ public RemotingLoginDialog(Shell parent, int style) {
+ super(parent, style);
+ setText("Login");
+ }
+
+ public Object open(CdmRemoteSource source, boolean loadLoginPrefs, boolean autoConnect) {
+ this.loadLoginPrefs = loadLoginPrefs;
+ this.serverName = source.getName();
+ String contextPath = source.getContextPath();
+ this.instanceName = contextPath.substring(contextPath.lastIndexOf("/") + 1);
+ return open(serverName, instanceName, loadLoginPrefs, autoConnect);
+ }
+
+
+ public Object open(String serverName, String instanceName, boolean loadLoginPrefs, boolean autoConnect) {
+ this.serverName = serverName;
+ this.instanceName = instanceName;
+ this.loadLoginPrefs = loadLoginPrefs;
+ this.autoConnect = autoConnect;
+ return open();
+ }
+
+ /**
+ * Open the dialog.
+ * @return the result
+ */
+ public Object open() {
+
+ createContents();
+ if(serverName == null && instanceName == null) {
+ readPrefLastServerInstance();
+ }
+
+ setEditorInfo();
+ populateCdmServerCombo();
+ shlConnect.open();
+ shlConnect.layout();
+
+ xpndblcmpstAdvanced.setExpanded(false);
+
+ Display display = getParent().getDisplay();
+
+ while (!shlConnect.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Create contents of the dialog.
+ */
+ private void createContents() {
+ shlConnect = new Shell(getParent(), SWT.DIALOG_TRIM);
+ shlConnect.setMinimumSize(new Point(MIN_WIDTH, MIN_HEIGHT));
+ shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT);
+ shlConnect.setText("Connect");
+ shlConnect.setLayout(new FillLayout(SWT.HORIZONTAL));
+
+ remotingComposite = new Composite(shlConnect, SWT.NONE);
+ remotingComposite.setLayout(new GridLayout(1, false));
+
+ Composite cdmServerComposite = new Composite(remotingComposite, SWT.NONE);
+ GridData gd_cdmServerComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_cdmServerComposite.heightHint = 68;
+ cdmServerComposite.setLayoutData(gd_cdmServerComposite);
+ cdmServerComposite.setLayout(new GridLayout(4, false));
+
+ Label lblCdmServer = new Label(cdmServerComposite, SWT.NONE);
+ lblCdmServer.setText("CDM Server : ");
+ lblCdmServer.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+ lblCdmServer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+
+ comboCdmServer = new Combo(cdmServerComposite, SWT.READ_ONLY);
+ comboCdmServer.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshCdmServer();
+
+ }
+ });
+ GridData gd_comboCdmServer = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+ gd_comboCdmServer.widthHint = 150;
+ comboCdmServer.setLayoutData(gd_comboCdmServer);
+ comboCdmServer.select(0);
+
+ txtCdmServerStatus = new Text(cdmServerComposite, SWT.BORDER);
+ txtCdmServerStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
+ txtCdmServerStatus.setEditable(false);
+ GridData gd_txtCdmServerStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ gd_txtCdmServerStatus.widthHint = 100;
+ txtCdmServerStatus.setLayoutData(gd_txtCdmServerStatus);
+
+ btnCdmServerRefresh = new Button(cdmServerComposite, SWT.NONE);
+ btnCdmServerRefresh.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshCdmServer();
+ }
+ });
+ btnCdmServerRefresh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ btnCdmServerRefresh.setText("Refresh");
+
+ Label lblCdmInstance = new Label(cdmServerComposite, SWT.NONE);
+ GridData gd_lblCdmInstance = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+ gd_lblCdmInstance.heightHint = 30;
+ lblCdmInstance.setLayoutData(gd_lblCdmInstance);
+ lblCdmInstance.setText("CDM Instance : ");
+ lblCdmInstance.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ comboCdmInstance = new Combo(cdmServerComposite, SWT.READ_ONLY);
+ comboCdmInstance.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshCdmInstance();
+ }
+ });
+ GridData gd_comboCdmInstance = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+ gd_comboCdmInstance.widthHint = 150;
+ comboCdmInstance.setLayoutData(gd_comboCdmInstance);
+ comboCdmInstance.select(0);
+
+ txtCdmInstanceStatus = new Text(cdmServerComposite, SWT.BORDER);
+ txtCdmInstanceStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
+ txtCdmInstanceStatus.setEditable(false);
+ GridData gd_txtCdmInstanceStatus = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ gd_txtCdmInstanceStatus.widthHint = 100;
+ txtCdmInstanceStatus.setLayoutData(gd_txtCdmInstanceStatus);
+
+ btnCdmInstanceRefresh = new Button(cdmServerComposite, SWT.FLAT);
+ btnCdmInstanceRefresh.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshCdmInstance();
+ }
+ });
+ GridData gd_btnCdmInstanceRefresh = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ gd_btnCdmInstanceRefresh.widthHint = 110;
+ gd_btnCdmInstanceRefresh.heightHint = 30;
+ btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh);
+ btnCdmInstanceRefresh.setText("Refresh");
+
+ loginComposite = new Composite(remotingComposite, SWT.NONE);
+ GridData gd_loginComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_loginComposite.widthHint = 487;
+ gd_loginComposite.heightHint = 70;
+ loginComposite.setLayoutData(gd_loginComposite);
+ GridLayout gl_loginComposite = new GridLayout(6, false);
+ gl_loginComposite.marginTop = 5;
+ loginComposite.setLayout(gl_loginComposite);
+
+ lblLogin = new Label(loginComposite, SWT.CENTER);
+ GridData gd_lblLogin = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+ gd_lblLogin.widthHint = 50;
+ lblLogin.setLayoutData(gd_lblLogin);
+ lblLogin.setText("Login : ");
+ lblLogin.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtLogin = new Text(loginComposite, SWT.BORDER);
+ GridData gd_txtLogin = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+ gd_txtLogin.minimumWidth = 80;
+ gd_txtLogin.widthHint = 80;
+ gd_txtLogin.heightHint = 15;
+ txtLogin.setLayoutData(gd_txtLogin);
+
+ lblPassword = new Label(loginComposite, SWT.CENTER);
+ lblPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblPassword.setText("Password : ");
+ lblPassword.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtPassword = new Text(loginComposite, SWT.BORDER | SWT.PASSWORD);
+ GridData gd_txtPassword = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+ gd_txtPassword.minimumWidth = 80;
+ gd_txtPassword.widthHint = 80;
+ gd_txtPassword.heightHint = 15;
+ txtPassword.setLayoutData(gd_txtPassword);
+ new Label(loginComposite, SWT.NONE);
+
+ btnConnect = new Button(loginComposite, SWT.FLAT);
+ btnConnect.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+ btnConnect.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if(selectedCsii.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
+ startManagedServer();
+ } else {
+ connect();
+ }
+ }
+ });
+ btnConnect.setText("Connect");
+
+ btnRememberMe = new Button(loginComposite, SWT.CHECK);
+ btnRememberMe.setSelection(true);
+ GridData gd_btnRememberMe = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+ gd_btnRememberMe.widthHint = 107;
+ btnRememberMe.setLayoutData(gd_btnRememberMe);
+ btnRememberMe.setText("Remember Me");
+ new Label(loginComposite, SWT.NONE);
+ new Label(loginComposite, SWT.NONE);
+ new Label(loginComposite, SWT.NONE);
+ new Label(loginComposite, SWT.NONE);
+
+ styledTxtMessage = new StyledText(remotingComposite, SWT.NONE);
+ styledTxtMessage.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
+ styledTxtMessage.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
+ styledTxtMessage.setFont(SWTResourceManager.getFont("Ubuntu", 12, SWT.BOLD));
+ styledTxtMessage.setSelectionBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION_TEXT));
+ styledTxtMessage.setSelectionForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
+ styledTxtMessage.setDoubleClickEnabled(false);
+ styledTxtMessage.setEditable(false);
+ GridData gd_styledTxtMessage = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+ gd_styledTxtMessage.exclude = true;
+ gd_styledTxtMessage.minimumHeight = MESSAGE_HEIGHT;
+ gd_styledTxtMessage.heightHint = MESSAGE_HEIGHT;
+ styledTxtMessage.setLayoutData(gd_styledTxtMessage);
+
+ xpndblcmpstAdvanced = new ExpandableComposite(remotingComposite, SWT.NONE, ExpandableComposite.TWISTIE);
+ GridData gd_xpndblcmpstAdvanced = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1);
+ gd_xpndblcmpstAdvanced.heightHint = 19;
+ xpndblcmpstAdvanced.setLayoutData(gd_xpndblcmpstAdvanced);
+ xpndblcmpstAdvanced.addExpansionListener(new IExpansionListener() {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ GridData gridData = (GridData) xpndblcmpstAdvanced.getLayoutData();
+ if(e.getState()) {
+ shlConnect.setSize(MIN_WIDTH, MIN_EXP_HEIGHT);
+ } else {
+ shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT);
+ }
+
+ }
+ @Override
+ public void expansionStateChanging(ExpansionEvent e) {
+ }
+ });
+ xpndblcmpstAdvanced.setText("advanced");
+ xpndblcmpstAdvanced.setExpanded(true);
+
+ compAdvanced = new Composite(xpndblcmpstAdvanced, SWT.NONE);
+ xpndblcmpstAdvanced.setClient(compAdvanced);
+ compAdvanced.setLayout(new GridLayout(4, false));
+
+ lblPort = new Label(compAdvanced, SWT.CENTER);
+ lblPort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblPort.setSize(0, 0);
+ lblPort.setText("Port : ");
+ lblPort.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtPort = new Text(compAdvanced, SWT.BORDER);
+ GridData gd_txtPort = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
+ gd_txtPort.minimumWidth = 50;
+ gd_txtPort.widthHint = 50;
+ txtPort.setLayoutData(gd_txtPort);
+
+ lblServerVersion = new Label(compAdvanced, SWT.CENTER);
+ lblServerVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblServerVersion.setText("Server Cdmlib Version :");
+ lblServerVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtServerVersion = new Text(compAdvanced, SWT.BORDER);
+ txtServerVersion.setEditable(false);
+ txtServerVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ btnStopServer = new Button(compAdvanced, SWT.FLAT);
+ btnStopServer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+ btnStopServer.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ stopManagedServer();
+ }
+ });
+ btnStopServer.setText("Stop Managed Server");
+
+ lblEditorVersion = new Label(compAdvanced, SWT.CENTER);
+ lblEditorVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblEditorVersion.setText("Editor Cdmlib Version :");
+ lblEditorVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtEditorVersion = new Text(compAdvanced, SWT.BORDER);
+ txtEditorVersion.setEditable(false);
+ txtEditorVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ new Label(compAdvanced, SWT.NONE);
+ new Label(compAdvanced, SWT.NONE);
+
+ lblServerCDMVersion = new Label(compAdvanced, SWT.CENTER);
+ lblServerCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblServerCDMVersion.setText("Server CDM Version :");
+ lblServerCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtServerCDMVersion = new Text(compAdvanced, SWT.BORDER);
+ txtServerCDMVersion.setEditable(false);
+ txtServerCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ new Label(compAdvanced, SWT.NONE);
+ new Label(compAdvanced, SWT.NONE);
+
+ lblEditorCDMVersion = new Label(compAdvanced, SWT.CENTER);
+ lblEditorCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblEditorCDMVersion.setText("Editor CDM Version :");
+ lblEditorCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
+
+ txtEditorCDMVersion = new Text(compAdvanced, SWT.BORDER);
+ txtEditorCDMVersion.setEditable(false);
+ txtEditorCDMVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ }
+
+
+
+ private void populateCdmServerCombo() {
+ Job job = new Job("Retrieve Server Instances") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ for(CdmServerInfo csii : CdmServerInfo.getCdmServers()) {
+ csiiMap.put(csii.getName(), csii);
+ comboCdmServer.add(csii.getName());
+ }
+ int serverIndex = -1;
+ if(serverName != null) {
+ serverIndex = comboCdmServer.indexOf(serverName);
+ }
+ if(serverIndex == -1) {
+ comboCdmServer.select(0);
+ autoConnect = false;
+ } else {
+ comboCdmServer.select(serverIndex);
+ }
+ CdmRemoteSource devRemoteSource = CdmServerInfo.getDevServerRemoteSource();
+ if(devRemoteSource != null) {
+ isDevRemoteSource = true;
+ String username = System.getProperty("cdm.server.dev.username");
+ String password = System.getProperty("cdm.server.dev.password");
+ if(username != null && !username.isEmpty() && password != null && !password.isEmpty()) {
+ txtLogin.setText(username);
+ txtPassword.setText(password);
+ CdmStore.connect(devRemoteSource, RemotingLoginDialog.this);
+ }
+ } else {
+ refreshCdmServer();
+ }
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+
+
+ private void refreshCdmServer() {
+ txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
+ clearOnServerChange();
+ emptyCredentials();
+ updateSelectedCdmServer();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ checkSelectedCdmServer();
+ }
+ });
+
+ }
+
+ private void updateSelectedCdmServer() {
+ int selIndex = comboCdmServer.getSelectionIndex();
+ if(selIndex != -1) {
+ selectedCsii = csiiMap.get(comboCdmServer.getItem(selIndex));
+ }
+ }
+
+ private void updatePort() {
+ txtPort.setText("");
+ if(selectedCsii != null) {
+ int port = selectedCsii.getPort();
+ if(port == CdmServerInfo.NULL_PORT) {
+ txtPort.setText(CdmServerInfo.NULL_PORT_STRING);
+ } else {
+ txtPort.setText(String.valueOf(port));
+ }
+ }
+ }
+
+ private int getPort() {
+ int port = CdmServerInfo.NULL_PORT;
+ try {
+ port = Integer.valueOf(txtPort.getText());
+ } catch (NumberFormatException nfe) {
+ if(!CdmServerInfo.NULL_PORT_STRING.equals(txtPort.getText())) {
+ setMessage("Port should be an integer");
+ }
+ }
+ return port;
+ }
+
+ private void checkSelectedCdmServer() {
+ if(selectedCsii != null) {
+ if(selectedCsii.isLocalhost()) {
+ txtPort.setEditable(true);
+ txtPort.setEnabled(true);
+ }
+ if(selectedCsii.pingServer()) {
+ txtCdmServerStatus.setText(STATUS_AVAILABLE);
+ populateCdmInstanceCombo(true);
+ String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified());
+ txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp);
+ } else {
+ txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
+ comboCdmInstance.removeAll();
+ disableCdmInstanceControls("", "");
+ }
+ }
+ updatePort();
+ }
+
+
+ private void populateCdmInstanceCombo(final boolean forceRefresh) {
+ comboCdmInstance.removeAll();
+ comboCdmInstance.setEnabled(false);
+ btnConnect.setEnabled(false);
+ txtCdmInstanceStatus.setText(STATUS_RETRIEVING);
+ txtCdmInstanceStatus.setToolTipText("");
+
+ serverJob = new Job("Retrieve Server Instances") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if(selectedCsii != null) {
+ if(forceRefresh) {
+ selectedCsii.refreshInstances();
+ }
+ final List<CdmInstanceInfo> instances = selectedCsii.getInstances();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if(!instances.isEmpty()) {
+ for(CdmInstanceInfo cdmInstance : instances) {
+ comboCdmInstance.add(cdmInstance.getName());
+ }
+ int instanceIndex = -1;
+ if(instanceName != null) {
+ instanceIndex = comboCdmInstance.indexOf(instanceName);
+ }
+ if(instanceIndex == -1) {
+ comboCdmInstance.select(0);
+ autoConnect = false;
+ } else {
+ comboCdmInstance.select(instanceIndex);
+ }
+ refreshCdmInstance();
+ comboCdmInstance.setEnabled(true);
+ if(autoConnect) {
+ connect();
+ }
+
+ } else {
+ txtCdmInstanceStatus.setText(STATUS_NO_INSTANCES);
+ btnConnect.setEnabled(false);
+ }
+ }
+ });
+ }
+ } catch (final CDMServerException e) {
+ MessagingUtils.warn(getClass(), e);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ disableCdmInstanceControls(STATUS_NOT_AVAILABLE, e.getMessage());
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE) && !isDevRemoteSource) {
+ // Start the Job
+ serverJob.schedule();
+ }
+ }
+
+ private void disableCdmInstanceControls(String cdmInstanceStatus, String tooltip) {
+ txtCdmInstanceStatus.setText(cdmInstanceStatus);
+ txtCdmInstanceStatus.setToolTipText(tooltip);
+ comboCdmInstance.setEnabled(false);
+ btnConnect.setEnabled(false);
+
+ }
+ private void refreshCdmInstance() {
+ txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY);
+ clearOnInstanceChange();
+ updateSelectedCdmInstance();
+ checkSelectedCdmInstance();
+ updateManagedServerControls();
+ }
+
+ private void updateSelectedCdmInstance() {
+ int selIndex = comboCdmInstance.getSelectionIndex();
+ if(selIndex != -1) {
+ selectedCdmInstance = selectedCsii.getInstanceFromName(comboCdmInstance.getItem(selIndex));
+
+ if(loadLoginPrefs && !isDevRemoteSource) {
+ readPrefCredentials();
+ }
+ }
+ }
+
+ private void updateManagedServerControls() {
+ if(selectedCsii.isLocalhostMgd()) {
+ if(isSelectedCdmInstanceRunningInManagedServer()) {
+ txtCdmInstanceStatus.setText(STATUS_STARTED);
+ } else {
+ txtCdmInstanceStatus.setText(STATUS_NOT_STARTED);
+ }
+ btnConnect.setEnabled(true);
+ selectedCsii.setPort(getManagedServerPort());
+ updatePort();
+ }
+
+
+ if(isManagedServerRunning()) {
+ btnStopServer.setEnabled(true);
+ } else {
+ btnStopServer.setEnabled(false);
+ }
+ }
+
+ private boolean isManagedServerRunning() {
+ return CdmStore.getManagedServer() != null && CdmStore.getManagedServer().isAlive();
+ }
+
+ private boolean isSelectedCdmInstanceRunningInManagedServer() {
+ return CdmStore.getManagedServer() != null &&
+ CdmStore.getManagedServer().isAlive() &&
+ selectedCsii.isLocalhostMgd() &&
+ CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName());
+ }
+
+ private void startManagedServer() {
+ if(isManagedServerRunning()) {
+ if(CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())) {
+ return;
+ } else {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ stopManagedServer();
+ }
+ });
+ }
+ }
+
+
+ Job job = new Job("Managed CDM Server Launch") {
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ String mgdServerConfigFileName = "mgd.datasources.xml";
+ String config = CDMServerUtils.convertEditorToServerConfig();
+ File managedServerConfigFile;
+ int maxUnits = 50;
+ monitor.beginTask("Launching Managed CDM Server", maxUnits);
+ try {
+ monitor.subTask("Generating datasources config file for " + selectedCdmInstance.getName());
+ managedServerConfigFile = CDMServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName);
+ monitor.worked(1);
+ CdmStore.setManagedServer(new CDMServer(selectedCdmInstance.getName(), managedServerConfigFile));
+ monitor.subTask("Starting Managed CDM Server. This may take a while.");
+ CdmStore.getManagedServer().start(false, RemotingLoginDialog.this);
+ int serverUnits = 0;
+
+ // the following loop is a 'fake' progress monitoring where the progress
+ // bar is advanced by one unit every second until maxUnits -2
+ while(!CdmStore.getManagedServer().isStarted()) {
+ if(serverUnits < maxUnits - 2) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+ monitor.worked(1);
+ serverUnits++;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ hide(false);
+ updateManagedServerControls();
+ connect();
+ }
+ });
+ } catch (IOException ioe) {
+ MessagingUtils.errorDialog("Error generating server config file",
+ this,
+ ioe.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ ioe,
+ true);
+ } catch (CDMEmbeddedServerException cse) {
+ MessagingUtils.errorDialog("Error starting managed server",
+ this,
+ cse.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ cse,
+ true);
+ } finally {
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ hide(true);
+ job.schedule();
+ }
+
+ private void stopManagedServer() {
+ try {
+ CdmStore.getManagedServer().stop();
+ } catch (Exception e) {
+ MessagingUtils.errorDialog("Error stopping managed server",
+ this,
+ "Could not stop managed server running at port " + CdmStore.getManagedServer().getPort() + ". Please stop it manually",
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ }
+ CdmStore.setManagedServer(null);
+ updateManagedServerControls();
+ }
+
+ private int getManagedServerPort() {
+ return CdmStore.getManagedServer() == null ? CdmServerInfo.NULL_PORT : CdmStore.getManagedServer().getPort();
+ }
+
+ private void checkSelectedCdmInstance() {
+ boolean available = false;
+ String status = STATUS_NOT_AVAILABLE;
+ String message = null;
+
+ if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) {
+ try {
+ if(selectedCsii.pingInstance(selectedCdmInstance, getPort())) {
+ status = STATUS_AVAILABLE;
+ available = true;
+ } else {
+ status = STATUS_NOT_AVAILABLE;
+ available = false;
+ }
+
+ if(available) {
+ txtServerCDMVersion.setText(selectedCsii.getCdmRemoteSource(selectedCdmInstance, getPort()).getDbSchemaVersion());
+ int compareDbSchemaVersion = selectedCsii.compareDbSchemaVersion(selectedCdmInstance, getPort());
+ int compareCdmlibServicesVersion = 0;
+ boolean disableServicesApiTimestampCheck =
+ PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.DISABLE_SERVICES_API_TIMESTAMP_CHECK));
+ if(!disableServicesApiTimestampCheck) {
+ compareCdmlibServicesVersion = selectedCsii.compareCdmlibServicesVersion();
+ }
+ if(compareDbSchemaVersion > 0 || compareCdmlibServicesVersion > 0) {
+ status = STATUS_NOT_COMPATIBLE;
+ available = false;
+ message = MESG_COMPATIBLE_EDITOR_OLD;
+ } else if(compareDbSchemaVersion < 0 || compareCdmlibServicesVersion < 0) {
+ status = STATUS_NOT_COMPATIBLE;
+ available = false;
+ message = MESG_COMPATIBLE_SERVER_OLD;
+ } else {
+ status = STATUS_AVAILABLE;
+ available = true;
+ message = "";
+ }
+ }
+ } catch (Exception e) {
+ txtCdmInstanceStatus.setToolTipText(e.getMessage());
+ } finally {
+ btnConnect.setEnabled(available);
+ txtCdmInstanceStatus.setText(status);
+ if(!StringUtils.isBlank(message)) {
+ setMessage(message);
+ }
+ }
+ }
+ }
+
+ private void connect() {
+ checkSelectedCdmInstance();
+
+ if(!txtCdmInstanceStatus.getText().equals(STATUS_AVAILABLE)) {
+ return;
+ }
+
+ ICdmRemoteSource source = selectedCsii.getCdmRemoteSource(selectedCdmInstance, getPort());
+
+ if(!validateLogin(source)) {
+ return;
+ }
+
+ try {
+ CdmStore.connect(source, this);
+ } catch (Exception e) {
+ // Do not expect anything to go wrong at this point, so we throw a runtime exception
+ // if any problems
+ throw new RuntimeException(e);
+ }
+
+ }
+
+
+ public boolean isRememberMe() {
+ return btnRememberMe.getSelection();
+ }
+
+ private void persistPrefLastServerInstance() {
+ IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
+ Preferences lastServerInstancePrefs = preferences.node(LAST_SERVER_INSTANCE_NODE);
+
+ lastServerInstancePrefs.put(LAST_SERVER_KEY, selectedCsii.getName());
+ lastServerInstancePrefs.put(LAST_INSTANCE_KEY, selectedCdmInstance.getName());
+
+ flushPreferences(lastServerInstancePrefs);
+ }
+
+ private void persistPrefCredentials() {
+ IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
+ Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
+ credentialsPrefs.put(getUsernamePrefKey(), txtLogin.getText());
+ credentialsPrefs.put(getPasswordPrefKey(), txtPassword.getText());
+ flushPreferences(credentialsPrefs);
+ }
+
+ private void flushPreferences(Preferences prefs) {
+ try {
+ prefs.flush();
+ } catch (BackingStoreException bse) {
+ setMessage(bse.getMessage());
+ }
+ }
+
+ private void readPrefCredentials() {
+ String username, password;
+ IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
+ Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
+ username = credentialsPrefs.get(getUsernamePrefKey(), "");
+ txtLogin.setText(username);
+ password = credentialsPrefs.get(getPasswordPrefKey(),"");
+ txtPassword.setText(password);
+ if(username.isEmpty() || password.isEmpty()) {
+ autoConnect = false;
+ }
+ }
+
+ private void readPrefLastServerInstance() {
+ IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
+ Preferences lastServerInstancePrefs = preferences.node(LAST_SERVER_INSTANCE_NODE);
+
+ serverName = lastServerInstancePrefs.get(LAST_SERVER_KEY, null);
+ instanceName = lastServerInstancePrefs.get(LAST_INSTANCE_KEY, null);
+ }
+
+ private void emptyCredentials() {
+ txtLogin.setText("");
+ txtPassword.setText("");
+ }
+
+ private String getUsernamePrefKey() {
+ return selectedCsii.toString(selectedCdmInstance.getName(), getPort()) + USERNAME_SUFFIX;
+ }
+
+ private String getPasswordPrefKey() {
+ return selectedCsii.toString(selectedCdmInstance.getName(), getPort()) + PASSWORD_SUFFIX;
+ }
+
+ private boolean validateLogin(ICdmRemoteSource remoteSource) {
+ if(getUsername() == null || getUsername().isEmpty()) {
+ setMessage("User login cannot be empty");
+ return false;
+ }
+ if(getPassword() == null || getPassword().isEmpty()) {
+ setMessage("Password cannot be empty");
+ return false;
+ }
+
+
+ try {
+ IUserService userService = CdmApplicationRemoteConfiguration.getUserService(remoteSource);
+ UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(getUsername(), getPassword());
+ CdmApplicationRemoteConfiguration.getAuthenticationManager(userService).authenticate(token);
+ } catch(BadCredentialsException e){
+ setMessage(LoginManager.INCORRECT_CREDENTIALS_MESSAGE);
+ return false;
+ } catch(LockedException e){
+ setMessage(LoginManager.ACCOUNT_LOCKED_MESSAGE);
+ return false;
+ } catch(IllegalArgumentException e){
+ setMessage(LoginManager.INCORRECT_CREDENTIALS_MESSAGE);
+ return false;
+ }
+ return true;
+ }
+
+ public String getUsername() {
+ return txtLogin.getText();
+ }
+
+ public String getPassword() {
+ return txtPassword.getText();
+ }
+
+ public void setMessage(String message) {
+ if(message != null && !message.isEmpty()) {
+ if(message.length() > 60) {
+ styledTxtMessage.setToolTipText(message);
+ message = message.substring(0, 60) + "...";
+ }
+ styledTxtMessage.setText(message);
+ styledTxtMessage.setVisible(true);
+ ((GridData)styledTxtMessage.getLayoutData()).exclude = false;
+ shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT);
+ shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT);
+ } else {
+ styledTxtMessage.setText("");
+ styledTxtMessage.setVisible(false);
+ ((GridData)styledTxtMessage.getLayoutData()).exclude = true;
+ shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage());
+ shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage());
+ }
+ remotingComposite.layout();
+ }
+
+ private int getHeightWithoutMessage() {
+ if(xpndblcmpstAdvanced.isExpanded()) {
+ return MIN_EXP_HEIGHT;
+ } else {
+ return MIN_HEIGHT;
+ }
+ }
+
+
+ public void hide(boolean isHidden) {
+ if(shlConnect != null && shlConnect.getDisplay() != null) {
+ shlConnect.setVisible(!isHidden);
+ }
+ }
+ public void dispose() {
+ if(shlConnect != null && shlConnect.getDisplay() != null) {
+ shlConnect.dispose();
+ }
+ }
+
+ public void onComplete() {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if(!isDevRemoteSource) {
+ if(isRememberMe()) {
+ persistPrefCredentials();
+ }
+ persistPrefLastServerInstance();
+ }
+ dispose();
+ }
+ });
+ }
+
+ private String generateLastModifiedTooltip(String cdmlibLastModified) {
+ if(StringUtils.isBlank(cdmlibLastModified)) {
+ return "";
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.z");
+ Date cdmlibLastModifiedDate;
+ String cdmlibLastModifiedTimestamp = "";
+
+ cdmlibLastModifiedDate = new Date(Long.valueOf(cdmlibLastModified));
+ cdmlibLastModifiedTimestamp = sdf.format(cdmlibLastModifiedDate);
+
+ return cdmlibLastModifiedTimestamp;
+ }
+
+ private void setEditorInfo() {
+ txtEditorCDMVersion.setText(CdmMetaData.getDbSchemaVersion());
+ String editorVersionTimestamp = generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified());
+ txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp);
+ }
+
+ private void clearOnServerChange() {
+ setMessage("");
+ txtServerCDMVersion.setText("");
+ txtServerVersion.setText("");
+ txtServerVersion.setToolTipText("");
+ txtServerCDMVersion.setText("");
+ comboCdmInstance.removeAll();
+ txtCdmInstanceStatus.setText("");
+ txtPort.setEditable(false);
+ txtPort.setEnabled(false);
+ }
+
+ private void clearOnInstanceChange() {
+ setMessage("");
+ txtServerCDMVersion.setText("");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void handleError(final Throwable t) {
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ serverJob.cancel();
+
+ String title = "CDM Server launch error";
+ String message = t.getMessage();
+
+
+ MessagingUtils.errorDialog(title,
+ this,
+ message,
+ TaxeditorStorePlugin.PLUGIN_ID,
+ t,
+ true);
+ }
+ });
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.ui.dialog;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author cmathew
+ * @date 22 Oct 2015
+ *
+ */
+public class ReportTextDialog extends Dialog {
+
+ private String reportText = "";
+ private String title = "";
+ /**
+ * Create the dialog.
+ * @param parentShell
+ */
+ public ReportTextDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ /**
+ * Create contents of the dialog.
+ * @param parent
+ */
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ Composite container = (Composite) super.createDialogArea(parent);
+ GridLayout gridLayout = (GridLayout) container.getLayout();
+ gridLayout.numColumns = 2;
+
+ StyledText styledText = new StyledText(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
+ styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ styledText.setText(reportText);
+
+ Button btnSave = new Button(container, SWT.NONE);
+ btnSave.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog fileDialog = new FileDialog(parent.getShell(), SWT.SAVE);
+ // Set filter on .txt files
+ fileDialog.setFilterExtensions(new String[] { "*.txt" });
+ // Put in a readable name for the filter
+ fileDialog.setFilterNames(new String[] { "Textfiles(*.txt)" });
+ String fileName = fileDialog.open();
+ if(fileName != null) {
+ File file = new File(fileName);
+ if (file.exists()) {
+ MessageBox mb = new MessageBox(fileDialog.getParent(), SWT.ICON_WARNING
+ | SWT.YES | SWT.NO);
+ mb.setMessage(fileName + " already exists. Do you want to replace it?");
+ boolean override = mb.open() == SWT.YES;
+ if(!override) {
+ return;
+ }
+ }
+ try {
+ FileWriter fileWriter = new FileWriter(fileName, false);
+ fileWriter.write(getReportText());
+ fileWriter.close();
+ } catch (IOException ioe) {
+ throw new IllegalStateException(ioe);
+ }
+ }
+ }
+ });
+ btnSave.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ btnSave.setText("save");
+
+ return container;
+ }
+
+ /**
+ * Create contents of the button bar.
+ * @param parent
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ }
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(title);
+ }
+ /**
+ * Return the initial size of the dialog.
+ */
+ @Override
+ protected Point getInitialSize() {
+ return new Point(669, 501);
+ }
+
+ public void setReportText(String text) {
+ this.reportText = text;
+ }
+
+ public String getReportText() {
+ return reportText;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
/**
@Override
protected Control createCustomArea(Composite parent) {
DeleteConfiguratorComposite composite = new DeleteConfiguratorComposite(parent, NONE);
- if(configurator instanceof TaxonBaseDeletionConfigurator){
- composite.addConfiguratorComposite(new DeleteTaxonConfiguratorComposite((TaxonBaseDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
+ if(configurator instanceof TaxonDeletionConfigurator){
+ composite.addConfiguratorComposite(new DeleteTaxonConfiguratorComposite((TaxonDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
}
else if(configurator instanceof SpecimenDeleteConfigurator){
composite.addConfiguratorComposite(new DeleteSpecimenConfiguratorComposite((SpecimenDeleteConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
} else if(configurator instanceof TaxonNodeDeletionConfigurator){
composite.addConfiguratorComposite(new DeleteNodeConfiguratorComposite((TaxonNodeDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
+ } else if(configurator instanceof NameDeletionConfigurator){
+ composite.addConfiguratorComposite(new DeleteNameConfiguratorComposite((NameDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
}
return composite;
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.PojoProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+/**
+ * @author kluther
+ * @date Nov 2, 2015
+ *
+ */
+public class DeleteNameConfiguratorComposite extends Composite {
+ private final DataBindingContext m_bindingContext;
+
+ private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ private final NameDeletionConfigurator configurator;
+ private final Button btnRemoveAllNameRelationships;
+ private final Button btnIgnoreIsBasionym;
+ private final Button btnIgnoreIsReplacedSynonymFor;
+ private final Button btnIgnoreHasBasionym;
+ private final Button btnIgnoreHasReplacedSynonym;
+ private final Button btnRemoveAllTypeDesignations;
+
+ /*
+ * private boolean removeAllNameRelationships = false;
+
+ private boolean ignoreIsBasionymFor = false;
+
+ private boolean ignoreIsReplacedSynonymFor = false;
+
+ private boolean ignoreHasBasionym = true;
+
+ private boolean ignoreHasReplacedSynonym = true;
+
+ private boolean removeAllNameTypeDesignations = true;
+ */
+
+
+ /**
+ * Create the composite.
+ * @param parent
+ * @param style
+ */
+ public DeleteNameConfiguratorComposite(NameDeletionConfigurator configurator, Composite parent, int style) {
+ super(parent, style);
+ this.configurator = configurator;
+ addDisposeListener(new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ toolkit.dispose();
+ }
+ });
+ toolkit.paintBordersFor(this);
+ setLayout(new RowLayout(SWT.VERTICAL));
+ setBackground(getBackground());
+
+ btnRemoveAllNameRelationships = new Button(this, SWT.CHECK);
+ btnRemoveAllNameRelationships.setText("Remove all Name Relationships");
+ btnRemoveAllNameRelationships.setSelection(true);
+
+ btnIgnoreIsBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreIsBasionym.setText("Ignore is Basionym");
+ btnIgnoreIsBasionym.setSelection(true);
+
+ btnIgnoreIsReplacedSynonymFor = new Button(this, SWT.CHECK);
+ btnIgnoreIsReplacedSynonymFor.setText("Ignore is Replaced Synonym");
+ btnIgnoreIsReplacedSynonymFor.setSelection(true);
+
+ btnIgnoreHasBasionym = new Button(this, SWT.CHECK);
+ btnIgnoreHasBasionym.setText("Ignore has Basionym");
+ btnIgnoreHasBasionym.setSelection(true);
+
+ btnIgnoreHasReplacedSynonym = new Button(this, SWT.CHECK);
+ btnIgnoreHasReplacedSynonym.setText("Ignore has Replaced Synonym");
+ btnIgnoreHasReplacedSynonym.setSelection(true);
+
+ btnRemoveAllTypeDesignations = new Button(this, SWT.CHECK);
+ btnRemoveAllTypeDesignations.setText("Remove all Type Designations");
+ btnRemoveAllTypeDesignations.setSelection(true);
+
+ m_bindingContext = initDataBindings();
+
+ }
+
+ protected DataBindingContext initDataBindings() {
+ DataBindingContext bindingContext = new DataBindingContext();
+ //
+ IObservableValue observeSelectionBtnRemoveAllNameRelationshipsWidget = WidgetProperties.selection().observe(btnRemoveAllNameRelationships);
+ IObservableValue removeAllNameRelationshipsConfiguratorObserveValue = PojoProperties.value("removeAllNameRelationships").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllNameRelationshipsWidget, removeAllNameRelationshipsConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnbtnIgnoreIsBasionymObserveWidget = WidgetProperties.selection().observe(btnIgnoreIsBasionym);
+ IObservableValue ignoreIsBasionymConfiguratorObserveValue = PojoProperties.value("ignoreIsBasionymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnbtnIgnoreIsBasionymObserveWidget, ignoreIsBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreIsReplacedSynonymForWidget = WidgetProperties.selection().observe(btnIgnoreIsReplacedSynonymFor);
+ IObservableValue ignoreIsReplacedSynonymForConfiguratorObserveValue = PojoProperties.value("ignoreIsReplacedSynonymFor").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreIsReplacedSynonymForWidget, ignoreIsReplacedSynonymForConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasBasionymWidget = WidgetProperties.selection().observe(btnIgnoreHasBasionym);
+ IObservableValue ignoreHasBasionymConfiguratorObserveValue = PojoProperties.value("ignoreHasBasionym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasBasionymWidget, ignoreHasBasionymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIgnoreHasReplacedSynonymWidget = WidgetProperties.selection().observe(btnIgnoreHasReplacedSynonym);
+ IObservableValue ignoreHasReplacedSynonymConfiguratorObserveValue = PojoProperties.value("ignoreHasReplacedSynonym").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIgnoreHasReplacedSynonymWidget, ignoreHasReplacedSynonymConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnRemoveAllTypeDesignationsWidget = WidgetProperties.selection().observe(btnRemoveAllTypeDesignations);
+ IObservableValue removeAllNameTypeDesignationsConfiguratorObserveValue = PojoProperties.value("removeAllNameTypeDesignations").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnRemoveAllTypeDesignationsWidget, removeAllNameTypeDesignationsConfiguratorObserveValue, null, null);
+
+ //
+ return bindingContext;
+ }
+}
private final SpecimenDeleteConfigurator configurator;
private final Button btnDeleteChildren;
private final Button btnDeleteFromTypeDesignation;
- private final Button btnDeleteMolecularData;
private final Button btnDeleteIndividualsassociationsfactual;
private final Button btnDeleteSpecimenDescription;
btnDeleteChildren.setText("Delete Children");
btnDeleteFromTypeDesignation = new Button(this, SWT.CHECK);
- btnDeleteFromTypeDesignation.setText("Delete from type designation");
-
- btnDeleteMolecularData = new Button(this, SWT.CHECK);
- btnDeleteMolecularData.setText("Delete molecular data");
+ btnDeleteFromTypeDesignation.setText("Delete from type designations");
btnDeleteIndividualsassociationsfactual = new Button(this, SWT.CHECK);
btnDeleteIndividualsassociationsfactual.setText("Delete from factual data");
btnDeleteSpecimenDescription = new Button(this, SWT.CHECK);
- btnDeleteSpecimenDescription.setText("Delete specimen description");
+ btnDeleteSpecimenDescription.setText("Delete from \"Described specimen\" in taxon descriptions");
m_bindingContext = initDataBindings();
}
IObservableValue deleteFromTypeDesignationConfiguratorObserveValue = PojoProperties.value("deleteFromTypeDesignation").observe(configurator);
bindingContext.bindValue(observeSelectionBtnDeleteFromTypeDesignationObserveWidget, deleteFromTypeDesignationConfiguratorObserveValue, null, null);
//
- IObservableValue observeSelectionBtnDeleteMolecularDataObserveWidget = WidgetProperties.selection().observe(btnDeleteMolecularData);
- IObservableValue deleteMolecularDataConfiguratorObserveValue = PojoProperties.value("deleteMolecularData").observe(configurator);
- bindingContext.bindValue(observeSelectionBtnDeleteMolecularDataObserveWidget, deleteMolecularDataConfiguratorObserveValue, null, null);
- //
IObservableValue observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget = WidgetProperties.selection().observe(btnDeleteIndividualsassociationsfactual);
IObservableValue deleteFromIndividualsAssociationConfiguratorObserveValue = PojoProperties.value("deleteFromIndividualsAssociation").observe(configurator);
bindingContext.bindValue(observeSelectionBtnDeleteIndividualsassociationsfactualObserveWidget, deleteFromIndividualsAssociationConfiguratorObserveValue, null, null);
*/
package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+import java.util.List;
+
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.PojoProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
/**
* @author pplitzner
* @date Feb 18, 2015
*
*/
-public class DeleteTaxonConfiguratorComposite extends Composite {
+public class DeleteTaxonConfiguratorComposite extends Composite implements SelectionListener{
private final DataBindingContext m_bindingContext;
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
- private final TaxonBaseDeletionConfigurator configurator;
+ private final TaxonDeletionConfigurator configurator;
private final Button btnDeleteTaxonName;
+ private final Button btnDeleteInAllClassifications;
+ private Combo classificationSelectionCombo;
+ private
+
+ Classification selectedClassification;
+ private List<Classification> classifications;
+
/**
* Create the composite.
* @param parent
* @param style
*/
- public DeleteTaxonConfiguratorComposite(TaxonBaseDeletionConfigurator configurator, Composite parent, int style) {
+ public DeleteTaxonConfiguratorComposite(TaxonDeletionConfigurator configurator, Composite parent, int style) {
super(parent, style);
this.configurator = configurator;
addDisposeListener(new DisposeListener() {
}
});
toolkit.paintBordersFor(this);
- setLayout(new RowLayout(SWT.VERTICAL));
+ setLayout(new GridLayout());
setBackground(getBackground());
btnDeleteTaxonName = new Button(this, SWT.CHECK);
btnDeleteTaxonName.setText("Delete taxon name if possible");
+ btnDeleteTaxonName.setSelection(true);
+
+ btnDeleteInAllClassifications = new Button(this, SWT.CHECK);
+ btnDeleteInAllClassifications.setText("Delete taxon in all classifications");
+ btnDeleteInAllClassifications.setSelection(true);
+
+ // createClassificationSelectionCombo(this);
+
m_bindingContext = initDataBindings();
}
//
IObservableValue observeSelectionBtnDeleteTaxonNameObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxonName);
IObservableValue deleteNameIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteNameIfPossible").observe(configurator);
+
+ IObservableValue observeSelectionBtnDeleteInAllClassificationObserveWidget = WidgetProperties.selection().observe(btnDeleteInAllClassifications);
+ IObservableValue deleteInAllClassificationsConfiguratorObserveValue = PojoProperties.value("deleteInAllClassifications").observe(configurator);
bindingContext.bindValue(observeSelectionBtnDeleteTaxonNameObserveWidget, deleteNameIfPossibleConfiguratorObserveValue, null, null);
+ bindingContext.bindValue(observeSelectionBtnDeleteInAllClassificationObserveWidget, deleteInAllClassificationsConfiguratorObserveValue, null, null);
+
+
+
//
return bindingContext;
}
+
+ /* private Control createClassificationSelectionCombo(Composite parent){
+// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
+
+ Composite classificationSelection = new Composite(parent, SWT.NULL);
+ classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+
+ GridLayout layout = new GridLayout();
+ classificationSelection.setLayout(layout);
+
+ Label label = new Label(classificationSelection, SWT.NULL);
+ // TODO not working is not really true but leave it here to remind everyone that this is under construction
+ label.setText("Select Classification");
+ classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
+ classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+ classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
+
+ for(Classification tree : classifications){
+ classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
+
+ }
+
+ classificationSelectionCombo.select(0);
+ classificationSelectionCombo.addSelectionListener(this);
+
+ return classificationSelection;
+ }*/
+
+@Override
+public void widgetSelected(SelectionEvent e) {
+ selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
+}
+
+@Override
+public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+}
}
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
protected T cdmBaseToBeFiltered;
+
/**
* <p>Constructor for AbstractFilteredCdmResourceSelectionDialog.</p>
*
this.settings = settings;
this.conversation = conversation;
-
+ this.cdmBaseToBeFiltered = cdmObject;
+ Cursor cursor = shell.getCursor();
+ shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
init();
-
initModel();
-
+ shell.setCursor(cursor);
String objectTitle = getTitle(cdmObject);
if (objectTitle != null) {
setInitialPattern(objectTitle);
@Override
public void widgetSelected(SelectionEvent e) {
- AbstractNewEntityWizard wizard = getNewEntityWizard(e.text);
-
- wizard.init(null, null);
- if(wizard.getEntity() != null) {
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- int status = dialog.open();
-
- if (status == IStatus.OK) {
-
- T entity = (T) wizard.getEntity();
- refresh();
- setPattern(entity);
- getConversationHolder().bind();
- }
- //FIXME : Need to make sure this is a stable fix (ticket 3822)
- getConversationHolder().commit();
- }
+ AbstractNewEntityWizard wizard = getNewEntityWizard(e.text);
+ if(wizard!=null){
+ wizard.init(null, null);
+ if(wizard.getEntity() != null) {
+ WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ int status = dialog.open();
+
+ if (status == IStatus.OK) {
+
+ T entity = (T) wizard.getEntity();
+ model.add(new UuidAndTitleCache<T>(entity.getUuid(),
+ entity.getId(),
+ getTitle(entity)));
+ refresh();
+ setPattern(entity);
+ getConversationHolder().bind();
+ }
+ //FIXME : Need to make sure this is a stable fix (ticket 3822)
+ getConversationHolder().commit();
+ }
+ }
}
};
}
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredNameSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created 04.06.2009
* @version 1.0
*/
public class NameSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNameBase> {
- /**
- * Creates a filtered selection dialog to select a name.
- *
- * @param shell
- * The shell for displaying this widget
- * @param name
- * A name that should be selected when the dialog opens
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- */
public static TaxonNameBase select(Shell shell, ConversationHolder conversation, TaxonNameBase name) {
NameSelectionDialog dialog = new NameSelectionDialog(shell, conversation,
"Choose a name", false, name);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredNameSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param multi a boolean.
- */
protected NameSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonNameBase name) {
super(shell, conversation, title, multi, NameSelectionDialog.class.getCanonicalName(), name);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
/** {@inheritDoc} */
@Override
protected TaxonNameBase getPersistentObject(UUID cdmUuid) {
return CdmStore.getService(INameService.class).load(cdmUuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()
- */
/** {@inheritDoc} */
@Override
protected void initModel() {
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.location.Country;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredNamedAreaSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created May 11, 2010
* @version 1.0
}else{
selectedVocabularies.remove(vocabulary);
}
-
initModel();
}
}
- private Collection<TermVocabulary<NamedArea>> selectedVocabularies;
+ private Collection<TermVocabulary> selectedVocabularies;
+ private ArrayList<TermVocabulary> preselectedVocabularies;
/**
* @param namedArea
* A namedArea that should be selected when the dialog opens
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ * @param preselectedVocabularyUuids the {@link UUID}s of the pre-selected vocabularies
* @return a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
*/
- public static NamedArea select(Shell shell, ConversationHolder conversation, NamedArea namedArea) {
+ public static NamedArea select(Shell shell, ConversationHolder conversation, NamedArea namedArea, UUID... preselectedVocabularyUuids) {
NamedAreaSelectionDialog dialog = new NamedAreaSelectionDialog(shell, conversation,
- "Choose an area", false, namedArea);
+ "Choose an area", false, namedArea, preselectedVocabularyUuids);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredNamedAreaSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param namedArea a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
- */
- protected NamedAreaSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, NamedArea namedArea) {
+ protected NamedAreaSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, NamedArea namedArea, UUID... preselectedVocabularyUuids) {
super(shell, conversation, title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);
+ if(preselectedVocabularyUuids.length>0){
+ preselectedVocabularies = new ArrayList<TermVocabulary>();
+ for(int i=0;i<preselectedVocabularyUuids.length;i++){
+ TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
+ preselectedVocabularies.add(preselectedVocabulary);
+ }
+ selectedVocabularies.retainAll(preselectedVocabularies);
+ initModel();//re-init to consider pre-selected vocabularies
+ }
}
/** {@inheritDoc} */
super.fillViewMenu(menuManager);
- for(TermVocabulary<NamedArea> vocabulary : getVocabularies()){
+ for(TermVocabulary<NamedArea> vocabulary : getAvailableVocabularies()){
IncludeNamedAreaVocabulary action = new IncludeNamedAreaVocabulary(vocabulary);
menuManager.add(action);
- action.setChecked(true);
+ if(preselectedVocabularies==null || preselectedVocabularies.isEmpty() || preselectedVocabularies.contains(vocabulary)) {
+ action.setChecked(true);
+ }
}
}
/** {@inheritDoc} */
@Override
protected void init() {
- selectedVocabularies = getVocabularies();
+ selectedVocabularies = getAvailableVocabularies();
}
- private List<TermVocabulary<NamedArea>> getVocabularies(){
- List<TermVocabulary<NamedArea>> vocabularies = CdmStore.getService(IVocabularyService.class).listByTermClass(NamedArea.class, null, null, null, null);
- vocabularies.add(CdmStore.getService(IVocabularyService.class).find(Country.uuidCountryVocabulary));
+ private List<TermVocabulary> getAvailableVocabularies(){
+ List<TermVocabulary> vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
return vocabularies;
}
String result = NamedArea.labelWithLevel(namedArea, CdmStore.getDefaultLanguage());
return result;
} catch (Exception e) {
- //TODO still need to learn how errors are handled in the Tax Editor
- System.out.println("Error occurred when trying retrieve title for Named Area: " + namedArea.getUuid());
+ MessagingUtils.error(NamedAreaSelectionDialog.class, "Error occurred when trying retrieve title for Named Area: " + namedArea.getUuid(), e);
return namedArea.getTitleCache();
}
}
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.location.Country;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
/**
* @author n.hoffmann
*/
public class SelectionDialogFactory {
- public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, ConversationHolder conversation, T currentSelection){
+ public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, ConversationHolder conversation, T currentSelection){
+ return getSelectionFromDialog(clazz, shell, conversation, currentSelection, null);
+ }
+
+ public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, ConversationHolder conversation, T currentSelection, ICdmFormElement parentElement){
if(clazz.equals(Taxon.class)){
return (T) TaxonBaseSelectionDialog.selectTaxon(shell, conversation, (Taxon) currentSelection);
return (T) ClassificationSelectionDialog.select(shell, conversation, (Classification) currentSelection);
}
if(clazz.equals(TaxonNode.class)){
- return (T) TaxonNodeSelectionDialog.select(shell, conversation, null, null, (TaxonNode) currentSelection, null);
+ return (T) TaxonNodeSelectionDialog.select(shell, conversation, null, null, (TaxonNode) currentSelection, ((TaxonNode) currentSelection).getClassification());
}
if(clazz.equals(Reference.class)){
return (T) ReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection);
return null;
}
if(clazz.equals(DerivedUnit.class)){
- return (T) DerivedUnitSelectionDialog.select(shell, conversation, (DerivedUnit) currentSelection);
+ return (T) DerivedUnitSelectionDialog.select(shell, conversation, (DerivedUnit) currentSelection);
}
if(clazz.equals(FieldUnit.class)){
- return (T) FieldUnitSelectionDialog.select(shell, conversation, (FieldUnit) currentSelection);
+ return (T) FieldUnitSelectionDialog.select(shell, conversation, (FieldUnit) currentSelection);
+ }
+ if(clazz.equals(SpecimenOrObservationBase.class)){
+ return (T) SpecimenOrObservationBaseSelectionDialog.select(shell, conversation, (SpecimenOrObservationBase) currentSelection);
}
if(clazz.equals(NamedArea.class)){
- return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection);
+ if(parentElement instanceof IEntityElement && ((IEntityElement) parentElement).getEntity() instanceof DerivedUnitFacade){
+ return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection, Country.uuidCountryVocabulary);
+ }
+ else{
+ return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection);
+ }
}
if(clazz.equals(Collection.class)){
return (T) CollectionSelectionDialog.select(shell, conversation, (Collection) currentSelection);
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.ui.dialog.selection;
+
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ */
+public class SpecimenOrObservationBaseSelectionDialog extends
+ AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> {
+
+ public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){
+ SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation,
+ "Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation);
+ return getSelectionFromDialog(dialog);
+ }
+
+ protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation,
+ String title, boolean multi, String settings,
+ SpecimenOrObservationBase cdmObject) {
+ super(shell, conversation, title, multi, settings, cdmObject);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected SpecimenOrObservationBase getPersistentObject(UUID uuid) {
+ Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
+ return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void initModel() {
+ model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+ return new NewDerivedUnitBaseWizard();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getNewWizardLinkText() {
+ return String.format("Create a new <a>%1s</a>", "field unit/derived unit");
+ }
+}
-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.ui.dialog.selection;\r
-\r
-import java.util.UUID;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-/**\r
- * <p>FilteredTaxonBaseSelectionDialog class.</p>\r
- *\r
- * @author n.hoffmann\r
- * @created Sep 21, 2009\r
- * @version 1.0\r
- */\r
-public class TaxonBaseSelectionDialog extends\r
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> {\r
- \r
- \r
- /**\r
- * <p>select</p>\r
- *\r
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
- */\r
- public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) {\r
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation,\r
- "Choose a taxon", false, null, null);\r
- return getSelectionFromDialog(dialog);\r
- }\r
- \r
- /**\r
- * <p>select</p>\r
- *\r
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
- */\r
- public static Taxon selectTaxon(Shell shell, ConversationHolder conversation, Taxon taxonToBeFiltered) {\r
- \r
-\r
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation,\r
- "Choose a taxon", false, null, taxonToBeFiltered);\r
- return (Taxon) getSelectionFromDialog(dialog);\r
- }\r
- \r
- /**\r
- * <p>select</p>\r
- *\r
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
- */\r
- public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) {\r
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation,\r
- "Choose a taxon", false, null, null);\r
- return (Synonym) getSelectionFromDialog(dialog);\r
- }\r
-\r
- private final Class<? extends TaxonBase> clazz;\r
- \r
- /**\r
- * <p>Constructor for FilteredTaxonBaseSelectionDialog.</p>\r
- *\r
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
- * @param title a {@link java.lang.String} object.\r
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
- * @param multi a boolean.\r
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
- */\r
- protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonBase taxon, TaxonBase taxonToBeFiltered) {\r
- super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), taxon);\r
- this.cdmBaseToBeFiltered = taxonToBeFiltered;\r
-\r
- \r
- \r
- this.clazz = clazz;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea(org.eclipse.swt.widgets.Composite)\r
- */\r
- /** {@inheritDoc} */\r
- @Override\r
- protected Control createExtendedContentArea(Composite parent) {\r
- return null;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)\r
- */\r
- /** {@inheritDoc} */\r
- @Override\r
- protected TaxonBase getPersistentObject(UUID uuid) {\r
- return CdmStore.getService(ITaxonService.class).load(uuid);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()\r
- */\r
- /** {@inheritDoc} */\r
- @Override\r
- protected void initModel() {\r
- if(clazz == TaxonBase.class){\r
- model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache();\r
- }\r
- else if(clazz == Taxon.class){\r
- \r
- model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon();\r
- \r
- }\r
- else if(clazz == Synonym.class){\r
- model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym();\r
- }\r
- }\r
-\r
- /** {@inheritDoc} */\r
- @Override\r
- protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {\r
- return null;\r
- }\r
-\r
- /** {@inheritDoc} */\r
- @Override\r
- protected String getNewWizardLinkText() {\r
- return null;\r
- }\r
-}\r
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.ui.dialog.selection;
+
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewTaxonWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Sep 21, 2009
+ * @version 1.0
+ */
+public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonBase> {
+
+
+ public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) {
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation,
+ "Choose a taxon/synonym", false, null, null);
+ return getSelectionFromDialog(dialog);
+ }
+
+ public static Taxon selectTaxon(Shell shell, ConversationHolder conversation, Taxon taxonToBeFiltered) {
+
+
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation,
+ "Choose a taxon", false, null, taxonToBeFiltered);
+ return (Taxon) getSelectionFromDialog(dialog);
+ }
+
+ public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) {
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation,
+ "Choose a synonym", false, null, null);
+ return (Synonym) getSelectionFromDialog(dialog);
+ }
+
+ private final Class<? extends TaxonBase> clazz;
+
+ protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonBase taxon, TaxonBase taxonToBeFiltered) {
+ super(shell, conversation, title, multi, TaxonBaseSelectionDialog.class.getCanonicalName(), taxon);
+ this.cdmBaseToBeFiltered = taxonToBeFiltered;
+ this.clazz = clazz;
+ initModel();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected TaxonBase getPersistentObject(UUID uuid) {
+ return CdmStore.getService(ITaxonService.class).load(uuid);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void initModel() {
+ if(clazz == TaxonBase.class){
+ model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache();
+ }
+ else if(clazz == Taxon.class){
+ model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon();
+ }
+ else if(clazz == Synonym.class){
+ model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+ return new NewTaxonWizard();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getNewWizardLinkText() {
+ return String.format("Create a new <a>%1s</a>", "Taxon ");
+ }
+}
*/
package eu.etaxonomy.taxeditor.ui.dialog.selection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredTaxonNodeSelectionDialog class.</p>
- *
* @author p.ciardelli
* @version $Id: $
*/
public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNode> implements SelectionListener{
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param excludeTaxa a {@link java.util.List} object.
- * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- */
public static TaxonNode select(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, TaxonNode node, Classification classification) {
TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
conversation,
private List<Classification> classifications;
private Classification selectedClassification;
+ private final List<UUID> excludeTaxa;
- /**
- * <p>Constructor for FilteredTaxonNodeSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param excludeTaxa a {@link java.util.List} object.
- * @param multi a boolean.
- * @param node a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- */
protected TaxonNodeSelectionDialog(Shell shell, ConversationHolder conversation, String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, Classification classification) {
super(shell, conversation, title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
setListLabelProvider(labelProvider);
setDetailsLabelProvider(labelProvider);
-
+ this.excludeTaxa = excludeTaxa;
if(classification != null){
selectedClassification = classification;
}
+ initModel();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea(org.eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
protected Control createExtendedContentArea(Composite parent) {
return "";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
/** {@inheritDoc} */
@Override
protected TaxonNode getPersistentObject(UUID uuid) {
return CdmStore.getService(IClassificationService.class).getTaxonNodeByUuid(uuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()
- */
/** {@inheritDoc} */
@Override
protected void initModel() {
if(classifications == null){
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
- selectedClassification = classifications.iterator().next();
+ Collections.sort(classifications, new Comparator<Classification>() {
+
+ @Override
+ public int compare(Classification o1, Classification o2) {
+ return o1.getTitleCache().compareTo(o2.getTitleCache());
+ }
+ });
+ if (this.cdmBaseToBeFiltered == null){
+ selectedClassification = classifications.iterator().next();
+ } else {
+ selectedClassification = this.cdmBaseToBeFiltered.getClassification();
+ }
}
- model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification);
+ model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), excludeTaxa);
}
/** {@inheritDoc} */
// $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.
*/
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
* <p>
* Abstract AbstractCdmEntityWizardPage class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Jun 1, 2010
* @version 1.0
* <p>
* Constructor for AbstractCdmEntityWizardPage.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
* .Composite)
Composite control = formFactory.createComposite(scrolledForm.getBody());
control.setLayoutData(LayoutConstants.FILL());
- control.setLayout(LayoutConstants.LAYOUT(2, false));
+ TableWrapLayout layout = LayoutConstants.LAYOUT(2, false);
+ layout.horizontalSpacing = 5;
+ control.setLayout(layout);
WizardPageRootElement rootElement = new WizardPageRootElement(
formFactory, control, getConversationHolder());
* <p>
* Getter for the field <code>entity</code>.
* </p>
- *
+ *
* @return a T object.
*/
public T getEntity() {
/**
* Creates the detail element for this wizard page
- *
+ *
* @param rootElement
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
* object.
if (event.getSource() == getDetailElement()) {
checkComplete();
}
+ else if(event.getSource() instanceof AbstractCdmDetailElement){
+ //check if parent element is set as detail element
+ ICdmFormElement formElement = (ICdmFormElement) event.getSource();
+ while(formElement.getParentElement()!=null){
+ if(formElement.getParentElement() == getDetailElement()){
+ checkComplete();
+ return;
+ }
+ formElement = formElement.getParentElement();
+ }
+ }
}
/**
* <p>
* getConversationHolder
* </p>
- *
+ *
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
* object.
*/
* <p>
* Getter for the field <code>detailElement</code>.
* </p>
- *
+ *
* @return a
* {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
* object.
TableWrapLayout layout = LayoutConstants.LAYOUT();
layout.bottomMargin = 10;
layout.rightMargin = 5;
+ layout.horizontalSpacing = 5;
client.setLayout(layout);
*/
@Override
public ConversationHolder getConversationHolder() {
- if(getParentElement() instanceof RootElement || getParentElement() == null){
-
- IEditorPart activeEditor = AbstractUtility.getActiveEditor();
- if(activeEditor instanceof IConversationEnabled){
- ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
- return conversation;
- }
- }else if(getParentElement() instanceof IConversationEnabled){
- return ((IConversationEnabled) getParentElement()).getConversationHolder();
- }
+ if(AbstractUtility.getActivePart() instanceof IConversationEnabled){
+ return ((IConversationEnabled) AbstractUtility.getActivePart()).getConversationHolder();
+ }
+ if(getParentElement() instanceof RootElement || getParentElement() == null){
+
+ IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+ if(activeEditor instanceof IConversationEnabled){
+ ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
+ return conversation;
+ }
+ }else if(getParentElement() instanceof IConversationEnabled){
+ return ((IConversationEnabled) getParentElement()).getConversationHolder();
+ }
MessagingUtils.messageDialog("Could not get conversation for AbstractFormSection",
getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't",
new IllegalArgumentException());
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.ui.element;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.taxeditor.Messages;
+
+/**
+ *
+ * @author pplitzner
+ * @date Sep 21, 2015
+ *
+ */
+public abstract class AbstractUriWithExceptionLabelElement <T> extends TextWithLabelElement {
+
+ protected Label labelException;
+
+ protected AbstractUriWithExceptionLabelElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, String labelString,
+ T initialObject, Integer textHeight, int style) {
+ super(formFactory, parentElement, false);
+
+ init(formFactory, labelString, initialObject, textHeight, style);
+ }
+
+ protected void init(CdmFormFactory formFactory, String labelString, T initialObject, Integer textHeight, int style) {
+ //label
+ initLabel(formFactory, labelString, false, getLayoutComposite());
+
+ //uri text
+ initText(formFactory, null, textHeight, null, false, style, getLayoutComposite());
+
+ //exceptionLabel
+ initExceptionLabel(getLayoutComposite(), formFactory, initialObject);
+ }
+
+ protected void initExceptionLabel(Composite parent, CdmFormFactory formFactory, T initialObject) {
+ labelException = formFactory.createLabel(parent, "", SWT.WRAP); //$NON-NLS-1$
+ int numColumns = AbstractFormSection.DEFAULT_NUM_COLUMNS;
+ if(parent.getLayout() instanceof TableWrapLayout){
+ numColumns = ((TableWrapLayout)parent.getLayout()).numColumns;
+ }
+ labelException.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(numColumns, 1));
+ addControl(labelException);
+ setParsedText(initialObject);
+ }
+
+
+ public abstract void setParsedText(T object);
+
+ protected abstract T getParsedText() throws Exception;
+
+ public T parseText(){
+ try {
+ labelException.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
+ labelException.setForeground(getPersistentBackground());
+ labelException.setText(""); //$NON-NLS-1$
+ return getParsedText();
+ } catch (Exception e) {
+ labelException.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
+ labelException.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ labelException.setText(Messages.UriWithLabelElement_URL_NOT_SAVED+e.getLocalizedMessage());
+ return null;
+ }
+ }
+
+}
import eu.etaxonomy.cdm.model.common.IEnumTerm;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.cdm.model.common.LSID;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElement;
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionElement;
+import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeAgentRelationCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenHierarchyDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationHistoryDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenSourceCollectionDetailSection;
return element;
}
+ public LsidWithExceptionLabelElement createLsidWithExceptionLabelElement(ICdmFormElement parentElement, String labelString,
+ LSID initialLsid, int style) {
+ LsidWithExceptionLabelElement element = new LsidWithExceptionLabelElement(this, parentElement, labelString, initialLsid, null, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
public UriWithLabelElement createUriWithLabelElement(ICdmFormElement parentElement, String labelString,
URI initialUri, int style) {
UriWithLabelElement element = new UriWithLabelElement(this, parentElement, labelString, initialUri, null, style);
return section;
}
- public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
+ NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
addAndAdaptSection(parentElement, section);
return section;
}
return section;
}
+ public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, conversation, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PreservedSpecimenDeterminationDetailSection createPreservedSpecimenDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- PreservedSpecimenDeterminationDetailSection section = new PreservedSpecimenDeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return element;
}
- public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement){
- TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement);
+ public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
+ TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
+ adapt(element);
+ parentElement.addElement(element);
+
+ return element;
+ }
+
+ public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement, boolean createNew){
+ TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement, createNew);
addAndAdaptElement(parentElement, element);
return element;
}
return element;
}
- public PreservedSpecimenDeterminationDetailElement createPreservedSpecimenDeterminationDetailElement(ICdmFormElement parentElement) {
- PreservedSpecimenDeterminationDetailElement element = new PreservedSpecimenDeterminationDetailElement(this, parentElement);
- addAndAdaptElement(parentElement, element);
- return element;
- }
-
public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return section;
}
+ public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+ GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
public IdentifierDetailSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
IdentifierDetailSection section = new IdentifierDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PreservedSpecimenDeterminationHistoryDetailSection createPreservedSpecimenDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- PreservedSpecimenDeterminationHistoryDetailSection section = new PreservedSpecimenDeterminationHistoryDetailSection(this, conversation, parentElement, style);
- addAndAdaptSection(parentElement, section);
- return section;
- }
-
public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
+
public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement,
Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style) {
AbstractEntityCollectionElement element = null;
if (entity instanceof Annotation) {
element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
- } else if (entity instanceof Person) {
+ }else if (entity instanceof Person) {
element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
} else if (entity instanceof Credit) {
element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
element = new ExtensionElement(this, parentElement, (Extension) entity, removeListener, style);
} else if (entity instanceof Marker) {
element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
- } else if (entity instanceof Media) {
+ } else if (entity instanceof TaxonNodeAgentRelation) {
+ element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, removeListener, backgroundColor, style);
+ }else if (entity instanceof Media) {
element = new MediaMetaElement(this, parentElement, (Media) entity, removeListener, true, style);
} else if (entity instanceof MediaRepresentation) {
element = new MediaRepresentationElement(this, parentElement, (MediaRepresentation) entity, removeListener,
} else if (entity instanceof DescriptionElementSource) {
element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
removeListener, style);
- } else if (entity instanceof IdentifiableSource) {
+ } else if (entity instanceof TaxonNodeAgentRelation) {
+ element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity,
+ removeListener,backgroundColor, style);
+ }
+ else if (entity instanceof IdentifiableSource) {
element = new IdentifiableSourceElement(this, parentElement, (IdentifiableSource) entity, removeListener,
style);
} else if (entity instanceof DefinedTerm) {
element = new SynonymRelationshipDetailElement(this, parentElement, (SynonymRelationship) entity, removeListener,
style);
} else if (entity instanceof SpecimenTypeDesignation) {
- element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
- removeListener, style);
+ if(parentElement instanceof DerivedUnitTypeDesignationSection){
+ element = new DerivedUnitTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
+ removeListener, style);
+ }
+ else{
+ element = new SpecimenTypeDesignationElement(this, parentElement, (SpecimenTypeDesignation) entity,
+ removeListener, style);
+ }
} else if (entity instanceof StateData) {
element = new StateDataElement(this, parentElement, (StateData) entity, removeListener, style);
} else if (entity instanceof StatisticalMeasurementValue) {
element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
}
+
if (element == null) {
MessagingUtils.messageDialog("No element for entity", this,
"Could not generate element for entity. Looks like the case is not handled already. Check implementation. Entity: "
* a {@link ConversationHolder} object.
* @return a {@link EntitySelectionElement} object.
*/
- public <T extends ICdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
+ public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
ConversationHolder conversation, ICdmFormElement parentElement, String labelString, T selection, int mode,
int style) {
EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, conversation, parentElement, clazz,
* a {@link ConversationHolder} object.
* @return a {@link EntitySelectionElement} object.
*/
- public <T extends ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
+ public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
T selection, int mode, int style) {
EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
return section;
}
+ /**
+ * @param formElement
+ * @param conversationHolder
+ * @param style
+ * @return
+ */
+ public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
+ ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
+ TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
+ addAndAdaptSection(formElement, section);
+ return section;
+ }
+
}
// $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.
*/
* <p>
* DateDetailSection class.
* </p>
- *
+ *
* @author n.hoffmann
* @created Mar 31, 2010
* @version 1.0
* <p>
* Constructor for DateDetailSection.
* </p>
- *
+ *
* @param formFactory
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
* object.
super(formFactory, parentElement, style);
partialElement_start = formFactory.createPartialElement(this,
- "Start: ", null, style);
- partialElement_end = formFactory.createPartialElement(this, "End: ",
+ "Start ", null, style);
+ partialElement_end = formFactory.createPartialElement(this, "End ",
null, style);
text_parseText = formFactory.createTextWithLabelElement(this, "Parse",
}
return super.getEntity();
}
-
+
/**
* <p>
* Setter for the field <code>timePeriod</code>.
* </p>
- *
+ *
* @param timePeriod
* a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
*/
updateTitle();
text_parseText.setText(timePeriod.toString());
}
-
+
/**
* When setting the entity through parsing we do not want to alter the parse field
* @param timePeriod
} else if (eventSource == text_parseText) {
cursorPosition = ((Text) text_parseText.getMainControl())
.getCaretPosition();
- setEntityInternally(TimePeriodParser.parseString(text_parseText.getText()));
+ setEntityInternally(TimePeriodParser.parseString(text_parseText.getText()));
} else if (eventSource == text_freeText) {
getEntity().setFreeText(text_freeText.getText());
}
this.setText(title);
layout();
}
-
+
/*
* (non-Javadoc)
- *
+ *
* @see eu.etaxonomy.taxeditor.forms.AbstractFormSection#dispose()
*/
/** {@inheritDoc} */
// $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.
*/
/**
- * <p>ISelectableElement interface.</p>
+ * Implementors of this interface provide a {@link SelectionArbitrator}.<br>
+ * The arbitrator allows the element to be selected to show e.g.
+ * supplemental data.<br>
+ * An arbitrator can be added like in the following code example:
+ * <br>
+ * <br>
+ * <pre>
+ * //make element selectable
+ * if(cdmFormFactory.getSelectionProvider() != null){
+ * selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
+ * }
+ * </pre>
*
* @author n.hoffmann
* @created Mar 5, 2010
// $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.
*/
import org.eclipse.ui.forms.widgets.TableWrapData;
import eu.etaxonomy.cdm.common.UriUtils;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
- * <p>ImageElement class.</p>
- *
* @author n.hoffmann
* @created Sep 24, 2010
* @version 1.0
private URI imageUri;
private Image image;
-
+
private Composite container;
- /**
- * <p>Constructor for ImageElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param imageUri a {@link java.net.URI} object.
- * @param style a int.
- */
+ private final Runnable postRunnable = new Runnable(){
+ @Override
+ public void run() {
+ AbstractUtility.reflowDetailsViewer();
+ AbstractUtility.reflowSupplementalViewer();
+ }
+ };
+
protected ImageElement(CdmFormFactory formFactory, ICdmFormElement parentElement, URI imageUri, int style) {
super(formFactory, parentElement);
-
+
container = new Composite(getLayoutComposite(), style);
container.setLayoutData(LayoutConstants.FILL(2, 1));
-
+
container.addPaintListener(this);
}
- /**
- * <p>Setter for the field <code>imageUri</code>.</p>
- *
- * @param uri a {@link java.net.URI} object.
- * @throws HttpException
- * @throws IOException
- */
public void initImageUri(URI uri) throws IOException, HttpException {
this.imageUri = uri;
InputStream imageStream = UriUtils.getInputStream(imageUri);
image = new Image(Display.getCurrent(), imageStream);
}
-
-
- /**
- * <p>Getter for the field <code>imageUri</code>.</p>
- *
- * @return the imageUri
- */
+
+
public URI getImageUri() {
return imageUri;
}
-
+
public void loadImage(){
- loadImage(null);
- }
-
-
-
- public void loadImage(final Runnable postRunnable){
if(getImageUri() != null){
Job job = new Job("Loading image") {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
} catch (Exception e) {
MessagingUtils.messageDialog("Could not load image", getClass(), e.getMessage() + ": " + getImageUri(), e);
}
-
+
return Status.OK_STATUS;
}
};
job.schedule();
}
}
-
-
- public void unloadImage(final Runnable postRunnable) {
+ public void unloadImage() {
Job job = new Job("Unloading image") {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
} catch (Exception e) {
MessagingUtils.messageDialog("Could not unload image", getClass(), e.getMessage() + ": " + getImageUri(), e);
}
-
+
return Status.OK_STATUS;
}
};
job.schedule();
-
+
}
-
+
public IRunnableWithProgress getLoadImageRunnable(final Runnable postRunnable){
-
- final Display display = getLayoutComposite().getDisplay();
-
+
+ final Display display = getLayoutComposite().getDisplay();
+
IRunnableWithProgress runnable = new IRunnableWithProgress(){
-
+
@Override
public void run(IProgressMonitor monitor) {
monitor.beginTask("Loading: " + getImageUri(), IProgressMonitor.UNKNOWN);
-
+
// redraw the image container
display.asyncExec(new Runnable(){
@Override
public void run() {
- if(! getLayoutComposite().isDisposed()){
+ if(! getLayoutComposite().isDisposed() && container!=null){
Event untypedEvent = new Event();
untypedEvent.widget = container;
PaintEvent event = new PaintEvent(untypedEvent);
}
}
});
-
+
// execute the external runnable
if(postRunnable != null){
display.asyncExec(postRunnable);
}
- monitor.done();
+ monitor.done();
}
};
-
+
return runnable;
}
-
+
private Rectangle calculateImageBounds(Image image, Control control){
Rectangle imageBounds = image.getBounds();
Rectangle containerBounds = control.getBounds();
-
+
Integer imgWidth = imageBounds.width;
Integer imgHeight = imageBounds.height;
-
+
Float ratio = imgHeight.floatValue()/imgWidth.floatValue();
Integer width = containerBounds.width;
Integer height = ((Float) (width * ratio)).intValue();
-
+
return new Rectangle(containerBounds.x, containerBounds.y, width, height);
}
+ public void dispose(){
+ if(image!=null){
+ image.dispose();
+ image = null;
+ }
+ imageUri = null;
+ if(container!=null){
+ container.dispose();
+ container = null;
+ }
+ }
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent)
- */
/** {@inheritDoc} */
@Override
public void paintControl(PaintEvent e) {
// $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.
*/
import org.eclipse.jface.util.PropertyChangeEvent;
+import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.description.KeyStatement;
/**
/**
* @return the keyStatement
*/
- public KeyStatement getKeyStatement() {
- return keyStatement;
+ public KeyStatement updateKeyStatement(KeyStatement ks) {
+ keyStatement = ks;
+ if(keyStatement == null) {
+ keyStatement = KeyStatement.NewInstance(element_languageString.getLanguageString().getLanguage(),
+ element_languageString.getLanguageString().getText());
+
+ } else {
+ LanguageString languageString = keyStatement.getLabel().get(element_languageString.getLanguageString().getLanguage());
+ if(languageString != null) {
+ languageString.setText(element_languageString.getText());
+ } else {
+ keyStatement.getLabel().put(element_languageString.getLanguageString().getLanguage(),
+ element_languageString.getLanguageString());
+ }
+ }
+ return keyStatement;
}
+
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.ui.forms.MultilanguageTextElement#propertyChange
* (org.eclipse.jface.util.PropertyChangeEvent)
if (event == null) {
return;
}
-
+
if (keyStatement == null) {
Object eventSource = event.getSource();
if (eventSource == element_languageString) {
-
+
if(element_languageString.getLanguageString() != null) {
- // for the case when the user copy / pastes text into the
+ // for the case when the user copy / pastes text into the
// (LanguageStringWithLabelElement) element_languageString text field
setKeyStatement(KeyStatement.NewInstance(element_languageString.getLanguageString().getLanguage(),
element_languageString.getLanguageString().getText()));
} else {
- setKeyStatement(KeyStatement.NewInstance());
+ //setKeyStatement(KeyStatement.NewInstance());
}
}
}
-
+
super.propertyChange(event);
-
+
}
}
return languageString;
}
+ public LanguageString updateLanguageString(LanguageString ls) {
+ if(ls == null){
+ ls = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
+ }
+ ls.setText(text.getText());
+ return ls;
+ }
+
/** {@inheritDoc} */
@Override
public void modifyText(ModifyEvent e) {
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.ui.element;
+
+import eu.etaxonomy.cdm.model.common.LSID;
+
+/**
+ *
+ * @author pplitzner
+ * @date Sep 21, 2015
+ *
+ */
+public class LsidWithExceptionLabelElement extends AbstractUriWithExceptionLabelElement<LSID> {
+
+ protected LsidWithExceptionLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement,
+ String labelString, LSID initialObject, Integer textHeight, int style) {
+ super(formFactory, parentElement, labelString, initialObject, textHeight, style);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setParsedText(LSID object) {
+ if(object != null){
+ super.setText(object.toString());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public LSID getParsedText() throws Exception {
+ return new LSID(super.getText());
+ }
+
+}
this.multilanguageText = multilanguageText;
if (multilanguageText != null) {
- if (multilanguageText.isEmpty()) {
- multilanguageText.put(
- CdmStore.getDefaultLanguage(),
- LanguageString.NewInstance("",
- CdmStore.getDefaultLanguage()));
- }
if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
combo_language.setTerms(getLanguages());
button.setEnabled(false);
.getDefaultLanguage() }));
element_languageString.setLanguageString(preferredLanguageString);
+
if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
- combo_language.setSelection(preferredLanguageString.getLanguage());
+ combo_language.setSelection(preferredLanguageString == null?CdmStore.getDefaultLanguage():preferredLanguageString.getLanguage());
button.setEnabled(true);
}
}
// $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.
*/
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.joda.time.Partial;
import eu.etaxonomy.cdm.model.common.TimePeriod;
private NumberWithLabelElement number_month;
private NumberWithLabelElement number_year;
private Partial partial;
-
+
/**
* <p>Constructor for PartialElement.</p>
*
public PartialElement(CdmFormFactory formFactory,
ICdmFormElement formElement, String labelString, int style) {
super(formFactory, formElement);
-
- formElement.getLayoutComposite().setLayout(LayoutConstants.LAYOUT(7, false));
-
+
+ TableWrapLayout layout = LayoutConstants.LAYOUT(7, false);
+ layout.horizontalSpacing = 5;
+ formElement.getLayoutComposite().setLayout(layout);
+
label = formFactory.createLabel(getLayoutComposite(), labelString);
addControl(label);
-
+
number_year = formFactory.createNumberTextWithLabelElement(this, "Year", null, style);
number_year.setLimits(4, -9999, 9999);
-
- number_month = formFactory.createNumberTextWithLabelElement(this, "Month", null, style);
+
+ number_month = formFactory.createNumberTextWithLabelElement(this, "Month", null, style);
number_month.setLimits(2, 1, 12);
-
+
number_day = formFactory.createNumberTextWithLabelElement(this, "Day", null, style);
number_day.setLimits(2, 1, 31);
-
-
- formFactory.addPropertyChangeListener(this);
+
+
+ formFactory.addPropertyChangeListener(this);
}
-
+
/**
* <p>Setter for the field <code>partial</code>.</p>
*
*/
public void setPartial(Partial partial){
this.partial = partial;
-
+
if(partial != null){
number_day.setNumber(TimePeriod.getPartialValue(partial, TimePeriod.DAY_TYPE));
number_month.setNumber(TimePeriod.getPartialValue(partial, TimePeriod.MONTH_TYPE));
if(event == null){
return;
}
-
+
Object eventSource = event.getSource();
-
+
if(getElements().contains(eventSource)){
if(event instanceof CdmPropertyChangeEvent){
if(((CdmPropertyChangeEvent) event).hasException()){
}
}
handleEvent(eventSource);
- }
+ }
}
-
+
/**
* @param event
*/
private void handleEvent(Object eventSource){
if(eventSource == number_month){
- partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE);
+ if (number_month.getInteger() == 0){
+ partial = TimePeriod.setPartialField(partial, null, TimePeriod.MONTH_TYPE);
+ } else{
+ partial = TimePeriod.setPartialField(partial, number_month.getInteger(), TimePeriod.MONTH_TYPE);
+ }
+
}else if(eventSource == number_day){
- partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE);
+ if (number_day.getInteger() == 0){
+ partial = TimePeriod.setPartialField(partial, null, TimePeriod.DAY_TYPE);
+ } else{
+ partial = TimePeriod.setPartialField(partial, number_day.getInteger(), TimePeriod.DAY_TYPE);
+ }
+
+
}else if(eventSource == number_year){
- partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE);
+ if (number_year.getInteger() == 0){
+ partial = TimePeriod.setPartialField(partial, null, TimePeriod.YEAR_TYPE);
+ } else{
+ partial = TimePeriod.setPartialField(partial, number_year.getInteger(), TimePeriod.YEAR_TYPE);
+ }
+
}
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
-
+
/** {@inheritDoc} */
@Override
public void setBackground(Color color) {
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
* @created Dec 20, 2010
* @version 1.0
*/
-public class UriWithLabelElement extends TextWithLabelElement {
+public class UriWithLabelElement extends AbstractUriWithExceptionLabelElement<URI> {
- private final Label labelException;
- private final Button btnOpenBrowser;
+ private Button btnOpenBrowser;
- protected UriWithLabelElement(CdmFormFactory formFactory,
- ICdmFormElement parentElement, String labelString,
- URI initialUri, Integer textHeight, int style) {
- super(formFactory, parentElement, false);
+ protected UriWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString,
+ URI initialObject, Integer textHeight, int style) {
+ super(formFactory, parentElement, labelString, initialObject, textHeight, style);
- //label
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void init(CdmFormFactory formFactory, String labelString, URI initialObject, Integer textHeight, int style) {
+
+ //label
initLabel(formFactory, labelString, false, getLayoutComposite());
//composite(uri + button)
initText(formFactory, null, textHeight, null, false, style, textAndButton);
//button
- btnOpenBrowser = formFactory.createButton(textAndButton, "", SWT.NONE); //$NON-NLS-1$
- btnOpenBrowser.setImage(ImageResources.getImage(ImageResources.WEB));
- btnOpenBrowser.setToolTipText(Messages.UriWithLabelElement_OPEN_EXTERNAL_BROWSER);
- btnOpenBrowser.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String errorTitle = Messages.UriWithLabelElement_INVALID_URL;
- String errorText = Messages.UriWithLabelElement_COULD_NOT_OPEN_BROWSER;
-
- URI uri = getUri();
- if(uri!=null){
- try {
+ btnOpenBrowser = formFactory.createButton(textAndButton, "", SWT.NONE); //$NON-NLS-1$
+ btnOpenBrowser.setImage(ImageResources.getImage(ImageResources.WEB));
+ btnOpenBrowser.setToolTipText(Messages.UriWithLabelElement_OPEN_EXTERNAL_BROWSER);
+ btnOpenBrowser.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String errorTitle = Messages.UriWithLabelElement_INVALID_URL;
+ String errorText = Messages.UriWithLabelElement_COULD_NOT_OPEN_BROWSER;
+
+ URI uri = parseText();
+ if(uri!=null){
+ try {
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(uri.toURL());
} catch (PartInitException pie) {
MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, pie));
} catch (IllegalArgumentException iae) {
MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, iae));
}
- }
- else{
- MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, null));
- }
- }
+ }
+ else{
+ MessagingUtils.informationDialog(errorTitle, new Status(IStatus.WARNING, TaxeditorStorePlugin.PLUGIN_ID, errorText, null));
+ }
+ }
});
- btnOpenBrowser.setLayoutData(LayoutConstants.RIGHT());
-
- labelException = formFactory.createLabel(getLayoutComposite(), "", SWT.WRAP); //$NON-NLS-1$
- int numColumns = AbstractFormSection.DEFAULT_NUM_COLUMNS;
- if(getLayoutComposite().getLayout() instanceof TableWrapLayout){
- numColumns = ((TableWrapLayout)getLayoutComposite().getLayout()).numColumns;
- }
- labelException.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(numColumns, 1));
- addControl(labelException);
- setUri(initialUri);
- }
+ btnOpenBrowser.setLayoutData(LayoutConstants.RIGHT());
+
+ initExceptionLabel(getLayoutComposite(), formFactory, initialObject);
+ }
- public void setUri(URI uri) {
- if(uri != null){
- super.setText(uri.toString());
- }
- }
- public URI getUri(){
- try {
- labelException.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
- labelException.setForeground(getPersistentBackground());
- labelException.setText(""); //$NON-NLS-1$
- return new URI(super.getText());
- } catch (Exception e) {
- labelException.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
- labelException.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
- labelException.setText(Messages.UriWithLabelElement_URL_NOT_SAVED+e.getMessage());
- return null;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setParsedText(URI object) {
+ if(object != null){
+ super.setText(object.toString());
}
- }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected URI getParsedText() throws Exception {
+ return new URI(super.getText());
+ }
}
// change others passwords
CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword());
}
+ CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
internalConversation.commit(false);
internalConversation.unbind();
internalConversation.close();
return false;
}catch (AuthenticationException e){
MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
-
+
return false;
}catch(Exception e){
MessagingUtils.warningDialog("Problem with changing password", this, "The password could not be changed. " + e.getMessage());
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
private final Composite box;
private Button btnRemove;
- private Button btnChooseEntity;
+ protected Button btnChooseEntity;
private Color backgroundColor;
setLayoutComposite(container);
addControl(container);
- Layout containerLayout = LayoutConstants.LAYOUT(2, false);
+ TableWrapLayout containerLayout = LayoutConstants.LAYOUT(2, false);
+ containerLayout.horizontalSpacing = 5;
container.setLayout(containerLayout);
container.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
if(isChoosableEntity){
btnChooseEntity = formFactory.createButton(box, null, SWT.PUSH);
addControl(btnChooseEntity);
+
btnChooseEntity.setLayoutData(LayoutConstants.RIGHT());
btnChooseEntity.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
btnChooseEntity.setToolTipText("Browse");
((AbstractEntityCollectionSection)getParentElement()).addElement(entity);
((AbstractEntityCollectionSection)getParentElement()).firePropertyChangeEvent(getParentElement());
}
+
}
}
});
return;
}
Object eventSource = event.getSource();
- if (getElements().contains(eventSource)) {
+ if (getElements().contains(eventSource) || getControls().contains(eventSource)) {
handleEvent(eventSource);
}
}
/** {@inheritDoc} */
@Override
public void setBackground(Color color) {
+ if(box.isDisposed() || container.isDisposed()){
+ return;
+ }
backgroundColor = color;
super.setBackground(color);
box.setBackground(color);
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
+
+ @Override
+ protected void handleToggleableCacheField() {
+ boolean pushedState = toggleable_cache.getState();
+
+ getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
+ setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_nomenclaturalTitle }));
+ updateToggleableCacheField();
+ }
}
package eu.etaxonomy.taxeditor.ui.section.agent;
-import java.awt.Checkbox;
import java.util.Arrays;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
toggleable_cache = formFactory.createToggleableTextField(formElement, "Title Cache", entity.getTitleCache(), entity.isProtectedTitleCache(), style);
toggleable_nomenclaturalTitleCache = formFactory.createToggleableTextField(formElement, "Abbrev. Title", entity.getNomenclaturalTitle(), entity.isProtectedNomenclaturalTitleCache(), style);
- hasAdditionalMembers = formFactory.createCheckbox(formElement, "Additional Members", false, style);
+ hasAdditionalMembers = formFactory.createCheckbox(formElement, "Additional Members", entity.isHasMoreMembers(), style);
section_teamMembers = formFactory.createTeamMemberSection(getConversationHolder(), formElement, ExpandableComposite.EXPANDED);
section_teamMembers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
}
@Override
protected void updateContent() {
super.updateContent();
-
+
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
toggleable_nomenclaturalTitleCache.setEnabled(getEntity()
.isProtectedNomenclaturalTitleCache());
toggleable_cache.getState(),
Arrays.asList(new Object[] { toggleable_cache,
toggleable_nomenclaturalTitleCache , hasAdditionalMembers}));
-
+
section_teamMembers.setEntity(getEntity());
}
public void handleEvent(Object eventSource) {
if (eventSource == toggleable_cache) {
handleToggleableCacheField();
-
+
} else if (eventSource == toggleable_nomenclaturalTitleCache) {
- getEntity().setNomenclaturalTitle(
- toggleable_nomenclaturalTitleCache.getText(),
- toggleable_nomenclaturalTitleCache.getState());
+ updateToggleable_nomanclaturalTitleCacheField();
setIrrelevant(
toggleable_nomenclaturalTitleCache.getState(),
Arrays.asList(new Object[] { toggleable_nomenclaturalTitleCache, hasAdditionalMembers }));
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
+
+ public void updateToggleable_nomanclaturalTitleCacheField() {
+ boolean pushedState = toggleable_nomenclaturalTitleCache.getState();
+
+ getEntity().setNomenclaturalTitle(toggleable_nomenclaturalTitleCache.getText(), pushedState);
+ setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache }));
+
+ if (!getEntity().isProtectedNomenclaturalTitleCache()) {
+ toggleable_nomenclaturalTitleCache.setText(getEntity().getNomenclaturalTitle());
+ }
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.ui.section.classification;
+
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+/**
+ * @author k.luther
+ * @date 23.03.2016
+ *
+ */
+public abstract class AbstractEditWizard<T> extends Wizard implements
+INewWizard, IConversationEnabled{
+
+ private ConversationHolder conversation;
+
+ protected CdmFormFactory formFactory;
+
+ private T entity;
+
+ private IWorkbench workbench;
+
+
+
+ /**
+ * <p>Constructor for AbstractNewEntityWizard.</p>
+ *
+ * @param <T> a T object.
+ */
+ public AbstractEditWizard(){
+ setWindowTitle(String.format("New %s", getEntityName()));
+ }
+
+ /**
+ * FIXME there might be a smarter way to do this,
+ *
+ * @return
+ */
+ protected abstract String getEntityName();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ saveEntity();
+
+ conversation.commit();
+ conversation.close();
+ return true;
+ }
+
+ /**
+ * <p>Getter for the field <code>entity</code>.</p>
+ *
+ * @return a T object.
+ */
+ public T getEntity() {
+ return entity;
+ }
+
+ /**
+ * <p>Setter for the field <code>entity</code>.</p>
+ *
+ * @param entity a T object.
+ */
+ public void setEntity(T entity){
+ this.entity = entity;
+ }
+
+ /**
+ * Adds the entity to the current persistence context
+ */
+ protected abstract void saveEntity();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench != null ? workbench : AbstractUtility.getWorkbench();
+
+
+ formFactory = new CdmFormFactory(Display.getCurrent(), null);
+ conversation = CdmStore.createConversation();
+
+
+ }
+
+
+
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {}
+
+ /**
+ * @return the workbench
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.ui.section.classification;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 23.03.2016
+ *
+ */
+public class EditTaxonNodeWizard extends AbstractEditWizard<ITaxonTreeNode> {
+
+ private TaxonNodeWizardPage taxonNodePage;
+ private IWizardPageListener wizardPageListener;
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#getEntityName()
+ */
+ @Override
+ protected String getEntityName() {
+ return "TaxonNode";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.classification.AbstractEditWizard#saveEntity()
+ */
+ @Override
+ protected void saveEntity() {
+ getConversationHolder().bind();
+ TaxonNode node = (TaxonNode)getEntity();
+
+ CdmStore.getService(ITaxonNodeService.class).merge(node, true);
+ }
+ @Override
+ public void addPages() {
+ taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener, false);
+
+ addPage(taxonNodePage);
+ }
+
+ public void addWizardPageListener(IWizardPageListener wizardPageListener){
+ this.wizardPageListener = wizardPageListener;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#setEntity(java.lang.Object)
+ */
+ @Override
+ public void setEntity(ITaxonTreeNode entity) {
+ setWindowTitle(String.format("Edit %s", getEntityName()));
+ entity = CdmStore.getService(ITaxonNodeService.class).load(entity.getUuid());
+ super.setEntity(entity);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.ui.section.classification;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author k.luther
+ * @date 22.03.2016
+ *
+ */
+public class TaxonNodeAgentRelationCollectionElement extends AbstractEntityCollectionElement<TaxonNodeAgentRelation> {
+
+
+
+
+ /**
+ * @param formFactory
+ * @param section
+ * @param entity
+ * @param removeListener
+ * @param backgroundColor
+ * @param style
+ */
+ public TaxonNodeAgentRelationCollectionElement(CdmFormFactory formFactory, AbstractFormSection section,
+ TaxonNodeAgentRelation entity, SelectionListener removeListener, Color backgroundColor, int style) {
+ super(formFactory, section, entity, removeListener, backgroundColor, style);
+
+ // TODO Auto-generated constructor stub
+ }
+
+
+
+
+ private EntitySelectionElement<TeamOrPersonBase> selection_toPerson;
+ private TermComboElement<DefinedTerm> combo_relationshipType;
+ private LabelElement label;
+
+
+
+
+
+
+
+ @Override
+ public void setEntity(TaxonNodeAgentRelation entity) {
+
+ if(entity.getId()!=0){
+ combo_relationshipType.setSelection(entity.getType());
+ selection_toPerson.setEntity(entity.getAgent());
+ }
+ this.entity = entity;
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource==combo_relationshipType){
+
+ entity.setType(combo_relationshipType.getSelection());
+
+ }else if (eventSource == selection_toPerson){
+ entity.setAgent(selection_toPerson.getEntity());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, int)
+ */
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.TaxonNodeAgentRelationType, element, "Taxonnode Agent Relationtype", null, style);
+ if (entity != null){
+ selection_toPerson = formFactory
+ .createSelectionElement(TeamOrPersonBase.class,
+ getConversationHolder(), element, "Agent", entity.getAgent(),
+ EntitySelectionElement.ALL, style);
+ } else{
+ selection_toPerson = formFactory
+ .createSelectionElement(TeamOrPersonBase.class,
+ getConversationHolder(), element, "Agent", null,
+ EntitySelectionElement.ALL, style);
+ }
+ label = formFactory.createLabel(element, null);
+
+ }
+
+ public boolean isComplete(){
+ if (selection_toPerson.getSelection()!= null && combo_relationshipType.getSelection() != null){
+ return true;
+ }
+ return false;
+
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* 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.ui.section.classification;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author k.luther
+ * @date 22.03.2016
+ *
+ */
+public class TaxonNodeAgentRelationCollectionSection extends AbstractEntityCollectionSection<TaxonNode, TaxonNodeAgentRelation> {
+
+
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+
+ * @param style
+ */
+ public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, conversation, parentElement, "TaxonNode Agent Relation", style);
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+ */
+ @Override
+ public String getEmptyString() {
+ return "No taxon node agent relations yet.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+ */
+ @Override
+ protected String getTooltipString() {
+ return "Add a new agent relation to this taxon node.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+ */
+ @Override
+ public Collection<TaxonNodeAgentRelation> getCollection(TaxonNode entity) {
+ //why Do I have to give the method an entity???
+ Collection<TaxonNodeAgentRelation> allAgentRelationships = getEntity().getAgentRelations();
+ return allAgentRelationships;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
+ */
+ @Override
+ public void addElement(TaxonNodeAgentRelation element) {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
+ */
+ @Override
+ public void removeElement(TaxonNodeAgentRelation element) {
+ getEntity().removeNodeAgent(element);
+ // CdmStore.getService(ITaxonNodeService.class).deleteAgentrelation(element);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+ */
+ @Override
+ public TaxonNodeAgentRelation createNewElement() {
+ TaxonNodeAgentRelation rel = getEntity().addAgentRelation(null, null);
+ return rel;
+ }
+
+ public boolean isComplete(){
+
+ return false;
+ }
+
+}
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
/**
- * <p>
- * TaxonNodeDetailElement class.
- * </p>
*
* @author n.hoffmann
* @created Sep 27, 2010
*/
public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeNode> {
+ private boolean createNew = false;
+
private EntitySelectionElement<Classification> selection_classification;
private Classification classification;
private TextWithLabelElement textNewTaxonName;
+ private TaxonNodeAgentRelationCollectionSection selectionNodeAgentRelation;
+
+
private CheckboxElement checkbox_openInEditor;
private boolean openInEditor;
private EntitySelectionElement<TaxonNameBase> selection_reuseExistingName;
- /**
- * <p>
- * Constructor for TaxonNodeDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- */
public TaxonNodeDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement) {
+ ICdmFormElement formElement, boolean isCreateNew) {
super(formFactory, formElement);
+ createNew = isCreateNew;
}
/** {@inheritDoc} */
selection_parentTaxonNode = formFactory
.createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
EntitySelectionElement.DELETABLE, style);
- selection_SecRef = formFactory
- .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", null,
- EntitySelectionElement.DELETABLE, style);
+
selection_reuseExistingTaxon = formFactory
.createSelectionElement(Taxon.class,
getConversationHolder(), formElement,
getConversationHolder(), formElement,
"Reuse existing name", null,
EntitySelectionElement.DELETABLE, style);
+ selection_SecRef = formFactory
+ .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", null,
+ EntitySelectionElement.DELETABLE, style);
+ if (isCreateNew()){
+ textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"New Taxon", "", style);
+ textNewTaxonName.setFocus();
+ } else{
+ textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"Taxon", "", style);
- textNewTaxonName = formFactory.createTextWithLabelElement(formElement,
- "New Taxon", "", style);
- textNewTaxonName.setFocus();
- preFillParentTaxonName();
+ }
+
+ if (isCreateNew()){
+ setParentTreeNode(entity);
+
+ } else{
+ setTreeNode(entity);
+ complete = true;
+ }
+ if (!isCreateNew()){
+ selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), style);
+ selectionNodeAgentRelation.setEntity((TaxonNode)entity);
+ selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ }
+ preFillTaxonName();
checkbox_openInEditor = formFactory.createCheckbox(formElement,
"Open in Editor", true, style);
setOpenInEditor(true);
- setParentTreeNode(entity);
+
}
- private void preFillParentTaxonName() {
- if(getEntity() instanceof TaxonNode){
+ private void preFillTaxonName() {
+ if(getEntity() instanceof TaxonNode ){
TaxonNode node = (TaxonNode)getEntity();
if(node.getTaxon()!=null){
Taxon taxon = HibernateProxyHelper.deproxy(node.getTaxon(), Taxon.class);
if(taxon.getName()!=null && taxon.getName().isInstanceOf(NonViralName.class)){
NonViralName<?> name = HibernateProxyHelper.deproxy(node.getTaxon().getName(), NonViralName.class);
- if( ! name.isSupraGeneric() && name.getRank() != null){
+ if (!isCreateNew()){
+ textNewTaxonName.setText(name.getNameCache());
+ } else if( ! name.isSupraGeneric() && name.getRank() != null){
String taxonName = "";
if(name.isGenus() || name.isInfraGeneric()|| name.isSpeciesAggregate() ){
taxonName = name.getGenusOrUninomial();
}
}
}
+
}
+
}
+
}
}
} else if (eventSource == selection_reuseExistingTaxon) {
boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
selection_reuseExistingName.setEnabled(enabled);
- textNewTaxonName.setEnabled(enabled);
if (!enabled){
- setTaxon(selection_reuseExistingTaxon.getEntity());
+ setTaxon(selection_reuseExistingTaxon.getEntity());
+ }
+ if (isCreateNew()){
+ textNewTaxonName.setEnabled(enabled);
+ if (!enabled){
+ setTaxon(selection_reuseExistingTaxon.getEntity());
+ } else{
+ textNewTaxonName.setText(null);
+ }
+
+ complete = !textNewTaxonName.getText().isEmpty();
}
- complete = !textNewTaxonName.getText().isEmpty();
-
} else if (eventSource == selection_reuseExistingName) {
- boolean enabled = selection_reuseExistingName.getEntity() == null;
+ boolean enabled = selection_reuseExistingName.getEntity() == null;
+ setTaxon(selection_reuseExistingName.getEntity());
selection_reuseExistingTaxon.setEnabled(enabled);
textNewTaxonName.setEnabled(enabled);
setTaxon(selection_reuseExistingName.getEntity());
+
complete = !textNewTaxonName.getText().isEmpty();
} else if (eventSource == textNewTaxonName) {
boolean enabled = CdmUtils.isBlank(textNewTaxonName.getText());
complete = !textNewTaxonName.getText().isEmpty();
} else if (eventSource == checkbox_openInEditor) {
setOpenInEditor(checkbox_openInEditor.getSelection());
+ } else if (eventSource == selectionNodeAgentRelation){
+ boolean allComplete = true;
+ for (ICdmFormElement element : selectionNodeAgentRelation.getElements()){
+ allComplete &=((TaxonNodeAgentRelationCollectionElement)element).isComplete();
+ }
+
+ complete = !isCreateNew() && allComplete;
}
}
- /**
- * <p>
- * Getter for the field <code>classification</code>.
- * </p>
- *
- * @return the classification
- */
public Classification getClassification() {
return classification;
}
return openInEditor;
}
- /**
- * <p>
- * Getter for the field <code>parentTreeNode</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
- */
public ITaxonTreeNode getParentTreeNode() {
return parentTreeNode;
}
- /**
- * <p>
- * Getter for the field <code>taxon</code>.
- * </p>
- *
- * @return the taxon
- */
public Taxon getTaxon() {
return taxon;
}
selection_classification.setEntity(classification);
selection_parentTaxonNode.setEntity(null);
selection_parentTaxonNode.setClassification(classification);
+ selection_SecRef.setEntity(classification.getReference());
} else if (parentTreeNode instanceof TaxonNode) {
- classification = (Classification) HibernateProxyHelper
+ classification = HibernateProxyHelper
.deproxy(((TaxonNode) parentTreeNode).getClassification());
selection_classification.setEntity(classification);
selection_parentTaxonNode.setEntity((TaxonNode) parentTreeNode);
selection_parentTaxonNode.setClassification(classification);
+ selection_SecRef.setEntity(((TaxonNode)parentTreeNode).getTaxon().getSec());
} else if(parentTreeNode == null){
this.parentTreeNode = selection_classification.getEntity();
}
}
+ private void setTreeNode(ITaxonTreeNode treeNode) {
+ classification = HibernateProxyHelper
+ .deproxy(((TaxonNode) treeNode).getClassification());
+ selection_classification.setEntity(classification);
+ selection_parentTaxonNode.setEntity(((TaxonNode) treeNode).getParent());
+ selection_parentTaxonNode.setClassification(((TaxonNode) treeNode).getParent().getClassification());
+ selection_SecRef.setEntity(((TaxonNode)treeNode).getTaxon().getSec());
+ }
+
private void setSecReference(Reference secRef){
this.secReference = secRef;
setTaxon(textNewTaxonName.getText());
private void setTaxon(Taxon taxon) {
this.taxon = taxon;
- textNewTaxonName.setText(taxon.getName().getTitleCache());
- this.secReference = taxon.getSec();
+ if (isCreateNew()){
+ textNewTaxonName.setText(taxon.getName().getTitleCache());
+ }
+ selection_SecRef.setEntity(taxon.getSec());
}
private void setTaxon(String taxonNameString) {
private void setTaxon(TaxonNameBase taxonName) {
Reference secundum = null;
if (getParentTreeNode() != null) {
- if (this.secReference != null){
- secundum = this.secReference;
- } else if (getParentTreeNode() instanceof Classification) {
+ if (this.selection_SecRef.getEntity() != null){
+ secundum = this.selection_SecRef.getEntity();
+ } /*else if (getParentTreeNode() instanceof Classification) {
secundum = ((Classification) getParentTreeNode())
.getReference();
} else if (getParentTreeNode() instanceof TaxonNode) {
secundum = ((TaxonNode) getParentTreeNode()).getTaxon()
.getSec();
- }
+ }*/
+ }
+ if (taxonName != null){
+ taxon = Taxon.NewInstance(taxonName, secundum);
+ if (!taxonName.getTitleCache().trim().equals(textNewTaxonName.getText().trim())){
+ textNewTaxonName.setText(taxonName.getTitleCache());
+ }
+ } else {
+ textNewTaxonName.setText(null);
}
- taxon = Taxon.NewInstance(taxonName, secundum);
}
private void setOpenInEditor(boolean openInEditor) {
}
public boolean isComplete() {
+ boolean allComplete = true;
+ if (!isCreateNew()){
+ for (ICdmFormElement element : selectionNodeAgentRelation.getElements()){
+ allComplete &=((TaxonNodeAgentRelationCollectionElement)element).isComplete();
+ }
+ complete = allComplete;
+ }
+
+
return complete;
}
+ /**
+ * @return the createNew
+ */
+ public boolean isCreateNew() {
+ return createNew;
+ }
+
}
@Override
protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection<TaxonNode> parentElement, int style) {
//FIXME generic
- return formFactory.createTaxonNodeDetailElement(parentElement);
+ return formFactory.createTaxonNodeDetailElement(parentElement, false);
}
}
public class TaxonNodeWizardPage extends AbstractCdmEntityWizardPage<ITaxonTreeNode> implements Listener{
private final IWizardPageListener wizardPageListener;
+ private final boolean isCreateNew;
/**
* <p>
* @param closeOnEnterListener
*/
public TaxonNodeWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, ITaxonTreeNode entity, IWizardPageListener closeOnEnterListener) {
+ ConversationHolder conversation, ITaxonTreeNode entity, IWizardPageListener closeOnEnterListener, boolean isCreateNew) {
super(formFactory, conversation, entity);
this.wizardPageListener = closeOnEnterListener;
- setTitle("Create a new Taxon");
+ setTitle("TaxonNode");
+ this.isCreateNew = isCreateNew;
+
}
/*
/** {@inheritDoc} */
@Override
public TaxonNodeDetailElement createElement(ICdmFormElement rootElement) {
- TaxonNodeDetailElement detailElement = formFactory.createTaxonNodeDetailElement(rootElement);
+ TaxonNodeDetailElement detailElement = formFactory.createTaxonNodeDetailElement(rootElement, this.isCreateNew);
detailElement.setEntity(entity);
formFactory.addPropertyChangeListener(this);
- detailElement.getTextNewTaxonName().getMainControl().addListener(SWT.KeyDown, this);
+ if (isCreateNew){
+ detailElement.getTextNewTaxonName().getMainControl().addListener(SWT.KeyDown, this);
+ }
return detailElement;
}
/** {@inheritDoc} */
@Override
public void propertyChange(PropertyChangeEvent event) {
- if (event.getSource() == getDetailElement()) {
- checkComplete();
- }
+ checkComplete();
}
@Override
if (detailElement.getClassification() == null) {
setMessage("No classification set.", WARNING);
}
- else if(detailElement.getTextNewTaxonName().getText().isEmpty()){
- setMessage("No taxon name set.", ERROR);
+ else if(isCreateNew ){
+ if(detailElement.getTextNewTaxonName().getText().isEmpty()){
+ setMessage("No taxon name set.", ERROR);
+ } else{
+ setMessage(null);
+ setPageComplete(true);
+ return;
+ }
}
else if(!detailElement.isComplete()){
setMessage("Not all required fields are filled.", ERROR);
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
@Override
protected Control createToolbar() {
- if(! hasSpecificElement()){
- return null;
- }
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- final String destinationString = (getEntity() instanceof TextData) ? "the specific element" : "free text";
+ final String destinationString = (getEntity().isInstanceOf(TextData.class)) ? "the specific element" : "free text";
final String label = "Change to " + destinationString;
@Override
protected void setSectionTitle() {
this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));
- setTextClient(createToolbar());
+
+ if(IsMoreThanOneTypeSupported()){
+ setTextClient(createToolbar());
+ }
}
- private boolean hasSpecificElement(){
- return getEntity().getFeature().isSupportsCategoricalData()
- || getEntity().getFeature().isSupportsCommonTaxonName()
- || getEntity().getFeature().isSupportsDistribution()
- || getEntity().getFeature().isSupportsIndividualAssociation()
- || getEntity().getFeature().isSupportsQuantitativeData()
- || getEntity().getFeature().isSupportsTaxonInteraction();
+ private boolean IsMoreThanOneTypeSupported(){
+ int count = 0;
+ Feature feature = getEntity().getFeature();
+ if(feature.isSupportsCategoricalData()){count++;}
+ if(feature.isSupportsCommonTaxonName()){count++;}
+ if(feature.isSupportsDistribution()){count++;}
+ if(feature.isSupportsIndividualAssociation()){count++;}
+ if(feature.isSupportsQuantitativeData()){count++;}
+ if(feature.isSupportsTaxonInteraction()){count++;}
+ if(feature.isSupportsTextData()){count++;}
+ return count > 1;
}
/* (non-Javadoc)
// $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.
*/
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * DescriptionElementSourceElement class.
- * </p>
- *
+ *
* @author n.hoffmann
* @created Nov 16, 2009
* @version 1.0
- * @param <T>
*/
public class DescriptionElementSourceElement extends
AbstractOriginalSourceElement<DescriptionElementSource> implements
private EntitySelectionElement<TaxonNameBase> selection_name;
- /**
- * <p>
- * Constructor for DescriptionElementSourceElement.
- * </p>
- *
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param element
- * a
- * {@link eu.etaxonomy.cdm.model.common.DescriptionElementSource}
- * object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- * @param cdmFormFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- */
public DescriptionElementSourceElement(CdmFormFactory cdmFormFactory,
AbstractFormSection formElement, DescriptionElementSource element,
SelectionListener removeListener, int style) {
formFactory.createSelectionArbitrator(this);
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.forms.entitysections.OriginalSourceComposite#
- * createControls(org.eclipse.swt.widgets.Composite, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
null, EntitySelectionElement.ALL, SWT.NULL);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractOriginalSourceElement
- * #setElement(eu.etaxonomy.cdm.model.common.OriginalSourceBase)
- */
/** {@inheritDoc} */
@Override
public void setEntity(DescriptionElementSource entity) {
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
- * (java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
} else if (eventSource == selection_name) {
getEntity().setNameUsedInSource(selection_name.getSelection());
}
+ else if(eventSource == combo_origsourcetype){
+ getEntity().setType(combo_origsourcetype.getSelection());
+ }
+
}
}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.section.description;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * <p>DescriptionElementSourceSection class.</p>
+ * <p>
+ * DescriptionElementSourceSection class.
+ * </p>
*
* @author n.hoffmann
* @created Nov 17, 2009
* @version 1.0
*/
-public class DescriptionElementSourceSection extends AbstractEntityCollectionSection<DescriptionElementBase, DescriptionElementSource>{
+public class DescriptionElementSourceSection extends
+ AbstractEntityCollectionSection<DescriptionElementBase, DescriptionElementSource> {
+
+ /**
+ * <p>
+ * Constructor for DescriptionElementSourceSection.
+ * </p>
+ *
+ * @param parentElement
+ * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+ * object.
+ * @param style
+ * a int.
+ * @param cdmFormFactory
+ * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+ * object.
+ * @param conversation
+ * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+ * object.
+ */
+ public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, conversation, parentElement, "References", style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public DescriptionElementSource createNewElement() {
+ return DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Collection<DescriptionElementSource> getCollection(DescriptionElementBase entity) {
+ List<DescriptionElementSource> sources = new ArrayList<DescriptionElementSource>(entity.getSources());
+ Collections.sort(sources, new Comparator<DescriptionElementSource>() {
+
+ @Override
+ public int compare(DescriptionElementSource o1, DescriptionElementSource o2) {
+ int id1 = o1.getId();
+ int id2 = o2.getId();
+ OriginalSourceType type1 = o1.getType();
+ OriginalSourceType type2 = o2.getType();
+ Reference citation1 = o1.getCitation();
+ Reference citation2 = o2.getCitation();
- /**
- * <p>Constructor for DescriptionElementSourceSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style){
- super(cdmFormFactory, conversation, parentElement, "References", style);
- }
+ // the newly created should always be on top
+ if (id1 == 0 && id2!=0) {
+ return -1;
+ }
+ if (id1 != 0 && id2==0) {
+ return 1;
+ }
- /** {@inheritDoc} */
- @Override
- public DescriptionElementSource createNewElement() {
- return DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
- }
+ // sort by type (Primary taxonomic > Primary Media > others
+ // alphabetically by reference title cache)
+ if (type1 != null && type1.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ && type2 != null && !type2.equals(OriginalSourceType.PrimaryTaxonomicSource)) {
+ return -1;
+ }
+ if (type1 != null && !type1.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ && type2 != null && type2.equals(OriginalSourceType.PrimaryTaxonomicSource)) {
+ return 1;
+ }
+ if (type1 != null && type1.equals(OriginalSourceType.PrimaryMediaSource)
+ && type2!=null && !type2.equals(OriginalSourceType.PrimaryTaxonomicSource)) {
+ return -1;
+ }
+ if (type2 != null && type2.equals(OriginalSourceType.PrimaryMediaSource)
+ && type1!=null && !type1.equals(OriginalSourceType.PrimaryTaxonomicSource)) {
+ return 1;
+ }
- /** {@inheritDoc} */
- @Override
- public Collection<DescriptionElementSource> getCollection(
- DescriptionElementBase entity) {
- return entity.getSources();
- }
+ //sort by citation title cache
+ if(citation1!=null && citation2!=null){
+ return citation1.getTitleCache().compareTo(citation2.getTitleCache());
+ }
+ return o2.getCreated().compareTo(o1.getCreated());
+ }
+ });
+ return sources;
+ }
- /** {@inheritDoc} */
- @Override
- public String getEmptyString() {
- return "No references yet.";
- }
+ /** {@inheritDoc} */
+ @Override
+ public String getEmptyString() {
+ return "No references yet.";
+ }
- /** {@inheritDoc} */
- @Override
- protected String getTooltipString() {
- return "Create a new reference";
- }
+ /** {@inheritDoc} */
+ @Override
+ protected String getTooltipString() {
+ return "Create a new reference";
+ }
- /** {@inheritDoc} */
- @Override
- public void addElement(DescriptionElementSource element) {
- getEntity().addSource(element);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void addElement(DescriptionElementSource element) {
+ getEntity().addSource(element);
+ }
- /** {@inheritDoc} */
- @Override
- public void removeElement(DescriptionElementSource element) {
- getEntity().removeSource(element);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void removeElement(DescriptionElementSource element) {
+ getEntity().removeSource(element);
+ }
}
// $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.
*/
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * IndividualsAssociationDetailElement class.
- * </p>
- *
* @author n.hoffmann
* @created Jun 10, 2010
* @version 1.0
AbstractDetailedDescriptionDetailElement<IndividualsAssociation> {
private TextWithLabelElement text_description;
- private EntitySelectionElement<DerivedUnit> selection_derivedUnit;
+ private EntitySelectionElement<SpecimenOrObservationBase> selection_derivedUnit;
- /**
- * <p>
- * Constructor for IndividualsAssociationDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param entity
- * a
- * {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation}
- * object.
- * @param style
- * a int.
- */
public IndividualsAssociationDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, IndividualsAssociation entity,
int style) {
protected void createControls(ICdmFormElement formElement,
IndividualsAssociation entity, int style) {
selection_derivedUnit = formFactory
- .createSelectionElement(DerivedUnit.class,
- getConversationHolder(), formElement, "Unit",
- CdmBase.deproxy(entity.getAssociatedSpecimenOrObservation(),DerivedUnit.class),
+ .createSelectionElement(SpecimenOrObservationBase.class,
+ getConversationHolder(), formElement, "Occurrence/Unit",
+ CdmBase.deproxy(entity.getAssociatedSpecimenOrObservation(),SpecimenOrObservationBase.class),
EntitySelectionElement.ALL, style);
text_description = formFactory.createMultiLineTextWithLabel(
import org.eclipse.core.runtime.IAdaptable;
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 org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
destinationElement = TextData.NewInstance();
}
}
-
+ if(destinationElement==null){
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Change not possible", "Feature does not have another type");
+ return Status.CANCEL_STATUS;
+ }
destinationElement.setFeature(feature);
inDescription.addElement(destinationElement);
inDescription.removeElement(sourceElement);
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
+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;
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);
// FIXME due to a bug in the rest map service we have to ensure that width will always be an even number
// image.calculateWidth() % 2 == 1 ? image.calculateWidth() + 1 :
int width = image.calculateWidth();
-
+ IEditGeoService editGeoService;
List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
+ }else{
+ editGeoService =(IEditGeoService) CdmStore.getCurrentApplicationConfiguration().getBean(
+ "editGeoService");
+ }
- String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(
+ String parameter = editGeoService.getDistributionServiceRequestParameterString(
getTaxonDescriptions(),
- false,
- false,
-
+ false,
+ false,
null,
- presenceAbsenceTermColors,
+ presenceAbsenceTermColors,
languages);
String mapUriString = String.format("%s?%s&ms=1000&bbox=-180,-90,180,90&l=earth", accessPoint, parameter);
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;
+ }
+
}
public void removeElement(Identifier element) {
getEntity().removeIdentifier(getEntity().getIdentifiers().get(0));
getConversationHolder().commit();
- System.out.println();
}
/* (non-Javadoc)
*/
package eu.etaxonomy.taxeditor.ui.section.key;
+import org.eclipse.swt.SWT;
+
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopePolyKeyDetailSection;
/**
* @author n.hoffmann
private TextWithLabelElement textLabel;
private NumberWithLabelElement numberStartNumber;
+ private TaxonomicScopeSection sectionTaxonomicScope;
+ private GeoScopePolyKeyDetailSection sectionGeoScopes;
+ private ScopeRestrictionSection sectionScopeRestriction;
public PolytomousKeyDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
protected void createControls(ICdmFormElement formElement,
PolytomousKey entity, int style) {
textLabel = formFactory.createTextWithLabelElement(formElement, "Title", entity.getTitleCache(), style);
- numberStartNumber = formFactory.createNumberTextWithLabelElement(formElement, "Start Number", entity.getStartNumber(), style);
+
+ numberStartNumber = formFactory.createNumberTextWithLabelElement(formElement, "Start Number", entity.getStartNumber(), style);
+
+ sectionTaxonomicScope = formFactory.createTaxonomicScopeSection(getConversationHolder(), formElement, style);
+ sectionTaxonomicScope.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionTaxonomicScope.setEntity(entity);
+
+ sectionGeoScopes = formFactory.createGeoScopePolyKeyDetailSection(getConversationHolder(), formElement, SWT.NULL);
+ sectionGeoScopes.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionGeoScopes.setEntity(entity);
+
+ sectionScopeRestriction = formFactory.createScopeRestrictionSection(getConversationHolder(), formElement, SWT.NULL);
+ sectionScopeRestriction.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionScopeRestriction.setEntity(entity);
}
public String getText() {
return textLabel.getText();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==textLabel){
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.section.key;
/**
* @author n.hoffmann
- *
+ *
*/
public class PolytomousKeyNodeDetailElement extends
AbstractCdmDetailElement<PolytomousKeyNode> {
/*
* (non-Javadoc)
- *
+ *
* @see
* eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
* .lang.Object)
@Override
public void handleEvent(Object eventSource) {
if (eventSource == element_question) {
- getEntity().getParent().setQuestion(
- element_question.getKeyStatement());
+ getEntity().getParent().setQuestion(element_question.updateKeyStatement(getEntity().getQuestion()));
} else if (eventSource == element_statement) {
- getEntity().setStatement(element_statement.getKeyStatement());
+ getEntity().setStatement(element_statement.updateKeyStatement(getEntity().getStatement()));
} else if (eventSource == selection_feature) {
getEntity().getParent().setFeature(selection_feature.getEntity());
} else if (eventSource == selection_taxon) {
import eu.etaxonomy.cdm.common.media.ImageInfo;
import eu.etaxonomy.cdm.model.media.ImageFile;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
private KeyValueViewerElement element_keyValue;
private ImageElement element_image;
-
- private final Runnable postRunnable = new Runnable(){
- @Override
- public void run() {
- AbstractUtility.reflowDetailsViewer();
- AbstractUtility.reflowSupplementalViewer();
- }
- };
-
-
public ImageFileElement(CdmFormFactory cdmFormFactory,
AbstractFormSection section, ImageFile element,
SelectionListener removeListener, int style) {
private void loadImage(URI uri, boolean updateDimensions) throws IOException, HttpException{
element_image.initImageUri(uri);
- element_image.loadImage(postRunnable );
+ element_image.loadImage();
if(uri == null){
public void handleEvent(Object eventSource) {
if(eventSource == text_uri){
try {
- URI uri = text_uri.getUri();
+ URI uri = text_uri.parseText();
getEntity().setUri(uri);
if(uri==null){
//buffer URI if parsing error occurred
}
protected void handleException(Exception e) {
- element_image.unloadImage(postRunnable);
+ element_image.unloadImage();
text_height.setNumber(0);
text_width.setNumber(0);
+ text_size.setNumber(0);
- element_image.loadImage(new Runnable(){
- @Override
- public void run() {
- AbstractUtility.reflowDetailsViewer();
- AbstractUtility.reflowSupplementalViewer();
- }
- });
+ element_image.loadImage();
}
}
import java.util.List;
import java.util.Set;
+import org.apache.sanselan.ImageReadException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.common.UriUtils;
+import eu.etaxonomy.cdm.common.media.ImageInfo;
+import eu.etaxonomy.cdm.model.media.ImageFile;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ImageElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
* Used to store the URI even if it is invalid and thus cannot be stored in CDM
*/
private String uriBuffer;
+ private ImageElement element_image;
+ private Label lblNoImage;
public MediaDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
public void handleEvent(Object eventSource){
if(eventSource==textUri){
textUri.setBackground(getPersistentBackground());
- URI uri = textUri.getUri();
+ URI uri = textUri.parseText();
singleMediaRepresentationPart.setUri(uri);
if(uri==null){
uriBuffer=textUri.getText();
}
+ else{
+ createImageElement(uri);
+ }
+ }
+ }
+
+ private void createImageElement(URI uri) {
+ ImageInfo imageInfo;
+ try {
+ if(uri == null){
+ return;
+ }
+ //first check if uri refers to an actual (non-image) file
+ UriUtils.getInputStream(uri);// will fail with a FileNotFoundException if not
+ imageInfo = ImageInfo.NewInstance(uri, 10000);//will fail when it is no image file
+ singleMediaRepresentationPart.setSize((int) imageInfo.getLength());
+ if(singleMediaRepresentationPart instanceof ImageFile){
+ ((ImageFile) singleMediaRepresentationPart).setHeight(imageInfo.getHeight());
+ ((ImageFile) singleMediaRepresentationPart).setWidth(imageInfo.getWidth());
+ }
+ singleMediaRepresentationPart.getMediaRepresentation().setMimeType(imageInfo.getMimeType());
+ singleMediaRepresentationPart.getMediaRepresentation().setSuffix(imageInfo.getSuffix());
+ element_image = formFactory.createImageElement(parentFormElement, uri, style);
+ element_image.initImageUri(uri);
+ element_image.loadImage();
+ disposeErrorLabel();
+ } catch (Exception e){
+ if(e.getCause()!=null && e.getCause().getClass().equals(ImageReadException.class)){
+ disposeErrorLabel();
+ handleException(uri, "No preview available for this file type");
+ }
+ else{
+ disposeErrorLabel();
+ handleException(uri, "No file found");
+ }
}
}
+ private void disposeErrorLabel() {
+ if(lblNoImage!=null){
+ lblNoImage.dispose();
+ }
+ lblNoImage = null;
+ }
+
public void toggleAdvancedMediaView() {
if (getEntity().getRepresentations() != null
&& (getEntity().getRepresentations().size() > 1 ||
if(textUri!=null){
removeElementsAndControls(textUri);
}
+ if(element_image!=null){
+ element_image.dispose();
+ element_image = null;
+ }
section_mediaRepresentation = formFactory.createMediaRepresentationSection(getConversationHolder(), parentFormElement, style);
section_mediaRepresentation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_mediaRepresentation.setEntity(getEntity());
}
textUri = formFactory.createUriWithLabelElement(parentFormElement, "Media URI", null, style);
URI uri = singleMediaRepresentationPart.getUri();
- textUri.setUri(uri);
+ textUri.setParsedText(uri);
//set buffered uri as text if uri had parsing problems in advanced view
if(uri==null && uriBuffer!=null){
textUri.setText(uriBuffer);
- textUri.getUri();
+ textUri.parseText();
}
textUri.getLayoutComposite().layout();
+
+ createImageElement(singleMediaRepresentationPart.getUri());
}
}
isAdvancedMediaView = false;
}
+ private void handleException(URI uri, String labelText) {
+ if(element_image!=null){
+ element_image.unloadImage();
+ element_image.loadImage();
+ element_image.dispose();
+ }
+ if(lblNoImage==null){
+ lblNoImage = formFactory.createLabel(getLayoutComposite(), labelText);
+ lblNoImage.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ lblNoImage.setAlignment(SWT.CENTER);
+ }
+ }
+
public boolean isAdvancedMediaView() {
return isAdvancedMediaView;
}
*/
package eu.etaxonomy.taxeditor.ui.section.media;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
* @created Nov 17, 2009
* @version 1.0
*/
-public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ITogglableMediaElement{
+public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ISelectableElement, ITogglableMediaElement{
private EntitySelectionElement<AgentBase> selection_artist;
private LanguageStringWithLabelElement text_description;
private LanguageStringWithLabelElement text_title;
private MediaDetailElement mediaDetailElement;
+ private SelectionArbitrator selectionArbitrator;
public MediaMetaElement(CdmFormFactory cdmFormFactory,
AbstractFormSection<?> formElement, Media element,
SelectionListener removeListener, boolean isChoosableEntity, int style) {
super(cdmFormFactory, formElement, element, removeListener, isChoosableEntity, null, style);
+ //make element selectable
+ if(cdmFormFactory.getSelectionProvider() != null){
+ selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
+ }
+
+
}
/** {@inheritDoc} */
});
text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
+ addElement(selection_artist);
text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
mediaDetailElement = formFactory.createMediaDetailElement(element);
+ addElement(mediaDetailElement);
}
/** {@inheritDoc} */
LanguageString title = element.getTitle(CdmStore.getDefaultLanguage());
if (title == null) {
- title = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
+ title = LanguageString.NewInstance(element.getTitleCache(), CdmStore.getDefaultLanguage());
}
text_title.setLanguageString(title);
+
}
@Override
protected Media selectFromDialog() {
- return MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
+
+ setEntity(MediaSelectionDialog.select(AbstractUtility.getShell(), null, null));
+ return entity;
}
@Override
}
/** {@inheritDoc} */
- @Override
+ @Override
public void handleEvent(Object eventSource) {
if (eventSource == selection_artist) {
getEntity().setArtist(selection_artist.getSelection());
}
}
+ @Override
+ public SelectionArbitrator getSelectionArbitrator() {
+ return selectionArbitrator;
+ }
+
}
text_size.setText(FileUtils.byteCountToDisplaySize(entity.getSize()));
}
if(entity.getUri() != null){
- text_uri.setUri(entity.getUri());
+ text_uri.setParsedText(entity.getUri());
} else {
String uriBuffer = getParentMediaDetailElement().getUriBuffer();
if(uriBuffer!=null){
text_uri.setText(uriBuffer);
- text_uri.getUri();//just to update the error label
+ text_uri.parseText();//just to update the error label
}
}
}
@Override
public void handleEvent(Object eventSource) {
if(eventSource == text_uri){
- URI uri = text_uri.getUri();
+ URI uri = text_uri.parseText();
getEntity().setUri(uri);
if(uri==null){
//buffer URI if parsing error occurred
public NameDetailElement(CdmFormFactory cdmFormFactory, ICdmFormElement formElement,
int style) {
super(cdmFormFactory, formElement);
- // register as selection listener
+ // make this element selectable
if(cdmFormFactory.getSelectionProvider() != null){
selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
}
toggleable_cache.setText(getEntity().getNameCache());
}
}
+
+ @Override
+ protected void handleToggleableCacheField() {
+ boolean pushedState = toggleable_cache.getState();
+
+ getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
+ setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_appendedPhrase, checkbox_anamorphic }));
+ updateToggleableCacheField();
+ }
+
+
}
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.ui.AbstractEntityCollectionElementWizardPage;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
* @created Jun 1, 2010
* @version 1.0
*/
-public class NameRelationshipWizardPage extends WizardPage implements
+public class NameRelationshipWizardPage extends AbstractEntityCollectionElementWizardPage implements
IPropertyChangeListener {
- private final CdmFormFactory formFactory;
-
private EntitySelectionElement<TaxonNameBase> selection_relatedTo;
private TermComboElement<NameRelationshipType> combo_relationshipType;
private TaxonNameBase toName;
- private RootElement rootElement;
-
/**
* <p>
* Constructor for NameRelationshipWizardPage.
/** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
- this.setPageComplete(false);
-
- Composite control = formFactory.createComposite(parent);
-
- control.setLayout(LayoutConstants.LAYOUT(2, false));
-
- rootElement = new RootElement(formFactory, control);
+ super.createControl(parent);
combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.NameRelationshipType,
rootElement, "Name Relationship Type", null, SWT.NULL);
"Related to", null, EntitySelectionElement.ALL,
SWT.NULL);
- setControl(control);
}
/**
setPageComplete(complete);
}
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- rootElement.removeElements();
- formFactory.removePropertyChangeListener(this);
- super.dispose();
- }
}
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * NameTypeDesignationElement class.
- * </p>
*
* @author n.hoffmann
* @created May 17, 2010
private EntitySelectionElement<TaxonNameBase> selection_typeName;
private TermComboElement<NameTypeDesignationStatus> combo_typeStatus;
- /**
- * <p>
- * Constructor for NameTypeDesignationElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.name.NameTypeDesignation}
- * object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- */
public NameTypeDesignationElement(CdmFormFactory formFactory,
AbstractFormSection section, NameTypeDesignation entity,
SelectionListener removeListener, int style) {
} else if (eventSource == text_referenceDetail) {
getEntity().setCitationMicroReference(
text_referenceDetail.getText());
- } else if (eventSource == text_originaleNameString) {
- getEntity().setOriginalNameString(
- text_originaleNameString.getText());
}
}
}
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
/**
- * <p>NomenclaturalStatusElement class.</p>
- *
* @author n.hoffmann
* @created Nov 5, 2009
* @version 1.0
private final SelectionArbitrator selectionArbitrator;
- /**
- * <p>Constructor for NomenclaturalStatusElement.</p>
- *
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a {@link eu.etaxonomy.cdm.model.name.NomenclaturalStatus} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- */
public NomenclaturalStatusElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement,
NomenclaturalStatus element, SelectionListener removeListener, int style) {
super(cdmFormFactory, formElement, element, removeListener, style);
selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
super.createControls(element, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void setEntity(NomenclaturalStatus entity) {
return selectionArbitrator;
}
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
else if(eventSource == text_referenceDetail){
getEntity().setCitationMicroReference(text_referenceDetail.getText());
}
- else if(eventSource == text_originaleNameString){
- getEntity().setOriginalNameString(text_originaleNameString.getText());
- }
}
}
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.LsidWithExceptionLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
private AuthorshipDetailSection section_author;
private EnumComboElement<NomenclaturalCode> combo_nomenclaturalCode;
private HybridDetailSection section_hybrid;
+ private LsidWithExceptionLabelElement textLsid;
public NonViralNameDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
toggleable_cache.setVisible(false);
combo_nomenclaturalCode.setVisible(false);
}
-
+ textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_name);
addControl(section_hybrid);
addElement(section_hybrid);
}
+
+
}
/** {@inheritDoc} */
section_name.setEntity(getEntity());
getLayoutComposite().layout();
}
+ else if(eventSource==textLsid){
+ getEntity().setLsid(textLsid.parseText());
+ }
}
+ @Override
+ protected void handleToggleableCacheField() {
+ boolean pushedState = toggleable_cache.getState();
+
+ getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
+ setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, textLsid }));
+ updateToggleableCacheField();
+ }
}
implements ITaxonBaseDetailSection {
private TaxonBase taxonBase;
+ boolean nameChoosable = false;
/**
* <p>Constructor for NonViralNameDetailSection.</p>
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+ * @param nameChoosable if <code>true</code> adds a button to choose the displayed name
* @param style a int.
*/
public NonViralNameDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
- ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style) {
super(formFactory, conversation, parentElement, selectionProvider, style);
+ this.nameChoosable = nameChoosable;
}
@Override
protected Control createToolbar() {
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
- //choose name
- Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
- @Override
- public void run() {
- TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), null);
- if(taxonName!=null){
- if(taxonName.isInstanceOf(NonViralName.class)){
- CdmStore.getService(ITaxonNodeService.class).list(TaxonNode.class, null, null, null, null);
- NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonName, NonViralName.class);
- taxonBase.setName(nonViralName);
- // taxonBase.getTitleCache();
- setEntity(nonViralName);
- firePropertyChangeEvent(NonViralNameDetailSection.this);
- }
- else{
- MessagingUtils.warningDialog("Invalid name", this, "The selected name can not be used for this taxon.");
- }
- }
- }
- };
- chooseNameAction.setToolTipText("Choose name for this taxon");
- chooseNameAction.setImageDescriptor(ImageResources.getImageDescriptor(ImageResources.BROWSE_ICON));
-
- toolBarManager.add(chooseNameAction);
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+
+ if(nameChoosable){
+ //choose name
+ Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
+ @Override
+ public void run() {
+ TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), null);
+ if(taxonName!=null){
+ if(taxonName.isInstanceOf(NonViralName.class)){
+ CdmStore.getService(ITaxonNodeService.class).list(TaxonNode.class, null, null, null, null);
+ NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonName, NonViralName.class);
+ taxonBase.setName(nonViralName);
+ // taxonBase.getTitleCache();
+ setEntity(nonViralName);
+ firePropertyChangeEvent(NonViralNameDetailSection.this);
+ }
+ else{
+ MessagingUtils.warningDialog("Invalid name", this, "The selected name can not be used for this taxon.");
+ }
+ }
+ }
+ };
+ chooseNameAction.setToolTipText("Choose name for this taxon");
+ chooseNameAction.setImageDescriptor(ImageResources.getImageDescriptor(ImageResources.BROWSE_ICON));
+
+ toolBarManager.add(chooseNameAction);
+ }
//clone
if(getEntity() != null && checkForMultipleNameUsages(getEntity())){
@Override
public void handleEvent(Object eventSource) {
if(eventSource == protologueUriText && protologueUriText.getText()!=null){
- mediaRepresentationPart.setUri(protologueUriText.getUri());
+ mediaRepresentationPart.setUri(protologueUriText.parseText());
}
}
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * SpecimenTypeDesignationElement class.
- * </p>
- *
* @author n.hoffmann
* @created May 17, 2010
* @version 1.0
private EntitySelectionElement<DerivedUnit> selection_typeSpecimen;
private TextWithLabelElement text_specimenTypeText;
- /**
- * <p>
- * Constructor for SpecimenTypeDesignationElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation}
- * object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- */
public SpecimenTypeDesignationElement(CdmFormFactory formFactory,
AbstractFormSection section, SpecimenTypeDesignation entity,
SelectionListener removeListener, int style) {
super.setEntity(entity);
selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
- SpecimenTypeDesignationStatus typeStatus = (SpecimenTypeDesignationStatus) HibernateProxyHelper
- .deproxy(entity.getTypeStatus());
+ SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
+ .deproxy(entity.getTypeStatus(), SpecimenTypeDesignationStatus.class);
combo_typeStatus.setSelection(typeStatus);
checkbox_notDesignated.setSelection(entity.isNotDesignated());
}
} else if (eventSource == text_referenceDetail) {
getEntity().setCitationMicroReference(
text_referenceDetail.getText());
- } else if (eventSource == text_originaleNameString) {
- getEntity().setOriginalNameString(
- text_originaleNameString.getText());
}
}
}
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.ui.AbstractEntityCollectionElementWizardPage;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
-import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
* @date 27.01.2014
*
*/
-public class SynonymRelationshipWizardPage extends WizardPage implements IPropertyChangeListener {
+public class SynonymRelationshipWizardPage extends AbstractEntityCollectionElementWizardPage implements IPropertyChangeListener {
- private final CdmFormFactory formFactory;
private EntitySelectionElement<Taxon> selection_relatedTo;
private Taxon taxon;
- private RootElement rootElement;
/**
* <p>
/** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
- this.setPageComplete(false);
-
- Composite control = formFactory.createComposite(parent);
-
- control.setLayout(LayoutConstants.LAYOUT(2, false));
-
- rootElement = new RootElement(formFactory, control);
+ super.createControl(parent);
combo_relationshipType = formFactory.createDefinedTermComboElement(TermType.SynonymRelationshipType,
rootElement, "Synonym Relationship Type", null, SWT.NULL);
checkboxPartial = formFactory.createCheckbox(rootElement, "Partial Synonym", null, SWT.NULL);
- setControl(control);
}
/**
setPageComplete(complete);
}
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- rootElement.removeElements();
- formFactory.removePropertyChangeListener(this);
- super.dispose();
- }
}
// $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.
*/
ICdmFormElement parentElement, int style) {
super(formFactory, conversation, parentElement, "Type Designations", style);
}
-
+
/** {@inheritDoc} */
@Override
public void addElement(TypeDesignationBase element) {
* @see eu.etaxonomy.taxeditor.section.ITaxonDetailSection#setTaxon(eu.etaxonomy.cdm.model.taxon.TaxonBase)
*/
/** {@inheritDoc} */
- public void setTaxonBase(TaxonBase entity) {
+ @Override
+ public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
NonViralName name = (NonViralName) HibernateProxyHelper.deproxy(entity.getName());
setEntity(name);
}
-
+
private boolean isSpecimenType(){
Rank rank = getEntity().getRank();
return rank.isSpecies() || rank.isInfraSpecific();
*/
public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public DerivedUnitBaseWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
@Override
protected void checkComplete() {
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
DerivedUnitBaseDetailElement detailElement = formFactory.createDerivedUnitBaseDetailElement(rootElement);
AbstractCdmDetailElement<DerivedUnitFacade> {
boolean showOnlyDerivedUnitData = false;
+ //TODO: flag to disable specimen type dropdown (#5244)
+ boolean showSpecimenType = true;
private ToggleableTextElement toggleableText_titleCache;
private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement,
DerivedUnitFacade entity, int style) {
else{
combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
combo_specorobstype.setSelection(entity.getType());
+ combo_specorobstype.setEnabled(showSpecimenType);
selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
formElement, "Country",
entity.getCountry(), EntitySelectionElement.NOTHING, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if (eventSource == toggleableText_titleCache) {
this.showOnlyDerivedUnitData = showOnlyDerivedUnitData;
}
+ public void setShowSpecimenType(boolean showSpecimenType) {
+ this.showSpecimenType = showSpecimenType;
+ }
+
}
*/
public class DerivedUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setTitle("General Specimen Data");
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
@Override
protected void checkComplete() {
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
DerivedUnitGeneralDetailElement detailElement = formFactory.createDerivedUnitGeneralDetailElement(rootElement);
+ detailElement.setShowSpecimenType(false);
detailElement.setEntity(getEntity());
checkComplete();
return detailElement;
getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
} else if (eventSource == selectionTaxonNameBase) {
getEntity().setTaxonName(selectionTaxonNameBase.getSelection());
+ //empty taxon field if name does not belong the taxon
+ TaxonBase taxonBase = selection_taxonBase.getEntity();
+ if(taxonBase!=null && taxonBase.getName()!=null
+ && !taxonBase.getName().equals(selectionTaxonNameBase.getSelection())){
+ selection_taxonBase.setEntity(null);
+ }
} else if (eventSource == selection_taxonBase) {
TaxonBase taxon = selection_taxonBase.getSelection();
getEntity().setTaxon(taxon);
} else if (eventSource == selection_country) {
getEntity().setCountry(selection_country.getSelection());
} else if (eventSource == languageText_locality) {
- LanguageString locality = languageText_locality.getLanguageString();
+ LanguageString locality = languageText_locality.updateLanguageString(getEntity().getLocality());
getEntity().setLocality(locality);
} else if (eventSource == element_point) {
getEntity().setExactLocation(element_point.getPoint());
*/
public class FieldUnitWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public FieldUnitWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
@Override
protected void checkComplete() {
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
FieldUnitDetailElement detailElement = formFactory.createFieldUnitDetailElement(rootElement);
*/
public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
public GatheringEventWizardPage(CdmFormFactory formFactory,
ConversationHolder conversation, DerivedUnitFacade entity) {
super(formFactory, conversation, entity);
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
@Override
protected void checkComplete() {
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
GatheringEventDetailElement detailElement = formFactory.createGatheringEventDetailElement(rootElement);
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.ui.section.occurrence;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ *
+ * @author pplitzner
+ * @date Sep 21, 2015
+ *
+ */
+public class GeoScopePolyKeyDetailSection extends AbstractEntityCollectionSection<PolytomousKey, NamedArea> {
+
+ public GeoScopePolyKeyDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement, int style) {
+ super(formFactory, conversation, parentElement, "Geo Scopes", style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Collection<NamedArea> getCollection(PolytomousKey entity) {
+ return entity.getGeographicalScope();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public NamedArea createNewElement() {
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
+
+ return selection;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addElement(NamedArea element) {
+ getEntity().addGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeElement(NamedArea element) {
+ getEntity().removeGeographicalScope(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getEmptyString() {
+ return "No geo scopes yet.";
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getTooltipString() {
+ return "Add a geo scope";
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.ui.section.occurrence.association;
+
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.name.AbstractTypeDesignationElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created May 17, 2010
+ * @version 1.0
+ */
+public class DerivedUnitTypeDesignationElement extends AbstractTypeDesignationElement<SpecimenTypeDesignation> {
+
+ private TermComboElement<SpecimenTypeDesignationStatus> combo_typeStatus;
+
+ private List<EntitySelectionElement<TaxonNameBase>> selectionTaxonNames;
+ private ICdmFormElement parentFormElement;
+ private int style;
+
+ private EntitySelectionElement<TaxonNameBase> selectionTaxonName;
+
+ public DerivedUnitTypeDesignationElement(CdmFormFactory formFactory,
+ AbstractFormSection section, SpecimenTypeDesignation entity,
+ SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, style);
+ }
+
+ @Override
+ public void setEntity(SpecimenTypeDesignation entity) {
+ super.setEntity(entity);
+ Set<TaxonNameBase> typifiedNames = entity.getTypifiedNames();
+ if(typifiedNames.size()==1){
+ selectionTaxonName.setEntity(typifiedNames.iterator().next());
+ }
+ else if(typifiedNames.size()>1){
+ formFactory.createLabel(getLayoutComposite(), "!!!!!!!!");
+ }
+
+ SpecimenTypeDesignationStatus typeStatus = (SpecimenTypeDesignationStatus) HibernateProxyHelper
+ .deproxy(entity.getTypeStatus());
+ combo_typeStatus.setSelection(typeStatus);
+ checkbox_notDesignated.setSelection(entity.isNotDesignated());
+
+// for (TaxonNameBase taxonNameBase : typifiedNames) {
+// EntitySelectionElement<TaxonNameBase> selectionElement = formFactory.createSelectionElement(
+// TaxonNameBase.class, getConversationHolder(), parentFormElement, "Scientific Name", null,
+// EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
+// selectionElement.setEntity(taxonNameBase);
+// }
+
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ this.parentFormElement = element;
+ this.style = style;
+
+ selectionTaxonName = formFactory.createSelectionElement(
+ TaxonNameBase.class, getConversationHolder(), parentFormElement, "Scientific Name", null,
+ EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
+
+ combo_typeStatus = formFactory.createDefinedTermComboElement(TermType.SpecimenTypeDesignationStatus,
+ parentFormElement, "Designation Status", null, style);
+
+ super.createControls(element, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == selectionTaxonName) {
+ selectionTaxonName.getSelection().addTypeDesignation(getEntity(), false);
+ } else if (eventSource == combo_typeStatus) {
+ getEntity().setTypeStatus(combo_typeStatus.getSelection());
+ } else if (eventSource == checkbox_notDesignated) {
+ getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
+ } else if (eventSource == selection_reference) {
+ getEntity().setCitation(selection_reference.getSelection());
+ } else if (eventSource == text_referenceDetail) {
+ getEntity().setCitationMicroReference(
+ text_referenceDetail.getText());
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.ui.section.occurrence.association;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author pplitzner
+ * @date Oct 29, 2015
+ *
+ */
+public class DerivedUnitTypeDesignationSection extends AbstractEntityCollectionSection<DerivedUnitFacade, SpecimenTypeDesignation> {
+
+ private Collection<SpecimenTypeDesignation> typeDesignations;
+
+ public DerivedUnitTypeDesignationSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement, int style) {
+ super(formFactory, conversation, parentElement, "Type Designations", style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Collection<SpecimenTypeDesignation> getCollection(DerivedUnitFacade entity) {
+ typeDesignations = entity.innerDerivedUnit().getSpecimenTypeDesignations();
+ return typeDesignations;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public SpecimenTypeDesignation createNewElement() {
+ return SpecimenTypeDesignation.NewInstance();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addElement(SpecimenTypeDesignation element) {
+ element.setTypeSpecimen(getEntity().innerDerivedUnit());
+ typeDesignations.add(element);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void removeElement(SpecimenTypeDesignation element) {
+ List<SpecimenTypeDesignation> toRemove = new ArrayList<SpecimenTypeDesignation>();
+ for (SpecimenTypeDesignation specimenTypeDesignation : typeDesignations) {
+ if(element.equals(specimenTypeDesignation)){
+ toRemove.add(specimenTypeDesignation);
+ }
+ }
+ for (SpecimenTypeDesignation specimenTypeDesignation : toRemove) {
+ specimenTypeDesignation.removeType();
+ Set<TaxonNameBase> names = specimenTypeDesignation.getTypifiedNames();
+ for (TaxonNameBase taxonNameBase : names) {
+ taxonNameBase.removeTypeDesignation(specimenTypeDesignation);
+ }
+ }
+ typeDesignations.removeAll(toRemove);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getEmptyString() {
+ return "No type designation yet.";
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected String getTooltipString() {
+ return "Add a type designation";
+ }
+
+
+}
\ No newline at end of file
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Set;
+import java.util.UUID;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> implements IDoubleClickListener{
-
- private TableViewer associationsViewer;
- private TableViewer typeDesignationViewer;
-
public TaxonAssociationDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
}
//TODO add context menu for deleting associations
- Label associationsLabel = formFactory.createLabel(getLayoutComposite(), "Individuals Associations");
- associationsLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-
- associationsViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
- associationsViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- associationsViewer.setContentProvider(new ArrayContentProvider());
- Collection<IndividualsAssociation> individualsAssociations = CdmStore.getService(IOccurrenceService.class).listIndividualsAssociations(entity.innerDerivedUnit(), null, null, null, null);
- //TODO implement service method for this which is just used in the label provider
- Collection<TaxonBase<?>> associatedTaxa = new HashSet<TaxonBase<?>>();
- for (IndividualsAssociation individualsAssociation : individualsAssociations) {
- if(individualsAssociation.getInDescription().isInstanceOf(TaxonDescription.class)){
- TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(individualsAssociation.getInDescription(), TaxonDescription.class);
- associatedTaxa.add(taxonDescription.getTaxon());
- }
- }
- associationsViewer.setInput(associatedTaxa);
- associationsViewer.addDoubleClickListener(this);
-
- Label typeLabel = formFactory.createLabel(getLayoutComposite(), "Type Designations");
- typeLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-
- typeDesignationViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
- typeDesignationViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- typeDesignationViewer.setContentProvider(new ArrayContentProvider());
+ Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listIndividualsAssociationTaxa(entity.innerDerivedUnit(), null, null, null, null);
Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
- //TODO implement service method for this which is just used in the label provider
- Collection<TaxonBase<?>> typedTaxa = new HashSet<TaxonBase<?>>();
- for (SpecimenTypeDesignation specimenTypeDesignation : typeDesignations) {
- for (TaxonNameBase taxonNameBase : specimenTypeDesignation.getTypifiedNames()) {
- Set taxa = taxonNameBase.getTaxa();
- for (Object taxon : taxa) {
- if(taxon instanceof CdmBase && ((CdmBase)taxon).isInstanceOf(TaxonBase.class)){
- typedTaxa.add(HibernateProxyHelper.deproxy(taxon, TaxonBase.class));
+ Collection<DeterminationEvent> determinationEvents = CdmStore.getService(IOccurrenceService.class).listDeterminationEvents(entity.innerDerivedUnit(), null, null, null, null);
+
+ if(associatedTaxa.isEmpty() && typeDesignations.isEmpty() && determinationEvents.isEmpty()){
+ Label label = formFactory.createLabel(getLayoutComposite(), "No associations");
+ label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ return;
+ }
+ if(!associatedTaxa.isEmpty()){
+ TableViewer viewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+ viewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setLabelProvider(new LabelProvider(){
+ @Override
+ public String getText(Object element) {
+ return "Associated with "+element.toString();
+ }
+ });
+ viewer.setInput(associatedTaxa);
+ viewer.addDoubleClickListener(this);
+ }
+ if(!typeDesignations.isEmpty()){
+ TableViewer viewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+ viewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setLabelProvider(new LabelProvider(){
+ @Override
+ public String getText(Object element) {
+ SpecimenTypeDesignation typeDesignation = (SpecimenTypeDesignation)element;
+ String label = typeDesignation.getTypeStatus()!=null?typeDesignation.getTypeStatus().getLabel()+" of ":"Type of ";
+ Set<TaxonNameBase> typifiedNames = typeDesignation.getTypifiedNames();
+ for (TaxonNameBase taxonNameBase : typifiedNames) {
+ label += taxonNameBase+", ";
+ }
+ if(label.endsWith(", ")){
+ label = label.substring(0, label.length()-2);
}
+ return label;
}
- }
+ });
+ viewer.setInput(typeDesignations);
+ viewer.addDoubleClickListener(this);
+ }
+ if(!determinationEvents.isEmpty()){
+ TableViewer viewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+ viewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setLabelProvider(new LabelProvider(){
+ @Override
+ public String getText(Object element) {
+ DeterminationEvent determinationEvent = (DeterminationEvent)element;
+ if(determinationEvent.getTaxon()!=null){
+ return "Determined as taxon "+determinationEvent.getTaxon();
+ }
+ if(determinationEvent.getTaxonName()!=null){
+ return "Determined as name "+determinationEvent.getTaxonName();
+ }
+ return element.toString();
+ }
+ });
+ viewer.setInput(determinationEvents);
+ viewer.addDoubleClickListener(this);
}
- typeDesignationViewer.setInput(typedTaxa);
- typeDesignationViewer.addDoubleClickListener(this);
}
/** {@inheritDoc} */
//empty
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
@Override
public void doubleClick(DoubleClickEvent event) {
if(event.getSelection() instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ UUID taxonToOpenUuid = null;
if(firstElement instanceof TaxonBase<?>){
- TaxonBase<?> taxonBase = (TaxonBase<?>)firstElement;
+ taxonToOpenUuid = ((TaxonBase<?>)firstElement).getUuid();
+ }
+ else if(firstElement instanceof SpecimenTypeDesignation){
+ //TODO how to open an editor for all typed names?
+ }
+ else if(firstElement instanceof DeterminationEvent){
+ if(((DeterminationEvent) firstElement).getTaxon()!=null){
+ taxonToOpenUuid = ((DeterminationEvent) firstElement).getTaxon().getUuid();
+ }
+ else if(((DeterminationEvent) firstElement).getTaxonName()!=null){
+ //TODO how to open editor for taxon name
+ }
+ }
+ if(taxonToOpenUuid!=null){
String commandId = "eu.etaxonomy.taxeditor.editor.openTaxonEditor";
} catch (NotDefinedException e1) {
MessagingUtils.error(this.getClass(), "Command not defined", e1);
}
- Parameterization params = new Parameterization(iparam, (taxonBase).getUuid().toString());
+ Parameterization params = new Parameterization(iparam, taxonToOpenUuid.toString());
parameters.add(params);
//build the parameterized command
}
}
}
-
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.ui.section.occurrence.derivedUnit;
-
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author n.hoffmann
- * @created May 11, 2011
- * @version 1.0
- */
-public class PreservedSpecimenDeterminationDetailElement extends AbstractCdmDetailElement<DerivedUnit> {
-
- private PreservedSpecimenCurrentDeterminationDetailSection section_currentDetermination;
-
- private PreservedSpecimenDeterminationHistoryDetailSection section_determinationHistory;
-
- /**
- * @param formFactory
- * @param formElement
- */
- public PreservedSpecimenDeterminationDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement) {
- super(formFactory, formElement);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
- */
- @Override
- protected void createControls(ICdmFormElement formElement,
- DerivedUnit entity, int style) {
-
- section_currentDetermination = formFactory.createPreservedSpecimenCurrentDeterminationDetailSection(getConversationHolder(), formElement, ExpandableComposite.EXPANDED);
- section_currentDetermination.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- section_currentDetermination.setEntity(entity);
-
- section_determinationHistory = formFactory.createPreservedSpecimenDeterminationHistoryDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
- section_determinationHistory.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- section_determinationHistory.setEntity(entity);
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
- */
- @Override
- public void handleEvent(Object eventSource) {
- if(eventSource == section_currentDetermination){
- section_determinationHistory.refresh();
- }
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.ui.section.occurrence.derivedUnit;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author n.hoffmann
- * @created May 11, 2011
- * @version 1.0
- */
-public class PreservedSpecimenDeterminationDetailSection extends AbstractCdmDetailSection<DerivedUnit> {
-
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
- public PreservedSpecimenDeterminationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
- ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
- */
- @Override
- public String getHeading() {
- return "Determinations";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
- @Override
- protected AbstractCdmDetailElement<DerivedUnit> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnit> parentElement, int style) {
- return formFactory.createPreservedSpecimenDeterminationDetailElement(parentElement);
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.ui.section.occurrence.derivedUnit;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-
-/**
- * @author n.hoffmann
- * @created May 11, 2011
- * @version 1.0
- */
-public class PreservedSpecimenDeterminationHistoryDetailSection extends
-PreservedSpecimenAbstractDeterminationEventDetailSection {
-
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param style
- */
- public PreservedSpecimenDeterminationHistoryDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
- int style) {
- super(formFactory, conversation, parentElement, "Determination History", style);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- @Override
- public Collection<DeterminationEvent> getCollection(DerivedUnit entity) {
- if(entity!=null){
- Set<DeterminationEvent> events = entity.getDeterminations();
- Set<DeterminationEvent> result = new HashSet<DeterminationEvent>();
- for (DeterminationEvent event : events){
- if (event.getPreferredFlag() != true){
- result.add(event);
- }
- }
- return result;
- }
- return null;
- }
-
- @Override
- public void refresh() {
- internalUpdateSection(false);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
- @Override
- protected String getTooltipString() {
- return "Add a determination event to the history";
- }
-
-}
getEntity().setGeneticAccessionNumber(textGeneticAccessNo.getText());
if(textGeneticAccessNo.getText()!=null && !textGeneticAccessNo.getText().isEmpty()){
try {
- textNCBIUri.setUri(getEntity().getGenBankUri());
- textENAUri.setUri(getEntity().getEmblUri());
- textDDBJUri.setUri(getEntity().getDdbjUri());
+ textNCBIUri.setParsedText(getEntity().getGenBankUri());
+ textENAUri.setParsedText(getEntity().getEmblUri());
+ textDDBJUri.setParsedText(getEntity().getDdbjUri());
} catch (URISyntaxException e) {
textGeneticAccessNo.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
}
getEntity().setBoldProcessId(textBoldProcessID.getText());
if(textBoldProcessID.getText()!=null && !textBoldProcessID.getText().isEmpty()){
try {
- textBoldUri.setUri(getEntity().getBoldUri());
+ textBoldUri.setParsedText(getEntity().getBoldUri());
} catch (URISyntaxException e) {
textBoldProcessID.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
}
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
import eu.etaxonomy.cdm.model.reference.ReferenceType;
-import eu.etaxonomy.taxeditor.model.AuthorHelper;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
private TextWithLabelElement text_publisher;
private TextWithLabelElement text_referenceAbstract;
private TextWithLabelElement text_series;
- private TextWithLabelElement text_seriesPart;
+// private TextWithLabelElement text_seriesPart;
private TextWithLabelElement text_volume;
private TextWithLabelElement text_abbrevTitle;
private TextWithLabelElement text_title;
selection_authorTeam = formFactory
.createSelectionElement(AgentBase.class,
getConversationHolder(), formElement, "Author",
- AuthorHelper.getAuthor(entity.getAuthorship()),
+ entity.getAuthorship(),
EntitySelectionElement.ALL, style);
ReferenceType referenceType = entity.getType();
"Date Published", entity.getDatePublished(), style);
createUriAndAbstract(this, entity, SWT.NULL);
+ handleToggleableAbbrevTitleField();
+ handleToggleableCacheField();
}
/*
// Object[]{text_cache}));
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
toggleableAbbrevCache.setEnabled(getEntity().isProtectedAbbrevTitleCache());
- setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[] { toggleable_cache }));
- setIrrelevant(toggleableAbbrevCache.getState(), Arrays.asList(new Object[] { toggleableAbbrevCache}));
+ setIrrelevantReferenceDetail(false);
+ setIrrelevantReferenceDetail(true);
}
/**
text_editor = formFactory.createTextWithLabelElement(element, "Editor",
reference.getEditor(), style);
- // series part
+ /* series part
text_seriesPart = formFactory.createTextWithLabelElement(element,
"Series", reference.getSeriesPart(), style);
-
+*/
if (referenceType.equals(ReferenceType.Book)) {
// edition
text_edition = formFactory.createTextWithLabelElement(element,
getEntity().setPublisher(text_publisher.getText());
} else if (eventSource == text_referenceAbstract) {
getEntity().setReferenceAbstract(text_referenceAbstract.getText());
- } else if (eventSource == text_seriesPart) {
- getEntity().setSeriesPart(text_seriesPart.getText());
+ } else if (eventSource == text_series) {
+ getEntity().setSeriesPart(text_series.getText());
} else if (eventSource == text_title) {
getEntity().setTitle(text_title.getText());
toggleable_cache.setText(text_title.getText());
getEntity().setAbbrevTitle(text_abbrevTitle.getText());
toggleableAbbrevCache.setText(text_abbrevTitle.getText());
} else if (eventSource == text_uri) {
- getEntity().setUri(text_uri.getUri());
+ getEntity().setUri(text_uri.parseText());
} else if (eventSource == text_volume) {
getEntity().setVolume(text_volume.getText());
}
protected void handleToggleableAbbrevTitleField() {
boolean pushedAbbrevState = toggleableAbbrevCache.getState();
getEntity().setAbbrevTitleCache(toggleableAbbrevCache.getText(), pushedAbbrevState);
- setIrrelevant(pushedAbbrevState, Arrays.asList(new Object[] { toggleableAbbrevCache, toggleable_cache, text_title }));
+ setIrrelevantReferenceDetail(true);
updateToggleableCacheField();
}
}
}
}
+
+ @Override
+ protected void handleToggleableCacheField() {
+
+ boolean pushedState = toggleable_cache.getState();
+ getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
+ setIrrelevantReferenceDetail(false);
+ updateToggleableCacheField();
+ }
+
+ protected void setIrrelevantReferenceDetail(boolean abbrev){
+
+ List<Object> except = new ArrayList();
+ except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished, text_publisher, text_referenceAbstract, text_uri, selection_institution}));
+ boolean pushedState;
+ if (abbrev){
+ except.add(text_title);
+ pushedState = toggleableAbbrevCache.getState();
+ } else{
+ except.add(text_abbrevTitle);
+ pushedState = toggleable_cache.getState();
+ }
+ switch( getEntity().getType()){
+ case Journal:
+ except.add(element_timePeriod);
+ break;
+ case Book:
+ except.remove(text_series);
+ except.remove(text_edition);
+ break;
+ default:
+ break;
+ }
+ setIrrelevant(pushedState, except);
+ }
}
package eu.etaxonomy.taxeditor.ui.section.supplemental;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.common.OriginalSourceBase;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
/**
- * <p>Abstract AbstractOriginalSourceElement class.</p>
- *
* @author n.hoffmann
* @created Mar 16, 2010
* @version 1.0
protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
protected TextWithLabelElement text_idInSource;
protected TextWithLabelElement text_idNamespace;
+ protected TextWithLabelElement text_originaleNameString;
- /**
- * <p>Constructor for AbstractOriginalSourceElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a T object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- * @param <T> a T object.
- */
public AbstractOriginalSourceElement(CdmFormFactory formFactory,
AbstractFormSection section,
T element, SelectionListener removeListener,
super(formFactory, section, element, removeListener, style);
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override
- public void init() {
- super.init();
- setHasOriginalNameString(true);
+ public void setEntity(T entity) {
+ super.setEntity(entity);
+ text_originaleNameString.setText(entity.getOriginalNameString());
}
/** {@inheritDoc} */
.createEnumComboElement(OriginalSourceType.class,
formElement, style);
super.createControls(formElement, style);
- text_idInSource = formFactory.createTextWithLabelElement(formElement, "Id In Source", null, style);
+ text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", null, style);
text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", null, style);
+ text_originaleNameString = formFactory.createTextWithLabelElement(
+ formElement, "Original Name", null, SWT.NULL);
}
}
// $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.
*/
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
+import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * Abstract AbstractReferencedEntityElement class.
- * </p>
- *
* @author n.hoffmann
* @created Mar 25, 2010
* @version 1.0
*/
public abstract class AbstractReferencedEntityElement<T extends ReferencedEntityBase>
- extends AbstractEntityCollectionElement<T> {
+ extends AbstractEntityCollectionElement<T> implements ISelectableElement {
+ private SelectionArbitrator selectionArbitrator;
+
protected EntitySelectionElement<Reference> selection_reference;
protected TextWithLabelElement text_referenceDetail;
- protected TextWithLabelElement text_originaleNameString;
-
- private boolean hasOriginalNameString = false;
-
- /**
- * <p>
- * Constructor for AbstractReferencedEntityElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a T object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- * @param <T>
- * a T object.
- */
public AbstractReferencedEntityElement(CdmFormFactory formFactory,
AbstractFormSection section, T entity,
SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, null, style);
+ // make this element selectable
+ if(formFactory.getSelectionProvider() != null){
+ selectionArbitrator = formFactory.createSelectionArbitrator(this);
+ }
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#
- * createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
null, EntitySelectionElement.ALL, style);
text_referenceDetail = formFactory.createTextWithLabelElement(
formElement, "Reference Detail", null, SWT.NULL);
- if (hasOriginalNameString)
- text_originaleNameString = formFactory.createTextWithLabelElement(
- formElement, "Original Name", null, SWT.NULL);
}
- /**
- * <p>
- * setEntity
- * </p>
- *
- * @param entity
- * a T object.
- */
@Override
public void setEntity(T entity) {
this.entity = entity;
selection_reference.setEntity(entity.getCitation());
text_referenceDetail.setText(entity.getCitationMicroReference());
- if (hasOriginalNameString)
- text_originaleNameString.setText(entity.getOriginalNameString());
- // // remove old listeners
- // clearEditButtonSelectionListener();
- //
- // addEditButtonSelectionListener(new
- // BulkEditorOpeningSelectionListener(entity.getCitation()));
- //
- };
-
- //
- // public void addEditButtonSelectionListener(SelectionListener listener){
- // selection_reference.addEditButtonSelectionListener(listener);
- // }
- //
- // public void removeEditButtonSelectionListener(SelectionListener
- // listener){
- // selection_reference.removeEditorButtonSelectionListener(listener);
- // }
- //
- // public void clearEditButtonSelectionListener(){
- // selection_reference.clearEditButtonSelectionListener();
- // }
-
- /**
- * <p>
- * Setter for the field <code>hasOriginalNameString</code>.
- * </p>
- *
- * @param hasOriginalNameString
- * a boolean.
- */
- public void setHasOriginalNameString(boolean hasOriginalNameString) {
- this.hasOriginalNameString = hasOriginalNameString;
}
-
- /**
- * <p>
- * hasOriginalNameString
- * </p>
- *
- * @return a boolean.
- */
- public boolean hasOriginalNameString() {
- return hasOriginalNameString;
+
+ @Override
+ public SelectionArbitrator getSelectionArbitrator() {
+ return selectionArbitrator;
}
+
}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.ui.section.supplemental;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
- * <p>IdentifiableSourceElement class.</p>
- *
* @author n.hoffmann
* @created Nov 16, 2009
* @version 1.0
*/
public class IdentifiableSourceElement extends AbstractOriginalSourceElement<IdentifiableSource>{
-
- /**
- * <p>Constructor for IdentifiableSourceElement.</p>
- *
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a {@link eu.etaxonomy.cdm.model.common.IdentifiableSource} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- */
+
public IdentifiableSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, IdentifiableSource element,
SelectionListener removeListener, int style) {
super(cdmFormFactory, formElement, element, removeListener, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
super.createControls(formElement, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void setEntity(IdentifiableSource entity) {
selection_reference.setEntity(entity.getCitation());
text_referenceDetail.setText(entity.getCitationMicroReference());
combo_origsourcetype.setSelection(entity.getType());
- if(hasOriginalNameString()) text_originaleNameString.setText(entity.getOriginalNameString());
- }
-
+ text_originaleNameString.setText(entity.getOriginalNameString());
+ }
+
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
((Taxon)getEntity()).setPublish(checkbox_published.getSelection());
}
}
+ @Override
+ protected void handleToggleableCacheField() {
+ boolean pushedState = toggleable_cache.getState();
+
+ getEntity().setTitleCache(toggleable_cache.getText(), pushedState);
+ setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, text_appendedPhrase, checkbox_published, checkbox_unplaced, checkbox_excluded}));
+ updateToggleableCacheField();
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.ui.section.taxon;
+
+import org.eclipse.swt.SWT;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ *
+ * @author pplitzner
+ * @date Jan 18, 2016
+ *
+ */
+public class TaxonWizardPage extends AbstractCdmEntityWizardPage<TaxonBase> {
+
+ public TaxonWizardPage(CdmFormFactory formFactory, ConversationHolder conversation,
+ TaxonBase entity) {
+ super(formFactory, conversation, entity);
+ setTitle("Taxon");
+ }
+
+
+ /** {@inheritDoc} */
+ @Override
+ public AbstractCdmDetailElement<TaxonBase> createElement(ICdmFormElement rootElement) {
+ TaxonBaseDetailElement taxonBaseDetailElement = formFactory.createTaxonBaseDetailElement(rootElement, SWT.NULL);
+ taxonBaseDetailElement.setEntity(entity);
+ return taxonBaseDetailElement;
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return true;
+ }
+}
} else if (eventSource == text_description) {\r
getEntity().getRepresentation(Language.getDefaultLanguage()).setText(text_description.getText());\r
} else if (eventSource == uri_uri) {\r
- getEntity().setUri(uri_uri.getUri());\r
+ getEntity().setUri(uri_uri.parseText());\r
} else if (eventSource == text_abbreviatedLabel) {\r
getEntity().getRepresentation(Language.getDefaultLanguage()).setAbbreviatedLabel(text_abbreviatedLabel.getText());\r
} else if (eventSource == timePeriod_validPeriod) {\r
handleRepresentation(eventSource);\r
\r
if (eventSource == uri_uri) {\r
- getEntity().setUri(uri_uri.getUri());\r
+ getEntity().setUri(uri_uri.parseText());\r
} else if (eventSource == uri_uriTermSource) {\r
- getEntity().setTermSourceUri(uri_uriTermSource.getUri());\r
+ getEntity().setTermSourceUri(uri_uriTermSource.parseText());\r
}\r
}\r
\r
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+public class ClassificationSelectionElement extends EntitySelectionElement<Classification> {
+
+ public ClassificationSelectionElement(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ Class<Classification> clazz, String labelString,
+ Classification entity, int mode, int style) {
+ super(formFactory, conversation, parentElement, clazz, labelString, entity,
+ mode, style);
+
+ }
+
+}
package eu.etaxonomy.taxeditor.ui.selection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.ui.IEditorPart;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
+import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.model.TextHelper;
import eu.etaxonomy.taxeditor.newWizard.AmplificationGeneralWizardPage;
import eu.etaxonomy.taxeditor.newWizard.PrimerWizardPage;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionWizardPage;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonWizardPage;
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailWizardPage;
/**
- * <p>
- * EditFromSelectionWizard class.
- * </p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
* @version 1.0
*/
public class EditFromSelectionWizard extends Wizard implements
- SelectionListener {
+ SelectionListener, ICdmEntitySessionEnabled {
+ private ICdmEntitySession cdmEntitySession;
+ private ICdmEntitySession previousCdmEntitySession;
private final EntitySelectionElement selectionElement;
+ private CdmBase rootElement;
- /**
- * <p>
- * Constructor for EditFromSelectionWizard.
- * </p>
- *
- * @param selectionElement
- * a
- * {@link eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement}
- * object.
- */
public EditFromSelectionWizard(EntitySelectionElement selectionElement) {
+ if (CdmStore.isActive() && CdmStore.getCurrentSessionManager().isRemoting()) {
+ previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ cdmEntitySession.bind();
+ }
this.selectionElement = selectionElement;
this.setWindowTitle(String.format("Edit %s", TextHelper.deproxyClassName(selectionElement.getEntity().getClass())));
}
public void addPages() {
CdmFormFactory formFactory = selectionElement.getFormFactory();
- ICdmBase entity = (ICdmBase) HibernateProxyHelper
+ CdmBase entity = HibernateProxyHelper
.deproxy(selectionElement.getEntity());
-
- if (entity instanceof Reference) {
+ //check if entity has already been persisted
+ if(entity.getId()==0){
+ rootElement = entity;
+ cdmEntitySession.addNewCdmEntity(rootElement);
+ }
+ else{
+ IService<CdmBase> service = CdmStore.getService(entity);
+ rootElement = service.load(entity.getUuid());
+ }
+ if (rootElement.isInstanceOf(Reference.class)) {
addPage(new ReferenceWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (Reference) entity));
- } else if (entity instanceof Team) {
+ (HibernateProxyHelper.deproxy(rootElement, Reference.class))));
+ } else if (rootElement.isInstanceOf(Team.class)) {
addPage(new TeamWizardPage(formFactory,
- selectionElement.getConversationHolder(), (Team) entity));
- } else if (entity instanceof Person) {
+ selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class)));
+ } else if (rootElement.isInstanceOf(Person.class)) {
addPage(new PersonWizardPage(formFactory,
- selectionElement.getConversationHolder(), (Person) entity));
- } else if (entity instanceof NonViralName) {
+ selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Person.class)));
+ } else if (rootElement.isInstanceOf(NonViralName.class)) {
addPage(new NonViralNameWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (NonViralName) entity));
- } else if (entity instanceof DerivedUnit) {
+ HibernateProxyHelper.deproxy(rootElement, NonViralName.class)));
+ } else if (rootElement.isInstanceOf(SpecimenOrObservationBase.class)) {
DerivedUnitFacade facade;
try {
- facade = DerivedUnitFacade.NewInstance(
- (DerivedUnit) entity,
- PreferencesUtil.getDerivedUnitConfigurator());
+ if(rootElement.isInstanceOf(DerivedUnit.class)){
+ facade = DerivedUnitFacade.NewInstance(
+ HibernateProxyHelper.deproxy(rootElement, DerivedUnit.class),
+ PreferencesUtil.getDerivedUnitConfigurator());
+ }
+ else {
+ facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit,
+ HibernateProxyHelper.deproxy(rootElement, FieldUnit.class),
+ PreferencesUtil.getDerivedUnitConfigurator());
+ }
+
} catch (DerivedUnitFacadeNotSupportedException e) {
// we should never get here
throw new IllegalStateException();
selectionElement.getConversationHolder(), facade));
addPage(new FieldUnitWizardPage(formFactory,
selectionElement.getConversationHolder(), facade));
- addPage(new DerivedUnitBaseWizardPage(formFactory,
- selectionElement.getConversationHolder(), facade));
- } else if (entity instanceof Collection) {
+ if(facade.innerDerivedUnit()!=null){
+ addPage(new DerivedUnitBaseWizardPage(formFactory,
+ selectionElement.getConversationHolder(), facade));
+ }
+ } else if (rootElement.isInstanceOf(Collection.class)) {
addPage(new CollectionWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (Collection) entity));
- } else if (entity instanceof Institution) {
+ HibernateProxyHelper.deproxy(rootElement, Collection.class)));
+ } else if (rootElement instanceof Institution) {
addPage(new InstitutionWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (Institution) entity));
- } else if (entity instanceof User) {
+ HibernateProxyHelper.deproxy(rootElement, Institution.class)));
+ } else if (rootElement instanceof User) {
addPage(new UserDetailWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (User) entity));
- } else if (entity instanceof Primer) {
+ HibernateProxyHelper.deproxy(rootElement, User.class)));
+ } else if (rootElement instanceof Primer) {
addPage(new PrimerWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (Primer) entity));
- } else if (entity instanceof Amplification) {
+ HibernateProxyHelper.deproxy(rootElement, Primer.class)));
+ } else if (rootElement instanceof Amplification) {
addPage(new AmplificationGeneralWizardPage(formFactory,
selectionElement.getConversationHolder(),
- (Amplification) entity));
+ HibernateProxyHelper.deproxy(rootElement, Amplification.class)));
} else {
MessagingUtils.warningDialog("Missing interface", this,
"No detail element for current selection");
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
/** {@inheritDoc} */
@Override
public boolean performFinish() {
- IEditorPart activeEditor = AbstractUtility.getActiveEditor();
- /*
- * forceDirty() for cases when one or more EditFromSelectionWizards are
- * opened cascadingly to trigger the save button. Otherwise the dirty
- * state would not be set and the user will have no feedback that he/she
- * actually still has ounsaved changes. This is necessary because
- * editing in these wizards is done on clones of the CDM entities which
- * are merged back with the original when pressing "Finish"
- */
- if (activeEditor instanceof IDirtyMarkable){
- ((IDirtyMarkable) activeEditor).forceDirty();
+ IService<CdmBase> service = CdmStore.getService(rootElement);
+ if(rootElement.getId()!=0){
+ service.merge(rootElement, true);
+ }
+ if(previousCdmEntitySession!=null){
+ selectionElement.setEntity(previousCdmEntitySession.load(rootElement, true));
}
return true;
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ if(previousCdmEntitySession!=null){
+ previousCdmEntitySession.dispose();
+ }
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ @Override
+ public java.util.Collection<CdmBase> getRootEntities() {
+ return Collections.singleton(rootElement);
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ return null;
+ }
}
import java.util.Observer;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.ICollectionService;
-import eu.etaxonomy.cdm.api.service.INameService;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.IService;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
-import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;
import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.cdm.model.agent.Institution;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.cdm.model.molecular.Primer;
-import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.occurrence.Collection;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.LoginManager;
* @version 1.0
* @param <T>
*/
-public class EntitySelectionElement<T extends ICdmBase> extends
+public class EntitySelectionElement<T extends CdmBase> extends
AbstractCdmFormElement implements SelectionListener, IEnableableFormElement, ISelectableElement, IEntityElement<T>, ILabeledElement, IConversationEnabled, Observer {
private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
this.isDeletable = (mode & DELETABLE) == DELETABLE;
boolean isSelectable = (mode & SELECTABLE) == SELECTABLE;
- this.labelString = (labelString == null || labelString.equals("")) ? "" : labelString + " : ";
+ this.labelString = (labelString == null || labelString.equals("")) ? "" : labelString;
this.conversation = conversation;
@Override
public void widgetSelected(SelectionEvent e) {
- T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity());
+ T selection = SelectionDialogFactory.getSelectionFromDialog(clazz, getShell(), getConversationHolder(), getEntity(), getParentElement());
setSelectionInternal(selection);
}
/** {@inheritDoc} */
@Override
public void setEnabled(boolean enabled) {
+
button_selection.setEnabled(enabled);
+ if (isDeletable){
+ button_remove.setEnabled(enabled);
+ }
if (isEditable) {
updateButtonStates();
}
+
}
/* (non-Javadoc)
*/
protected String getTitle() {
if (entity != null){
- if(entity instanceof IIdentifiableEntity) {
- return ((IIdentifiableEntity) entity).getTitleCache();
- } else if(entity instanceof Group){
+ if(entity instanceof Group){
return ((Group) entity).getName();
} else if(entity instanceof GrantedAuthority){
return GrantedAuthorityLabelTextProvider.getText(((GrantedAuthority) entity));
} else if (entity instanceof Amplification){
return ((Amplification) entity).getLabelCache();
}
+ else if(entity instanceof IIdentifiableEntity) {
+ return ((IIdentifiableEntity) entity).getTitleCache();
+ }
}
return "";
private class EditListener extends SelectionAdapter {
- private static final String TRANSIENT_EDITING_WARNING_TEXT = "Warning: All changes for this element are directly reflected in the data base.\nThe \"Cancel\" button has no effect";
- private static final String TRANSIENT_EDITING_WARNING_TITLE = "CDM element not yet saved.";
private final EntitySelectionElement<T> selectionElement;
public EditListener(EntitySelectionElement<T> selectionElement) {
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
- T originalEntity = selectionElement.getEntity();
- T clonedEntity = null;
- IService<T> service = null;
- if(originalEntity instanceof CdmBase){
- //get corresponding service
- if(entity instanceof Reference<?>){
- service = (IService<T>) CdmStore.getService(IReferenceService.class);
- }
- else if (entity instanceof Team || entity instanceof Person || entity instanceof Institution) {
- service = (IService<T>) CdmStore.getService(IAgentService.class);
- }
- else if (entity instanceof NonViralName) {
- service = (IService<T>) CdmStore.getService(INameService.class);
- }
- else if (entity instanceof SpecimenOrObservationBase) {
- service = (IService<T>) CdmStore.getService(IOccurrenceService.class);
- }
- else if (entity instanceof Collection) {
- service = (IService<T>) CdmStore.getService(ICollectionService.class);
- }
- else if (entity instanceof User) {
- service = (IService<T>) CdmStore.getService(IUserService.class);
- }
- else if (entity instanceof Primer) {
- service = (IService<T>) CdmStore.getService(IPrimerService.class);
- }
- else if (entity instanceof Amplification) {
- service = (IService<T>) CdmStore.getService(IAmplificationService.class);
- }
- //check if original already exists in data base. If not then do not clone and all changes will be persisted directly -> Warning to user.
- if(service !=null && service.find(originalEntity.getUuid())==null && originalEntity.getId() != 0){
- if(MessagingUtils.confirmDialog(TRANSIENT_EDITING_WARNING_TITLE, "["+originalEntity.getClass().getSimpleName()+"]"+originalEntity + " has to be saved before it can be edited. Save now?")){
- service.save(originalEntity);
- AbstractUtility.getActiveEditor().doSave(new NullProgressMonitor());
- }
- else{
- //transient CDM elements should not be edited to avoid merge conflicts
- // when the elements are cascaded
- return;
- }
- }
- else{
- //FIXME temporarily disabled cloning re-opening bug #2645 (EditFromSelectionWizard persists data even when canceled)
-// try {
-// //clone original
-// clonedEntity = (T) ((CdmBase) originalEntity).clone();
-// } catch (CloneNotSupportedException e1) {
-// MessagingUtils.warningDialog(TRANSIENT_EDITING_WARNING_TITLE, this, TRANSIENT_EDITING_WARNING_TEXT);
-// }
- }
-
- }
- if(clonedEntity!=null){
- selectionElement.setEntity(clonedEntity);
- }
WizardDialog dialog = new WizardDialog(selectionElement.getShell(),
new EditFromSelectionWizard(selectionElement));
if (dialog.open() == IStatus.OK) {
- if(service!=null && clonedEntity!=null){//check if cloning happened
- T editedClonedEntity = selectionElement.getEntity();
- editedClonedEntity.setId(originalEntity.getId());
- editedClonedEntity.setUuid(originalEntity.getUuid());
-
- //merge clone and original
- service.merge(editedClonedEntity);
- originalEntity = service.load(originalEntity.getUuid());
-
- }
- selectionElement.setEntity(originalEntity);
selectionElement.updateFromWizard();
+ //if the edited entity has already been persisted
+ //but the transient entity is still set in this
+ //EntitySelectionElement, re-load it and set it
+ IService<T> service = CdmStore.getService(entity);
+ if(entity.getId()==0){
+ T loadedEntity = service.load(entity.getUuid());
+ if(loadedEntity!=null){
+ setEntity(loadedEntity);
+ }
+ }
}
- //be sure to reset to original in all cases
- selectionElement.setEntity(originalEntity);
- selectionElement.refresh();
}
}
private void updateButtonStates() {
if(button_edit != null && !button_selection.isDisposed()){
- button_edit.setEnabled(isEditable && button_selection.isEnabled() && getEntity() != null && CdmStore.currentAuthentiationHasPermission((CdmBase) getEntity(), UPDATE));
+ button_edit.setEnabled(isEditable && button_selection.isEnabled() && getEntity() != null && CdmStore.currentAuthentiationHasPermission(getEntity(), UPDATE));
}
}
}
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-public class EntitySelectionElementWithAbbreviatedTitle<T extends ICdmBase> extends EntitySelectionElement<T> {
+public class EntitySelectionElementWithAbbreviatedTitle<T extends CdmBase> extends EntitySelectionElement<T> {
/**
* @param formFactory
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor;
+package eu.etaxonomy.taxeditor.util;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
/**
* Prefix to declare the version as beta
*/
- private static final String BETA_PREFIX = "[Beta]";
+ private static final String BETA_PREFIX = "[BETA]";
+ public static String getTitle() {
+ return "EDIT Taxonomic Editor " + ApplicationUtil.getVersion();
+ }
/**
* @return
*/
public static boolean isStable() {
return !getVersion().startsWith("[");
}
- /**
- * <p>getPluginId</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public static String getPluginId(){
- return TaxonomicEditorPlugin.PLUGIN_ID;
- }
-
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class OperationsUtil {
+
+ public static List<UUID> convertToUuidList(List<CdmBase> cdmBaseList) {
+ List<UUID> uuids = new ArrayList<UUID>();
+ for(CdmBase cdmBase : cdmBaseList) {
+ if(cdmBase == null) {
+ uuids.add(null);
+ } else {
+ uuids.add(cdmBase.getUuid());
+ }
+ }
+ return uuids;
+ }
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.util;
+
+import java.text.DecimalFormat;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
+import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
+import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
+
+/**
+ * Manages client side progress monitors
+ *
+ * @author cmathew
+ * @date 23 Oct 2015
+ *
+ */
+
+public class ProgressMonitorClientManager {
+ private static final Logger logger = Logger.getLogger(ProgressMonitorClientManager.class);
+
+ /**
+ * Polls the progress monitor service for the progress status of a monitor
+ * corresponding to the given uuid.
+ *
+ * @param label for the operation
+ * @param uuid of the remoting monitor already started on the server
+ * @param pollInterval in milliseconds
+ * @param cancelable flag which determines whether the operation can be cancelled
+ * @param postOp callback for running post operation logic
+ * @param feedbackGenerator feedback generator corresponding to the
+ * 'wait on feedback' request made on the remoting monitor
+ * @param monitor to be updated
+ * @return a final progress monitor after the operation is completed
+ * @throws InterruptedException
+ */
+ public IRemotingProgressMonitor pollMonitor(final String label,
+ final UUID uuid,
+ final int pollInterval,
+ final IPostMoniteredOperationEnabled postOp,
+ IFeedbackGenerator feedbackGenerator,
+ IProgressMonitor monitor) throws InterruptedException {
+ return pollMonitor(label, uuid, pollInterval, postOp, Arrays.asList(feedbackGenerator), monitor);
+ }
+ /**
+ * Polls the progress monitor service for the progress status of a monitor
+ * corresponding to the given uuid.
+ *
+ *
+ * @param label for the operation
+ * @param uuid of the remoting monitor already started on the server
+ * @param pollInterval in milliseconds
+ * @param cancelable flag which determines whether the operation can be cancelled
+ * @param postOp callback for running post operation logic
+ * @param feedbackGenerators list of feedback generators corresponding to the
+ * size and exact order of the 'wait on feedback' requests made on the
+ * remoting monitor
+ * @param monitor to be updated
+ * @return a final progress monitor after the operation is completed
+ * @throws InterruptedException
+ */
+ public IRemotingProgressMonitor pollMonitor(final String label,
+ final UUID uuid,
+ final int pollInterval,
+ final IPostMoniteredOperationEnabled postOp,
+ List<IFeedbackGenerator> feedbackGenerators,
+ IProgressMonitor monitor) throws InterruptedException {
+ IProgressMonitorService progressMonitorService = CdmApplicationState.getCurrentAppConfig().getProgressMonitorService();
+ IRemotingProgressMonitor remotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ try {
+ final int START_DELAY=10;
+ // wait about 10 seconds for the remoting monitor to be initialised
+ // (i.e. for the begin task method to be called ON THE REMOTING MONITOR)
+ for(int i=0;i<START_DELAY;i++) {
+ Thread.sleep(1000);
+ logger.info("Waiting for monitered work to start ..");
+ remotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ if(remotingMonitor.getTotalWork() > 0) {
+ break;
+ }
+ }
+ // if the total work is still not been set then we assume that the
+ // operation has zero work units
+ if(remotingMonitor.getTotalWork() == 0) {
+ throw new InterruptedException("Monitor has zero work units");
+ }
+ // start the client monitor
+ monitor.beginTask(label, remotingMonitor.getTotalWork());
+ logger.info("Work to be done: " + remotingMonitor.getTotalWork());
+ int editorTotalWorkDone = 0;
+ int serverTotalWorkDone = 0;
+ // loop until the operation is done
+ int feedbackCount = 0;
+ while(!(remotingMonitor.isCanceled() || remotingMonitor.isFailed() || remotingMonitor.isDone())) {
+ // wait for pollInterval, then
+ // .... retrieve remoting monitor, then
+ // .... set client monitor info
+ Thread.sleep(pollInterval);
+ remotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ // check if remoting monitor is waiting for feedback
+ if(remotingMonitor.getIsWaitingForFeedback()) {
+ if(feedbackGenerators != null) {
+ // if we have run out of feedback generators while
+ // the remoting monitor is waiting on feedback
+ // then throw exception
+ if(feedbackCount + 1 > feedbackGenerators.size()) {
+ throw new IllegalStateException("Remoting monitor waiting on feedback that does not exist");
+ }
+ feedbackGenerators.get(feedbackCount).setFeedbackForMonitor(uuid);
+ feedbackCount++;
+ }
+ }
+ serverTotalWorkDone = (int) remotingMonitor.getWorkDone();
+ logger.info("Work done from start: " + serverTotalWorkDone);
+ String percentage = new DecimalFormat("#.##").format(remotingMonitor.getPercentage());
+ // set dialog text
+ monitor.setTaskName(label + " " + percentage + "% done ");
+ monitor.subTask(remotingMonitor.getSubTask());
+ int worked = serverTotalWorkDone - editorTotalWorkDone;
+ if(worked > 0) {
+ logger.info("Work done since last check: " + worked);
+ monitor.worked(worked);
+ }
+ editorTotalWorkDone = serverTotalWorkDone;
+ }
+ if(remotingMonitor.getResult() instanceof Exception) {
+ throw new IllegalStateException((Exception)remotingMonitor.getResult());
+ }
+ return remotingMonitor;
+ } finally {
+ if(postOp != null && remotingMonitor.isDone()) {
+ postOp.postOperation(remotingMonitor);
+ }
+ }
+ }
+}
/** {@inheritDoc} */
@Override
public Control getControl() {
+ if(body.isDisposed()){
+ return null;
+ }
for(Control child : body.getChildren()){
return child;
}
return body;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object)
*/
/** {@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);
Display.getCurrent().asyncExec(delaySelection);
}
}
+
+
/** {@inheritDoc} */
@Override
// $Id$
/**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.view;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* <p>Abstract AbstractCdmViewPart class.</p>
* @created Jun 15, 2010
* @version 1.0
*/
-public abstract class AbstractCdmViewPart extends ViewPart implements ISelectionListener, IPostOperationEnabled, IConversationEnabled, IDirtyMarkable{
+public abstract class AbstractCdmViewPart extends ViewPart implements ISelectionListener, IPostOperationEnabled, IConversationEnabled, ICdmEntitySessionEnabled, IDirtyMarkable{
- protected ISelectionService selectionService;
+ protected ISelectionService selectionService;
- public static IStructuredSelection EMPTY_SELECTION = new StructuredSelection();
+ public static IStructuredSelection EMPTY_SELECTION = new StructuredSelection();
- protected IWorkbenchPart part;
+ protected IWorkbenchPart part;
private PageBook pageBook;
- private Label emptySelectionLabel;
+ private Label emptySelectionLabel;
- private Composite viewerComposite;
+ private Composite viewerComposite;
- /** {@inheritDoc} */
- @Override
- public void createPartControl(Composite parent) {
- selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
+ /** {@inheritDoc} */
+ @Override
+ public void createPartControl(Composite parent) {
+ selectionService = getSite().getWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(this);
- pageBook = new PageBook(parent, SWT.NULL);
- //create viewerComposite
- viewerComposite = new SashForm(pageBook, SWT.HORIZONTAL);
- createViewer(viewerComposite);
+ pageBook = new PageBook(parent, SWT.NULL);
+ //create viewerComposite
+ viewerComposite = new SashForm(pageBook, SWT.HORIZONTAL);
+ createViewer(viewerComposite);
- // Page 2: Nothing selected
+ // Page 2: Nothing selected
emptySelectionLabel = new Label(pageBook, SWT.TOP + SWT.LEFT + SWT.WRAP);
setInitialSelection();
- }
-
- /**
- *
- */
- private void setInitialSelection() {
- selectionChanged(AbstractUtility.getActivePart(), getInitialSelection());
- }
-
- /**
- * <p>getInitialSelection</p>
- *
- * @return a {@link org.eclipse.jface.viewers.ISelection} object.
- */
- protected ISelection getInitialSelection() {
- return selectionService.getSelection();
- }
-
- /**
- * <p>showEmptyPage</p>
- */
- public void showEmptyPage(){
- pageBook.showPage(emptySelectionLabel);
- }
+ }
+
+ /**
+ *
+ */
+ private void setInitialSelection() {
+ selectionChanged(AbstractUtility.getActivePart(), getInitialSelection());
+ }
+
+ /**
+ * <p>getInitialSelection</p>
+ *
+ * @return a {@link org.eclipse.jface.viewers.ISelection} object.
+ */
+ protected ISelection getInitialSelection() {
+ return selectionService.getSelection();
+ }
+
+ /**
+ * <p>showEmptyPage</p>
+ */
+ public void showEmptyPage(){
+ pageBook.showPage(emptySelectionLabel);
+ }
/**
* <p>showViewer</p>
* @param selection a {@link org.eclipse.jface.viewers.ISelection} object.
*/
public void showViewer(IWorkbenchPart part, IStructuredSelection selection){
- this.part = part;
+ this.part = part;
- Object element = selection.getFirstElement();
-
- getViewer().setInput(element);
-
- showViewer();
+ Object element = selection.getFirstElement();
+ //avoid widget is disposed exceptions
+ if (getViewer().getControl()==null || getViewer().getControl().isDisposed()){
+ return;
+ }
+ getViewer().setInput(element);
+ showViewer();
}
/**
*/
public abstract Viewer getViewer();
- /**
- * <p>showViewer</p>
- */
- public void showViewer(){
- pageBook.showPage(viewerComposite);
- }
-
- public void setEnabled(boolean enabled){
- pageBook.setEnabled(enabled);
- }
-
- /** {@inheritDoc} */
- @Override
- public void setFocus() {
- if(getConversationHolder() != null){
- getConversationHolder().bind();
- }
- getViewer().getControl().setFocus();
- }
-
- /**
- * <p>createViewer</p>
- *
- * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
- */
- public abstract void createViewer(Composite parent);
-
- /** {@inheritDoc} */
- @Override
+ /**
+ * <p>showViewer</p>
+ */
+ public void showViewer(){
+ pageBook.showPage(viewerComposite);
+ }
+
+ public void setEnabled(boolean enabled){
+ pageBook.setEnabled(enabled);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setFocus() {
+ if(getConversationHolder() != null){
+ getConversationHolder().bind();
+ }
+ if(getCdmEntitySession() != null){
+ getCdmEntitySession().bind();
+ }
+ getViewer().getControl().setFocus();
+ }
+
+ /**
+ * <p>createViewer</p>
+ *
+ * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
+ */
+ public abstract void createViewer(Composite parent);
+
+ /** {@inheritDoc} */
+ @Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
- changed(objectAffectedByOperation);
- return true;
- }
+ changed(objectAffectedByOperation);
+ return true;
+ }
- /** {@inheritDoc} */
- @Override
+ /** {@inheritDoc} */
+ @Override
public abstract void changed(Object object);
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
public ConversationHolder getConversationHolder() {
- if(part != null && part instanceof IConversationEnabled) {
+ if(part != null && part instanceof IConversationEnabled) {
return ((IConversationEnabled) part).getConversationHolder();
}
- return null;
- }
+ return null;
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ if(part != null && part instanceof ICdmEntitySessionEnabled) {
+ return ((ICdmEntitySessionEnabled) part).getCdmEntitySession();
+ }
+ return null;
+ }
+
+ @Override
+ public List<? extends CdmBase> getRootEntities() {
+ return Arrays.asList((CdmBase)getViewer().getInput());
+ }
- /** {@inheritDoc} */
- @Override
+ /** {@inheritDoc} */
+ @Override
public void update(CdmDataChangeMap changeEvents) {
- }
-
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- selectionService.removeSelectionListener(this);
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
- */
- @Override
- public void forceDirty() {
- changed(null);
- }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ selectionService.removeSelectionListener(this);
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
+ */
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.view;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.ViewPart;
-
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-
-/**
- * <p>Abstract AbstractSplitableViewPart class.</p>
- *
- * @author n.hoffmann
- * @created Feb 12, 2010
- * @version 1.0
- */
-public abstract class AbstractSplitableViewPart extends ViewPart implements ISelectionListener{
-
- static final int VIEW_ORIENTATION_VERTICAL = 0;
- static final int VIEW_ORIENTATION_HORIZONTAL = 1;
- static final int VIEW_ORIENTATION_SINGLE = 2;
- static final int VIEW_ORIENTATION_AUTOMATIC = 3;
-
- private static final int PAGE_EMPTY = 0;
- private static final int PAGE_VIEWER = 1;
-
- private final IDialogSettings dialogSettings;
-
- private SashForm detailSplitter;
-
- private Composite parent;
-
- private PageBook pagebook;
-
- private int orientation;
-
- private int currentOrientation;
-//
- private boolean showViewer2;
-
- private Viewer viewer1;
-
- private Viewer viewer2;
-
- private Label emptySelectionLabel;
-
- private ISelectionService selectionService;
-
-
- /**
- * <p>Constructor for AbstractSplitableViewPart.</p>
- */
- public AbstractSplitableViewPart() {
- super();
-
- dialogSettings = TaxeditorStorePlugin.getDefault().getDialogSettings();
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- /** {@inheritDoc} */
- @Override
- public void createPartControl(Composite parent) {
- selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
- selectionService.addPostSelectionListener(this);
-
-
- this.parent = parent;
- addResizeListener(parent);
- pagebook = new PageBook(parent, SWT.NULL);
-
- // Page 1: Viewers
- createDetailSplitter(pagebook);
- viewer1 = createViewer1(detailSplitter);
- viewer2 = createViewer2(detailSplitter);
-
- // Page 2: Nothing selected
- emptySelectionLabel = new Label(pagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
- emptySelectionLabel.setText("Current selection does not support this view"); //
-
- showPage(PAGE_EMPTY);
-
- initOrientation();
-
- // FIXME since this class is not used at the moment we will not have to fix this soon
- // it might also become irrelevant in future uses
- // set the selection if there is an open editor
-// if(EditorUtil.getActiveMultiPageTaxonEditor() != null){
-// selectionChanged(EditorUtil.getActiveMultiPageTaxonEditor(), EditorUtil.getCurrentSelection());
-// }
- }
-
- private void initOrientation() {
-
- try {
- orientation = dialogSettings.getInt(getDialogstoreVieworientationKey());
-
- if ((orientation < 0) || (orientation > 3)) {
- orientation = VIEW_ORIENTATION_AUTOMATIC;
- }
- } catch (NumberFormatException e) {
- orientation = VIEW_ORIENTATION_AUTOMATIC;
- }
-
- // force the update
- currentOrientation = -1;
- setOrientation(orientation);
- }
-
- /**
- * <p>getDialogstoreVieworientationKey</p>
- *
- * @return a {@link java.lang.String} object.
- */
- protected abstract String getDialogstoreVieworientationKey();
-
- /**
- * <p>showEmptyPage</p>
- */
- public void showEmptyPage(){
- showPage(PAGE_EMPTY);
- }
-
- /**
- * <p>showViewer</p>
- */
- public void showViewer(){
- showPage(PAGE_VIEWER);
- }
-
- private void showPage(int page) {
- if (page == PAGE_EMPTY) {
- pagebook.showPage(emptySelectionLabel);
- } else {
- pagebook.showPage(detailSplitter);
- }
- }
-
- private void addResizeListener(Composite parent) {
- parent.addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e) {
- }
- public void controlResized(ControlEvent e) {
- computeOrientation();
- }
- });
- }
-
- void computeOrientation() {
- saveSplitterRatio();
- dialogSettings.put(getDialogstoreVieworientationKey(), orientation);
- if (orientation != VIEW_ORIENTATION_AUTOMATIC) {
- setOrientation(orientation);
- }
- else {
- if (orientation == VIEW_ORIENTATION_SINGLE)
- return;
- Point size= parent.getSize();
- if (size.x != 0 && size.y != 0) {
- if (size.x > size.y)
- setOrientation(VIEW_ORIENTATION_HORIZONTAL);
- else
- setOrientation(VIEW_ORIENTATION_VERTICAL);
- }
- }
- }
-
- private void saveSplitterRatio() {
- if (detailSplitter != null && ! detailSplitter.isDisposed()) {
- int[] weigths = detailSplitter.getWeights();
- int ratio = (weigths[0] * 1000) / (weigths[0] + weigths[1]);
- String key= getDialogStoreRatioKey() + currentOrientation;
- dialogSettings.put(key, ratio);
- }
- }
-
- /**
- * <p>getDialogStoreRatioKey</p>
- *
- * @return a {@link java.lang.String} object.
- */
- protected abstract String getDialogStoreRatioKey();
-
- void setOrientation(int orientation) {
- if (currentOrientation != orientation) {
- if ((getViewer1() != null)
- && !getViewer1().getControl().isDisposed()
- && (detailSplitter != null)
- && !detailSplitter.isDisposed()) {
-
- if (orientation == VIEW_ORIENTATION_SINGLE) {
- setShowViewer2(false);
- } else {
- if (currentOrientation == VIEW_ORIENTATION_SINGLE) {
- setShowViewer2(true);
- }
- boolean horizontal = orientation == VIEW_ORIENTATION_HORIZONTAL;
- detailSplitter.setOrientation(horizontal ? SWT.HORIZONTAL
- : SWT.VERTICAL);
- }
-
- detailSplitter.layout();
- }
-
- updateCheckedState();
-
- currentOrientation = orientation;
-
- restoreSplitterRatio();
- }
- }
-
- /**
- * @param show
- */
- private void setShowViewer2(boolean show) {
- showViewer2 = show;
- showOrHideViewer2();
- }
-
- /**
- *
- */
- private void showOrHideViewer2() {
- if (showViewer2) {
- detailSplitter.setMaximizedControl(null);
- } else {
- detailSplitter.setMaximizedControl(getViewer1().getControl());
- }
- }
-
- private void restoreSplitterRatio() {
- String ratio= dialogSettings.get(getDialogStoreRatioKey() + currentOrientation);
- if (ratio == null)
- return;
- int intRatio= Integer.parseInt(ratio);
- detailSplitter.setWeights(new int[] {intRatio, 1000 - intRatio});
- }
-
- private void updateCheckedState() {
-// for (int i= 0; i < fToggleOrientationActions.length; i++) {
-// fToggleOrientationActions[i].setChecked(fOrientation == fToggleOrientationActions[i].getOrientation());
-// }
- }
-
- /**
- * <p>createViewer1</p>
- *
- * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
- * @return a {@link org.eclipse.jface.viewers.Viewer} object.
- */
- protected abstract Viewer createViewer1(Composite parent);
-
-
- /**
- * <p>createViewer2</p>
- *
- * @param parent a {@link org.eclipse.swt.widgets.Composite} object.
- * @return a {@link org.eclipse.jface.viewers.Viewer} object.
- */
- protected abstract Viewer createViewer2(Composite parent);
-
-
- /**
- * @param pagebook2
- */
- private void createDetailSplitter(Composite parent) {
- detailSplitter = new SashForm(parent, SWT.HORIZONTAL);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- selectionService.removeSelectionListener(this);
- selectionService.removePostSelectionListener(this);
- super.dispose();
- }
-
- /**
- * <p>Getter for the field <code>viewer1</code>.</p>
- *
- * @return a {@link org.eclipse.jface.viewers.Viewer} object.
- */
- protected Viewer getViewer1() {
- return viewer1;
- }
-
- /**
- * <p>Getter for the field <code>viewer2</code>.</p>
- *
- * @return a {@link org.eclipse.jface.viewers.Viewer} object.
- */
- protected Viewer getViewer2() {
- return viewer2;
- }
-}
*/
package eu.etaxonomy.taxeditor.view;
+import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
+import java.util.UUID;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.dialogs.PopupDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
* This class opens a popup dialog and provides the possibility to choose from a
*/
public class CdmViewerChooser extends PopupDialog implements ISelectionChangedListener, ILabelProvider{
+ private Map<Command, String> nameViewerMap;
private Object input;
- private Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap;
public CdmViewerChooser(Shell parentShell) {
this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...",
*/
public void chooseViewer(Object input){
this.input = input;
- this.nameViewerMap = CdmViewerUtil.getNameViewerMap(input);
+ this.nameViewerMap = CdmViewerUtil.getAvailableViewers(input);
//if only one editor is available then open it
if(nameViewerMap.size()==1){
- Entry<Class<?>, String> next = nameViewerMap.keySet().iterator().next();
- ICdmViewer cdmViewer = nameViewerMap.get(next);
- cdmViewer.show(input, next.getKey());
+ Command command = nameViewerMap.keySet().iterator().next();
+ executeCommand(command, input);
}
else{
if(nameViewerMap.isEmpty()){
}
}
+ private void executeCommand(Command command, Object input) {
+ //set uuid parameter
+ if(input instanceof ICdmBase){
+ Map<String, UUID> params = new HashMap<String, UUID>();
+ String commandId = command.getId();
+ params.put(commandId+".uuid", ((ICdmBase) input).getUuid());
+
+ if(command.isEnabled()) {
+
+ //build the parameterized command
+ ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, params);
+
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ try {
+ if(pc!=null){
+ handlerService.executeCommand(pc, null);
+ }
+ else{
+ handlerService.executeCommand(commandId, null);
+ }
+ } catch (NotDefinedException nde) {
+ throw new RuntimeException("Could not find open command: " + commandId);
+ } catch (Exception exception) {
+ MessagingUtils.error(getClass(), "An exception occured while trying execute "+commandId, exception);
+ }
+ }
+ }
+ }
+
@Override
protected Control createDialogArea(Composite parent) {
TableViewer viewer = new TableViewer(new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
ISelection selection = event.getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if(nameViewerMap.containsKey(firstElement)){
- Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement;
- ICdmViewer cdmViewer = nameViewerMap.get(entry);
- cdmViewer.show(input, entry.getKey());
+ if(firstElement instanceof Command && nameViewerMap.containsKey(firstElement)){
+ executeCommand((Command) firstElement, this.input);
this.close();
}
}
@Override
public String getText(Object element) {
- String text = null;
- if(nameViewerMap.containsKey(element)){
- Entry<Class<?>, String> entry = (Entry<Class<?>, String>) element;
- text = entry.getValue();
- }
- return text;
+ return nameViewerMap.get(element);
}
@Override
package eu.etaxonomy.taxeditor.view;
+import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.UUID;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.Messages;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* Generic context menu for opening elements in the taxeditor.
new ContributionItem() {
@Override
public void fill(Menu menu, int index) {
- MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
- addItem.setText("Open in...");
- Menu addMenu = new Menu(menu);
- addItem.setMenu(addMenu);
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final ISelection selection = window.getActivePage().getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap = CdmViewerUtil.getNameViewerMap(firstElement);
- for(Entry<Entry<Class<?>, String>, ICdmViewer> entry:nameViewerMap.entrySet()){
- Entry<Class<?>, String> viewerClass = entry.getKey();
- MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
- menuItem.setText(viewerClass.getValue());
- menuItem.addSelectionListener(new OpenInViewerListener(entry.getValue(), firstElement, viewerClass.getKey()));
+ Map<Command, String> enabledCommands = CdmViewerUtil.getAvailableViewers(firstElement);
+
+ //check if only one or multiple viewers/commands are available
+ if(enabledCommands.size()==1){
+ Entry<Command, String> entry = enabledCommands.entrySet().iterator().next();
+ final Command command = entry.getKey();
+ String viewerName = entry.getValue();
+
+ MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
+ addItem.setText(String.format(Messages.CdmViewerContextMenu_OPEN, viewerName));
+ addItem.addSelectionListener(new CommandInvoker(command, firstElement)) ;
+ }
+ else if(enabledCommands.size()>1){
+ MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
+ addItem.setText(Messages.CdmViewerContextMenu_OPEN_IN);
+ Menu addMenu = new Menu(menu);
+ addItem.setMenu(addMenu);
+ for(Entry<Command, String> entry:enabledCommands.entrySet()){
+ final Command command = entry.getKey();
+ String viewerName = entry.getValue();
+
+ MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
+ menuItem.setText(viewerName);
+ menuItem.addSelectionListener(new CommandInvoker(command, firstElement)) ;
+ }
}
}
}
+
}
};
return contributionItems;
}
- private class OpenInViewerListener extends SelectionAdapter {
+ private final class CommandInvoker extends SelectionAdapter {
+ private final Command command;
+ private Object selectedObject;
- private final ICdmViewer cdmViewer;
- private final Object input;
- private final Class<?> viewerClass;
-
- public OpenInViewerListener(ICdmViewer cdmViewer, Object input, Class<?> viewerClass) {
- super();
- this.cdmViewer = cdmViewer;
- this.input = input;
- this.viewerClass = viewerClass;
+ private CommandInvoker(Command command, Object selectedObject) {
+ this.command = command;
+ this.selectedObject = selectedObject;
}
@Override
public void widgetSelected(SelectionEvent e) {
- cdmViewer.show(input, viewerClass);
+ IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Map<String, UUID> params = new HashMap<String, UUID>();
+ //for generic UuidAndTitleCache objects try to load the object
+ if (selectedObject instanceof UuidAndTitleCache){
+ UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache)selectedObject;
+ Class type = uuidAndTitleCache.getType();
+ if(type == Taxon.class || type == Synonym.class){
+ selectedObject = CdmStore.getService(ITaxonService.class).load(uuidAndTitleCache.getUuid());
+ }
+ else if(SpecimenOrObservationBase.class.isAssignableFrom(type)){
+ selectedObject = CdmStore.getService(IOccurrenceService.class).load(uuidAndTitleCache.getUuid());
+ }
+ }
+ if(selectedObject instanceof ICdmBase){
+ params.put(command.getId()+".uuid", ((ICdmBase) selectedObject).getUuid()); //$NON-NLS-1$
+ }
+ ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params);
+ try {
+ if(parameterizedCommand!=null){
+ handlerService.executeCommand(parameterizedCommand, null);
+ }
+ else{
+ handlerService.executeCommand(command.getId(), null);
+ }
+ } catch (NotDefinedException nde) {
+ throw new RuntimeException("Could not find open command: " + command.getId()); //$NON-NLS-1$
+ } catch (Exception exception) {
+ MessagingUtils.error(getClass(), "An exception occured while trying execute "+command.getId(), exception); //$NON-NLS-1$
+ }
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
}
-
}
}
import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.commands.Command;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
+ * Scans eu.etaxonomy.taxeditor.store.cdmViewer extension point.
* @author pplitzner
* @date Jul 7, 2015
*
*/
public class CdmViewerUtil {
- public static Map<Entry<Class<?>, String>, ICdmViewer> getNameViewerMap(Object input){
- Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap = new HashMap<Entry<Class<?>, String>, ICdmViewer>();
-
- IExtensionRegistry reg = Platform.getExtensionRegistry();
- IConfigurationElement[] extensions = reg
- .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
- for (IConfigurationElement configElement : extensions) {
- try {
- Object object = configElement.createExecutableExtension("class");
- if(object instanceof ICdmViewer){
- ICdmViewer cdmViewer = (ICdmViewer)object;
- Map<Class<?>, String> viewerClasses = cdmViewer.getViewerClasses(input);
- for (Entry<Class<?>, String> entry : viewerClasses.entrySet()) {
- nameViewerMap.put(entry, cdmViewer);
- }
+ /**
+ * Returns a map of available commands to open the given input.
+ * Keys are the command IDs and values are their string representations.
+ *
+ * @param input
+ * the object which should be handled by the available commands
+ * @return a key-value map of available commands and their string
+ * representation
+ */
+ public static Map<Command, String> getAvailableViewers(Object input){
+ Map<Command, String> commandViewerNameMap = new HashMap<Command, String>();
+
+ if(input!=null){
+ //for generic UuidAndTitleCache objects try to load the object
+ if (input instanceof UuidAndTitleCache){
+ UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache)input;
+ Class type = uuidAndTitleCache.getType();
+ if(type == Taxon.class || type == Synonym.class){
+ input = CdmStore.getService(ITaxonService.class).load(uuidAndTitleCache.getUuid());
}
- else{
- MessagingUtils.error(CdmViewerChooser.class, new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, "Could not load cdmViewer extension"));
+ else if(SpecimenOrObservationBase.class.isAssignableFrom(type)){
+ input = CdmStore.getService(IOccurrenceService.class).load(uuidAndTitleCache.getUuid());
+ }
+ }
+
+
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer"); //$NON-NLS-1$
+ for (IConfigurationElement configElement : extensions) {
+ if(configElement.getName().equals("viewCommandMapping")){ //$NON-NLS-1$
+ try {
+ String commandId = configElement.getAttribute("commandId"); //$NON-NLS-1$
+ String viewerName = configElement.getAttribute("viewerName"); //$NON-NLS-1$
+ Class<?> selectionClass = Class.forName(configElement.getAttribute("selection")); //$NON-NLS-1$
+ if(selectionClass.isAssignableFrom(input.getClass())){
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ Command command = commandService.getCommand(commandId);
+ //TODO: maybe pass the command directly instead of just the command id
+ if(command.isEnabled()){
+ commandViewerNameMap.put(command, viewerName);
+ }
+ }
+ } catch (ClassNotFoundException e) {
+ MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e); //$NON-NLS-1$
+ }
}
- } catch (CoreException e) {
- MessagingUtils.error(CdmViewerChooser.class, "Could not load cdmViewer extension", e);
}
}
- return nameViewerMap;
+ return commandViewerNameMap;
}
}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2015 EDIT
-* 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.view;
-
-import java.util.Map;
-
-
-/**
- * Implementors of this interface provide a mapping of input elements to views
- * or editors which can display information or provide editing functionality for
- * the input elements.
- *
- * @author pplitzner
- * @date Feb 23, 2015
- *
- */
-public interface ICdmViewer {
-
- /**
- * For the given input a map is returned specifying the available viewer
- * classes as keys and their string representation as values
- *
- * @param input
- * the input for which the viewer classes should be returned
- * @return a map holding the viewer classes as keys and their string
- * representations as values
- */
- public Map<Class<?>, String> getViewerClasses(Object input);
-
- /**
- * Opens the viewer defined by the given viewerClass for the given input.
- * @param input the input for which a viewer should be opened
- * @param viewerClass the qualified class name of the viewer
- */
- public void show(Object input, Class<?> viewerClass);
-
-}
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.io.IOException;
import java.io.InputStream;
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.transientServices.TransientCdmRepository;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
InputStream resultStream;
resultStream = new BioCaseQueryServiceWrapper().query(query, endPoint);
Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(resultStream, null, false);
- TransientCdmRepository repo =
+ /* TransientCdmRepository repo =
new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
configurator.setCdmAppController(repo);
-
+*/
CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
importer.invoke(configurator);
- results = repo.getUnits();
+ // results = repo.getUnits();
setResults(results);
} catch (ClientProtocolException e) {
logger.error(errorMessage, e);
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.util.Collection;
-package eu.etaxonomy.taxeditor.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.io.IOException;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.CompoundContributionItem;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
try{
DataSetResponse response = new GbifQueryServiceWrapper().queryOriginalDataSet(gbifResponse);
final BioCaseEditorInput input = new BioCaseEditorInput(new OccurenceQuery(response.getUnitId()), response.getEndpoint());
- EditorUtil.open(input);
+ // EditorUtil.open(input);
Job queryJob = new Job("Querying for original record...") {
@Override
logger.error("Query for single record failed.", e);
} catch (IOException e) {
logger.error("Query for single record failed.", e);
- } catch (PartInitException e) {
- logger.error("Could not open editor.", e);
}
+// } catch (PartInitException e) {
+// logger.error("Could not open editor.", e);
+// }
}
});
}
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.util.Collection;
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.util.ArrayList;
import java.util.Collection;
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
*/
public class GbifImportEditor extends DataImportEditor<GbifResponse>{
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor";
+ public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.GbifImportEditor";
/**
* Required for extension point
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor#getTextForTableItem(java.lang.Object)
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportEditor#getTextForTableItem(java.lang.Object)
*/
@Override
protected String getTextForTableItem(GbifResponse item) {
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.io.IOException;
import java.net.URISyntaxException;
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.io.IOException;
import java.net.URISyntaxException;
public class GbifResponseImportView extends DataImportView<GbifResponse> {
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.dataimport.GbifResponseImportView";
+ public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView";
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
*/
@Override
protected String getTextForTableItem(GbifResponse item) {
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#query()
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#query()
*/
@Override
public void query() {
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
/**
* Enumeration of possible specimen provider types
-package eu.etaxonomy.taxeditor.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import org.apache.log4j.Logger;
import org.eclipse.jface.action.Action;
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
*/
public class SpecimenImportEditor extends DataImportEditor<SpecimenOrObservationBase<?>> {
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor";
+ public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportEditor";
/**
* Required for extension point
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor#getTextForTableItem(eu.etaxonomy.cdm.model.common.IIdentifiableEntity)
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportEditor#getTextForTableItem(eu.etaxonomy.cdm.model.common.IIdentifiableEntity)
*/
@Override
protected String getTextForTableItem(SpecimenOrObservationBase<?> item) {
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import org.apache.http.client.ClientProtocolException;
+import org.eclipse.core.runtime.jobs.Job;
import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.view.dataimport.transientServices.TransientCdmRepository;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
public class SpecimenImportView extends DataImportView<SpecimenOrObservationBase<?>> {
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"; //$NON-NLS-1$
+ public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView"; //$NON-NLS-1$
private URI endPoint;
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
*/
@Override
protected String getTextForTableItem(SpecimenOrObservationBase<?> item) {
}
/* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#query()
+ * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#query()
*/
@Override
public void query() {
//FIXME move ABCD import to cdmlib -> this will also get rid of the transient services
InputStream resultStream;
resultStream = new BioCaseQueryServiceWrapper().query(query, endPoint);
- Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(resultStream, null, false);
- TransientCdmRepository repo =
- new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
- configurator.setCdmAppController(repo);
+ Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(null, null);
+// TransientCdmRepository repo =
+// new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
+ //configurator.setCdmAppController(repo);
configurator.setAddMediaAsMediaSpecimen(true);
-
- CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
- importer.invoke(configurator);
- results = repo.getUnits();
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, resultStream, SOURCE_TYPE.INPUTSTREAM);
+ CdmStore.getImportManager().run(job);
+ } else {
+ configurator.setSource(resultStream);
+ CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>();
+ importer.invoke(configurator);
+ }
+ // results = repo.getUnits();
setResults(results);
} catch (ClientProtocolException e) {
logger.error(errorMessage, e);
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.net.MalformedURLException;
import java.net.URI;
private SpecimenProviderSelectionController specimenProviderSelectionController;
private URI endPoint;
- protected SpecimenProviderSelectionWizardPage(String pageName) {
+ public SpecimenProviderSelectionWizardPage(String pageName) {
super(pageName);
setTitle("Select Specimen Provider");
setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
}
+
+
}
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
DataImportView<?> dataImportView = null;
query = searchPage.getQuery();
- try {
- switch (providerSelectionPage.getQueryType()) {
- case BIOCASE:
- SpecimenImportView specimenImportView = (SpecimenImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .showView(SpecimenImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
- specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
- dataImportView = specimenImportView;
- break;
- case GBIF:
- dataImportView = (GbifResponseImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
- break;
- }
- } catch ( PartInitException e ) {
- logger.error("Could not open import view for query: " + query.toString(), e);
+ Abcd206ImportConfigurator configurator = CdmStore.getImportManager().AbcdConfigurator();
+ configurator.setOccurenceQuery(query);
+ configurator.setSourceUri(providerSelectionPage.getEndPoint());
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ if(CdmStore.getCurrentSessionManager().isRemoting()) {
+ //Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+ //CdmStore.getImportManager().run(job);
+
+ CdmStore.getImportManager().run(configurator);
}
- if(dataImportView!=null){
- dataImportView.setQuery(query);
-// dataImportView.query();
-// Display.getDefault().asyncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-// CdmStore.getContextManager().notifyContextRefresh();
-// }
-// });
+// try {
+// switch (providerSelectionPage.getQueryType()) {
+// case BIOCASE:
+// SpecimenImportView specimenImportView = (SpecimenImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
+// .showView(SpecimenImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
+// specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
+// dataImportView = specimenImportView;
+// break;
+// case GBIF:
+// dataImportView = (GbifResponseImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
+// .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
+// break;
+// }
+// } catch ( PartInitException e ) {
+// logger.error("Could not open import view for query: " + query.toString(), e);
+// }
+// if(dataImportView!=null){
+// dataImportView.setQuery(query);
+//// dataImportView.query();
+//// Display.getDefault().asyncExec(new Runnable() {
+////
+//// @Override
+//// public void run() {
+//// CdmStore.getContextManager().notifyContextRefresh();
+//// }
+//// });
Job queryJob = new QueryJob("Query specimen provider", dataImportView);
queryJob.schedule();
- }
+
return true;
}
* 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.editor.view.dataimport;
+package eu.etaxonomy.taxeditor.view.dataimport;
import java.util.Calendar;
// $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.
*/
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
+import eu.etaxonomy.taxeditor.Messages;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
- * <p>ChangeConnectionHandler class.</p>
- *
* @author n.hoffmann
* @created 15.04.2009
* @version 1.0
*/
public class ChangeConnectionHandler extends AbstractHandler {
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) {
+ @Override
+ public Object execute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getCurrentSelection(event);
-
+
if(selection != null && selection instanceof IStructuredSelection){
CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) ((IStructuredSelection) selection).getFirstElement();
-
+
if(CdmStore.isConnecting()){
- MessagingUtils.warningDialog("Already connecting", this, "You are currently connecting to a different datasource already.");
+ MessagingUtils.warningDialog(Messages.ChangeConnectionHandler_ALREADY_CONNECTING, this, Messages.ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY);
return null;
}
-
+
try {
container.getCdmSource().checkConnection();
- boolean confirmed = MessagingUtils.confirmDialog("Confirm Datasource Connection", "Do you really want to connect to this datasource?\n\n"
+ boolean confirmed = MessagingUtils.confirmDialog(Messages.ChangeConnectionHandler_CONFIRM_DATASOURCE, Messages.ChangeConnectionHandler_REALLY_WANT_TO_CONNECT
+ container.getCdmSource().getName());
-
+
if(confirmed){
CdmDataSourceRepository.changeDataSource(container.getCdmSource());
}
} catch (Exception e) {
- MessagingUtils.warningDialog("Chosen datasource is not available", this, "This could mean that either the database server is " +
- "not running or the machine is not reachable.\n\n" +
- "Please also make sure that you are connected to the network when trying to connect to a remote datasource.");
+ MessagingUtils.warningDialog(Messages.ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE, this, Messages.ChangeConnectionHandler_NOT_AVAILABLE_REASONS);
MessagingUtils.warn(getClass(), e);
return null;
- }
+ }
}
-
+
return null;
}
}
// $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.
*/
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
- * <p>DeleteDataSourceHandler class.</p>
- *
* @author n.hoffmann
* @created 15.04.2009
* @version 1.0
*/
public class DeleteDataSourceHandler extends AbstractDataSourceHandler {
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
- */
/** {@inheritDoc} */
@Override
public boolean specificExecute(ExecutionEvent event) {
ISelection selection = HandlerUtil.getActivePart(event).getSite().getSelectionProvider().getSelection();
if(selection instanceof IStructuredSelection){
Object[] selectedObjects = ((IStructuredSelection) selection).toArray();
-
+
if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you want to delete the selected datasources?")){
return false;
}
- // Delete from persistent data sources
+ // Delete from persistent data sources
for(Object object : selectedObjects){
CdmPersistentDataSource dataSource = (CdmPersistentDataSource) ((CdmMetaDataAwareDataSourceContainer) object).getCdmSource();
CdmDataSourceRepository.delete(dataSource);
}
-
+
return true;
}
return false;
package eu.etaxonomy.taxeditor.view.derivateSearch;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
-import java.util.UUID;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.jface.viewers.Viewer;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.store.CdmStore;
public class DerivateContentProvider implements ITreeContentProvider {
+ List<TreeNode> rootNodes;
+
@Override
public void dispose() {
// TODO Auto-generated method stub
}
+ public List<SpecimenOrObservationBase> getRootElements() {
+ List<SpecimenOrObservationBase> elements = new ArrayList<SpecimenOrObservationBase>();
+
+ if(rootNodes != null) {
+ for(TreeNode node : rootNodes) {
+ elements.add((SpecimenOrObservationBase)node.getValue());
+ }
+ }
+ return elements;
+ }
+
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public Object[] getElements(Object inputElement) {
- List<TreeNode> rootElements = new ArrayList<TreeNode>();
- if(inputElement instanceof Set){
- for (Object o: (Set)inputElement) {
- if(o instanceof UUID){
- UUID uuid = (UUID)o;
- SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(uuid);
+ rootNodes = new ArrayList<TreeNode>();
+ if(inputElement instanceof Collection){
+ for (Object o: (Collection)inputElement) {
+ if(o instanceof SpecimenOrObservationBase){
+ SpecimenOrObservationBase<?> rootElement = (SpecimenOrObservationBase<?>)o;
if(rootElement!=null){
- rootElements.add(new TreeNode(rootElement));
+ rootNodes.add(new TreeNode(rootElement));
}
}
}
}
- return rootElements.toArray();
+ return rootNodes.toArray();
}
@Override
node.setParent(currentnode);
children.add(node);
}
- return children.toArray();
}
else if(value instanceof Sequence){
Set<SingleRead> singleReads = ((Sequence) value).getSingleReads();
}
return children.toArray();
}
- else if(value instanceof SpecimenOrObservationBase){
+
+ if(value instanceof SpecimenOrObservationBase){
List<DerivedUnit> derivates = getDerivates((SpecimenOrObservationBase<?>) value);
for (DerivedUnit derivedUnit:derivates) {
TreeNode node = new TreeNode(derivedUnit);
else if(element instanceof Sequence){
return !((Sequence)element).getSingleReads().isEmpty();
}
- else if(element instanceof SpecimenOrObservationBase){
+
+ if(element instanceof SpecimenOrObservationBase){
SpecimenOrObservationBase<?> specimenOrObservation = (SpecimenOrObservationBase<?>)element;
for(DerivationEvent event:specimenOrObservation.getDerivationEvents()){
if(!event.getDerivatives().isEmpty()){
*/
package eu.etaxonomy.taxeditor.view.derivateSearch;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.format.CdmFormatterFactory;
+import eu.etaxonomy.cdm.format.ICdmFormatter;
+import eu.etaxonomy.cdm.format.ICdmFormatter.FormatKey;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
private static final String NO_SAMPLE_DESIGNATION = "[no sample designation]";
- private Set<SingleRead> multiLinkSingleReads;
+ private static Set<SingleRead> multiLinkSingleReads;
+ private static Map<DerivedUnit, Collection<SpecimenTypeDesignation>> typeDesignations;
+
private ConversationHolder conversation;
private static DefinedTerm photoTerm = null;
/** {@inheritDoc} */
@Override
public String getText(Object element) {
- return getDerivateText(element);
+ if(element instanceof TreeNode){
+ element = ((TreeNode) element).getValue();
+ }
+ FormatKey[] formatKeys = {
+ FormatKey.GATHERING_COUNTRY, FormatKey.SPACE,
+ FormatKey.GATHERING_LOCALITY_TEXT, FormatKey.SPACE,
+ FormatKey.GATHERING_DATE, FormatKey.SPACE,
+ FormatKey.GATHERING_COLLECTOR, FormatKey.SPACE,
+ FormatKey.FIELD_NUMBER, FormatKey.SPACE,
+ FormatKey.COLLECTION_CODE, FormatKey.SPACE,
+ FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE,
+// FormatKey.KIND_OF_UNIT, FormatKey.SPACE,
+ FormatKey.SAMPLE_DESIGNATION, FormatKey.SPACE,
+ FormatKey.SINGLE_READ_PRIMER, FormatKey.SPACE,
+ FormatKey.SEQUENCE_DNA_MARKER, FormatKey.SPACE,
+ FormatKey.AMPLIFICATION_LABEL, FormatKey.SPACE,
+ FormatKey.MEDIA_TITLE, FormatKey.SPACE,
+ FormatKey.MEDIA_ARTIST, FormatKey.SPACE
+ };
+ return CdmFormatterFactory.format(element, formatKeys);
}
/** {@inheritDoc} */
derivate = node.getValue();
}
- conversation.bind();
+ if(conversation!=null){
+ conversation.bind();
+ }
final String emptyString = "";
final String separator = " ";
FieldUnit fieldUnit = (FieldUnit)derivate;
if(fieldUnit.getGatheringEvent()!=null){
GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
- if(CdmStore.getService(IOccurrenceService.class).exists(fieldUnit.getUuid()) && !conversation.getSession().contains(gatheringEvent)){
- fieldUnit = (FieldUnit) CdmStore.getService(IOccurrenceService.class).load(fieldUnit.getUuid());
- gatheringEvent = fieldUnit.getGatheringEvent();
- }
label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+separator:emptyString;
label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+separator:emptyString;
label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+separator:emptyString;
else if(derivate instanceof DerivedUnit){
DerivedUnit derivedUnit = (DerivedUnit)derivate;
if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
- java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
- if(fieldUnits!=null && !fieldUnits.isEmpty()){
- FieldUnit fieldUnit = fieldUnits.iterator().next();
- GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
-// gatheringEvent = HibernateProxyHelper.deproxy(gatheringEvent, GatheringEvent.class);
- if(gatheringEvent!=null){
- label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
+ //check for type designation
+ if(typeDesignations.get(derivedUnit)==null){
+ for (SpecimenTypeDesignation specimenTypeDesignation : CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnit, null, null, null, null)) {
+ addTypeDesignation(derivedUnit, specimenTypeDesignation);
}
- label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
}
+ //java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
+ //TODO : This is not generic anymore for performance reasons
+ Set<SpecimenOrObservationBase> originals = derivedUnit.getOriginals();
+ if(originals!=null && originals.size() ==1) {
+ SpecimenOrObservationBase specimen = originals.iterator().next();
+ if(specimen instanceof FieldUnit) {
+ FieldUnit fieldUnit = (FieldUnit)specimen;
+ GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
+ if(gatheringEvent!=null){
+ label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
+ }
+ label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
+ }
+ }
+
eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();
if(collection!=null){
label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
}
- String mostSignificantIdentifier = CdmStore.getService(IOccurrenceService.class).getMostSignificantIdentifier(derivedUnit);
+ String mostSignificantIdentifier = derivedUnit.getMostSignificantIdentifier();
label += mostSignificantIdentifier!=null?mostSignificantIdentifier+separator:emptyString;
}
else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
return label;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
- */
@Override
public Image getImage(Object element) {
if(element instanceof TreeNode){
boolean hasCharacterData = false;
if(cdmBase.isInstanceOf(SpecimenOrObservationBase.class)){
SpecimenOrObservationBase<?> specimen = HibernateProxyHelper.deproxy(cdmBase, SpecimenOrObservationBase.class);
- if(!CdmStore.getService(IOccurrenceService.class).getCharacterDataForSpecimen(specimen).isEmpty()){
+ if(specimen.hasCharacterData()){
hasCharacterData = true;
}
}
}
else if(cdmBase.isInstanceOf(DerivedUnit.class)){
DerivedUnit derivedUnit = HibernateProxyHelper.deproxy(element, DerivedUnit.class);
+
if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){
return hasCharacterData?ImageResources.getImage(ImageResources.FIELD_UNIT_CHARACTER_DATA):ImageResources.getImage(ImageResources.FIELD_UNIT);
}
return hasCharacterData?ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE);
}
else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
+ if(typeDesignations.get(derivedUnit)!=null && !typeDesignations.get(derivedUnit).isEmpty()){
+ return ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_TYPE);
+ }
return hasCharacterData?ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE);
}
else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.Media){
}
else if(cdmBase.isInstanceOf(SingleRead.class)){
- if(multiLinkSingleReads.contains(element)){
+ if(multiLinkSingleReads!=null && multiLinkSingleReads.contains(element)){
return ImageResources.getImage(ImageResources.SINGLE_READ_DERIVATE_MULTILINK);
}
else{
return null;
}
- /**
- * @param multiLinkSingleReads2
- */
- public void setMultiLinkSingleReads(Set<SingleRead> multiLinkSingleReads) {
- this.multiLinkSingleReads = multiLinkSingleReads;
+ private static void addTypeDesignation(DerivedUnit derivedUnit, SpecimenTypeDesignation typeDesignation){
+ Collection<SpecimenTypeDesignation> list = typeDesignations.get(derivedUnit);
+ if(list==null){
+ list = new ArrayList<SpecimenTypeDesignation>();
+ }
+ list.add(typeDesignation);
+ typeDesignations.put(derivedUnit, list);
+ }
+
+ public static Set<SingleRead> getMultiLinkSingleReads() {
+ return multiLinkSingleReads;
+ }
+
+ public void updateLabelCache(Collection<SpecimenOrObservationBase<?>> rootElements) {
+ multiLinkSingleReads = new HashSet<SingleRead>();
+ typeDesignations = new HashMap<DerivedUnit, Collection<SpecimenTypeDesignation>>();
+ for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
+ if(entry.getValue().size()>1){
+ multiLinkSingleReads.add(entry.getKey());
+ }
+ }
+ if(rootElements!=null){
+ Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
+ for (SpecimenOrObservationBase specimenOrObservationBase : rootElements) {
+ derivedUnits.addAll(CdmStore.getService(IOccurrenceService.class).getAllChildDerivatives(specimenOrObservationBase.getUuid()));
+ if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
+ derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
+ }
+ }
+ typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null);
+ }
}
}
+++ /dev/null
-// $Id$
-/**
- * Copyright (C) 2013 EDIT
- * 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.view.derivateSearch;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.part.ViewPart;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.model.IContextListener;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * This view allows to search for and filter {@link SpecimenOrObservationBase}s and display
- * the results in a list. The results can be selected and opened in an editor.
- */
-public class DerivateSearchView extends ViewPart implements IContextListener {
-
- public static final String ID = "eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView";
- private DerivateSearchCompositeController derivateSearchCompositeController;
- private ConversationHolder conversationHolder;
-
- /**
- * Constructs a new DerivateSearchView and registers it to listen to context changes
- */
- public DerivateSearchView() {
- CdmStore.getContextManager().addContextListener(this);
- }
-
- @Override
- public void createPartControl(Composite parent) {
- derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
- getSite().setSelectionProvider(derivateSearchCompositeController.getResultViewer());
- derivateSearchCompositeController.setEnabled(CdmStore.isActive());
-
- //create context menu
- MenuManager menuManager = new MenuManager();
- getSite().registerContextMenu(menuManager, derivateSearchCompositeController.getResultViewer());
- Control control = derivateSearchCompositeController.getResultViewer().getControl();
- Menu menu = menuManager.createContextMenu(control);
- control.setMenu(menu);
- }
-
- @Override
- public void setFocus() {
- derivateSearchCompositeController.setFocus();
- //make sure to bind again if maybe in another view the conversation was unbound
- if(getConversationHolder()!=null && !getConversationHolder().isClosed() && !getConversationHolder().isBound()){
- getConversationHolder().bind();
- }
- }
-
- @Override
- public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
- }
-
- @Override
- public void contextStop(IMemento memento, IProgressMonitor monitor) {
- derivateSearchCompositeController.setEnabled(false);
- derivateSearchCompositeController.reset();
- }
-
- @Override
- public void contextStart(IMemento memento, IProgressMonitor monitor) {
- derivateSearchCompositeController.setEnabled(true);
- }
-
- @Override
- public void contextRefresh(IProgressMonitor monitor) {
- initConversation();
- }
-
- private void initConversation(){
- if(conversationHolder==null){
- conversationHolder = CdmStore.createConversation();
- derivateSearchCompositeController.setConversation(conversationHolder);
- }
- }
-
- @Override
- public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
- }
-
- public ConversationHolder getConversationHolder() {
- if(CdmStore.isActive() && conversationHolder==null){
- initConversation();
- }
- return conversationHolder;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- if(conversationHolder!=null){
- conversationHolder.close();
- }
- }
-}
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.Feature;
@Override
protected void selectionChanged_internal(IWorkbenchPart part, ISelection selection){
- if(AbstractUtility.getActiveEditor() == null){
+ if(AbstractUtility.getActiveEditor() == null && !(AbstractUtility.getActivePart() instanceof IConversationEnabled)){
showEmptyPage();
return;
}
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.DerivedUnitTypeDesignationSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
private ISelection selection;
- /**
- * <p>
- * Constructor for DetailsViewer.
- * </p>
- *
- * @param parent
- * a {@link org.eclipse.swt.widgets.Composite} object.
- * @param viewPart
- * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
- * object.
- */
public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
super(parent, viewPart);
}
}
- /**
- * @param rootElement
- */
private void createEmptySection(RootElement parent) {
destroySections();
addPart(emptySection);
}
- /**
- * @param rootElement
- */
private void createGroupSection(RootElement parent) {
destroySections();
addPart(grantedAuthorityDetailSection);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.Viewer#getSelection()
- */
/** {@inheritDoc} */
@Override
public ISelection getSelection() {
}
}
- /**
- * createTaxonSections(RootElement parent)
- *
- * @param parent
- */
private void createTaxonSections(RootElement parent) {
destroySections();
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ NonViralNameDetailSection nonViralNameSection = formFactory
+ .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
addPart(nameRelationshipSection);
}
-
addPart(parsingMessagesSection);
addPart(taxonBaseDetailSection);
addPart(nonViralNameSection);
addPart(referenceDetailSection);
}
- /**
- * createNameSections
- *
- * @param parent
- */
private void createNameSections(RootElement parent) {
destroySections();
- NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
+ getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
}
}
- /**
- * createReferenceSections
- *
- * @param parent
- */
private void createReferenceSections(RootElement parent) {
destroySections();
addPart(referenceDetailSection);
}
- /**
- * createTeamOrPersonBaseDetailSection
- *
- * @param parent
- */
private void createTeamOrPersonBaseDetailSection(RootElement parent) {
destroySections();
TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(teamOrPersonBaseDetailSection);
}
- /**
- * createTeamDetailSection
- *
- * @param parent
- */
private void createTeamDetailSection(RootElement parent) {
destroySections();
TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(teamDetailSection);
}
- /**
- * createPersonDetailSection
- *
- * @param parent
- */
private void createPersonDetailSection(RootElement parent) {
destroySections();
PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(personDetailSection);
}
- /**
- * createDescriptionElementSection
- *
- * @param parent
- */
private void createDescriptionElementSection(RootElement parent) {
destroySections();
addPart(descriptionElementMediaSection);
}
- /**
- * createDescriptionSection
- *
- * @param parent
- */
private void createDescriptionSection(RootElement parent) {
destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+// DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+//
+// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
// DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
// .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
addPart(descriptionDetailSection);
addPart(naturalLanguageSection);
- addPart(describedSpecimenSection);
+// addPart(describedSpecimenSection);
// addPart(descriptionSourceSection);
addPart(scopeSection);
}
- /**
- * createDescriptionSection
- *
- * @param parent
- */
private void createSpecimenDescriptionSection(RootElement parent) {
destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(descriptionDetailSection);
}
- /**
- * Creates the use Description section
- *
- * @param parent
- */
private void createUseDescriptionSection(RootElement parent) {
destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
}
-
- /**
- * @param rootElement
- */
private void createImageGallerySection(RootElement parent) {
destroySections();
DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(descriptionDetailSection);
}
- /**
- * createMediaElementSection
- *
- * @param parent
- */
-
private void createMediaElementSection(RootElement parent) {
destroySections();
addPart(mediaDetailSection);
}
- /**
- * createDerivedUnitBaseElementSection
- *
- * @param parent
- */
private void createDerivedUnitBaseElementSection(RootElement parent) {
destroySections();
FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(fieldUnitDetailSection);
}
+ else{
+ if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(taxonAssociationDetailSection);
+ }
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ addPart(identifierDetailSection);
+ }
if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(determinationDetailSection);
}
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- addPart(taxonAssociationDetailSection);
- }
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- addPart(identifierDetailSection);
+ DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ addPart(derivedUnitTypeDesignationSection);
}
}
-
-
- /**
- * @param rootElement
- */
private void createFeatureDistributionSection(RootElement parent) {
destroySections();
addPart(featureDistributionSection);
}
- /**
- * createPolytomousKeyNodeSection
- *
- * @param parent
- */
private void createPolytomousKeyNodeSection(RootElement parent) {
destroySections();
- PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
+ PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
-
addPart(polytomousKeyDetailSection);
addPart(polytomousKeyNodeDetailSection);
- addPart(taxonomicScopeSection);
}
- /**
- * create the UseRecordSection
- *
- * @param parent
- */
private void createUseRecordSection(RootElement parent) {
destroySections();
}
- /**
- * createUserSection
- *
- * @param parent
- */
private void createUserSection(RootElement parent) {
destroySections();
addPart(groupByUserDetailSection);
}
- /**
- * createTaxonRelationshipSection
- *
- * @param parent
- */
private void createTaxonRelationshipSection(RootElement parent) {
destroySections();
addPart(referencedEntityBaseDetailSection);
}
- /**
- * @param rootElement
- */
private void createTermVocabularySection(RootElement parent) {
destroySections();
addPart(termVocabularyDetailSection);
}
- /**
- * createDefinedTermSection
- *
- * @param parent
- */
private void createDefinedTermSection(RootElement parent) {
destroySections();
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.view.sessions;
+
+import java.util.List;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StyledCellLabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult;
+import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult.CdmEntityInfo;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 17 Feb 2015
+ *
+ */
+public class InspectSessionsDialog extends Dialog {
+
+ protected Object result;
+ protected Shell shlInspectSessions;
+ private Text txtDebugInfo;
+ private Label lblDebugInformation;
+
+ private final Cache cdmlibModelCache;
+
+ private final ICdmEntitySession activeSession;
+
+ private TreeViewer treeViewer;
+ private Button btnClose;
+ EntityCacherDebugResult ecdr;
+ private SashForm sashForm;
+ private Composite compositeDebug;
+ /**
+ * Create the dialog.
+ * @param parent
+ * @param style
+ */
+ public InspectSessionsDialog(Shell parent, int style) {
+ super(parent, style);
+ setText("Inspect Active Session");
+ cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
+ activeSession = CdmStore.getCurrentSessionManager().getActiveSession();
+ ecdr = activeSession.debug();
+ }
+
+ /**
+ * Open the dialog.
+ * @return the result
+ */
+ public Object open() {
+
+ createContents();
+ setDebugInfoText();
+ treeViewer.setContentProvider(new SessionsTreeContentProvider());
+ treeViewer.setLabelProvider(new SessionsTreeLabelProvider());
+ treeViewer.setInput(getRootElements());
+ shlInspectSessions.open();
+ shlInspectSessions.layout();
+ Display display = getParent().getDisplay();
+ while (!shlInspectSessions.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Create contents of the dialog.
+ */
+ private void createContents() {
+ shlInspectSessions = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE);
+ shlInspectSessions.setSize(641, 631);
+ shlInspectSessions.setText("Inspect Sessions");
+ shlInspectSessions.setLayout(new GridLayout(1, false));
+
+ sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL);
+ sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ PatternFilter filter = new PatternFilter();
+ FilteredTree tree = new FilteredTree(sashForm, SWT.MULTI | SWT.H_SCROLL | SWT.BORDER
+ | SWT.V_SCROLL, filter, true);
+ treeViewer = tree.getViewer();
+ //treeViewer = new TreeViewer(sashForm, SWT.BORDER);
+ //Tree tree = treeViewer.getTree();
+
+ compositeDebug = new Composite(sashForm, SWT.NONE);
+ compositeDebug.setLayout(new GridLayout(1, false));
+
+ lblDebugInformation = new Label(compositeDebug, SWT.NONE);
+ lblDebugInformation.setAlignment(SWT.CENTER);
+ lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+ lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblDebugInformation.setText("Debug Information");
+
+ txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
+ txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ sashForm.setWeights(new int[] {338, 184});
+
+ btnClose = new Button(shlInspectSessions, SWT.NONE);
+ btnClose.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ shlInspectSessions.dispose();
+ }
+ });
+ GridData gd_btnClose = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_btnClose.widthHint = 70;
+ btnClose.setLayoutData(gd_btnClose);
+ btnClose.setText("Close");
+
+ }
+
+ private void setDebugInfoText() {
+ txtDebugInfo.setText(ecdr.toString());
+ }
+ private CdmEntityInfo[] getRootElements() {
+
+ List<CdmEntityInfo> rootElemnts = ecdr.getRootElements();
+ return rootElemnts.toArray(new CdmEntityInfo[rootElemnts.size()]);
+ }
+
+ class SessionsTreeContentProvider implements ITreeContentProvider {
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return (CdmEntityInfo[])inputElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ List<CdmEntityInfo> children = ((CdmEntityInfo)parentElement).getChildren();
+ return children.toArray();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ CdmEntityInfo cei = (CdmEntityInfo)element;
+ return cei.getParent();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ List<CdmEntityInfo> children = ((CdmEntityInfo)element).getChildren();
+ if(children != null && !children.isEmpty()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(String className) {
+ Element e = cdmlibModelCache.get(className);
+ if (e == null) {
+ return null;
+ } else {
+ return (CdmModelFieldPropertyFromClass) e.getObjectValue();
+ }
+ }
+
+ }
+
+ class SessionsTreeLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ CdmEntityInfo cei = (CdmEntityInfo)cell.getElement();
+ StyledString text = new StyledString();
+ if(cei != null) {
+ text.append(cei.getLabel());
+ }
+ cell.setText(text.toString());
+ cell.setStyleRanges(text.getStyleRanges());
+ super.update(cell);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ CdmEntityInfo cei = (CdmEntityInfo)element;
+ return cei.getLabel();
+ }
+ }
+}
+
+
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.view.sessions;
+
+import java.text.DecimalFormat;
+import java.util.Collection;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.statistics.LiveCacheStatistics;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.wb.swt.SWTResourceManager;
+
+import eu.etaxonomy.cdm.api.cache.CdmCacher;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+import eu.etaxonomy.taxeditor.session.NullSession;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 16 Feb 2015
+ *
+ */
+public class SessionsViewPart extends ViewPart implements ICdmEntitySessionManagerObserver {
+
+ public static final String ID = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"; //$NON-NLS-1$
+ public static final String OPEN_INSPECT_SESSIONS_DIALOG_ID = "eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog";
+ private Table tableSessions;
+
+ private final String[] titles = { "Owner", "In Memory", "On Disk"};
+
+ private final ICdmEntitySessionManager cdmEntitySessionManager;
+ private Text txtNoOfSessions;
+ private Text txtNoOfCaches;
+ private Text txtDefaultInMemory;
+ private Text txtCdmModelInMemory;
+ private Text txtCdmModelOnDisk;
+ private Text txtDefaultOnDisk;
+
+ public SessionsViewPart() {
+ this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
+ if(cdmEntitySessionManager != null) {
+ cdmEntitySessionManager.addSessionObserver(this);
+ }
+ }
+
+ /**
+ * Create contents of the view part.
+ * @param parent
+ */
+ @Override
+ public void createPartControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+ container.setLayout(new GridLayout(5, false));
+ {
+ Label lblNoOfSessions = new Label(container, SWT.NONE);
+ lblNoOfSessions.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblNoOfSessions.setAlignment(SWT.RIGHT);
+ GridData gd_lblNoOfSessions = new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1);
+ gd_lblNoOfSessions.widthHint = 115;
+ gd_lblNoOfSessions.minimumHeight = 30;
+ lblNoOfSessions.setLayoutData(gd_lblNoOfSessions);
+ lblNoOfSessions.setText("No. of Sessions : ");
+ }
+ {
+ txtNoOfSessions = new Text(container, SWT.BORDER);
+ txtNoOfSessions.setEditable(false);
+ txtNoOfSessions.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
+ GridData gd_txtNoOfSessions = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtNoOfSessions.widthHint = 50;
+ txtNoOfSessions.setLayoutData(gd_txtNoOfSessions);
+ }
+ new Label(container, SWT.NONE);
+ new Label(container, SWT.NONE);
+ new Label(container, SWT.NONE);
+ {
+ Label lblNoOfCaches = new Label(container, SWT.CENTER);
+ lblNoOfCaches.setAlignment(SWT.RIGHT);
+ lblNoOfCaches.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ GridData gd_lblNoOfCaches = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+ gd_lblNoOfCaches.widthHint = 150;
+ lblNoOfCaches.setLayoutData(gd_lblNoOfCaches);
+ lblNoOfCaches.setText("No. of entity caches : ");
+ }
+ {
+ txtNoOfCaches = new Text(container, SWT.BORDER);
+ txtNoOfCaches.setEditable(false);
+ GridData gd_txtNoOfCaches = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtNoOfCaches.widthHint = 50;
+ txtNoOfCaches.setLayoutData(gd_txtNoOfCaches);
+ }
+ new Label(container, SWT.NONE);
+ new Label(container, SWT.NONE);
+ new Label(container, SWT.NONE);
+
+ {
+ Label lblDefaultCache = new Label(container, SWT.CENTER);
+ lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblDefaultCache.setText("Default Cache, ");
+ lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblDefaultCache.setAlignment(SWT.RIGHT);
+ }
+ {
+ Label lblDefaultInMemory = new Label(container, SWT.CENTER);
+ lblDefaultInMemory.setText("in Memory : ");
+ lblDefaultInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblDefaultInMemory.setAlignment(SWT.RIGHT);
+ lblDefaultInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ }
+ {
+ txtDefaultInMemory = new Text(container, SWT.BORDER);
+ txtDefaultInMemory.setEditable(false);
+ GridData gd_txtDefaultInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtDefaultInMemory.widthHint = 130;
+ txtDefaultInMemory.setLayoutData(gd_txtDefaultInMemory);
+ }
+ {
+ Label lblDefaultOnDisk = new Label(container, SWT.CENTER);
+ lblDefaultOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblDefaultOnDisk.setText("on Disk : ");
+ lblDefaultOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblDefaultOnDisk.setAlignment(SWT.RIGHT);
+ }
+ {
+ txtDefaultOnDisk = new Text(container, SWT.BORDER);
+ txtDefaultOnDisk.setEditable(false);
+ txtDefaultOnDisk.setText("");
+ GridData gd_txtDefaultOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtDefaultOnDisk.widthHint = 130;
+ txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk);
+ }
+ {
+ Label lblCdmModelCache = new Label(container, SWT.CENTER);
+ lblCdmModelCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblCdmModelCache.setText("CDM Model Cache, ");
+ lblCdmModelCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblCdmModelCache.setAlignment(SWT.RIGHT);
+ }
+ {
+ Label lblCdmModelInMemory = new Label(container, SWT.CENTER);
+ lblCdmModelInMemory.setText("in Memory : ");
+ lblCdmModelInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblCdmModelInMemory.setAlignment(SWT.RIGHT);
+ GridData gd_lblCdmModelInMemory = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
+ gd_lblCdmModelInMemory.widthHint = 86;
+ lblCdmModelInMemory.setLayoutData(gd_lblCdmModelInMemory);
+ }
+ {
+ txtCdmModelInMemory = new Text(container, SWT.BORDER);
+ txtCdmModelInMemory.setEditable(false);
+ GridData gd_txtCdmModelInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtCdmModelInMemory.widthHint = 130;
+ txtCdmModelInMemory.setLayoutData(gd_txtCdmModelInMemory);
+ }
+ {
+ Label lblCdmModelOnDisk = new Label(container, SWT.CENTER);
+ lblCdmModelOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblCdmModelOnDisk.setText("on Disk : ");
+ lblCdmModelOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblCdmModelOnDisk.setAlignment(SWT.RIGHT);
+ }
+ {
+ txtCdmModelOnDisk = new Text(container, SWT.BORDER);
+ txtCdmModelOnDisk.setEditable(false);
+ txtCdmModelOnDisk.setText("");
+ GridData gd_txtCdmModelOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtCdmModelOnDisk.widthHint = 130;
+ txtCdmModelOnDisk.setLayoutData(gd_txtCdmModelOnDisk);
+ }
+ {
+ Button btnRefresh = new Button(container, SWT.NONE);
+ btnRefresh.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ changed();
+ }
+ });
+ GridData gd_btnRefresh = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
+ gd_btnRefresh.widthHint = 100;
+ btnRefresh.setLayoutData(gd_btnRefresh);
+ btnRefresh.setText("Refresh");
+ }
+ {
+ Button btnInspectActiveSession = new Button(container, SWT.NONE);
+ btnInspectActiveSession.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null);
+ }
+ });
+ btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
+ btnInspectActiveSession.setText("Inspect Active Session");
+ }
+ new Label(container, SWT.NONE);
+ new Label(container, SWT.NONE);
+
+ {
+ tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION);
+ GridData gd_tableSessions = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
+ gd_tableSessions.widthHint = 769;
+ tableSessions.setLayoutData(gd_tableSessions);
+ tableSessions.setHeaderVisible(true);
+ tableSessions.setLinesVisible(true);
+ }
+
+ createActions();
+ initializeToolBar();
+ initializeMenu();
+ }
+
+ /**
+ * Create the actions.
+ */
+ private void createActions() {
+
+
+ for (String title : titles) {
+ TableColumn column = new TableColumn(tableSessions, SWT.NULL);
+ column.setWidth(200);
+ column.setText(title);
+ }
+ changed();
+
+ }
+
+
+ @Override
+ public void changed() {
+ if(tableSessions.isDisposed()) {
+ return;
+ }
+ tableSessions.removeAll();
+ if(cdmEntitySessionManager != null) {
+ Collection<ICdmEntitySession> sessions = cdmEntitySessionManager.getSessions();
+ txtNoOfSessions.setText(String.valueOf(sessions.size()));
+ for(ICdmEntitySession session : sessions) {
+ addSession(session);
+ }
+ ICdmEntitySession nullSession = cdmEntitySessionManager.getNullSession();
+ if(nullSession != null) {
+ addSession(nullSession);
+ }
+ for (int i=0; i<titles.length; i++) {
+ tableSessions.getColumn (i).pack ();
+ }
+ }
+
+ CdmRemoteCacheManager instance = CdmRemoteCacheManager.getInstance();
+ int cdmEnityCacheSize = CacheManager.create().getCacheNames().length;
+ txtNoOfCaches.setText(String.valueOf(cdmEnityCacheSize));
+
+ Cache defaultCache = CacheManager.create().getCache(CdmCacher.DEFAULT_CACHE_NAME);
+ txtDefaultInMemory.setText("");
+ txtDefaultOnDisk.setText("");
+ if(defaultCache != null) {
+ LiveCacheStatistics liveCacheStatistics = defaultCache.getLiveCacheStatistics();
+ txtDefaultInMemory.setText(getInMemoryStats(liveCacheStatistics));
+ txtDefaultOnDisk.setText(getOnDiskStats(liveCacheStatistics));
+ }
+
+ Cache cdmModelGetMethodsCache = instance.getCdmModelGetMethodsCache();
+ txtCdmModelInMemory.setText("");
+ txtCdmModelOnDisk.setText("");
+ if(cdmModelGetMethodsCache != null) {
+ LiveCacheStatistics liveCacheStatistics = cdmModelGetMethodsCache.getLiveCacheStatistics();
+ txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics));
+ txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics));
+ }
+
+ }
+
+ private void addSession(ICdmEntitySession session) {
+
+ TableItem item = new TableItem(tableSessions, SWT.NULL);
+
+ String activePrefix = "";
+ if(session.isActive()) {
+ activePrefix = "*";
+ }
+ String sessionOwnerString = "";
+ if(session instanceof NullSession) {
+ sessionOwnerString = "Null Session";
+ } else {
+ if(session.getOwner() != null) {
+ sessionOwnerString = session.getOwner().toString();
+ }
+ }
+ item.setText(0, activePrefix + sessionOwnerString);
+ LiveCacheStatistics cacheStatistics = session.getCacheStatistics();
+ item.setText(1, getInMemoryStats(cacheStatistics));
+ item.setText(2, getOnDiskStats(cacheStatistics));
+ }
+
+ private String getInMemoryStats(LiveCacheStatistics statistics) {
+ if(statistics != null) {
+ long localHeapSize = statistics.getLocalHeapSize();
+
+ long localHeapSizeInBytes = statistics.getLocalHeapSizeInBytes();
+ String localHeapSizeInBytesStr =
+ (new DecimalFormat("#.##")).format(localHeapSizeInBytes/1048576.0);
+ return String.valueOf(localHeapSize) + " objects / " + localHeapSizeInBytesStr + " Mb";
+ }
+ return "";
+ }
+
+ private String getOnDiskStats(LiveCacheStatistics statistics) {
+ if(statistics != null) {
+ long localDiskSize = statistics.getLocalDiskSize();
+
+ long localDiskSizeInBytes = statistics.getLocalDiskSizeInBytes();
+ String localDiskSizeInBytesStr =
+ (new DecimalFormat("#.##")).format(localDiskSizeInBytes/1048576.0);
+ return String.valueOf(localDiskSize) + " objects / " + localDiskSizeInBytesStr + " Mb";
+ }
+ return "";
+ }
+
+ /**
+ * Initialize the toolbar.
+ */
+ private void initializeToolBar() {
+ IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
+ }
+
+ /**
+ * Initialize the menu.
+ */
+ private void initializeMenu() {
+ IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
+ }
+
+ @Override
+ public void setFocus() {
+ // Set the focus
+ }
+
+}
// TODO Auto-generated method stub
return false;
}
-
-
}
+++ /dev/null
-### ************ APPENDER ***********************************###
-
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=taxeditor.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### ************* LOG LEVELS *********************************###
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-### levels: error, warn, debug, info
-log4j.rootLogger=INFO, stdout
-
-### set directory-specific levels below
-
-### basic level for editor directory
-log4j.logger.eu.etaxonomy.taxeditor = WARN, stdout
-
-log4j.logger.eu.etaxonomy.taxeditor.store = DEBUG, stdout
-
-### log level for conversation handler
-#log4j.logger.eu.etaxonomy.cdm.api.application = DEBUG, stdout
// $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.
*/
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
/**
* @author n.hoffmann
* @version 1.0
*/
public abstract class AbstractTaxeditorOperationTestBase {
-
+
public static final IUndoContext undoContext = null;
-
+
public static final IProgressMonitor monitor = null;
- public static final IAdaptable info = null;
+ public static final IAdaptable info = null;
public static final IPostOperationEnabled postOperation = null;
-
+ public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null;
+
protected static AbstractPostOperation operation;
protected static Taxon taxon;
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.store.operations;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.dto.CdmEntityIdentifier;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author cmathew
+ * @date 26 Jun 2015
+ *
+ */
+public class RemotingTestUpdateOperation extends RemotingCdmUpdateOperation {
+
+ private static String LABEL = "Test Operation";
+
+ private UpdateResult result;
+ private Exception exception;
+ private CdmEntityIdentifier cei;
+
+
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingTestUpdateOperation(UpdateResult result,
+ Object source,
+ boolean async) {
+ super(LABEL, Action.Update, source, async);
+ this.result = result;
+ }
+
+ public RemotingTestUpdateOperation(Exception exception,
+ Object source,
+ boolean async) {
+ super(LABEL, Action.Update, source, async);
+ this.exception = exception;
+ }
+
+ public RemotingTestUpdateOperation(CdmEntityIdentifier cei,
+ Object source,
+ boolean async) {
+ super(LABEL, Action.Update, source, async);
+ this.cei = cei;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ ITestService testService = CdmApplicationState.getTestService();
+ if(result != null) {
+ return testService.returnResult(result);
+ } else if(exception != null) {
+ return testService.throwException(exception);
+ } else if(cei != null) {
+ return testService.addChild(cei);
+ }
+ return null;
+ }
+
+}
+++ /dev/null
-### ************ APPENDER ***********************************###
-
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=hibernate.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-
-### ************* LOG LEVELS *********************************###
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-
-log4j.rootLogger=info, stdout, file
-
- ### *** CDM *** ###
-
-log4j.logger.eu.etaxonomy.cdm = info
-log4j.logger.eu.etaxonomy.cdm.database.init = warn
-#
-log4j.logger.eu.etaxonomy.cdm.model.common.init = warn
-#
-log4j.logger.eu.etaxonomy.cdm.test.integration = info
-log4j.logger.eu.etaxonomy.cdm.api.application = warn
-log4j.logger.eu.etaxonomy.cdm.api.service = info
-#log4j.logger.eu.etaxonomy.cdm.database.VocabularyStoreImpl = warn
-#
-log4j.logger.eu.etaxonomy.cdm.database = warn
-log4j.logger.eu.etaxonomy.cdm.persistence.dao.hibernate.common = warn
-
-
-
- ### *** SPRING ************ ###
-log4j.logger.org.springframework.transaction = warn
-log4j.logger.org.hibernate.engine.LoadContexts = warn
-log4j.logger.org.springframework.orm.hibernate3.SessionFactoryUtils = warn
-log4j.logger.org.springframework.orm.hibernate3 = warn
-log4j.logger.org.springframework.FileSystemXmlApplicationContext = warn;
-log4j.logger.org.springframework.core.io.support = warn
-
-
- ### ***HIBERNATE ************ ###
-
-log4j.logger.org.hibernate=warn
-
-### No warnings as thrown by SQLServer
-###log4j.logger.org.hibernate.cfg = warn
-
-### No warnings as thrown by SQLServer
-log4j.logger.org.hibernate.util.JDBCExceptionReporter = error
-
-### log HQL query parser activity
-#log4j.logger.org.hibernate.hql.ast.AST=debug
-
-### log just the SQL
-log4j.logger.org.hibernate.SQL=warn
-
-### log JDBC bind parameters ###
-log4j.logger.org.hibernate.type=warn
-
-### log schema export/update ###
-log4j.logger.org.hibernate.tool.hbm2ddl=warn
-
-### log HQL parse trees
-log4j.logger.org.hibernate.hql=debug
-log4j.logger.org.hibernate.hql.ast=warn
-
-### log cache activity ###
-#log4j.logger.org.hibernate.cache=debug
-
-### log transaction activity
-#log4j.logger.org.hibernate.transaction=debug
-
-### log JDBC resource acquisition
-log4j.logger.org.hibernate.jdbc=info
-
-### enable the following line if you want to track down connection ###
-### leakages when using DriverManagerConnectionProvider ###
-#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
-
-
- ### *** Profiling Logger ************ ###
-
-#log4j.logger.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE, profiling
-### Profiling output
-#log4j.appender.profiling=org.apache.log4j.RollingFileAppender
-#log4j.appender.profiling.File=profiling.log
-#log4j.appender.profiling.MaxFileSize=1024KB
-#log4j.appender.profiling.MaxBackupIndex=1
-#log4j.appender.profiling.layout=org.apache.log4j.PatternLayout
-#log4j.appender.profiling.layout.conversionPattern=%d,%p,%m%n
-
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <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/test/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry including="**/*.java" kind="src" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/test/resources"/>
+ <classpathentry exported="true" kind="lib" path="lib/byte-buddy-0.5.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.2.2.RELEASE.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-core-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-database-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbmaintainer-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-dbunit-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/unitils-spring-3.4.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/dbunit-2.4.9.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>eu.etaxonomy.taxeditor.test</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+ <name>eu.etaxonomy.taxeditor.test</name>
+ <comment>Holds all UI tests for the Taxonomic Editor. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
-#Wed Oct 05 13:31:15 CEST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.7
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.test
Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 3.6.1.qualifier
+Bundle-Version: 4.0.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.apache.log4j,
- org.eclipse.ui,
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.swtbot.eclipse.core,
- org.eclipse.swtbot.eclipse.finder,
- org.eclipse.swtbot.junit4_x,
org.eclipse.ui.ide,
- eu.etaxonomy.taxeditor.application,
- eu.etaxonomy.taxeditor.bulkeditor,
+ org.junit;bundle-version="4.8.2",
+ eu.etaxonomy.taxeditor.webapp,
eu.etaxonomy.taxeditor.cdmlib,
+ eu.etaxonomy.taxeditor.bulkeditor,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.help,
eu.etaxonomy.taxeditor.navigation,
eu.etaxonomy.taxeditor.printpublisher,
- eu.etaxonomy.taxeditor.store
-Eclipse-RegisterBuddy: org.apache.log4j
+ eu.etaxonomy.taxeditor.store,
+ org.apache.log4j,
+ org.hamcrest,
+ org.eclipse.swtbot.eclipse.core,
+ org.eclipse.swtbot.eclipse.finder,
+ eu.etaxonomy.taxeditor.webapp;bundle-version="3.13.0"
+Eclipse-RegisterBuddy: org.apache.log4j, org.eclipse.swtbot.swt.finder
+Bundle-ClassPath: .,
+ lib/byte-buddy-0.5.1.jar,
+ lib/org.springframework.context-3.2.2.RELEASE.jar,
+ lib/unitils-core-3.4.2.jar,
+ lib/unitils-database-3.4.2.jar,
+ lib/unitils-dbmaintainer-3.4.2.jar,
+ lib/unitils-dbunit-3.4.2.jar,
+ lib/unitils-spring-3.4.2.jar,
+ lib/dbunit-2.4.9.jar
-source.. = src/test/java/
+source.. = src/test/java/,\
+ src/test/resources/
bin.includes = META-INF/,\
- .
+ .,\
+ lib/byte-buddy-0.5.1.jar,\
+ lib/org.springframework.context-3.2.2.RELEASE.jar,\
+ lib/unitils-core-3.4.2.jar,\
+ lib/unitils-database-3.4.2.jar,\
+ lib/unitils-dbmaintainer-3.4.2.jar,\
+ lib/unitils-dbunit-3.4.2.jar,\
+ lib/unitils-spring-3.4.2.jar,\
+ lib/dbunit-2.4.9.jar,\
+ src/test/resources/
+output.. = target/classes
-<?xml version="1.0" encoding="UTF-8"?>\r
-<project>\r
-\r
- <parent>\r
- <groupId>eu.etaxonomy</groupId>\r
- <artifactId>taxeditor-parent</artifactId>\r
- <version>3.4.0-SNAPSHOT</version>\r
- </parent>\r
- <modelVersion>4.0.0</modelVersion>\r
- <artifactId>eu.etaxonomy.taxeditor.test</artifactId>\r
- <packaging>eclipse-test-plugin</packaging>\r
- <name>UI Test Bundle</name>\r
- <description>Holds all UI tests for the Taxonomic Editor</description>\r
- <!-- <repositories> -->\r
- <!-- <repository> -->\r
- <!-- <id>ganymede</id> -->\r
- <!-- <layout>p2</layout> -->\r
- <!-- <url>http://download.eclipse.org/releases/galileo</url> -->\r
- <!-- </repository> -->\r
- <!-- <repository> -->\r
- <!-- <id>swtbot</id> -->\r
- <!-- <layout>p2</layout> -->\r
- <!-- <url>http://download.eclipse.org/technology/swtbot/galileo/dev-build/update-site</url> -->\r
- <!-- </repository> -->\r
- <!-- </repositories> -->\r
-\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <groupId>org.eclipse.tycho</groupId>\r
- <artifactId>tycho-maven-plugin</artifactId>\r
- <version>${tycho.version}</version>\r
- <extensions>true</extensions>\r
- </plugin>\r
- <plugin>\r
- <groupId>org.eclipse.tycho</groupId>\r
- <artifactId>target-platform-configuration</artifactId>\r
- <version>${tycho.version}</version>\r
- <configuration>\r
- <resolver>p2</resolver>\r
- </configuration>\r
- </plugin>\r
- <plugin>\r
- <groupId>org.eclipse.tycho</groupId>\r
- <artifactId>tycho-surefire-plugin</artifactId>\r
- <version>${tycho.version}</version>\r
- <configuration>\r
- <useUIHarness>true</useUIHarness>\r
- <useUIThread>false</useUIThread>\r
- <includes>\r
- <include>**/*Test.java</include>\r
- </includes>\r
- <product>eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product</product>\r
- <application>eu.etaxonomy.taxeditor.application.application</application>\r
- <!-- <dependency>
- <type>p2-installable-unit</type>
- <artifactId>eu.etaxonomy.taxeditor.product</artifactId>
- <version>0.0.0</version>
- </dependency> -->\r
- </configuration>\r
- </plugin>\r
- <!-- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>maven-osgi-test-plugin</artifactId>
- <version>${tycho.version}</version>
- <configuration>
- <useUIHarness>true</useUIHarness>
- <useUIThread>false</useUIThread>
- <product>eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product</product>
- <application>org.eclipse.ui.ide.workbench</application>
- <dependencies>
- <dependency>
- <type>p2-installable-unit</type>
- <artifactId>eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product</artifactId>
- <version>0.0.0</version>
- </dependency>
- </dependencies>
- </configuration>
- </plugin> -->\r
- </plugins>\r
- </build>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>taxeditor-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>eu.etaxonomy.taxeditor.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>UI Test Bundle</name>
+ <description>Holds all Tests for the Taxonomic Editor</description>
+ <build>
+ <resources>
+ <resource>
+ <!-- replace the place holders like ${...} in datasources.xml -->
+ <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ <targetPath>../test-classes</targetPath>
+ <includes>
+ <include>datasources.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <!-- all other test resources without filtering -->
+ <directory>src/test/resources</directory>
+ <targetPath>../test-classes</targetPath>
+ <excludes>
+ <exclude>datasources.xml</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <!-- all main resources without filtering -->
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <filters>
+ <!-- Work around for https://bugs.eclipse.org/bugs/show_bug.cgi?id=348045 -->
+ <!-- taken from https://wiki.eclipse.org/index.php?title=Tycho/Target_Platform#Filtering -->
+ <filter>
+ <type>p2-installable-unit</type>
+ <id>org.eclipse.equinox.servletbridge.extensionbundle</id>
+ <removeAll />
+ </filter>
+ </filters>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <!-- currently we run only the non-ui unit tests so we don't the
+ harness -->
+ <!-- <useUIHarness>true</useUIHarness> -->
+ <dependencies>
+ <!-- This will pull the feature and its dependent plugins into
+ the classpath for the tests. Note that this requires ALL taxeditor projects
+ to be installed. -->
+ <dependency>
+ <type>eclipse-feature</type>
+ <artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
+ <!-- This is the minimum required version -->
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>9.1.3.v20140225</version><!-- do not update, since later versions are no longer compatible to java 7 -->
+ <!--
+ To see the detailed list of parameters that can be configured for a particular goal:
+ mvn jetty:help -Ddetail=true -Dgoal= goal-name
+ -->
+ <configuration>
+ <systemProperties>
+ <force>true</force>
+ <systemProperty>
+ <name>cdm.datasource</name>
+ <value>cdmTest</value>
+ </systemProperty>
+ <systemProperty>
+ <!--
+ The lucene index should be placed into the target folder,
+ so user.home needs to be set to this folder.
+ user.home needs to be overridden since it already
+ exists, thus the force option is turned on above
+ -->
+ <name>user.home</name>
+ <value>${basedir}/target/</value>
+ </systemProperty>
+ <systemProperty>
+ <name>spring.profiles.active</name>
+ <value>remoting</value>
+ </systemProperty>
+ <systemProperty>
+ <name>cdm.beanDefinitionFile</name>
+ <value>${basedir}/target/test-classes/datasources.xml</value>
+ </systemProperty>
+ </systemProperties>
+ <stopPort>9191</stopPort>
+ <stopKey>jetty-cdm-server</stopKey>
+ <stopWait>10</stopWait>
+ <httpConnector>
+ <port>9090</port>
+ </httpConnector>
+ <!--
+ ${project.parent.basedir} can not be used due to the bug
+ https://issues.apache.org/jira/browse/MNG-5522
+ as long as this is unfixed we replace it by
+ ${basedir}/../
+ -->
+ <war>${basedir}/../eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/cdmlib-remote-webapp.war</war>
+ <daemon>true</daemon>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <!--
+ IMPORTANT!!!
+ this must exactly match the version as set in
+ cdmlib-parent pom.xml
+ -->
+ <version>0.9.5.2</version>
+ </dependency>
+ <!-- DATABASE DRIVER -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.4.190</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.38</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.4</version>
+ </dependency>
+<!-- <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency> -->
+ <!--
+ <dependency>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>cdmlib-persistence</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ </exclusions>
+ </dependency>
+ -->
+ </dependencies>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy-war</goal>
+ </goals>
+ <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
- debug="false">
-
- <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) - %m%n" />
- </layout>
- </appender>
-
- <appender name="fileAppender" class="org.apache.log4j.FileAppender">
- <param name="File" value="/tmp/debug.log" />
- <param name="Append" value="false" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) - %m%n" />
- </layout>
- </appender>
-
- <appender name="asyncAppender" class="org.apache.log4j.AsyncAppender">
- <!-- appender-ref ref="consoleAppender" / -->
- <appender-ref ref="fileAppender" />
- </appender>
-
- <!-- don't log matchers, this is very high amount of chatter -->
- <category name="org.eclipse.swtbot.swt.finder.matchers">
- <priority value="OFF" />
- </category>
-
- <!--
- don't log widget notification events, this is moderately high chatter
- -->
- <category name="org.eclipse.swtbot.swt.finder.widgets">
- <priority value="OFF" />
- </category>
-
- <!-- don't log finders, this is moderate chatter -->
- <category name="org.eclipse.swtbot.swt.finder.finders">
- <priority value="DEBUG" />
- </category>
-
- <category name="org.eclipse.swtbot.swt.finder.keyboard">
- <!-- set to a value higher than debug to turn on. -->
- <priority value="DEBUG" />
- </category>
-
- <category name="org.eclipse.swtbot">
- <priority value="ALL" />
- </category>
-
- <root>
- <priority value="INFO" />
- <appender-ref ref="consoleAppender" />
- <appender-ref ref="fileAppender" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.cdm.api.cache;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+
+/**
+ * @author cmathew
+ * @date 7 Oct 2014
+ *
+ */
+@DataSet
+public class CdmClientCachingTest extends RemotingSessionAwareTest {
+
+ private static final Logger logger = Logger.getLogger(CdmClientCachingTest.class);
+
+ private final UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
+ private final UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
+ private final UUID polytomousKeyNodeUuid1 = UUID.fromString("75e4c924-ff58-4ee7-a59d-fd9173517d08");
+ private final UUID polytomousKeyNodeUuid2 = UUID.fromString("b775c027-13c0-4b87-8aa9-712faeaafbdc");
+
+
+ private final IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+ private final IPolytomousKeyNodeService polytomousKeyNodeService = getRemoteApplicationController().getPolytomousKeyNodeService();
+ private final ICommonService commonService = getRemoteApplicationController().getCommonService();
+ private final ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+
+
+ private static final List<String> PKEY_DEPTH1_INIT_STRATEGY = Arrays.asList(new String[] {
+ });
+
+ private static final List<String> PKEY_DEPTH2_INIT_STRATEGY = Arrays.asList(new String[] {
+ "root"});
+
+ private static final List<String> PKEY_DEPTH3_INIT_STRATEGY = Arrays.asList(new String[] {
+ "root.statement"});
+
+
+ @BeforeClass
+ public static void initializePolytomousKeyTest() {
+
+ }
+
+
+
+
+ @Test
+ public void recursiveLoadSubGraphDepth1Test() {
+
+ // this call will load into the session cache the graph
+ // polytomous key
+ // |- root : polytomous key node
+ // in a recursive call
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
+
+ // checking to make sure the root object is in the session cache
+ Assert.assertSame(CdmBase.deproxy(pkey1.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey1.getRoot()));
+
+ }
+
+
+ @Test
+ public void recursiveLoadSubGraphDepth2Test() {
+
+ // this call will load into the session cache the graph
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+ // in a recursive call
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+ CdmTransientEntityCacher cacher = getCacher(sessionOwner);
+ // checking to make sure the root object is in the session cache
+ Assert.assertSame(CdmBase.deproxy(pkey.getRoot(),PolytomousKeyNode.class), cacher.getFromCache(pkey.getRoot()));
+ Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getStatement(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getStatement()));
+ Assert.assertSame(CdmBase.deproxy(pkey.getRoot().getQuestion(),KeyStatement.class), cacher.getFromCache(pkey.getRoot().getQuestion()));
+
+ }
+
+ /**
+ * when : retrieving objects using recursive caching of object graphs with different depths
+ * then : the objects in the sub-graph having the same persistence id should be the same
+ */
+ @Test
+ public void lazyLoadRecursiveTest() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ CdmTransientEntityCacher cacher = getCacher(sessionOwner);
+
+ }
+
+
+ /**
+ * when : retrieving objects using recursive caching of object graphs with different depths
+ * then : the objects in the sub-graph having the same persistence id should be the same
+ */
+ @Test
+ public void differentSubGraphDepthTest1() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // in a recursive call
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
+ KeyStatement ks1 = CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class);
+
+ CdmTransientEntityCacher cacher = getCacher(sessionOwner);
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+ PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH3_INIT_STRATEGY),PolytomousKey.class);
+
+ KeyStatement ks2 = CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class);
+
+ Assert.assertSame(ks2, cacher.getFromCache(ks2));
+ Assert.assertSame(cacher.getFromCache(KeyStatement.class, ks1.getId()), cacher.getFromCache(ks2));
+
+ }
+
+ /**
+ * when : retrieving objects using recursive caching of object graphs with different depths
+ * then : the objects in the sub-graph having the same persistence id should be the same
+ */
+ @Test
+ public void differentSubGraphDepthTest2() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+ KeyStatement ks1 = pkey1.getRoot().getStatement();
+ Assert.assertSame(ks1, pkey1.getRoot().getStatement());
+ CdmTransientEntityCacher cacher = getCacher(sessionOwner);
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH1_INIT_STRATEGY),PolytomousKey.class);
+
+ Assert.assertSame(pkey1.getRoot().getStatement(), pkey2.getRoot().getStatement());
+ pkey2.getRoot().getStatement().getCreatedBy();
+ Assert.assertSame(cacher.getFromCache(ks1), cacher.getFromCache(pkey2.getRoot().getStatement()));
+ }
+
+ /**
+ * when : retrieving objects using (first) recursive load directly and (second) lazy loading in the same session
+ * then : the objects in the sub-graph having the same persistence id should be the same
+ */
+ @Test
+ public void recursiveLoadAndLazyLoadTest() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+
+
+ CdmTransientEntityCacher cacher = getCacher(sessionOwner);
+
+ // checking that the root is not null and
+ // that it exists in the cache and
+ // that both the original object and the
+ // cached object are the same
+ Assert.assertNotNull(CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class));
+ Assert.assertNotNull(cacher.getFromCache(pkey1.getRoot().getStatement()));
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ KeyStatement ks2 = CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class);
+ Assert.assertSame(ks2, cacher.getFromCache(pkey2.getRoot().getStatement()));
+
+ Assert.assertSame(pkey1.getRoot().getStatement(), pkey2.getRoot().getStatement());
+ Assert.assertSame(cacher.getFromCache(pkey1.getRoot().getStatement()), cacher.getFromCache(pkey2.getRoot().getStatement()));
+ }
+
+ /**
+ * when : retrieving objects using (first) lazy loading and (second) recursive load directly in the same session
+ * then : the objects in the sub-graph having the same persistence id should be the same
+ */
+ @Test
+ public void lazyLoadAndRecursiveLoadTest() {
+
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+
+ PolytomousKey pkey1 = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ // lazy initialising root.statement
+ KeyStatement st = CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class);
+ st.getLabel();
+
+ // checking that the root is not null and
+ // that it exists in the cache and
+ // that both the original object and the
+ // cached object are the same
+ Assert.assertNotNull(pkey1.getRoot().getStatement());
+ Assert.assertSame(CdmBase.deproxy(pkey1.getRoot().getStatement(), KeyStatement.class),
+ cacher.getFromCache(pkey1.getRoot().getStatement(), KeyStatement.class));
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+
+ PolytomousKey pkey2 = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+
+
+ Assert.assertSame(CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
+ Assert.assertSame(st, CdmBase.deproxy(pkey2.getRoot().getStatement(), KeyStatement.class));
+ Assert.assertSame(cacher.getFromCache(st), cacher.getFromCache(pkey2.getRoot().getStatement(), KeyStatement.class));
+ }
+
+
+
+
+
+ /**
+ * when : loading an object (first) and then (second) loading a graph the object is contained in, in the same session
+ * then : the object should be the same
+ */
+ @Test
+ public void subGraphObjectLoadTest1() {
+
+ // this call will load into the session cache a polytomous key node object
+ PolytomousKeyNode rootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid1),PolytomousKeyNode.class);
+
+
+ Assert.assertNotNull(rootPKNode);
+ Assert.assertSame(rootPKNode, cacher.getFromCache(rootPKNode));
+
+ PolytomousKeyNode childOfRootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid2),PolytomousKeyNode.class);
+
+
+ Assert.assertNotNull(childOfRootPKNode);
+ Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+
+
+ Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
+ Assert.assertSame(pkey.getRoot().getChildAt(1), childOfRootPKNode);
+ }
+
+ /**
+ * when : loading a graph (first) and then (second) loading an object contained in in the graph, in the same session
+ * then : the object should be the same
+ */
+ @Test
+ public void subGraphObjectLoadTest2() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+
+
+ // this call will load into the session cache a polytomous key node object
+ PolytomousKeyNode rootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid1),PolytomousKeyNode.class);
+
+
+ Assert.assertNotNull(rootPKNode);
+ Assert.assertSame(rootPKNode, cacher.getFromCache(rootPKNode));
+
+ PolytomousKeyNode childOfRootPKNode = CdmBase.deproxy(polytomousKeyNodeService.find(polytomousKeyNodeUuid2),PolytomousKeyNode.class);
+
+
+ Assert.assertNotNull(childOfRootPKNode);
+ Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
+
+ Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
+ Assert.assertSame(pkey.getRoot().getChildAt(1), childOfRootPKNode);
+ }
+
+
+ /**
+ * when : loading objects from a collection
+ * then : the object stored in the cache should be the same
+ */
+ @Test
+ public void subGraphCollectionLoadTest() {
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH2_INIT_STRATEGY),PolytomousKey.class);
+
+
+ PolytomousKeyNode childOfRootPKNode = pkey.getRoot().getChildAt(1);
+
+ Assert.assertSame(childOfRootPKNode, cacher.getFromCache(childOfRootPKNode));
+ Assert.assertSame(pkey.getRoot().getChildAt(1), childOfRootPKNode);
+
+ }
+
+ /**
+ * when : loading a non-lazy collection in a subgraph and loading the collection directly
+ * then : the object stored in the cache should be the same as the object in the sub-graph collection and
+ * the object in the directly loaded collection
+ */
+ @Test
+ public void nonLazyCollectionLoadTest() {
+ // need to find an example of this
+ }
+
+ /**
+ * when : loading objects from a map
+ * then : the object stored in the cache should be the same
+ */
+ @Test
+ public void subGraphMapLoadTest() {
+
+ Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+ Language hindi = Language.getLanguageFromUuid(UUID.fromString("0a1d9d1d-135d-4575-b172-669b51673c39"));
+
+
+ // this call will load into the session cache the graph and update the objects in the sub-graph for a
+ // polytomous key
+ // |- root : polytomous key node
+ // |- question : KeyStatement
+ // |- statement : KeyStatement
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.load(polytomousKeyUuid, PKEY_DEPTH3_INIT_STRATEGY),PolytomousKey.class);
+
+
+ Map<Language, LanguageString> labelMap = pkey.getRoot().getStatement().getLabel();
+ Set<Language> languages = labelMap.keySet();
+ Iterator<Language> languagesItr = languages.iterator();
+ while(languagesItr.hasNext()) {
+ Language lang = languagesItr.next();
+ if(lang.equals(english)) {
+ Assert.assertSame(lang, english);
+ }
+ if(lang.equals(hindi)) {
+ Assert.assertSame(lang, hindi);
+ }
+ Assert.assertSame(lang, cacher.getFromCache(lang));
+ }
+ }
+
+ /**
+ * when : loading a non-lazy map in a subgraph and loading the map directly
+ * then : the object stored in the cache should be the same as the object in the sub-graph map and
+ * the object in the directly loaded map
+ */
+ @Test
+ public void nonLazyMapLoadTest() {
+ // need to find an example of this
+ }
+
+
+
+}
package eu.etaxonomy.taxeditor.application.menu.general;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
import eu.etaxonomy.taxeditor.test.AbstractEditorTest;\r
\r
/**\r
* Open all "General -> New" menus\r
- * \r
+ *\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class NewMenuTest extends AbstractEditorTest {\r
\r
@Test\r
openNewWizardFor("Taxon");\r
utils.cancel();\r
}\r
- \r
+\r
\r
@Test\r
public void canOpenNewWizardForReference(){\r
openNewWizardFor("Reference");\r
utils.cancel();\r
}\r
- \r
- \r
+\r
+\r
@Test\r
public void canOpenNewWizardForName(){\r
openNewWizardFor("Name");\r
utils.cancel();\r
}\r
- \r
- \r
+\r
+\r
@Test\r
public void canOpenNewWizardForTeam(){\r
openNewWizardFor("Team");\r
utils.cancel();\r
}\r
- \r
- \r
+\r
+\r
@Test\r
public void canOpenNewWizardForPerson(){\r
openNewWizardFor("Person");\r
utils.cancel();\r
}\r
- \r
+\r
@Test\r
public void canOpenNewWizardForSpecimen(){\r
openNewWizardFor("Specimen");\r
utils.cancel();\r
}\r
- \r
- \r
+\r
+\r
@Test\r
public void canOpenNewWizardForClassification(){\r
openNewWizardFor("Classification");\r
--- /dev/null
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.httpinvoker;
+
+import java.lang.reflect.Field;
+import java.util.Map;
+
+import net.sf.ehcache.CacheManager;
+
+import org.apache.log4j.Logger;
+import org.junit.BeforeClass;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.context.SecurityContextImpl;
+import org.unitils.database.DatabaseUnitils;
+import org.unitils.database.annotations.Transactional;
+import org.unitils.database.util.TransactionMode;
+import org.unitils.spring.annotation.SpringApplicationContext;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.remoting.source.CdmPersistentRemoteSource;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
+import eu.etaxonomy.taxeditor.session.CdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
+
+
+/**
+ * Base class for remoting tests, responsible for
+ * - starting / stop the cdm server
+ * - running some basic connection tests
+ * - setting up the remote configuration.
+ *
+ */
+@Transactional(TransactionMode.DISABLED)
+@SpringApplicationContext("file:./target/classes/eu/etaxonomy/cdm/testRemotingApplicationContext.xml")
+public abstract class BaseRemotingTest extends ThreadedTest {
+ private static final Logger logger = Logger.getLogger(BaseRemotingTest.class);
+
+ private static ICdmRemoteSource cdmRemoteSource;
+ private static CdmPersistentRemoteSource remotePersistentSource;
+ protected static ICdmEntitySessionManager cdmEntitySessionManager;
+
+ @BeforeClass
+ public static void initializeBaseRemotingTest() {
+
+ DatabaseUnitils.disableConstraints();
+
+ try {
+ initializeController(sourceName,
+ host,
+ httpPort,
+ contextPath,
+ NomenclaturalCode.ICNAFP,
+ user,
+ password);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // Assert.fail("Server failed to start. Reason : " + e.getMessage());
+ }
+
+
+ }
+
+ public static void emptyAllCachesExceptModelCache() {
+ CacheManager cm = CacheManager.create();
+ String[] cacheNames = CacheManager.create().getCacheNames();
+ for(String cacheName : cacheNames) {
+ if(!cacheName.equals(CdmRemoteCacheManager.CDM_MODEL_CACHE_NAME)) {
+ cm.removeCache(cacheName);
+ }
+ }
+ }
+
+
+ public static void initializeController(String sourceName, String host, int port, String contextPath, NomenclaturalCode ncode, String username, String password) {
+
+ if(CdmApplicationState.getCurrentAppConfig() != null) {
+ return;
+ }
+ cdmRemoteSource = CdmRemoteSource.NewInstance(sourceName, host, port, contextPath, ncode);
+ CdmApplicationRemoteController remoteApplicationController =
+ CdmApplicationRemoteController.NewInstance(cdmRemoteSource,
+ null,
+ null);
+ CdmApplicationState.setCurrentAppConfig(remoteApplicationController);
+ CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+
+ cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager();
+
+ CdmApplicationState.setCurrentDataChangeService(new CdmDataChangeService());
+
+ authenticate(username, password);
+
+ }
+
+ protected static void authenticate(String username, String password) {
+
+ //FIXME:Remoting the authentication code should be replaced by a method call which actually
+ // does the authentication in the editor code so that the 'real' authentication can be tested
+ SecurityContextHolder.clearContext();
+ SecurityContextImpl sc = new SecurityContextImpl();
+ Authentication token = new UsernamePasswordAuthenticationToken(username,password);
+ Authentication authentication = getRemoteApplicationController().getAuthenticationManager().authenticate(token);
+ authentication = new UsernamePasswordAuthenticationToken(username,password, authentication.getAuthorities());
+ sc.setAuthentication(authentication);
+
+ SecurityContextHolder.setContext(sc);
+ CdmApplicationState.setCurrentSecurityContext(SecurityContextHolder.getContext());
+
+ }
+
+
+ protected static CdmApplicationRemoteController getRemoteApplicationController() {
+ return (CdmApplicationRemoteController) CdmApplicationState.getCurrentAppConfig();
+ }
+
+ protected static ICdmRemoteSource getCdmRemoteSource() {
+ return cdmRemoteSource;
+ }
+
+ protected static CdmPersistentRemoteSource getCdmPersistentRemoteSource() {
+ return remotePersistentSource;
+ }
+
+ protected static ICdmEntitySessionManager getCdmEntitySessionManager() {
+ return cdmEntitySessionManager;
+ }
+
+
+ protected static CdmEntitySession getSession(ICdmEntitySessionEnabled sessionOwner) {
+ Map<ICdmEntitySessionEnabled, CdmEntitySession> ownerSessionMap =
+ (Map<ICdmEntitySessionEnabled, CdmEntitySession>) getFieldValueViaReflection(cdmEntitySessionManager, "ownerSessionMap");
+ return ownerSessionMap.get(sessionOwner);
+ }
+
+ protected static CdmEntitySession getActiveSession() {
+ return ((InheritableThreadLocal<CdmEntitySession>) getFieldValueViaReflection(cdmEntitySessionManager, "tlActiveSession")).get();
+ }
+
+ protected static CdmTransientEntityCacher getCacher(ICdmEntitySessionEnabled sessionOwner) {
+ return (CdmTransientEntityCacher) getFieldValueViaReflection(getSession(sessionOwner), "cdmTransientEntityCacher");
+ }
+
+
+ protected static Object getFieldValueViaReflection(Object object, String fieldName) {
+ Class<?> clazz = object.getClass();
+ try {
+ Field field = clazz.getDeclaredField(fieldName);
+ field.setAccessible(true);
+ return field.get(object);
+ } catch (NoSuchFieldException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+
+ protected static void authenticateDefaultUser() {
+ authenticate(user, password);
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2014 EDIT
+* 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.httpinvoker;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.remoting.RemoteAccessException;
+
+import eu.etaxonomy.cdm.config.CdmSourceException;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.lazyloading.RemotePersistentCollectionTest;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+
+public class CdmRemoteSourceTest extends BaseRemotingTest {
+ private static final Logger logger = Logger.getLogger(RemotePersistentCollectionTest.class);
+
+
+ @Test
+ public void whenConnectingToInactiveServerThenFailToConnect() {
+
+ // check if non-active server throws the right exception
+ CdmRemoteSource inactiveCrs = CdmRemoteSource.NewInstance(sourceName,
+ host,
+ 808080,
+ contextPath,
+ NomenclaturalCode.ICNAFP);
+ try {
+ String dbSchemaVersion = inactiveCrs.getDbSchemaVersion();
+ Assert.fail("getDbSchemaVersion() on inactive cdm server should have thrown RemoteAccessException");
+ } catch(CdmSourceException cse) {
+ Assert.fail("getDbSchemaVersion() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
+ } catch(RemoteAccessException rae){
+
+ }
+
+ try {
+ inactiveCrs.isDbEmpty();
+ Assert.fail("isDbEmpty() on inactive cdm server should have thrown RemoteAccessException");
+ } catch(CdmSourceException cse) {
+ Assert.fail("isDbEmpty() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
+ } catch(RemoteAccessException rae){
+
+ }
+
+ try {
+ inactiveCrs.checkConnection();
+ Assert.fail("checkConnection() on inactive cdm server should have thrown RemoteAccessException");
+ } catch(CdmSourceException cse) {
+ Assert.fail("checkConnection() on inactive cdm server should have thrown RemoteAccessException and not CdmSourceException");
+ } catch(RemoteAccessException rae){
+
+ }
+
+ }
+
+ @Test
+ public void whenConnectingToAnActiveServerThenConnectSuccessfully() {
+ // check if active server throws the right exception
+ CdmRemoteSource activeCrs = CdmRemoteSource.NewInstance(sourceName,
+ host,
+ httpPort,
+ contextPath,
+ NomenclaturalCode.ICNAFP);
+ String dbSchemaVersion = "";
+ try {
+ dbSchemaVersion = activeCrs.getDbSchemaVersion();
+ } catch (CdmSourceException e) {
+ Assert.fail("getDbSchemaVersion() on active cdm server should not have thrown CdmSourceException");
+ }
+ logger.info("dbSchemaVersion is " + dbSchemaVersion);
+
+
+ boolean isDbEmpty = false;
+ try {
+ isDbEmpty = activeCrs.isDbEmpty();
+ } catch (CdmSourceException e) {
+ Assert.fail("isDbEmpty() on active cdm server should not have thrown CdmSourceException");
+ }
+ Assert.assertFalse(isDbEmpty);
+
+
+ boolean check = true;
+ try {
+ isDbEmpty = activeCrs.checkConnection();
+ } catch (CdmSourceException e) {
+ Assert.fail("checkConnection() on active cdm server should not have thrown CdmSourceException");
+ }
+ Assert.assertTrue(check);
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.httpinvoker;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.junit.Assert;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerUtils;
+import eu.etaxonomy.taxeditor.webapp.CDMEmbeddedServerException;
+import eu.etaxonomy.taxeditor.webapp.CDMServer;
+import eu.etaxonomy.taxeditor.webapp.ICDMServerError;
+
+
+/**
+ * @author cmathew
+ * @date 6 Oct 2014
+ *
+ */
+public class CdmServerTest extends TestConfig {
+ private static final Logger logger = Logger.getLogger(CdmServerTest.class);
+
+
+
+ @Test
+ public void generateConfigFile() throws IOException {
+ String mgdServerConfigFileName = "test.mgd.datasources.xml";
+ String config = CDMServerUtils.convertEditorToServerConfig();
+ CDMServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName);
+ }
+
+ @Test
+ public void manageCdmServer() throws IOException, URISyntaxException, CDMEmbeddedServerException {
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test");
+ URL mgdDatasourcesConfigURL = bundle.getEntry("src/test/resources/.cdmLibrary/writableResources/mgd.datasources.xml");
+ File mgdDatasourcesConfigFile = new File(FileLocator.resolve(mgdDatasourcesConfigURL).toURI());
+ CDMServer cdmServer = new CDMServer("cdmTest", mgdDatasourcesConfigFile);
+ cdmServer.start(new ICDMServerError() {
+ @Override
+ public void handleError(Throwable t) {
+ Assert.fail("Error starting server. Reason : " + t.getMessage());
+ }
+ });
+ try {
+ cdmServer.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Error stopping server. Reason : " + e.getMessage());
+ }
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.httpinvoker;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.remoting.RemoteAccessException;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.cdm.config.CdmSourceException;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+
+/**
+ * Class to test the HttpInvoker services exposed by the CDM Sever
+ *
+ */
+public class HttpInvokerServicesTest extends BaseRemotingTest {
+ private static final Logger logger = Logger.getLogger(HttpInvokerServicesTest.class);
+
+ ITestService testService = getRemoteApplicationController().getTestService();
+
+ @Test
+ public void whenCallingMethodsOnRemoteServicesThenSucceed() {
+ try {
+
+ //getRemoteApplicationController().getDatabaseService();
+ String dbSchemaVersion = getRemoteApplicationController().getDatabaseService().getDbSchemaVersion();
+ logger.info("dbSchemaVersion is " + dbSchemaVersion);
+
+
+ } catch (CdmSourceException e) {
+ Assert.fail("pinging database service on active cdm server should not have thrown CdmSourceException");
+ }
+
+ getRemoteApplicationController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
+
+ }
+
+ @Ignore
+ @Test
+ public void whenCallingMethodsOnRemoteServicesThenFailIfNotAuthenticated() {
+
+ SecurityContext context = SecurityContextHolder.getContext();
+
+ CdmApplicationState.setCurrentSecurityContext(null);
+ try {
+ getRemoteApplicationController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
+ Assert.fail("service call should fail as it is not authenticated");
+ }catch (RemoteAccessException rae) {
+
+ }
+
+ CdmApplicationState.setCurrentSecurityContext(context);
+
+ }
+
+ // should be kept at ignore and only used for manual testing
+ // otherwise tests will take too much time
+ @Ignore
+ @Test
+ public void testDisableReadTimeout() throws InterruptedException {
+ testService.waitFor((long) 120000.0);
+ }
+
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.httpinvoker;
+
+import org.apache.log4j.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.MockSessionOwner;
+
+/**
+ * @author cmathew
+ * @date 12 Jun 2015
+ *
+ */
+public abstract class RemotingSessionAwareTest extends BaseRemotingTest {
+
+ private static final Logger logger = Logger.getLogger(RemotingSessionAwareTest.class);
+
+ protected CdmTransientEntityCacher cacher;
+ protected MockSessionOwner sessionOwner;
+
+ private static String extraUsername = "Someone";
+ private static String extraPassword = "Password";
+
+
+ private IUserService userService = getRemoteApplicationController().getUserService();
+
+ @Before
+ public void initializeSession() {
+
+ sessionOwner = new MockSessionOwner();
+ logger.info("created mock session owner : " + sessionOwner);
+ ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.newSession(sessionOwner, true);
+ CdmApplicationState.getCurrentDataChangeService().register(sessionOwner);
+ sessionOwner.setCdmEntitySession(cdmEntitySession);
+ cacher = getCacher(sessionOwner);
+
+ UserDetails extraUser = null;
+
+ try {
+ extraUser = userService.loadUserByUsername(extraUsername);
+ } catch (UsernameNotFoundException unfe) {
+ User user = User.NewInstance(extraUsername, extraPassword);
+ userService.createUser(user);
+ }
+
+
+ }
+
+ @After
+ public void postSessionAwareTest() {
+ sessionOwner.dispose();
+ CdmApplicationState.getCurrentDataChangeService().unregister(sessionOwner);
+ logger.info("disposed of mock session owner : " + sessionOwner);
+ }
+
+
+ protected static void authenticateExtraUser() {
+ authenticate(extraUsername, extraPassword);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.httpinvoker;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.junit.BeforeClass;
+import org.osgi.framework.Bundle;
+import org.unitils.UnitilsJUnit4;
+
+/**
+ * @author cmathew
+ * @date 11 Nov 2015
+ *
+ */
+public abstract class TestConfig extends UnitilsJUnit4 {
+
+ private static final Logger logger = Logger.getLogger(TestConfig.class);
+
+ private final static String DEFAULT_USER = "admin";
+ private final static String DEFAULT_PASSWORD = "00000";
+ private final static int DEFAULT_HTTP_PORT = 9090;
+ private final static String DEFAULT_CONTEXT_PATH = "";
+ private final static String DEFAULT_SOURCE_NAME = "default";
+ private final static String DEFAULT_HOST = "localhost";
+
+ private static String userHomeKey = "user.home";
+
+ protected static String user = DEFAULT_USER;
+ protected static String password = DEFAULT_PASSWORD;
+ protected static int httpPort = DEFAULT_HTTP_PORT;
+ protected static String contextPath = DEFAULT_CONTEXT_PATH;
+ protected static String sourceName = DEFAULT_SOURCE_NAME;
+ protected static String host = DEFAULT_HOST;
+
+ @BeforeClass
+ public static void initializeTestConfig() {
+ try {
+ String userHomeDirPath;
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test");
+
+ URL userHomeDirURL = bundle.getEntry("src/test/resources");
+ File userHomeDir = new File(FileLocator.resolve(userHomeDirURL).toURI());
+ userHomeDirPath = userHomeDir.getAbsolutePath();
+
+ URL serverPropertiesURL = bundle.getEntry("src/test/resources/server.properties");
+ File serverPropertiesFile = new File(FileLocator.resolve(serverPropertiesURL).toURI());
+ InputStream inputStream = new FileInputStream(serverPropertiesFile);
+
+ Properties prop = new Properties();
+
+ prop.load(inputStream);
+ inputStream.close();
+
+
+ logger.warn("Setting user.home to " + userHomeDirPath);
+ System.setProperty(userHomeKey, userHomeDirPath);
+
+
+ if(prop.getProperty("user") != null) {
+ user = prop.getProperty("user");
+ }
+
+ if(prop.getProperty("password") != null) {
+ password = prop.getProperty("password");
+ }
+
+ if(prop.getProperty("httpPort") != null) {
+ httpPort = Integer.valueOf(prop.getProperty("httpPort"));
+ }
+
+ if(prop.getProperty("contextPath") != null) {
+ contextPath = prop.getProperty("contextPath");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ // Assert.fail("Server failed to start. Reason : " + e.getMessage());
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.httpinvoker;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2015
+ *
+ */
+public abstract class TestThread extends Thread {
+ Throwable throwable;
+ boolean isBlocked = false;
+
+ public TestThread() {
+
+ }
+
+ public TestThread(boolean blocking) {
+ isBlocked = blocking;
+ }
+ /**
+ * @return the throwable
+ */
+ public Throwable getThrowable() {
+ return throwable;
+ }
+
+ /**
+ * @param throwable the throwable to set
+ */
+ public void setThrowable(Throwable throwable) {
+ this.throwable = throwable;
+ }
+
+ public void unblock() {
+ isBlocked = false;
+ }
+
+ @Override
+ public final void run() {
+ try {
+ while(isBlocked) {};
+ doRun();
+ } catch(Exception ex) {
+ throwable = ex;
+ } catch(AssertionError ae) {
+ throwable = ae;
+ }
+ }
+
+ public abstract void doRun() throws Exception, AssertionError;
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.httpinvoker;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.After;
+
+/**
+ * @author cmathew
+ * @date 16 Oct 2015
+ *
+ */
+public abstract class ThreadedTest extends TestConfig {
+
+ private Set<TestThread> threadPool = new HashSet<TestThread>();
+
+ protected void invokeThread(TestThread thread) {
+ threadPool.add(thread);
+ thread.start();
+ }
+
+ @After
+ public void cleanup() throws Throwable {
+ try {
+ for(TestThread thread : threadPool) {
+ if(thread.isAlive()) {
+ thread.join();
+ }
+ }
+
+ for(TestThread thread : threadPool) {
+ if(thread.getThrowable() != null) {
+ throw thread.getThrowable();
+ }
+ }
+ } finally {
+ threadPool.clear();
+ }
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.lazyloading;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+
+
+
+
+/**
+ * Class to test the {@link CdmApplicationRemoteController}
+ *
+ */
+// FIXME:Remoting need to create a proper dataset for this test
+// Could be combined with RemotePersistentCollectionTest
+@Ignore
+@DataSet
+public class AbstractLazyInitializerTest extends BaseRemotingTest {
+ private static final Logger logger = Logger.getLogger(AbstractLazyInitializerTest.class);
+
+ private static IClassificationService classificationService;
+ private static ITaxonService taxonService;
+
+ private static List<TaxonNode> taxonNodes;
+
+ private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
+ private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
+
+
+ @BeforeClass
+ public static void initializeRemoteLazyLoading() {
+
+ taxonService = getRemoteApplicationController().getTaxonService();
+ classificationService= getRemoteApplicationController().getClassificationService();
+ List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
+ Assert.assertFalse(classifications.isEmpty());
+
+ Classification classification = classifications.get(0);
+ Assert.assertNotNull(classification);
+ taxonNodes = classificationService.getAllNodes();
+ Assert.assertFalse(taxonNodes.isEmpty());
+
+ }
+
+
+
+ @Test
+ public void testCDMEntityGet() {
+ //ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+ Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
+ int maxcount = 30;
+ int count = 0;
+ while(taxonNodeItr.hasNext() && count <= maxcount) {
+ TaxonNode taxonNode = taxonNodeItr.next();
+ Assert.assertNotNull(taxonNode);
+
+ Taxon taxon = taxonNode.getTaxon();
+ Assert.assertNotNull(taxon);
+
+ String taxonTitle = taxon.getTitleCache();
+ logger.info("Taxon : " + taxonTitle);
+
+ TaxonNameBase name = taxon.getName();
+ Assert.assertNotNull(name);
+
+ String nameTitle = name.getTitleCache();
+ logger.info("Taxon Name : " + nameTitle);
+
+ count++;
+ }
+ }
+
+ @Test
+ public void taxonReadTest() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ }
+
+
+ @Test
+ public void testCDMEntitySave() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+ String oldTitleCache = taxon.getTitleCache();
+
+ System.out.println("Taxon title : " + oldTitleCache);
+
+ taxon.setTitleCache(oldTitleCache + ":updated", true);
+ taxonService.merge(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
+
+ Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(taxonNew.getTitleCache()));
+
+
+ taxonNew.setTitleCache(oldTitleCache, true);
+ taxonService.merge(taxonNew);
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+ System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
+
+ Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
+
+ }
+
+
+ @Test
+ public void testCDMEntitySaveLazyNew() {
+ Team combAuthor = Team.NewInstance();
+ combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
+ BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
+ name.setCombinationAuthorship(combAuthor);
+ Taxon tax1 = Taxon.NewInstance(name, null);
+ UUID taxonUuid1 = taxonService.save(tax1).getUuid();
+
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ String oldTitleCache = nvn.getTitleCache();
+ logger.info("Taxon Name Title : " + oldTitleCache);
+ nvn.setTitleCache(oldTitleCache + ":updated",false);
+ taxonService.update(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
+
+ Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(nvnNew.getTitleCache()));
+
+ nvnNew.setTitleCache(oldTitleCache, true);
+ taxonService.update(taxon);
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+ NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
+
+ Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
+ }
+
+ @Ignore
+ @Test
+ public void testCDMEntitySaveCollection() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
+ Set<String> relToTitles = new HashSet<String>();
+ Iterator<SynonymRelationship> srItr = synRelations.iterator();
+ while(srItr.hasNext()) {
+ SynonymRelationship sr = srItr.next();
+ System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
+ relToTitles.add(sr.getSynonym().getTitleCache());
+ sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
+
+ }
+ taxonService.merge(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
+
+ Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
+ Iterator<String> relToTitlesItr = relToTitles.iterator();
+ while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
+ SynonymRelationship srNew = srItrNew.next();
+ String relToTitle = relToTitlesItr.next();
+ System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
+ Assert.assertTrue("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache().equals(relToTitle));
+ srNew.getSynonym().setTitleCache(relToTitle);
+ }
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+
+ Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
+ Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
+ relToTitlesItr = relToTitles.iterator();
+ while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
+ SynonymRelationship srOld = srItrOld.next();
+ String relToTitle = relToTitlesItr.next();
+ System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
+ Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
+
+ }
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.lazyloading;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+
+
+public class CdmServiceCacherTest extends RemotingSessionAwareTest {
+ private static final Logger logger = Logger.getLogger(CdmServiceCacherTest.class);
+
+
+ private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
+
+ @Test
+ public void testLanguageCache() {
+ Language defaultLanguage = Language.getDefaultLanguage();
+
+ Language defaultLanguageInCache = (Language)cdmServiceCacher.getFromCache(defaultLanguage.getUuid());
+ Assert.assertEquals("Loaded Language Term should match Language Term in Cache",defaultLanguage,defaultLanguageInCache);
+
+ Language language = Language.getLanguageFromUuid(Language.uuidFrench);
+ Language languageInCache = (Language)cdmServiceCacher.getFromCache(language.getUuid());
+ Assert.assertEquals("Loaded Language Term should match Language Term in Cache",language,languageInCache);
+
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.lazyloading;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * This test class is primarily for performance testing.
+ * It should be used to make read-only calls to the target cdm-server.
+ *
+ * @author cmathew
+ * @date 26 Aug 2015
+ *
+ */
+//FIXME:Remoting ignoring until we can target integration servers
+@Ignore
+public class PropertyPathsTest extends BaseRemotingTest {
+
+ @Test
+ public void taxonLoadTest() {
+ // load taxon Crepis from cichorieae
+ UUID taxonBaseUuid = UUID.fromString("d0ae2121-1c32-4737-8c49-f871d429fd90");
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "synonymRelations.synonym.name.status.type",
+ "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.relatedFrom.name.status"
+ });
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, taxonBasePropertyPaths);
+ Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+ Set<SynonymRelationship> synonymRelations = taxon.getSynonymRelations();
+ for(SynonymRelationship rel : synonymRelations) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ Set<TaxonNameBase> typifiedNames = taxon.getName().getHomotypicalGroup().getTypifiedNames();
+ for(TaxonNameBase name : typifiedNames) {
+ Set<TaxonBase> taxonBases = name.getTaxonBases();
+ for(TaxonBase tb : taxonBases) {
+ if(tb instanceof Synonym) {
+ Synonym syn = CdmBase.deproxy(tb, Synonym.class);
+ Set<SynonymRelationship> rels = syn.getSynonymRelations();
+ for(SynonymRelationship rel : rels) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ }
+ if(tb instanceof Taxon) {
+ Taxon syn = CdmBase.deproxy(tb, Taxon.class);
+ Set<SynonymRelationship> rels = syn.getSynonymRelations();
+ for(SynonymRelationship rel : rels) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.lazyloading;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+
+
+
+/**
+ * Test class which tests remoting for persistent cdm entities.
+ *
+ * FIXME:Remoting saving tests are ignored until the merge development is underway
+ * @author c.mathew
+ *
+ */
+//FIXME:Remoting need to create a proper dataset for this test
+//Could be combined with AbstractLazyInitializerTest
+@Ignore
+public class RemoteLazyLoadingTest extends BaseRemotingTest {
+
+ private static final Logger logger = Logger.getLogger(RemoteLazyLoadingTest.class);
+
+ private static IClassificationService classificationService;
+ private static ITaxonService taxonService;
+
+ private static List<TaxonNode> taxonNodes;
+
+ private final UUID taxonUuid1 = UUID.fromString("8217ef77-2ab1-4318-bd67-ccd0cdef07c4");
+ private final UUID taxonUuid2 = UUID.fromString("ef96fafa-7750-4141-b31b-1ad1daab3e76");
+
+
+ @BeforeClass
+ public static void initializeRemoteLazyLoading() {
+ taxonService = getRemoteApplicationController().getTaxonService();
+
+ classificationService= getRemoteApplicationController().getClassificationService();
+ //List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
+// Assert.assertFalse(classifications.isEmpty());
+//
+// Classification classification = classifications.get(0);
+// Assert.assertNotNull(classification);
+ taxonNodes = classificationService.getAllNodes();
+ Assert.assertFalse(taxonNodes.isEmpty());
+
+ }
+
+
+
+ @Test
+ public void testCDMEntityGet() {
+ Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
+ int maxcount = 30;
+ int count = 0;
+ while(taxonNodeItr.hasNext() && count <= maxcount) {
+ TaxonNode taxonNode = taxonNodeItr.next();
+ Assert.assertNotNull(taxonNode);
+
+ Taxon taxon = taxonNode.getTaxon();
+ Assert.assertNotNull(taxon);
+
+ String taxonTitle = taxon.getTitleCache();
+ logger.info("Taxon : " + taxonTitle);
+
+ TaxonNameBase name = taxon.getName();
+ Assert.assertNotNull(name);
+
+ String nameTitle = name.getTitleCache();
+ logger.info("Taxon Name : " + nameTitle);
+
+ count++;
+ }
+
+
+ }
+
+ @Test
+ public void test() {
+
+ }
+
+ @Test
+ public void testCDMEntitySaveEager() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+ String oldTitleCache = taxon.getTitleCache();
+
+ System.out.println("Taxon title : " + oldTitleCache);
+
+ taxon.setTitleCache(oldTitleCache + ":updated");
+ taxonService.merge(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ System.out.println("New Taxon Title : " + taxonNew.getTitleCache());
+
+ Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(taxonNew.getTitleCache()));
+
+ taxonNew.setTitleCache(oldTitleCache);
+ taxonService.merge(taxonNew);
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+ System.out.println("Old Taxon Title : " + taxonOld.getTitleCache());
+
+ Assert.assertEquals("Title caches should be equal",oldTitleCache,taxonOld.getTitleCache());
+
+ }
+
+
+ @Test
+ public void testCDMEntityUpdate() {
+
+ Team combAuthor = Team.NewInstance();
+ combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
+ BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
+ name.setCombinationAuthorship(combAuthor);
+ Taxon taxon = Taxon.NewInstance(name, null);
+ UUID taxonUuid = taxonService.save(taxon).getUuid();
+
+ // Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+ // NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ // String oldTitleCache = nvn.getTitleCache();
+ // System.out.println("Taxon Name Title : " + oldTitleCache);
+ // nvn.setTitleCache(oldTitleCache + ":updated", true);
+ //
+ // taxon.setTitleCache(oldTitleCache + ":updated",true);
+ // try {
+ // taxonService.update(taxon);
+ // } catch (LazyInitializationException lie) {
+ // lie.printStackTrace();
+ // }
+
+ List<String> TAXON_INIT_STRATEGY = Arrays.asList(new String[] {
+ "name"
+ });
+ Taxon taxonNew = (Taxon)taxonService.findTaxonByUuid(taxonUuid,TAXON_INIT_STRATEGY);
+ NonViralName nvn = CdmBase.deproxy(taxonNew.getName(),NonViralName.class);
+ Team team = CdmBase.deproxy(nvn.getCombinationAuthorship(),Team.class);
+ String oldTitleCache = nvn.getTitleCache();
+ System.out.println("Taxon Name Title : " + oldTitleCache);
+ nvn.setTitleCache(oldTitleCache + ":updated", true);
+ taxonService.update(taxonNew);
+
+ }
+
+
+ @Test
+ public void testCDMEntitySaveLazy() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ String oldTitleCache = nvn.getTitleCache();
+ System.out.println("Taxon Name Title : " + oldTitleCache);
+ nvn.setTitleCache(oldTitleCache + ":updated", true);
+ taxonService.update(taxon);
+
+ // Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ // NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ // System.out.println("New Taxon Name Title : " + nvnNew.getTitleCache());
+ //
+ // Assert.assertNotEquals("Title caches should not be equal",oldTitleCache,nvnNew.getTitleCache());
+ //
+ // nvnNew.setTitleCache(oldTitleCache, true);
+ // taxonService.update(taxon);
+ //
+ // Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+ // NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ // System.out.println("Old Taxon Name Title : " + nvnNew.getTitleCache());
+ //
+ // Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
+ }
+
+ @Test
+ public void testCDMEntitySaveLazyNew() {
+ Team combAuthor = Team.NewInstance();
+ combAuthor.addTeamMember(Person.NewTitledInstance("test member"));
+ BotanicalName name = BotanicalName.NewInstance(null, "Test1", null, null, null, null, null, null, null);
+ name.setCombinationAuthorship(combAuthor);
+ Taxon tax1 = Taxon.NewInstance(name, null);
+ UUID taxonUuid1 = taxonService.save(tax1).getUuid();
+
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ NonViralName nvn = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ String oldTitleCache = nvn.getTitleCache();
+ logger.info("Taxon Name Title : " + oldTitleCache);
+ nvn.setTitleCache(oldTitleCache + ":updated",false);
+ taxonService.update(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ NonViralName nvnNew = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ logger.info("New Taxon Name Title : " + nvnNew.getTitleCache());
+
+ Assert.assertTrue("Title caches should not be equal",oldTitleCache.equals(nvnNew.getTitleCache()));
+
+ nvnNew.setTitleCache(oldTitleCache, true);
+ taxonService.update(taxon);
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+ NonViralName nvnOld = CdmBase.deproxy(taxon.getName(),NonViralName.class);
+ logger.info("Old Taxon Name Title : " + nvnNew.getTitleCache());
+
+ Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
+ }
+ @Ignore
+ @Test
+ public void testCDMEntitySaveCollection() {
+ Taxon taxon = (Taxon)taxonService.find(taxonUuid1);
+
+ Set<SynonymRelationship> synRelations = taxon.getSynonymRelations();
+ Set<String> relToTitles = new HashSet<String>();
+ Iterator<SynonymRelationship> srItr = synRelations.iterator();
+ while(srItr.hasNext()) {
+ SynonymRelationship sr = srItr.next();
+ System.out.println("Synonym Title Cache : " + sr.getSynonym().getTitleCache());
+ relToTitles.add(sr.getSynonym().getTitleCache());
+ sr.getSynonym().setTitleCache(sr.getSynonym().getTitleCache() + ":updated");
+
+ }
+ taxonService.merge(taxon);
+
+ Taxon taxonNew = (Taxon)taxonService.find(taxonUuid1);
+ Set<SynonymRelationship> synRelationsNew = taxonNew.getSynonymRelations();
+
+ Iterator<SynonymRelationship> srItrNew = synRelationsNew.iterator();
+ Iterator<String> relToTitlesItr = relToTitles.iterator();
+ while(srItrNew.hasNext() && relToTitlesItr.hasNext()) {
+ SynonymRelationship srNew = srItrNew.next();
+ String relToTitle = relToTitlesItr.next();
+ System.out.println("New Synonym Title Cache: " + srNew.getSynonym().getTitleCache());
+ Assert.assertTrue("Synonym Title caches should not be equal", srNew.getSynonym().getTitleCache().equals(relToTitle));
+ srNew.getSynonym().setTitleCache(relToTitle);
+ }
+
+ Taxon taxonOld = (Taxon)taxonService.find(taxonUuid1);
+
+ Set<SynonymRelationship> synRelationsOld = taxonNew.getSynonymRelations();
+ Iterator<SynonymRelationship> srItrOld = synRelationsOld.iterator();
+ relToTitlesItr = relToTitles.iterator();
+ while(srItrOld.hasNext() && relToTitlesItr.hasNext()) {
+ SynonymRelationship srOld = srItrOld.next();
+ String relToTitle = relToTitlesItr.next();
+ System.out.println("New Synonym Title Cache: " + srOld.getSynonym().getTitleCache());
+ Assert.assertEquals("Synonym Title caches should be equal", srOld.getSynonym().getTitleCache(), relToTitle);
+
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2014 EDIT
+* 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.lazyloading;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.description.TextData;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+
+/**
+ * Test class which tests remoting for persistent collections.
+ *
+ * @author c.mathew
+ * @created 13.03.2014
+ */
+//FIXME:Remoting need to create a proper dataset for this test
+//Could be combined with AbstractLazyInitializerTest
+@Ignore
+public class RemotePersistentCollectionTest extends BaseRemotingTest {
+ private static final Logger logger = Logger.getLogger(RemotePersistentCollectionTest.class);
+
+ private static IClassificationService classificationService;
+ private static ICommonService commonService;
+
+ @BeforeClass
+ public static void initializeServices() {
+ classificationService = getRemoteApplicationController().getClassificationService();
+ commonService = getRemoteApplicationController().getCommonService();
+ }
+
+ /**
+ * Test method which checks remoting for persistent lists.
+ *
+ */
+ @Test
+ public void persistentListTest() {
+
+ List<TaxonNode> taxonNodes = classificationService.getAllNodes();
+ int size = taxonNodes.size();
+ logger.debug("classificationService.getAllNodes() size : " + size);
+ TaxonNode taxonNode = null;
+ if(size > 0) {
+ Assert.assertFalse(taxonNodes.isEmpty());
+
+ taxonNode = taxonNodes.get(0);
+ Assert.assertNotNull(taxonNode);
+ Assert.assertTrue(taxonNodes.contains(taxonNode));
+
+ // get the list of child nodes, which will give a
+ // proxy list which is not yet initialised
+ List<TaxonNode> childNodes = taxonNode.getChildNodes();
+ // this size call will first initialise the list locally by internally
+ // calling the ICommonService.initializeCollection method and then
+ // call size on the initialised list
+ int childCount = childNodes.size();
+
+ // this size call will initialise the list remotely and only return the
+ // size of the list
+ int remoteChildCount = commonService.size(taxonNode.getUuid(), "childNodes");
+ Assert.assertEquals(childCount, remoteChildCount);
+
+ String firstNodeTaxonTitle = taxonNode.getTaxon().getTitleCache();
+ Assert.assertNotNull(firstNodeTaxonTitle);
+
+ if(childCount > 0) {
+ Assert.assertFalse(childNodes.isEmpty());
+ // this get call will use the already initialised list to get the
+ // 0th element
+ TaxonNode localTaxonNode = childNodes.get(0);
+
+ // this get call will initialise the list remotely and only return the
+ // 0th element from the list
+ TaxonNode remoteTaxonNode = (TaxonNode)commonService.get(taxonNode.getUuid(), "childNodes",0);
+
+ // the locally and remotely retrieved taxon node should exist in the
+ // (local and remote) child nodes list, should be not-null and should be equal to each other
+ Assert.assertTrue(taxonNode.getChildNodes().contains(localTaxonNode));
+ Assert.assertTrue(taxonNode.getChildNodes().contains(remoteTaxonNode));
+ Assert.assertTrue(commonService.contains(taxonNode.getUuid(), "childNodes", localTaxonNode));
+ Assert.assertTrue(commonService.contains(taxonNode.getUuid(), "childNodes", remoteTaxonNode));
+ Assert.assertNotNull(remoteTaxonNode);
+ Assert.assertNotNull(localTaxonNode);
+ Assert.assertEquals(remoteTaxonNode,localTaxonNode);
+ }
+ }
+ }
+
+// @Test
+// public void persistentSetTest() {
+// List<Classification> classifications = classificationService.listClassifications(1,0,null,null);
+// int size = classifications.size();
+// if(size > 0) {
+// Assert.assertFalse(classifications.isEmpty());
+//
+// Classification classification = classifications.get(0);
+// Assert.assertNotNull(classification);
+// Assert.assertTrue(classifications.contains(classification));
+//
+// TaxonNode rootTaxonNode = classification.getRootNode();
+// // get the list of child nodes, which will give a
+// // proxy list which is not yet initialised
+// List<TaxonNode> childNodes = rootTaxonNode.getChildNodes();
+//
+// // this size call will initialise the list locally by internally
+// // calling the ICommonService.initializeCollection method
+// int childCount = childNodes.size();
+//
+// if(childCount > 0) {
+// Assert.assertFalse(childNodes.isEmpty());
+//
+// // this get call will use the already initialised list to get the
+// // 0th element
+// Taxon localTaxon = childNodes.get(0).getTaxon();
+// Assert.assertNotNull(localTaxon);
+//
+// TaxonNameBase taxonName = localTaxon.getName();
+// Assert.assertNotNull(taxonName);
+//
+// // get the list of taxa, which will give a
+// // proxy set which is not yet initialised
+// Set<Taxon> taxa = taxonName.getTaxonBases();
+//
+// // this size call will initialise the list locally by internally
+// // calling the ICommonService.initializeCollection method
+// int taxaCount = taxa.size();
+// Assert.assertNotEquals(taxaCount,-1);
+//
+// if(taxaCount > 0) {
+// Assert.assertFalse(taxa.isEmpty());
+// // the locally retrieved taxon should exist in the
+// // (local and remote) taxon list and should be not-null
+// Assert.assertTrue(taxa.contains(localTaxon));
+// Assert.assertNotNull(localTaxon);
+// Assert.assertTrue(commonService.contains((PersistentCollection)taxa, localTaxon));
+// }
+// }
+// }
+// }
+
+ @Test
+ public void persistentMapTest() {
+ List<TaxonNode> taxonNodes = classificationService.getAllNodes();
+ // calling iterator will initialise the collection
+ Iterator<TaxonNode> taxonNodesItr = taxonNodes.iterator();
+ while(taxonNodesItr.hasNext()) {
+ TaxonNode taxonNode = taxonNodesItr.next();
+ Taxon taxon = taxonNode.getTaxon();
+
+ if(taxon != null) {
+ Set<TaxonDescription> descriptions = taxon.getDescriptions();
+ Iterator<TaxonDescription> descriptionsItr = descriptions.iterator();
+ while(descriptionsItr.hasNext()) {
+ TaxonDescription desc = descriptionsItr.next();
+ if(desc != null) {
+ for (DescriptionElementBase element : desc.getElements()){
+ if (element.isInstanceOf(TextData.class)){
+ // usually a call to 'get' collections should not initialise the collection,
+ // but the 'getMultilanguageText' call internally calls readSize on the collection
+ // which triggers the initialisation
+ Map<Language, LanguageString> multilanguagetextMap = ((TextData)element).getMultilanguageText();
+ //boolean init = AbstractPersistentCollection.isInitialized(multilanguagetextMap);
+ //Assert.assertTrue(init);
+
+ if(!multilanguagetextMap.isEmpty()) {
+ // found a map whcih we can test!
+ logger.info("Found Non-empty multilanguagetextMap");
+ boolean empty = commonService.isEmpty(element.getUuid(), "multilanguageText");
+ Assert.assertFalse(empty);
+ // test retrieval of key set, which should already by initialised
+ Set<Language> langKeySet = multilanguagetextMap.keySet();
+ Iterator<Language> langKeySetItr = langKeySet.iterator();
+ while(langKeySetItr.hasNext()) {
+ Language key = langKeySetItr.next();
+ // testing 'containsKey' on locally initialised collection
+ boolean localContainsKey = multilanguagetextMap.containsKey(key);
+ Assert.assertTrue(localContainsKey);
+ // testing 'containsKey' on remotely initialised collection
+ boolean remoteContainsKey =
+ commonService.containsKey(element.getUuid(), "multilanguageText", key);
+ Assert.assertTrue(remoteContainsKey);
+
+ LanguageString value = multilanguagetextMap.get(key);
+ // testing 'containsValue' on locally initialised collection
+ boolean localContainsValue = multilanguagetextMap.containsValue(value);
+ Assert.assertTrue(localContainsValue);
+ // testing 'containsValue' on remotely initialised collection
+ boolean remoteContainsValue =
+ commonService.containsValue(element.getUuid(), "multilanguageText", value);
+ Assert.assertTrue(remoteContainsValue);
+
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.navigation.navigator.contextmenu;\r
\r
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;\r
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;\r
import org.junit.Before;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
import eu.etaxonomy.taxeditor.test.AbstractEditorTest;\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class ClassificationTest extends AbstractEditorTest {\r
\r
private SWTBotView navigatorView;\r
private SWTBotTree tree;\r
\r
- @Before\r
+ @Override\r
+ @Before\r
public void setup() {\r
super.setup();\r
navigatorView = utils.view("Taxon Navigator");\r
tree = utils.tree(navigatorView.getWidget());\r
}\r
- \r
+\r
@Test\r
public void canDeleteClassification() throws Exception {\r
tree.select(0);\r
bot.waitUntil(Conditions.shellIsActive("Confirm Deletion"));\r
utils.ok();\r
}\r
- \r
+\r
@Test\r
public void canCreateClassification() throws Exception {\r
tree.setFocus();\r
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.newWizard;\r
\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
import eu.etaxonomy.taxeditor.test.AbstractEditorTest;\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class NewTaxonWizardTest extends AbstractEditorTest {\r
\r
@Override\r
bot.menu("General").menu("New").menu("Taxon").click();\r
bot.waitUntil(Conditions.shellIsActive("New Entity"));\r
}\r
- \r
+\r
@Test\r
public void unalteredDialogCanNotBefinished() {\r
boolean finishIsEnabled = bot.button("Finish").isEnabled();\r
Assert.assertEquals(false, finishIsEnabled);\r
utils.cancel();\r
}\r
- \r
+\r
@Test\r
public void canCreateNewTaxonMinimal(){\r
utils.openFilteredSelection(0, "Choose a Classification");\r
bot.textWithLabel("New Taxon").setText(newTaxonName);\r
bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Finish")));\r
utils.finish();\r
- \r
+\r
// bot.waitUntil(Conditions.waitForEditor(WithPartId.withPartId(MultiPageTaxonEditor.ID)));\r
// Assert.assertEquals(newTaxonName, bot.activeEditor().getTitle());\r
}\r
- \r
- \r
\r
- \r
+\r
+\r
+\r
}\r
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.operation;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.Before;
+
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.test.MockConversationEnabled;
+
+/**
+ * @author n.hoffmann
+ * @created 15.04.2009
+ * @version 1.0
+ */
+public abstract class BaseOperationTest extends RemotingSessionAwareTest {
+
+ public static final IUndoContext undoContext = null;
+
+ public static final IProgressMonitor monitor = new NullProgressMonitor();
+ public static final IAdaptable info = null;
+ public static final IPostOperationEnabled postOperation = null;
+ public static final IConversationEnabled conversationEnabled = new MockConversationEnabled();
+ public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null;
+
+ protected static AbstractOperation operation;
+
+ @Before
+ public void initializeOperations() {
+ RemotingCdmUpdateOperation.throwExceptions = true;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingUpdatePolytomousKeyAllNodesOperation;
+
+/**
+ * @author cmathew
+ * @date 25 Jun 2015
+ *
+ */
+@DataSet
+public class PolytomousKeyViewPartTest extends BaseOperationTest {
+
+ IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+ private static UUID pkey1Uuid = UUID.fromString("f82cef88-5a9e-4917-9938-d08bda40836f");
+ private static UUID pkey2Uuid = UUID.fromString("a00ca7ec-b660-433c-bd14-596826ab2243");
+ private static UUID pkey3Uuid = UUID.fromString("197bc542-bf5b-4a52-aa66-c65df32c196b");
+
+ @Ignore // waiting for #3998 to be fixed
+ @Test
+ public void testDeletePolytomousKey() throws ExecutionException {
+ List<PolytomousKey> pKeysBeforeDelete = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+ int initialCount = pKeysBeforeDelete.size();
+
+ List<PolytomousKey> keysToDelete = new ArrayList<PolytomousKey>();
+ keysToDelete.add(polytomousKeyService.load(pkey1Uuid));
+ keysToDelete.add(polytomousKeyService.load(pkey2Uuid));
+ keysToDelete.add(polytomousKeyService.load(pkey3Uuid));
+
+ List<UUID> uuids = new ArrayList<UUID>();
+ uuids.add(pkey1Uuid);
+ uuids.add(pkey2Uuid);
+ uuids.add(pkey3Uuid);
+
+ int keysToDeleteCount = keysToDelete.size();
+ operation = new RemotingDeletePolytomousKeyOperation(sessionOwner,
+ false,
+ uuids);
+ operation.execute(monitor, info);
+
+ List<PolytomousKey> pKeysAfterDelete = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+ Assert.assertEquals(initialCount - keysToDeleteCount, pKeysAfterDelete.size());
+ for(PolytomousKey key : keysToDelete) {
+ Assert.assertFalse(pKeysAfterDelete.contains(key));
+ }
+
+ }
+
+ @Test
+ public void testUpdateAllNodes() throws ExecutionException {
+ operation = new RemotingUpdatePolytomousKeyAllNodesOperation(sessionOwner,
+ false,
+ pkey1Uuid);
+ operation.execute(monitor, info);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionException;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.UpdateResult.Status;
+import eu.etaxonomy.cdm.api.service.dto.CdmEntityIdentifier;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils;
+import eu.etaxonomy.taxeditor.store.operations.RemotingTestUpdateOperation;
+
+/**
+ * @author cmathew
+ * @date 26 Jun 2015
+ *
+ */
+@DataSet
+public class RemotingCdmUpdateOperationTest extends BaseOperationTest {
+
+ private static final Logger logger = Logger.getLogger(RemotingCdmUpdateOperationTest.class);
+
+ private static ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+
+ private static UUID taxonNodeUuid1;
+ private static UUID taxonNodeUuid2;
+ private static UUID taxonNodeUuid3;
+ private static UUID taxonNodeUuid4;
+ private static UUID taxonNodeUuid5;
+
+
+ private static Set<TaxonNode> taxonNodes;
+ private static Set<CdmEntityIdentifier> ceis;
+
+ @BeforeClass
+ public static void initializeUpdatedObjects() {
+ taxonNodeUuid1 = UUID.fromString("b85b5b78-6760-409f-ac91-bb89e95ff2a1");
+ taxonNodeUuid2 = UUID.fromString("6ad8e9e2-f5f6-41ad-aa30-f62a903650db");
+ taxonNodeUuid3 = UUID.fromString("91698cec-615f-4472-9002-feda1a6acded");
+ taxonNodeUuid4 = UUID.fromString("b8439f51-6b96-445a-b401-7a836ba1cf58");
+ taxonNodeUuid5 = UUID.fromString("629b3fd3f-29b4-4011-ab12-9c1ad1607dbd");
+
+ }
+
+ @Test
+ public void testUpdateResultWithCdmEntities() throws ExecutionException {
+ TaxonNode taxonNode1 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid1));
+ TaxonNode taxonNode2 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid2));
+ TaxonNode taxonNode3 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid3));
+ TaxonNode taxonNode4 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid4));
+ TaxonNode taxonNode5 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid5));
+
+ taxonNodes = new HashSet<TaxonNode>();
+ taxonNodes.add(taxonNode1);
+ taxonNodes.add(taxonNode2);
+ taxonNodes.add(taxonNode3);
+ taxonNodes.add(taxonNode4);
+ taxonNodes.add(taxonNode5);
+
+ UpdateResult result = new UpdateResult();
+ result.addUpdatedObjects(taxonNodes);
+ result.setStatus(Status.OK);
+
+ sessionOwner.setExpectedUpdatedObjects(taxonNodes);
+
+ operation = new RemotingTestUpdateOperation(result, sessionOwner, false);
+ operation.execute(monitor, info);
+
+ Assert.assertEquals(taxonNodes, sessionOwner.getEventUpdatedObjects());
+ }
+
+ @Test
+ public void testUpdateResultWithCdmIdentities() throws ExecutionException {
+ TaxonNode taxonNode1 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid1));
+ TaxonNode taxonNode2 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid2));
+ TaxonNode taxonNode3 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid3));
+ TaxonNode taxonNode4 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid4));
+ TaxonNode taxonNode5 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid5));
+
+ taxonNodes = new HashSet<TaxonNode>();
+ taxonNodes.add(taxonNode1);
+ taxonNodes.add(taxonNode2);
+ taxonNodes.add(taxonNode3);
+ taxonNodes.add(taxonNode4);
+ taxonNodes.add(taxonNode5);
+
+ ceis = new HashSet<CdmEntityIdentifier>();
+ ceis.add(new CdmEntityIdentifier(taxonNode3.getId(),TaxonNode.class));
+ ceis.add(new CdmEntityIdentifier(taxonNode4.getId(),TaxonNode.class));
+ ceis.add(new CdmEntityIdentifier(taxonNode5.getId(),TaxonNode.class));
+
+ UpdateResult result = new UpdateResult();
+ result.addUpdatedObject(taxonNode1);
+ result.addUpdatedObject(taxonNode2);
+ result.addUpdatedCdmIds(ceis);
+
+ result.setStatus(Status.OK);
+ sessionOwner.setExpectedUpdatedObjects(taxonNodes);
+ operation = new RemotingTestUpdateOperation(result, sessionOwner, false);
+ operation.execute(monitor, info);
+
+ Assert.assertEquals(taxonNodes, sessionOwner.getEventUpdatedObjects());
+ }
+
+ @Test
+ public void testUpdateResultWithLoadedCdmIdentities() throws ExecutionException {
+ TaxonNode taxonNode1 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid1));
+ TaxonNode taxonNode2 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid2));
+ TaxonNode taxonNode3 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid3));
+ TaxonNode taxonNode4 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid4));
+ TaxonNode taxonNode5 = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid5));
+
+ taxonNodes = new HashSet<TaxonNode>();
+ taxonNodes.add(taxonNode1);
+ taxonNodes.add(taxonNode2);
+ taxonNodes.add(taxonNode3);
+ taxonNodes.add(taxonNode4);
+ taxonNodes.add(taxonNode5);
+
+ ceis = new HashSet<CdmEntityIdentifier>();
+ ceis.add(new CdmEntityIdentifier(taxonNode3.getId(),TaxonNode.class));
+ ceis.add(new CdmEntityIdentifier(taxonNode4.getId(),TaxonNode.class));
+ ceis.add(new CdmEntityIdentifier(taxonNode5.getId(),TaxonNode.class));
+
+
+ UpdateResult result = new UpdateResult();
+ result.addUpdatedObject(taxonNode1);
+ result.addUpdatedObject(taxonNode2);
+ result.addUpdatedCdmIds(ceis);
+ result.addUpdatedCdmId(new CdmEntityIdentifier(46,TaxonNode.class));
+
+ result.setStatus(Status.OK);
+ sessionOwner.setExpectedUpdatedObjects(taxonNodes);
+ operation = new RemotingTestUpdateOperation(result, sessionOwner, false);
+ operation.execute(monitor, info);
+
+ Assert.assertEquals(taxonNodes, sessionOwner.getEventUpdatedObjects());
+ }
+
+ @Test
+ public void testDataChange() throws ExecutionException {
+ TaxonNode taxonNode = (TaxonNode) ProxyUtils.deproxy(taxonNodeService.load(taxonNodeUuid1));
+ CdmEntityIdentifier cei = new CdmEntityIdentifier(taxonNode.getId(), TaxonNode.class);
+
+ taxonNodes = new HashSet<TaxonNode>();
+ taxonNodes.add(taxonNode);
+
+ int taxonNodeCountChildren = taxonNode.getCountChildren();
+ sessionOwner.setExpectedUpdatedObjects(taxonNodes);
+
+ operation = new RemotingTestUpdateOperation(cei, sessionOwner, false);
+ operation.execute(monitor, info);
+
+ Set eventUpdatedObjects = sessionOwner.getEventUpdatedObjects();
+ Assert.assertEquals(taxonNodes, eventUpdatedObjects);
+ Assert.assertEquals(taxonNodeCountChildren + 1, ((TaxonNode)eventUpdatedObjects.iterator().next()).getCountChildren());
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.operation;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionException;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.OriginalSourceType;
+import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.description.TextData;
+import eu.etaxonomy.cdm.model.name.BotanicalName;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.NonViralName;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 3 Feb 2015
+ *
+ */
+
+@DataSet
+public class TaxonNameEditorTest extends BaseOperationTest {
+
+ private static final Logger logger = Logger.getLogger(TaxonNameEditorTest.class);
+
+ ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+ ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+ IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
+
+ Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+
+ @Test
+ public void testAddHomotypicSynonym() throws ExecutionException {
+ UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ Taxon taxon = taxonNode.getTaxon();
+ HomotypicalGroup group = taxon.getHomotypicGroup();
+ BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+ newSynonymName.setTitleCache("New Synonym", true);
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+ undoContext, taxon, group, newSynonymName, postOperation);
+
+ operation.execute(monitor, info);
+ taxonNodeService.merge(taxonNode);
+ Assert.assertEquals(taxon.getHomotypicGroup().getTypifiedNames().size(), 2);
+ Assert.assertEquals(taxon.getSynonyms().size(), 1);
+ Iterator<Synonym> synonymItr = taxon.getSynonyms().iterator();
+ Synonym synonym = synonymItr.next();
+ Assert.assertTrue(taxon.getHomotypicGroup().getTypifiedNames().contains(synonym.getName()));
+ }
+
+ @Test
+ public void addHeterotypicSynonym() throws ExecutionException {
+ UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ Taxon taxon = taxonNode.getTaxon();
+ HomotypicalGroup group = taxon.getHomotypicGroup();
+ BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+ newSynonymName.setTitleCache("New Synonym", true);
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+ undoContext, taxon, group, newSynonymName, postOperation);
+
+ operation.execute(monitor, info);
+ taxonNodeService.merge(taxonNode);
+
+
+ }
+
+ @Test
+ public void addDeleteAddHomotypicSynonym() throws ExecutionException {
+ UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ Taxon taxon = taxonNode.getTaxon();
+ HomotypicalGroup group = taxon.getHomotypicGroup();
+ BotanicalName newSynonymName = BotanicalName.NewInstance(null);
+ newSynonymName.setTitleCache("New Synonym", true);
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+ undoContext, taxon, group, newSynonymName, postOperation);
+
+ operation.execute(monitor, info);
+ taxonNodeService.merge(taxonNode);
+ Assert.assertEquals(taxon.getHomotypicGroup().getTypifiedNames().size(), 2);
+
+ Set<Synonym> synonyms = taxon.getSynonyms();
+ for(Synonym synonym : synonyms) {
+ taxonService.deleteSynonym(synonym.getUuid(), taxon.getUuid(), null);
+ }
+
+ taxonNodeService.merge(taxonNode);
+
+ newSynonymName = BotanicalName.NewInstance(null);
+ newSynonymName.setTitleCache("Another New Synonym", true);
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation("Create Synonym In Existing Homotypical Group",
+ undoContext, taxon, group, newSynonymName, postOperation);
+
+ operation.execute(monitor, info);
+ taxonNodeService.merge(taxonNode);
+ }
+
+ @Test
+ public void swapSynonymWithAcceptedTaxon() throws ExecutionException {
+ List<TaxonNode> rootEntities = new ArrayList<TaxonNode>();
+ UUID taxonNodeUuid = UUID.fromString("d425a971-1abe-4895-9e1f-1e5c8ff1c84c");
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ rootEntities.add(taxonNode);
+
+ UUID taxonUuid = UUID.fromString("9763e5f0-6cd4-4d96-b8a4-4420854f7727");
+ Taxon taxon = (Taxon)taxonService.load(taxonUuid);
+ TaxonNameBase taxonName = taxon.getName();
+
+ UUID synonymUuid = UUID.fromString("1eb173bd-b174-4162-8ff5-5136d8f1e746");
+ Synonym synonym = (Synonym)taxonService.load(synonymUuid);
+ TaxonNameBase synonymName = synonym.getName();
+
+ taxonService.swapSynonymAndAcceptedTaxon(synonym.getUuid(), taxon.getUuid());
+
+ Assert.assertEquals(taxonName, synonym.getName());
+ Assert.assertEquals(synonymName, taxon.getName());
+ }
+
+ @Test
+ public void addTaxon() {
+ NonViralName taxonName = NonViralName.NewInstance(null);
+ Taxon taxon = Taxon.NewInstance(taxonName, null);
+ taxonService.merge(taxon);
+ }
+
+ @Ignore
+ @Test
+ public void addDescription() {
+ UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ Taxon taxon = taxonNode.getTaxon();
+ TaxonDescription description = TaxonDescription.NewInstance(taxon);
+
+
+ TextData textData = TextData.NewInstance();
+
+ textData.setFeature(Feature.ECOLOGY());
+ description.addElement(textData);
+
+ DescriptionElementSource descriptionElementSource = DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
+ textData.addSource(descriptionElementSource);
+
+
+ CdmStore.getService(ITaxonNodeService.class).merge(taxonNode);
+
+ description.getId();
+ }
+
+
+ @Test
+ public void addTaxonNodeCascadeProblem() {
+ UUID taxonNodeUuid = UUID.fromString("ce54c396-3694-47f2-abb0-1d7b7e057985");
+
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ Taxon childTaxon = Taxon.NewInstance(null, null);
+ TaxonNode childTaxonNode = taxonNode.addChildTaxon(childTaxon, null, null);
+ Taxon grandChildTaxon = Taxon.NewInstance(null, null);
+ TaxonNode grandChildTaxonNode = childTaxonNode.addChildTaxon(grandChildTaxon, null, null);
+
+ CdmStore.getService(ITaxonNodeService.class).merge(taxonNode,true);
+
+ Assert.assertEquals(taxonNode.getChildNodes().get(0).getId(), childTaxonNode.getId());
+
+ Assert.assertTrue(childTaxonNode.treeIndex() != null);
+ Assert.assertEquals(taxonNode.getChildNodes().get(0).treeIndex(), childTaxonNode.treeIndex());
+ Assert.assertFalse(childTaxon.getId() == 0);
+ Assert.assertEquals(taxonNode.getChildNodes().get(0).getTaxon().getId(), childTaxon.getId());
+
+ Assert.assertTrue(grandChildTaxonNode.treeIndex() != null);
+ Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getId(), grandChildTaxonNode.getId());
+ Assert.assertFalse(grandChildTaxon.getId() == 0);
+ Assert.assertEquals(taxonNode.getChildNodes().get(0).getChildNodes().get(0).getTaxon().getId(), grandChildTaxon.getId());
+ }
+
+}
+
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.operation;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionException;
+import org.junit.Assert;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveFactualDataOperation;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation;
+
+/**
+ * @author cmathew
+ * @date 9 Mar 2015
+ *
+ */
+@DataSet
+public class TaxonNavigatorTest extends BaseOperationTest {
+
+ private static final Logger logger = Logger.getLogger(TaxonNameEditorTest.class);
+
+ ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+ ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+ IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
+
+ Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+
+
+ @Test
+ public void testChangeAcceptedTaxonToSynonym() throws ExecutionException {
+
+
+ UUID oldTaxonNodeNodeUuid = UUID.fromString("b85b5b78-6760-409f-ac91-bb89e95ff2a1");
+ UUID newAcceptedTaxonNodeUuid = UUID.fromString("6ad8e9e2-f5f6-41ad-aa30-f62a903650db");
+
+ TaxonNode oldTaxonNode = taxonNodeService.load(oldTaxonNodeNodeUuid);
+ TaxonNameBase name = oldTaxonNode.getTaxon().getName();
+
+
+ TaxonNode newAcceptedTaxonNode = taxonNodeService.load(newAcceptedTaxonNodeUuid);
+ int countTargetSynonyms = newAcceptedTaxonNode.getTaxon().getSynonyms().size();
+ sessionOwner.addExpectedUpdatedObject(oldTaxonNode.getParent());
+ sessionOwner.addExpectedUpdatedObject(newAcceptedTaxonNode);
+
+ operation = new RemotingChangeAcceptedTaxonToSynonymOperation(sessionOwner,
+ false,
+ oldTaxonNode.getUuid(),
+ newAcceptedTaxonNode.getUuid());
+ operation.execute(monitor, info);
+ newAcceptedTaxonNode = taxonNodeService.load(newAcceptedTaxonNodeUuid);
+ oldTaxonNode = taxonNodeService.load(oldTaxonNodeNodeUuid);
+ Assert.assertNull(oldTaxonNode);
+ Assert.assertEquals(countTargetSynonyms + 1,newAcceptedTaxonNode.getTaxon().getSynonyms().size());
+ Assert.assertEquals(name, newAcceptedTaxonNode.getTaxon().getSynonyms().iterator().next().getName());
+
+
+ }
+
+ @Test
+ public void testMoveTaxon() throws ExecutionException {
+
+ UUID taxonNodeToMoveUuid = UUID.fromString("b8439f51-6b96-445a-b401-7a836ba1cf58");
+ UUID newParentTreeNodeUuid = UUID.fromString("2f05d429-632d-4230-b9cb-70299360b470");
+ boolean moveToParentNode = true;
+
+ TaxonNode taxonNodeToMove = taxonNodeService.load(taxonNodeToMoveUuid);
+ TaxonNode oldParent = taxonNodeToMove.getParent();
+ sessionOwner.addExpectedUpdatedObject(oldParent);
+ int childCount = oldParent.getCountChildren();
+ TaxonNode newParentTreeNode = taxonNodeService.load(newParentTreeNodeUuid);
+ sessionOwner.addExpectedUpdatedObject(newParentTreeNode);
+ operation = new RemotingMoveTaxonOperation(sessionOwner,
+ false,
+ taxonNodeToMove.getUuid(),
+ newParentTreeNode.getUuid(),
+ moveToParentNode);
+ operation.execute(monitor, info);
+ Assert.assertEquals(childCount-1, oldParent.getCountChildren());
+ Assert.assertTrue(!oldParent.getChildNodes().contains(taxonNodeToMove));
+ Assert.assertTrue(newParentTreeNode.getChildNodes().contains(taxonNodeToMove));
+ }
+
+ @Test
+ public void testMoveFactualData() throws ExecutionException {
+ UUID sourceTaxonUuid = UUID.fromString("e40854d7-143f-4054-b229-6ed4cedb4bff");
+ UUID targetTaxonUuid = UUID.fromString("b8402dc4-5050-4882-a147-01b71e0e47d6");
+
+ Taxon sourceTaxon = CdmBase.deproxy(taxonService.load(sourceTaxonUuid), Taxon.class);
+ Set<TaxonDescription> sourceDescriptions = new HashSet(sourceTaxon.getDescriptions());
+ sessionOwner.addExpectedUpdatedObject(sourceTaxon);
+
+ Taxon targetTaxon = CdmBase.deproxy(taxonService.load(targetTaxonUuid), Taxon.class);
+ int countTargetDescriptions = targetTaxon.getDescriptions().size();
+ sessionOwner.addExpectedUpdatedObject(targetTaxon);
+
+ operation = new RemotingMoveFactualDataOperation(sessionOwner,
+ false,
+ sourceTaxonUuid,
+ targetTaxonUuid);
+ operation.execute(monitor, info);
+ Assert.assertEquals(0, sourceTaxon.getDescriptions().size());
+ Assert.assertEquals(sourceDescriptions.size() + countTargetDescriptions, targetTaxon.getDescriptions().size());
+ Assert.assertTrue(targetTaxon.getDescriptions().containsAll(sourceDescriptions));
+ }
+
+ @Test
+ public void testDeleteTaxonNodeWithDeleteChildren() throws ExecutionException {
+ UUID taxonNodeUuid = UUID.fromString("2f05d429-632d-4230-b9cb-70299360b470");
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ List<TaxonNode> childNodes = taxonNode.getChildNodes();
+ List<UUID> childNodeUuids = new ArrayList<UUID>();
+ for(TaxonNode childNode : childNodes) {
+ childNodeUuids.add(childNode.getUuid());
+ }
+ Assert.assertTrue(taxonNode.getCountChildren() > 0);
+
+ Set<ITaxonTreeNode> nodes = new HashSet<ITaxonTreeNode>();
+ nodes.add(taxonNode);
+
+ TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+ configNodes.setChildHandling(ChildHandling.DELETE);
+ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+ config.setTaxonNodeConfig(configNodes);
+
+ sessionOwner.addExpectedUpdatedObject(taxonNode.getParent());
+
+ operation = new RemotingDeleteTaxonNodeOperation(sessionOwner,
+ false,
+ nodes,
+ config);
+ operation.execute(monitor, info);
+ TaxonNode reloadedNode = taxonNodeService.load(taxonNode.getUuid());
+ Assert.assertNull(reloadedNode);
+ for(UUID childNodeUuid : childNodeUuids) {
+ TaxonNode reloadedChildNode = taxonNodeService.load(childNodeUuid);
+ Assert.assertNull(reloadedChildNode);
+ }
+ }
+
+ @Test
+ public void testDeleteTaxonNodes() throws ExecutionException {
+ UUID taxonNode1Uuid = UUID.fromString("99f03b56-67cd-4e01-9ceb-2362d48f9d07");
+ UUID taxonNode2Uuid = UUID.fromString("91698cec-615f-4472-9002-feda1a6acded");
+ UUID taxonNode3Uuid = UUID.fromString("4fe03763-b966-4361-8334-352f6f777588");
+
+ TaxonNode taxonNode1 = taxonNodeService.load(taxonNode1Uuid);
+ TaxonNode taxonNode2 = taxonNodeService.load(taxonNode2Uuid);
+ TaxonNode taxonNode3 = taxonNodeService.load(taxonNode3Uuid);
+
+ Set<ITaxonTreeNode> nodes = new HashSet<ITaxonTreeNode>();
+ nodes.add(taxonNode1);
+ nodes.add(taxonNode2);
+ nodes.add(taxonNode3);
+
+ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+
+
+ sessionOwner.addExpectedUpdatedObject(taxonNode1.getParent());
+ sessionOwner.addExpectedUpdatedObject(taxonNode2.getParent());
+ sessionOwner.addExpectedUpdatedObject(taxonNode3.getParent());
+ operation = new RemotingDeleteTaxonNodeOperation(sessionOwner,
+ false,
+ nodes,
+ config);
+ operation.execute(monitor, info);
+ TaxonNode reloadedNode1 = taxonNodeService.load(taxonNode1.getUuid());
+ TaxonNode reloadedNode2 = taxonNodeService.load(taxonNode2.getUuid());
+ TaxonNode reloadedNode3 = taxonNodeService.load(taxonNode3.getUuid());
+ Assert.assertNull(reloadedNode1);
+ Assert.assertNull(reloadedNode2);
+ Assert.assertNull(reloadedNode3);
+
+ }
+
+ @Test
+ public void testDeleteTaxonNodeWithMovingChildrenToParentNode() throws ExecutionException {
+ UUID taxonNodeUuid = UUID.fromString("2f05d429-632d-4230-b9cb-70299360b470");
+ TaxonNode taxonNode = taxonNodeService.load(taxonNodeUuid);
+ TaxonNode parentTaxonNode = taxonNode.getParent();
+ List<TaxonNode> childNodes = taxonNode.getChildNodes();
+ List<UUID> childNodeUuids = new ArrayList<UUID>();
+ for(TaxonNode childNode : childNodes) {
+ childNodeUuids.add(childNode.getUuid());
+ }
+ Assert.assertTrue(taxonNode.getCountChildren() > 0);
+
+ Set<ITaxonTreeNode> nodes = new HashSet<ITaxonTreeNode>();
+ nodes.add(taxonNode);
+
+ TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+ configNodes.setChildHandling(ChildHandling.MOVE_TO_PARENT);
+ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+ config.setTaxonNodeConfig(configNodes);
+
+ sessionOwner.addExpectedUpdatedObject(taxonNode.getParent());
+ operation = new RemotingDeleteTaxonNodeOperation(sessionOwner,
+ false,
+ nodes,
+ config);
+ operation.execute(monitor, info);
+ TaxonNode reloadedNode = taxonNodeService.load(taxonNode.getUuid());
+ Assert.assertNull(reloadedNode);
+ List<TaxonNode> parentChildNodes = parentTaxonNode.getChildNodes();
+ List<UUID> parentChildNodeUuids = new ArrayList<UUID>();
+ for(TaxonNode parentChildNode : parentChildNodes) {
+ parentChildNodeUuids.add(parentChildNode.getUuid());
+ }
+ parentChildNodeUuids.containsAll(childNodeUuids);
+
+ }
+
+ @Test
+ @DataSet("TaxonNavigatorTest.testDeleteClassificationWithDeleteChildren.xml")
+ public void testDeleteClassificationWithDeleteChildren() throws ExecutionException {
+ UUID classificationUuid = UUID.fromString("0c2b5d25-7b15-4401-8b51-dd4be0ee5cab");
+ Classification classification = classificationService.load(classificationUuid);
+ TaxonNode rootNode = classification.getRootNode();
+ Set<ITaxonTreeNode> nodes = new HashSet<ITaxonTreeNode>();
+ nodes.add(classification);
+
+ TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+ configNodes.setChildHandling(ChildHandling.DELETE);
+ TaxonDeletionConfigurator config = new TaxonDeletionConfigurator();
+ config.setTaxonNodeConfig(configNodes);
+
+ operation = new RemotingDeleteTaxonNodeOperation(sessionOwner,
+ false,
+ nodes,
+ config);
+ operation.execute(monitor, info);
+
+ Classification reloadedClassification = classificationService.load(classification.getUuid());
+ Assert.assertNull(reloadedClassification);
+ TaxonNode reloadedRootNode = taxonNodeService.load(rootNode.getUuid());
+ Assert.assertNull(reloadedRootNode);
+
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.service;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.io.common.ExportResult;
+import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
+import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
+import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
+import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
+import eu.etaxonomy.cdm.io.service.IIOService;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+
+/**
+ * @author cmathew
+ * @date 31 Jul 2015
+ *
+ */
+@DataSet
+public class IOServiceExportTest extends BaseRemotingTest {
+
+ private final IIOService ioService = CdmApplicationState.getIOService();
+ private final INameService nameService = CdmApplicationState.getCurrentAppConfig().getNameService();
+
+ @Test
+ public void exportJaxbTest() throws IOException {
+ JaxbExportConfigurator config = JaxbExportConfigurator.NewInstance(null, null);
+ ExportResult result = ioService.export(config);
+ List<byte[]> dataList = result.getExportData();
+ Assert.assertEquals(1, dataList.size());
+ byte[] exportData = dataList.get(0);
+ String savePath = "target/exportjaxb.xml";
+ FileOutputStream stream = null;
+
+ stream = new FileOutputStream(savePath);
+ stream.write(exportData);
+ stream.close();
+ }
+
+ @Test
+ public void exportSDDTest() throws IOException {
+ SDDExportConfigurator config = SDDExportConfigurator.NewInstance(null, null, null);
+ ExportResult result = ioService.export(config);
+ List<byte[]> dataList = result.getExportData();
+ Assert.assertEquals(1, dataList.size());
+ byte[] exportData = dataList.get(0);
+ String savePath = "target/exportsdd.xml";
+ FileOutputStream stream = null;
+
+ stream = new FileOutputStream(savePath);
+ stream.write(exportData);
+ stream.close();
+
+ }
+
+ @Test
+ public void exportCSVTest() throws IOException {
+ HashSet<UUID> set = new HashSet<UUID>();
+ set.add(UUID.fromString("0c2b5d25-7b15-4401-8b51-dd4be0ee5cab"));
+ CsvDemoExportConfigurator config = CsvDemoExportConfigurator.NewInstance(null, null);
+ config.setClassificationUuids(set);
+ config.setDoTaxa(true);
+ config.setHasHeaderLines(true);
+ config.setClassification(true);
+ config.setTaxonName(true);
+ config.setAuthor(true);
+ config.setRank(true);
+ config.setLastChange(true);
+
+ ExportResult result = ioService.export(config);
+ List<byte[]> dataList = result.getExportData();
+ Assert.assertEquals(1, dataList.size());
+ byte[] exportData = dataList.get(0);
+ String savePath = "target/exportcsv.xml";
+ saveToFile(savePath, exportData);
+ }
+
+ @Test
+ public void exportCSVNameTest() throws IOException {
+ CsvNameExportConfigurator config = CsvNameExportConfigurator.NewInstance(null,null);
+ ExportResult result = ioService.export(config);
+ List<byte[]> dataList = result.getExportData();
+ Assert.assertEquals(1, dataList.size());
+ byte[] exportData = dataList.get(0);
+ String savePath = "target/exportcsvname.xml";
+ saveToFile(savePath, exportData);
+ }
+
+ @Test
+ public void exportCSVPrintTest() throws IOException {
+ CsvNameExportConfigurator config = CsvNameExportConfigurator.NewInstance(null,null);
+ config.setNamesOnly(false);
+ config.setClassificationUUID(UUID.fromString("0c2b5d25-7b15-4401-8b51-dd4be0ee5cab"));
+ ExportResult result = ioService.export(config);
+ List<byte[]> dataList = result.getExportData();
+ Assert.assertEquals(1, dataList.size());
+ byte[] exportData = dataList.get(0);
+ String savePath = "target/exportcsvprint.xml";
+ saveToFile(savePath, exportData);
+ }
+
+ private static void saveToFile(String filePath, byte[] data) throws IOException {
+ FileOutputStream stream = null;
+ stream = new FileOutputStream(filePath);
+ stream.write(data);
+ stream.close();
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.service;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.common.ImportResult;
+import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
+import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
+import eu.etaxonomy.cdm.io.service.IIOService;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
+import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+
+/**
+ *
+ * Note : One issue with this test class is that when the tests are run a second time
+ * against the same server there are errors due to the fact that not all the imported data is deleted.
+ * This needs to be fixed
+ * @author cmathew
+ * @date 5 Aug 2015
+ *
+ */
+@Ignore // seems to cause problems with other tests due to data not deleted
+@DataSet
+public class IOServiceImportTest extends BaseRemotingTest {
+
+ private final IIOService ioService = CdmApplicationState.getIOService();
+ private final INameService nameService = CdmApplicationState.getCurrentAppConfig().getNameService();
+ private final IOccurrenceService occurrenceService = CdmApplicationState.getCurrentAppConfig().getOccurrenceService();
+
+ @Test
+ public void importNormalExplicit() throws IOException {
+ String importFilePath = "src/test/resources/imports/NormalExplicitImport.xls";
+ NormalExplicitImportConfigurator config =
+ NormalExplicitImportConfigurator.NewInstance(null, null, null, null);
+ config.setNomenclaturalCode(NomenclaturalCode.ICNB);
+ config.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.URI);
+ Assert.assertTrue(result.isSuccess());
+ List<TaxonNameBase> list = nameService.list(TaxonNameBase.class, null, null, null, null);
+ Assert.assertEquals(9,list.size());
+ }
+
+
+ @Test
+ public void importAbcd() throws IOException {
+ String importFilePath = "src/test/resources/imports/ABCDImport.xml";
+ Abcd206ImportConfigurator config =
+ Abcd206ImportConfigurator.NewInstance(null, null);
+ config.setNomenclaturalCode(NomenclaturalCode.ICNB);
+ config.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.INPUTSTREAM);
+ Assert.assertTrue(result.isSuccess());
+ Assert.assertTrue(!result.getReports().isEmpty());
+ saveToFile("target/importAbcdReport.txt", result.getReports().get(0));
+ List<TaxonNameBase> list = nameService.list(TaxonNameBase.class, null, null, null, null);
+ Assert.assertEquals(2,list.size());
+ }
+
+ @Test
+ public void importSDD() throws IOException {
+ String importFilePath = "src/test/resources/imports/SDD.xml";
+ SDDImportConfigurator config =
+ SDDImportConfigurator.NewInstance(null, null);
+ config.setNomenclaturalCode(NomenclaturalCode.ICNB);
+ config.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.URI);
+ Assert.assertTrue(result.isSuccess());
+ List<TaxonNameBase> list = nameService.list(TaxonNameBase.class, null, null, null, null);
+ Assert.assertEquals(9,list.size());
+ }
+
+ @Test
+ public void importSpecimenExcel() throws IOException {
+ String importFilePath = "src/test/resources/imports/SpecimenExcelImport.xls";
+ SpecimenCdmExcelImportConfigurator config = SpecimenCdmExcelImportConfigurator.NewInstance(null, null);
+ config.setNomenclaturalCode(NomenclaturalCode.ICNB);
+ config.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.URI);
+ Assert.assertTrue(result.isSuccess());
+// List<SpecimenOrObservationBase> occurrences = occurrenceService.list(SpecimenOrObservationBase.class, null, null, null, null);
+// Assert.assertEquals(3,occurrences.size());
+ }
+
+ @Test
+ public void importTCS() throws IOException {
+ String importFilePath = "src/test/resources/imports/TcsImport.xml";
+ TcsXmlImportConfigurator config = TcsXmlImportConfigurator.NewInstance(null, null);
+ config.setNomenclaturalCode(NomenclaturalCode.ICNB);
+ config.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.URI);
+ Assert.assertTrue(result.isSuccess());
+ List<TaxonNameBase> list = nameService.list(TaxonNameBase.class, null, null, null, null);
+ Assert.assertEquals(16,list.size());
+ }
+
+ private byte[] fileToByteArray(String filePath) throws IOException {
+ Path path = Paths.get(filePath);
+ return Files.readAllBytes(path);
+ }
+
+ private static void saveToFile(String filePath, byte[] data) {
+ FileOutputStream stream = null;
+ try {
+ stream = new FileOutputStream(filePath);
+ stream.write(data);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if(stream != null) {
+ stream.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
+import eu.etaxonomy.cdm.api.service.ITestService;
+import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.cdm.common.monitor.RemotingProgressMonitor;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
+import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 22 Oct 2015
+ *
+ */
+public class ProgressMonitorServiceTest extends RemotingSessionAwareTest {
+
+ private static final Logger logger = Logger.getLogger(ProgressMonitorServiceTest.class);
+
+ ITestService testService = getRemoteApplicationController().getTestService();
+
+ IProgressMonitorService progressMonitorService = getRemoteApplicationController().getProgressMonitorService();
+
+
+
+ @After
+ public void revertAuthentication() {
+ authenticateDefaultUser();
+ }
+
+ @Test
+ public void testMonitLongRunningMethod() throws InterruptedException {
+ UUID uuid = testService.monitLongRunningMethod(null, null, 0);
+ int pollInterval = 1000;
+ RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult("Success");
+ expectedMonitor.addReport("Report");
+ expectedMonitor.done();
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid),
+ (IFeedbackGenerator)null,
+ new NullProgressMonitor());
+ }
+
+ @Test
+ public void testMonitLongRunningMethodByChangingUser() throws InterruptedException {
+
+ IllegalStateException ise = new IllegalStateException("IllegalStateException");
+ UUID uuid = testService.monitLongRunningMethod(ise, null, 0);
+ authenticateExtraUser();
+ IRemotingProgressMonitor monitor = progressMonitorService.getRemotingMonitor(uuid);
+ Assert.assertNull(monitor);
+
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithException() throws InterruptedException {
+ IllegalStateException ise = new IllegalStateException("IllegalStateException");
+ UUID uuid = testService.monitLongRunningMethod(ise, null, 0);
+ int pollInterval = 1000;
+ RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult(ise);
+ expectedMonitor.setIsFailed(true);
+ expectedMonitor.done();
+ try {
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid),
+ (IFeedbackGenerator)null,
+ new NullProgressMonitor());
+ Assert.fail("Exception due to inconsistent number of feedback generators not thrown");
+ } catch(IllegalStateException e) {
+
+ }
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithInterrupt() {
+ IllegalStateException ise = new IllegalStateException("Interrupted Exception");
+ final UUID uuid = testService.monitLongRunningMethod(ise, null, 0);
+ final int pollInterval = 1000;
+ final RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult(ise);
+ expectedMonitor.setCanceled(true);
+ expectedMonitor.setIsFailed(true);
+ expectedMonitor.done();
+
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ null,
+ (IFeedbackGenerator)null,
+ new NullProgressMonitor());
+ Assert.fail("InterruptedException wrapped in an IllegalStateException should be thrown");
+ } catch (InterruptedException e) {
+
+ } catch (IllegalStateException e) {
+
+ }
+ }
+ };
+ thread.start();
+ while(!progressMonitorService.isMonitorThreadRunning(uuid)) {}
+
+ progressMonitorService.interrupt(uuid);
+
+ while(progressMonitorService.isMonitorThreadRunning(uuid)) {}
+
+ IRemotingProgressMonitor remotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid).postOperation(remotingMonitor);
+
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithCancellation() throws InterruptedException {
+
+ final UUID uuid = testService.monitLongRunningMethod(null, null, 0);
+ final int pollInterval = 1000;
+ final RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult("Cancelled");
+ expectedMonitor.setCanceled(true);
+ expectedMonitor.done();
+
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ null,
+ (IFeedbackGenerator)null,
+ new NullProgressMonitor());
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+ };
+ thread.start();
+ while(!progressMonitorService.isMonitorThreadRunning(uuid)) {}
+ progressMonitorService.cancel(uuid);
+ while(progressMonitorService.isMonitorThreadRunning(uuid)) {}
+ IRemotingProgressMonitor remotingMonitor = progressMonitorService.getRemotingMonitor(uuid);
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid).postOperation(remotingMonitor);
+
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithWaitForFeedback() throws InterruptedException {
+
+ List<String> feedbacks = Arrays.asList("feedback1", "feedback2");
+ List<IFeedbackGenerator> feebackGenerators = new ArrayList<IFeedbackGenerator>();
+ final RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult("Success");
+ for(String feedback : feedbacks) {
+ feebackGenerators.add(new MockFeedbackGenerator(feedback, 0));
+ expectedMonitor.addReport(feedback);
+ }
+ expectedMonitor.addReport("Report");
+ expectedMonitor.done();
+
+ final UUID uuid = testService.monitLongRunningMethod(null, feedbacks, 0);
+ final int pollInterval = 1000;
+
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid),
+ feebackGenerators,
+ new NullProgressMonitor());
+
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithInconsistentWaitForFeedback() throws InterruptedException {
+
+ List<String> feedbacks = Arrays.asList("feedback1", "feedback2");
+ List<IFeedbackGenerator> feebackGenerators = new ArrayList<IFeedbackGenerator>();
+ final RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult("Success");
+ for(String feedback : feedbacks) {
+ feebackGenerators.add(new MockFeedbackGenerator(feedback, 0));
+ expectedMonitor.addReport(feedback);
+ }
+ expectedMonitor.addReport("Report");
+ expectedMonitor.done();
+
+ final UUID uuid = testService.monitLongRunningMethod(null, feedbacks, 0);
+ final int pollInterval = 1000;
+
+ feebackGenerators.remove(1);
+
+ final UUID newUuid = testService.monitLongRunningMethod(null, feedbacks, 0);
+
+ try {
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ newUuid,
+ pollInterval,
+ new MockPostMoniteredOperationEnabled(expectedMonitor, newUuid),
+ feebackGenerators,
+ new NullProgressMonitor());
+ Assert.fail("Exception due to inconsistent number of feedback generators not thrown");
+ } catch(IllegalStateException ise) {
+
+ }
+ }
+
+ @Test
+ public void testMonitLongRunningMethodWithWaitForFeedbackTimeout() throws InterruptedException {
+
+ List<String> feedbacks = Arrays.asList("feedback1");
+ List<IFeedbackGenerator> feebackGenerators = new ArrayList<IFeedbackGenerator>();
+ final RemotingProgressMonitor expectedMonitor = new RemotingProgressMonitor();
+ expectedMonitor.setResult(new IllegalStateException(new InterruptedException()));
+ for(String feedback : feedbacks) {
+ feebackGenerators.add(new MockFeedbackGenerator(feedback, 1000 * 15));
+
+ }
+ expectedMonitor.setCanceled(true);
+ expectedMonitor.setIsFailed(true);
+ expectedMonitor.done();
+
+ expectedMonitor.done();
+
+ final UUID uuid = testService.monitLongRunningMethod(null, feedbacks, 1000 * 5);
+ final int pollInterval = 1000;
+
+
+ try {
+ CdmStore.getProgressMonitorClientManager().pollMonitor("Testing Progress Monitor",
+ uuid,
+ pollInterval,
+ new MockPostMoniteredOperationEnabled(expectedMonitor, uuid),
+ feebackGenerators,
+ new NullProgressMonitor());
+ Assert.fail("Exception due to inconsistent number of feedback generators not thrown");
+ } catch(IllegalStateException ise) {
+
+ }
+ }
+
+
+ class MockPostMoniteredOperationEnabled implements IPostMoniteredOperationEnabled {
+
+ private RemotingProgressMonitor expectedMonitor;
+ private UUID monitorUuid;
+
+ public MockPostMoniteredOperationEnabled(RemotingProgressMonitor expectedMonitor, UUID monitorUuid) {
+ this.expectedMonitor = expectedMonitor;
+ this.monitorUuid = monitorUuid;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void postOperation(IRemotingProgressMonitor monitor) {
+ if(expectedMonitor.getResult() instanceof Exception) {
+ Exception expectedException = (Exception) expectedMonitor.getResult();
+ Exception exception = (Exception) monitor.getResult();
+ Assert.assertEquals(expectedException.getClass(), expectedException.getClass());
+ Assert.assertEquals(expectedException.getMessage(), expectedException.getMessage());
+ } else {
+ Assert.assertEquals(expectedMonitor.getResult(), monitor.getResult());
+ }
+ Assert.assertEquals(expectedMonitor.getReports(), monitor.getReports());
+ Assert.assertEquals(expectedMonitor.isCanceled(), monitor.isCanceled());
+ Assert.assertEquals(expectedMonitor.isFailed(), monitor.isFailed());
+ Assert.assertEquals(expectedMonitor.isDone(), monitor.isDone());
+ Assert.assertTrue(!progressMonitorService.isMonitorThreadRunning(monitorUuid));
+ }
+ }
+
+ class MockFeedbackGenerator implements IFeedbackGenerator {
+
+ private String feedback;
+ private long waitTime;
+
+ public MockFeedbackGenerator(String feedback, long waitTime) {
+ this.feedback = feedback;
+ this.waitTime = waitTime;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setFeedbackForMonitor(UUID uuid) {
+ if(waitTime > 0) {
+ try {
+ Thread.sleep(waitTime);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ CdmApplicationState.getCurrentAppConfig().getProgressMonitorService().setFeedback(uuid, feedback);
+ }
+
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.service;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+
+public class ServiceInterceptorTest extends RemotingSessionAwareTest {
+
+ private static final Logger logger = Logger.getLogger(ServiceInterceptorTest.class);
+ private final ITermService termService = getRemoteApplicationController().getTermService();
+ private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
+
+
+ @Test
+ public void termServiceInterceptorTest() {
+ List<DefinedTermBase<?>> terms = termService.listByTermType(TermType.Language, null, null, null, null);
+ int cacheLanguageSize = 0;
+ List<UUID> keys = cdmServiceCacher.getDefaultCache().getKeys();
+ for(UUID key : keys) {
+ if(cdmServiceCacher.getFromCache(key).getClass().equals(Language.class)) {
+ cacheLanguageSize++;
+ }
+ }
+ Assert.assertEquals(terms.size(), cacheLanguageSize);
+ // TO DO : get the static termTypeMap from TermServiceRequestExecutor and check the size
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.session;
+
+import org.junit.Test;
+import org.springframework.util.Assert;
+import org.unitils.UnitilsJUnit4;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+
+/**
+ * @author cmathew
+ * @date 5 Oct 2015
+ *
+ */
+public class CdmApplicationStateTest extends UnitilsJUnit4 {
+
+ @Test
+ public void testCdmlibManifestInfoUpdate() {
+ CdmApplicationState.updateCdmlibManifestInfo();
+ Assert.notNull(CdmApplicationState.getCdmlibVersion());
+ Assert.notNull(CdmApplicationState.getCdmlibLastModified());
+ }
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.session;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.ICommonService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Credit;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.Extension;
+import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.media.Rights;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+import eu.etaxonomy.taxeditor.httpinvoker.TestThread;
+
+
+/**
+ * @author cmathew
+ * @date 7 Oct 2014
+ *
+ */
+@DataSet
+public class CdmEntitySessionAwareTest extends RemotingSessionAwareTest {
+
+ private static final Logger logger = Logger.getLogger(CdmEntitySessionAwareTest.class);
+
+ UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
+ UUID subKeyUuid = UUID.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01");
+ //UUID polytomousKeyUuid = UUID.fromString("bab66772-2c83-428a-bb6d-655d12ac6097");
+ UUID taxon1Uuid = UUID.fromString("2b336df7-29e8-4f79-985f-66502739d22f");
+ UUID personUuid = UUID.fromString("945d08f2-eb92-45b6-9252-6275ea6d338b");
+
+
+
+ IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+ IPolytomousKeyNodeService polytomousKeyNodeService = getRemoteApplicationController().getPolytomousKeyNodeService();
+ ICommonService commonService = getRemoteApplicationController().getCommonService();
+ ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+ IVocabularyService vocabularyService = getRemoteApplicationController().getVocabularyService();
+ ITermService termService = getRemoteApplicationController().getTermService();
+ IUserService userService = getRemoteApplicationController().getUserService();
+
+ //Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+
+
+ @BeforeClass
+ public static void initializePolytomousKeyTest() {
+ }
+
+
+ @Test
+ public void readAllPolytomousKeys() {
+ List<PolytomousKey> pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+ Iterator<PolytomousKey> pKeysItr = pKeys.iterator();
+ Assert.assertEquals(pKeysItr.next().getUuid(),UUID.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01"));
+ Assert.assertEquals(pKeysItr.next().getUuid(),UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66"));
+ }
+
+
+ @Test
+ //@DataSet("PolytomousKeyTest.readPolytmousKeyData.xml")
+ public void readPolytmousKeyData() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ Set<Taxon> taxonomicScope = pKey.getTaxonomicScope();
+ Iterator<Taxon> tsItr = taxonomicScope.iterator();
+ Taxon taxon = tsItr.next();
+
+ Assert.assertEquals("Achillea sec. Cyprus", taxon.getTitleCache());
+ Assert.assertEquals(tsItr.hasNext(), false);
+
+ List<Credit> credits = pKey.getCredits();
+ AgentBase agent = credits.get(0).getAgent();
+ Assert.assertEquals(agent.getId(),4809);
+ Assert.assertEquals(agent.getTitleCache(),"R. A. Graham");
+ Assert.assertEquals(credits.get(0).getText(),"Credits Text Test");
+
+ Set<Extension> exts = pKey.getExtensions();
+ Iterator<Extension> extItr = exts.iterator();
+ Extension ext = extItr.next();
+ Assert.assertEquals(ext.getValue(), "http://test.com");
+
+ Set<Rights> rights = pKey.getRights();
+ Iterator<Rights> rightsItr = rights.iterator();
+ Rights right = rightsItr.next();
+ Assert.assertEquals(right.getText(),"Rights Text Test");
+
+ Set<IdentifiableSource> sources = pKey.getSources();
+ Iterator<IdentifiableSource> sourcesItr = sources.iterator();
+ IdentifiableSource source = sourcesItr.next();
+ Assert.assertEquals(source.getId(), 23710);
+ source = sourcesItr.next();
+ Assert.assertEquals(source.getId(), 23711);
+
+ // TO DO : Added tests for Annotations , Markers
+ }
+
+
+
+ @Test
+ public void readPolytomousKeyDataFromNodes() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ PolytomousKeyNode rootNode = pKey.getRoot();
+
+
+ Assert.assertEquals(rootNode.getId(), 2750);
+
+ Assert.assertEquals(rootNode.getChildAt(0).getId(), 2751);
+ Assert.assertEquals(rootNode.getChildAt(0).getParent().getId(), rootNode.getId());
+ Assert.assertEquals(rootNode.getKey().getId(), pKey.getId());
+ Integer sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(0), "sortIndex");
+ Assert.assertEquals(sortIndex, new Integer(0));
+ String statement = "Capitula without ligulate ray-florets; leaves entire or subentire";
+ Assert.assertEquals(rootNode.getChildAt(0).getStatement().getLabelText(Language.ENGLISH()), statement);
+
+ Assert.assertEquals(rootNode.getChildAt(1).getId(), 2753);
+ Assert.assertEquals(rootNode.getChildAt(1).getParent().getId(), rootNode.getId());
+ Assert.assertEquals(rootNode.getChildAt(1).getKey().getId(), pKey.getId());
+ sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1), "sortIndex");
+ Assert.assertEquals(sortIndex, new Integer(1));
+ statement = "Capitula with ligulate ray-florets; leaves pinnatisect";
+ Assert.assertEquals(rootNode.getChildAt(1).getStatement().getLabelText(Language.ENGLISH()), statement);
+
+ Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getId(), 2754);
+ Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getParent().getId(), rootNode.getChildAt(1).getId());
+ Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getKey().getId(), pKey.getId());
+ sortIndex = (Integer)getFieldValueViaReflection(rootNode.getChildAt(1).getChildAt(0), "sortIndex");
+ Assert.assertEquals(sortIndex, new Integer(0));
+ statement = "Ray-florets yellow";
+ Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getStatement().getLabelText(Language.ENGLISH()), statement);
+ Assert.assertEquals(rootNode.getChildAt(1).getChildAt(0).getChildAt(0).getTaxon().getTitleCache(), "Achillea arabica Kotschy sec. Cyprus");
+ }
+
+ @Test
+ public void addGrandChildPolytomousKeyNode() {
+
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ PolytomousKeyNode rootChildNode = pKey.getRoot().getChildAt(0);
+ PolytomousKeyNode grandChildNode = PolytomousKeyNode.NewInstance();
+ rootChildNode.addChild(grandChildNode);
+
+ polytomousKeyService.merge(pKey, true);
+ grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
+ Assert.assertTrue(0 != grandChildNode.getId());
+ KeyStatement ks = KeyStatement.NewInstance("test");
+ grandChildNode.setStatement(ks);
+ polytomousKeyService.merge(pKey, true);
+
+ //grandChildNode = pKey.getRoot().getChildAt(0).getChildAt(0);
+ //KeyStatement ks = grandChildNode.getStatement();
+ Assert.assertTrue(0 != ks.getId());
+
+ }
+
+ @Test
+ public void addGreatGrandChildPolytomousKeyNode() {
+
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ PolytomousKeyNode rootChildNode = pKey.getRoot().getChildAt(0);
+ PolytomousKeyNode grandChildNode = PolytomousKeyNode.NewInstance();
+ rootChildNode.addChild(grandChildNode);
+
+
+ polytomousKeyNodeService.merge(grandChildNode);
+
+
+ Assert.assertFalse(pKey.getRoot().getChildAt(0).getChildAt(0).getId() == 0);
+ }
+
+ @Test
+ public void savePolytomousKeyNodeData() {
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ PolytomousKeyNode pkeynode = pkey.getRoot();
+ String newQuestion = "New Question";
+ String newStatement = "New Statement";
+
+ Assert.assertEquals("Question 1",pkeynode.getQuestion().getLabel().get(Language.ENGLISH()).getText());
+ for(PolytomousKeyNode node : pkeynode.getChildren()) {
+
+ node.setQuestion(null);
+ node.setStatement(null);
+ }
+ //FIXME:Remoting Add tests for feature after fixing problem
+
+ //Feature feature = pkeynode.getFeature();
+ //Assert.assertEquals(feature.getTitleCache(),"Systematics");
+ //pkeynode.setFeature(null);
+
+ Assert.assertEquals(pkeynode.getChildAt(0).getModifyingText().get(Language.ENGLISH()).getText(),"Modifying Text 1a");
+ String modifyingText = "Modifying Text 1a updated";
+
+ //pkeynode.getChildAt(0).putModifyingText(Language.ENGLISH(), modifyingText);
+
+ Assert.assertEquals(pkeynode.getChildAt(0).getSubkey().getId(),751);
+ Assert.assertEquals("Asphodeline", pkeynode.getChildAt(0).getSubkey().getTitleCache());
+ Assert.assertNull(pkeynode.getChildAt(1).getTaxon());
+ Taxon taxon = CdmBase.deproxy(taxonService.find(taxon1Uuid),Taxon.class);
+ pkeynode.getChildAt(1).setTaxon(taxon);
+
+ polytomousKeyService.merge(pkey);
+
+ pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ pkeynode = pkey.getRoot();
+ for(PolytomousKeyNode node : pkeynode.getChildren()) {
+ Assert.assertNull(node.getQuestion());
+ node.setQuestion(KeyStatement.NewInstance(Language.ENGLISH(),newQuestion));
+ Assert.assertNull(node.getStatement());
+ node.setStatement(KeyStatement.NewInstance(Language.ENGLISH(),newStatement));
+ }
+
+ Assert.assertEquals(pkeynode.getChildAt(1).getTaxon(), taxon);
+
+ polytomousKeyService.merge(pkey);
+
+ pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ pkeynode = pkey.getRoot();
+ for(PolytomousKeyNode node : pkeynode.getChildren()) {
+ Assert.assertNotNull(node.getQuestion());
+ Map<Language, LanguageString> label = node.getQuestion().getLabel();
+ Assert.assertEquals(newQuestion, label.get(Language.ENGLISH()).getText());
+ Assert.assertNotNull(node.getStatement());
+ Assert.assertEquals(newStatement, node.getStatement().getLabel(Language.ENGLISH()).getText());
+ }
+ //Assert.assertEquals(pkeynode.getFeature().getId(), feature.getId());
+
+ }
+
+
+ @Test
+ public void savePolytomousKeyNodeDataWithSameSubKey() {
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ PolytomousKeyNode pkeynode = pkey.getRoot();
+
+ PolytomousKey subkey1 = CdmBase.deproxy(pkeynode.getChildAt(0).getSubkey(), PolytomousKey.class);
+ String subkey1title = subkey1.getTitleCache();
+ subkey1.setTitleCache(subkey1title + "test", true);
+
+
+ PolytomousKey subkey2 = CdmBase.deproxy(pkeynode.getChildAt(1).getChildAt(0).getSubkey(), PolytomousKey.class);
+ String subkey2title = subkey2.getTitleCache();
+ subkey2.setTitleCache(subkey2title + "test", true);
+
+ Assert.assertSame(subkey1, subkey2);
+
+ polytomousKeyService.merge(pkey);
+ }
+
+ @Test
+ public void savePolytomousKeyNodeDataWithSameSubKeyUsingService() {
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ PolytomousKeyNode pkeynode = pkey.getRoot();
+//because of the check for null values in getChildren it isn't a persistent list anymore
+ // PersistentCollection children = (PersistentCollection) pkeynode.getChildren();
+ PolytomousKeyNode childNode0 = (PolytomousKeyNode)commonService.get(pkeynode.getUuid(), "children", 0);
+ PolytomousKey subkey1 = CdmBase.deproxy(childNode0.getSubkey(),PolytomousKey.class);
+ String subkey1title = subkey1.getTitleCache();
+ subkey1.setTitleCache(subkey1title + "test", true);
+
+ PolytomousKeyNode childNode1 = (PolytomousKeyNode)commonService.get(pkeynode.getUuid(), "children", 1);
+ PolytomousKey subkey2 = CdmBase.deproxy(childNode1.getSubkey(),PolytomousKey.class);
+ String subkey2title = subkey2.getTitleCache();
+ subkey2.setTitleCache(subkey2title + "test", true);
+
+ Assert.assertNotSame(childNode0, childNode1);
+
+ Assert.assertSame(subkey1, subkey2);
+
+ polytomousKeyService.merge(pkey);
+ }
+
+
+
+ @Test
+ public void savePolytomousKeyNodeDataWithSameLanguageInLabel() {
+
+ PolytomousKey pkey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ PolytomousKeyNode pkeynode = pkey.getRoot();
+
+ Map<Language, LanguageString> label1 = pkeynode.getQuestion().getLabel();
+ label1.size();
+
+
+ Map<Language, LanguageString> label2 = pkeynode.getChildAt(0).getStatement().getLabel();
+ label2.size();
+
+
+ polytomousKeyService.merge(pkey);
+ }
+
+ @Test
+ public void deleteSubKeyInPolytomousSubKeyWithoutInitializing() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ PolytomousKeyNode rootNode = pKey.getRoot();
+ PolytomousKeyNode child = rootNode.getChildAt(0);
+ PolytomousKey subKey = child.getSubkey();
+
+ polytomousKeyService.delete(subKey.getUuid());
+
+ // retrieving subkey shows its null
+ subKey = CdmBase.deproxy(polytomousKeyService.find(subKeyUuid),PolytomousKey.class);
+ Assert.assertNull(subKey);
+
+ pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ rootNode = pKey.getRoot();
+ child = rootNode.getChildAt(0);
+ subKey = child.getSubkey();
+ // subkey will not be null, because the delete functionality of the subkey
+ // does not currently delete it from a polytomous key node
+
+ // FIXME: With the new delete functionality this should be null, shouldn't it ?
+ Assert.assertNotNull(subKey);
+ }
+
+
+ @Test
+ public void deleteSubKeyInPolytomousNode() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ PolytomousKeyNode rootNode = pKey.getRoot();
+ List<PolytomousKeyNode> children = rootNode.getChildren();
+ PolytomousKeyNode child = rootNode.getChildAt(0);
+ polytomousKeyNodeService.delete(child.getUuid(), true);
+
+ pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ rootNode = pKey.getRoot();
+ children = rootNode.getChildren();
+ Assert.assertFalse(children.contains(child));
+ }
+
+ @Test
+ public void deleteSubKeyInPolytomousSubKeyAfterInitializing() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ PolytomousKeyNode rootNode = pKey.getRoot();
+ PolytomousKeyNode child = rootNode.getChildAt(0);
+ PolytomousKey subKey = child.getSubkey();
+ // this call initializes the subkey
+ subKey.getRoot();
+
+ polytomousKeyService.delete(subKey);
+
+ // since subKey was initialized before the delete, it will be
+ // accesible even after the delete. This behaviour is similar
+ // to hibernate session delete where the deleted object is
+ // made transient, but not deleted from the object graph
+
+ PolytomousKeyNode subKeyRootNode = subKey.getRoot();
+ Assert.assertNotNull(subKey);
+ }
+
+ @Test
+ public void saveNewTermVocabulary() {
+ TermVocabulary termVocabulary =
+ TermVocabulary.NewInstance(TermType.Feature,
+ null,
+ "Untitled",
+ null,
+ null);
+ try {
+ List<TermVocabulary<DefinedTermBase>> vocabularies = vocabularyService.findByTermType(TermType.Feature);
+
+ for(TermVocabulary vocab : vocabularies) {
+ vocab.getTermsOrderedByLabels(Language.ENGLISH());
+ }
+
+ termVocabulary = vocabularyService.merge(termVocabulary);
+ vocabularies.add(termVocabulary);
+ termVocabulary.setLabel("Test");
+ vocabularyService.merge(new ArrayList<TermVocabulary>(vocabularies));
+ } finally {
+ vocabularyService.delete(termVocabulary);
+ }
+ }
+
+ @Test
+ public void saveNewTerm() {
+ UUID vocNameFeatureUuid = UUID.fromString("fa7ca3eef-4092-49e1-beec-ed5096193e5e");
+ UUID vocFeatureUuid = UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");
+ DefinedTermBase newTerm = TermType.Feature.getEmptyDefinedTermBase();
+ newTerm.setLabel("CreateTest");
+
+ try {
+
+ Assert.assertNotNull(newTerm);
+ TermVocabulary vocNameFeature = vocabularyService.find(vocNameFeatureUuid);
+ TermVocabulary vocFeature = vocabularyService.find(vocFeatureUuid);
+
+ List<TermVocabulary> vocs = new ArrayList<TermVocabulary>();
+
+ vocs.add(vocNameFeature);
+ vocs.add(vocFeature);
+
+ vocNameFeature.addTerm(newTerm);
+
+ vocs = vocabularyService.merge(vocs);
+ for(TermVocabulary voc : vocs) {
+ if(voc.getUuid().equals(vocNameFeatureUuid)) {
+ vocNameFeature = voc;
+ }
+ }
+
+ Assert.assertTrue(vocNameFeature.getTerms().contains(newTerm));
+
+ for(Object obj : vocNameFeature.getTerms()) {
+ DefinedTermBase dtb = (DefinedTermBase)obj;
+ if("CreateTest".equals(dtb.getLabel())) {
+ newTerm = dtb;
+ Assert.assertNotNull(dtb.getCreatedBy());
+ Assert.assertNotNull(dtb.getCreated());
+ } else {
+ Assert.assertNull(dtb.getCreatedBy());
+ }
+ }
+ newTerm.setLabel("UpdateTest");
+ newTerm = termService.merge(newTerm);
+ Assert.assertNotNull(newTerm.getUpdatedBy());
+ Assert.assertNotNull(newTerm.getUpdated());
+
+ Assert.assertNull(vocNameFeature.getCreatedBy());
+ Assert.assertNull(vocFeature.getCreatedBy());
+ } finally {
+ if(termService.find(newTerm.getUuid()) != null) {
+ termService.delete(newTerm.getUuid());
+ }
+ }
+ }
+
+
+ @Test
+ public void updatePerson() {
+ // Test for #5138
+ Person person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().load(personUuid);
+ person.setFirstname("Me");
+ CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
+ }
+
+
+ @Test
+ public void createPerson() {
+ // Test for #5138
+ Person person = Person.NewInstance();
+ person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
+ person = (Person) CdmApplicationState.getCurrentAppConfig().getAgentService().load(person.getUuid());
+ person.setFirstname("Some");
+ CdmApplicationState.getCurrentAppConfig().getAgentService().merge(person);
+ }
+
+ @Test
+ public void testThreadLocalActiveSession() throws InterruptedException {
+ MockSessionOwner<CdmBase> so1 = new MockSessionOwner<CdmBase>();
+ final ICdmEntitySession activeSession = getCdmEntitySessionManager().newSession(so1, true);
+ TestThread thread = new TestThread(true) {
+ @Override
+ public void doRun() throws InterruptedException {
+ ICdmEntitySession threadLocalActiveSession = getCdmEntitySessionManager().getActiveSession();
+ Assert.assertEquals(threadLocalActiveSession, activeSession);
+ }
+ };
+ invokeThread(thread);
+ MockSessionOwner<CdmBase> so2 = new MockSessionOwner<CdmBase>();
+ ICdmEntitySession newActiveSession = getCdmEntitySessionManager().newSession(so2, true);
+ Assert.assertFalse(activeSession.equals(newActiveSession));
+ thread.unblock();
+
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.unitils.dbunit.annotation.DataSet;
+
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.LanguageString;
+import eu.etaxonomy.cdm.model.description.KeyStatement;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.persistence.dao.description.IPolytomousKeyNodeDao;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
+
+//FIXME:Remoting fix data issue : User#30
+//@Ignore
+@DataSet
+public class CdmEntitySessionManagerTest extends RemotingSessionAwareTest {
+
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(CdmEntitySessionManagerTest.class);
+
+
+ IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+ IPolytomousKeyNodeService polytomousKeyNodeService = getRemoteApplicationController().getPolytomousKeyNodeService();
+
+ private final UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
+ private final Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+
+
+ @BeforeClass
+ public static void initializeCdmEntitySessionManagerTest() {
+ }
+
+
+ @Test
+ public void manageNullSessionTest() {
+
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+ cdmEntitySessionManager.bind(null);
+ Assert.assertSame(pKey, pKey);
+ Assert.assertNull(getActiveSession());
+ }
+
+ @Test
+ public void manageSessionWithObjectTest() {
+ PolytomousKey pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+ Assert.assertNotNull(getActiveSession());
+
+
+ // FIXME:Remoting fix test of setting root entities
+ //Assert.assertEquals(rootEntities.size(),1);
+ //Assert.assertSame(rootEntities.get(0), pKey);
+
+ String upTitleCache = "Updated Title Cache";
+ String upStatement = "Updated Statement";
+ pKey.setTitleCache(upTitleCache, true);
+
+ PolytomousKeyNode node = pKey.getRoot().getChildAt(0);
+ node.getStatement().getLabel(english).setText(upStatement);
+ polytomousKeyService.merge(pKey, true);
+
+ pKey = CdmBase.deproxy(polytomousKeyService.find(polytomousKeyUuid),PolytomousKey.class);
+
+
+ Assert.assertEquals(pKey.getTitleCache(), upTitleCache);
+ node = pKey.getRoot().getChildAt(0);
+ KeyStatement statement = node.getStatement();
+ LanguageString label = statement.getLabel(english);
+ Assert.assertEquals(label.getText(), upStatement);
+ }
+
+ @Test
+ public void manageSessionWithListTest() {
+ List<PolytomousKey> pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+ Assert.assertNotNull(getActiveSession());
+
+
+ // FIXME:Remoting fix test of setting root entities
+ //Assert.assertEquals(rootEntities.size(),2);
+ //Assert.assertSame(rootEntities.get(0),pKeys.get(0));
+ //Assert.assertEquals(rootEntities.get(0).getUuid(),UUID.fromString("9d8bf4f6-a70a-4b80-8556-2ccfb436ff01"));
+ //Assert.assertSame(rootEntities.get(1),pKeys.get(1));
+ //Assert.assertEquals(rootEntities.get(1).getUuid(),UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66"));
+
+ String upTitleCache = "Updated Title Cache";
+ String upStatement = "Updated Statement";
+ pKeys.get(0).setTitleCache(upTitleCache, true);
+ polytomousKeyService.merge(pKeys.get(0));
+ PolytomousKey key = pKeys.get(1);
+ PolytomousKeyNode root = key.getRoot();
+ root = HibernateProxyHelper.deproxy(root, PolytomousKeyNode.class);
+ PolytomousKeyNode node = root.getChildAt(0);
+ List<PolytomousKeyNode> nodes = root.getChildren();
+ node.getStatement().getLabel(english).setText(upStatement);
+
+ MergeResult<PolytomousKey> result = polytomousKeyService.merge(key, true);
+ key = result.getMergedEntity();
+ pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
+
+ Assert.assertEquals(pKeys.get(0).getTitleCache(), upTitleCache);
+ key = pKeys.get(1);
+ root = key.getRoot();
+ nodes = root.getChildren();
+ Iterator<PolytomousKeyNode> it = nodes.iterator();
+ if (it.hasNext()){
+ node = it.next();
+ } else {
+ Assert.fail();
+ }
+ Assert.assertEquals(node.getStatement().getLabel(english).getText(), upStatement);
+
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.session;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.junit.Assert;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+public class MockSessionOwner<T extends CdmBase> implements ICdmEntitySessionEnabled, ICdmChangeListener {
+
+ private static final Logger logger = Logger.getLogger(MockSessionOwner.class);
+
+ private final List<T> rootEntities;
+ private Set<T> expectedUpdatedObjects;
+ private Set<? extends CdmBase> eventUpdatedObjects;
+
+ private ICdmEntitySession session;
+
+ public MockSessionOwner() {
+ this.rootEntities = null;
+ this.expectedUpdatedObjects = new HashSet<T>();
+ }
+
+// public MockSessionOwner(Set<T> updatedObjects) {
+// this.rootEntities = null;
+// this.updatedObjects = updatedObjects;
+// }
+//
+// public MockSessionOwner(List<T> rootEntities) {
+// this.rootEntities = rootEntities;
+// }
+
+ public void setExpectedUpdatedObjects(Set<T> updatedObjects) {
+ this.expectedUpdatedObjects = updatedObjects;
+ }
+
+ public void addExpectedUpdatedObject(T updatedObject) {
+ this.expectedUpdatedObjects.add(updatedObject);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return session;
+ }
+
+ public void setCdmEntitySession(ICdmEntitySession session) {
+ this.session = session;;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+ */
+ @Override
+ public List<T> getRootEntities() {
+ return rootEntities;
+ }
+
+ public void dispose() {
+ if(session != null) {
+ session.dispose();
+ logger.info("disposed of session from session owner : " + this);
+ }
+ }
+
+ public Set<? extends CdmBase> getEventUpdatedObjects() {
+ return eventUpdatedObjects;
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.application.ICdmChangeListener#onChange(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
+ */
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ eventUpdatedObjects = event.getChangedObjects();
+ if(expectedUpdatedObjects != null && !expectedUpdatedObjects.isEmpty()) {
+ for(CdmBase cb : expectedUpdatedObjects) {
+ Assert.assertTrue(event.getChangedObjects().contains(cb));
+ }
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.test;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+
+/**
+ * @author cmathew
+ * @date 15 Jun 2015
+ *
+ */
+public class MockConversationEnabled implements IConversationEnabled {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return new ConversationHolderMock();
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 EDIT
+ * 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.ui.dialogs;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.unitils.UnitilsJUnit4;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.config.CdmSourceException;
+import eu.etaxonomy.taxeditor.remoting.server.CDMServerException;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+
+/**
+ * @author cmathew
+ * @date 26 Jan 2015
+ *
+ */
+
+public class CdmServerInfoTest extends UnitilsJUnit4 {
+
+ @Test
+ public void pingServersTest() {
+ List<CdmServerInfo> servers = CdmServerInfo.getCdmServers();
+ for(CdmServerInfo server : servers) {
+ server.pingServer();
+ }
+ }
+
+
+ @Ignore // this should be targetting integration or production
+ @Test
+ public void pingInstancesTest() {
+ CdmServerInfo csii = new CdmServerInfo(new CdmServerInfoConfig("edit-test", "test.e-taxonomy.eu", 8080, "cdmserver/", false));
+ try {
+ csii.refreshInstances();
+ List<CdmInstanceInfo> instances = csii.getInstances();
+ for(CdmInstanceInfo instance : instances) {
+ Assert.assertTrue(csii.pingInstance(instance, 8080));
+ }
+ } catch (CDMServerException e) {
+ Assert.fail("Execption should not be thrown here");
+ }
+ }
+
+ @Test
+ public void refreshWrongInstancesTest() {
+ CdmServerInfo wrongCsii = new CdmServerInfo(new CdmServerInfoConfig("local", "local", 8080, "noserver", false));
+ try {
+ wrongCsii.refreshInstances();
+ List<CdmInstanceInfo> instances = wrongCsii.getInstances();
+ Assert.fail("Execption should be thrown here");
+ } catch (CDMServerException e) {
+
+ }
+ }
+
+ @Ignore // this should be targetting integration or production
+ @Test
+ public void refreshInstancesTest() throws CDMServerException {
+ CdmServerInfo cdmServerInfo = new CdmServerInfo(new CdmServerInfoConfig("edit-test", "test.e-taxonomy.eu", 8080, "cdmserver/", false));
+ cdmServerInfo.refreshInstances();
+ List<CdmInstanceInfo> instances = cdmServerInfo.getInstances();
+ Assert.assertTrue(instances != null && !instances.isEmpty());
+ }
+
+ @Test
+ public void compareCdmlibServicesVersionTest() throws CdmSourceException {
+ String editorVersion = CdmApplicationState.getCdmlibVersion();
+ String editorCdmlibLastModified = CdmApplicationState.getCdmlibLastModified();
+ Long editorCdmlibLastModifiedLong = Long.valueOf(editorCdmlibLastModified);
+
+ String[] editorVersionSplit = editorVersion.split("\\.");
+
+ Assert.assertEquals(0, CdmServerInfo.compareCdmlibServicesVersion(editorVersion, editorCdmlibLastModified));
+
+
+ int editorVersionMajor = Integer.valueOf(editorVersionSplit[0]);
+ int editorVersionMinor = Integer.valueOf(editorVersionSplit[1]);
+ int editorVersionPatch = Integer.valueOf(editorVersionSplit[2]);
+
+ String serverVersionMajorNew = String.valueOf(editorVersionMajor+1) + "." + String.valueOf(editorVersionMinor) + "." + String.valueOf(editorVersionPatch);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionMajorNew, editorCdmlibLastModified) > 0);
+
+ String serverVersionMinorNew = String.valueOf(editorVersionMajor) + "." + String.valueOf(editorVersionMinor+1) + "." + String.valueOf(editorVersionPatch);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionMinorNew, editorCdmlibLastModified) > 0);
+
+ String serverVersionPatchNew = String.valueOf(editorVersionMajor) + "." + String.valueOf(editorVersionMinor) + "." + String.valueOf(editorVersionPatch+1);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionPatchNew, editorCdmlibLastModified) > 0);
+
+ String serverVersionMajorOld = String.valueOf(editorVersionMajor-1) + "." + String.valueOf(editorVersionMinor) + "." + String.valueOf(editorVersionPatch);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionMajorOld, editorCdmlibLastModified) < 0);
+
+ String serverVersionMinorOld = String.valueOf(editorVersionMajor) + "." + String.valueOf(editorVersionMinor-1) + "." + String.valueOf(editorVersionPatch);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionMinorOld, editorCdmlibLastModified) < 0);
+
+ String serverVersionPatchOld = String.valueOf(editorVersionMajor) + "." + String.valueOf(editorVersionMinor) + "." + String.valueOf(editorVersionPatch-1);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(serverVersionPatchOld, editorCdmlibLastModified) < 0);
+
+ String serverCdmlibLastModifiedNew = String.valueOf(editorCdmlibLastModifiedLong+1);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(editorVersion, serverCdmlibLastModifiedNew) > 0);
+
+ String serverCdmlibLastModifiedOld = String.valueOf(editorCdmlibLastModifiedLong-1);
+ Assert.assertTrue(CdmServerInfo.compareCdmlibServicesVersion(editorVersion, serverCdmlibLastModifiedOld) < 0);
+
+ }
+
+ @Test
+ public void convertToServerConfigTest() {
+
+
+ }
+}
package eu.etaxonomy.taxeditor.ui.dialogs;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
import eu.etaxonomy.taxeditor.test.AbstractEditorTest;\r
\r
-\r
+@Ignore\r
public class LoginDialogTest extends AbstractEditorTest{\r
- \r
+\r
@Test\r
public void canLoginAsAdmin() throws Exception {\r
bot.menu("General").menu("Login").click();\r
bot.textWithLabel("Password").setText("00000");\r
utils.ok();\r
}\r
- \r
+\r
@Test\r
public void canCancelLogin() throws Exception {\r
bot.menu("General").menu("Login").click();\r
bot.waitUntil(Conditions.shellIsActive("Login"));\r
utils.cancel();\r
}\r
- \r
+\r
}\r
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.ui.selection;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
/**\r
- * This test will only test the selection element itself. The test may have to start other \r
- * dialogs open windows before to get at the selection element. Any errors on the way \r
+ * This test will only test the selection element itself. The test may have to start other\r
+ * dialogs open windows before to get at the selection element. Any errors on the way\r
* should be handled by different tests.\r
- * \r
+ *\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class ClassificationSelectionElementTest extends AbstractSelectionElementTest{\r
@Override\r
public void setup() {\r
bot.menu("General").menu("New").menu("Taxon").click();\r
bot.waitUntil(Conditions.shellIsActive("New Entity"));\r
}\r
- \r
+\r
@Test\r
public void canSelectClassification() {\r
utils.openFilteredSelection(0, "Choose a Classification");\r
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.ui.selection;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
/**\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class NameSelectionElementTest extends AbstractSelectionElementTest {\r
@Override\r
public void setup() {\r
bot.menu("General").menu("New").menu("Taxon").click();\r
bot.waitUntil(Conditions.shellIsActive("New Entity"));\r
}\r
- \r
+\r
@Test\r
public void canSelectName() {\r
utils.openFilteredSelection(3, "Choose a name");\r
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.ui.selection;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
/**\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class TaxonNodeSelectionElementTest extends AbstractSelectionElementTest {\r
@Override\r
public void setup() {\r
bot.menu("General").menu("New").menu("Taxon").click();\r
bot.waitUntil(Conditions.shellIsActive("New Entity"));\r
}\r
- \r
+\r
@Test\r
public void canSelectTaxon() {\r
utils.openFilteredSelection(1, "Select parent taxon");\r
utils.cancel();\r
}\r
- \r
+\r
}\r
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.ui.selection;\r
\r
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;\r
+import org.junit.Ignore;\r
import org.junit.Test;\r
\r
/**\r
- * This test will only test the selection element itself. The test may have to start other \r
- * dialogs open windows before to get at the selection element. Any errors on the way \r
+ * This test will only test the selection element itself. The test may have to start other\r
+ * dialogs open windows before to get at the selection element. Any errors on the way\r
* should be handled by different tests.\r
- * \r
+ *\r
* @author n.hoffmann\r
*\r
*/\r
+@Ignore\r
public class TaxonSelectionElementTest extends AbstractSelectionElementTest {\r
@Override\r
public void setup() {\r
bot.menu("General").menu("New").menu("Taxon").click();\r
bot.waitUntil(Conditions.shellIsActive("New Entity"));\r
}\r
- \r
+\r
@Test\r
public void canSelectTaxon() {\r
utils.openFilteredSelection(2, "Choose a taxon");\r
--- /dev/null
+package eu.etaxonomy.taxeditor.util;
+
+/**
+ * based on from http://code.google.com/p/java-tester/source/browse/trunk/src/main/java/org/jtester/unitils/database/H2DbSupport.java
+ */
+
+
+import java.util.Set;
+
+import org.unitils.core.dbsupport.DbSupport;
+
+public class H2DbSupport extends DbSupport {
+ /**
+ * Creates support for HsqlDb databases.
+ */
+ public H2DbSupport() {
+ super("h2");
+ }
+
+ @Override
+ public Set<String> getColumnNames(String tableName) {
+ return getSQLHandler().getItemsAsStringSet(
+ "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '" + tableName
+ + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+ }
+
+ @Override
+ public Set<String> getTableNames() {
+ return getSQLHandler().getItemsAsStringSet(
+ "select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'TABLE' AND TABLE_SCHEMA = '"
+ + getSchemaName() + "'");
+ }
+
+ @Override
+ public Set<String> getViewNames() {
+ return getSQLHandler().getItemsAsStringSet(
+ "select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'VIEW' AND TABLE_SCHEMA = '"
+ + getSchemaName() + "'");
+ }
+
+ @Override
+ public Set<String> getSequenceNames() {
+ return getSQLHandler().getItemsAsStringSet(
+ "select SEQUENCE_NAME from INFORMATION_SCHEMA.SEQUENCES where SEQUENCE_SCHEMA = '"
+ + getSchemaName() + "'");
+ }
+
+ @Override
+ public Set<String> getTriggerNames() {
+ return getSQLHandler().getItemsAsStringSet(
+ "select TRIGGER_NAME from INFORMATION_SCHEMA.TRIGGERS where TRIGGER_SCHEMA = '" + getSchemaName()
+ + "'");
+ }
+
+ @Override
+ public long getSequenceValue(String sequenceName) {
+ return getSQLHandler().getItemAsLong(
+ "select CURRENT_VALUE from INFORMATION_SCHEMA.SEQUENCES where SEQUENCE_SCHEMA = '"
+ + getSchemaName() + "' and SEQUENCE_NAME = '" + sequenceName + "'");
+ }
+
+ @Override
+ public boolean supportsSequences() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsTriggers() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsIdentityColumns() {
+ return true;
+ }
+
+ @Override
+ public void incrementSequenceToValue(String sequenceName, long newSequenceValue) {
+ getSQLHandler().executeUpdate(
+ "alter sequence " + qualified(sequenceName) + " restart with " + newSequenceValue);
+ }
+
+ @Override
+ public void incrementIdentityColumnToValue(String tableName, String identityColumnName, long identityValue) {
+ getSQLHandler().executeUpdate(
+ "alter table " + qualified(tableName) + " alter column " + quoted(identityColumnName)
+ + " RESTART WITH " + identityValue);
+ }
+
+ @Override
+ public void disableReferentialConstraints() {
+ Set<String> tableNames = getTableNames();
+ for (String tableName : tableNames) {
+ disableReferentialConstraints(tableName);
+ }
+ }
+
+ @Override
+ public void disableValueConstraints() {
+ Set<String> tableNames = getTableNames();
+ for (String tableName : tableNames) {
+ disableValueConstraints(tableName);
+ }
+ }
+
+ private void disableReferentialConstraints(String tableName) {
+ Set<String> constraintNames = this.getForeignKeyConstraintNames(tableName);
+ for (String constraintName : constraintNames) {
+ this.removeForeignKeyConstraint(tableName, constraintName);
+ }
+ }
+
+ private void disableValueConstraints(String tableName) {
+ Set<String> primaryKeyColumnNames = this.getPrimaryKeyColumnNames(tableName);
+
+ Set<String> notNullColumnNames = this.getNotNullColummnNames(tableName);
+ for (String notNullColumnName : notNullColumnNames) {
+ if (primaryKeyColumnNames.contains(notNullColumnName)) {
+ continue;
+ }
+ this.removeNotNullConstraint(tableName, notNullColumnName);
+ }
+ }
+
+ /**
+ * Gets the names of all identity columns of the given table.
+ * <p/>
+ * todo check, at this moment the PK columns are returned
+ *
+ * @param tableName The table, not null
+ * @return The names of the identity columns of the table with the given name
+ */
+ @Override
+ public Set<String> getIdentityColumnNames(String tableName) {
+ return getPrimaryKeyColumnNames(tableName);
+ }
+
+ private Set<String> getPrimaryKeyColumnNames(String tableName) {
+ return getSQLHandler().getItemsAsStringSet(
+ "select COLUMN_NAME from INFORMATION_SCHEMA.INDEXES where PRIMARY_KEY=TRUE AND TABLE_NAME = '"
+ + tableName + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+ }
+
+ private Set<String> getNotNullColummnNames(String tableName) {
+ return getSQLHandler().getItemsAsStringSet(
+ "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where IS_NULLABLE = 'NO' AND TABLE_NAME = '"
+ + tableName + "' AND TABLE_SCHEMA = '" + getSchemaName() + "'");
+ }
+
+ private Set<String> getForeignKeyConstraintNames(String tableName) {
+ return getSQLHandler().getItemsAsStringSet(
+ "select CONSTRAINT_NAME from INFORMATION_SCHEMA.CONSTRAINTS "
+ + "where CONSTRAINT_TYPE = 'REFERENTIAL' AND TABLE_NAME = '" + tableName
+ + "' AND CONSTRAINT_SCHEMA = '" + getSchemaName() + "'");
+ }
+
+ private void removeForeignKeyConstraint(String tableName, String constraintName) {
+ getSQLHandler().executeUpdate(
+ "alter table " + qualified(tableName) + " drop constraint " + quoted(constraintName));
+ }
+
+ private void removeNotNullConstraint(String tableName, String columnName) {
+ getSQLHandler().executeUpdate(
+ "alter table " + qualified(tableName) + " alter column " + quoted(columnName) + " set null");
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+ ls
+ <bean id="cdmTestDataSource" class="eu.etaxonomy.cdm.database.LocalH2" lazy-init="true">
+ <property name="driverClassName" value="org.h2.Driver" />
+ <property name="url" value="jdbc:h2:file:./target/classes/h2/cdmTest;AUTO_SERVER=TRUE" />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ <property name="mode" value="embedded" />
+ <property name="nomenclaturalCode" value="ICNAFP" />
+ </bean>
+</beans>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+">
+ <bean id="dataSourceProperties" class="eu.etaxonomy.cdm.remote.config.DataSourceProperties">
+ <property name="propsMap">
+ <map/>
+ </property>
+ </bean>
+ <bean id="cdmTest" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
+ <property name="driverClass" value="org.h2.Driver"/>
+ <property name="user" value="sa"/>
+ <property name="password" value=""/>
+ <property name="jdbcUrl" value="jdbc:h2:file:./target/classes/h2/cdmTest;AUTO_SERVER=TRUE"/>
+ </bean>
+</beans>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- DO NOT EDIT THIS FILE MANUALLY. --><!-- It is created by the Taxonomic Editor for launching a managed CDM Server. --><beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+">
+ <bean id="dataSourceProperties" class="eu.etaxonomy.cdm.remote.config.DataSourceProperties">
+ <property name="propsMap">
+ <map/>
+ </property>
+ </bean>
+ <bean id="MGD_cdmTest" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
+ <property name="driverClass" value="org.h2.Driver"/>
+ <property name="user" value="sa"/>
+ <property name="password" value=""/>
+ <property name="jdbcUrl" value="jdbc:h2:file:/home/andreas/workspaces/cdm/taxeditor/eu.etaxonomy.taxeditor.test/src/test/resources/.cdmLibrary/writableResources/h2/LocalH2/cdmTest;AUTO_SERVER=TRUE"/>
+ </bean>
+</beans>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
+ ">
+
+ <!--
+ DataSourceProperties allow configuring specific properties of the datasources
+
+ * cdmlib-remote.xslBasePath:
+ alternative base path for REST services to retrieve XSL style sheets from.
+ the base path must be on the same domain since cross domain xsl loading is
+ not permitted
+ -->
+ <bean id="dataSourceProperties" class="eu.etaxonomy.cdm.remote.config.DataSourceProperties">
+ <property name="propsMap">
+ <map>
+ <!--
+ <entry key="dataSourceBeanID">
+ <props>
+ <prop key="cdmlib-remote.xslBasePath">/xsl</prop>
+ </props>
+ </entry>
+ -->
+ </map>
+ </property>
+ </bean>
+
+ <bean id="cdmTest" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
+ <property name="driverClass" value="org.h2.Driver"/>
+ <property name="user" value="sa" />
+ <property name="password" value="" />
+ <property name="jdbcUrl" value="jdbc:h2:file:${basedir}/target/classes/h2/cdmTest;AUTO_SERVER=TRUE"/>
+ </bean>
+</beans>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+
+ Extraction Model: PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 79
+ AgentBase 1
+ Credit 1
+ Extension 1
+ KeyStatement 10
+ KeyStatement_LanguageString 10
+ LanguageString 19
+ OriginalSourceBase 2
+ PolytomousKey 2
+ PolytomousKeyNode 10
+ PolytomousKeyNode_LanguageString 9
+ PolytomousKey_Credit 1
+ PolytomousKey_Extension 1
+ PolytomousKey_OriginalSourceBase 2
+ PolytomousKey_RightsInfo 1
+ PolytomousKey_Taxon 1
+ RightsInfo 1
+ TaxonBase 6
+
+--><dataset>
+ <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+ <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+ <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+ <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="Modifying Text 1b" language_id="124"/>
+ <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+ <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+ <LanguageString id="14572" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155f" updated="2014-10-09 15:43:03.0" text="Koi Sach Ya Sawal" createdby_id="30" updatedby_id="30" language_id="125"/>
+
+ <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. & Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+ <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+ <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4808" type_id="2056"/>
+
+ <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2760" statement_id="2460"/>
+ <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="1550" taxon_id="37" parent_id="2750"/>
+ <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+ <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2761" statement_id="2460" subkey_id="1550" parent_id="2750"/>
+ <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2461" subkey_id="1550" parent_id="2753"/>
+ <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+ <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+ <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2464" parent_id="2753"/>
+ <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+ <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+ <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+ <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+ <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+ <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+ <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+ <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+ <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2460" label_id="14572" label_mapkey_id="125"/>
+
+ <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" createdby_id="30" startNumber="1"/>
+ <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" createdby_id="30" updatedby_id="30" root_id="2750" startNumber="1"/>
+
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="1730" sourceType="PTS"/>
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="50" sourceType="PTS"/>
+
+
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ http://www.springframework.org/schema/tx
+ http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+
+ <bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
+
+</beans>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Mon Oct 06 13:11:21 CEST 2014 from cmathew@cmbgbm-t530
+
+ Extraction Model: TaxonBase where uuid like '8217ef77-2ab1-4318-bd67-ccd0cdef07c4' (extractionmodel/by-example/SbE-TaxonBase-13-09-59-049.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 2
+ TaxonBase 1
+ TaxonNameBase 1
+
+--><dataset>
+ <TaxonNameBase DTYPE="BotanicalName" id="32" created="2010-12-21 15:09:43.0" uuid="f8be96d0-9af9-4e19-b9f1-52a4c0ecc580" protectedtitlecache="true" titleCache="Achillea arabica Kotschy" fullTitleCache="Achillea arabica Kotschy" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Kotschy" binomhybrid="false" genusoruninomial="Achillea" hybridformula="false" monomhybrid="false" namecache="Achillea arabica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="arabica" trinomhybrid="false" anamorphic="false" createdby_id="11" homotypicalgroup_id="32" rank_id="778" />
+
+ <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" updated="2014-09-17 09:27:47.0" protectedtitlecache="true" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" name_id="32" sec_id="10" publish="true"/>
+
+
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+
+ Extraction Model: PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 79
+ AgentBase 1
+ Credit 1
+ Extension 1
+ KeyStatement 10
+ KeyStatement_LanguageString 10
+ LanguageString 19
+ OriginalSourceBase 2
+ PolytomousKey 2
+ PolytomousKeyNode 10
+ PolytomousKeyNode_LanguageString 9
+ PolytomousKey_Credit 1
+ PolytomousKey_Extension 1
+ PolytomousKey_OriginalSourceBase 2
+ PolytomousKey_RightsInfo 1
+ PolytomousKey_Taxon 1
+ RightsInfo 1
+ TaxonBase 6
+
+--><dataset>
+ <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+ <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+ <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+ <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="" language_id="124"/>
+ <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" createdby_id="30" updatedby_id="30" language_id="124"/>
+ <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+ <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+
+ <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. & Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+ <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+ <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4808" type_id="2056"/>
+
+ <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2760"/>
+ <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="751" taxon_id="37" parent_id="2750"/>
+ <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+ <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" question_id="2761" statement_id="2460" subkey_id="751" parent_id="2750"/>
+ <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2461" subkey_id="751" parent_id="2753"/>
+ <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+ <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+ <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2464" parent_id="2753"/>
+ <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+ <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" createdby_id="30" updatedby_id="30" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+ <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+ <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" createdby_id="30" updatedby_id="30"/>
+ <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+ <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+ <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+ <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+ <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+ <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+
+ <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" createdby_id="30" startNumber="1"/>
+ <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" createdby_id="30" updatedby_id="30" root_id="2750" startNumber="1"/>
+
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="1730" sourceType="PTS"/>
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" createdby_id="30" updatedby_id="30" citation_id="50" sourceType="PTS"/>
+
+ <LanguageString id="10"/>
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Mon Jun 29 14:15:44 CEST 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: PolytomousKey where id = 90 or id = 111 or id = 112 or id = 113 or id = 114 or id = 115 or id = 116 (extractionmodel/by-example/SbE-PolytomousKey-14-15-18-725.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 10
+ PolytomousKey 7
+ PolytomousKeyNode 3
+
+--><dataset>
+ <PolytomousKeyNode id="100" created="2012-11-23 19:53:37.0" uuid="c8e296da-441d-403b-9647-d729c00b2aa4" updated="2014-01-24 13:21:03.0" nodenumber="1" key_id="90"/>
+ <PolytomousKeyNode id="101" created="2012-11-23 19:53:54.0" uuid="588754cd-6098-40d3-bb37-05d0a6676336" sortindex="0" key_id="90" parent_id="100"/>
+ <PolytomousKeyNode id="102" created="2012-11-23 19:54:42.0" uuid="52ea0b19-f29e-49fc-8326-02292fda4e43" sortindex="1" key_id="90" parent_id="100"/>
+
+ <PolytomousKey id="90" created="2012-11-23 19:53:37.0" uuid="f82cef88-5a9e-4917-9938-d08bda40836f" protectedtitlecache="true" titleCache="Cleome" root_id="100" startNumber="1"/>
+ <PolytomousKey id="111" created="2013-02-15 16:26:38.0" uuid="a00ca7ec-b660-433c-bd14-596826ab2243" protectedtitlecache="true" titleCache="Ammi" startNumber="1"/>
+ <PolytomousKey id="112" created="2013-02-15 16:31:54.0" uuid="197bc542-bf5b-4a52-aa66-c65df32c196b" protectedtitlecache="true" titleCache="Adonis" startNumber="1"/>
+ <PolytomousKey id="113" created="2013-02-15 16:50:59.0" uuid="2ebacbb0-13f4-4407-8579-d5968e09a905" protectedtitlecache="true" titleCache="Enarthrocarpus" startNumber="1"/>
+ <PolytomousKey id="114" created="2013-02-15 16:54:31.0" uuid="0426418c-5b76-4c19-8177-6bebb4d37329" protectedtitlecache="true" titleCache="Glaucium" startNumber="1"/>
+ <PolytomousKey id="115" created="2013-02-15 17:05:42.0" uuid="6aa69b73-6242-4d3d-85c9-485aab9b1975" protectedtitlecache="true" titleCache="Sagina" startNumber="1"/>
+ <PolytomousKey id="116" created="2013-02-15 17:09:43.0" uuid="cfe7626d-49cc-4dac-acbc-601825deb44a" protectedtitlecache="true" titleCache="Dianthus" startNumber="1"/>
+
+
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Fri Jun 19 09:13:03 CEST 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: all rows from Classification (extractionmodel/by-example/SbE-Classification-09-10-20-259.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 67
+ Classification 1
+ DescriptionBase 22
+ TaxonBase 14
+ TaxonNameBase 14
+ TaxonNode 16
+
+--><dataset>
+ <TaxonNode id="46" created="2010-12-21 15:09:43.0" uuid="168a4d09-a2b0-4206-b4cc-5d13199f9306" countchildren="0" classification_id="10" parent_id="47" taxon_id="48" treeIndex="#t10#4032#49#48#47#46#" sortIndex="0"/>
+ <TaxonNode id="47" created="2010-12-21 15:09:43.0" uuid="2f05d429-632d-4230-b9cb-70299360b470" countchildren="1" classification_id="10" parent_id="48" taxon_id="51" treeIndex="#t10#4032#49#48#47#" sortIndex="0"/>
+ <TaxonNode id="48" created="2010-12-21 15:09:43.0" uuid="24773d3b-8f11-4400-99de-71658982b245" countchildren="6" classification_id="10" parent_id="49" treeIndex="#t10#4032#49#48#" sortIndex="0"/>
+ <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="0"/>
+ <TaxonNode id="236" created="2010-12-21 15:09:45.0" uuid="f5d97f8b-c673-4050-af06-bbfab33baaec" countchildren="0" classification_id="10" parent_id="237" taxon_id="264" treeIndex="#t10#4032#49#48#237#236#" sortIndex="0"/>
+ <TaxonNode id="237" created="2010-12-21 15:09:45.0" uuid="4998de90-d0be-433b-a62f-0d57a1e399b0" countchildren="1" classification_id="10" parent_id="48" taxon_id="265" treeIndex="#t10#4032#49#48#237#" sortIndex="1"/>
+ <TaxonNode id="714" created="2010-12-21 15:09:48.0" uuid="b85b5b78-6760-409f-ac91-bb89e95ff2a1" countchildren="0" classification_id="10" parent_id="715" taxon_id="812" treeIndex="#t10#4032#49#48#715#714#" sortIndex="0"/>
+ <TaxonNode id="715" created="2010-12-21 15:09:48.0" uuid="91698cec-615f-4472-9002-feda1a6acded" countchildren="2" classification_id="10" parent_id="48" taxon_id="814" treeIndex="#t10#4032#49#48#715#" sortIndex="2"/>
+ <TaxonNode id="716" created="2010-12-21 15:09:48.0" uuid="6ad8e9e2-f5f6-41ad-aa30-f62a903650db" countchildren="0" classification_id="10" parent_id="715" taxon_id="815" treeIndex="#t10#4032#49#48#715#716#" sortIndex="1"/>
+ <TaxonNode id="828" created="2010-12-21 15:09:49.0" uuid="786622ba-cb2c-47f4-9eeb-65a6ebb7122b" countchildren="0" classification_id="10" parent_id="829" taxon_id="946" treeIndex="#t10#4032#49#48#829#828#" sortIndex="0"/>
+ <TaxonNode id="829" created="2010-12-21 15:09:49.0" uuid="4fe03763-b966-4361-8334-352f6f777588" countchildren="1" classification_id="10" parent_id="48" taxon_id="948" treeIndex="#t10#4032#49#48#829#" sortIndex="3"/>
+ <TaxonNode id="1915" created="2010-12-21 15:09:57.0" uuid="99f03b56-67cd-4e01-9ceb-2362d48f9d07" countchildren="0" classification_id="10" parent_id="1916" taxon_id="2203" treeIndex="#t10#4032#49#48#1916#1915#" sortIndex="0"/>
+ <TaxonNode id="1916" created="2010-12-21 15:09:57.0" uuid="d8998200-500f-4312-90f4-2b60e6fd3a78" countchildren="1" classification_id="10" parent_id="48" taxon_id="2205" treeIndex="#t10#4032#49#48#1916#" sortIndex="4"/>
+ <TaxonNode id="2354" created="2010-12-21 15:10:00.0" uuid="b8439f51-6b96-445a-b401-7a836ba1cf58" countchildren="0" classification_id="10" parent_id="2355" taxon_id="2737" treeIndex="#t10#4032#49#48#2355#2354#" sortIndex="0"/>
+ <TaxonNode id="2355" created="2010-12-21 15:10:00.0" uuid="6da4e5b6-ebc3-4c46-bdce-24161b7bd0e2" countchildren="1" classification_id="10" parent_id="48" taxon_id="2738" treeIndex="#t10#4032#49#48#2355#" sortIndex="5"/>
+ <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="1" classification_id="10" treeIndex="#t10#4032#"/>
+
+ <TaxonNameBase DTYPE="BotanicalName" id="48" created="2010-12-21 15:09:43.0" uuid="7aceb517-2b91-46b9-a5a2-88b7e0fb3230" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L." fullTitleCache="Adiantum capillus-veneris L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum capillus-veneris" protectedauthorshipcache="false" protectednamecache="false" specificepithet="capillus-veneris" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="49" created="2010-12-21 15:09:43.0" uuid="079fff38-ff2d-426b-a49e-70b0f1db6c31" protectedtitlecache="false" titleCache="Pteridophyta" fullTitleCache="Pteridophyta" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteridophyta" hybridformula="false" monomhybrid="false" namecache="Pteridophyta" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="810"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="51" created="2010-12-21 15:09:43.0" uuid="c8af63e0-7bd4-4fad-aa2d-3777cbe1210a" protectedtitlecache="false" titleCache="Adiantum" fullTitleCache="Adiantum" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="264" created="2010-12-21 15:09:45.0" uuid="b976da6a-dd84-4fcd-9a1b-9847afba1da2" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link" fullTitleCache="Anogramma leptophylla (L.) Link" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Link" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma leptophylla" protectedauthorshipcache="false" protectednamecache="false" specificepithet="leptophylla" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="265" created="2010-12-21 15:09:45.0" uuid="c7f1db22-20fb-4eeb-810b-d37c5593b95d" protectedtitlecache="false" titleCache="Anogramma" fullTitleCache="Anogramma" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="812" created="2010-12-21 15:09:48.0" uuid="16450a2d-2085-471f-804a-defcd43c03e4" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod." fullTitleCache="Cheilanthes acrostica (Balb.) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Balb.) Tod." binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes acrostica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="acrostica" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="814" created="2010-12-21 15:09:48.0" uuid="bbb1c5be-5a0c-45e2-b8af-f37a80ccf858" protectedtitlecache="false" titleCache="Cheilanthes" fullTitleCache="Cheilanthes" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="815" created="2010-12-21 15:09:48.0" uuid="f04a9283-f856-4d28-b469-4a222472862b" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe" fullTitleCache="Cheilanthes maderensis Lowe" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Lowe" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes maderensis" protectedauthorshipcache="false" protectednamecache="false" specificepithet="maderensis" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="946" created="2010-12-21 15:09:49.0" uuid="e30ef44b-52e4-41ff-a68d-9912d3c537f1" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod." fullTitleCache="Cosentinia vellea (Aiton) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Aiton) Tod." binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia vellea" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vellea" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="948" created="2010-12-21 15:09:49.0" uuid="21fda99e-0425-4f29-b7b2-196f8a51b054" protectedtitlecache="false" titleCache="Cosentinia" fullTitleCache="Cosentinia" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2203" created="2010-12-21 15:09:57.0" uuid="8fe0bb4b-7687-4d32-8ff2-94e690980f81" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv." fullTitleCache="Notholaena marantae (L.) Desv." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Desv." binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena marantae" protectedauthorshipcache="false" protectednamecache="false" specificepithet="marantae" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2205" created="2010-12-21 15:09:57.0" uuid="77b7934f-8f62-4798-b96a-f3d12bfd5ebf" protectedtitlecache="false" titleCache="Notholaena" fullTitleCache="Notholaena" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2737" created="2010-12-21 15:10:00.0" uuid="25560d66-07a3-41ce-8244-36ca98638c71" protectedtitlecache="false" titleCache="Pteris vittata L." fullTitleCache="Pteris vittata L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris vittata" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vittata" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2738" created="2010-12-21 15:10:00.0" uuid="a40593ce-e8cc-43bb-a391-2de988b09039" protectedtitlecache="false" titleCache="Pteris" fullTitleCache="Pteris" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+
+ <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus" updatedby_id="10" name_id="10" rootnode_id="4032"/>
+
+ <TaxonBase DTYPE="Taxon" id="48" created="2011-03-01 20:11:26.0" uuid="b8402dc4-5050-4882-a147-01b71e0e47d6" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="48" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="49" created="2010-12-21 15:09:43.0" uuid="1141a510-5ee8-4a59-ae60-7b4fea44872f" protectedtitlecache="false" titleCache="Pteridophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="49" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="51" created="2010-12-21 15:09:43.0" uuid="233cac41-bb05-4925-bb9e-ab0bdf330973" protectedtitlecache="false" titleCache="Adiantum sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="51" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="264" created="2011-03-01 20:11:27.0" uuid="d679c5d0-53b3-40fc-97e1-0646aad7ed23" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="264" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="265" created="2010-12-21 15:09:45.0" uuid="1fc1d927-1155-4282-a9f5-f07202f79ace" protectedtitlecache="false" titleCache="Anogramma sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="265" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="812" created="2011-03-01 20:11:29.0" uuid="e40854d7-143f-4054-b229-6ed4cedb4bff" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="812" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="814" created="2010-12-21 15:09:48.0" uuid="433ad11a-b931-49a4-8128-d6f4d454914a" protectedtitlecache="false" titleCache="Cheilanthes sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="814" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="815" created="2010-12-21 15:09:48.0" uuid="7ea2c74a-f2b2-41f6-acdf-1ca35f5d03f8" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="815" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="946" created="2011-03-01 20:11:30.0" uuid="ba21b018-97d2-42d7-af6c-5e8db8e495ff" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="946" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="948" created="2010-12-21 15:09:49.0" uuid="a2768f6d-80f2-4e0c-a6e3-99b7a9f3bc9d" protectedtitlecache="false" titleCache="Cosentinia sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="948" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2203" created="2011-03-01 20:11:36.0" uuid="d9a0c5d5-baee-4b6b-974a-a7de5affe748" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2203" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2205" created="2010-12-21 15:09:57.0" uuid="c221d34c-76b0-4fc7-9901-e72efd4c899b" protectedtitlecache="false" titleCache="Notholaena sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2205" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2737" created="2011-03-01 20:11:39.0" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2737" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2738" created="2010-12-21 15:10:00.0" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2738" publish="true"/>
+
+ <DescriptionBase DTYPE="TaxonDescription" id="28" created="2010-12-21 15:09:43.0" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" updated="2011-03-01 19:20:45.0" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" created="2010-12-21 15:09:45.0" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" updated="2011-03-01 19:20:46.0" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" created="2010-12-21 15:09:48.0" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" created="2010-12-21 15:09:48.0" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" created="2010-12-21 15:09:49.0" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" created="2010-12-21 15:09:57.0" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" updated="2011-03-01 19:20:53.0" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" created="2010-12-21 15:10:00.0" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" updated="2011-03-01 19:20:55.0" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" created="2011-03-01 19:20:45.0" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" updated="2011-03-01 20:11:26.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" created="2011-03-01 19:20:46.0" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" updated="2011-03-01 20:11:27.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" created="2011-03-01 19:20:48.0" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" updated="2011-03-01 20:11:29.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" created="2011-03-01 19:20:48.0" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" updated="2011-03-01 20:11:30.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" created="2011-03-01 19:20:55.0" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" updated="2011-03-01 20:11:39.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" created="2011-03-01 19:20:53.0" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" updated="2011-03-01 20:11:36.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" created="2012-07-30 15:39:44.0" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" created="2012-12-03 12:21:48.0" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" created="2013-02-10 21:43:33.0" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" created="2014-02-28 19:20:29.0" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" updated="2014-02-28 19:20:29.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" created="2014-02-28 19:20:34.0" uuid="7b108193-e689-417a-bcab-adaf6c49d532" updated="2014-02-28 19:20:34.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" created="2014-02-28 19:20:58.0" uuid="de29cc97-a160-4783-b996-b929157335d5" updated="2014-02-28 19:20:58.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" created="2014-02-28 19:21:07.0" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" updated="2014-02-28 19:21:08.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" created="2014-02-28 19:23:51.0" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" updated="2014-02-28 19:23:51.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" created="2014-02-28 19:25:21.0" uuid="2d55f445-8e72-43d3-976a-133828e89599" updated="2014-02-28 19:25:21.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737"/>
+
+ <SynonymRelationship/>
+
+ <LanguageString id="10"/>
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Wed Mar 04 16:11:14 CET 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: all rows from Classification (extractionmodel/by-example/SbE-Classification-16-11-06-737.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 31
+ Classification 1
+ HomotypicalGroup 2
+ SynonymRelationship 1
+ TaxonBase 5
+ TaxonNameBase 3
+ TaxonNode 19
+
+--><dataset>
+
+
+ <TaxonNode id="347" created="2010-12-21 15:09:45.0" uuid="d425a971-1abe-4895-9e1f-1e5c8ff1c84c" countchildren="0" classification_id="10" taxon_id="387" treeIndex="#t10#4032#49#346#345#347#" sortIndex="1"/>
+ <TaxonNode id="351" created="2010-12-21 15:09:46.0" uuid="ce54c396-3694-47f2-abb0-1d7b7e057985" countchildren="0" classification_id="10" taxon_id="394" treeIndex="#t10#4032#49#346#345#351#" sortIndex="4"/>
+
+ <HomotypicalGroup id="368" created="2010-12-21 15:09:45.0" uuid="d7eaa174-4efd-4d09-a427-dce4ed6513f7" />
+ <HomotypicalGroup id="375" created="2010-12-21 15:09:46.0" uuid="62ed57d6-2c69-4404-bb95-248a1c9bb24c" />
+
+ <TaxonNameBase DTYPE="BotanicalName" id="387" created="2010-12-21 15:09:45.0" uuid="d25985c7-6fb4-4b31-8a94-5d7c5ba6ad16" protectedtitlecache="false" titleCache="Asplenium ceterach L." fullTitleCache="Asplenium ceterach L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium ceterach" protectedauthorshipcache="false" protectednamecache="false" specificepithet="ceterach" trinomhybrid="false" anamorphic="false" homotypicalgroup_id="368" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="388" created="2010-12-21 15:09:45.0" uuid="747021f1-cf5f-4249-a825-228da3368399" protectedtitlecache="true" titleCache="Asplenium cyprium Viane & Van den heede" fullTitleCache="Asplenium cyprium Viane & Van den heede" parsingproblem="16" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" hybridformula="false" monomhybrid="false" namecache="Asplenium cyprium Viane & Van den heede" protectedauthorshipcache="false" protectednamecache="true" trinomhybrid="false" anamorphic="false" />
+ <TaxonNameBase DTYPE="BotanicalName" id="394" created="2010-12-21 15:09:46.0" uuid="08f8f376-c9a4-4ea9-950d-3ac30b7fa689" protectedtitlecache="false" titleCache="Asplenium viride Huds." fullTitleCache="Asplenium viride Huds." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Huds." binomhybrid="false" genusoruninomial="Asplenium" hybridformula="false" monomhybrid="false" namecache="Asplenium viride" protectedauthorshipcache="false" protectednamecache="false" specificepithet="viride" trinomhybrid="false" anamorphic="false" homotypicalgroup_id="375" rank_id="778" />
+
+ <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" protectedtitlecache="false" titleCache="Cyprus" name_id="10" reference_id="10" />
+
+ <TaxonBase DTYPE="Taxon" id="387" created="2011-03-01 20:11:27.0" uuid="9763e5f0-6cd4-4d96-b8a4-4420854f7727" protectedtitlecache="false" titleCache="Asplenium ceterach L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="387" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Synonym" id="388" created="2010-12-21 15:09:45.0" uuid="1eb173bd-b174-4162-8ff5-5136d8f1e746" protectedtitlecache="false" titleCache="Asplenium cyprium Viane & Van den heede sec. Cyprus" doubtful="false" usenamecache="false" name_id="388" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="394" created="2011-03-01 20:11:27.0" uuid="aff4fa6f-9aa8-463d-ac07-ec8a1925eb57" protectedtitlecache="false" titleCache="Asplenium viride Huds. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="394" sec_id="10" publish="true"/>
+
+ <SynonymRelationship id="50" created="2010-12-21 15:09:45.0" uuid="60d1466f-5823-4a69-a071-1887d0c1e72b" doubtful="false" partial="false" proparte="false" relatedfrom_id="388" relatedto_id="387" />
+
+ <LanguageString id="10"/>
+ <DescriptionBase/>
+ <DescriptionElementBase/>
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Mon Jun 22 14:57:08 CEST 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: all rows from Classification (extractionmodel/by-example/SbE-Classification-14-56-50-312.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 6
+ Classification 1
+ TaxonBase 2
+ TaxonNode 3
+
+--><dataset>
+ <TaxonNode id="13" created="2010-12-21 15:09:43.0" uuid="0ac32f24-6d55-44ae-8519-c86c83faa938" countchildren="122" classification_id="10" parent_id="4032" taxon_id="11" treeIndex="#t10#4032#13#" sortIndex="0"/>
+ <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="1"/>
+ <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="2" classification_id="10" treeIndex="#t10#4032#"/>
+
+ <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus" updatedby_id="10" rootnode_id="4032"/>
+
+ <TaxonBase DTYPE="Taxon" id="11" created="2010-12-21 15:09:43.0" uuid="575347a4-fac0-4af7-8514-a4246b45fd7d" protectedtitlecache="false" titleCache="Spermatophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="49" created="2010-12-21 15:09:43.0" uuid="1141a510-5ee8-4a59-ae60-7b4fea44872f" protectedtitlecache="false" titleCache="Pteridophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" publish="true"/>
+
+
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Fri Jun 19 09:13:03 CEST 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: all rows from Classification (extractionmodel/by-example/SbE-Classification-09-10-20-259.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 67
+ Classification 1
+ DescriptionBase 22
+ TaxonBase 14
+ TaxonNameBase 14
+ TaxonNode 16
+
+--><dataset>
+ <TaxonNode id="46" created="2010-12-21 15:09:43.0" uuid="168a4d09-a2b0-4206-b4cc-5d13199f9306" countchildren="0" classification_id="10" parent_id="47" taxon_id="48" treeIndex="#t10#4032#49#48#47#46#" sortIndex="0"/>
+ <TaxonNode id="47" created="2010-12-21 15:09:43.0" uuid="2f05d429-632d-4230-b9cb-70299360b470" countchildren="1" classification_id="10" parent_id="48" taxon_id="51" treeIndex="#t10#4032#49#48#47#" sortIndex="0"/>
+ <TaxonNode id="48" created="2010-12-21 15:09:43.0"
+ uuid="24773d3b-8f11-4400-99de-71658982b245" countchildren="6"
+ classification_id="10" parent_id="49" treeIndex="#t10#4032#49#48#"
+ sortIndex="0" taxon_id="2739" />
+ <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="0"/>
+ <TaxonNode id="236" created="2010-12-21 15:09:45.0" uuid="f5d97f8b-c673-4050-af06-bbfab33baaec" countchildren="0" classification_id="10" parent_id="237" taxon_id="264" treeIndex="#t10#4032#49#48#237#236#" sortIndex="0"/>
+ <TaxonNode id="237" created="2010-12-21 15:09:45.0" uuid="4998de90-d0be-433b-a62f-0d57a1e399b0" countchildren="1" classification_id="10" parent_id="48" taxon_id="265" treeIndex="#t10#4032#49#48#237#" sortIndex="1"/>
+ <TaxonNode id="714" created="2010-12-21 15:09:48.0" uuid="b85b5b78-6760-409f-ac91-bb89e95ff2a1" countchildren="0" classification_id="10" parent_id="715" taxon_id="812" treeIndex="#t10#4032#49#48#715#714#" sortIndex="0"/>
+ <TaxonNode id="715" created="2010-12-21 15:09:48.0" uuid="91698cec-615f-4472-9002-feda1a6acded" countchildren="2" classification_id="10" parent_id="48" taxon_id="814" treeIndex="#t10#4032#49#48#715#" sortIndex="2"/>
+ <TaxonNode id="716" created="2010-12-21 15:09:48.0" uuid="6ad8e9e2-f5f6-41ad-aa30-f62a903650db" countchildren="0" classification_id="10" parent_id="715" taxon_id="815" treeIndex="#t10#4032#49#48#715#716#" sortIndex="1"/>
+ <TaxonNode id="828" created="2010-12-21 15:09:49.0" uuid="786622ba-cb2c-47f4-9eeb-65a6ebb7122b" countchildren="0" classification_id="10" parent_id="829" taxon_id="946" treeIndex="#t10#4032#49#48#829#828#" sortIndex="0"/>
+ <TaxonNode id="829" created="2010-12-21 15:09:49.0" uuid="4fe03763-b966-4361-8334-352f6f777588" countchildren="1" classification_id="10" parent_id="48" taxon_id="948" treeIndex="#t10#4032#49#48#829#" sortIndex="3"/>
+ <TaxonNode id="1915" created="2010-12-21 15:09:57.0" uuid="99f03b56-67cd-4e01-9ceb-2362d48f9d07" countchildren="0" classification_id="10" parent_id="1916" taxon_id="2203" treeIndex="#t10#4032#49#48#1916#1915#" sortIndex="0"/>
+ <TaxonNode id="1916" created="2010-12-21 15:09:57.0" uuid="d8998200-500f-4312-90f4-2b60e6fd3a78" countchildren="1" classification_id="10" parent_id="48" taxon_id="2205" treeIndex="#t10#4032#49#48#1916#" sortIndex="4"/>
+ <TaxonNode id="2354" created="2010-12-21 15:10:00.0" uuid="b8439f51-6b96-445a-b401-7a836ba1cf58" countchildren="0" classification_id="10" parent_id="2355" taxon_id="2737" treeIndex="#t10#4032#49#48#2355#2354#" sortIndex="0"/>
+ <TaxonNode id="2355" created="2010-12-21 15:10:00.0" uuid="6da4e5b6-ebc3-4c46-bdce-24161b7bd0e2" countchildren="1" classification_id="10" parent_id="48" taxon_id="2738" treeIndex="#t10#4032#49#48#2355#" sortIndex="5"/>
+ <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="1" classification_id="10" treeIndex="#t10#4032#"/>
+
+ <TaxonNameBase DTYPE="BotanicalName" id="48" created="2010-12-21 15:09:43.0" uuid="7aceb517-2b91-46b9-a5a2-88b7e0fb3230" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L." fullTitleCache="Adiantum capillus-veneris L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum capillus-veneris" protectedauthorshipcache="false" protectednamecache="false" specificepithet="capillus-veneris" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="49" created="2010-12-21 15:09:43.0" uuid="079fff38-ff2d-426b-a49e-70b0f1db6c31" protectedtitlecache="false" titleCache="Pteridophyta" fullTitleCache="Pteridophyta" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteridophyta" hybridformula="false" monomhybrid="false" namecache="Pteridophyta" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="810"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="51" created="2010-12-21 15:09:43.0" uuid="c8af63e0-7bd4-4fad-aa2d-3777cbe1210a" protectedtitlecache="false" titleCache="Adiantum" fullTitleCache="Adiantum" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="264" created="2010-12-21 15:09:45.0" uuid="b976da6a-dd84-4fcd-9a1b-9847afba1da2" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link" fullTitleCache="Anogramma leptophylla (L.) Link" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Link" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma leptophylla" protectedauthorshipcache="false" protectednamecache="false" specificepithet="leptophylla" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="265" created="2010-12-21 15:09:45.0" uuid="c7f1db22-20fb-4eeb-810b-d37c5593b95d" protectedtitlecache="false" titleCache="Anogramma" fullTitleCache="Anogramma" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="812" created="2010-12-21 15:09:48.0" uuid="16450a2d-2085-471f-804a-defcd43c03e4" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod." fullTitleCache="Cheilanthes acrostica (Balb.) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Balb.) Tod." binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes acrostica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="acrostica" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="814" created="2010-12-21 15:09:48.0" uuid="bbb1c5be-5a0c-45e2-b8af-f37a80ccf858" protectedtitlecache="false" titleCache="Cheilanthes" fullTitleCache="Cheilanthes" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="815" created="2010-12-21 15:09:48.0" uuid="f04a9283-f856-4d28-b469-4a222472862b" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe" fullTitleCache="Cheilanthes maderensis Lowe" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Lowe" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes maderensis" protectedauthorshipcache="false" protectednamecache="false" specificepithet="maderensis" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="946" created="2010-12-21 15:09:49.0" uuid="e30ef44b-52e4-41ff-a68d-9912d3c537f1" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod." fullTitleCache="Cosentinia vellea (Aiton) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Aiton) Tod." binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia vellea" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vellea" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="948" created="2010-12-21 15:09:49.0" uuid="21fda99e-0425-4f29-b7b2-196f8a51b054" protectedtitlecache="false" titleCache="Cosentinia" fullTitleCache="Cosentinia" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2203" created="2010-12-21 15:09:57.0" uuid="8fe0bb4b-7687-4d32-8ff2-94e690980f81" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv." fullTitleCache="Notholaena marantae (L.) Desv." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Desv." binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena marantae" protectedauthorshipcache="false" protectednamecache="false" specificepithet="marantae" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2205" created="2010-12-21 15:09:57.0" uuid="77b7934f-8f62-4798-b96a-f3d12bfd5ebf" protectedtitlecache="false" titleCache="Notholaena" fullTitleCache="Notholaena" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2737" created="2010-12-21 15:10:00.0" uuid="25560d66-07a3-41ce-8244-36ca98638c71" protectedtitlecache="false" titleCache="Pteris vittata L." fullTitleCache="Pteris vittata L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris vittata" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vittata" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2738" created="2010-12-21 15:10:00.0" uuid="a40593ce-e8cc-43bb-a391-2de988b09039" protectedtitlecache="false" titleCache="Pteris" fullTitleCache="Pteris" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2739" created="2010-12-21 15:10:00.0" uuid="81e2f844-70a9-4b14-82c2-9c2ba3fdb24e" protectedtitlecache="false" titleCache="Pteris cretica L." fullTitleCache="Pteris cretica L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris cretica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="cretica" trinomhybrid="false" anamorphic="false" rank_id="778" />
+
+ <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus" updatedby_id="10" name_id="10" rootnode_id="4032"/>
+
+ <TaxonBase DTYPE="Taxon" id="48" created="2011-03-01 20:11:26.0" uuid="b8402dc4-5050-4882-a147-01b71e0e47d6" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="48" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="49" created="2010-12-21 15:09:43.0" uuid="1141a510-5ee8-4a59-ae60-7b4fea44872f" protectedtitlecache="false" titleCache="Pteridophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="49" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="51" created="2010-12-21 15:09:43.0" uuid="233cac41-bb05-4925-bb9e-ab0bdf330973" protectedtitlecache="false" titleCache="Adiantum sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="51" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="264" created="2011-03-01 20:11:27.0" uuid="d679c5d0-53b3-40fc-97e1-0646aad7ed23" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="264" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="265" created="2010-12-21 15:09:45.0" uuid="1fc1d927-1155-4282-a9f5-f07202f79ace" protectedtitlecache="false" titleCache="Anogramma sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="265" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="812" created="2011-03-01 20:11:29.0" uuid="e40854d7-143f-4054-b229-6ed4cedb4bff" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="812" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="814" created="2010-12-21 15:09:48.0" uuid="433ad11a-b931-49a4-8128-d6f4d454914a" protectedtitlecache="false" titleCache="Cheilanthes sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="814" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="815" created="2010-12-21 15:09:48.0" uuid="7ea2c74a-f2b2-41f6-acdf-1ca35f5d03f8" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="815" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="946" created="2011-03-01 20:11:30.0" uuid="ba21b018-97d2-42d7-af6c-5e8db8e495ff" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="946" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="948" created="2010-12-21 15:09:49.0" uuid="a2768f6d-80f2-4e0c-a6e3-99b7a9f3bc9d" protectedtitlecache="false" titleCache="Cosentinia sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="948" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2203" created="2011-03-01 20:11:36.0" uuid="d9a0c5d5-baee-4b6b-974a-a7de5affe748" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2203" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2205" created="2010-12-21 15:09:57.0" uuid="c221d34c-76b0-4fc7-9901-e72efd4c899b" protectedtitlecache="false" titleCache="Notholaena sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2205" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2737" created="2011-03-01 20:11:39.0" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2737" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2738" created="2010-12-21 15:10:00.0" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2738" publish="true"/><TaxonBase
+ DTYPE="Taxon" id="2739" created="2010-12-21 15:10:00.0" uuid="79b45ff5-c17c-44ec-9114-fb6b3cd1aef4" protectedtitlecache="false"
+ titleCache="Pteris cretica sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" name_id="2739"
+ taxonomicchildrencount="0" publish="true" unplaced="false"
+ taxonstatusunknown="false">
+</TaxonBase>
+
+ <DescriptionBase DTYPE="TaxonDescription" id="28" created="2010-12-21 15:09:43.0" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" updated="2011-03-01 19:20:45.0" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48"></DescriptionBase>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" created="2010-12-21 15:09:45.0" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" updated="2011-03-01 19:20:46.0" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" created="2010-12-21 15:09:48.0" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" created="2010-12-21 15:09:48.0" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" created="2010-12-21 15:09:49.0" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" created="2010-12-21 15:09:57.0" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" updated="2011-03-01 19:20:53.0" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" created="2010-12-21 15:10:00.0" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" updated="2011-03-01 19:20:55.0" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" created="2011-03-01 19:20:45.0" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" updated="2011-03-01 20:11:26.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" created="2011-03-01 19:20:46.0" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" updated="2011-03-01 20:11:27.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" created="2011-03-01 19:20:48.0" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" updated="2011-03-01 20:11:29.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" created="2011-03-01 19:20:48.0" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" updated="2011-03-01 20:11:30.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" created="2011-03-01 19:20:55.0" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" updated="2011-03-01 20:11:39.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" created="2011-03-01 19:20:53.0" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" updated="2011-03-01 20:11:36.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" created="2012-07-30 15:39:44.0" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" created="2012-12-03 12:21:48.0" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" created="2013-02-10 21:43:33.0" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" created="2014-02-28 19:20:29.0" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" updated="2014-02-28 19:20:29.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" created="2014-02-28 19:20:34.0" uuid="7b108193-e689-417a-bcab-adaf6c49d532" updated="2014-02-28 19:20:34.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" created="2014-02-28 19:20:58.0" uuid="de29cc97-a160-4783-b996-b929157335d5" updated="2014-02-28 19:20:58.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" created="2014-02-28 19:21:07.0" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" updated="2014-02-28 19:21:08.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" created="2014-02-28 19:23:51.0" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" updated="2014-02-28 19:23:51.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" created="2014-02-28 19:25:21.0" uuid="2d55f445-8e72-43d3-976a-133828e89599" updated="2014-02-28 19:25:21.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737"/>
+
+ <SynonymRelationship/>
+
+ <LanguageString id="10"/>
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Fri Jun 19 09:13:03 CEST 2015 from cmathew@cmbgbm-t530
+
+ Extraction Model: all rows from Classification (extractionmodel/by-example/SbE-Classification-09-10-20-259.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 67
+ Classification 1
+ DescriptionBase 22
+ TaxonBase 14
+ TaxonNameBase 14
+ TaxonNode 16
+
+--><dataset>
+ <TaxonNode id="46" created="2010-12-21 15:09:43.0" uuid="168a4d09-a2b0-4206-b4cc-5d13199f9306" countchildren="0" classification_id="10" parent_id="47" taxon_id="48" treeIndex="#t10#4032#49#48#47#46#" sortIndex="0"/>
+ <TaxonNode id="47" created="2010-12-21 15:09:43.0" uuid="2f05d429-632d-4230-b9cb-70299360b470" countchildren="1" classification_id="10" parent_id="48" taxon_id="51" treeIndex="#t10#4032#49#48#47#" sortIndex="0"/>
+ <TaxonNode id="48" created="2010-12-21 15:09:43.0" uuid="24773d3b-8f11-4400-99de-71658982b245" countchildren="6" classification_id="10" parent_id="49" treeIndex="#t10#4032#49#48#" sortIndex="0"/>
+ <TaxonNode id="49" created="2010-12-21 15:09:43.0" uuid="572290a9-7535-48c8-9f68-25ddbc9869ee" countchildren="10" classification_id="10" parent_id="4032" taxon_id="49" treeIndex="#t10#4032#49#" sortIndex="0"/>
+ <TaxonNode id="236" created="2010-12-21 15:09:45.0" uuid="f5d97f8b-c673-4050-af06-bbfab33baaec" countchildren="0" classification_id="10" parent_id="237" taxon_id="264" treeIndex="#t10#4032#49#48#237#236#" sortIndex="0"/>
+ <TaxonNode id="237" created="2010-12-21 15:09:45.0" uuid="4998de90-d0be-433b-a62f-0d57a1e399b0" countchildren="1" classification_id="10" parent_id="48" taxon_id="265" treeIndex="#t10#4032#49#48#237#" sortIndex="1"/>
+ <TaxonNode id="714" created="2010-12-21 15:09:48.0" uuid="b85b5b78-6760-409f-ac91-bb89e95ff2a1" countchildren="0" classification_id="10" parent_id="715" taxon_id="812" treeIndex="#t10#4032#49#48#715#714#" sortIndex="0"/>
+ <TaxonNode id="715" created="2010-12-21 15:09:48.0" uuid="91698cec-615f-4472-9002-feda1a6acded" countchildren="2" classification_id="10" parent_id="48" taxon_id="814" treeIndex="#t10#4032#49#48#715#" sortIndex="2"/>
+ <TaxonNode id="716" created="2010-12-21 15:09:48.0" uuid="6ad8e9e2-f5f6-41ad-aa30-f62a903650db" countchildren="0" classification_id="10" parent_id="715" taxon_id="815" treeIndex="#t10#4032#49#48#715#716#" sortIndex="1"/>
+ <TaxonNode id="828" created="2010-12-21 15:09:49.0" uuid="786622ba-cb2c-47f4-9eeb-65a6ebb7122b" countchildren="0" classification_id="10" parent_id="829" taxon_id="946" treeIndex="#t10#4032#49#48#829#828#" sortIndex="0"/>
+ <TaxonNode id="829" created="2010-12-21 15:09:49.0" uuid="4fe03763-b966-4361-8334-352f6f777588" countchildren="1" classification_id="10" parent_id="48" taxon_id="948" treeIndex="#t10#4032#49#48#829#" sortIndex="3"/>
+ <TaxonNode id="1915" created="2010-12-21 15:09:57.0" uuid="99f03b56-67cd-4e01-9ceb-2362d48f9d07" countchildren="0" classification_id="10" parent_id="1916" taxon_id="2203" treeIndex="#t10#4032#49#48#1916#1915#" sortIndex="0"/>
+ <TaxonNode id="1916" created="2010-12-21 15:09:57.0" uuid="d8998200-500f-4312-90f4-2b60e6fd3a78" countchildren="1" classification_id="10" parent_id="48" taxon_id="2205" treeIndex="#t10#4032#49#48#1916#" sortIndex="4"/>
+ <TaxonNode id="2354" created="2010-12-21 15:10:00.0" uuid="b8439f51-6b96-445a-b401-7a836ba1cf58" countchildren="0" classification_id="10" parent_id="2355" taxon_id="2737" treeIndex="#t10#4032#49#48#2355#2354#" sortIndex="0"/>
+ <TaxonNode id="2355" created="2010-12-21 15:10:00.0" uuid="6da4e5b6-ebc3-4c46-bdce-24161b7bd0e2" countchildren="1" classification_id="10" parent_id="48" taxon_id="2738" treeIndex="#t10#4032#49#48#2355#" sortIndex="5"/>
+ <TaxonNode id="4032" created="2014-01-16 10:24:29.0" uuid="29b3fd3f-29b4-4011-ab12-9c1ad1607dbd" countchildren="1" classification_id="10" treeIndex="#t10#4032#"/>
+
+ <TaxonNameBase DTYPE="BotanicalName" id="48" created="2010-12-21 15:09:43.0" uuid="7aceb517-2b91-46b9-a5a2-88b7e0fb3230" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L." fullTitleCache="Adiantum capillus-veneris L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum capillus-veneris" protectedauthorshipcache="false" protectednamecache="false" specificepithet="capillus-veneris" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="49" created="2010-12-21 15:09:43.0" uuid="079fff38-ff2d-426b-a49e-70b0f1db6c31" protectedtitlecache="false" titleCache="Pteridophyta" fullTitleCache="Pteridophyta" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteridophyta" hybridformula="false" monomhybrid="false" namecache="Pteridophyta" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="810"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="51" created="2010-12-21 15:09:43.0" uuid="c8af63e0-7bd4-4fad-aa2d-3777cbe1210a" protectedtitlecache="false" titleCache="Adiantum" fullTitleCache="Adiantum" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Adiantum" hybridformula="false" monomhybrid="false" namecache="Adiantum" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="264" created="2010-12-21 15:09:45.0" uuid="b976da6a-dd84-4fcd-9a1b-9847afba1da2" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link" fullTitleCache="Anogramma leptophylla (L.) Link" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Link" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma leptophylla" protectedauthorshipcache="false" protectednamecache="false" specificepithet="leptophylla" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="265" created="2010-12-21 15:09:45.0" uuid="c7f1db22-20fb-4eeb-810b-d37c5593b95d" protectedtitlecache="false" titleCache="Anogramma" fullTitleCache="Anogramma" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Anogramma" hybridformula="false" monomhybrid="false" namecache="Anogramma" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="812" created="2010-12-21 15:09:48.0" uuid="16450a2d-2085-471f-804a-defcd43c03e4" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod." fullTitleCache="Cheilanthes acrostica (Balb.) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Balb.) Tod." binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes acrostica" protectedauthorshipcache="false" protectednamecache="false" specificepithet="acrostica" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="814" created="2010-12-21 15:09:48.0" uuid="bbb1c5be-5a0c-45e2-b8af-f37a80ccf858" protectedtitlecache="false" titleCache="Cheilanthes" fullTitleCache="Cheilanthes" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="815" created="2010-12-21 15:09:48.0" uuid="f04a9283-f856-4d28-b469-4a222472862b" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe" fullTitleCache="Cheilanthes maderensis Lowe" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="Lowe" binomhybrid="false" genusoruninomial="Cheilanthes" hybridformula="false" monomhybrid="false" namecache="Cheilanthes maderensis" protectedauthorshipcache="false" protectednamecache="false" specificepithet="maderensis" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="946" created="2010-12-21 15:09:49.0" uuid="e30ef44b-52e4-41ff-a68d-9912d3c537f1" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod." fullTitleCache="Cosentinia vellea (Aiton) Tod." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(Aiton) Tod." binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia vellea" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vellea" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="948" created="2010-12-21 15:09:49.0" uuid="21fda99e-0425-4f29-b7b2-196f8a51b054" protectedtitlecache="false" titleCache="Cosentinia" fullTitleCache="Cosentinia" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Cosentinia" hybridformula="false" monomhybrid="false" namecache="Cosentinia" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2203" created="2010-12-21 15:09:57.0" uuid="8fe0bb4b-7687-4d32-8ff2-94e690980f81" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv." fullTitleCache="Notholaena marantae (L.) Desv." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="(L.) Desv." binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena marantae" protectedauthorshipcache="false" protectednamecache="false" specificepithet="marantae" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2205" created="2010-12-21 15:09:57.0" uuid="77b7934f-8f62-4798-b96a-f3d12bfd5ebf" protectedtitlecache="false" titleCache="Notholaena" fullTitleCache="Notholaena" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Notholaena" hybridformula="false" monomhybrid="false" namecache="Notholaena" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+ <TaxonNameBase DTYPE="BotanicalName" id="2737" created="2010-12-21 15:10:00.0" uuid="25560d66-07a3-41ce-8244-36ca98638c71" protectedtitlecache="false" titleCache="Pteris vittata L." fullTitleCache="Pteris vittata L." parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="L." binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris vittata" protectedauthorshipcache="false" protectednamecache="false" specificepithet="vittata" trinomhybrid="false" anamorphic="false" rank_id="778" />
+ <TaxonNameBase DTYPE="BotanicalName" id="2738" created="2010-12-21 15:10:00.0" uuid="a40593ce-e8cc-43bb-a391-2de988b09039" protectedtitlecache="false" titleCache="Pteris" fullTitleCache="Pteris" parsingproblem="0" problemends="-1" problemstarts="-1" protectedfulltitlecache="false" authorshipcache="" binomhybrid="false" genusoruninomial="Pteris" hybridformula="false" monomhybrid="false" namecache="Pteris" protectedauthorshipcache="false" protectednamecache="false" trinomhybrid="false" anamorphic="false" rank_id="788"/>
+
+ <Classification id="10" created="2010-12-21 15:09:43.0" uuid="0c2b5d25-7b15-4401-8b51-dd4be0ee5cab" updated="2015-06-09 07:10:42.0" protectedtitlecache="false" titleCache="Cyprus" updatedby_id="10" name_id="10" rootnode_id="4032"/>
+
+ <TaxonBase DTYPE="Taxon" id="48" created="2011-03-01 20:11:26.0" uuid="b8402dc4-5050-4882-a147-01b71e0e47d6" protectedtitlecache="false" titleCache="Adiantum capillus-veneris L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="48" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="49" created="2010-12-21 15:09:43.0" uuid="1141a510-5ee8-4a59-ae60-7b4fea44872f" protectedtitlecache="false" titleCache="Pteridophyta sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="49" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="51" created="2010-12-21 15:09:43.0" uuid="233cac41-bb05-4925-bb9e-ab0bdf330973" protectedtitlecache="false" titleCache="Adiantum sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="51" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="264" created="2011-03-01 20:11:27.0" uuid="d679c5d0-53b3-40fc-97e1-0646aad7ed23" protectedtitlecache="false" titleCache="Anogramma leptophylla (L.) Link sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="264" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="265" created="2010-12-21 15:09:45.0" uuid="1fc1d927-1155-4282-a9f5-f07202f79ace" protectedtitlecache="false" titleCache="Anogramma sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="265" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="812" created="2011-03-01 20:11:29.0" uuid="e40854d7-143f-4054-b229-6ed4cedb4bff" protectedtitlecache="false" titleCache="Cheilanthes acrostica (Balb.) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="812" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="814" created="2010-12-21 15:09:48.0" uuid="433ad11a-b931-49a4-8128-d6f4d454914a" protectedtitlecache="false" titleCache="Cheilanthes sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="814" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="815" created="2010-12-21 15:09:48.0" uuid="7ea2c74a-f2b2-41f6-acdf-1ca35f5d03f8" protectedtitlecache="false" titleCache="Cheilanthes maderensis Lowe sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="815" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="946" created="2011-03-01 20:11:30.0" uuid="ba21b018-97d2-42d7-af6c-5e8db8e495ff" protectedtitlecache="false" titleCache="Cosentinia vellea (Aiton) Tod. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="946" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="948" created="2010-12-21 15:09:49.0" uuid="a2768f6d-80f2-4e0c-a6e3-99b7a9f3bc9d" protectedtitlecache="false" titleCache="Cosentinia sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="948" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2203" created="2011-03-01 20:11:36.0" uuid="d9a0c5d5-baee-4b6b-974a-a7de5affe748" protectedtitlecache="false" titleCache="Notholaena marantae (L.) Desv. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2203" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2205" created="2010-12-21 15:09:57.0" uuid="c221d34c-76b0-4fc7-9901-e72efd4c899b" protectedtitlecache="false" titleCache="Notholaena sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2205" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2737" created="2011-03-01 20:11:39.0" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2737" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="2738" created="2010-12-21 15:10:00.0" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" name_id="2738" publish="true"/>
+
+ <DescriptionBase DTYPE="TaxonDescription" id="28" created="2010-12-21 15:09:43.0" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" updated="2011-03-01 19:20:45.0" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" created="2010-12-21 15:09:45.0" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" updated="2011-03-01 19:20:46.0" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" created="2010-12-21 15:09:48.0" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" created="2010-12-21 15:09:48.0" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" created="2010-12-21 15:09:49.0" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" updated="2011-03-01 19:20:48.0" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" created="2010-12-21 15:09:57.0" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" updated="2011-03-01 19:20:53.0" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" created="2010-12-21 15:10:00.0" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" updated="2011-03-01 19:20:55.0" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" created="2011-03-01 19:20:45.0" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" updated="2011-03-01 20:11:26.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" created="2011-03-01 19:20:46.0" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" updated="2011-03-01 20:11:27.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" created="2011-03-01 19:20:48.0" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" updated="2011-03-01 20:11:29.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" created="2011-03-01 19:20:48.0" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" updated="2011-03-01 20:11:30.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" created="2011-03-01 19:20:55.0" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" updated="2011-03-01 20:11:39.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" created="2011-03-01 19:20:53.0" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" updated="2011-03-01 20:11:36.0" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" created="2012-07-30 15:39:44.0" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" created="2012-12-03 12:21:48.0" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" created="2013-02-10 21:43:33.0" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" created="2014-02-28 19:20:29.0" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" updated="2014-02-28 19:20:29.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" created="2014-02-28 19:20:34.0" uuid="7b108193-e689-417a-bcab-adaf6c49d532" updated="2014-02-28 19:20:34.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" created="2014-02-28 19:20:58.0" uuid="de29cc97-a160-4783-b996-b929157335d5" updated="2014-02-28 19:20:58.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" created="2014-02-28 19:21:07.0" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" updated="2014-02-28 19:21:08.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" created="2014-02-28 19:23:51.0" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" updated="2014-02-28 19:23:51.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" created="2014-02-28 19:25:21.0" uuid="2d55f445-8e72-43d3-976a-133828e89599" updated="2014-02-28 19:25:21.0" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737"/>
+
+ <SynonymRelationship/>
+
+ <LanguageString id="10"/>
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<dataset>
+ <TaxonNameBase />
+ <TaxonBase />
+ <TaxonNode />
+ <Classification />
+</dataset>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+
+ Extraction Model: PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 79
+ AgentBase 1
+ Credit 1
+ Extension 1
+ KeyStatement 10
+ KeyStatement_LanguageString 10
+ LanguageString 19
+ OriginalSourceBase 2
+ PolytomousKey 2
+ PolytomousKeyNode 10
+ PolytomousKeyNode_LanguageString 9
+ PolytomousKey_Credit 1
+ PolytomousKey_Extension 1
+ PolytomousKey_OriginalSourceBase 2
+ PolytomousKey_RightsInfo 1
+ PolytomousKey_Taxon 1
+ RightsInfo 1
+ TaxonBase 6
+
+--><dataset>
+ <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+ <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+ <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+ <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="" language_id="124"/>
+ <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" language_id="124"/>
+ <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" language_id="124"/>
+ <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" language_id="124"/>
+ <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" language_id="124"/>
+ <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" language_id="124"/>
+ <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." language_id="124"/>
+ <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." language_id="124"/>
+ <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" language_id="124"/>
+ <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+ <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+
+ <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. & Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+ <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+ <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4809" type_id="2056"/>
+
+
+ <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" key_id="1550" question_id="2760"/>
+ <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="751" taxon_id="37" parent_id="2750"/>
+ <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+ <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" key_id="1550" question_id="2761" statement_id="2460" subkey_id="751" parent_id="2750"/>
+ <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" key_id="1550" statement_id="2461" subkey_id="751" parent_id="2753"/>
+ <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+ <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+ <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" key_id="1550" statement_id="2464" parent_id="2753"/>
+ <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+ <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+ <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+ <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+ <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+ <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham"/>
+
+ <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+ <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+ <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+
+ <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" startNumber="1"/>
+ <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" root_id="2750" startNumber="1"/>
+
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" sourceType="PTS"/>
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" sourceType="PTS"/>
+
+</dataset>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?><!--
+ generated by Jailer 4.3, Thu Oct 09 18:00:09 CEST 2014 from cmathew@cmbgbm-t530
+
+ Extraction Model: PolytomousKey where uuid like '0d53ba20-7de4-4baa-bd8a-401048447d66' (extractionmodel/by-example/SbE-PolytomousKey-17-59-56-907.csv)
+ Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
+ Database User: root
+
+ Exported Rows: 79
+ AgentBase 1
+ Credit 1
+ Extension 1
+ KeyStatement 10
+ KeyStatement_LanguageString 10
+ LanguageString 19
+ OriginalSourceBase 2
+ PolytomousKey 2
+ PolytomousKeyNode 10
+ PolytomousKeyNode_LanguageString 9
+ PolytomousKey_Credit 1
+ PolytomousKey_Extension 1
+ PolytomousKey_OriginalSourceBase 2
+ PolytomousKey_RightsInfo 1
+ PolytomousKey_Taxon 1
+ RightsInfo 1
+ TaxonBase 6
+
+--><dataset>
+ <PolytomousKey_Extension PolytomousKey_id="1550" extensions_id="10"/>
+
+ <PolytomousKey_Credit PolytomousKey_id="1550" credits_id="20" sortIndex="0"/>
+
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2751" modifyingtext_id="13780" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2752" modifyingtext_id="13781" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2753" modifyingtext_id="13795" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2754" modifyingtext_id="13788" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2755" modifyingtext_id="13785" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2756" modifyingtext_id="13787" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2757" modifyingtext_id="13794" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2758" modifyingtext_id="13791" modifyingtext_mapkey_id="124"/>
+ <PolytomousKeyNode_LanguageString PolytomousKeyNode_id="2759" modifyingtext_id="13793" modifyingtext_mapkey_id="124"/>
+
+ <LanguageString id="13780" created="2014-03-10 10:03:09.0" uuid="cceaa60b-61f4-4c8a-bb0e-d45f0fa3e2dc" text="Modifying Text 1a" language_id="124"/>
+ <LanguageString id="13781" created="2014-03-10 10:03:17.0" uuid="01a0ace4-de49-4725-9909-e881fb13035d" text="" language_id="124"/>
+ <LanguageString id="13782" created="2014-03-10 10:03:48.0" uuid="ec0fea40-69dd-4c3e-ab7a-34948037a069" updated="2014-03-10 10:06:32.0" text="Capitula with ligulate ray-florets; leaves pinnatisect" language_id="124"/>
+ <LanguageString id="13783" created="2014-03-10 10:04:03.0" uuid="82f8a3a0-567f-4d89-ba10-3f3699111d55" updated="2014-03-10 10:06:32.0" text="Ray-florets yellow" language_id="124"/>
+ <LanguageString id="13784" created="2014-03-10 10:04:21.0" uuid="4270501f-1efc-45c2-9e8f-c65f120e8f4c" updated="2014-03-10 10:06:32.0" text="Stem thinly pilose; leaves 10-15 mm wide, with spreading linear-subulate segments; perennial herb" language_id="124"/>
+ <LanguageString id="13785" created="2014-03-10 10:04:07.0" uuid="813f5fd6-c8f6-43e8-9a2b-1464f3ba052a" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13786" created="2014-03-10 10:04:53.0" uuid="ba17ac94-632f-4d69-ac89-a882e19ff1c5" updated="2014-03-10 10:06:32.0" text="Stem white-tomentose; leaves 1-3 mm wide, with minute overlapping, transverse segments; small subshrubs with a woody base" language_id="124"/>
+ <LanguageString id="13787" created="2014-03-10 10:04:34.0" uuid="ab219a5d-e0c4-45fd-8405-6693c3fb8abf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13788" created="2014-03-10 10:03:53.0" uuid="2baec690-422d-4f85-bcfd-24f5718cbecf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13789" created="2014-03-10 10:05:16.0" uuid="7c6a7984-8e6f-48b1-86b2-d5d643199bf3" updated="2014-03-10 10:06:32.0" text="Ray-florets white" language_id="124"/>
+ <LanguageString id="13790" created="2014-03-10 10:05:34.0" uuid="72bd8bc9-1904-47ab-8bec-b9296a98b244" updated="2014-03-10 10:06:32.0" text="Perennial herb; stem pilose, hairy or glabrescent, but not tomentose; ligules 1-2 mm diam." language_id="124"/>
+ <LanguageString id="13791" created="2014-03-10 10:05:20.0" uuid="c917e3fb-e48b-4207-b77d-c1c108e37906" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13792" created="2014-03-10 10:06:15.0" uuid="c5dd35d8-da6a-4d05-b30c-6b55220bd989" updated="2014-03-10 10:06:32.0" text="Shrub with a woody base; stem white-tomentose or woolly; ligules 4-5 mm diam." language_id="124"/>
+ <LanguageString id="13793" created="2014-03-10 10:06:03.0" uuid="227a17f6-1ca1-4d06-8480-25711b614863" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13794" created="2014-03-10 10:05:07.0" uuid="2c434ab1-8ca7-4464-b5cd-4cee40db41ed" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13795" created="2014-03-10 10:03:38.0" uuid="27190d54-f53b-401e-820c-edfb36d4bcbf" updated="2014-03-10 10:06:32.0" text="" language_id="124"/>
+ <LanguageString id="13796" created="2014-03-10 10:03:25.0" uuid="69cffb28-8a85-478f-bcae-533e20938ccd" updated="2014-03-10 10:06:32.0" text="Capitula without ligulate ray-florets; leaves entire or subentire" language_id="124"/>
+ <LanguageString id="14570" created="2014-10-09 15:42:33.0" uuid="84967760-6dbe-4af4-8e0c-309f1af6ce20" updated="2014-10-09 15:42:44.0" text="Question 1" createdby_id="10" updatedby_id="10" language_id="124"/>
+ <LanguageString id="14571" created="2014-10-09 15:42:55.0" uuid="d82f37b1-f51d-42c1-a291-0c7820db155e" updated="2014-10-09 15:43:03.0" text="Question 2" createdby_id="10" updatedby_id="10" language_id="124"/>
+
+ <TaxonBase DTYPE="Taxon" id="32" created="2011-03-01 20:11:26.0" uuid="8217ef77-2ab1-4318-bd67-ccd0cdef07c4" protectedtitlecache="false" titleCache="Achillea arabica Kotschy sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="35" created="2010-12-21 15:09:43.0" uuid="fade44fd-34b2-455f-861a-d1372b866f06" protectedtitlecache="false" titleCache="Achillea sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="36" created="2011-03-01 20:11:26.0" uuid="05f0a2e1-e3c3-4e74-8fec-8a0ae89236c3" protectedtitlecache="false" titleCache="Achillea cretica L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="37" created="2011-03-01 20:11:26.0" uuid="0f8d18a9-e861-48e8-bfab-83e01a379bc0" protectedtitlecache="false" titleCache="Achillea maritima (L.)Ehrend. & Y.-P. Guo subsp. maritima sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="40" created="2010-12-21 15:09:43.0" uuid="2b336df7-29e8-4f79-985f-66502739d22f" protectedtitlecache="false" titleCache="Achillea millefolium L. sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+ <TaxonBase DTYPE="Taxon" id="41" created="2011-03-01 20:11:26.0" uuid="094e1af8-efd8-4605-b037-b4f715379562" protectedtitlecache="false" titleCache="Achillea santolinoides subsp. wilhelmsii (K. Koch) Greuter sec. Cyprus" doubtful="false" usenamecache="false" excluded="false" taxonstatusunknown="false" taxonomicchildrencount="0" unplaced="false" createdby_id="11" sec_id="10" publish="true"/>
+
+ <PolytomousKey_Taxon polytomousKey_id="1550" taxon_id="35"/>
+
+ <RightsInfo id="10" created="2014-10-09 15:45:53.0" uuid="bdfb572b-be25-45e7-9349-22a9da43531f" updated="2014-10-09 15:48:01.0" text="Rights Text Test" createdby_id="10" updatedby_id="10" agent_id="4809" type_id="2056"/>
+
+ <PolytomousKeyNode id="2750" created="2014-03-10 10:02:35.0" uuid="75e4c924-ff58-4ee7-a59d-fd9173517d08" updated="2014-03-10 10:02:42.0" nodenumber="1" key_id="1550" question_id="2760"/>
+ <PolytomousKeyNode id="2751" created="2014-03-10 10:02:52.0" uuid="23e51ff7-11b1-443b-aff2-3fe8b5ace9fe" sortindex="0" key_id="1550" statement_id="2467" subkey_id="1550" taxon_id="37" parent_id="2750"/>
+ <PolytomousKeyNode id="2752" created="2014-03-10 10:03:16.0" uuid="dcf326f7-c0ad-4e76-b64e-43aea11f767c" key_id="1550"/>
+ <PolytomousKeyNode id="2753" created="2014-03-10 10:03:38.0" uuid="b775c027-13c0-4b87-8aa9-712faeaafbdc" updated="2014-03-10 10:06:32.0" nodenumber="2" sortindex="1" key_id="1550" question_id="2761" statement_id="2460" subkey_id="1550" parent_id="2750"/>
+ <PolytomousKeyNode id="2754" created="2014-03-10 10:03:52.0" uuid="df5d5922-35de-43d5-9d46-7730ae28eeb3" updated="2014-03-10 10:06:32.0" nodenumber="3" sortindex="0" key_id="1550" statement_id="2461" subkey_id="1550" parent_id="2753"/>
+ <PolytomousKeyNode id="2755" created="2014-03-10 10:04:07.0" uuid="0c8583ee-399e-433c-b76b-272c54dbd9f5" updated="2014-03-10 10:06:32.0" sortindex="0" key_id="1550" statement_id="2462" taxon_id="32" parent_id="2754"/>
+ <PolytomousKeyNode id="2756" created="2014-03-10 10:04:34.0" uuid="a10e1e61-82c0-470e-a245-10a927b80c9a" updated="2014-03-10 10:06:32.0" sortindex="1" key_id="1550" statement_id="2463" taxon_id="41" parent_id="2754"/>
+ <PolytomousKeyNode id="2757" created="2014-03-10 10:05:07.0" uuid="19f7a6a2-4c55-49cb-8b92-d68a9fd9074c" updated="2014-03-10 10:06:32.0" nodenumber="4" sortindex="1" key_id="1550" statement_id="2464" parent_id="2753"/>
+ <PolytomousKeyNode id="2758" created="2014-03-10 10:05:20.0" uuid="0a4d86d1-fba5-4088-8dcc-6f0e7268ca5b" updated="2014-03-10 10:06:32.0" sortindex="0" key_id="1550" statement_id="2465" taxon_id="40" parent_id="2757"/>
+ <PolytomousKeyNode id="2759" created="2014-03-10 10:06:03.0" uuid="827c9df4-ac15-4163-95ab-616d51f62803" updated="2014-03-10 10:06:32.0" sortindex="1" key_id="1550" statement_id="2466" taxon_id="36" parent_id="2757"/>
+
+ <Credit id="20" created="2014-10-09 15:45:22.0" uuid="aa412b15-ee6c-4834-b14e-a66969cb398d" updated="2014-10-09 15:48:01.0" text="Credits Text Test" createdby_id="10" updatedby_id="10" language_id="124" agent_id="4809"/>
+
+ <KeyStatement id="2460" created="2014-03-10 10:03:48.0" uuid="66da6df7-784c-4d5a-9378-58b2cf92ba13" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2461" created="2014-03-10 10:04:03.0" uuid="f9cfd498-de47-48fd-b38c-43cf57b63750" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2462" created="2014-03-10 10:04:21.0" uuid="817fb39e-91d4-4d8c-a942-6acab47575d1" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2463" created="2014-03-10 10:04:53.0" uuid="6b571b86-7764-4f27-925c-ae5e2653f7ad" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2464" created="2014-03-10 10:05:16.0" uuid="91bbb534-abdf-4915-9f6f-a0cb41f8cf58" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2465" created="2014-03-10 10:05:34.0" uuid="1991ca31-2630-4917-8db3-eb67cec8f231" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2466" created="2014-03-10 10:06:15.0" uuid="3e1bbc59-b098-4533-ac35-245e1140a0ae" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2467" created="2014-03-10 10:03:24.0" uuid="68fd99f6-64ce-4bb8-a6af-d2cf2c046e2c" updated="2014-03-10 10:06:32.0" />
+ <KeyStatement id="2760" created="2014-10-09 15:42:33.0" uuid="b9702653-f620-4208-bda9-a6fe082004d1" updated="2014-10-09 15:42:44.0" createdby_id="10" updatedby_id="10"/>
+ <KeyStatement id="2761" created="2014-10-09 15:42:55.0" uuid="688a432f-4b57-4c6f-a8f6-0c468a28cb7c" updated="2014-10-09 15:43:03.0" createdby_id="10" updatedby_id="10"/>
+
+ <AgentBase DTYPE="Person" id="4809" created="2010-12-21 15:09:59.0" uuid="945d08f2-eb92-45b6-9252-6275ea6d338b" protectedtitlecache="false" titleCache="R. A. Graham" nomenclaturaltitle="R. A. Graham" createdby_id="11"/>
+
+ <Extension id="10" created="2014-10-09 15:45:41.0" uuid="0d6f35d7-7e76-446a-a017-7e8355ee1b4c" updated="2014-10-09 15:48:01.0" extendedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" extendedObj_id="1550" value="http://test.com" createdby_id="10" updatedby_id="10" type_id="2075"/>
+
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23710"/>
+ <PolytomousKey_OriginalSourceBase PolytomousKey_id="1550" sources_id="23711"/>
+
+ <PolytomousKey_RightsInfo PolytomousKey_id="1550" rights_id="10"/>
+
+ <KeyStatement_LanguageString KeyStatement_id="2460" label_id="13782" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2461" label_id="13783" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2462" label_id="13784" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2463" label_id="13786" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2464" label_id="13789" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2465" label_id="13790" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2466" label_id="13792" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2467" label_id="13796" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2760" label_id="14570" label_mapkey_id="124"/>
+ <KeyStatement_LanguageString KeyStatement_id="2761" label_id="14571" label_mapkey_id="124"/>
+
+ <PolytomousKey id="751" created="2013-03-24 11:17:08.0" uuid="9d8bf4f6-a70a-4b80-8556-2ccfb436ff01" protectedtitlecache="true" titleCache="Asphodeline" startNumber="1"/>
+ <PolytomousKey id="1550" created="2014-03-10 10:02:35.0" uuid="0d53ba20-7de4-4baa-bd8a-401048447d66" updated="2014-03-10 10:02:42.0" protectedtitlecache="true" titleCache="Achillea" root_id="2750" startNumber="1"/>
+
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23710" created="2014-03-10 10:06:57.0" uuid="95e05e82-499d-4b8a-ad6b-1085f74a7496" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" sourceType="PTS"/>
+ <OriginalSourceBase DTYPE="IdentifiableSource" id="23711" created="2014-03-10 10:06:48.0" uuid="f77555fe-0d98-4c9f-98ed-a5bca6b1e342" updated="2014-03-10 10:07:33.0" sourcedObj_type="eu.etaxonomy.cdm.model.description.PolytomousKey" sourcedObj_id="1550" sourceType="PTS"/>
+
+
+</dataset>
--- /dev/null
+<?xml version="1.0"?>
+<abcd:DataSets xmlns:abcd="http://www.tdwg.org/schemas/abcd/2.06" xmlns:biocase="http://www.biocase.org/schemas/protocol/1.3" xmlns:ns1="http://www.dnabank-network.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.biocase.org/schemas/protocol/1.3 http://www.bgbm.org/biodivinf/schema/protocol_1_31.xsd">
+ <abcd:DataSet>
+ <abcd:DatasetGUID>www.floraweb.de/florkart/atlas/2007</abcd:DatasetGUID>
+ <abcd:TechnicalContacts>
+ <abcd:TechnicalContact>
+ <abcd:Name>Rudolf May</abcd:Name>
+ <abcd:Email>rudolf.may@bfn.de</abcd:Email>
+ <abcd:Phone>+49-228-84911441</abcd:Phone>
+ <abcd:Address>BfN, Konstantinstr. 110, D-53179 Bonn</abcd:Address>
+ </abcd:TechnicalContact>
+ </abcd:TechnicalContacts>
+ <abcd:ContentContacts>
+ <abcd:ContentContact>
+ <abcd:Name>Rudolf May</abcd:Name>
+ <abcd:Email>rudolf.may@bfn.de</abcd:Email>
+ <abcd:Phone>+49-228-84911441</abcd:Phone>
+ <abcd:Address>BfN, Konstantinstr. 110, D-53179 Bonn</abcd:Address>
+ </abcd:ContentContact>
+ </abcd:ContentContacts>
+ <abcd:Metadata>
+ <abcd:Description>
+ <abcd:Representation abcd:language="GE German Deutsch">
+ <abcd:Title>FlorKart - FlorenKartierung Gefaesspflanzen</abcd:Title>
+ <abcd:Details>Verbreitung der Farn- und Bluetenpflanzen in Deutschland, Vorkommensnachweise aggregiert auf Rasterfelder der Topographischen Karte im Massstab 1 : 25000 (TK25 = MTB), Blattschnitt 6 x 10 Minuten, sowie in Zeitperioden 'vor 1950', '1950 - 1980', '1980 - 2000'</abcd:Details>
+ <abcd:Coverage>Deutschland</abcd:Coverage>
+ <abcd:URI>http://www.floraweb.de</abcd:URI>
+ </abcd:Representation>
+ </abcd:Description>
+ <abcd:IconURI>http://www.floraweb.de/images/floraweb.gif</abcd:IconURI>
+ <abcd:Version>
+ <abcd:Major>2007</abcd:Major>
+ </abcd:Version>
+ <abcd:RevisionData>
+ <abcd:Creators>Netzwerk Phytodiversitaet Deutschlands (NetPhyD) und Bundesamt für Naturschutz (BfN)</abcd:Creators>
+ <abcd:Contributors>Alle ehrenamtlich an der Floristischen Kartierung Deutschlands beteiligten Mitarbeiter</abcd:Contributors>
+ <abcd:DateCreated>2007-01-01</abcd:DateCreated>
+ <abcd:DateModified>2010-01-01</abcd:DateModified>
+ </abcd:RevisionData>
+ <abcd:Owners>
+ <abcd:Owner>
+ <abcd:Organisation>
+ <abcd:Name>
+ <abcd:Representation abcd:language="GE German Deutsch">
+ <abcd:Text>Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversität Deutschlands (NetPhyD)</abcd:Text>
+ <abcd:Abbreviation>BfN/NetPhyD</abcd:Abbreviation>
+ </abcd:Representation>
+ </abcd:Name>
+ </abcd:Organisation>
+ <abcd:Person>
+ <abcd:FullName>Rudolf May</abcd:FullName>
+ </abcd:Person>
+ <abcd:Roles>
+ <abcd:Role>Project Manager</abcd:Role>
+ </abcd:Roles>
+ <abcd:Addresses>
+ <abcd:Address>BfN, Konstantinstr. 110, D-53179 Bonn</abcd:Address>
+ </abcd:Addresses>
+ <abcd:TelephoneNumbers>
+ <abcd:TelephoneNumber>
+ <abcd:Number>+49-228-84911441</abcd:Number>
+ <abcd:Device>voice</abcd:Device>
+ </abcd:TelephoneNumber>
+ </abcd:TelephoneNumbers>
+ <abcd:EmailAddresses>
+ <abcd:EmailAddress>floraweb@bfn.de</abcd:EmailAddress>
+ </abcd:EmailAddresses>
+ <abcd:URIs>
+ <abcd:URL>http://www.bfn.de</abcd:URL>
+ </abcd:URIs>
+ <abcd:LogoURI>http://www.bfn.de/fileadmin/global/templates/images/logo_bfn.gif</abcd:LogoURI>
+ </abcd:Owner>
+ </abcd:Owners>
+ <abcd:IPRStatements>
+ <abcd:IPRDeclarations>
+ <abcd:IPRDeclaration abcd:language="GE German Deutsch">
+ <abcd:Text>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:Text>
+ <abcd:Details>Alle amtlich und ehrenamtlich an der Floristischen Kartierung Deutschlands beteiligten Mitarbeiter</abcd:Details>
+ </abcd:IPRDeclaration>
+ </abcd:IPRDeclarations>
+ <abcd:Copyrights>
+ <abcd:Copyright abcd:language="GE German Deutsch">
+ <abcd:Text>BfN/NetPhyD</abcd:Text>
+ <abcd:Details>Bundesamt fuer Naturschutz und Netzwerk Phytodiversitaet Deutschlands</abcd:Details>
+ </abcd:Copyright>
+ </abcd:Copyrights>
+ <abcd:TermsOfUseStatements>
+ <abcd:TermsOfUse abcd:language="GE German Deutsch">
+ <abcd:Text>Bei Verwendung in Publikationen bitte die Datenquelle vollstaendig zitieren.</abcd:Text>
+ <abcd:Details>Bei Verwendung in Publikationen bitte die Datenquelle vollstaendig zitieren. Die Verwendung der Daten zu kommerziellen Zwecken wird untersagt.</abcd:Details>
+ </abcd:TermsOfUse>
+ </abcd:TermsOfUseStatements>
+ <abcd:Disclaimers>
+ <abcd:Disclaimer abcd:language="GE German Deutsch">
+ <abcd:Text>Fuer die Richtigkeit der Daten wird keine Gewaehrleistung uebernommen</abcd:Text>
+ <abcd:Details>Fuer die Richtigkeit der Daten wird keine Gewaehrleistung uebernommen</abcd:Details>
+ </abcd:Disclaimer>
+ </abcd:Disclaimers>
+ <abcd:Acknowledgements>
+ <abcd:Acknowledgement abcd:language="GE German Deutsch">
+ <abcd:Text>In Anerkennung der Leistungen der ehrenamtlichen Kartierer der Flora Deutschlands</abcd:Text>
+ <abcd:Details>Die Kompilation der Verbreitungsdaten beruht auf unentgeltlich erbrachten Kartierungsleistungen von über 2000 ehrenamtlichen Mitarbeitern der Floristischen Kartierung Deutschlands, die in zahlreichen regionalen Kartierungsprojekten organisiert sind.</abcd:Details>
+ <abcd:URI>http://www.floraweb.de/pflanzenarten/hintergrundtexte_florkart_organisation.html</abcd:URI>
+ </abcd:Acknowledgement>
+ </abcd:Acknowledgements>
+ <abcd:Citations>
+ <abcd:Citation abcd:language="GE German Deutsch">
+ <abcd:Text>Datenbank FLORKART, BfN und NetPhyD</abcd:Text>
+ <abcd:Details>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:Details>
+ </abcd:Citation>
+ </abcd:Citations>
+ </abcd:IPRStatements>
+ </abcd:Metadata>
+ <abcd:Units>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003121</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 3915: Bockhorst</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>3915</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>8.25</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>52.06</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6363</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003122</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 3916: Halle (Westfalen)</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>3916</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>8.42</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>52.06</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6363</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003123</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 5628: Bad Königshofen im Grabfeld</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>5628</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>10.42</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>50.36</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6481</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003124</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 5634: Teuschnitz</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>5634</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.42</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>50.36</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6482</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003125</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 5635: Nordhalben</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>5635</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.58</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>50.36</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6483</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003126</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 5728: Oberlauringen</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>5728</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>10.42</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>50.26</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6487</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003127</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 6132: Buttenheim</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>6132</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.08</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>49.86</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6515</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003128</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 6232: Forchheim</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>6232</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.08</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>49.76</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6522</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003129</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 6235: Pegnitz</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>6235</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.58</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>49.76</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6523</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ <abcd:Unit>
+ <abcd:SourceInstitutionID>BfN</abcd:SourceInstitutionID>
+ <abcd:SourceID>FlorKart_BfN</abcd:SourceID>
+ <abcd:UnitID>1003130</abcd:UnitID>
+ <abcd:UnitReferences>
+ <abcd:UnitReference>
+ <abcd:TitleCitation>Datenbank FLORKART, BfN und NetPhyD</abcd:TitleCitation>
+ <abcd:CitationDetail>Datenbank FLORKART der Floristischen Kartierung Deutschlands, Stand 2007, Bundesamt für Naturschutz (BfN) und Netzwerk Phytodiversitaet Deutschland (NetPhyD)</abcd:CitationDetail>
+ </abcd:UnitReference>
+ </abcd:UnitReferences>
+ <abcd:Identifications>
+ <abcd:Identification>
+ <abcd:Result>
+ <abcd:TaxonIdentified>
+ <abcd:HigherTaxa>
+ <abcd:HigherTaxon>
+ <abcd:HigherTaxonName>Asteraceae</abcd:HigherTaxonName>
+ </abcd:HigherTaxon>
+ </abcd:HigherTaxa>
+ <abcd:ScientificName>
+ <abcd:FullScientificNameString>Cichorium calvum Asch.</abcd:FullScientificNameString>
+ <abcd:NameAtomised>
+ <abcd:Botanical>
+ <abcd:GenusOrMonomial>Cichorium</abcd:GenusOrMonomial>
+ <abcd:FirstEpithet>calvum</abcd:FirstEpithet>
+ <abcd:Rank>SPE</abcd:Rank>
+ <abcd:AuthorTeamParenthesis>Asch.</abcd:AuthorTeamParenthesis>
+ </abcd:Botanical>
+ </abcd:NameAtomised>
+ </abcd:ScientificName>
+ </abcd:TaxonIdentified>
+ </abcd:Result>
+ </abcd:Identification>
+ </abcd:Identifications>
+ <abcd:Gathering>
+ <abcd:DateTime>
+ <abcd:DateText>1950-1980</abcd:DateText>
+ <abcd:PeriodExplicit>false</abcd:PeriodExplicit>
+ </abcd:DateTime>
+ <abcd:Agents>
+ <abcd:GatheringAgentsText>Mitarbeiter der Floristischen Kartierung Deutschlands</abcd:GatheringAgentsText>
+ </abcd:Agents>
+ <abcd:LocalityText>MTB 7032: Bieswang</abcd:LocalityText>
+ <abcd:Country>
+ <abcd:Name language="German">Deutschland</abcd:Name>
+ </abcd:Country>
+ <abcd:SiteCoordinateSets>
+ <abcd:SiteCoordinates>
+ <abcd:CoordinatesGrid>
+ <abcd:GridCellSystem>German TK25</abcd:GridCellSystem>
+ <abcd:GridCellCode>7032</abcd:GridCellCode>
+ </abcd:CoordinatesGrid>
+ <abcd:CoordinatesLatLong>
+ <abcd:LongitudeDecimal>11.08</abcd:LongitudeDecimal>
+ <abcd:LatitudeDecimal>48.96</abcd:LatitudeDecimal>
+ <abcd:AccuracyStatement>Mittelpunkte von TK25-Rasterfeldern</abcd:AccuracyStatement>
+ <abcd:CoordinateErrorDistanceInMeters>6575</abcd:CoordinateErrorDistanceInMeters>
+ </abcd:CoordinatesLatLong>
+ </abcd:SiteCoordinates>
+ </abcd:SiteCoordinateSets>
+ </abcd:Gathering>
+ </abcd:Unit>
+ </abcd:Units>
+ </abcd:DataSet>
+ </abcd:DataSets>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Datasets xmlns="http://rs.tdwg.org/UBIF/2006/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rs.tdwg.org/UBIF/2006/ http://rs.tdwg.org/UBIF/2006/Schema/1.1/SDD.xsd">
+ <TechnicalMetadata created="1970-01-01T09:34:00">
+ <Generator name="Xper2"
+ notes="This software is developed and distributed by LIS - Laboratoire Informatique et SystÈmatique (LIS) - UniversitÈ Pierre et Marie Curie - Paris VI - Copyright (c) 2004-2009" version="1.1"/>
+ </TechnicalMetadata>
+ <Dataset xml:lang="fr">
+ <Representation>
+ <Label>ant base</Label>
+ </Representation>
+ <RevisionData>
+ <Creators>
+ <Agent ref="a0" role="aut"/>
+ </Creators>
+ <DateCreated>2012-06-06T09:34:58</DateCreated>
+ <DateModified>2012-06-06T09:34:58</DateModified>
+ </RevisionData>
+ <TaxonNames>
+ <TaxonName id="t1">
+ <Representation>
+ <Label>Dolichoderinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t2">
+ <Representation>
+ <Label>Formicinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t3">
+ <Representation>
+ <Label>Ponerinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t4">
+ <Representation>
+ <Label>Myrmicinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t5">
+ <Representation>
+ <Label>Pseudomyrmecinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t6">
+ <Representation>
+ <Label>Ecitoninae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t7">
+ <Representation>
+ <Label>Ectatomminae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t8">
+ <Representation>
+ <Label>Cerapachyinae</Label>
+ </Representation>
+ </TaxonName>
+ <TaxonName id="t9">
+ <Representation>
+ <Label>Genus Ectatom</Label>
+ </Representation>
+ </TaxonName>
+ </TaxonNames>
+ <TaxonHierarchies>
+ <TaxonHierarchy id="th1">
+ <Representation>
+ <Label>Default Entity Tree</Label>
+ </Representation>
+ <TaxonHierarchyType>UnspecifiedTaxonomy</TaxonHierarchyType>
+ <Nodes>
+ <Node id="tn1">
+ <TaxonName ref="t1"/>
+ </Node>
+ <Node id="tn2">
+ <TaxonName ref="t2"/>
+ </Node>
+ <Node id="tn3">
+ <Parent ref="tn2"/>
+ <TaxonName ref="t3"/>
+ </Node>
+ <Node id="tn4">
+ <TaxonName ref="t4"/>
+ </Node>
+ <Node id="tn5">
+ <Parent ref="tn4"/>
+ <TaxonName ref="t5"/>
+ </Node>
+ <Node id="tn6">
+ <TaxonName ref="t6"/>
+ </Node>
+ <Node id="tn7">
+ <Parent ref="tn6"/>
+ <TaxonName ref="t8"/>
+ </Node>
+ </Nodes>
+ </TaxonHierarchy>
+ </TaxonHierarchies>
+ <Characters>
+ <CategoricalCharacter id="c1">
+ <Representation>
+ <Label>Pétiole</Label>
+ <Detail>Le <b>pétiole</b> se situe entre le mésosoma et l'alitrunk.</Detail>
+ <MediaObject ref="m35"/>
+ <MediaObject ref="m36"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s1">
+ <Representation>
+ <Label>un seul article réduit ou isolé</Label>
+ <MediaObject ref="m37"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s2">
+ <Representation>
+ <Label>deux articles réduits ou isolés</Label>
+ <Detail>Les deux articles correspondent au<b>pétiole</b> et au <b>post-pétiole</b>.<br>Soit les deux segments sont plus ou moins réduits, soit le deuxième article est plus large que le premier, soit le postpétiole est largement plus réduit.</Detail>
+ <MediaObject ref="m38"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c2">
+ <Representation>
+ <Label>Aiguillon venimeux</Label>
+ <Detail>Quand il est vestigial et non fonctionnel, on le considère comme absent.</Detail>
+ <MediaObject ref="m39"/>
+ <MediaObject ref="m40"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s3">
+ <Representation>
+ <Label>absent</Label>
+ <Detail>Apex du gastre <b>sans aiguillon</b>.</Detail>
+ <MediaObject ref="m41"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s4">
+ <Representation>
+ <Label>présent</Label>
+ <Detail>C'est l'<b>apex du gastre</b> qui porte l'aiguillon.<br>Il est considéré comme présent uniquement s'il <b>est fonctionnel</b>. Certains aiguillons sont dévaginables, d'autres sont visibles de façon permanente.</Detail>
+ <MediaObject ref="m42"/>
+ <MediaObject ref="m43"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c3">
+ <Representation>
+ <Label>Acidopore</Label>
+ <Detail>L'<b>acidopore</b> est l'ouverture à la base du gastre par laquelle le venin est éjecté ou vaporisé</Detail>
+ <MediaObject ref="m44"/>
+ <MediaObject ref="m45"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s5">
+ <Representation>
+ <Label>circulaire et entouré de soies</Label>
+ <Detail>Quand cette structure est présente, le venin est projeté sous forme de spray. L'<b>acidopore circulaire</b> est parfois visible à l'oeil nu chez les fourmis de grande taille.</Detail>
+ <MediaObject ref="m46"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s6">
+ <Representation>
+ <Label>sous forme de fente</Label>
+ <Detail>Contrairement à l'acidopore circulaire, la <b>fente</b> est rarement visible à l'oeil nu.</Detail>
+ <MediaObject ref="m47"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s7">
+ <Representation>
+ <Label>absent ou quasi invisible</Label>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c4">
+ <Representation>
+ <Label>Pygidium</Label>
+ <Detail>Le <b>pygidium</b> correspond au tergite à l'apex du gastre.</Detail>
+ <MediaObject ref="m48"/>
+ <MediaObject ref="m49"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s8">
+ <Representation>
+ <Label>non armé</Label>
+ <Detail><b>Pygidium lisse non armé</b> latéralement ou postérieurement.</Detail>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s9">
+ <Representation>
+ <Label>armé</Label>
+ <Detail><b>Pygidium armé </b> latéralement, postérieurement ou les deux par une rangée de courtes épines ou dents.</Detail>
+ <MediaObject ref="m50"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c5">
+ <Representation>
+ <Label>Marge clypéale</Label>
+ <MediaObject ref="m51"/>
+ <MediaObject ref="m52"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s10">
+ <Representation>
+ <Label>sans projection</Label>
+ <Detail>Il s'agit de la <b>marge clypéale antérolatérale</b>.</Detail>
+ <MediaObject ref="m53"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s11">
+ <Representation>
+ <Label>avec projection</Label>
+ <MediaObject ref="m54"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c6">
+ <Representation>
+ <Label>Yeux</Label>
+ <Detail>Les <b>yeux</b> des insectes sont des yeux composés d'<b>ommatidies</b>. Attention à ne pas les confondre avec les <b>ocelles</b>, yeux simples souvent situés sur le dessu-de la tête, servant à détecter les variations de luminosité.</Detail>
+ <MediaObject ref="m55"/>
+ <MediaObject ref="m56"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s12">
+ <Representation>
+ <Label>absents ou très réduits</Label>
+ <Detail>Yeux absents ou très réduits c'est à dire représentés seulement par une seule ou un petit nombre d'ommatidies.</Detail>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s13">
+ <Representation>
+ <Label>présents et bien visibles</Label>
+ <Detail>Yeux présent et bien visibles composés d'un grand nombre d'ommatidies.</Detail>
+ <MediaObject ref="m57"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c7">
+ <Representation>
+ <Label>Antennes</Label>
+ <MediaObject ref="m58"/>
+ <MediaObject ref="m59"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s14">
+ <Representation>
+ <Label>de 8 Ã 10 segments</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s15">
+ <Representation>
+ <Label>de 12 segments</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s16">
+ <Representation>
+ <Label>moins de 8 segments</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s17">
+ <Representation>
+ <Label>10 ou 11 segments</Label>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c8">
+ <Representation>
+ <Label>Répartition mondiale</Label>
+ </Representation>
+ <States>
+ <StateDefinition id="s18">
+ <Representation>
+ <Label>monde entier</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s19">
+ <Representation>
+ <Label>régions tempérées</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s20">
+ <Representation>
+ <Label>tropiques</Label>
+ <Detail>Il s'agit des tropiques (voire subtropiques) du monden entier.</Detail>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s21">
+ <Representation>
+ <Label>néotropiques</Label>
+ <Detail>Il s'agit des zones tropicales américaines.</Detail>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c9">
+ <Representation>
+ <Label>Lobes frontaux</Label>
+ <MediaObject ref="m60"/>
+ <MediaObject ref="m61"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s22">
+ <Representation>
+ <Label>absents ou très réduits et verticaux</Label>
+ <MediaObject ref="m62"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s23">
+ <Representation>
+ <Label>présents et horizontaux</Label>
+ <MediaObject ref="m63"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c10">
+ <Representation>
+ <Label>Bases antennaires</Label>
+ <MediaObject ref="m64"/>
+ <MediaObject ref="m65"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s24">
+ <Representation>
+ <Label>partiellement ou complètement camouflées</Label>
+ <Detail>En vue de face, les <b>bases antennaires</b> sont partiellement ou complètement recouvertes par les <b> lobes frontaux</b> (jamais complètement exposées).</Detail>
+ <MediaObject ref="m66"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s25">
+ <Representation>
+ <Label>totalement exposées</Label>
+ <Detail>En vue de face, les <b>bases antennaires</b> sont complètement exposées et non recouvertes par les lobes frontaux.</Detail>
+ <MediaObject ref="m67"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c11">
+ <Representation>
+ <Label>Suture promésonotale</Label>
+ <Detail>La <b>suture promésonotale</b> est la suture (ligne de ligne de fusion) entre le pronotum et le mesonotum, les deux premiers articles du thorax.</Detail>
+ <MediaObject ref="m68"/>
+ <MediaObject ref="m69"/>
+ <MediaObject ref="m70"/>
+ <MediaObject ref="m71"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s26">
+ <Representation>
+ <Label>absente</Label>
+ <MediaObject ref="m72"/>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s27">
+ <Representation>
+ <Label>vestigiale</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s28">
+ <Representation>
+ <Label>présente</Label>
+ <MediaObject ref="m73"/>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c12">
+ <Representation>
+ <Label>Ocelle(s)</Label>
+ <Detail>Les <b>ocelles</b> sont des yeux simples servant à détecter les variations de luminosité. Les ouvrières peuvent avoir un ou plusieurs ocelles.</Detail>
+ <MediaObject ref="m74"/>
+ <MediaObject ref="m75"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s29">
+ <Representation>
+ <Label>absent(s)</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s30">
+ <Representation>
+ <Label>présent(s)</Label>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ <CategoricalCharacter id="c13">
+ <Representation>
+ <Label>Palpes maxillaires</Label>
+ <MediaObject ref="m76"/>
+ </Representation>
+ <States>
+ <StateDefinition id="s31">
+ <Representation>
+ <Label>présents et bien visibles</Label>
+ </Representation>
+ </StateDefinition>
+ <StateDefinition id="s32">
+ <Representation>
+ <Label>absents ou très difficilement visibles</Label>
+ </Representation>
+ </StateDefinition>
+ </States>
+ </CategoricalCharacter>
+ </Characters>
+ <CharacterTrees>
+ <CharacterTree id="ct1">
+ <Representation>
+ <Label>Ordre et dÈpendance entre caractËres</Label>
+ </Representation>
+ <ShouldContainAllCharacters>true</ShouldContainAllCharacters>
+ <Nodes>
+ <CharNode>
+ <Character ref="c1"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c2"/>
+ </CharNode>
+ <CharNode>
+ <DependencyRules>
+ <InapplicableIf>
+ <State ref="s2"/>
+ </InapplicableIf>
+ </DependencyRules>
+ <Character ref="c3"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c4"/>
+ </CharNode>
+ <CharNode>
+ <DependencyRules>
+ <InapplicableIf>
+ <State ref="s3"/>
+ </InapplicableIf>
+ </DependencyRules>
+ <Character ref="c5"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c6"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c7"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c8"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c9"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c10"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c11"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c12"/>
+ </CharNode>
+ <CharNode>
+ <Character ref="c13"/>
+ </CharNode>
+ </Nodes>
+ </CharacterTree>
+ </CharacterTrees>
+ <CodedDescriptions>
+ <CodedDescription id="D1">
+ <Representation>
+ <Label>Dolichoderinae</Label>
+ <MediaObject ref="m1"/>
+ <MediaObject ref="m2"/>
+ <MediaObject ref="m3"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t1"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s1"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <Note>Leur aiguillon venimeux est vestigial et non fonctionnel.</Note>
+ <State ref="s3"/>
+ </Categorical>
+ <Categorical ref="c3">
+ <State ref="s6"/>
+ </Categorical>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5"/>
+ <Categorical ref="c6">
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <Note>Les ouvrières possèdent généralement 11 articles antennaires, rarement 10 ou 11.</Note>
+ <State ref="s14"/>
+ <State ref="s15"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s18"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <Note>Elles sont partiellement ou totalement cachées par la carèbe frontale, marge du lbe frontal.</Note>
+ <State ref="s24"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>Elle est présente et flexible.</Note>
+ <State ref="s28"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <Note>Les ocelles sont pratiquement tout le temps absents.</Note>
+ <State ref="s29"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s31"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D2">
+ <Representation>
+ <Label>Formicinae</Label>
+ <MediaObject ref="m4"/>
+ <MediaObject ref="m5"/>
+ <MediaObject ref="m6"/>
+ <MediaObject ref="m7"/>
+ <MediaObject ref="m8"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t2"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s1"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <Note>Leur aiguillon est non fonctionnel.</Note>
+ <State ref="s3"/>
+ </Categorical>
+ <Categorical ref="c3">
+ <State ref="s5"/>
+ </Categorical>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5"/>
+ <Categorical ref="c6">
+ <Note>Leurs yeux sont généralement bien développés, rarement réduits ou absents.</Note>
+ <State ref="s12"/>
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <State ref="s14"/>
+ <State ref="s15"/>
+ <State ref="s17"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s18"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s25"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <State ref="s28"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <Note>Les ocelles sont présents dans la grande majorité des genres.</Note>
+ <State ref="s30"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s31"/>
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D3">
+ <Representation>
+ <Label>Ponerinae</Label>
+ <MediaObject ref="m9"/>
+ <MediaObject ref="m10"/>
+ <MediaObject ref="m11"/>
+ <MediaObject ref="m12"/>
+ <MediaObject ref="m13"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t3"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s1"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <State ref="s4"/>
+ </Categorical>
+ <Categorical ref="c3">
+ <State ref="s7"/>
+ </Categorical>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5">
+ <State ref="s10"/>
+ </Categorical>
+ <Categorical ref="c6">
+ <Note>Les Ponerinae possèdent des yeux bien développés dans la grande majorité des cas.</Note>
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s19"/>
+ <State ref="s20"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <State ref="s23"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s24"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>Si les yeux et les lobes frontaux sont absents, la suture promésonotale est toujours absente.</Note>
+ <State ref="s26"/>
+ <State ref="s28"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <Note>En général les ouvrières de poneriane ne portent pas d'ocelles.</Note>
+ <State ref="s29"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s31"/>
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D4">
+ <Representation>
+ <Label>Myrmicinae</Label>
+ <MediaObject ref="m14"/>
+ <MediaObject ref="m15"/>
+ <MediaObject ref="m16"/>
+ <MediaObject ref="m17"/>
+ <MediaObject ref="m18"/>
+ <MediaObject ref="m19"/>
+ <MediaObject ref="m20"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t4"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s2"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <State ref="s4"/>
+ </Categorical>
+ <Categorical ref="c3"/>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5">
+ <State ref="s10"/>
+ </Categorical>
+ <Categorical ref="c6">
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <Note>Le nombre d'articles antennaires peut varier de 4 Ã 12 chez les Myrmicinae.</Note>
+ <State ref="s14"/>
+ <State ref="s15"/>
+ <State ref="s16"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s18"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <State ref="s22"/>
+ <State ref="s23"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s24"/>
+ <State ref="s25"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>Elle est souvent complètement absente et rarement vestigiale. Quand c'est le cas, elle donne l'impression transversalement s'un arche en vue dorsale.</Note>
+ <State ref="s26"/>
+ <State ref="s27"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <Note>Les ocelles sont la plupart du temps absents, très rarement présents.</Note>
+ <State ref="s29"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s31"/>
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D5">
+ <Representation>
+ <Label>Pseudomyrmecinae</Label>
+ <MediaObject ref="m21"/>
+ <MediaObject ref="m22"/>
+ <MediaObject ref="m23"/>
+ <MediaObject ref="m24"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t5"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s2"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <State ref="s4"/>
+ </Categorical>
+ <Categorical ref="c3"/>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5">
+ <Note>La projestion clypéale concernée est postérieure c'est à dir vers les mandibules, et non vers le haut de la tête.</Note>
+ <State ref="s10"/>
+ </Categorical>
+ <Categorical ref="c6">
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <State ref="s15"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s20"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <State ref="s22"/>
+ <State ref="s23"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s24"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>Elle est très visible en vue dorsale.</Note>
+ <State ref="s28"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <State ref="s30"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D6">
+ <Representation>
+ <Label>Ecitoninae</Label>
+ <MediaObject ref="m25"/>
+ <MediaObject ref="m26"/>
+ <MediaObject ref="m27"/>
+ <MediaObject ref="m28"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t6"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s2"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <State ref="s4"/>
+ </Categorical>
+ <Categorical ref="c3"/>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5">
+ <State ref="s10"/>
+ </Categorical>
+ <Categorical ref="c6">
+ <Note>Leurs yeux sont réduits à une seule ommatidies ou absents.</Note>
+ <State ref="s12"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <State ref="s15"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s19"/>
+ <State ref="s21"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <State ref="s22"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s25"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>Cette suture n'est jamais marqué et elle est flexible.</Note>
+ <State ref="s26"/>
+ <State ref="s27"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <State ref="s30"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D7">
+ <Representation>
+ <Label>Ectatomminae</Label>
+ <MediaObject ref="m29"/>
+ <MediaObject ref="m30"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t7"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s1"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <State ref="s3"/>
+ </Categorical>
+ <Categorical ref="c3">
+ <State ref="s7"/>
+ </Categorical>
+ <Categorical ref="c4">
+ <State ref="s8"/>
+ </Categorical>
+ <Categorical ref="c5"/>
+ <Categorical ref="c6">
+ <State ref="s13"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s18"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <State ref="s22"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s24"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <State ref="s29"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <State ref="s32"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D8">
+ <Representation>
+ <Label>Cerapachyinae</Label>
+ <MediaObject ref="m31"/>
+ <MediaObject ref="m32"/>
+ <MediaObject ref="m33"/>
+ <MediaObject ref="m34"/>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t8"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1">
+ <State ref="s1"/>
+ </Categorical>
+ <Categorical ref="c2">
+ <Note>Aiguillon bien dévellopé et fonctionnel.</Note>
+ <State ref="s4"/>
+ </Categorical>
+ <Categorical ref="c3">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c4">
+ <Note>Il existe un rangée apicale ou marginale de courtes dents ou épines.</Note>
+ <State ref="s9"/>
+ </Categorical>
+ <Categorical ref="c5">
+ <State ref="s11"/>
+ </Categorical>
+ <Categorical ref="c6">
+ <Note>Les yeux sont généralement présents, très rarement réduits ou absents.</Note>
+ <State ref="s12"/>
+ </Categorical>
+ <Categorical ref="c7">
+ <State ref="s15"/>
+ <State ref="s17"/>
+ </Categorical>
+ <Categorical ref="c8">
+ <State ref="s20"/>
+ </Categorical>
+ <Categorical ref="c9">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ <Categorical ref="c10">
+ <State ref="s25"/>
+ </Categorical>
+ <Categorical ref="c11">
+ <Note>La plupart du temps, elle est complètement absente. Elle n'est que très rarement visible.</Note>
+ <State ref="s26"/>
+ <State ref="s28"/>
+ </Categorical>
+ <Categorical ref="c12">
+ <State ref="s30"/>
+ </Categorical>
+ <Categorical ref="c13">
+ <Status code="DataUnavailable"/>
+ </Categorical>
+ </SummaryData>
+ </CodedDescription>
+ <CodedDescription id="D9">
+ <Representation>
+ <Label>Genus Ectatom</Label>
+ </Representation>
+ <Scope>
+ <TaxonName ref="t9"/>
+ </Scope>
+ <SummaryData>
+ <Categorical ref="c1"/>
+ <Categorical ref="c2"/>
+ <Categorical ref="c3"/>
+ <Categorical ref="c4"/>
+ <Categorical ref="c5"/>
+ <Categorical ref="c6"/>
+ <Categorical ref="c7"/>
+ <Categorical ref="c8"/>
+ <Categorical ref="c9"/>
+ <Categorical ref="c10"/>
+ <Categorical ref="c11"/>
+ <Categorical ref="c12"/>
+ <Categorical ref="c13"/>
+ </SummaryData>
+ </CodedDescription>
+ </CodedDescriptions>
+ <Agents>
+ <Agent id="a0">
+ <Representation>
+ <Label>Unknown</Label>
+ </Representation>
+ </Agent>
+ </Agents>
+ <MediaObjects>
+ <MediaObject id="m1">
+ <Representation>
+ <Label>Dolichoderinae - m1</Label>
+ <Detail role="Caption">Dolichoderinae</Detail>
+ </Representation>
+ <Type>Image</Type>
+ <Source href="http://cybertaxonomy.eu/sites/wp5.e-taxonomy.eu/files/cybergate.PNG"/>
+ </MediaObject>
+ <MediaObject id="m2">
+ <Representation>
+ <Label>Dolichoderinae - m2</Label>
+ <Detail role="Caption">Dolichoderinae</Detail>
+ </Representation>
+ <Type>Image</Type>
+ <Source href="http://cybertaxonomy.eu/sites/wp5.e-taxonomy.eu/files/cybergate.PNG"/>
+ </MediaObject>
+ </MediaObjects>
+ </Dataset>
+</Datasets>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<DataSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tdwg.org/schemas/tcs/1.01 http://tdwg.napier.ac.uk/TCS_1.01/v101.xsd" xmlns="http://www.tdwg.org/schemas/tcs/1.01">
+ <!-- This is an instance document that tests as many different
+ applications of the schema as possible within a single document.
+ It is not meant to a 'realistic' example of a real data set
+ but a illustration of all the different types of data that can
+ be passed. -->
+ <MetaData>
+ <!-- to be completed -->
+ <Simple/>
+ </MetaData>
+ <Specimens>
+ <Specimen id="2">
+ <Simple/>
+ <Institution identifier=""/>
+ <Collection identifier="LE"/>
+ <SpecimenItem identifier=""/>
+ </Specimen>
+ </Specimens>
+ <Publications>
+ <Publication id="1">
+ <Simple>Fl. SSR</Simple>
+ </Publication>
+ <Publication id="2">
+ <Simple>Copeland, H.F. (1943). A study, anatomical and taxonomic, of the
+ genera of Rhododendroideae. Am. Midl.Nat. 30:533-625</Simple>
+ </Publication>
+ <Publication id="3">
+ <Simple>Wilson, E.H. & Rehder, A. (1921). A monograph of the azaleas.
+ Publication of the Arnold Arboretum No. 9 Harvard University, Cambridge
+ MA.</Simple>
+ </Publication>
+ <Publication id="4">
+ <Simple>Judd, W.S. & Kron, K.A. (1995) A Revision of Rhododendron VI
+ Edinb. J. Bot. 52(1): 1-54</Simple>
+ </Publication>
+ <Publication id="5">
+ <Simple>Maximoxicz, C.J. (1870) Rhododendron schlippenbachii. Mem. Acad. Sci.
+ St Petersbourg. ser.3 15.</Simple>
+ </Publication>
+ </Publications>
+ <TaxonNames>
+ <TaxonName id="0" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron</Simple>
+ </TaxonName>
+ <TaxonName nomenclaturalCode="Botanical" id="1">
+ <Simple>Rhododendron subgenus Pentanthera (G. Don) Poyarkova</Simple>
+ <CanonicalName>
+ <Simple>Rhododedron subgenus Pentanthera</Simple>
+ <Genus>Rhododendron</Genus>
+ <InfragenericEpithet>Pentanthera</InfragenericEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>(G.Don) Poyarkova</Simple>
+ <BasionymAuthorship>
+ <Simple>G. Don</Simple>
+ <Authors>
+ <AgentName>G. Don</AgentName>
+ </Authors>
+ </BasionymAuthorship>
+ <CombinationAuthorship>
+ <Simple>Poyarkova</Simple>
+ <Authors>
+ <AgentName>Poyarkova</AgentName>
+ </Authors>
+ </CombinationAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn ref="1">Fl. SSR Vol 18 (1952)</PublishedIn>
+ <MicroReference>Page 57</MicroReference>
+ <Typification>
+ <Simple>Rhododendron flavum G.Don</Simple>
+ <!--
+ N.B. This could be linked to a full name entry if
+ required but no details are in the current monograph so
+ it isn't
+ -->
+ <TypeName/>
+ </Typification>
+ </TaxonName>
+ <TaxonName id="2" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron sect. Sciadorhodion Rehder & Wilson</Simple>
+ <CanonicalName>
+ <Simple>Rhododendron sect. Sciadorhodion</Simple>
+ <Genus>Rhododendron</Genus>
+ <InfragenericEpithet>Sciadorhodion</InfragenericEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>Rehder & Wilson</Simple>
+ <BasionymAuthorship>
+ <Simple>Rehder & Wilson</Simple>
+ </BasionymAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn linkType="local" ref="3">Wislon & Rehder Monogr. Azaleas 79 (1921)</PublishedIn>
+ <MicroReference>Page 79</MicroReference>
+ <Typification>
+ <Simple/>
+ <TypeName>
+ <NameReference linkType="local" ref="3">Rhododendron quinquefolium Bisset
+ & Moore</NameReference>
+ <LectotypePublication ref="2">Copeland, H.F.(1943)</LectotypePublication>
+ </TypeName>
+ </Typification>
+ <Basionym>
+ <RelatedName ref="4">Azalea subgen. Sciadorhodion (Rhehder & Wilson)
+ Copeland</RelatedName>
+ </Basionym>
+ </TaxonName>
+ <TaxonName id="3" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron quinquefolium Bisset & Moore</Simple>
+ </TaxonName>
+ <TaxonName id="4" nomenclaturalCode="Botanical">
+ <!-- for brevity this NameObject isn't fully expanded -->
+ <Simple>Azalea subgen. Sciadorhodion (Rhehder & Wilson) Copeland </Simple>
+ <Basionym>
+ <RelatedName ref="2">Rhododendron sect. Sciadorhodion Rehder &
+ Wilson</RelatedName>
+ </Basionym>
+ </TaxonName>
+ <TaxonName id="5" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron schlippenbachii Maxim.</Simple>
+ <Rank code="sp">Species</Rank>
+ <CanonicalName>
+ <Simple>Rhododendron schlippenbachii</Simple>
+ <Genus>Rhododendron</Genus>
+ <SpecificEpithet>schlippenbachii</SpecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>Maxim.</Simple>
+ <BasionymAuthorship>
+ <Simple>Maxim.</Simple>
+ <Authors>
+ <AgentName>Maximoxicz, C.J.</AgentName>
+ </Authors>
+ </BasionymAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn ref="5">Bull. Acad. Sci. St Petersbourg, ser. 3 15 (1870)</PublishedIn>
+ <MicroReference>Page 226</MicroReference>
+ <Typification>
+ <Simple/>
+ <TypeVouchers>
+ <TypeVoucher typeOfType="lecto">
+ <VoucherReference linkType="local" ref="1"/>
+ <LectotypePublication ref="4"/>
+ <LectotypeMicroReference>Page 15</LectotypeMicroReference>
+ </TypeVoucher>
+ <TypeVoucher typeOfType="isolecto">
+ <VoucherReference linkType="local" ref="2"/>
+ <LectotypePublication ref="4"/>
+ <LectotypeMicroReference>Page 15</LectotypeMicroReference>
+ </TypeVoucher>
+ </TypeVouchers>
+ </Typification>
+ </TaxonName>
+ <TaxonName id="6" nomenclaturalCode="Botanical">
+ <Simple>Azalea schlippenbachii (Maxim.) Kuntze</Simple>
+ <CanonicalName>
+ <Simple>Azalea schlippenbachii</Simple>
+ <Genus>Azalea</Genus>
+ <SpecificEpithet>schlippenbachii</SpecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>(Maxim.) Kuntze</Simple>
+ <BasionymAuthorship>
+ <Simple>Maxim.</Simple>
+ </BasionymAuthorship>
+ <CombinationAuthorship>
+ <Simple>Kuntze</Simple>
+ </CombinationAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn>Revis. Gen.Pl. 2:387 (1891)</PublishedIn>
+ <Typification>
+ <Simple/>
+ <TypeVouchers>
+ <TypeVoucher typeOfType="lecto">
+ <VoucherReference ref="2">[Russia] Manchuria, shores of Possiet Bay, [SW of
+ Vladivostok], 1860, C. Maximowicz LE</VoucherReference>
+ <LectotypePublication ref="4"/>
+ <LectotypeMicroReference>Page 15</LectotypeMicroReference>
+ </TypeVoucher>
+ </TypeVouchers>
+ </Typification>
+ </TaxonName>
+ <TaxonName id="7" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron pentaphyllum Maxim.</Simple>
+ <CanonicalName>
+ <Simple>Rhododendron pentaphyllum</Simple>
+ <Genus>Rhododendron</Genus>
+ <SpecificEpithet>pentaphyllum</SpecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>Maxim.</Simple>
+ </CanonicalAuthorship>
+ <PublishedIn>Bull. Acad. Sci. St Petersbourg, ser. 3, 31:65 (1887)</PublishedIn>
+ <Typification>
+ <Simple/>
+ <TypeVouchers>
+ <TypeVoucher typeOfType="holo">
+ <VoucherReference>Japan, Kyushiu, prov. Osumi, summit, Mt Taka-kuma, Tashiro
+ (LE)</VoucherReference>
+ </TypeVoucher>
+ </TypeVouchers>
+
+ </Typification>
+ </TaxonName>
+ <TaxonName id="8" nomenclaturalCode="Botanical">
+ <Simple>Azalea pentaphylla (Maxim.) Copeland</Simple>
+ <CanonicalName>
+ <Simple>Azalea pentaphylla</Simple>
+ <Genus>Azalea</Genus>
+ <SpecificEpithet>pentaphylla</SpecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>(Maxim.) Copeland</Simple>
+ <BasionymAuthorship>
+ <Simple>Maxim.</Simple>
+ </BasionymAuthorship>
+ <CombinationAuthorship>
+ <Simple>Copeland</Simple>
+ </CombinationAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn>Am.Midl.Nat. 30:595 (1943)</PublishedIn>
+ <Typification>
+ <Simple/>
+ <TypeVouchers>
+ <TypeVoucher typeOfType="holo">
+ <VoucherReference>Japan, Kyushiu, prov. Osumi, summit, Mt Taka-kuma, Tashiro
+ (LE)</VoucherReference>
+ </TypeVoucher>
+ </TypeVouchers>
+ </Typification>
+ </TaxonName>
+ <TaxonName id="9" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron pentaphyllum var. nikoense Komatsu</Simple>
+ <Rank code="var">variety</Rank>
+ <CanonicalName>
+ <Simple>Rhododendron pentaphyllum var. nikoense</Simple>
+ <Genus ref="0">Rhododendron</Genus>
+ <SpecificEpithet>pentaphyllum</SpecificEpithet>
+ <InfraspecificEpithet>nikoense</InfraspecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>Konatsu</Simple>
+ </CanonicalAuthorship>
+ <PublishedIn>Icon. Pl. Koisikav. 3: 45, t 168 (1916)</PublishedIn>
+ </TaxonName>
+ <TaxonName id="10" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron nikoense (Komatsu) Nakai</Simple>
+ <Rank code="sp">Species</Rank>
+ <CanonicalName>
+ <Simple>Rhododendron nikoense</Simple>
+ <Genus ref="0">Rhododendron</Genus>
+ <SpecificEpithet>nikoense</SpecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>(Komatsu) Nakai</Simple>
+ <BasionymAuthorship>
+ <Simple>Komatsu</Simple>
+ </BasionymAuthorship>
+ <CombinationAuthorship>
+ <Simple>Nakai</Simple>
+ </CombinationAuthorship>
+ </CanonicalAuthorship>
+ <PublishedIn>Nakai & Koidz. Trees and Shrubs Japan 1: 68 (1922)</PublishedIn>
+ <Basionym>
+ <RelatedName ref="9">Rhododendron pentaphyllum var. nikoense</RelatedName>
+ </Basionym>
+ </TaxonName>
+ <TaxonName id="11" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron quinquefolium Bisset & S. Moore var. roseum Rehder</Simple>
+ <Rank code="var">variety</Rank>
+ <CanonicalName>
+ <Simple>Rhododendron quinquefolium</Simple>
+ <Genus ref="0">Rhododendron</Genus>
+ <SpecificEpithet>quinquefolium</SpecificEpithet>
+ <InfraspecificEpithet>roseum</InfraspecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>Rehder</Simple>
+ </CanonicalAuthorship>
+ <PublishedIn>Bailey, Stand. Cycl. Hort. 5: 2947 (1916)</PublishedIn>
+ </TaxonName>
+ <TaxonName id="12" nomenclaturalCode="Botanical">
+ <Simple>Rhododendron pentaphyllum Maxim. var. shikokianum T. Yamazaki</Simple>
+ <Rank code="sp">species</Rank>
+ <CanonicalName>
+ <Simple>Rhododendron pentaphyllum var. shikokianum</Simple>
+ <Genus ref="0">Rhododendron</Genus>
+ <SpecificEpithet>pentaphyllum</SpecificEpithet>
+ <InfraspecificEpithet>shikokianum</InfraspecificEpithet>
+ </CanonicalName>
+ <CanonicalAuthorship>
+ <Simple>T. Yamazaki</Simple>
+ </CanonicalAuthorship>
+ <PublishedIn>Jap. Bot. 63: 312 (1988)</PublishedIn>
+ </TaxonName>
+ </TaxonNames>
+ <TaxonConcepts>
+ <TaxonConcept id="1">
+ <Name scientific="true" linkType="local" ref="2">Rhododendron sect. Sciadorhodion Rehder
+ & Wilson</Name>
+ <Rank code="sect">Section</Rank>
+ <AccordingTo>
+ <Simple>Judd & Kron (1995)</Simple>
+ <AccordingToDetailed>
+ <PublishedIn linkType="local" ref="4">Judd & Kron (1995) A Revision of
+ Rhododendron VI </PublishedIn>
+ <MicroReference>Page 13-14</MicroReference>
+ </AccordingToDetailed>
+ </AccordingTo>
+ <TaxonRelationships>
+ <TaxonRelationship type="is parent taxon of">
+ <ToTaxonConcept linkType="local" ref="2"/>
+ </TaxonRelationship>
+ </TaxonRelationships>
+ </TaxonConcept>
+ <TaxonConcept id="2">
+ <Name scientific="true" linkType="local" ref="5">Rhododendron schlippenbachii Maxim.</Name>
+ <AccordingTo>
+ <Simple>Judd & Kron (1995)</Simple>
+ <AccordingToDetailed>
+ <PublishedIn linkType="local" ref="4"/>
+ <MicroReference>Page 15</MicroReference>
+ </AccordingToDetailed>
+ </AccordingTo>
+ <TaxonRelationships>
+ <TaxonRelationship type="is child taxon of">
+ <ToTaxonConcept ref="1">Rhododendron sect. Sciadorhodion Rehder &
+ Wilson</ToTaxonConcept>
+ </TaxonRelationship>
+ </TaxonRelationships>
+ </TaxonConcept>
+ <TaxonConcept id="3">
+ <Name scientific="true" ref="6">Azalea schlippenbachii (Maxim.) Kuntze</Name>
+ <AccordingTo>
+ <Simple>Kuntze (1891)</Simple>
+ </AccordingTo>
+ <TaxonRelationships>
+ <TaxonRelationship type="is congruent to">
+ <ToTaxonConcept ref="2"/>
+ </TaxonRelationship>
+ </TaxonRelationships>
+ </TaxonConcept>
+ <TaxonConcept id="4">
+ <Name scientific="true" ref="7">Rhododendron pentaphyllum Maxim.</Name>
+ <AccordingTo>
+ <Simple>Judd & Kron (1995)</Simple>
+ </AccordingTo>
+ <TaxonRelationships>
+ <!-- relationships linking to taxonconcept without any descriptive string -->
+ <TaxonRelationship type="has synonym">
+ <ToTaxonConcept ref="6"/>
+ </TaxonRelationship>
+ <TaxonRelationship type="has synonym">
+ <ToTaxonConcept ref="7"/>
+ </TaxonRelationship>
+ <!-- relationship with linking reference to another taxon concept and string description of concept -->
+ <TaxonRelationship type="has synonym">
+ <ToTaxonConcept ref="8">Rhododendron pentaphyllum var. nikoense
+ Komatsu</ToTaxonConcept>
+ </TaxonRelationship>
+ <!-- relationships without linking -->
+ <TaxonRelationship type="has synonym">
+ <ToTaxonConcept>Rhododendron pentaphyllum Maxim. var. shikokianum T.
+ Yamazaki</ToTaxonConcept>
+ </TaxonRelationship>
+ <TaxonRelationship type="has synonym">
+ <ToTaxonConcept>Rhododendron quinquefolium Bisset & S. Moore var. roseum
+ Rehder</ToTaxonConcept>
+ </TaxonRelationship>
+ </TaxonRelationships>
+ </TaxonConcept>
+ <TaxonConcept id="6">
+ <Name scientific="true">Rhododendron nikoense (Komatsu) Nakai</Name>
+ </TaxonConcept>
+ <TaxonConcept id="7">
+ <Name scientific="true" ref="10">Rhododendron nikoense (Komatsu) Nakai</Name>
+ </TaxonConcept>
+ <TaxonConcept id="8">
+ <Name scientific="true" ref="9">Rhododendron pentaphyllum var. nikoense Komatsu</Name>
+ </TaxonConcept>
+ </TaxonConcepts>
+</DataSet>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %p [%c] - %m%n" />
+ </layout>
+ </appender>
+ <root>
+ <priority value="WARN" />
+ <appender-ref ref="CONSOLE" />
+ </root>
+</log4j:configuration>
\ No newline at end of file
--- /dev/null
+httpPort=9090
+stopPort=9191
+stopKey=jetty-cdm-server
+user=admin
+password=00000
+contextPath=
--- /dev/null
+#
+# NOTE: this is the unitils.properties file for the cdmlib-persistence module
+# a separate unitils.properties exists for cdmlib-io and for cdmlib-services
+#
+#
+# the list of all properties is found in
+# http://unitils.org/unitils-default.properties
+#
+
+### Unitils Modules ###
+# List of modules that is loaded. Overloading this list is normally not useful, unless you want to add a custom
+# module. Disabling a module can be performed by setting unitils.module.<modulename>.enabled to false.
+# If a module's specific dependencies are not found (e.g. hibernate is not in you classpath), this module is not loaded,
+# even if it is in this list and the enabled property is set to true. It's therefore not strictly necessary to disable
+# any of these modules.
+#DEFAULT: unitils.modules=database,dbunit,hibernate,mock,easymock,inject,spring,jpa
+unitils.module.easymock.enabled=false
+unitils.module.mock.enabled=false
+
+
+### Database ###
+#
+# Name or path of the user specific properties file. This file should contain the necessary parameters to connect to the
+# developer's own unit test schema. It is recommended to override the name of this file in the project specific properties
+# file, to include the name of the project. The system will try to find this file in the classpath, the user home folder
+# (recommended) or the local filesystem.
+#
+unitils.configuration.localFileName=unitils-cdmlib-local.properties
+
+# H2 #
+#
+database.driverClassName=org.h2.Driver
+#database.url=jdbc:h2:file:./src/main/resources/h2/cdmTest;AUTO_SERVER=TRUE
+database.url=jdbc:h2:file:./target/classes/h2/cdmTest;AUTO_SERVER=TRUE
+database.dialect=h2
+database.userName=sa
+database.password=
+database.schemaNames=PUBLIC
+org.dbunit.dataset.datatype.IDataTypeFactory.implClassName.h2=org.dbunit.ext.h2.H2DataTypeFactory
+org.unitils.core.dbsupport.DbSupport.implClassName.h2=eu.etaxonomy.taxeditor.util.H2DbSupport
+database.storedIndentifierCase.h2=auto
+database.identifierQuoteString.h2=auto
+
+
+#### Transaction mode ###
+#
+# If set to commit or rollback, each test is run in a transaction,
+# which is committed or rolled back after the test is finished.
+# Since we have many tests with incomplete data these tests would be
+# failing during commit so it is better use rollback as default
+# and set commit for individual test where necessary
+DatabaseModule.Transactional.value.default=rollback
+
+# org.unitils.database.transaction.impl.DefaultUnitilsTransactionManager is used by default:
+#
+# Implements transactions for unit tests, by delegating to a spring PlatformTransactionManager.
+# The concrete implementation of PlatformTransactionManager that is used depends on the test class.
+# If a custom PlatformTransactionManager was configured in a spring ApplicationContext, this one is used.
+# If not, a suitable subclass of PlatformTransactionManager is created, depending on the configuration
+# of a test. E.g. if some ORM persistence unit was configured on the test, a PlatformTransactionManager
+# that can offer transactional behavior for such a persistence unit is used.
+# If no such configuration is found, a DataSourceTransactionManager is used.
+#
+# org.unitils.database.transaction.UnitilsTransactionManager.implClassName=org.unitils.database.transaction.impl.SpringTransactionManager
+
+### Hibernate ###
+#
+HibernateModule.configuration.implClassName=org.hibernate.cfg.Configuration
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.5.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.1.24.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jetty-all-9.2.9.v20150224.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.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 kind="src" path="src/main/resources"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
--- /dev/null
+/bin/
+/target/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>eu.etaxonomy.taxeditor.webapp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Webapp
+Bundle-SymbolicName: eu.etaxonomy.taxeditor.webapp;singleton:=true
+Bundle-Version: 4.0.0.qualifier
+Require-Bundle: org.eclipse.core.runtime
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Export-Package: eu.etaxonomy.taxeditor.webapp
+Bundle-ClassPath: .,
+ lib/log4j-1.2.17.jar,
+ lib/jetty-all-9.2.9.v20150224.jar,
+ lib/javax.servlet-api-3.1.0.jar,
+ lib/mysql-connector-java-5.1.24.jar,
+ lib/c3p0-0.9.5.2.jar
+Bundle-Vendor: EDIT
+Import-Package: org.eclipse.jface.resource,
+ org.eclipse.ui.plugin
+Bundle-Activator: eu.etaxonomy.taxeditor.webapp.TaxeditorWebappPlugin
--- /dev/null
+source.. = src/main/java/,\
+ src/main/resources/
+bin.includes = META-INF/,\
+ .,\
+ lib/log4j-1.2.17.jar,\
+ lib/jetty-all-9.2.9.v20150224.jar,\
+ lib/javax.servlet-api-3.1.0.jar,\
+ lib/mysql-connector-java-5.1.24.jar,\
+ lib/cdmlib-remote-webapp.war,\
+ lib/c3p0-0.9.5.2.jar
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>taxeditor-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>eu.etaxonomy.taxeditor.webapp</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>CDM Library Webapp Plugin</name>
+ <description>CDM Library webapp as a plugin</description>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <id>copy-dependency-war</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>
+ cdmlib-remote-webapp
+ </includeArtifactIds>
+ <outputDirectory>
+ ${basedir}/lib
+ </outputDirectory>
+ <overWriteReleases>true</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <excludeTransitive>true</excludeTransitive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>update-snapshot-jar-names</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <echo>Anonymizing war</echo>
+ <move todir="./lib">
+ <fileset dir="./lib" />
+ <mapper type="regexp"
+ from="(^cdmlib\-remote\-webapp).*(\.war)" to="\1\2" />
+ </move>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>SpringSource Enterprise Bundle Repository - External Bundle
+ Milestones
+ </id>
+ <url>http://repository.springsource.com/maven/bundles/milestone
+ </url>
+ </repository>
+ <repository>
+ <id>SpringSource Enterprise Bundle Repository - SpringSource
+ Bundle
+ Releases
+ </id>
+ <url>http://repository.springsource.com/maven/bundles/release
+ </url>
+ </repository>
+ <repository>
+ <id>SpringSource Enterprise Bundle Repository - External Bundle
+ Releases
+ </id>
+ <url>http://repository.springsource.com/maven/bundles/external
+ </url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>eu.etaxonomy</groupId>
+ <artifactId>cdmlib-remote-webapp</artifactId>
+ <version>${cdmlib.version}</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+</project>
+
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.webapp;
+
+/**
+ * @author cmathew
+ * @date 23 Sep 2014
+ *
+ */
+public class CDMEmbeddedServerException extends Exception {
+
+ public CDMEmbeddedServerException(String message) {
+ super(message);
+ }
+
+ public CDMEmbeddedServerException(Exception e) {
+ super(e);
+ }
+
+ public CDMEmbeddedServerException(String message,Exception e) {
+ super(message,e);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * 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.webapp;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.StringUtil;
+import org.eclipse.jetty.util.preventers.AppContextLeakPreventer;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * (Singleton) Server instance which manages a compatible cdmlib-webapp-war.
+ * This is done by launching a jetty instance (using jetty-runner) as an
+ * executed process. The choice of the external process over a more
+ * preferable 'embedded jetty' instance is due to problems arising from the
+ * class loading of classes (e.g. from hibernate core) which are needed
+ * for both the webapp as well as the remoting client.
+ *
+ * @author cmathew
+ * @date 23 Sep 2014
+ *
+ */
+
+public class CDMServer {
+
+ public static final Logger logger = Logger.getLogger(CDMServer.class);
+
+
+ private final String dataSourceName;
+ private final String host = "127.0.0.1";
+ private int httpPort = 9090;
+ private final String contextPath = "/";
+
+ private File warFile;
+ private Server server;
+
+
+ public CDMServer(String dataSourceName, File dataSourcesFile) throws CDMEmbeddedServerException {
+ if(StringUtil.isBlank(dataSourceName)) {
+ throw new CDMEmbeddedServerException("DataSource name is not valid");
+ }
+
+ if(dataSourcesFile == null || !dataSourcesFile.exists()) {
+ throw new CDMEmbeddedServerException("DataSource config file does not exist");
+ }
+ this.dataSourceName = dataSourceName;
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.webapp");
+ URL warURL = bundle.getEntry("lib/cdmlib-remote-webapp.war");
+
+ try {
+ URL resolvedWarURL = FileLocator.toFileURL(warURL);
+ // We need to use the 3-arg constructor of URI in order to properly escape file system chars
+ URI resolvedURI = new URI(resolvedWarURL.getProtocol(), resolvedWarURL.getPath(), null);
+ warFile = new File(resolvedURI);
+ System.out.println("war url : " + warFile.getAbsolutePath());
+
+ if(warFile == null || !warFile.exists()) {
+ throw new CDMEmbeddedServerException("Cdmlib War file does not exist");
+ }
+ } catch (URISyntaxException use) {
+ throw new CDMEmbeddedServerException(use);
+ } catch (IOException ioe) {
+ throw new CDMEmbeddedServerException(ioe);
+ }
+
+ System.setProperty("spring.profiles.active", "remoting");
+ System.setProperty("cdm.beanDefinitionFile", dataSourcesFile.getAbsolutePath());
+ System.setProperty("cdm.datasource", dataSourceName);
+
+ httpPort = findFreePort();
+
+ logger.warn("Starting server on port : " + httpPort);
+
+ server = new Server(httpPort);
+
+ server.addBean(new AppContextLeakPreventer());
+
+ WebAppContext webapp = new WebAppContext();
+ webapp.setContextPath(contextPath);
+ webapp.setWar(warFile.getAbsolutePath());
+
+ server.setHandler(webapp);
+ }
+
+ public String getDataSourceName() {
+ return dataSourceName;
+ }
+ public String getHost() {
+ return host;
+ }
+
+ public int getPort() {
+ return httpPort;
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ private static int findFreePort() throws CDMEmbeddedServerException {
+ ServerSocket socket = null;
+ try {
+ socket = new ServerSocket(0);
+ socket.setReuseAddress(true);
+ int port = socket.getLocalPort();
+ try {
+ socket.close();
+ } catch (IOException e) {
+
+ }
+ return port;
+ } catch (IOException e) {
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ throw new CDMEmbeddedServerException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
+ }
+
+ public void start(ICDMServerError cdmServerError) throws CDMEmbeddedServerException {
+ start(true, cdmServerError);
+ }
+
+ public void start(boolean wait, final ICDMServerError cdmServerError) throws CDMEmbeddedServerException {
+
+ if(server == null) {
+ throw new CDMEmbeddedServerException("Server is already disposed");
+ }
+
+ if(server.isStarting()) {
+ throw new CDMEmbeddedServerException("Server is starting");
+ }
+
+ if(server.isStarted()) {
+ throw new CDMEmbeddedServerException("Server has started");
+ }
+
+ if(server.isRunning()) {
+ throw new CDMEmbeddedServerException("Server is running");
+ }
+
+ if(server.isStopping()) {
+ throw new CDMEmbeddedServerException("Server is currently stopping. Please re-try in about 10 seconds");
+ }
+
+ Thread serverThread = new Thread() {
+
+ @Override
+ public void run() {
+ try {
+ server.start();
+ server.join();
+ } catch (Throwable t) {
+ cdmServerError.handleError(t);
+ }
+ }
+ };
+
+ serverThread.start();
+
+ if(wait) {
+ while(!server.isStarted()) {}
+
+ }
+ }
+
+ public boolean isAlive() {
+ return server.isRunning() || server.isStarting() || server.isStarted();
+ }
+
+ public boolean isStarted() {
+ return server.isStarted();
+ }
+
+ public void stop() throws Exception {
+ server.stop();
+ server.destroy();
+ server = null;
+ }
+
+
+
+
+ public static void stopServerViaJMX(int jmxPort) throws CDMEmbeddedServerException {
+ String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:" + jmxPort + "/jmxrmi";
+ logger.warn("Shutting down Jetty instance ... ");
+
+ try {
+ JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), null);
+ connector.connect(null);
+ MBeanServerConnection connection = connector.getMBeanServerConnection();
+ ObjectName objectName = new ObjectName("org.eclipse.jetty.server:type=server,id=0");
+ connection.invoke(objectName, "stop", null, null);
+ logger.warn("Shutdown command sent");
+ } catch (InstanceNotFoundException e) {
+ throw new CDMEmbeddedServerException(e);
+ } catch (MBeanException e) {
+ throw new CDMEmbeddedServerException(e);
+ } catch (ReflectionException e) {
+ throw new CDMEmbeddedServerException(e);
+ } catch (IOException e) {
+ throw new CDMEmbeddedServerException(e);
+ } catch (MalformedObjectNameException e) {
+ throw new CDMEmbeddedServerException(e);
+ }
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.webapp;
+
+/**
+ * @author cmathew
+ * @date 16 Nov 2015
+ *
+ */
+public interface ICDMServerError {
+
+ public void handleError(Throwable t);
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.webapp;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author n.hoffmann
+ * @version $Id: $
+ */
+public class TaxeditorWebappPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.editor"</code> */
+ public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor";
+
+ // The shared instance
+ private static TaxeditorWebappPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public TaxeditorWebappPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TaxeditorWebappPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+
+ /**
+ * Exposes this normally protected method.
+ *
+ * @return a {@link org.eclipse.jface.resource.ImageRegistry} object.
+ */
+ @Override
+ public ImageRegistry createImageRegistry(){
+ return super.createImageRegistry();
+ }
+}
--- /dev/null
+cdmlib-remote-webapp.war
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.application"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.bulkeditor"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.cdmlib"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.editor"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.navigation"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.printpublisher"/>\r
- <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.store"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.application"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.bulkeditor"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.cdmlib"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.editor"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.navigation"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.printpublisher"/>
+ <classpathentry kind="src" path="/eu.etaxonomy.taxeditor.store"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="3.8.0.qualifier">
+<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="4.0.0.qualifier">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<text>
</aboutInfo>
<configIni use="default"></configIni>
<launcherArgs>
- <programArgs>-data @user.home/.cdmLibrary -Dserver_port=58080</programArgs>
- <vmArgs>-Xmx512M -XX:MaxPermSize=256M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow</vmArgs>
- <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>
+ <programArgs>-data @user.home/.cdmLibrary -Dserver_port=58080
+ </programArgs>
+ <vmArgs>-Xmx512M -XX:MaxPermSize=256M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow
+ </vmArgs>
+ <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
+ </vmArgsMac>
</launcherArgs>
<windowImages i16="/eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif" i32="/eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif" i48="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<splash location="eu.etaxonomy.taxeditor.application" startupForegroundColor="000000" startupMessageRect="7,432,360,20" startupProgressRect="5,447,366,15"/>
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="3.8.0.qualifier" useFeatures="true" includeLaunchers="true">
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="4.0.0.qualifier" useFeatures="true" includeLaunchers="true">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>EDIT Taxonomic Editor Product</name>
<description>The EDIT Taxonomic Desktop Editor</description>
<url>http://wp5.e-taxonomy.eu/taxeditor</url>
- <properties>
+ <properties>
<product.id>eu.etaxonomy.taxeditor.product</product.id>
</properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-p2-director-plugin</artifactId>
- <version>${tycho.version}</version>
- <executions>
- <execution>
- <id>materialize-products</id>
- <goals>
- <goal>materialize-products</goal>
- </goals>
- </execution>
- <execution>
- <id>archive-products</id>
- <goals>
- <goal>archive-products</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <products>
- <product>
- <id>${product.id}</id>
- <rootFolder>EDIT Taxonomic Editor</rootFolder>
- </product>
- </products>
- </configuration>
- </plugin>
- </plugins>
- </build>
+
<profiles>
+ <profile>
+ <id>buildProducts</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-director-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <executions>
+ <execution>
+ <id>materialize-products</id>
+ <goals>
+ <goal>materialize-products</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>archive-products</id>
+ <goals>
+ <goal>archive-products</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <products>
+ <product>
+ <id>${product.id}</id>
+ <rootFolder>EDIT Taxonomic Editor</rootFolder>
+ </product>
+ </products>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
<profile>
<id>signJars</id>
<build>
<?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0</maven>
</prerequisites>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.8.0-SNAPSHOT</version>
+ <version>4.0.0-SNAPSHOT</version>
<name>EDIT Taxonomic Editor</name>
<description>The Taxonomic Editor for EDIT's platform for
cybertaxonomy
<properties>
<java.codelevel>1.6</java.codelevel>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <cdmlib.version>3.8.0-SNAPSHOT</cdmlib.version>
+ <cdmlib.version>4.0.0-SNAPSHOT</cdmlib.version>
<!-- TODO can we use project.version ????? -->
<tycho.version>0.22.0</tycho.version>
- <taxeditor.version>3.8.0-SNAPSHOT</taxeditor.version>
+ <taxeditor.version>4.0.0-SNAPSHOT</taxeditor.version>
<update.dir>snapshot</update.dir>
+ <unitils.version>3.4.2</unitils.version>
</properties>
<modules>
<module>eu.etaxonomy.taxeditor.cdmlib</module>
<module>eu.etaxonomy.taxeditor.help</module>
<module>eu.etaxonomy.taxeditor.molecular</module>
<module>eu.etaxonomy.taxeditor.molecular.lib</module>
+ <module>eu.etaxonomy.taxeditor.webapp</module>
<module>eu.etaxonomy.taxeditor.application</module>
<module>eu.etaxonomy.taxeditor.feature.platform</module>
<module>eu.etaxonomy.taxeditor.feature</module>
+ <module>eu.etaxonomy.taxeditor.feature.jre.linux64</module>
<module>eu.etaxonomy.taxeditor</module>
</modules>
<scm>