Revision 0bd095d9
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java | ||
---|---|---|
124 | 124 |
* |
125 | 125 |
* @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object. |
126 | 126 |
*/ |
127 |
protected static CdmStore getDefault() {
|
|
127 |
protected static CdmStore getDefault(boolean connecting){
|
|
128 | 128 |
if (instance != null && instance.isConnected) { |
129 | 129 |
return instance; |
130 | 130 |
} else{// if (instance == null || !instance.isConnected) { |
131 |
|
|
132 |
MessagingUtils.dataSourceNotAvailableWarningDialog(instance); |
|
131 |
if (connecting){ |
|
132 |
MessagingUtils.dataSourceNotAvailableWarningDialog(instance); |
|
133 |
}else{ |
|
134 |
MessagingUtils.noDataSourceWarningDialog(instance); |
|
135 |
} |
|
133 | 136 |
|
134 | 137 |
|
135 | 138 |
return null; |
136 | 139 |
} |
137 | 140 |
} |
141 |
/** |
|
142 |
* <p> |
|
143 |
* getDefault |
|
144 |
* </p> |
|
145 |
* |
|
146 |
* @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object. |
|
147 |
*/ |
|
148 |
protected static CdmStore getDefault(){ |
|
149 |
return getDefault(false); |
|
150 |
} |
|
138 | 151 |
|
139 | 152 |
/** |
140 | 153 |
* Initialize the with the last edited datasource |
... | ... | |
200 | 213 |
if(isActive()) { |
201 | 214 |
// before we connect we clear the entity caches and the sessions |
202 | 215 |
CdmRemoteCacheManager.removeEntityCaches(); |
203 |
if(getCurrentSessionManager() != null) { |
|
204 |
getCurrentSessionManager().disposeAll(); |
|
216 |
if(getCurrentSessionManager(true) != null) {
|
|
217 |
getCurrentSessionManager(true).disposeAll();
|
|
205 | 218 |
} |
206 | 219 |
} |
207 | 220 |
MessagingUtils.info("Connecting to datasource: " + cdmSource); |
... | ... | |
342 | 355 |
return mockCdmEntitySessionManager; |
343 | 356 |
} |
344 | 357 |
} |
345 |
|
|
346 | 358 |
public static ICdmEntitySessionManager getCurrentSessionManager() { |
347 |
if (getDefault() != null) { |
|
348 |
return getDefault().getSessionManager(); |
|
359 |
return getCurrentSessionManager(false); |
|
360 |
} |
|
361 |
|
|
362 |
|
|
363 |
public static ICdmEntitySessionManager getCurrentSessionManager(boolean connecting) { |
|
364 |
if (getDefault(connecting) != null) { |
|
365 |
return getDefault(connecting).getSessionManager(); |
|
349 | 366 |
} |
350 | 367 |
return null; |
351 | 368 |
|
Also available in: Unified diff
fix #5971: admin menu is visible only if connected and user has role manager