Revision 10644642
Added by Andreas Müller over 7 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacherConnectionProvider.java | ||
---|---|---|
5 | 5 |
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl; |
6 | 6 |
|
7 | 7 |
import eu.etaxonomy.cdm.database.CdmDataSource; |
8 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
9 | 8 |
|
10 | 9 |
/** |
11 | 10 |
* This is a very preliminary class to get the model cache running. Need to better understand how |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java | ||
---|---|---|
29 | 29 |
import eu.etaxonomy.cdm.database.CdmPersistentDataSource; |
30 | 30 |
import eu.etaxonomy.cdm.database.DataSourceNotFoundException; |
31 | 31 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
32 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
33 | 32 |
import eu.etaxonomy.taxeditor.model.MementoHelper; |
34 | 33 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
35 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
36 | 34 |
import eu.etaxonomy.taxeditor.remoting.source.CdmPersistentRemoteSource; |
37 | 35 |
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException; |
38 | 36 |
import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource; |
... | ... | |
173 | 171 |
*/ |
174 | 172 |
public static ICdmDataSource createDefaultH2DataSource() { |
175 | 173 |
ICdmDataSource h2DataSource = CdmDataSource.NewH2EmbeddedInstance( |
176 |
DEFAULT_DATASOURCE_NAME, "sa", "", PreferencesUtil.getPreferredNomenclaturalCode(true));
|
|
174 |
DEFAULT_DATASOURCE_NAME, "sa", ""); |
|
177 | 175 |
save(h2DataSource.getName(), h2DataSource); |
178 | 176 |
return h2DataSource; |
179 | 177 |
} |
... | ... | |
186 | 184 |
*/ |
187 | 185 |
public static boolean setCurrentCdmSource(ICdmSource cdmSource) { |
188 | 186 |
currentCdmSource = cdmSource; |
189 |
NomenclaturalCode dataSourceNomenclaturalCode = cdmSource.getNomenclaturalCode(); |
|
190 |
NomenclaturalCode applicationNomenclaturalCode = PreferencesUtil.getPreferredNomenclaturalCode(true); |
|
191 |
|
|
192 |
if( dataSourceNomenclaturalCode != null && ! dataSourceNomenclaturalCode.equals(applicationNomenclaturalCode)){ |
|
193 |
PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode, true); |
|
194 |
MessagingUtils.informationDialog("Nomenclatural Code Change", "The Datasource that was just " + |
|
195 |
"loaded has a different nomenclatural code than the one stored in Preferences. " + |
|
196 |
"The nomenclatural code was changed in the application."); |
|
197 |
} |
|
187 |
// NomenclaturalCode dataSourceNomenclaturalCode = cdmSource.getNomenclaturalCode();
|
|
188 |
// NomenclaturalCode applicationNomenclaturalCode = PreferencesUtil.getPreferredNomenclaturalCode(true);
|
|
189 |
// |
|
190 |
// if( dataSourceNomenclaturalCode != null && ! dataSourceNomenclaturalCode.equals(applicationNomenclaturalCode)){
|
|
191 |
// PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode, true);
|
|
192 |
// MessagingUtils.informationDialog("Nomenclatural Code Change", "The Datasource that was just " +
|
|
193 |
// "loaded has a different nomenclatural code than the one stored in Preferences. " +
|
|
194 |
// "The nomenclatural code was changed in the application.");
|
|
195 |
// }
|
|
198 | 196 |
return true; |
199 | 197 |
} |
200 | 198 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceCredentialsWizardPage.java | ||
---|---|---|
29 | 29 |
import org.eclipse.swt.widgets.Text; |
30 | 30 |
|
31 | 31 |
import eu.etaxonomy.cdm.database.CdmDataSource; |
32 |
import eu.etaxonomy.cdm.database.CdmPersistentDataSource; |
|
33 | 32 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
34 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
35 | 33 |
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository; |
36 |
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper; |
|
37 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
38 | 34 |
|
39 | 35 |
|
40 | 36 |
/** |
... | ... | |
54 | 50 |
|
55 | 51 |
protected Group authenticationGroup; |
56 | 52 |
protected Group locationGroup; |
57 |
protected Group nomenclaturalCodeGroup; |
|
58 | 53 |
|
59 | 54 |
protected Composite composite; |
60 | 55 |
|
... | ... | |
65 | 60 |
protected String username; |
66 | 61 |
protected String password; |
67 | 62 |
|
68 |
protected NomenclaturalCode nomenclaturalCode; |
|
69 |
|
|
70 | 63 |
CdmDataSourceWizard.Mode mode; |
71 | 64 |
|
72 | 65 |
/** |
... | ... | |
98 | 91 |
} |
99 | 92 |
} |
100 | 93 |
|
101 |
/* (non-Javadoc) |
|
102 |
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) |
|
103 |
*/ |
|
104 | 94 |
/** {@inheritDoc} */ |
105 | 95 |
@Override |
106 | 96 |
public void createControl(Composite parent) { |
... | ... | |
140 | 130 |
// create the authentication input fields |
141 | 131 |
createAuthenticationForm(); |
142 | 132 |
|
143 |
// create nomenclatural code combo |
|
144 |
createNomenclaturalCodeForm(); |
|
145 |
|
|
146 | 133 |
// Create composite for buttons |
147 | 134 |
Composite buttonComposite = new Composite(composite, SWT.NONE); |
148 | 135 |
buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); |
... | ... | |
157 | 144 |
|
158 | 145 |
// Test connection when button is pressed |
159 | 146 |
testButton.addSelectionListener(new SelectionAdapter() { |
160 |
/* (non-Javadoc) |
|
161 |
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
|
162 |
*/ |
|
163 | 147 |
@Override |
164 | 148 |
public void widgetSelected(SelectionEvent e) { |
165 | 149 |
testDbConfiguration(); |
... | ... | |
192 | 176 |
text_databaseName = new Text(authenticationGroup, SWT.BORDER); |
193 | 177 |
text_databaseName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
194 | 178 |
|
195 |
|
|
196 | 179 |
// Create username label |
197 | 180 |
Label usernameLabel = new Label(authenticationGroup, SWT.NONE); |
198 | 181 |
usernameLabel.setText("User Name:"); |
... | ... | |
201 | 184 |
text_username = new Text(authenticationGroup, SWT.BORDER); |
202 | 185 |
text_username.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
203 | 186 |
|
204 |
|
|
205 | 187 |
// Create password label |
206 | 188 |
Label passwordLabel = new Label(authenticationGroup, SWT.NONE); |
207 | 189 |
passwordLabel.setText("Password:"); |
... | ... | |
251 | 233 |
text_username.removeModifyListener(this); |
252 | 234 |
text_password.removeModifyListener(this); |
253 | 235 |
} |
254 |
/** |
|
255 |
* Create a radio button group to select a nomenclatural code from |
|
256 |
*/ |
|
257 |
private void createNomenclaturalCodeForm() { |
|
258 |
nomenclaturalCodeGroup = new Group(composite , SWT.NONE); |
|
259 |
nomenclaturalCodeGroup.setLayout(new GridLayout()); |
|
260 |
|
|
261 |
nomenclaturalCode = dataSource != null ? dataSource.getNomenclaturalCode() : PreferencesUtil.getPreferredNomenclaturalCode(true); |
|
262 |
|
|
263 |
for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) { |
|
264 |
Button button = new Button(nomenclaturalCodeGroup, SWT.RADIO); |
|
265 |
button.setText(NomenclaturalCodeHelper.getDescription(code)); |
|
266 |
button.setData(code); |
|
267 |
if (nomenclaturalCode != null) { |
|
268 |
button.setSelection(nomenclaturalCode.equals(code)); |
|
269 |
} |
|
270 |
button.addSelectionListener(new SelectionAdapter() { |
|
271 |
@Override |
|
272 |
public void widgetSelected(SelectionEvent e) { |
|
273 |
nomenclaturalCode = (NomenclaturalCode) e.widget.getData(); |
|
274 |
modifyText(null); |
|
275 |
} |
|
276 |
}); |
|
277 |
} |
|
278 |
} |
|
279 | 236 |
|
280 | 237 |
public void testDbConfiguration(){ |
281 | 238 |
testDbConfiguration(false); |
... | ... | |
345 | 302 |
password = text_password.getText(); |
346 | 303 |
} |
347 | 304 |
|
348 |
/* (non-Javadoc) |
|
349 |
* @see org.eclipse.jface.wizard.WizardPage#getNextPage() |
|
350 |
*/ |
|
351 | 305 |
/** {@inheritDoc} */ |
352 | 306 |
@Override |
353 | 307 |
public IWizardPage getNextPage() { |
... | ... | |
386 | 340 |
return name; |
387 | 341 |
} |
388 | 342 |
|
389 |
/* (non-Javadoc) |
|
390 |
* @see org.eclipse.swto.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) |
|
391 |
*/ |
|
392 | 343 |
/** {@inheritDoc} */ |
393 | 344 |
@Override |
394 | 345 |
public void modifyText(ModifyEvent e) { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceH2WizardPage.java | ||
---|---|---|
18 | 18 |
* |
19 | 19 |
* @author n.hoffmann |
20 | 20 |
* @created 19.05.2009 |
21 |
* @version 1.0 |
|
22 | 21 |
*/ |
23 | 22 |
public class CdmDataSourceH2WizardPage extends CdmDataSourceCredentialsWizardPage { |
24 | 23 |
|
... | ... | |
44 | 43 |
setTitle("Enter credentials for embedded H2 database"); |
45 | 44 |
} |
46 | 45 |
|
47 |
/* (non-Javadoc) |
|
48 |
* @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#createDatabaseForm() |
|
49 |
*/ |
|
50 | 46 |
/** {@inheritDoc} */ |
51 | 47 |
@Override |
52 | 48 |
public void createDatabaseForm() { |
53 | 49 |
// no more fields needed for embedded H2 |
54 | 50 |
} |
55 | 51 |
|
56 |
/* (non-Javadoc) |
|
57 |
* @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#updateLocation() |
|
58 |
*/ |
|
59 | 52 |
/** {@inheritDoc} */ |
60 | 53 |
@Override |
61 | 54 |
public void updateLocation() { |
62 | 55 |
// nothing to do, no location data provided |
63 | 56 |
} |
64 | 57 |
|
65 |
/* (non-Javadoc) |
|
66 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateDataSource() |
|
67 |
*/ |
|
68 | 58 |
/** {@inheritDoc} */ |
69 | 59 |
@Override |
70 | 60 |
public void updateDataSource() { |
... | ... | |
73 | 63 |
if(dataSource == null) { |
74 | 64 |
setDataSource(CdmDataSource.NewH2EmbeddedInstance(database, |
75 | 65 |
username, |
76 |
password, |
|
77 |
nomenclaturalCode)); |
|
66 |
password)); |
|
78 | 67 |
} else { |
79 | 68 |
dataSource.setName(name); |
80 | 69 |
dataSource.setDatabase(database); |
81 | 70 |
dataSource.setUsername(username); |
82 | 71 |
dataSource.setPassword(password); |
83 |
dataSource.setNomenclaturalCode(nomenclaturalCode); |
|
84 | 72 |
} |
85 | 73 |
} |
86 | 74 |
|
87 |
/* (non-Javadoc) |
|
88 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#checkPageComplete() |
|
89 |
*/ |
|
90 | 75 |
/** {@inheritDoc} */ |
91 | 76 |
@Override |
92 | 77 |
public void checkPageComplete() { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceMySQLWizardPage.java | ||
---|---|---|
26 | 26 |
* |
27 | 27 |
* @author n.hoffmann |
28 | 28 |
* @created 19.05.2009 |
29 |
* @version 1.0 |
|
30 | 29 |
*/ |
31 | 30 |
public class CdmDataSourceMySQLWizardPage extends CdmDataSourceCredentialsWizardPage { |
32 | 31 |
|
... | ... | |
65 | 64 |
|
66 | 65 |
} |
67 | 66 |
|
68 |
/* (non-Javadoc) |
|
69 |
* @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#createDatabaseForm() |
|
70 |
*/ |
|
71 | 67 |
/** {@inheritDoc} */ |
72 | 68 |
@Override |
73 | 69 |
public void createDatabaseForm() { |
... | ... | |
99 | 95 |
|
100 | 96 |
} |
101 | 97 |
|
102 |
/* (non-Javadoc) |
|
103 |
* @see eu.etaxonomy.taxeditor.store.datasource.CdmDataSourceCredentialsWizardPage#updateLocation() |
|
104 |
*/ |
|
105 | 98 |
/** {@inheritDoc} */ |
106 | 99 |
@Override |
107 | 100 |
public void updateLocation() { |
... | ... | |
116 | 109 |
} |
117 | 110 |
} |
118 | 111 |
|
119 |
/* (non-Javadoc) |
|
120 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateDataSource() |
|
121 |
*/ |
|
122 | 112 |
/** {@inheritDoc} */ |
123 | 113 |
@Override |
124 | 114 |
public void updateDataSource() { |
... | ... | |
129 | 119 |
database, |
130 | 120 |
port, |
131 | 121 |
username, |
132 |
password, |
|
133 |
nomenclaturalCode)); |
|
122 |
password)); |
|
134 | 123 |
} else { |
135 | 124 |
dataSource.setName(name); |
136 | 125 |
dataSource.setServer(server); |
... | ... | |
138 | 127 |
dataSource.setPort(port); |
139 | 128 |
dataSource.setUsername(username); |
140 | 129 |
dataSource.setPassword(password); |
141 |
dataSource.setNomenclaturalCode(nomenclaturalCode); |
|
142 | 130 |
} |
143 | 131 |
} |
144 | 132 |
|
145 |
/* (non-Javadoc) |
|
146 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#checkPageComplete() |
|
147 |
*/ |
|
148 | 133 |
/** {@inheritDoc} */ |
149 | 134 |
@Override |
150 | 135 |
public void checkPageComplete() { |
... | ... | |
162 | 147 |
super.checkPageComplete(); |
163 | 148 |
} |
164 | 149 |
|
165 |
/* (non-Javadoc) |
|
166 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#init() |
|
167 |
*/ |
|
168 | 150 |
/** {@inheritDoc} */ |
169 | 151 |
@Override |
170 | 152 |
public void init() { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourcePostgreSQLServerWizardPage.java | ||
---|---|---|
15 | 15 |
|
16 | 16 |
/** |
17 | 17 |
* @author n.hoffmann |
18 |
* |
|
19 | 18 |
*/ |
20 | 19 |
public class CdmDataSourcePostgreSQLServerWizardPage extends |
21 | 20 |
CdmDataSourceCredentialsWizardPage { |
... | ... | |
48 | 47 |
|
49 | 48 |
} |
50 | 49 |
|
51 |
/* (non-Javadoc) |
|
52 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#createDatabaseForm() |
|
53 |
*/ |
|
54 | 50 |
@Override |
55 | 51 |
public void createDatabaseForm() { |
56 | 52 |
// Create group composite for location data |
... | ... | |
81 | 77 |
|
82 | 78 |
} |
83 | 79 |
|
84 |
/* (non-Javadoc) |
|
85 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateLocation() |
|
86 |
*/ |
|
87 | 80 |
@Override |
88 | 81 |
public void updateLocation() { |
89 | 82 |
server = text_server.getText(); |
... | ... | |
97 | 90 |
} |
98 | 91 |
} |
99 | 92 |
|
100 |
/* (non-Javadoc) |
|
101 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#updateDataSource() |
|
102 |
*/ |
|
103 | 93 |
@Override |
104 | 94 |
public void updateDataSource() { |
105 | 95 |
|
... | ... | |
111 | 101 |
database, |
112 | 102 |
port, |
113 | 103 |
username, |
114 |
password, |
|
115 |
nomenclaturalCode)); |
|
104 |
password)); |
|
116 | 105 |
} else { |
117 | 106 |
dataSource.setName(name); |
118 | 107 |
dataSource.setServer(server); |
... | ... | |
120 | 109 |
dataSource.setPort(port); |
121 | 110 |
dataSource.setUsername(username); |
122 | 111 |
dataSource.setPassword(password); |
123 |
dataSource.setNomenclaturalCode(nomenclaturalCode); |
|
124 | 112 |
} |
125 | 113 |
} |
126 | 114 |
|
127 |
/* (non-Javadoc) |
|
128 |
* @see eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceCredentialsWizardPage#init() |
|
129 |
*/ |
|
130 | 115 |
/** {@inheritDoc} */ |
131 | 116 |
@Override |
132 | 117 |
public void init() { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceLabelProvider.java | ||
---|---|---|
26 | 26 |
* |
27 | 27 |
* @author n.hoffmann |
28 | 28 |
* @created 14.04.2009 |
29 |
* @version 1.0 |
|
30 | 29 |
*/ |
31 | 30 |
public class CdmDataSourceLabelProvider extends LabelProvider implements ITableLabelProvider { |
32 | 31 |
|
33 |
/* |
|
34 |
* (non-Javadoc) |
|
35 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
|
36 |
*/ |
|
37 | 32 |
/** {@inheritDoc} */ |
38 | 33 |
public Image getColumnImage(Object element, int columnIndex) { |
39 | 34 |
if(columnIndex == 0){ |
... | ... | |
47 | 42 |
return null; |
48 | 43 |
} |
49 | 44 |
|
50 |
/* |
|
51 |
* (non-Javadoc) |
|
52 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) |
|
53 |
*/ |
|
54 | 45 |
/** {@inheritDoc} */ |
55 | 46 |
public String getColumnText(Object element, int columnIndex) { |
56 | 47 |
CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) element; |
... | ... | |
80 | 71 |
} else { |
81 | 72 |
return DatabaseTypeEnum.MySQL.getName(); |
82 | 73 |
} |
83 |
case 6: |
|
84 |
if (dataSource.getNomenclaturalCode() == null) { |
|
85 |
return ""; |
|
86 |
} |
|
87 |
return dataSource.getNomenclaturalCode().name(); |
|
74 |
//TODO 6 was nomenclatural code, do we need to change following numbers? |
|
88 | 75 |
case 7: |
89 | 76 |
return container.getMetaData(MetaDataPropertyName.DB_CREATE_DATE); |
90 | 77 |
case 8: |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceViewPart.java | ||
---|---|---|
57 | 57 |
private static final Logger logger = Logger.getLogger(CdmDataSourceViewPart.class); |
58 | 58 |
|
59 | 59 |
private class ContextListener extends ContextListenerAdapter{ |
60 |
/* (non-Javadoc) |
|
61 |
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) |
|
62 |
*/ |
|
63 | 60 |
@Override |
64 | 61 |
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) { |
65 | 62 |
monitor.subTask("Refreshing Datasource View"); //$NON-NLS-1$ |
66 | 63 |
viewer.refresh(); |
67 | 64 |
} |
68 | 65 |
|
69 |
/* (non-Javadoc) |
|
70 |
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) |
|
71 |
*/ |
|
72 | 66 |
@Override |
73 | 67 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
74 | 68 |
monitor.subTask("Refreshing Datasource View"); //$NON-NLS-1$ |
75 | 69 |
viewer.refresh(); |
76 | 70 |
} |
77 | 71 |
|
78 |
/* (non-Javadoc) |
|
79 |
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) |
|
80 |
*/ |
|
81 | 72 |
@Override |
82 | 73 |
public void contextStart(IMemento memento, IProgressMonitor monitor) { |
83 | 74 |
monitor.subTask("Refreshing Datasource View"); //$NON-NLS-1$ |
... | ... | |
97 | 88 |
this.cdmSources = cdmSources; |
98 | 89 |
} |
99 | 90 |
|
100 |
/* (non-Javadoc) |
|
101 |
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) |
|
102 |
*/ |
|
103 | 91 |
@Override |
104 | 92 |
public IStatus run(final IProgressMonitor monitor) { |
105 | 93 |
try{ |
... | ... | |
260 | 248 |
viewer.getControl().setFocus(); |
261 | 249 |
} |
262 | 250 |
|
263 |
|
|
264 |
/* (non-Javadoc) |
|
265 |
* @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean) |
|
266 |
*/ |
|
267 | 251 |
/** {@inheritDoc} */ |
268 | 252 |
@Override |
269 | 253 |
public void showBusy(boolean busy) { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceViewerComparator.java | ||
---|---|---|
16 | 16 |
import eu.etaxonomy.cdm.config.ICdmSource; |
17 | 17 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
18 | 18 |
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName; |
19 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
20 | 19 |
|
21 | 20 |
/** |
22 | 21 |
* @author n.hoffmann |
23 | 22 |
* @created Dec 8, 2010 |
24 |
* @version 1.0 |
|
25 | 23 |
*/ |
26 | 24 |
public class CdmDataSourceViewerComparator extends ViewerComparator { |
27 | 25 |
|
... | ... | |
45 | 43 |
} |
46 | 44 |
} |
47 | 45 |
|
48 |
/* (non-Javadoc) |
|
49 |
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
|
50 |
*/ |
|
51 | 46 |
@Override |
52 | 47 |
public int compare(Viewer viewer, Object e1, Object e2) { |
53 | 48 |
CdmMetaDataAwareDataSourceContainer d1 = (CdmMetaDataAwareDataSourceContainer) e1; |
... | ... | |
59 | 54 |
int result = 0; |
60 | 55 |
|
61 | 56 |
switch (propertyIndex) { |
62 |
case 10:
|
|
57 |
case 9:
|
|
63 | 58 |
result = d1.getMetaData(MetaDataPropertyName.DB_CREATE_NOTE).compareTo(d2.getMetaData(MetaDataPropertyName.DB_CREATE_NOTE)); |
64 | 59 |
break; |
65 |
case 9:
|
|
60 |
case 8:
|
|
66 | 61 |
// is compatible |
67 | 62 |
break; |
68 |
case 8: |
|
69 |
result = d1.getMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION).compareTo(d2.getMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION)); |
|
70 |
break; |
|
71 | 63 |
case 7: |
72 |
result = d1.getMetaData(MetaDataPropertyName.DB_CREATE_DATE).compareTo(d2.getMetaData(MetaDataPropertyName.DB_CREATE_DATE));
|
|
64 |
result = d1.getMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION).compareTo(d2.getMetaData(MetaDataPropertyName.DB_SCHEMA_VERSION));
|
|
73 | 65 |
break; |
74 | 66 |
case 6: |
75 |
// is running
|
|
67 |
result = d1.getMetaData(MetaDataPropertyName.DB_CREATE_DATE).compareTo(d2.getMetaData(MetaDataPropertyName.DB_CREATE_DATE));
|
|
76 | 68 |
break; |
77 | 69 |
case 5: |
78 |
NomenclaturalCode code1 = d1.getCdmSource().getNomenclaturalCode(); |
|
79 |
NomenclaturalCode code2 = d2.getCdmSource().getNomenclaturalCode(); |
|
80 |
if (code1 != null && code2 != null) { |
|
81 |
result = code1.compareTo(code2); |
|
82 |
} |
|
70 |
// is running |
|
83 | 71 |
break; |
84 | 72 |
case 4: |
85 | 73 |
if(cs1 instanceof ICdmDataSource && cs2 instanceof ICdmDataSource) { |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
29 | 29 |
import eu.etaxonomy.cdm.api.application.CdmDataChangeService; |
30 | 30 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher; |
31 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
32 | 31 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager; |
33 | 32 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher; |
34 | 33 |
import eu.etaxonomy.taxeditor.remoting.source.CdmPersistentRemoteSource; |
... | ... | |
66 | 65 |
host, |
67 | 66 |
httpPort, |
68 | 67 |
contextPath, |
69 |
NomenclaturalCode.ICNAFP, |
|
70 | 68 |
user, |
71 | 69 |
password); |
72 | 70 |
} catch (Exception e) { |
... | ... | |
88 | 86 |
} |
89 | 87 |
|
90 | 88 |
|
91 |
public static void initializeController(String sourceName, String host, int port, String contextPath, NomenclaturalCode ncode, String username, String password) {
|
|
89 |
public static void initializeController(String sourceName, String host, int port, String contextPath, String username, String password) { |
|
92 | 90 |
|
93 | 91 |
if(CdmApplicationState.getCurrentAppConfig() != null) { |
94 | 92 |
return; |
95 | 93 |
} |
96 |
cdmRemoteSource = CdmRemoteSource.NewInstance(sourceName, host, port, contextPath, ncode);
|
|
94 |
cdmRemoteSource = CdmRemoteSource.NewInstance(sourceName, host, port, contextPath); |
|
97 | 95 |
CdmApplicationRemoteController remoteApplicationController = |
98 | 96 |
CdmApplicationRemoteController.NewInstance(cdmRemoteSource, |
99 | 97 |
null, |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java | ||
---|---|---|
14 | 14 |
import org.springframework.remoting.RemoteAccessException; |
15 | 15 |
|
16 | 16 |
import eu.etaxonomy.cdm.config.CdmSourceException; |
17 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
18 | 17 |
import eu.etaxonomy.taxeditor.lazyloading.RemotePersistentCollectionTest; |
19 | 18 |
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource; |
20 | 19 |
|
... | ... | |
29 | 28 |
CdmRemoteSource inactiveCrs = CdmRemoteSource.NewInstance(sourceName, |
30 | 29 |
host, |
31 | 30 |
808080, |
32 |
contextPath, |
|
33 |
NomenclaturalCode.ICNAFP); |
|
31 |
contextPath); |
|
34 | 32 |
try { |
35 | 33 |
String dbSchemaVersion = inactiveCrs.getDbSchemaVersion(); |
36 | 34 |
Assert.fail("getDbSchemaVersion() on inactive cdm server should have thrown RemoteAccessException"); |
... | ... | |
66 | 64 |
CdmRemoteSource activeCrs = CdmRemoteSource.NewInstance(sourceName, |
67 | 65 |
host, |
68 | 66 |
httpPort, |
69 |
contextPath, |
|
70 |
NomenclaturalCode.ICNAFP); |
|
67 |
contextPath); |
|
71 | 68 |
String dbSchemaVersion = ""; |
72 | 69 |
try { |
73 | 70 |
dbSchemaVersion = activeCrs.getDbSchemaVersion(); |
Also available in: Unified diff
ref #3658 remove nomenclatural code from datasources