ref #3658 remove nomenclatural code from datasources
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 13 Oct 2016 11:59:47 +0000 (13:59 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 10 Nov 2016 12:50:41 +0000 (13:50 +0100)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSource.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java

index 6297b5b6c0a30740171da57ca5be198cfb1e2d8d..0a5797ae67fe080a81b3abb970c2d7b52bd664b8 100644 (file)
@@ -25,7 +25,7 @@ public class CdmModelCacherConnectionProvider extends DatasourceConnectionProvid
                String database = "xyz";
                String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database;
         String username = "sa";
                String database = "xyz";
                String path = "C:\\Users\\a.mueller\\.cdmLibrary\\writableResources\\h2\\LocalH2_" + database;
         String username = "sa";
-        CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("cdmTest", username, "", path,   NomenclaturalCode.ICNAFP);
+        CdmDataSource dataSource = CdmDataSource.NewH2EmbeddedInstance("cdmTest", username, "", path);
         return dataSource;
        }
        
         return dataSource;
        }
        
index e40e3625ff441fa1521a11d5d7f0806274a39984..3e7f33488a6ba8af28bf60a1e26fa5d9a2ba45c3 100644 (file)
@@ -29,13 +29,13 @@ import eu.etaxonomy.cdm.config.CdmPersistentSourceUtils;
 import eu.etaxonomy.cdm.config.CdmPersistentXMLSource;
 import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
 import eu.etaxonomy.cdm.config.ICdmPersistentSource;
 import eu.etaxonomy.cdm.config.CdmPersistentXMLSource;
 import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties;
 import eu.etaxonomy.cdm.config.ICdmPersistentSource;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 
 /**
  * Class representing a CDM remote source which can be persisted to a source config file
  *
  */
 public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{
 
 /**
  * Class representing a CDM remote source which can be persisted to a source config file
  *
  */
 public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{
+       @SuppressWarnings("unused")
        private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSource.class);
 
        public static final String REMOTESOURCE_BEAN_POSTFIX = "RemoteSource";
        private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSource.class);
 
        public static final String REMOTESOURCE_BEAN_POSTFIX = "RemoteSource";
@@ -98,15 +98,8 @@ public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements IC
                if(!cdmSourceProperties.containsKey(CdmSourceProperties.CONTEXTPATH.toString())) {
                        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");
                }
-               // default NomenclaturalCode is always ICNAFP
-               if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) {
-                       cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), NomenclaturalCode.ICNAFP.name());
-               }
        }
 
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.config.ICdmPersistentSource#getBeanName()
-        */
        @Override
        public String getBeanName() {
                return beanName;
        @Override
        public String getBeanName() {
                return beanName;
@@ -133,17 +126,11 @@ public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements IC
                return cdmSourceProperties.getProperty(CdmSourceProperties.CONTEXTPATH.toString());
        }
 
                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());
                cdmSourceProperties.put(CdmSourceProperties.PORT.toString(), String.valueOf(remoteSource.getPort()));
                cdmSourceProperties.put(CdmSourceProperties.CONTEXTPATH.toString(), remoteSource.getContextPath());
        public static CdmPersistentRemoteSource save(String strRemoteSourceName, ICdmRemoteSource remoteSource) throws CdmRemoteSourceException {
                Properties cdmSourceProperties = new Properties();
                cdmSourceProperties.put(CdmSourceProperties.SERVER.toString(), remoteSource.getServer());
                cdmSourceProperties.put(CdmSourceProperties.PORT.toString(), String.valueOf(remoteSource.getPort()));
                cdmSourceProperties.put(CdmSourceProperties.CONTEXTPATH.toString(), remoteSource.getContextPath());
-               cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), remoteSource.getNomenclaturalCode().name());
                checkProperties(cdmSourceProperties);
                return save(strRemoteSourceName, cdmSourceProperties);
        }
                checkProperties(cdmSourceProperties);
                return save(strRemoteSourceName, cdmSourceProperties);
        }
index 473cdca0f4d50494ecaf501320df57c353492de8..ed950a4b5c3eec7070dfa26783805afbf42a38c6 100644 (file)
@@ -27,7 +27,7 @@ public class CdmRemoteSource extends CdmRemoteSourceBase {
         * @return
         */
        public static CdmRemoteSource NewInstance() {
         * @return
         */
        public static CdmRemoteSource NewInstance() {
-               return new CdmRemoteSource(DEFAULT_NAME, DEFAULT_SERVER, DEFAULT_PORT, DEFAULT_CONTEXT_PATH, DEFAULT_NOMENCLATURAL_CODE);
+               return new CdmRemoteSource(DEFAULT_NAME, DEFAULT_SERVER, DEFAULT_PORT, DEFAULT_CONTEXT_PATH);
        }
        
        /**
        }
        
        /**
@@ -40,8 +40,8 @@ public class CdmRemoteSource extends CdmRemoteSourceBase {
         * @param nomenclaturalCode
         * @return
         */
         * @param nomenclaturalCode
         * @return
         */
-       public static CdmRemoteSource NewInstance(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
-               return new CdmRemoteSource(name, server, port, contextPath, nomenclaturalCode);
+       public static CdmRemoteSource NewInstance(String name, String server, int port, String contextPath) {
+               return new CdmRemoteSource(name, server, port, contextPath);
        }
        
        /**
        }
        
        /**
@@ -53,8 +53,8 @@ public class CdmRemoteSource extends CdmRemoteSourceBase {
         * @param contextPath
         * @param nomenclaturalCode
         */
         * @param contextPath
         * @param nomenclaturalCode
         */
-       private CdmRemoteSource(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { 
-               super(name, server, port, contextPath, nomenclaturalCode);
+       private CdmRemoteSource(String name, String server, int port, String contextPath) { 
+               super(name, server, port, contextPath);
                
        }
 
                
        }
 
index 59c24ea3b2f5497c692570e00582113aee6584b0..b349a4b231fd89eb1dd3f596f1993620756d8407 100644 (file)
@@ -15,7 +15,6 @@ import eu.etaxonomy.cdm.api.service.IMetadataService;
 import eu.etaxonomy.cdm.config.CdmSource;
 import eu.etaxonomy.cdm.config.CdmSourceException;
 import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName;
 import eu.etaxonomy.cdm.config.CdmSource;
 import eu.etaxonomy.cdm.config.CdmSourceException;
 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.
@@ -29,7 +28,6 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
        protected static final String DEFAULT_SERVER = "127.0.0.1";
        protected static final int DEFAULT_PORT = 8080;
        protected static final String DEFAULT_CONTEXT_PATH = "";
        protected static final String DEFAULT_SERVER = "127.0.0.1";
        protected static final int DEFAULT_PORT = 8080;
        protected static final String DEFAULT_CONTEXT_PATH = "";
-       protected static final NomenclaturalCode DEFAULT_NOMENCLATURAL_CODE = NomenclaturalCode.ICNAFP;
        private String contextPath;
        private String baseUrl;
 
        private String contextPath;
        private String baseUrl;
 
@@ -44,7 +42,6 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                setServer(DEFAULT_SERVER);
                setPort(DEFAULT_PORT);
                setContextPath(DEFAULT_CONTEXT_PATH);
                setServer(DEFAULT_SERVER);
                setPort(DEFAULT_PORT);
                setContextPath(DEFAULT_CONTEXT_PATH);
-               setNomenclaturalCode(DEFAULT_NOMENCLATURAL_CODE);
        }
 
        /**
        }
 
        /**
@@ -56,19 +53,14 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
         * @param contextPath
         * @param nomenclaturalCode
         */
         * @param contextPath
         * @param nomenclaturalCode
         */
-       public CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) {
+       public CdmRemoteSourceBase(String name, String server, int port, String contextPath) {
                setName(name);
                setServer(server);
                setPort(port);
                setContextPath(contextPath);
                setName(name);
                setServer(server);
                setPort(port);
                setContextPath(contextPath);
-               setNomenclaturalCode(nomenclaturalCode);
                metadataService = CdmApplicationRemoteConfiguration.getMetadataService(this);
        }
 
                metadataService = CdmApplicationRemoteConfiguration.getMetadataService(this);
        }
 
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getBaseUrl()
-        */
        @Override
        public String getBaseUrl() {
                return baseUrl;
        @Override
        public String getBaseUrl() {
                return baseUrl;
@@ -86,9 +78,6 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                this.baseUrl = baseUrl;
        }
 
                this.baseUrl = baseUrl;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.remote.ICdmRemoteSource#getContextPath()
-        */
        @Override
        public String getContextPath() {
                return contextPath;
        @Override
        public String getContextPath() {
                return contextPath;
@@ -105,27 +94,18 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                this.contextPath = contextPath;
        }
 
                this.contextPath = contextPath;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.config.CdmSource#getDbSchemaVersion()
-        */
        @Override
        public String getDbSchemaVersion() throws CdmSourceException {
                return metadataService.getDbSchemaVersion();
 
        }
 
        @Override
        public String getDbSchemaVersion() throws CdmSourceException {
                return metadataService.getDbSchemaVersion();
 
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.config.CdmSource#isDbEmpty()
-        */
        @Override
        public boolean isDbEmpty() throws CdmSourceException {
                return metadataService.isDbEmpty();
 
        }
 
        @Override
        public boolean isDbEmpty() throws CdmSourceException {
                return metadataService.isDbEmpty();
 
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.config.CdmSource#checkConnection()
-        */
        @Override
        public boolean checkConnection() throws CdmSourceException {
                // assuming that database service works implies
        @Override
        public boolean checkConnection() throws CdmSourceException {
                // assuming that database service works implies
@@ -138,9 +118,6 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                return true;
        }
 
                return true;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.cdm.config.CdmSource#getConnectionMessage()
-        */
        @Override
        public String getConnectionMessage() {
                return "Connecting to Remote CDM Instance " + getName() + ":" + getPort() + "/" + getContextPath();
        @Override
        public String getConnectionMessage() {
                return "Connecting to Remote CDM Instance " + getName() + ":" + getPort() + "/" + getContextPath();
@@ -152,5 +129,4 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                return metadataService.getCdmMetadataMap();
        }
 
                return metadataService.getCdmMetadataMap();
        }
 
-
 }
 }
index 2a5f81522b5eeb71bdeb31068e40ff9d0c9a3d8b..d54986bc726b17243e4335c25f771e1bc0dfaacb 100644 (file)
@@ -255,8 +255,8 @@ public class CdmServerInfo {
             return CdmRemoteSource.NewInstance(name,
                     server,
                     port,
             return CdmRemoteSource.NewInstance(name,
                     server,
                     port,
-                    instance.getBasePath(),
-                    null);
+                    instance.getBasePath()
+                    );
         }
         return null;
     }
         }
         return null;
     }