diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/ui/folders/DocumentEntryPanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/ui/folders/DocumentEntryPanel.java
index 96d99def0..eb6420165 100644
--- a/j-lawyer-client/src/com/jdimension/jlawyer/ui/folders/DocumentEntryPanel.java
+++ b/j-lawyer-client/src/com/jdimension/jlawyer/ui/folders/DocumentEntryPanel.java
@@ -670,6 +670,7 @@ You should also get your employer (if you work as a programmer) or school,
import com.jdimension.jlawyer.client.settings.ClientSettings;
import com.jdimension.jlawyer.client.utils.FileUtils;
import com.jdimension.jlawyer.client.utils.FrameUtils;
+import com.jdimension.jlawyer.client.utils.DateUtils;
import com.jdimension.jlawyer.persistence.ArchiveFileDocumentsBean;
import com.jdimension.jlawyer.persistence.Invoice;
import com.jdimension.jlawyer.services.ArchiveFileServiceRemote;
@@ -733,7 +734,7 @@ public DocumentEntryPanel() {
DnDConstants.ACTION_MOVE,
this);
- this.lblCreationDate.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
+ this.lblChangeDate.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
this.lblDictateSign.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
this.lblFileSize.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
@@ -758,7 +759,7 @@ public DocumentEntryPanel(ArchiveFilePanel caseContainer, CaseFolderPanel docume
DnDConstants.ACTION_MOVE,
this);
- this.lblCreationDate.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
+ this.lblChangeDate.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
this.lblDictateSign.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
this.lblFileSize.setForeground(DefaultColorTheme.COLOR_DARK_GREY);
@@ -851,7 +852,7 @@ private void initComponents() {
lblFileIcon = new javax.swing.JLabel();
lblFileName = new javax.swing.JLabel();
- lblCreationDate = new javax.swing.JLabel();
+ lblChangeDate = new javax.swing.JLabel();
lblDictateSign = new javax.swing.JLabel();
lblFileSize = new javax.swing.JLabel();
chkSelected = new javax.swing.JCheckBox();
@@ -888,11 +889,11 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
}
});
- lblCreationDate.setFont(lblCreationDate.getFont().deriveFont(lblCreationDate.getFont().getStyle() | java.awt.Font.BOLD, lblCreationDate.getFont().getSize()-2));
- lblCreationDate.setText("10.10.2020");
- lblCreationDate.addMouseListener(new java.awt.event.MouseAdapter() {
+ lblChangeDate.setFont(lblChangeDate.getFont().deriveFont(lblChangeDate.getFont().getStyle() | java.awt.Font.BOLD, lblChangeDate.getFont().getSize()-2));
+ lblChangeDate.setText("10.10.2020");
+ lblChangeDate.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
- lblCreationDateMouseClicked(evt);
+ lblChangeDateMouseClicked(evt);
}
});
@@ -979,7 +980,7 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
- .addComponent(lblCreationDate)
+ .addComponent(lblChangeDate)
.addGap(18, 18, 18)
.addComponent(lblFileSize)
.addGap(18, 18, 18)
@@ -1001,7 +1002,7 @@ public void mouseExited(java.awt.event.MouseEvent evt) {
.addComponent(lblFileName)
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCreationDate)
+ .addComponent(lblChangeDate)
.addComponent(lblDictateSign)
.addComponent(lblFileSize)
.addComponent(lblFolder))
@@ -1141,9 +1142,9 @@ private void chkSelectedKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:ev
}
}//GEN-LAST:event_chkSelectedKeyReleased
- private void lblCreationDateMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCreationDateMouseClicked
+ private void lblChangeDateMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblChangeDateMouseClicked
this.lblFileNameMouseClicked(evt);
- }//GEN-LAST:event_lblCreationDateMouseClicked
+ }//GEN-LAST:event_lblChangeDateMouseClicked
private void lblFileSizeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblFileSizeMouseClicked
this.lblFileNameMouseClicked(evt);
@@ -1225,7 +1226,7 @@ public void setFavorite(boolean favorite) {
private javax.swing.JCheckBox chkSelected;
private javax.swing.JButton cmdHighlight1;
private javax.swing.JButton cmdHighlight2;
- private javax.swing.JLabel lblCreationDate;
+ private javax.swing.JLabel lblChangeDate;
private javax.swing.JLabel lblDictateSign;
private javax.swing.JLabel lblFavorite;
private javax.swing.JLabel lblFileIcon;
@@ -1247,7 +1248,8 @@ void setDocument(ArchiveFileDocumentsBean doc, Invoice linkedInvoice) {
this.lblFileName.setText(doc.getName());
this.lblFileName.setToolTipText(doc.getName());
this.lblFileIcon.setToolTipText(doc.getName());
- this.lblCreationDate.setText(dfDateTime.format(doc.getCreationDate()));
+ this.lblChangeDate.setText(DateUtils.getHumanReadableTime(doc.getChangeDate()));
+ this.lblChangeDate.setToolTipText("erstellt: " + dfDateTime.format(doc.getCreationDate()) + System.lineSeparator() + "geändert: " + dfDateTime.format(doc.getChangeDate()));
this.lblDictateSign.setText(doc.getDictateSign());
if(this.document.getFolder()==null) {
this.lblFolder.setIcon(null);
diff --git a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/comparator/DocumentsComparator.java b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/comparator/DocumentsComparator.java
index 9c3dc2563..478e20ca3 100755
--- a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/comparator/DocumentsComparator.java
+++ b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/comparator/DocumentsComparator.java
@@ -691,8 +691,8 @@ public int compare(Object obj1, Object obj2) {
ArchiveFileDocumentsBean dto1=(ArchiveFileDocumentsBean)obj1;
ArchiveFileDocumentsBean dto2=(ArchiveFileDocumentsBean)obj2;
- Date d1=dto1.getCreationDate();
- Date d2=dto2.getCreationDate();
+ Date d1=dto1.getChangeDate();
+ Date d2=dto2.getChangeDate();
if(d1!=null)
return d1.compareTo(d2);
diff --git a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/ArchiveFileDocumentsBean.java b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/ArchiveFileDocumentsBean.java
index 804d228bf..33ea82e8c 100755
--- a/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/ArchiveFileDocumentsBean.java
+++ b/j-lawyer-server-entities/src/java/com/jdimension/jlawyer/persistence/ArchiveFileDocumentsBean.java
@@ -733,6 +733,9 @@ public class ArchiveFileDocumentsBean implements Serializable {
@Column(name = "document_type", columnDefinition = "INTEGER DEFAULT 10")
protected long documentType=TYPE_GENERIC;
+ @Column(name = "date_changed")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date changeDate;
public ArchiveFileDocumentsBean() {
}
@@ -928,6 +931,7 @@ public void setVersion(long version) {
public void bumpVersion() {
this.setVersion(this.version+1);
+ this.setChangeDate(new Date());
}
/**
@@ -971,5 +975,19 @@ public long getDocumentType() {
public void setDocumentType(long documentType) {
this.documentType = documentType;
}
+
+ /**
+ * @return the changeDate
+ */
+ public Date getChangeDate() {
+ return changeDate;
+ }
+
+ /**
+ * @param changeDate the changeDate to set
+ */
+ public void setChangeDate(Date changeDate) {
+ this.changeDate = changeDate;
+ }
}
diff --git a/j-lawyer-server-entities/src/java/db/migration/V2_6_0_2__DocumentsAddChanged.sql b/j-lawyer-server-entities/src/java/db/migration/V2_6_0_2__DocumentsAddChanged.sql
new file mode 100644
index 000000000..c1d0b9a55
--- /dev/null
+++ b/j-lawyer-server-entities/src/java/db/migration/V2_6_0_2__DocumentsAddChanged.sql
@@ -0,0 +1,6 @@
+ALTER TABLE case_documents ADD `date_changed` datetime default null;
+alter table case_documents add index `IDX_DOCDATECHANGED` (date_changed);
+update case_documents set date_changed=creationDate;
+
+insert into server_settings(settingKey, settingValue) values('jlawyer.server.database.version','2.6.0.2') ON DUPLICATE KEY UPDATE settingValue = '2.6.0.2';
+commit;
\ No newline at end of file
diff --git a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/CasesEndpointV1.java b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/CasesEndpointV1.java
index f705f80a5..1bf503431 100644
--- a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/CasesEndpointV1.java
+++ b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/CasesEndpointV1.java
@@ -990,6 +990,7 @@ public Response getCaseDocuments(@PathParam("id") String id) {
d.setVersion(doc.getVersion());
d.setName(doc.getName());
d.setCreationDate(doc.getCreationDate());
+ d.setChangeDate(doc.getChangeDate());
d.setFavorite(doc.isFavorite());
d.setSize(doc.getSize());
d.setHighlight1(doc.getHighlight1());
diff --git a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/pojo/RestfulDocumentV1.java b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/pojo/RestfulDocumentV1.java
index cd2e34f27..7ba0e7ea2 100644
--- a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/pojo/RestfulDocumentV1.java
+++ b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v1/pojo/RestfulDocumentV1.java
@@ -674,6 +674,7 @@ public class RestfulDocumentV1 {
private String id=null;
private String name=null;
private Date creationDate=null;
+ private Date changeDate=null;
private long size=0l;
private boolean favorite=false;
protected String folderId=null;
@@ -809,6 +810,20 @@ public int getHighlight2() {
public void setHighlight2(int highlight2) {
this.highlight2 = highlight2;
}
+
+ /**
+ * @return the changeDate
+ */
+ public Date getChangeDate() {
+ return changeDate;
+ }
+
+ /**
+ * @param changeDate the changeDate to set
+ */
+ public void setChangeDate(Date changeDate) {
+ this.changeDate = changeDate;
+ }
diff --git a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java
index 2d1478d65..1ee75025f 100644
--- a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java
+++ b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java
@@ -886,6 +886,7 @@ public Response addDocumentFromTemplate(@PathParam("caseId") String caseId, @Pat
ArchiveFileDocumentsBean newDoc=casesvc.addDocumentFromTemplate(caseId, fileName, null, folder, template, placeHoldersInTemplateMap, "");
RestfulDocumentV1 rdoc=new RestfulDocumentV1();
rdoc.setCreationDate(newDoc.getCreationDate());
+ rdoc.setChangeDate(newDoc.getChangeDate());
rdoc.setFavorite(rdoc.isFavorite());
rdoc.setFolderId(newDoc.getFolder().getId());
rdoc.setId(newDoc.getId());
diff --git a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java
index 142e98b72..9ca7d014e 100644
--- a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java
+++ b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/export/HTMLExport.java
@@ -924,8 +924,8 @@ public String export(ArchiveFileBean dto, Date lastModified) throws Exception {
docOut.write(docContent);
}
File docOutFile = new File(newDir3.getAbsolutePath() + System.getProperty("file.separator") + dbNewName);
- if (db.getCreationDate() != null) {
- docOutFile.setLastModified(db.getCreationDate().getTime());
+ if (db.getChangeDate() != null) {
+ docOutFile.setLastModified(db.getChangeDate().getTime());
}
} catch (Throwable t) {
log.error("Could not export document " + db.getName() + " from case " + dto.getFileNumber(), t);
@@ -934,7 +934,7 @@ public String export(ArchiveFileBean dto, Date lastModified) throws Exception {
// 01.01.2013 | dings |
sb.append("");
- sb.append(toDate(df, db.getCreationDate()));
+ sb.append(toDate(df, db.getChangeDate()));
sb.append(" | ");
diff --git a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java
index aa882d4c3..801ba42b8 100644
--- a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java
+++ b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/ArchiveFileService.java
@@ -1737,7 +1737,9 @@ public ArchiveFileDocumentsBean addDocument(String archiveFileId, String fileNam
db.setVersion(1);
db.setDictateSign(dictateSign);
db.setArchiveFileKey(aFile);
- db.setCreationDate(new Date());
+ Date created=new Date();
+ db.setCreationDate(created);
+ db.setChangeDate(created);
db.setName(fileName);
db.setFolder(aFile.getRootFolder());
if (data != null) {
@@ -3469,7 +3471,9 @@ public ArchiveFileDocumentsBean addDocumentFromTemplate(String archiveFileId, St
db.setVersion(1);
db.setDictateSign(dictateSign);
db.setArchiveFileKey(aFile);
- db.setCreationDate(new Date());
+ Date created=new Date();
+ db.setCreationDate(created);
+ db.setChangeDate(created);
db.setName(fileName);
db.setFolder(aFile.getRootFolder());
if (new File(dstId).exists()) {
@@ -3693,7 +3697,7 @@ public List getTaggedDocuments(java.lang.String[] docT
st = con.prepareStatement("select distinct(docid) from (select a5.id as docid from "
+ " (SELECT id, date_changed, archived from cases) a1, "
+ " document_tags a4, case_documents a5 "
- + " where a1.archived=0 and a5.deleted=0 and (((a4.tagName in (" + inClause + ") and a4.documentKey=a5.id and a5.archiveFileKey=a1.id))) order by date_changed DESC) allkeys limit 0,?");
+ + " where a1.archived=0 and a5.deleted=0 and (((a4.tagName in (" + inClause + ") and a4.documentKey=a5.id and a5.archiveFileKey=a1.id))) order by a1.date_changed DESC) allkeys limit 0,?");
int index = 1;
|