List <Account> accounts = MapperRegistry.getInstance().getAccountManagement().getAccounts(loggedInUser);
if (accounts != null && !accounts.isEmpty()) {
for (Account acc: accounts) {
if (acc.getConnection().getId().equals(xCon.getId())) {
if (acc instanceof PaloAccountImpl) {
Connection con = null;
try {
ServerConnectionPool pool = ConnectionPoolManager.getInstance().getPool(acc, sessionId);
con = pool.getConnection("getDatabases");
((PaloAccountImpl) acc).setConnection(con);
} catch (Throwable t) {
ConnectionPoolManager.getInstance().disconnect(acc, sessionId, "getDatabases");
throw new DbOperationFailedException(t.getMessage());
}
List <XDatabase> databases = new ArrayList<XDatabase>();
for (Database db: con.getDatabases()) {
if (db.getType() != Database.TYPE_SYSTEM &&
db.getType() != Database.TYPE_ATTRIBUTE &&
db.getType() != Database.TYPE_USER_INFO &&
!db.getName().startsWith("#")) {
databases.add((XDatabase) XConverter.createX(db));