From 9e775f1e0c1518aaa0f2c66f631595779e2d136f Mon Sep 17 00:00:00 2001 From: j-dimension Date: Wed, 27 Nov 2024 16:20:52 +0100 Subject: [PATCH] added settings to mailboxes. issue #2708 --- .../voip/EpostLetterValidationStep.java | 1 - .../jlawyer/persistence/MailboxSetup.java | 37 +++++++++++++++++++ .../V3_0_0_5__AddMailboxSettings.sql | 4 ++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 j-lawyer-server-entities/src/java/db/migration/V3_0_0_5__AddMailboxSettings.sql diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostLetterValidationStep.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostLetterValidationStep.java index d9335c60a..fa638825d 100644 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostLetterValidationStep.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/voip/EpostLetterValidationStep.java @@ -702,7 +702,6 @@ public void nextEvent() { this.data.put("epost.letter.duplex", this.chkDuplex.isSelected()); this.data.put("epost.letter.color", this.chkColor.isSelected()); this.data.put("epost.letter.coverpage", this.chkDefaultCoverPage.isSelected()); - return; } @Override diff --git a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/MailboxSetup.java b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/MailboxSetup.java index 285c5b631..f8812dea8 100644 --- a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/MailboxSetup.java +++ b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/MailboxSetup.java @@ -662,7 +662,10 @@ You should also get your employer (if you work as a programmer) or school, */ package com.jdimension.jlawyer.persistence; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.Serializable; +import java.util.Properties; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -747,6 +750,9 @@ public class MailboxSetup implements Serializable, EventTypes { private boolean scanIgnoreInline=true; @Column(name = "scan_minattachmentsize", columnDefinition = "INTEGER DEFAULT 5000") private int scanMinAttachmentSize=0; + + @Column(name = "settings", columnDefinition = "MEDIUMBLOB") + private byte[] settings; public String getId() { return id; @@ -1168,5 +1174,36 @@ public void setScanMinAttachmentSize(int minAttachmentSize) { this.scanMinAttachmentSize = minAttachmentSize; } + /** + * @return the settings + */ + public byte[] getSettings() { + if(this.settings==null) + this.settings=emptySettings(); + return settings; + } + + /** + * @param settings the settings to set + */ + public void setSettings(byte[] settings) { + this.settings = settings; + } + + private byte[] emptySettings() { + if(this.settings==null) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + new Properties().store(out, "updated " + new java.util.Date().toString()); + out.flush(); + out.close(); + } catch (IOException ioe) { + // no logging + } + this.settings = out.toByteArray(); + } + return this.settings; + } + } diff --git a/j-lawyer-server-entities/src/java/db/migration/V3_0_0_5__AddMailboxSettings.sql b/j-lawyer-server-entities/src/java/db/migration/V3_0_0_5__AddMailboxSettings.sql new file mode 100644 index 000000000..f78f57eed --- /dev/null +++ b/j-lawyer-server-entities/src/java/db/migration/V3_0_0_5__AddMailboxSettings.sql @@ -0,0 +1,4 @@ +alter table mailbox_setup add `settings` MEDIUMBLOB; + +insert into server_settings(settingKey, settingValue) values('jlawyer.server.database.version','3.0.0.5') ON DUPLICATE KEY UPDATE settingValue = '3.0.0.5'; +commit; \ No newline at end of file