use of org.platformlayer.RepositoryException in project platformlayer by platformlayer.
the class JdbcUserRepository method listAllServiceAccounts.
@Override
@JdbcTransaction
public List<ServiceAccountEntity> listAllServiceAccounts(byte[] filterPublicKey) throws RepositoryException {
DbHelper db = new DbHelper();
try {
List<ServiceAccountEntity> serviceAccounts = db.queries.listAllServiceAccounts();
List<ServiceAccountEntity> ret = Lists.newArrayList();
for (ServiceAccountEntity serviceAccount : serviceAccounts) {
if (filterPublicKey != null) {
if (!Objects.equal(filterPublicKey, serviceAccount.publicKeyData)) {
continue;
}
}
ret.add(serviceAccount);
}
return ret;
} catch (SQLException e) {
throw new RepositoryException("Error listing service accounts", e);
} finally {
db.close();
}
}
Aggregations