*/
public static int retrievePriorityForDatabase(WGAConfiguration config, VirtualHost vHost, String dbkey) {
// first try - check if default db is requested
if (vHost.getDefaultDatabase() != null) {
ConfigBean bean = (ConfigBean) config.getByUid(vHost.getDefaultDatabase());
if (bean != null && bean instanceof ContentDatabase) {
ContentDatabase database = (ContentDatabase) bean;
if (dbkey.equalsIgnoreCase(database.getKey())) {
return 0;
}
}
}
// second try - check allowed db keys
int i = 0;
for (String uid : vHost.getAllowedDatabases()) {
i++;
if (uid.equals(VirtualHost.UID_ALL_DATABASES)) {
return Integer.MAX_VALUE;
}
ConfigBean dbBean = (ConfigBean) config.getByUid(uid);
if (dbBean != null && dbBean instanceof ContentDatabase) {
ContentDatabase database = (ContentDatabase) dbBean;
if (dbkey.equalsIgnoreCase(database.getKey())) {
return i;
}