branch develop updated (033bf5a0 -> 88f73ad1)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git from 033bf5a0 [gitflow-maven-plugin]Update for next development version new 263386af fixes #11068 : Pas de délock à l'archivage et délock trop tôt lorsqu'on quitte un élément new 88f73ad1 Clean code The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 88f73ad1247ed4b327dd1afdc67f44978c93d1a4 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 9 14:45:26 2020 +0100 Clean code commit 263386af2927289e7b029bba680a05c72fe81472 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 9 14:31:41 2020 +0100 fixes #11068 : Pas de délock à l'archivage et délock trop tôt lorsqu'on quitte un élément Summary of changes: .../services/service/EmailServiceImpl.java | 2 ++ .../ui/swing/content/demande/DemandeUIHandler.java | 28 +++++++----------- .../content/demande/actions/ArchiveAction.java | 34 ++++++++++++---------- .../content/transmit/actions/TransmitAction.java | 11 +++---- 4 files changed, 36 insertions(+), 39 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 263386af2927289e7b029bba680a05c72fe81472 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 9 14:31:41 2020 +0100 fixes #11068 : Pas de délock à l'archivage et délock trop tôt lorsqu'on quitte un élément --- .../services/service/EmailServiceImpl.java | 2 ++ .../ui/swing/content/demande/DemandeUIHandler.java | 16 ++++++++-- .../content/demande/actions/ArchiveAction.java | 34 ++++++++++++---------- .../content/transmit/actions/TransmitAction.java | 11 +++---- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index 2fad48fa..8bc5457d 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -1306,6 +1306,8 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe email.setLastPrintingUser(null); email.setLastPrintingDate(null); + unlockEmail(email.getTopiaId()); + History history = historyDao.create(History.PROPERTY_TYPE, HistoryType.TRANSMISSION, History.PROPERTY_FAX_TO_MAIL_USER, currentUser, History.PROPERTY_MODIFICATION_DATE, new Date(), diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index 0ddc2557..219aa4cc 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -494,9 +494,9 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, DemandeUIModel model = getModel(); - if (model.isEditable()) { + /*if (model.isEditable()) { serviceContext.getEmailService().unlockEmail(model.getTopiaId()); - } + }*/ model.removePropertyChangeListener(listModelListener); model.removePropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, demandTypeListener); @@ -537,7 +537,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, askCancelEditBeforeLeavingMessage = n("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave.noHelp"); askSaveBeforeLeavingMessage = n("faxtomail.demande.askSaveBeforeLeaving.save.noHelp"); } - return quitScreen2( + Boolean result = quitScreen2( true, getModel().isModify(), t(askCancelEditBeforeLeavingMessage), @@ -545,6 +545,16 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, showHelp, getContext().getActionFactory().createLogicAction(this, SaveDemandeAction.class) ); + + if (result) { + try(FaxToMailServiceContext faxToMailServiceContext = getContext().newServiceContext()) { + faxToMailServiceContext.getEmailService().unlockEmail(getModel().getTopiaId()); + } catch (IOException e) { + log.warn("Could not unlock email"); + } + } + + return result; } @Override diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/ArchiveAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/ArchiveAction.java index 16d96764..745ab9a0 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/ArchiveAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/actions/ArchiveAction.java @@ -26,20 +26,18 @@ package com.franciaflex.faxtomail.ui.swing.content.demande.actions; import com.franciaflex.faxtomail.persistence.entities.DemandStatus; import com.franciaflex.faxtomail.persistence.entities.MailFolder; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUI; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeListUIHandler; -import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUI; +import com.franciaflex.faxtomail.services.FaxToMailServiceContext; +import com.franciaflex.faxtomail.services.service.exceptions.AlreadyLockedMailException; +import com.franciaflex.faxtomail.services.service.exceptions.FolderNotReadableException; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; -import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUIHandler; -import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUI; import com.google.common.base.Optional; -import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.swing.*; +import javax.swing.JOptionPane; +import java.io.IOException; import java.util.Collection; import java.util.Date; @@ -54,6 +52,8 @@ import static org.nuiton.i18n.I18n.t; */ public class ArchiveAction extends SaveDemandeAndExitAction { + private static final Log log = LogFactory.getLog(ArchiveAction.class); + protected DemandeUIModel previousState; public ArchiveAction(DemandeUIHandler handler) { @@ -94,12 +94,7 @@ public class ArchiveAction extends SaveDemandeAndExitAction { do { Collection<MailFolder> children = folder.getChildren(); if (children != null) { - Optional<MailFolder> optArchiveChild = Iterables.tryFind(children, new Predicate<MailFolder>() { - @Override - public boolean apply(MailFolder mailFolder) { - return mailFolder.isArchiveFolder(); - } - }); + Optional<MailFolder> optArchiveChild = Iterables.tryFind(children, mailFolder -> mailFolder.isArchiveFolder()); if (optArchiveChild.isPresent()) { archiveChild = optArchiveChild.get(); } @@ -118,6 +113,10 @@ public class ArchiveAction extends SaveDemandeAndExitAction { model.setDemandStatus(DemandStatus.ARCHIVED); model.setTakenBy(null); + try(FaxToMailServiceContext faxToMailServiceContext = getContext().newServiceContext()) { + faxToMailServiceContext.getEmailService().unlockEmail(model.getTopiaId()); + } + //cannot be reverted in postFailedAction model.clearPDFPages(); @@ -143,6 +142,11 @@ public class ArchiveAction extends SaveDemandeAndExitAction { model.setArchiveDate(null); model.setDemandStatus(previousState.getDemandStatus()); model.setTakenBy(previousState.getTakenBy()); + try(FaxToMailServiceContext faxToMailServiceContext = getContext().newServiceContext()) { + faxToMailServiceContext.getEmailService().lockEmail(model.getTopiaId(),getContext().getCurrentUser()); + } catch (AlreadyLockedMailException | FolderNotReadableException | IOException e) { + log.warn("Could not lock back email after error archiving"); + } previousState = null; } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/actions/TransmitAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/actions/TransmitAction.java index af921a02..92df334a 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/actions/TransmitAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/actions/TransmitAction.java @@ -68,7 +68,7 @@ public class TransmitAction extends AbstractFaxToMailAction<MailFolderChooserUIM boolean result = super.prepareAction(); MailFolderChooserUIModel model = getModel(); - List<DemandeUIModel> demandeUIModels = new ArrayList<DemandeUIModel>(model.getDemandeUIModels()); + List<DemandeUIModel> demandeUIModels = new ArrayList<>(model.getDemandeUIModels()); for (final DemandeUIModel demandeUIModel : model.getDemandeUIModels()) { @@ -111,12 +111,9 @@ public class TransmitAction extends AbstractFaxToMailAction<MailFolderChooserUIM @Override public void doAction() throws Exception { MailFolderChooserUIModel model = getModel(); - Collection<String> emailIds = Collections2.transform(model.getDemandeUIModels(), new Function<DemandeUIModel, String>() { - @Override - public String apply(DemandeUIModel demandeUIModel) { - return demandeUIModel.getTopiaId(); - } - }); + + Collection<String> emailIds = Collections2.transform(model.getDemandeUIModels(), DemandeUIModel::getTopiaId); + try(FaxToMailServiceContext faxToMailServiceContext = getContext().newServiceContext()) { faxToMailServiceContext.getEmailService().transmit(emailIds, model.getMailFolder(), getContext().getCurrentUser()); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See https://gitlab.nuiton.org/codelutin/faxtomail.git commit 88f73ad1247ed4b327dd1afdc67f44978c93d1a4 Author: jcouteau <couteau@codelutin.com> Date: Mon Nov 9 14:45:26 2020 +0100 Clean code --- .../ui/swing/content/demande/DemandeUIHandler.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java index 219aa4cc..b7e78a08 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java @@ -40,10 +40,8 @@ import com.franciaflex.faxtomail.ui.swing.content.demande.actions.SaveDemandeAct import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel; import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler; import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil; -import com.franciaflex.faxtomail.ui.swing.util.JImagePanel; import com.google.common.collect.Sets; import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.JAXXWidgetUtil; import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox; import jaxx.runtime.validator.swing.SwingValidator; import org.apache.commons.collections4.CollectionUtils; @@ -66,18 +64,13 @@ import org.nuiton.jaxx.application.swing.util.CloseableUI; import org.nuiton.util.beans.BeanMonitor; import javax.swing.*; -import javax.swing.event.AncestorEvent; -import javax.swing.event.AncestorListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.TableCellEditor; import java.awt.*; import java.awt.event.ActionEvent; -import java.awt.event.ComponentEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.IOException; @@ -85,7 +78,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Map; @@ -490,14 +482,9 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, if (log.isDebugEnabled()) { log.debug("closing: " + ui); } - try (FaxToMailServiceContext serviceContext = getContext().newServiceContext()) { DemandeUIModel model = getModel(); - /*if (model.isEditable()) { - serviceContext.getEmailService().unlockEmail(model.getTopiaId()); - }*/ - model.removePropertyChangeListener(listModelListener); model.removePropertyChangeListener(Email.PROPERTY_DEMAND_TYPE, demandTypeListener); for (RangeRowModel row : model.getValidRangeRowModels()) { @@ -510,9 +497,6 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, ui.getDemandRepliesButton().onCloseUI(); clearValidators(); - } catch (IOException eee) { - log.error("Error closing UI", eee); - } } public void closeButtonPopups() { @@ -537,7 +521,7 @@ public class DemandeUIHandler extends AbstractFaxToMailUIHandler<DemandeUIModel, askCancelEditBeforeLeavingMessage = n("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave.noHelp"); askSaveBeforeLeavingMessage = n("faxtomail.demande.askSaveBeforeLeaving.save.noHelp"); } - Boolean result = quitScreen2( + boolean result = quitScreen2( true, getModel().isModify(), t(askCancelEditBeforeLeavingMessage), -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm