use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepository method containsOrganization.
@Override
public boolean containsOrganization(String organizationId) throws TException {
checkOrganizationId(organizationId);
Statement query = createQueryToCheckIfOrgExists(organizationId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to query for existence of Organization [{}]", organizationId, ex);
throw new OperationFailedException("Could not query for Organization: " + ex.getMessage());
}
Row row = results.one();
checkRowIsPresent(row);
long count = row.getLong(0);
return count > 0L;
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepository method getOrganization.
@Override
public Organization getOrganization(String organizationId) throws TException {
checkOrganizationId(organizationId);
Statement query = createQueryToGetOrganization(organizationId);
ResultSet results;
try {
results = cassandra.execute(query);
} catch (Exception ex) {
LOG.error("Failed to query for Organization [{}]", organizationId, ex);
throw new OperationFailedException("Could not get Organization: " + ex.getMessage());
}
Row row = results.one();
checkRowIsPresent(row);
Organization org = organizationMapper.apply(row);
return org;
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepository method deleteMember.
@Override
public void deleteMember(String organizationId, String userId) throws TException {
checkOrganizationId(organizationId);
checkUserId(userId);
Statement deleteStatement = createStatmentToDeleteMember(organizationId, userId);
try {
cassandra.execute(deleteStatement);
} catch (Exception ex) {
LOG.error("Failed to delete Member [{}] in Organization [{}]", userId, organizationId, ex);
throw new OperationFailedException("Failed to delete Member in Organization: " + ex.getMessage());
}
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepository method deleteAllMembers.
@Override
public void deleteAllMembers(String organizationId) throws TException {
checkOrganizationId(organizationId);
Statement deleteStatement = createStatementToDeleteAllMembers(organizationId);
try {
cassandra.execute(deleteStatement);
} catch (Exception ex) {
LOG.error("Failed to delete all Members in Organization [{}]", organizationId, ex);
throw new OperationFailedException("Failed to delete all members in Organization: " + ex.getMessage());
}
}
use of tech.aroma.thrift.exceptions.OperationFailedException in project aroma-data-operations by RedRoma.
the class CassandraOrganizationRepository method saveOrganization.
@Override
public void saveOrganization(Organization organization) throws TException {
checkThat(organization).throwing(InvalidArgumentException.class).is(validOrganization());
Statement insertStatement = createStatementToInsert(organization);
try {
cassandra.execute(insertStatement);
} catch (Exception ex) {
LOG.error("Failed to save Organization in Cassandra: [{}]", organization, ex);
throw new OperationFailedException("Failed to save Organization: " + ex.getMessage());
}
}
Aggregations