Revision 5215f59f
Added by Andreas Müller over 7 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java | ||
---|---|---|
29 | 29 |
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource; |
30 | 30 |
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties; |
31 | 31 |
import eu.etaxonomy.cdm.config.ICdmPersistentSource; |
32 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
33 | 32 |
|
34 | 33 |
/** |
35 | 34 |
* Class representing a CDM remote source which can be persisted to a source config file |
36 | 35 |
* |
37 | 36 |
*/ |
38 | 37 |
public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{ |
38 |
@SuppressWarnings("unused") |
|
39 | 39 |
private static final Logger logger = Logger.getLogger(CdmPersistentRemoteSource.class); |
40 | 40 |
|
41 | 41 |
public static final String REMOTESOURCE_BEAN_POSTFIX = "RemoteSource"; |
... | ... | |
98 | 98 |
if(!cdmSourceProperties.containsKey(CdmSourceProperties.CONTEXTPATH.toString())) { |
99 | 99 |
throw new CdmRemoteSourceException("Could not initialise remote source. Required property '" + CdmSourceProperties.SERVER.toString() + "' is missing"); |
100 | 100 |
} |
101 |
// default NomenclaturalCode is always ICNAFP |
|
102 |
if(!cdmSourceProperties.containsKey(CdmSourceProperties.NOMENCLATURAL_CODE.toString())) { |
|
103 |
cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), NomenclaturalCode.ICNAFP.name()); |
|
104 |
} |
|
105 | 101 |
} |
106 | 102 |
|
107 |
/* (non-Javadoc) |
|
108 |
* @see eu.etaxonomy.cdm.config.ICdmPersistentSource#getBeanName() |
|
109 |
*/ |
|
110 | 103 |
@Override |
111 | 104 |
public String getBeanName() { |
112 | 105 |
return beanName; |
... | ... | |
133 | 126 |
return cdmSourceProperties.getProperty(CdmSourceProperties.CONTEXTPATH.toString()); |
134 | 127 |
} |
135 | 128 |
|
136 |
@Override |
|
137 |
public NomenclaturalCode getNomenclaturalCode() { |
|
138 |
return NomenclaturalCode.fromString(cdmSourceProperties.getProperty(CdmSourceProperties.NOMENCLATURAL_CODE.toString())); |
|
139 |
} |
|
140 |
|
|
141 | 129 |
public static CdmPersistentRemoteSource save(String strRemoteSourceName, ICdmRemoteSource remoteSource) throws CdmRemoteSourceException { |
142 | 130 |
Properties cdmSourceProperties = new Properties(); |
143 | 131 |
cdmSourceProperties.put(CdmSourceProperties.SERVER.toString(), remoteSource.getServer()); |
144 | 132 |
cdmSourceProperties.put(CdmSourceProperties.PORT.toString(), String.valueOf(remoteSource.getPort())); |
145 | 133 |
cdmSourceProperties.put(CdmSourceProperties.CONTEXTPATH.toString(), remoteSource.getContextPath()); |
146 |
cdmSourceProperties.put(CdmSourceProperties.NOMENCLATURAL_CODE.toString(), remoteSource.getNomenclaturalCode().name()); |
|
147 | 134 |
checkProperties(cdmSourceProperties); |
148 | 135 |
return save(strRemoteSourceName, cdmSourceProperties); |
149 | 136 |
} |
Also available in: Unified diff
ref #3658 remove nomenclatural code from datasources