public ServiceAuthorization createAuthorization(ProjectId project, ServiceAuthorization authorization)
throws RepositoryException {
try {
ServiceType serviceType = new ServiceType(authorization.serviceType);
JdbcConnection connection = connectionProvider.get();
int serviceId = JdbcRepositoryHelpers.getServiceKey(connection, serviceType);
int projectId = JdbcRepositoryHelpers.getProjectKey(connection, project);
final String sql = "INSERT INTO service_authorizations (service, project, data) VALUES (?, ?, ?)";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = null;
try {
ps.setInt(1, serviceId);
ps.setInt(2, projectId);
ps.setString(3, authorization.data);