Skip to content

Commit

Permalink
store and restore selected type of party in drebis wizards. only one …
Browse files Browse the repository at this point in the history
…type is supported. close #1229
  • Loading branch information
j-dimension committed Nov 7, 2023
1 parent 3d15515 commit e154d09
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,18 +666,33 @@
import com.jdimension.jlawyer.client.settings.ClientSettings;
import com.jdimension.jlawyer.client.settings.ServerSettings;
import com.jdimension.jlawyer.drebis.InsuranceInfo;
import com.jdimension.jlawyer.persistence.AddressBean;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.PartyTypeBean;
import java.util.ArrayList;
import java.util.List;

/**
*
* @author jens
* @author j-dimension
*/
public class DrebisUtils {

public static PartyTypeBean getType(AddressBean ab, List<ArchiveFileAddressesBean> allParties) {
if(allParties==null || ab==null)
return null;

for(ArchiveFileAddressesBean aab: allParties) {
if(aab.getAddressKey()!=null && aab.getAddressKey().getId().equals(ab.getId()))
return aab.getReferenceType();
}
return null;
}

public static InsuranceInfo getAnyInsurance(String id, String office) {
ClientSettings s=ClientSettings.getInstance();

ArrayList<InsuranceInfo> all=new ArrayList<InsuranceInfo>();
ArrayList<InsuranceInfo> all=new ArrayList<>();
all.addAll(s.getInsurances());
all.addAll(s.getMotorInsurances());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,11 +663,14 @@
*/
package com.jdimension.jlawyer.client.drebis.claim;

import com.jdimension.jlawyer.client.settings.ServerSettings;
import com.jdimension.jlawyer.client.utils.ComponentUtils;
import com.jdimension.jlawyer.client.wizard.*;
import com.jdimension.jlawyer.drebis.DrebisPerson;
import com.jdimension.jlawyer.drebis.DrebisUtils;
import com.jdimension.jlawyer.persistence.AddressBean;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.PartyTypeBean;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
Expand All @@ -694,13 +697,24 @@ public ClientSelectionStep() {
public void nextEvent() throws Exception {

ArrayList<DrebisPerson> persons=new ArrayList<>();
ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

DefaultTableModel dm=(DefaultTableModel)this.tblClients.getModel();
for(int i=0;i<dm.getRowCount();i++) {
Boolean enabled = (Boolean)dm.getValueAt(i, 0);
if(enabled) {
// user chose to submit this client

AddressBean ab=clients.get(i);
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(ab, allParties);
if(ptb != null) {
// will only store ONE type of party
ServerSettings.getInstance().setSetting("drebis." + this.getClass().getName() + ".selectedtype", ptb.getId());
}

// columns: 0 submit, 1 name, 2 firstname, 3 company, 4 street, 5 zip, 6 city, 7 countrycode, 8 phone, 9 fax, 10 email
DrebisPerson p=new DrebisPerson();
if(dm.getValueAt(i, 6)!=null)
Expand Down Expand Up @@ -893,19 +907,28 @@ public String getStepName() {
@Override
public void display() {

ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

Object test = data.get("clients.drebispersons");
if (test != null) {
// user navigated back - do not reset but use what is there
} else {
// initial display
String enabledParty=ServerSettings.getInstance().getSetting("drebis." + this.getClass().getName() + ".selectedtype", null);

ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
for (int i = 0; i < clients.size(); i++) {
AddressBean cl = clients.get(i);

boolean selected=false;
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(cl, allParties);
if(ptb!=null)
selected=ptb.getId().equals(enabledParty);

Vector row = new Vector();
row.add(false);
row.add(selected);
row.add(cl.getName());
row.add(cl.getFirstName());
row.add(cl.getCompany());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@

import com.jdimension.jlawyer.client.drebis.HelpDetailsDialog;
import com.jdimension.jlawyer.client.editors.EditorsRegistry;
import com.jdimension.jlawyer.client.settings.ServerSettings;
import com.jdimension.jlawyer.client.utils.ComponentUtils;
import com.jdimension.jlawyer.client.utils.FrameUtils;
import com.jdimension.jlawyer.client.utils.StringUtils;
Expand All @@ -673,6 +674,8 @@
import com.jdimension.jlawyer.drebis.DrebisUtils;
import com.jdimension.jlawyer.drebis.InsuranceInfo;
import com.jdimension.jlawyer.persistence.AddressBean;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.PartyTypeBean;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.JDialog;
Expand Down Expand Up @@ -700,12 +703,22 @@ public ClientSelectionStep() {
public void nextEvent() throws Exception {

ArrayList<DrebisPerson> persons=new ArrayList<>();
ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

DefaultTableModel dm=(DefaultTableModel)this.tblClients.getModel();
for(int i=0;i<dm.getRowCount();i++) {
Boolean enabled = (Boolean)dm.getValueAt(i, 0);
if(enabled) {
// user chose to submit this client
AddressBean ab=clients.get(i);
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(ab, allParties);
if(ptb != null) {
// will only store ONE type of party
ServerSettings.getInstance().setSetting("drebis." + this.getClass().getName() + ".selectedtype", ptb.getId());
}

// columns: 0 submit, 1 name, 2 firstname, 3 company, 4 street, 5 zip, 6 city, 7 countrycode, 8 phone, 9 fax, 10 email
DrebisPerson p=new DrebisPerson();
Expand Down Expand Up @@ -1054,12 +1067,18 @@ public String getStepName() {

@Override
public void display() {

ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

Object test = data.get("clients.drebispersons");
if (test != null) {
// user navigated back - do not reset but use what is there
} else {
// initial display
String enabledParty=ServerSettings.getInstance().getSetting("drebis." + this.getClass().getName() + ".selectedtype", null);

ArrayList<InsuranceInfo> ins = (ArrayList<InsuranceInfo>) data.get("insurances");
this.cmbInsurances.removeAllItems();
this.cmbInsurances.addItem("");
Expand All @@ -1072,6 +1091,11 @@ public void display() {
ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
for (int i = 0; i < clients.size(); i++) {
AddressBean cl = clients.get(i);

boolean selected=false;
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(cl, allParties);
if(ptb!=null)
selected=ptb.getId().equals(enabledParty);

String t = cl.getInsuranceNumber();
if (t != null && !("".equalsIgnoreCase(t))) {
Expand All @@ -1085,7 +1109,7 @@ public void display() {
// }

Vector row = new Vector();
row.add(false);
row.add(selected);
row.add(cl.getName());
row.add(cl.getFirstName());
row.add(cl.getCompany());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@

import com.jdimension.jlawyer.client.drebis.HelpDetailsDialog;
import com.jdimension.jlawyer.client.editors.EditorsRegistry;
import com.jdimension.jlawyer.client.settings.ServerSettings;
import com.jdimension.jlawyer.client.utils.ComponentUtils;
import com.jdimension.jlawyer.client.utils.FrameUtils;
import com.jdimension.jlawyer.client.utils.StringUtils;
Expand All @@ -673,6 +674,8 @@
import com.jdimension.jlawyer.drebis.DrebisUtils;
import com.jdimension.jlawyer.drebis.InsuranceInfo;
import com.jdimension.jlawyer.persistence.AddressBean;
import com.jdimension.jlawyer.persistence.ArchiveFileAddressesBean;
import com.jdimension.jlawyer.persistence.PartyTypeBean;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.JDialog;
Expand Down Expand Up @@ -700,12 +703,22 @@ public ClientSelectionStep() {
public void nextEvent() throws Exception {

ArrayList<DrebisPerson> persons=new ArrayList<>();
ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

DefaultTableModel dm=(DefaultTableModel)this.tblClients.getModel();
for(int i=0;i<dm.getRowCount();i++) {
Boolean enabled = (Boolean)dm.getValueAt(i, 0);
if(enabled) {
// user chose to submit this client
AddressBean ab=clients.get(i);
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(ab, allParties);
if(ptb != null) {
// will only store ONE type of party
ServerSettings.getInstance().setSetting("drebis." + this.getClass().getName() + ".selectedtype", ptb.getId());
}

// columns: 0 submit, 1 name, 2 firstname, 3 company, 4 street, 5 zip, 6 city, 7 countrycode, 8 phone, 9 fax, 10 email
DrebisPerson p=new DrebisPerson();
Expand Down Expand Up @@ -1050,12 +1063,18 @@ public String getStepName() {

@Override
public void display() {

ArrayList<ArchiveFileAddressesBean> allParties=(ArrayList<ArchiveFileAddressesBean>) data.get("clients.allparties");
if(allParties==null)
allParties=new ArrayList<>();

Object test = data.get("clients.drebispersons");
if (test != null) {
// user navigated back - do not reset but use what is there
} else {
// initial display
String enabledParty=ServerSettings.getInstance().getSetting("drebis." + this.getClass().getName() + ".selectedtype", null);

ArrayList<InsuranceInfo> ins = (ArrayList<InsuranceInfo>) data.get("insurances");
this.cmbInsurances.removeAllItems();
this.cmbInsurances.addItem("");
Expand All @@ -1074,6 +1093,11 @@ public void display() {
ArrayList<AddressBean> clients = (ArrayList<AddressBean>) data.get("clients.addressbeans");
for (int i = 0; i < clients.size(); i++) {
AddressBean cl = clients.get(i);

boolean selected=false;
PartyTypeBean ptb=com.jdimension.jlawyer.client.drebis.DrebisUtils.getType(cl, allParties);
if(ptb!=null)
selected=ptb.getId().equals(enabledParty);

String t = cl.getInsuranceNumber();
if (t != null && !("".equalsIgnoreCase(t))) {
Expand All @@ -1086,7 +1110,7 @@ public void display() {
}

Vector row = new Vector();
row.add(false);
row.add(selected);
row.add(cl.getName());
row.add(cl.getFirstName());
row.add(cl.getCompany());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4596,6 +4596,11 @@ private void mnuSendDocumentFaxActionPerformed(java.awt.event.ActionEvent evt) {

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

ArrayList<ArchiveFileAddressesBean> allParties = new ArrayList<>();
for (ArchiveFileAddressesBean abean : this.pnlInvolvedParties.getInvolvedParties()) {
allParties.add(abean);
}

ArrayList<AddressBean> clients = new ArrayList<>();
for (AddressBean abean : this.pnlInvolvedParties.getInvolvedPartiesAddress()) {
clients.add(abean);
Expand Down Expand Up @@ -4623,6 +4628,7 @@ private void mnuCoverageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
data.put("archiveFile.name", this.dto.getName());
data.put("archiveFile.fileNumber", this.dto.getFileNumber());
data.put("insurances", ClientSettings.getInstance().getInsurances());
data.put("clients.allparties", allParties);
data.put("clients.addressbeans", clients);
data.put("others.addressbeans", others);
data.put("documents.documentbeans", docs);
Expand All @@ -4636,6 +4642,11 @@ private void mnuCoverageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F

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

ArrayList<ArchiveFileAddressesBean> allParties = new ArrayList<>();
for (ArchiveFileAddressesBean abean : this.pnlInvolvedParties.getInvolvedParties()) {
allParties.add(abean);
}

ArrayList<AddressBean> clients = new ArrayList<>();
for (AddressBean abean : this.pnlInvolvedParties.getInvolvedPartiesAddress()) {
clients.add(abean);
Expand Down Expand Up @@ -4664,6 +4675,7 @@ private void mnuMotorCoverageActionPerformed(java.awt.event.ActionEvent evt) {//
data.put("archiveFile.fileNumber", this.dto.getFileNumber());
data.put("archiveFile.claimNumber", this.dto.getClaimNumber());
data.put("insurances", ClientSettings.getInstance().getMotorInsurances());
data.put("clients.allparties", allParties);
data.put("clients.addressbeans", clients);
data.put("others.addressbeans", others);
data.put("documents.documentbeans", docs);
Expand Down Expand Up @@ -4744,6 +4756,11 @@ private void cmdExportHtmlActionPerformed(java.awt.event.ActionEvent evt) {//GEN

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

ArrayList<ArchiveFileAddressesBean> allParties = new ArrayList<>();
for (ArchiveFileAddressesBean abean : this.pnlInvolvedParties.getInvolvedParties()) {
allParties.add(abean);
}

ArrayList<AddressBean> clients = new ArrayList<>();
for (AddressBean abean : this.pnlInvolvedParties.getInvolvedPartiesAddress()) {
clients.add(abean);
Expand All @@ -4763,6 +4780,7 @@ private void mnuFreeTextMessageActionPerformed(java.awt.event.ActionEvent evt) {
data.put("insurances", ClientSettings.getInstance().getInsurances());
data.put("motorinsurances", ClientSettings.getInstance().getMotorInsurances());
data.put("clients.addressbeans", clients);
data.put("clients.allparties", allParties);
data.put("documents.documentbeans", docs);
data.put("documents.documentbeans.selected", selDocs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,6 @@ public class ServerSettingsKeys {
public static final String SERVERCONF_DREBISTECHUSER="jlawyer.server.drebis.techuser";
public static final String SERVERCONF_DREBISTECHPWD="jlawyer.server.drebis.techpwd";


public static final String SERVERCONF_BEAMODE="jlawyer.server.bea.beamode";
public static final String SERVERCONF_BEAENDPOINT="jlawyer.server.bea.beaendpoint";
public static final String SERVERCONF_BEAENABLEDVERSIONS="jlawyer.global.bea.enabledversions";
Expand Down

0 comments on commit e154d09

Please sign in to comment.