complete MetaDataTable and MetaDataColumn

This commit is contained in:
Thomas Peetz
2025-01-20 15:40:45 +01:00
parent 60fba0d3e9
commit 65288a53a1
16 changed files with 257 additions and 219 deletions
@@ -332,5 +332,89 @@ public class SetupModuleAdmin implements ApplicationListener<ContextRefreshedEve
metaDataService.getColumn(cardTable, "card_set_id", "card_set_id", "TEXT", null, 7, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(cardTable, "rooster_id", "rooster_id", "TEXT", null, 8, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(cardTable, "vendor_id", "vendor_id", "TEXT", null, 9, Boolean.FALSE, "", Boolean.FALSE, null);
MetaDataTable userTable = metaDataService.getTable("user");
metaDataService.getColumn(userTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "first_name", "first_name", "TEXT", null, 5, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "last_name", "last_name", "TEXT", null, 6, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "user_name", "user_name", "TEXT", "UNIQUE", 7, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "email", "email", "TEXT", null, 8, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "password", "password", "TEXT", null, 9, Boolean.FALSE, "Password", Boolean.FALSE, null);
metaDataService.getColumn(userTable, "enabled", "enabled", "BOOLEAN", null, 10, Boolean.TRUE, "", Boolean.TRUE, null);
MetaDataTable tokenTable = metaDataService.getTable("token");
metaDataService.getColumn(tokenTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "token", "token", "TEXT", null, 5, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "name", "name", "TEXT", null, 6, Boolean.TRUE, "Name", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "last_used_date", "used", "TIMESTAMP", null, 7, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(tokenTable, "enabled", "enabled", "BOOLEAN", null, 8, Boolean.TRUE, "", Boolean.TRUE, "Enabled");
metaDataService.getColumn(tokenTable, "user_id", "user_id", "TEXT", null, 9, Boolean.TRUE, "User", Boolean.FALSE, null, "user_name");
MetaDataTable roleTable = metaDataService.getTable("role");
metaDataService.getColumn(roleTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(roleTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(roleTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(roleTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(roleTable, "name", "name", "TEXT", null, 5, Boolean.TRUE, "", Boolean.FALSE, null);
MetaDataTable authorizationMatrix = metaDataService.getTable("authorization_matrix");
metaDataService.getColumn(authorizationMatrix, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(authorizationMatrix, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(authorizationMatrix, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(authorizationMatrix, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(authorizationMatrix, "user_id", "user_id", "TEXT", null, 5, Boolean.TRUE, "User", Boolean.FALSE, null, "user_name");
metaDataService.getColumn(authorizationMatrix, "role_id", "role_id", "TEXT", null, 6, Boolean.TRUE, "Role", Boolean.FALSE, null, "name");
MetaDataTable moduleDataTable = metaDataService.getTable("module_data");
metaDataService.getColumn(moduleDataTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(moduleDataTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(moduleDataTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(moduleDataTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(moduleDataTable, "module_name", "module_name", "TEXT", "UNIQUE", 5, Boolean.TRUE, "Module", Boolean.FALSE, null);
metaDataService.getColumn(moduleDataTable, "import_data", "import_data", "BOOLEAN", null, 6, Boolean.TRUE, "Import Data?", Boolean.TRUE, "Import Data");
MetaDataTable mailAccountTable = metaDataService.getTable("mail_account");
metaDataService.getColumn(mailAccountTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "host", "host", "TEXT", null, 5, Boolean.TRUE, "Host", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "port", "port", "LONG", null, 6, Boolean.TRUE, "Port", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "protocol", "protocol", "TEXT", null, 7, Boolean.TRUE, "Protocol", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "user_name", "user_name", "TEXT", null, 8, Boolean.TRUE, "Username", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "password", "password", "TEXT", null, 9, Boolean.FALSE, "Password", Boolean.FALSE, null);
metaDataService.getColumn(mailAccountTable, "start_tls", "start_tls", "BOOLEAN", null, 10, Boolean.TRUE, "StartTLS", Boolean.TRUE, "StartTLS");
MetaDataTable mailTable = metaDataService.getTable("mail");
metaDataService.getColumn(mailTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "folder", "folder", "TEXT", null, 5, Boolean.TRUE, "Folder", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "subject", "subject", "TEXT", null, 6, Boolean.TRUE, "Subject", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "body", "body", "TEXT", null, 7, Boolean.FALSE, "Body", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "sent_date", "created", "TIMESTAMP", null, 8, Boolean.FALSE, "Gesendet", Boolean.FALSE, null);
metaDataService.getColumn(mailTable, "received_date", "created", "TIMESTAMP", null, 9, Boolean.FALSE, "Empfangen", Boolean.FALSE, null);
MetaDataTable metaDataTableTable = metaDataService.getTable("meta_data_table");
metaDataService.getColumn(metaDataTableTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.TRUE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataTableTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataTableTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataTableTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataTableTable, "table_name", "table_name", "TEXT", "UNIQUE", 5, Boolean.TRUE, "Table", Boolean.FALSE, null);
MetaDataTable metaDataColumnTable = metaDataService.getTable("meta_data_column");
metaDataService.getColumn(metaDataColumnTable, "id", "identifier", "TEXT", "PRIMARY KEY", 1, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "created_date", "created", "TIMESTAMP", null, 2, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "last_modified_date", "modified", "TIMESTAMP", null, 3, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "version", "version", "LONG", null, 4, Boolean.FALSE, "", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "column_name", "column_name", "TEXT", null, 5, Boolean.TRUE, "Column", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "column_sync_name", "column_sync_name", "TEXT", null, 6, Boolean.TRUE, "SQLite Column", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "column_type", "column_type", "TEXT", null, 7, Boolean.TRUE, "Type", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "column_modifier", "column_modifier", "TEXT", null, 8, Boolean.TRUE, "Modifier", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "column_order", "column_order", "LONG", null, 9, Boolean.TRUE, "Order", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "is_shown", "is_shown", "BOOLEAN", null, 10, Boolean.TRUE, "Is Shown", Boolean.TRUE, "Is Shown");
metaDataService.getColumn(metaDataColumnTable, "column_label", "column_label", "TEXT", null, 11, Boolean.TRUE, "Label", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "show_filter", "show_filter", "BOOLEAN", null, 12, Boolean.TRUE, "Show Filter", Boolean.TRUE, "Show Filter");
metaDataService.getColumn(metaDataColumnTable, "filter_label", "filter_label", "TEXT", null, 13, Boolean.TRUE, "Filter Label", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "ref_column", "ref_column", "TEXT", null, 14, Boolean.TRUE, "Ref Column", Boolean.FALSE, null);
metaDataService.getColumn(metaDataColumnTable, "table_id", "table_id", "TEXT", null, 15, Boolean.TRUE, "Table", Boolean.FALSE, null, "table_name");
}
}
@@ -32,7 +32,7 @@ public class MetaDataColumn extends AbstractEntity {
private String columnLabel;
private Boolean showFilter;
private Boolean showFilter = Boolean.FALSE;
private String filterLabel;
@@ -24,6 +24,8 @@ public class Token extends AbstractEntity {
private String token;
private String name;
private Date lastUsedDate;
private boolean enabled;
@@ -54,7 +54,7 @@ public class MetaDataService {
log.debug("columnType has to be changed to {}", columnType);
column.setColumnType(columnType);
}
if (columnModifier != null && !column.getColumnModifier().equals(columnModifier)) {
if (columnModifier != null && !columnModifier.equals(column.getColumnModifier())) {
log.debug("columnModifier has to be changed to {}", columnModifier);
column.setColumnModifier(columnModifier);
}
@@ -1,40 +0,0 @@
package de.thpeetz.kontor.media.data;
import de.thpeetz.kontor.common.data.AbstractEntity;
import jakarta.annotation.Nullable;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Getter
@Setter
@Entity
@Table(indexes = @Index(columnList = "url"), uniqueConstraints = @UniqueConstraint(columnNames = {"url"}))
public class MediaLink extends AbstractEntity {
@NotEmpty
private String url;
private String title;
private boolean review;
@OneToOne
@JoinColumn(name = "video_id", referencedColumnName = "id")
@Nullable
private MediaVideo mediaVideo;
@OneToOne
@JoinColumn(name = "article_id", referencedColumnName = "id")
@Nullable
private MediaArticle mediaArticle;
}