Skip to content

Commit

Permalink
sonarqube fixes. close #1228.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Sep 29, 2023
1 parent 291158e commit c46af50
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -823,15 +823,15 @@ public SendBeaMessageDialog(java.awt.Frame parent, boolean modal) {
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());

Collection templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
Collection<String> templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
this.cmbTemplates.removeAllItems();
this.cmbTemplates.addItem("");
String lastUsedTemplate = UserSettings.getInstance().getSetting(UserSettings.CONF_BEA_LASTUSEDTEMPLATE, null);
for (Object t : templates) {
EmailTemplate etpl = locator.lookupIntegrationServiceRemote().getEmailTemplate(t.toString());
for (String t : templates) {
EmailTemplate etpl = locator.lookupIntegrationServiceRemote().getEmailTemplate(t);
if (etpl != null) {
if (etpl.isText()) {
this.cmbTemplates.addItem(t.toString());
this.cmbTemplates.addItem(t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,16 +716,14 @@ public FreeTextStep() {
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());

Collection templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
Collection<String> templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
this.cmbTemplates.removeAllItems();
this.cmbTemplates.addItem("");
String lastUsedTemplate = UserSettings.getInstance().getSetting(UserSettings.CONF_DREBIS_LASTUSEDTEMPLATE, null);
for (Object t : templates) {
EmailTemplate etpl = locator.lookupIntegrationServiceRemote().getEmailTemplate(t.toString());
if (etpl != null) {
if (etpl.isText()) {
this.cmbTemplates.addItem(t.toString());
}
for (String t : templates) {
EmailTemplate etpl = locator.lookupIntegrationServiceRemote().getEmailTemplate(t);
if (etpl != null && etpl.isText()) {
this.cmbTemplates.addItem(t);
}
}
if (lastUsedTemplate != null) {
Expand Down Expand Up @@ -961,20 +959,19 @@ private void cmbTemplatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
log.warn("Unable to load assistant with id " + contextArchiveFile.getAssistant());
}

List<PartiesPanelEntry> selectedParties = this.partiesPanel.getSelectedParties(new ArrayList(allPartyTypes));
List<PartiesPanelEntry> selectedParties = this.partiesPanel.getSelectedParties(new ArrayList<>(allPartyTypes));
List<PartiesTriplet> partiesTriplets = new ArrayList<>();
for (PartiesPanelEntry pe : selectedParties) {
PartiesTriplet triplet = new PartiesTriplet(pe.getAddress(), pe.getReferenceType(), pe.getInvolvement());
partiesTriplets.add(triplet);
}
HashMap<String, Object> htValues = locator.lookupSystemManagementRemote().getPlaceHolderValues(ht, contextArchiveFile, partiesTriplets, null, null, formPlaceHolderValues, caseLawyer, caseAssistant, author, null, null, null);


placeHolderNames = EmailTemplateAccess.getPlaceHoldersInTemplate(tpl.getBody(), allPartyTypesPlaceholders, formPlaceHolders);
ht = new HashMap<>();
for (String ph : placeHolderNames) {
ht.put(ph, "");
}
htValues = locator.lookupSystemManagementRemote().getPlaceHolderValues(ht, contextArchiveFile, partiesTriplets, null, null, formPlaceHolderValues, caseLawyer, caseAssistant, author, null, null, null);
HashMap<String, Object> htValues = locator.lookupSystemManagementRemote().getPlaceHolderValues(ht, contextArchiveFile, partiesTriplets, null, null, formPlaceHolderValues, caseLawyer, caseAssistant, author, null, null, null);

String t = EmailTemplateAccess.replacePlaceHolders(tpl.getBody(), htValues);
int cursorIndex = t.indexOf(EmailTemplate.PLACEHOLDER_CURSOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ private void refreshList() {
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());

Collection fileNames=locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
Collection<String> fileNames=locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();

for(Object o:fileNames) {
model.addElement(o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,12 +850,12 @@ private void initialize() {
try {
JLawyerServiceLocator locator = JLawyerServiceLocator.getInstance(settings.getLookupProperties());

Collection templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
Collection<String> templates = locator.lookupIntegrationServiceRemote().getAllEmailTemplateNames();
this.cmbTemplates.removeAllItems();
this.cmbTemplates.addItem("");
String lastUsedTemplate = UserSettings.getInstance().getSetting(UserSettings.CONF_MAIL_LASTUSEDTEMPLATE, null);
for (Object t : templates) {
this.cmbTemplates.addItem(t.toString());
for (String t : templates) {
this.cmbTemplates.addItem(t);
}
if (lastUsedTemplate != null) {
this.cmbTemplates.setSelectedItem(lastUsedTemplate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ public interface IntegrationServiceRemote {

String assignObservedFile(String fileName, String archiveFileId, String renameTo) throws Exception;

Collection getAllEmailTemplateNames();
Collection<String> getAllEmailTemplateNames();

void saveEmailTemplate(EmailTemplate template, boolean replace) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ public String assignObservedFile(String fileName, String archiveFileId, String r

@Override
@RolesAllowed(value = {"loginRole"})
public Collection getAllEmailTemplateNames() {
public Collection<String> getAllEmailTemplateNames() {
String localBaseDir = System.getProperty("jlawyer.server.basedirectory");
localBaseDir = localBaseDir.trim();
if (!localBaseDir.endsWith(System.getProperty("file.separator"))) {
Expand Down

0 comments on commit c46af50

Please sign in to comment.