working on backend-side translations
This commit is contained in:
@@ -8,6 +8,8 @@ import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
|
||||
import static de.srsoftware.umbrella.bookmarks.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Constants.ERROR_FAILED_CREATE_TABLE;
|
||||
import static de.srsoftware.umbrella.core.Errors.*;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.databaseException;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
@@ -52,8 +54,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_URL_COMMENTS, e);
|
||||
throw new RuntimeException(e);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URL_COMMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +65,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_URLS, e);
|
||||
throw new RuntimeException(e);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URLS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARKS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARKS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
if (result != null) return result;
|
||||
throw UmbrellaException.notFound("no_bookmark_for_urlid",id);
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
query.execute(db).close();
|
||||
return Bookmark.of(urlId,url,comment,timestamp);
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to store url");
|
||||
throw databaseException(FAILED_TO_STORE_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package de.srsoftware.umbrella.core;
|
||||
|
||||
public class Errors {
|
||||
public static final String FAILED_TO_ASSIGN_USER_TO_COMPANY = "failed_to_assign_user_to_company";
|
||||
public static final String FAILED_TO_CREATE_STATE = "failed_to_create_state";
|
||||
public static final String FAILED_TO_CREATE_TABLE = "failed_to_create_table";
|
||||
public static final String FAILED_TO_DROP_COMPANY = "failed_to_drop_company";
|
||||
public static final String FAILED_TO_DROP_MEMBER_FROM_PROJECT = "failed_to_drop_member_from_project";
|
||||
public static final String FAILED_TO_INSERT_PROJECT = "failed_to_insert_project";
|
||||
public static final String FAILED_TO_LOAD_BOOKMARK = "failed_to_load_bookmark";
|
||||
public static final String FAILED_TO_LOAD_BOOKMARKS = "failed_to_load_bookmarks";
|
||||
public static final String FAILED_TO_LOAD_COMPANY_MEMBERS = "failed_to_load_company_members";
|
||||
public static final String FAILED_TO_LOAD_CONTACT_BY_ID = "failed_to_load_contact_by_id";
|
||||
public static final String FAILED_TO_LOAD_CONTACTS_OF_USER = "failed_to_load_contacts_of_user";
|
||||
public static final String FAILED_TO_LOAD_ITEMS = "failed_to_load_items";
|
||||
public static final String FAILED_TO_LOAD_PROJECT = "failed_to_load_project";
|
||||
public static final String FAILED_TO_LOAD_PROJECT_MEMBERS = "failed_to_load_project_members";
|
||||
public static final String FAILED_TO_REMOVE_USER_FROM_COMPANY = "failed_to_remove_user_from_company";
|
||||
public static final String FAILED_TO_STORE_URL = "failed_to_store_url";
|
||||
public static final String FAILED_TO_UPDATE_PROJECT = "failed_to_update_project";
|
||||
}
|
||||
|
||||
@@ -95,15 +95,22 @@
|
||||
|
||||
"failed": "fehlgeschlagen",
|
||||
"failed_login_attempts" : "Account nach {attempts} fehlgeschlagenen Logins gesperrt bis {release_time}",
|
||||
"failed_to_assign_user_to_company": "Failed to assign user {0} to company {1}",
|
||||
"failed_to_create_state": "Failed to create custom state!",
|
||||
"failed_to_create_table": "Failed to create table `{0}`",
|
||||
"failed_to_drop_company": "Failed to remove company {0}",
|
||||
"failed_to_drop_member_from_project": "Failed to delete member (userId = {0} from project {1}",
|
||||
"failed_to_insert_project": "Failed to insert project into database",
|
||||
"failed_to_load_bookmark": "Failed to load bookmark",
|
||||
"failed_to_load_bookmarks": "Failed to load bookmark list",
|
||||
"failed_to_load_company_members": "Failed to load members of company {0}",
|
||||
"failed_to_load_contact_by_id": "Failed to load contact with id = {0}",
|
||||
"failed_to_load_contacts_of_user": "Failed to load contacts of user {0}",
|
||||
"failed_to_load_items": "Failed to load items from database",
|
||||
"failed_to_load_project": "Failed to load project from database",
|
||||
"failed_to_load_project_members": "Failed to load members of project",
|
||||
"failed_to_remove_user_from_company": "Failed to remove user {0} from company {1}",
|
||||
"failed_to_store_url": "Failed to store url",
|
||||
"failed_to_update_project": "Failed to update project in database",
|
||||
"family_name": "Familenname",
|
||||
"file": "Datei",
|
||||
|
||||
Reference in New Issue
Block a user