cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Tue, 9 Jun 2020 00:13:50 +0000 (02:13 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Tue, 9 Jun 2020 00:13:50 +0000 (02:13 +0200)
12 files changed:
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateSynonymInHomotypicalGroupHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenPasswordWizzardHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowLoginWindowHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/update/P2Util.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/MessagingUtils.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ExtReferenceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/e4/handler/ChangeConnectionHandlerE4.java

index 71ba9cfc879319ec12640bbabdbb9b2dc8c32167..7b5469b04d209d5ae9e71b9e711f32592699847a 100644 (file)
@@ -63,21 +63,17 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
                        }
                    }
                }
-
         }
 
+           P2Util.setP2UpdateRepositories();
 
-               if(PreferencesUtil.shouldConnectAtStartUp()) {
-            CdmStore.connect();
+           if(PreferencesUtil.shouldConnectAtStartUp()) {
+                   CdmStore.connect();
         }
-
-               P2Util.setP2UpdateRepositories();
-
        }
 
        @Override
     public void postWindowClose() {
         P2Util.saveP2RepositoryPreferences();
     }
-}
-
+}
\ No newline at end of file
index 0fc6239683e9f9aa6573ff7ffc4bd1a4e53aa994..87f76fdfe557b95e8004e2ce520c034772812fee 100644 (file)
@@ -339,7 +339,6 @@ public class CdmApplicationRemoteConfiguration implements ICdmRepository, Applic
         return (IUserService) getService(IUserService.class, "/remoting-public/user.service", new AuthenticatingHttpInvokerRequestExecutor());\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
@@ -358,7 +357,6 @@ public class CdmApplicationRemoteConfiguration implements ICdmRepository, Applic
         return (IGrantedAuthorityService) getService(IGrantedAuthorityService.class, "/remoting/grantedauthority.service", new AuthenticatingHttpInvokerRequestExecutor());\r
     }\r
 \r
-\r
     @Override\r
     public ProviderManager getAuthenticationManager(){\r
         if(authenticationManager == null) {\r
index c412900925a833ac33ed7370c6e0b97359953560..0a30c168b3590f4fd697c06e54bad8a999baf5e8 100644 (file)
@@ -30,10 +30,8 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.parser.ParseHandler;
 
 /**
- *
  * @author pplitzner
  * @since Aug 28, 2017
- *
  */
 public class CreateSynonymInHomotypicalGroupHandlerE4 {
 
index 3ceeb983c1c13b91ac74d25f79f4e546d90e1ce4..b795b4e992bce9bcf21cf21c7280606c13c2cbbe 100644 (file)
@@ -62,7 +62,6 @@ public class CdmDataSourceRepository{
                        memento = readMemento();
                        lastUsedCdmSourceName = memento != null ? memento.getString(CURRENT_DATASOURCE) : DEFAULT_DATASOURCE_NAME;
                        lastUsedCdmSourcePostFix = memento != null ? memento.getString(CURRENT_DATASOURCE_POSTFIX) : DEFAULT_DATASOURCE_POSTFIX;
-
                }
        }
 
@@ -133,7 +132,6 @@ public class CdmDataSourceRepository{
                return null;
        }
 
-
        /**
         * <p>Getter for the field <code>currentDataSource</code>.</p>
         *
@@ -185,15 +183,6 @@ public class CdmDataSourceRepository{
         */
        public static boolean setCurrentCdmSource(ICdmSource cdmSource) {
                currentCdmSource = cdmSource;
-//             NomenclaturalCode dataSourceNomenclaturalCode = cdmSource.getNomenclaturalCode();
-//             NomenclaturalCode applicationNomenclaturalCode = PreferencesUtil.getPreferredNomenclaturalCode(true);
-//
-//             if( dataSourceNomenclaturalCode != null && ! dataSourceNomenclaturalCode.equals(applicationNomenclaturalCode)){
-//                     PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode, true);
-//                     MessagingUtils.informationDialog("Nomenclatural Code Change", "The Datasource that was just " +
-//                                     "loaded has a different nomenclatural code than the one stored in Preferences. " +
-//                                     "The nomenclatural code was changed in the application.");
-//             }
                return true;
        }
 
@@ -317,7 +306,6 @@ public class CdmDataSourceRepository{
                }
        }
 
-
        private static IMemento initializeMemento() {
 
                XMLMemento memento = XMLMemento.createWriteRoot(TAG_DATASOURCE);
index 09a51b5b329822060cff68168ce4cac26e7dab1f..1c2799873e288b398501ef9c40e8551551f4bf6a 100644 (file)
@@ -22,10 +22,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
 
 /**
- *
  * @author pplitzner
  * @date 10.10.2017
- *
  */
 public class OpenPasswordWizzardHandlerE4 {
 
index a65915acc4404080b082b86f7f3bbaf3a48b38f2..c08bc5a63569b9cbf2b6b99367f6ad7eee9abfe2 100644 (file)
@@ -18,10 +18,8 @@ import org.eclipse.swt.widgets.Shell;
 import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
 
 /**
- *
  * @author pplitzner
  * @date 10.10.2017
- *
  */
 public class ShowLoginWindowHandlerE4 {
 
index 5d99d19658317a3d3b8ed261312748c83466a25e..4b760abcf4cb34f0314f460fc54df70cdbe973e5 100644 (file)
@@ -46,7 +46,7 @@ public class P2Util {
      */
     @SuppressWarnings("restriction")
     public static void setP2UpdateRepositories() {
-        List<MetadataRepositoryElement> repoElements = new ArrayList<MetadataRepositoryElement>();
+        List<MetadataRepositoryElement> repoElements = new ArrayList<>();
         List<MetadataRepositoryElement> savedRepoElements = new ArrayList<>();
 
         MetadataRepositoryElement mre = new MetadataRepositoryElement(null, getP2UpdateRepository(), true);
@@ -57,7 +57,6 @@ public class P2Util {
 
         ElementUtils.updateRepositoryUsingElements(ProvisioningUI.getDefaultUI(),repoElements
                 .toArray(new MetadataRepositoryElement[]{} ));
-
     }
 
     public static String getP2UpdateRepositoryName(){
@@ -89,7 +88,7 @@ public class P2Util {
         URI[] currentlyEnabled = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
         URI[] currentlyDisabled = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED);
 
-        List<MetadataRepositoryElement> repoElements = new ArrayList<MetadataRepositoryElement>();
+        List<MetadataRepositoryElement> repoElements = new ArrayList<>();
 
         for(URI repo : currentlyEnabled) {
             boolean enabled = true;
index 2b2337483d0a1b6ce11dc7005bac69528ce058d3..da63b1a75124027e82f4234c99bfbff653548330 100644 (file)
@@ -170,7 +170,7 @@ public class MessagingUtils {
      * @return
      */
     public static List<String> getContextInfo() {
-        List<String> contextInfo = new ArrayList<String>();
+        List<String> contextInfo = new ArrayList<>();
         String name = "";
         String contextPath = "";
         String schemaVersion = "";
index 807e8df098bc47cc1cd9798620f175b3bae00526..609b928b736844a38ff202104c1223241a3f1bd7 100644 (file)
@@ -123,8 +123,6 @@ public class CdmStore {
 
     private static CdmStore instance;
 
-    //private final ICdmRepository applicationConfiguration;
-
     private static ContextManager contextManager = new ContextManager();
 
     private static LoginManager loginManager = new LoginManager();
@@ -147,11 +145,6 @@ public class CdmStore {
 
     private boolean isConnected;
 
-
-
-    /**
-     * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
-     */
     protected static CdmStore getDefault(boolean connecting){
         if (instance != null && instance.isConnected) {
             return instance;
@@ -165,32 +158,23 @@ public class CdmStore {
         }
     }
 
-    /**
-     * <p>
-     * getDefault
-     * </p>
-     *
-     * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
-     */
     protected static CdmStore getDefault(){
        return getDefault(false);
     }
 
     /**
      * Initialize the with the last edited datasource
+     * @deprecated this method is not needed anymore after fully changing to remoting.
+     * Therefore it will be removed
      */
+    @Deprecated
     public static void connect() {
-
-        ICdmSource cdmSource;
         try {
-
-            cdmSource = CdmDataSourceRepository.getCurrentCdmSource();
+            ICdmSource 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);
         }
-
-
     }
 
     /**
@@ -229,7 +213,6 @@ public class CdmStore {
         job.setUser(true);
         job.setPriority(Job.BUILD);
         job.schedule();
-
     }
 
     private static void connect(final ICdmSource cdmSource,
@@ -288,11 +271,11 @@ public class CdmStore {
                 instance.close();
             }
         }
-
     }
+
     private void close() {
-        isConnected = false;
-        cdmSource = null;
+        this.isConnected = false;
+        this.cdmSource = null;
         CdmApplicationState.dispose();
     }
 
@@ -300,7 +283,6 @@ public class CdmStore {
             ICdmSource cdmSource) {
         instance = new CdmStore(applicationController, cdmSource);
         CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
-
     }
 
     private CdmStore(ICdmRepository repository,
@@ -325,15 +307,6 @@ public class CdmStore {
         return null;
     }
 
-    /**
-     * <p>
-     * getCurrentApplicationController
-     * </p>
-     *
-     * @return a
-     *         {@link eu.etaxonomy.cdm.remote.api.application.CdmApplicationController}
-     *         object.
-     */
     public static ICdmRepository getCurrentApplicationConfiguration() {
         if (getDefault() != null) {
             return getDefault().getApplicationConfiguration();
@@ -382,13 +355,11 @@ public class CdmStore {
         return getCurrentSessionManager(false);
     }
 
-
     public static  ICdmEntitySessionManager getCurrentSessionManager(boolean connecting) {
         if (getDefault(connecting) != null) {
             return getDefault(connecting).getSessionManager();
         }
         return null;
-
     }
 
     /**
@@ -427,7 +398,6 @@ public class CdmStore {
         return getCurrentApplicationConfiguration().getPermissionEvaluator();
     }
 
-
     /*
      * SECURITY RELATED CONVENIENCE METHODS
      */
@@ -500,29 +470,14 @@ public class CdmStore {
         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;
     }
@@ -531,24 +486,10 @@ public class CdmStore {
      * 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;
     }
@@ -570,24 +511,10 @@ public class CdmStore {
      * 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());
     }
@@ -608,29 +535,10 @@ public class CdmStore {
         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;
     }
 
-
     @SuppressWarnings("unchecked")
     public static <T extends CdmBase> IService<T> getService(T cdmBase){
         IService<T> service = null;
index d6c182d4f771cfbcc178c704d4d812c2f8fc9d0d..ec6f8f586772c088d76d97df677c6da1d6fc9a5c 100644 (file)
@@ -6,7 +6,6 @@
  * 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.Observable;
@@ -30,7 +29,6 @@ import eu.etaxonomy.taxeditor.util.ApplicationUtil;
  *
  * @author n.hoffmann
  * @created 01.07.2009
- * @version 1.0
  */
 public class AuthenticatedUserBar extends WorkbenchWindowControlContribution implements Observer{
 
@@ -40,14 +38,11 @@ public class AuthenticatedUserBar extends WorkbenchWindowControlContribution imp
         CdmStore.getLoginManager().addObserver(this);
     }
 
-
-
     @Override
     public boolean isDynamic() {
         return true;
     }
 
-    /** {@inheritDoc} */
     @Override
     protected Control createControl(Composite parent) {
         parent.getParent().setRedraw(true);
@@ -58,7 +53,6 @@ public class AuthenticatedUserBar extends WorkbenchWindowControlContribution imp
         return label_authenticatedUser;
     }
 
-    /** {@inheritDoc} */
     @Override
     public void update(Observable o, Object arg) {
         User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
@@ -78,7 +72,6 @@ public class AuthenticatedUserBar extends WorkbenchWindowControlContribution imp
         label_authenticatedUser.setRedraw(true);
     }
 
-    /** {@inheritDoc} */
     @Override
     public void dispose() {
         super.dispose();
index 509af3cc32f8ffdce1494de2a1f36f0157d29ded..14733be069e3b411e7a9b274a78dc81a2559c79a 100644 (file)
 */
 package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
- import java.util.UUID;
+import java.util.UUID;
 
 import org.eclipse.swt.widgets.Shell;
 
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
+import eu.etaxonomy.cdm.config.ICdmSource;
 import eu.etaxonomy.cdm.model.agent.Person;
 import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
-import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
 import eu.etaxonomy.taxeditor.newWizard.NewReferenceWizard;
 import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
-import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
-
 /**
  * @author k.luther
  * @date 02.05.2017
  */
 public class ExtReferenceSelectionDialog extends
-    AbstractFilteredCdmResourceSelectionDialog<Reference> {
-
-        protected static boolean isInReference = false;
-        private Reference currentReference;
-        ICdmRepository controller;
-        ICdmRemoteSource remoteSource ;
-        Reference remoteSourceRef;
-        IReferenceService service = null;
-
-
-        /**
-         * <p>select</p>
-         *
-         * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
-         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-         * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         */
-        public static Reference select(Shell shell, //ConversationHolder conversation,
-                Reference reference, boolean isInReference) {
-            ExtReferenceSelectionDialog dialog = new ExtReferenceSelectionDialog(shell, //conversation,
-                    "Choose a reference", false, reference, isInReference);
-            return getSelectionFromDialog(dialog);
-        }
-
-        /**
-         * <p>select</p>
-         *
-         * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
-         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-         * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         */
-        public static Reference select(Shell shell, //ConversationHolder conversation,
-                Reference reference) {
-            ExtReferenceSelectionDialog dialog = new ExtReferenceSelectionDialog(shell, //conversation,
-                    "Choose a reference", false, reference);
-            return getSelectionFromDialog(dialog);
-        }
-
-
-
-
+        AbstractFilteredCdmResourceSelectionDialog<Reference> {
+
+    protected static boolean isInReference = false;
+    private Reference currentReference;
+    private ICdmSource remoteSource ;
+    private Reference remoteSourceRef;
+    private IReferenceService service = null;
+
+    /**
+     * <p>select</p>
+     *
+     * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     */
+    public static Reference select(Shell shell, //ConversationHolder conversation,
+            Reference reference, boolean isInReference) {
+        ExtReferenceSelectionDialog dialog = new ExtReferenceSelectionDialog(shell, //conversation,
+                "Choose a reference", false, reference, isInReference);
+        return getSelectionFromDialog(dialog);
+    }
 
+    /**
+     * <p>select</p>
+     *
+     * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     */
+    public static Reference select(Shell shell, //ConversationHolder conversation,
+            Reference reference) {
+        ExtReferenceSelectionDialog dialog = new ExtReferenceSelectionDialog(shell, //conversation,
+                "Choose a reference", false, reference);
+        return getSelectionFromDialog(dialog);
+    }
 
-        /**
-         * <p>Constructor for FilteredReferenceSelectionDialog.</p>
-         *
-         * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
-         * @param title a {@link java.lang.String} object.
-         * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-         * @param multi a boolean.
-         */
-        protected ExtReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
-                String title, boolean multi, Reference reference) {
-            super(shell, //conversation,
-                    title, multi, ExtReferenceSelectionDialog.class.getCanonicalName());
-            this.currentReference = reference;
+    /**
+     * <p>Constructor for FilteredReferenceSelectionDialog.</p>
+     *
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+     * @param title a {@link java.lang.String} object.
+     * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @param multi a boolean.
+     */
+    protected ExtReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
+            String title, boolean multi, Reference reference) {
+        super(shell, //conversation,
+                title, multi, ExtReferenceSelectionDialog.class.getCanonicalName());
+        this.currentReference = reference;
 //            controller = CdmStore.getCurrentApplicationConfiguration();
-            remoteSource = CdmServerInfo.getDevServerRemoteSource();
-            remoteSourceRef = ReferenceFactory.newDatabase();
-            remoteSourceRef.setTitle(remoteSource.getName());
-        }
-
-
-
+        remoteSource = CdmServerInfo.getDevServerRemoteSource();
+        remoteSourceRef = ReferenceFactory.newDatabase();
+        remoteSourceRef.setTitle(remoteSource.getName());
+    }
 
-        /**
-         * <p>Constructor for FilteredReferenceSelectionDialog.</p>
-         *
-         * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
-         * @param title a {@link java.lang.String} object.
-         * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
-         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-         * @param multi a boolean.
-         */
-        protected ExtReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
-                String title, boolean multi, Reference reference, boolean isInReference) {
-            super(shell, //conversation,
-                    title, multi, ExtReferenceSelectionDialog.class.getCanonicalName());
-            this.isInReference = isInReference;
-            this.currentReference = reference;
+    /**
+     * <p>Constructor for FilteredReferenceSelectionDialog.</p>
+     *
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+     * @param title a {@link java.lang.String} object.
+     * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @param multi a boolean.
+     */
+    protected ExtReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
+            String title, boolean multi, Reference reference, boolean isInReference) {
+        super(shell, //conversation,
+                title, multi, ExtReferenceSelectionDialog.class.getCanonicalName());
+        ExtReferenceSelectionDialog.isInReference = isInReference;
+        this.currentReference = reference;
 
 //            controller = CdmStore.getCurrentApplicationConfiguration();
 //            CdmServerInfoConfig parameterObject = new CdmServerInfoConfig("localhost", "localhost", 8080, "cdmserver/", true);
@@ -122,125 +109,105 @@ public class ExtReferenceSelectionDialog extends
 //            CdmInstanceInfo selectedCdmInstance = selectedCsii.getInstanceFromName("local-cuba") ;
 //            Integer port;
 //            remoteSource = selectedCsii.getCdmRemoteSource(selectedCdmInstance, 80);
+    }
 
+    @Override
+    protected Reference getPersistentObject(UUID cdmUuid) {
+        Reference extRef = service.load(cdmUuid);
 
+        Reference newRef = ReferenceFactory.newReference( extRef.getType());
+        if (extRef.getTitle() != null){
+            newRef.setTitle(extRef.getTitle());
+        }else{
+            newRef.setTitleCache(extRef.getTitleCache(), true);
+        }
+        if (extRef.getAbbrevTitle() != null){
+            newRef.setAbbrevTitle(extRef.getAbbrevTitle());
+        }else{
+            newRef.setAbbrevTitleCache(extRef.getAbbrevTitleCache(), true);
         }
 
-
-        /* (non-Javadoc)
-         * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
-         */
-        /** {@inheritDoc} */
-        @Override
-        protected Reference getPersistentObject(UUID cdmUuid) {
-            Reference extRef = service.load(cdmUuid);
-
-            Reference newRef = ReferenceFactory.newReference( extRef.getType());
-            if (extRef.getTitle() != null){
-                newRef.setTitle(extRef.getTitle());
+        if (extRef.getInReference() != null){
+            Reference inRef = extRef.getInReference();
+            Reference newRefInRef = ReferenceFactory.newReference( extRef.getInBook().getType());
+            if (inRef.getTitle() != null){
+                newRefInRef.setTitle(inRef.getTitle());
             }else{
-                newRef.setTitleCache(extRef.getTitleCache(), true);
+                newRefInRef.setTitleCache(inRef.getTitleCache(), true);
             }
-            if (extRef.getAbbrevTitle() != null){
-                newRef.setAbbrevTitle(extRef.getAbbrevTitle());
+            if (inRef.getAbbrevTitle() != null){
+                newRefInRef.setAbbrevTitle(inRef.getAbbrevTitle());
             }else{
-                newRef.setAbbrevTitleCache(extRef.getAbbrevTitleCache(), true);
+                newRefInRef.setAbbrevTitleCache(inRef.getAbbrevTitleCache(), true);
             }
+            newRefInRef.addSource(OriginalSourceType.Other, String.valueOf(newRefInRef.getId()), "Reference", remoteSourceRef, null);
+            newRef.setInReference(newRefInRef);
+            newRef.setProtectedTitleCache(false);
+            newRef.setProtectedAbbrevTitleCache(false);
+            newRef.addSource(OriginalSourceType.Other, String.valueOf(newRef.getId()), "Reference", remoteSourceRef, null);
+        }
+        TeamOrPersonBase<?> author;
+        if (extRef.getAuthorship() != null){
+            if (extRef.getAuthorship() instanceof Person){
+                 author = Person.NewTitledInstance(extRef.getAuthorship().getTitleCache());
+                 author.setProtectedTitleCache(true);
+            }else{
+               author = Team.NewInstance();
+               Person newMember;
 
-            if (extRef.getInReference() != null){
-                Reference inRef = extRef.getInReference();
-                Reference newRefInRef = ReferenceFactory.newReference( extRef.getInBook().getType());
-                if (inRef.getTitle() != null){
-                    newRefInRef.setTitle(inRef.getTitle());
-                }else{
-                    newRefInRef.setTitleCache(inRef.getTitleCache(), true);
-                }
-                if (inRef.getAbbrevTitle() != null){
-                    newRefInRef.setAbbrevTitle(inRef.getAbbrevTitle());
-                }else{
-                    newRefInRef.setAbbrevTitleCache(inRef.getAbbrevTitleCache(), true);
-                }
-                newRefInRef.addSource(OriginalSourceType.Other, String.valueOf(newRefInRef.getId()), "Reference", remoteSourceRef, null);
-                newRef.setInReference(newRefInRef);
-                newRef.setProtectedTitleCache(false);
-                newRef.setProtectedAbbrevTitleCache(false);
-                newRef.addSource(OriginalSourceType.Other, String.valueOf(newRef.getId()), "Reference", remoteSourceRef, null);
-            }
-            TeamOrPersonBase author;
-            if (extRef.getAuthorship() != null){
-                if (extRef.getAuthorship() instanceof Person){
-                     author = Person.NewTitledInstance(extRef.getAuthorship().getTitleCache());
-                     author.setProtectedTitleCache(true);
-                }else{
-                   author = Team.NewInstance();
-                   Person newMember;
-
-                   for (Person member:((Team)extRef.getAuthorship()).getTeamMembers()){
-                       newMember = Person.NewTitledInstance(member.getTitleCache());
-                       ((Team)author).addTeamMember(newMember);
-                   }
-
-                }
-                newRef.setAuthorship(author);
+               for (Person member:((Team)extRef.getAuthorship()).getTeamMembers()){
+                   newMember = Person.NewTitledInstance(member.getTitleCache());
+                   ((Team)author).addTeamMember(newMember);
+               }
             }
-
-            newRef = CdmStore.getService(IReferenceService.class).save(newRef);
-
-            return newRef;
+            newRef.setAuthorship(author);
         }
+        newRef = CdmStore.getService(IReferenceService.class).save(newRef);
+        return newRef;
+    }
 
-        /** {@inheritDoc} */
-        @Override
-        protected void callService(String pattern) {
-
+    @Override
+    protected void callService(String pattern) {
 
-            if (remoteSource != null){
+        if (remoteSource != null){
 //               if (service == null){
 //                   service = CdmApplicationRemoteConfiguration.getExtReferenceService(remoteSource);
 //               }
-               if (pattern.equals("?")){ //$NON-NLS-1$
-                    if (isInReference && currentReference != null){
-                        model = service.getUuidAndTitleCache(null, null, currentReference.getType());
-                    }else{
-                        model = service.getUuidAndTitleCache(null, null);
-                    }
+           if (pattern.equals("?")){ //$NON-NLS-1$
+                if (isInReference && currentReference != null){
+                    model = service.getUuidAndTitleCache(null, null, currentReference.getType());
                 }else{
-                    if (isInReference && currentReference != null){
-                        model = service.getUuidAndTitleCache(limitOfInitialElements, pattern, currentReference.getType());
-                    }else{
-                        model = service.getUuidAndTitleCache(limitOfInitialElements,pattern);
-
-                    }
+                    model = service.getUuidAndTitleCache(null, null);
                 }
-             }
-        }
-
-
-        /** {@inheritDoc} */
-        @Override
-        protected String getTitle(Reference cdmObject) {
-            if(cdmObject == null){
-                return "";
             }else{
-                return super.getTitle(cdmObject);
+                if (isInReference && currentReference != null){
+                    model = service.getUuidAndTitleCache(limitOfInitialElements, pattern, currentReference.getType());
+                }else{
+                    model = service.getUuidAndTitleCache(limitOfInitialElements,pattern);
+                }
             }
+         }
+    }
+
+    @Override
+    protected String getTitle(Reference cdmObject) {
+        if(cdmObject == null){
+            return "";
+        }else{
+            return super.getTitle(cdmObject);
+        }
 //          }else{
 //              return DefaultReferenceCacheStrategy.putAuthorToEndOfString(cdmObject.getTitleCache(), cdmObject.getAuthorship().getTitleCache());
 //          }
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
-            return new NewReferenceWizard();
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        protected String[] getNewWizardText() {
-            return new String[]{"Reference "};
-        }
-
     }
 
+    @Override
+    protected NewReferenceWizard getNewEntityWizard(String parameter) {
+        return new NewReferenceWizard();
+    }
 
+    @Override
+    protected String[] getNewWizardText() {
+        return new String[]{"Reference "};
+    }
+}
index 8ff1b0d82384f57c303e4120a1a92193c7453219..9635cfd302731f3bf9cbbec4b2dad4ae78939e0c 100644 (file)
@@ -28,10 +28,8 @@ import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContaine
 import eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4;
 
 /**
- *
  * @author pplitzner
  * @date 22.08.2017
- *
  */
 public class ChangeConnectionHandlerE4 {