working on backend-side translations

This commit is contained in:
2025-12-13 13:34:08 +01:00
parent d210207b3b
commit eba34f1002
4 changed files with 29 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ import static de.srsoftware.tools.jdbc.Query.Dialect.SQLITE;
import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
import static de.srsoftware.umbrella.company.Constants.*;
import static de.srsoftware.umbrella.core.Constants.*;
import static de.srsoftware.umbrella.core.Errors.*;
import static de.srsoftware.umbrella.core.Field.*;
import static de.srsoftware.umbrella.core.Field.COMPANY_ID;
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.databaseException;
@@ -65,8 +66,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
stmt.execute();
stmt.close();
} catch (SQLException e) {
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_COMPANIES, e);
throw new RuntimeException(e);
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_COMPANIES);
}
}
@@ -77,8 +77,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
stmt.execute();
stmt.close();
} catch (SQLException e) {
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_COMPANIES_USERS, e);
throw new RuntimeException(e);
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_COMPANIES);
}
}
@@ -91,7 +90,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
.execute(db)
.close();
} catch (SQLException e) {
throw databaseException("Failed to assign user {0} to company {1}");
throw databaseException(FAILED_TO_ASSIGN_USER_TO_COMPANY);
}
}
@@ -102,7 +101,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
delete().from(TABLE_COMPANIES).where(ID,equal(companyId)).execute(db);
return companyId;
} catch (SQLException e) {
throw databaseException("Failed to remove company {0}",companyId);
throw databaseException(FAILED_TO_DROP_COMPANY,companyId);
}
}
@@ -111,7 +110,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
try {
delete().from(TABLE_COMPANIES_USERS).where(COMPANY_ID,equal(companyId)).where(USER_ID,equal(userId)).execute(db);
} catch (SQLException e) {
throw databaseException("Failed to remove user {0} from company {1}",userId,companyId);
throw databaseException(FAILED_TO_REMOVE_USER_FROM_COMPANY,userId,companyId);
}
}
@@ -124,7 +123,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
rs.close();
return ids;
} catch (SQLException e) {
throw databaseException("Failed to load members of company {0}",companyId);
throw databaseException(FAILED_TO_LOAD_COMPANY_MEMBERS,companyId);
}
}