Skip to content

Commit

Permalink
duplicate case with form data. close #2696
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 24, 2024
1 parent b790898 commit d0f8a00
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mnuDuplicateSelectedArchiveFilesActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="mnuDuplicateSelectedArchiveFilesWithForms">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/icons/editcopy.png"/>
</Property>
<Property name="text" type="java.lang.String" value="duplizieren (inklusive Falldaten)"/>
<Property name="toolTipText" type="java.lang.String" value="gew&#xe4;hlte Akten und deren Falldaten duplizieren"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mnuDuplicateSelectedArchiveFilesWithFormsActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="mnuDeleteSelectedArchiveFiles">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,11 +677,14 @@
import com.jdimension.jlawyer.client.utils.ThreadUtils;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.ArchiveFileBean;
import com.jdimension.jlawyer.persistence.ArchiveFileFormEntriesBean;
import com.jdimension.jlawyer.persistence.ArchiveFileFormsBean;
import com.jdimension.jlawyer.persistence.ArchiveFileGroupsBean;
import com.jdimension.jlawyer.persistence.ArchiveFileReviewsBean;
import com.jdimension.jlawyer.persistence.ArchiveFileTagsBean;
import com.jdimension.jlawyer.persistence.Group;
import com.jdimension.jlawyer.services.ArchiveFileServiceRemote;
import com.jdimension.jlawyer.services.FormsServiceRemote;
import com.jdimension.jlawyer.services.JLawyerServiceLocator;
import com.jdimension.jlawyer.ui.tagging.TagUtils;
import java.awt.Color;
Expand Down Expand Up @@ -816,6 +819,7 @@ private void initComponents() {
popupArchiveFileActions = new javax.swing.JPopupMenu();
mnuOpenSelectedArchiveFile = new javax.swing.JMenuItem();
mnuDuplicateSelectedArchiveFiles = new javax.swing.JMenuItem();
mnuDuplicateSelectedArchiveFilesWithForms = new javax.swing.JMenuItem();
mnuDeleteSelectedArchiveFiles = new javax.swing.JMenuItem();
mnuEnableCaseSync = new javax.swing.JMenuItem();
mnuDisableCaseSync = new javax.swing.JMenuItem();
Expand Down Expand Up @@ -856,6 +860,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
popupArchiveFileActions.add(mnuDuplicateSelectedArchiveFiles);

mnuDuplicateSelectedArchiveFilesWithForms.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/editcopy.png"))); // NOI18N
mnuDuplicateSelectedArchiveFilesWithForms.setText("duplizieren (inklusive Falldaten)");
mnuDuplicateSelectedArchiveFilesWithForms.setToolTipText("gewählte Akten und deren Falldaten duplizieren");
mnuDuplicateSelectedArchiveFilesWithForms.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuDuplicateSelectedArchiveFilesWithFormsActionPerformed(evt);
}
});
popupArchiveFileActions.add(mnuDuplicateSelectedArchiveFilesWithForms);

mnuDeleteSelectedArchiveFiles.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/editdelete.png"))); // NOI18N
mnuDeleteSelectedArchiveFiles.setText("löschen");
mnuDeleteSelectedArchiveFiles.setToolTipText("gewählte Akten löschen");
Expand Down Expand Up @@ -1223,8 +1237,7 @@ private void cmdTagFilterMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRS
this.popTagFilter.show(this.cmdTagFilter, evt.getX(), evt.getY());
}//GEN-LAST:event_cmdTagFilterMousePressed

private void mnuDuplicateSelectedArchiveFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuDuplicateSelectedArchiveFilesActionPerformed

private void duplicateSelectedArchiveFiles(boolean includeForms) {
int[] selectedIndices = this.tblResults.getSelectedRows();
Arrays.sort(selectedIndices);
ArrayList<String> ids = new ArrayList<>();
Expand Down Expand Up @@ -1290,6 +1303,33 @@ private void mnuDuplicateSelectedArchiveFilesActionPerformed(java.awt.event.Acti
}
fileService.updateAllowedGroups(target.getId(), targetGroups);

if(includeForms) {
FormsServiceRemote formsSvc=locator.lookupFormsServiceRemote();
List<ArchiveFileFormsBean> forms=formsSvc.getFormsForCase(source.getId());
for(ArchiveFileFormsBean form: forms) {
ArchiveFileFormsBean newForm=new ArchiveFileFormsBean();
newForm.setArchiveFileFormEntriesBeanList(new ArrayList<>());
newForm.setArchiveFileKey(target);
newForm.setCreationDate(new Date());
newForm.setDescription(form.getDescription());
newForm.setFormType(form.getFormType());
newForm.setPlaceHolder(form.getPlaceHolder());
newForm=formsSvc.addForm(target.getId(), newForm);
List<ArchiveFileFormEntriesBean> formEntries=formsSvc.getFormEntries(form.getId());
List newFormEntries=new ArrayList<>();
for(ArchiveFileFormEntriesBean formEntry: formEntries) {
ArchiveFileFormEntriesBean newEntry=new ArchiveFileFormEntriesBean();
newEntry.setArchiveFileKey(target);
newEntry.setEntryKey(formEntry.getEntryKey());
newEntry.setForm(newForm);
newEntry.setPlaceHolder(formEntry.getPlaceHolder());
newEntry.setStringValue(formEntry.getStringValue());
newFormEntries.add(newEntry);
}
formsSvc.setFormEntries(newForm.getId(), newFormEntries);
}
}

}

EventBroker eb = EventBroker.getInstance();
Expand All @@ -1304,6 +1344,11 @@ private void mnuDuplicateSelectedArchiveFilesActionPerformed(java.awt.event.Acti
} finally {
ThreadUtils.setDefaultCursor(this, false);
}
}

private void mnuDuplicateSelectedArchiveFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuDuplicateSelectedArchiveFilesActionPerformed
this.duplicateSelectedArchiveFiles(false);

}//GEN-LAST:event_mnuDuplicateSelectedArchiveFilesActionPerformed

private void cmdDocumentTagFilterMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cmdDocumentTagFilterMousePressed
Expand All @@ -1329,6 +1374,10 @@ private void mnuDisableCaseSyncActionPerformed(java.awt.event.ActionEvent evt) {
this.toggleCaseSync(false);
}//GEN-LAST:event_mnuDisableCaseSyncActionPerformed

private void mnuDuplicateSelectedArchiveFilesWithFormsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuDuplicateSelectedArchiveFilesWithFormsActionPerformed
this.duplicateSelectedArchiveFiles(true);
}//GEN-LAST:event_mnuDuplicateSelectedArchiveFilesWithFormsActionPerformed

private void toggleCaseSync(boolean enable) {
int[] selectedIndices = this.tblResults.getSelectedRows();
Arrays.sort(selectedIndices);
Expand Down Expand Up @@ -1374,6 +1423,7 @@ private void toggleCaseSync(boolean enable) {
private javax.swing.JMenuItem mnuDeleteSelectedArchiveFiles;
private javax.swing.JMenuItem mnuDisableCaseSync;
private javax.swing.JMenuItem mnuDuplicateSelectedArchiveFiles;
private javax.swing.JMenuItem mnuDuplicateSelectedArchiveFilesWithForms;
private javax.swing.JMenuItem mnuEnableCaseSync;
private javax.swing.JMenuItem mnuOpenSelectedArchiveFile;
private javax.swing.JPopupMenu popDocumentTagFilter;
Expand Down

0 comments on commit d0f8a00

Please sign in to comment.