Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 1934 discussions
28 Jun '14
Author: kmorin
Date: 2014-06-28 16:29:21 +0200 (Sat, 28 Jun 2014)
New Revision: 284
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/284
Log:
- gestion des retours edi
- rejet des emails sans clients
Added:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EmailTopiaDao.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -255,7 +255,7 @@
// email ediCodeNumber
if (StringUtils.isNotBlank(emailFilter.getEdiCodeNumber())) {
- query.append(" AND lower(E." + Email.PROPERTY_EDI_CODE_NUMBER + ") LIKE lower(:" + EmailFilter.PROPERTY_EDI_CODE_NUMBER + ")");
+ query.append(" AND lower(E." + Email.PROPERTY_EDI_ERROR + ") LIKE lower(:" + EmailFilter.PROPERTY_EDI_CODE_NUMBER + ")");
args.put(EmailFilter.PROPERTY_EDI_CODE_NUMBER, "%" + emailFilter.getEdiCodeNumber() + "%");
}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java (rev 0)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -0,0 +1,23 @@
+package com.franciaflex.faxtomail.services;
+
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class FaxToMailServiceUtils {
+
+ public static String addFaxDomainToFaxNumber(String faxNumber, MailFolder folder) {
+ while (!folder.isUseCurrentLevelFaxDomain()
+ && folder.getParent() != null) {
+ folder = folder.getParent();
+ }
+ int endIndex = faxNumber.indexOf('@');
+ if (endIndex >= 0) {
+ faxNumber = faxNumber.substring(0, endIndex);
+ }
+ faxNumber += "@" + folder.getFaxDomain();
+ return faxNumber;
+ }
+}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -67,10 +67,9 @@
clients = clientDao.forEmailAddressEquals(emailAddress).findAll();
if (CollectionUtils.isEmpty(clients)) {
- emailAddress = emailAddress.substring(0, emailAddress.indexOf('@'));
- emailAddress.replaceAll(" ", "");
- if (NumberUtils.isNumber(emailAddress)) {
- emailAddress = StringUtils.leftPad(emailAddress, 10, '0');
+ String faxNumber = emailAddress.substring(0, emailAddress.indexOf('@')).replaceAll(" ", "");
+ if (NumberUtils.isNumber(faxNumber)) {
+ emailAddress = StringUtils.leftPad(faxNumber, 10, '0');
clients = clientDao.forFaxNumberEquals(emailAddress).findAll();
email.setFax(true);
}
@@ -98,6 +97,7 @@
}
}
}
+ email.setSender(emailAddress);
return client;
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -38,6 +38,7 @@
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -47,8 +48,11 @@
import javax.mail.MessagingException;
import com.franciaflex.faxtomail.persistence.entities.AttachmentTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.EdiReturn;
+import com.franciaflex.faxtomail.persistence.entities.EdiReturnTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.MailField;
+import com.google.common.base.Function;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.io.IOUtils;
@@ -307,6 +311,9 @@
EmailTopiaDao dao = getPersistenceContext().getEmailDao();
List<Email> toTransmitToEdi = dao.forDemandStatusEquals(DemandStatus.TRANSMITTED_TO_EDI).findAll();
+ if (log.isDebugEnabled()) {
+ log.debug(toTransmitToEdi.size() + " demands to transmit to edi");
+ }
for (Email email : toTransmitToEdi) {
transmitDemandToEdi(email);
}
@@ -651,8 +658,8 @@
getPersistenceContext().commit();
}
- public void rejectEmail(String from, String to, String subject,
- String content) throws EmailException, MessagingException, IOException {
+ public void rejectEmail(String from, String to, String subject, String content)
+ throws EmailException, MessagingException, IOException {
final String smtpUser = getApplicationConfig().getSmtpUser();
final String password = getApplicationConfig().getSmtpPassword();
@@ -674,4 +681,47 @@
message.send();
}
+
+ public void updateRangeRowsWithEdiReturns() {
+ EdiReturnTopiaDao ediReturnDao = getPersistenceContext().getEdiReturnDao();
+ RangeRowTopiaDao rangeRowTopiaDao = getPersistenceContext().getRangeRowDao();
+ EmailTopiaDao emailTopiaDao = getPersistenceContext().getEmailDao();
+
+ Set<Email> emailsToUpdate = new HashSet<>();
+
+ List<EdiReturn> ediReturns = ediReturnDao.findAll();
+ if (log.isDebugEnabled()) {
+ log.debug(ediReturns.size() + " returns from edi");
+ }
+ List<String> rangeRowsIds = Lists.transform(ediReturns,new Function<EdiReturn, String>() {
+ @Override
+ public String apply(EdiReturn ediReturn) {
+ return ediReturn.getRangeRowTopiaId();
+ }
+ });
+
+ List<RangeRow> rangeRows = rangeRowTopiaDao.forTopiaIdIn(rangeRowsIds).findAll();
+ Map<String, RangeRow> rangeRowsById = Maps.uniqueIndex(rangeRows, TopiaEntities.getTopiaIdFunction());
+
+ for (EdiReturn ediReturn : ediReturns) {
+ RangeRow rangeRow = rangeRowsById.get(ediReturn.getRangeRowTopiaId());
+ Email email = emailTopiaDao.forRangeRowContains(rangeRow).findUnique();
+
+ if (StringUtils.isNotBlank(ediReturn.getError())) {
+ //error
+ email.setEdiError(ediReturn.getError());
+
+ } else {
+ rangeRow.setCommandNumber(ediReturn.getCommandNumber());
+ }
+
+ email.setDemandStatus(DemandStatus.IN_PROGRESS);
+ emailsToUpdate.add(email);
+ }
+
+ rangeRowTopiaDao.updateAll(rangeRows);
+ emailTopiaDao.updateAll(emailsToUpdate);
+ ediReturnDao.deleteAll(ediReturns);
+ getPersistenceContext().commit();
+ }
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -107,7 +107,7 @@
if (count == 0) {
List<DemandType> types = Lists.newArrayList(
- demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande"),
+ demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande", DemandType.PROPERTY_FIELDS, Lists.newArrayList(MailField.RANGE_ROW)),
demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Réponse"),
demandTypeDao.create(DemandType.PROPERTY_LABEL, "Commande Annulation/Modification"),
demandTypeDao.create(DemandType.PROPERTY_LABEL, "Devis Diffus"),
@@ -210,7 +210,9 @@
int etatAttenteSize = etatAttentes.size();
// root folders (~companies)
- MailFolder franciaflex = folderDao.create(MailFolder.PROPERTY_NAME, "Franciaflex");
+ MailFolder franciaflex = folderDao.create(MailFolder.PROPERTY_NAME, "Franciaflex",
+ MailFolder.PROPERTY_USE_CURRENT_LEVEL_REJECT_RESPONSE_MAIL_ADDRESS, true,
+ MailFolder.PROPERTY_USE_CURRENT_LEVEL_REJECT_RESPONSE_MESSAGE, true);
MailFolder faber = folderDao.create(MailFolder.PROPERTY_NAME, "Faber");
MailFolder franceFermeture = folderDao.create(MailFolder.PROPERTY_NAME, "France-fermeture");
@@ -432,6 +434,10 @@
rangeRows.add(rangeRow);
}
email.setRangeRow(rangeRows);
+
+ if (random.nextBoolean()) {
+ email.setEdiError("error 42");
+ }
}
email.setDemandType(demandType);
email.setPriority(priorities.get(random.nextInt(priorities.size())));
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -37,6 +37,7 @@
import com.franciaflex.faxtomail.persistence.entities.HistoryImpl;
import com.franciaflex.faxtomail.persistence.entities.HistoryType;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
import com.franciaflex.faxtomail.ui.swing.actions.ArchiveFromListAction;
import com.franciaflex.faxtomail.ui.swing.actions.ComputeQuantitiesByRangeAction;
import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction;
@@ -48,6 +49,7 @@
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -504,8 +506,15 @@
ReplyFormUI dialogContent = new ReplyFormUI(ui);
ReplyFormUIModel model = dialogContent.getModel();
- model.setTo(demand.getSender());
+ //TODO kmorin 20140626 test
+ String sender = JAXXUtil.getStringValue(demand.getSender());
+ if (demand.isFax()) {
+ MailFolder selectedFolder = getModel().getSelectedFolder();
+ sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder);
+ }
+ model.setTo(sender);
+
openFrame(dialogContent, t("faxtomail.reply.title", demand.getObject()), new Dimension(800, 600));
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.css 2014-06-28 14:29:21 UTC (rev 284)
@@ -283,14 +283,17 @@
_validatorLabel: { t("faxtomail.demande.rangeRow.label") };
}
-#ediCodeNumberLabel {
- text: "faxtomail.demande.ediCodeNumber.label";
- visible: { model.getEdiCodeNumber() != null };
+#ediErrorLabel {
+ text: "faxtomail.demande.ediError.label";
+ visible: { model.getEdiError() != null };
+ foreground: { Color.RED };
}
-#ediCodeNumberField {
- text: { model.getEdiCodeNumber() };
- visible: { model.getEdiCodeNumber() != null };
+#ediErrorField {
+ text: { model.getEdiError() };
+ visible: { model.getEdiError() != null };
+ editable: false;
+ foreground: { Color.RED };
}
.horizontal-separator {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUI.jaxx 2014-06-28 14:29:21 UTC (rev 284)
@@ -47,6 +47,7 @@
javax.swing.ListSelectionModel
javax.swing.SwingConstants
+ java.awt.Color
java.awt.FlowLayout
java.text.SimpleDateFormat
@@ -249,22 +250,19 @@
</cell>
</row>
- <row>
- <cell>
- <JLabel id='ediCodeNumberLabel'/>
- </cell>
- <cell weightx='1'>
- <JTextField id='ediCodeNumberField'
- onKeyReleased='handler.setText(event, "ediCodeNumber")'/>
- </cell>
- </row>
-
</Table>
</JScrollPane>
<JPanel layout="{new BorderLayout()}" id="rangePanel">
<JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.NORTH'>
+ <JLabel id='ediErrorLabel'/>
+ <JTextField id='ediErrorField'/>
+ </JPanel>
+ <JScrollPane constraints="BorderLayout.CENTER">
+ <JXTable id='rangeTable'/>
+ </JScrollPane>
+ <JPanel layout="{new FlowLayout(FlowLayout.LEADING)}" constraints='BorderLayout.SOUTH'>
<JLabel id="quotationNbLabel"/>
<JLabel id="quotationNbField"/>
<JLabel styleClass="horizontal-separator"/>
@@ -274,9 +272,6 @@
<JLabel id="savNbLabel"/>
<JLabel id="savNbField"/>
</JPanel>
- <JScrollPane constraints="BorderLayout.CENTER">
- <JXTable id='rangeTable'/>
- </JScrollPane>
</JPanel>
</JSplitPane>
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -431,14 +431,14 @@
return editObject.getReceptionDate();
}
- public void setEdiCodeNumber(String ediCodeNumber) {
- Object oldValue = getEdiCodeNumber();
- editObject.setEdiCodeNumber(ediCodeNumber);
- firePropertyChanged(Email.PROPERTY_EDI_CODE_NUMBER, oldValue, ediCodeNumber);
+ public void setEdiError(String ediCodeNumber) {
+ Object oldValue = getEdiError();
+ editObject.setEdiError(ediCodeNumber);
+ firePropertyChanged(Email.PROPERTY_EDI_ERROR, oldValue, ediCodeNumber);
}
- public String getEdiCodeNumber() {
- return editObject.getEdiCodeNumber();
+ public String getEdiError() {
+ return editObject.getEdiError();
}
public void setProjectReference(String projectReference) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandesUIHandler.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -28,6 +28,8 @@
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.MailAction;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
import com.franciaflex.faxtomail.ui.swing.actions.ArchiveAction;
import com.franciaflex.faxtomail.ui.swing.actions.SaveAndOpenDialogAction;
import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAndExitAction;
@@ -38,6 +40,7 @@
import com.franciaflex.faxtomail.ui.swing.content.transmit.MailFolderChooserUI;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
+import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -377,7 +380,14 @@
model.setOriginalDemand(currentDemand);
- model.setTo(currentDemand.getSender());
+ //TODO kmorin 20140626 test
+ String sender = JAXXUtil.getStringValue(currentDemand.getSender());
+ if (currentDemand.isFax()) {
+ MailFolder selectedFolder = getContext().getCurrentMailFolder();
+ sender = FaxToMailServiceUtils.addFaxDomainToFaxNumber(sender, selectedFolder);
+ }
+ model.setTo(sender);
+
DemandeUI demandeUI = (DemandeUI) getTabPanel().getSelectedComponent();
SaveAndOpenDialogAction action = new SaveAndOpenDialogAction(demandeUI.getHandler(),
false,
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/DemandeTableModel.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -97,7 +97,7 @@
put(MailField.EDI_RETURN,
ColumnIdentifier.<Email>newReadOnlyId(
- Email.PROPERTY_EDI_CODE_NUMBER,
+ Email.PROPERTY_EDI_ERROR,
n("faxtomail.demandeList.table.header.ediCodeNumber"),
n("faxtomail.demandeList.table.header.ediCodeNumber.tip")));
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -170,7 +170,9 @@
if (!colorNotAffectedFolders
|| context.getCurrentUser().isAffectedFoldersEmpty()
|| context.getCurrentUser().containsAffectedFolders(node.getMailFolder())) {
- foreground = Color.BLACK;
+
+ foreground = hasFocus ? Color.WHITE : Color.BLACK;
+
} else {
foreground = Color.LIGHT_GRAY;
}
@@ -315,7 +317,7 @@
log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath());
}
}
-
+
if (log.isTraceEnabled()) {
log.trace("Content after mail = " + content);
}
@@ -328,7 +330,7 @@
/**
* Force le chargement des attachmentFile (edited and original) pour un attachment.
- *
+ *
* @param context context
* @param attachment attachment
*/
@@ -434,7 +436,7 @@
/**
* Ouvre un attachment en fonction de la configuration des extensions, ou à default le open système.
- *
+ *
* @param context
* @param attachment
*/
@@ -443,7 +445,7 @@
File file = attachment.getFile();
String filename = attachment.getFilename();
String extension = FilenameUtils.getExtension(filename);
-
+
// get configuration extension command
ExtensionCommand extCommand = null;
if (StringUtils.isNotBlank(extension)) {
Modified: trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-06-28 14:29:21 UTC (rev 284)
@@ -105,7 +105,7 @@
faxtomail.demande.demandStatus.label=Statut
faxtomail.demande.demandType.label=Type
faxtomail.demande.docType.label=Type
-faxtomail.demande.ediCodeNumber.label=Retour EDI
+faxtomail.demande.ediError.label=Retour EDI
faxtomail.demande.etatAttente.label=État attente
faxtomail.demande.fax.label=Fax
faxtomail.demande.firstOpened.label=Première ouverture
@@ -167,8 +167,8 @@
faxtomail.demandeList.table.header.comment.tip=Commentaire
faxtomail.demandeList.table.header.companyReference=Notre ref
faxtomail.demandeList.table.header.companyReference.tip=Notre référence
-faxtomail.demandeList.table.header.ediCodeNumber=Code EDI
-faxtomail.demandeList.table.header.ediCodeNumber.tip=Code EDI
+faxtomail.demandeList.table.header.ediCodeNumber=Retour EDI
+faxtomail.demandeList.table.header.ediCodeNumber.tip=Retour EDI
faxtomail.demandeList.table.header.lastAttachmentOpeningUser=Dernier à ouvrir une PJ
faxtomail.demandeList.table.header.lastAttachmentOpeningUser.tip=Dernier utilisateur à avoir ouvert une pièce-jointe
faxtomail.demandeList.table.header.object=Objet
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailApplicationListener.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -27,6 +27,7 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+import com.franciaflex.faxtomail.web.job.ClientUpdateJob;
import com.franciaflex.faxtomail.web.job.EDIManagementJob;
import com.franciaflex.faxtomail.web.job.MailFilterJob;
import org.apache.commons.logging.Log;
@@ -87,6 +88,11 @@
.withIdentity("faxToMailJobs", "ediManagementJob")
.build();
+ JobDetail clientUpdateJob = JobBuilder.newJob(ClientUpdateJob.class)
+ .usingJobData(data)
+ .withIdentity("faxToMailJobs", "clientUpdateJob")
+ .build();
+
try {
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
@@ -109,6 +115,15 @@
scheduler.scheduleJob(ediManagementJob, trigger);
+ // schedule client updates (toutes les 15 minutes)
+ trigger = TriggerBuilder
+ .newTrigger()
+ .withIdentity("clientUpdates", "clientUpdatesTrigger")
+ .withSchedule(CronScheduleBuilder.cronSchedule("0 */15 * * * ?"))
+ .build();
+
+ scheduler.scheduleJob(clientUpdateJob, trigger);
+
scheduler.start();
log.debug("schedulers launched");
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/EDIManagementJob.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -52,7 +52,15 @@
EmailService emailService = serviceContext.newService(EmailService.class);
emailService.transmitPendingDemandsToEdi();
- //TODO kmorin 20140521 check in the transfert table if new command number arrived
+ if (log.isDebugEnabled()) {
+ log.debug("Transmission over");
+ }
+
+ emailService.updateRangeRowsWithEdiReturns();
+
+ if (log.isDebugEnabled()) {
+ log.debug("End of EDIManagementJob");
+ }
}
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-28 14:29:21 UTC (rev 284)
@@ -66,6 +66,7 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
@@ -214,189 +215,199 @@
MailFolderService mailFolderService = serviceContext.newService(MailFolderService.class);
for (int i = 0 ; i < count ; i++) {
- Email email = new EmailImpl();
+ try {
+ Email email = new EmailImpl();
- int messageNumber = count - i;
- Message message = folder.getMessage(messageNumber);
+ int messageNumber = count - i;
+ Message message = folder.getMessage(messageNumber);
- Charset charset = getCharset(message);
+ Charset charset = getCharset(message);
- List<String> modifiedProperties = new ArrayList<>();
+ List<String> modifiedProperties = new ArrayList<>();
- if (log.isDebugEnabled()){
- log.debug("Object: " + message.getSubject());
- }
+ if (log.isDebugEnabled()){
+ log.debug("Object: " + message.getSubject());
+ }
-// email.s(message.getSubject());
-// modifiedProperties.add(Email.PROPERTY_OBJECT);
+ // email.s(message.getSubject());
+ // modifiedProperties.add(Email.PROPERTY_OBJECT);
- List<Address> recipients = new ArrayList<>();
- Address[] toRecipients = message.getRecipients(Message.RecipientType.TO);
- if (toRecipients != null) {
- recipients.addAll(Arrays.asList(toRecipients));
- }
- Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC);
- if (ccRecipients != null) {
- recipients.addAll(Arrays.asList(ccRecipients));
- }
+ List<Address> recipients = new ArrayList<>();
+ Address[] toRecipients = message.getRecipients(Message.RecipientType.TO);
+ if (toRecipients != null) {
+ recipients.addAll(Arrays.asList(toRecipients));
+ }
+ Address[] ccRecipients = message.getRecipients(Message.RecipientType.CC);
+ if (ccRecipients != null) {
+ recipients.addAll(Arrays.asList(ccRecipients));
+ }
- MailFilter filter = null;
- for (Address address : recipients) {
+ MailFilter filter = null;
+ for (Address address : recipients) {
- String recipient = address.toString();
+ String recipient = address.toString();
- // some reciepient are like "toto tutu<toto.tutu73(a)gmail.com>"
- // the regex is to extract email address from it
- recipient = recipient.replaceFirst("^.*<(.*)>$", "$1");
- recipient = recipient.toLowerCase();
+ // some reciepient are like "toto tutu<toto.tutu73(a)gmail.com>"
+ // the regex is to extract email address from it
+ recipient = recipient.replaceFirst("^.*<(.*)>$", "$1");
+ recipient = recipient.toLowerCase();
- Collection<MailFilter> filters = mailFolderService.getFiltersForRecipient(recipient);
+ Collection<MailFilter> filters = mailFolderService.getFiltersForRecipient(recipient);
- if (CollectionUtils.isNotEmpty(filters)) {
- filter = filters.iterator().next();
- email.setRecipient(recipient);
- modifiedProperties.add(Email.PROPERTY_RECIPIENT);
- break;
+ if (CollectionUtils.isNotEmpty(filters)) {
+ filter = filters.iterator().next();
+ email.setRecipient(recipient);
+ modifiedProperties.add(Email.PROPERTY_RECIPIENT);
+ break;
+ }
+
}
-
- }
- if (filter == null) {
- if (log.isDebugEnabled()) {
- log.debug("Can't place mail " + message.getSubject() + " in any folder");
- if (log.isTraceEnabled()) {
- for (Address address : recipients) {
- log.trace(" - for recipient " + address.toString());
+ if (filter == null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Can't place mail " + message.getSubject() + " in any folder");
+ if (log.isTraceEnabled()) {
+ for (Address address : recipients) {
+ log.trace(" - for recipient " + address.toString());
+ }
}
}
+ continue;
}
- continue;
- }
- Address[] addresses = message.getFrom();
- if (addresses != null && addresses.length > 0) {
- String sender = addresses[0].toString();
- // some sender are like "toto tutu<toto.tutu73(a)gmail.com>"
- // the regex is to extract email address from it
- sender = sender.replaceFirst("^.*<(.*)>$", "$1");
- sender = sender.toLowerCase();
+ Address[] addresses = message.getFrom();
+ if (addresses != null && addresses.length > 0) {
+ String sender = addresses[0].toString();
+ // some sender are like "toto tutu<toto.tutu73(a)gmail.com>"
+ // the regex is to extract email address from it
+ sender = sender.replaceFirst("^.*<(.*)>$", "$1");
+ sender = sender.toLowerCase();
- email.setSender(sender);
- modifiedProperties.add(Email.PROPERTY_SENDER);
+ Client client = serviceContext.newService(ClientService.class)
+ .getClientForEmailAddress(sender, email);
+ modifiedProperties.add(Email.PROPERTY_SENDER);
- Client client = serviceContext.newService(ClientService.class)
- .getClientForEmailAddress(sender, email);
+ if (client != null) {
+ String object = client.getCaracteristic1() + " / " +
+ client.getCode() + " / " +
+ client.getName() + " / " +
+ client.getFaxNumber() + " / " +
+ DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date());
+ email.setObject(object);
+ modifiedProperties.add(Email.PROPERTY_OBJECT);
+ modifiedProperties.add(Email.PROPERTY_CLIENT);
+ }
+ email.setClient(client);
- if (client != null) {
- String object = client.getCaracteristic1() + " / " +
- client.getCode() + " / " +
- client.getName() + " / " +
- client.getFaxNumber() + " / " +
- DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date());
- email.setObject(object);
- modifiedProperties.add(Email.PROPERTY_OBJECT);
- modifiedProperties.add(Email.PROPERTY_CLIENT);
- }
- email.setClient(client);
+ MailFolder mailFolder = null;
+ if (!filter.isFilterFolderPriority() && client != null) {
+ FaxToMailUser personInCharge = client.getPersonInCharge();
+ if (personInCharge != null) {
+ mailFolder = mailFolderService.getFolderForFaxToMailUser(personInCharge);
+ }
+ }
- MailFolder mailFolder;
- if (filter.isFilterFolderPriority()) {
- if (client == null &&
- (filter.getMailFolder().getRejectUnknownSender() != null &&
- filter.getMailFolder().getRejectUnknownSender())) {
- // client unknown filter active
- // unknown client -> message rejected
- MailFolder folderTmp = filter.getMailFolder();
- emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
- continue;
+ if (mailFolder == null) {
+ // to default folder
+ mailFolder = filter.getMailFolder();
}
- // to default folder
- mailFolder = filter.getMailFolder();
- } else {
- // add to person in charge or reject the mail if client is unknown
- if (
- client == null ||
- client.getPersonInCharge() == null ||
- client.getPersonInCharge().getAffectedFolders() == null ||
- client.getPersonInCharge().getAffectedFolders().isEmpty()) {
- if(client == null &&
- (filter.getMailFolder().getRejectUnknownSender() != null &&
- filter.getMailFolder().getRejectUnknownSender())) {
- // rejected client mail unknown filter activated
- // mail rejected
- MailFolder folderTmp = filter.getMailFolder();
- emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
+ email.setMailFolder(mailFolder);
+ modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
+
+ // if client is null and folder
+ if (client == null) {
+ Boolean reject = null;
+ String rejectMessage = null;
+ String senderEmail = null;
+
+ // find reject conf
+ MailFolder rejectMailFolder = mailFolder;
+ while (!Boolean.FALSE.equals(reject) && rejectMailFolder != null
+ && (reject == null
+ || !rejectMailFolder.isUseCurrentLevelRejectResponseMessage()
+ || !rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress())) {
+
+ if (reject == null) {
+ reject = rejectMailFolder.getRejectUnknownSender();
+ }
+ if (rejectMessage == null && rejectMailFolder.isUseCurrentLevelRejectResponseMessage()) {
+ rejectMessage = rejectMailFolder.getRejectResponseMessage();
+ }
+ if (senderEmail == null && rejectMailFolder.isUseCurrentLevelRejectResponseMailAddress()) {
+ senderEmail = rejectMailFolder.getRejectResponseMailAddress();
+ }
+ rejectMailFolder = rejectMailFolder.getParent();
+ }
+
+ if (Boolean.TRUE.equals(reject)) {
+ // unknown client -> message rejected
+ String recipient = email.getSender();
+ if (email.isFax()) {
+ recipient = FaxToMailServiceUtils.addFaxDomainToFaxNumber(recipient, mailFolder);
+ }
+ emailService.rejectEmail(senderEmail, recipient, t("faxtomail.email.subject.re", message.getSubject()), rejectMessage);
continue;
}
- // client mailFolder unknown -> to default folder
- mailFolder = filter.getMailFolder();
- } else {
- // to client mailFolder
- FaxToMailUser personInCharge = client.getPersonInCharge();
- mailFolder = mailFolderService.getFolderForFaxToMailUser(personInCharge);
}
+
}
- // if no folder found, do not save the mail
- if (mailFolder == null) {
- continue;
+
+ Date receivedDate = message.getReceivedDate();
+ if (receivedDate == null) {
+ receivedDate = message.getSentDate();
}
+ email.setReceptionDate(receivedDate);
+ modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
- email.setMailFolder(mailFolder);
- modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
- }
+ Date now = new Date();
- Date receivedDate = message.getReceivedDate();
- if (receivedDate == null) {
- receivedDate = message.getSentDate();
- }
- email.setReceptionDate(receivedDate);
- modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
+ DecoratorService decoratorService = serviceContext.newService(DecoratorService.class);
+ Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
+ String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
+ email.setProjectReference(projectRef);
+ modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE);
- Date now = new Date();
+ email.setDemandStatus(DemandStatus.UNTREATED);
+ modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
- DecoratorService decoratorService = serviceContext.newService(DecoratorService.class);
- Decorator<Date> dateDecorator = decoratorService.getDecoratorByType(Date.class, DecoratorService.DATE);
- String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now));
- email.setProjectReference(projectRef);
- modifiedProperties.add(Email.PROPERTY_PROJECT_REFERENCE);
+ StringBuilder emailSource = new StringBuilder();
+ Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines();
+ while (headerLines.hasMoreElements()) {
+ String headerLine = headerLines.nextElement();
+ emailSource.append(headerLine).append("\n");
+ }
+ String originalContent = IOUtils.toString(message.getInputStream(), charset);
+ emailSource.append("\n").append(originalContent);
+ email.setOriginalEmail(emailSource.toString());
- email.setDemandStatus(DemandStatus.UNTREATED);
- modifiedProperties.add(Email.PROPERTY_DEMAND_STATUS);
+ List<Attachment> attachements = new ArrayList<>();
+ Attachment attachment = convertTextToPdf(emailSource.toString(), t("faxtomail.email.content.attachment.fileName"));
+ attachements.add(attachment);
- StringBuilder emailSource = new StringBuilder();
- Enumeration<String> headerLines = ((MimeMessage)message).getAllHeaderLines();
- while (headerLines.hasMoreElements()) {
- String headerLine = headerLines.nextElement();
- emailSource.append(headerLine).append("\n");
- }
- String originalContent = IOUtils.toString(message.getInputStream(), charset);
- emailSource.append("\n").append(originalContent);
- email.setOriginalEmail(emailSource.toString());
+ if (message.isMimeType("multipart/*")) {
+ decomposeMultipartEmail(attachements, message, email, emailService);
+ // } else {
+ // String content = IOUtils.toString(message.getInputStream(), charset);
+ // email.setPlainContent(content);
+ }
- List<Attachment> attachements = new ArrayList<>();
- Attachment attachment = convertTextToPdf(emailSource.toString(), email.getObject());
- attachements.add(attachment);
+ emailService.saveEmail(email,
+ attachements,
+ email.getClient() != null ? email.getClient().getCode() : null,
+ null,
+ modifiedProperties.toArray(new String[modifiedProperties.size()]));
- if (message.isMimeType("multipart/*")) {
- decomposeMultipartEmail(attachements, message, email, emailService);
-// } else {
-// String content = IOUtils.toString(message.getInputStream(), charset);
-// email.setPlainContent(content);
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Message:" +message.getSubject() + " placé dans le dossier " + email.getMailFolder().getName());
+ }
+ // suppression des mails sur le serveur distant (automatique par default)
+ if (serviceContext.getApplicationConfig().isMailDelete()) {
+ message.setFlag(Flags.Flag.DELETED, true);
+ }
- emailService.saveEmail(email,
- attachements,
- email.getClient() != null ? email.getClient().getCode() : null,
- null,
- modifiedProperties.toArray(new String[modifiedProperties.size()]));
-
- if (log.isDebugEnabled()) {
- log.debug("Message:" +message.getSubject() + " placé dans le dossier " + email.getMailFolder().getName());
+ } catch (Exception e) {
+ log.error("Error while reading the email", e);
}
- // suppression des mails sur le serveur distant (automatique par default)
- if (serviceContext.getApplicationConfig().isMailDelete()) {
- message.setFlag(Flags.Flag.DELETED, true);
- }
}
if (log.isDebugEnabled()){
log.debug("End of emails");
Modified: trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/resources/i18n/faxtomail-ui-web_fr_FR.properties 2014-06-28 14:29:21 UTC (rev 284)
@@ -34,4 +34,6 @@
com.franciaflex.faxtomail.persistence.entities.MailField.SAV_NB=Quantité de SAV
com.franciaflex.faxtomail.persistence.entities.MailField.SENDER=Émetteur
com.franciaflex.faxtomail.persistence.entities.MailField.TAKEN_BY=Pris par
+faxtomail.email.content.attachment.fileName=contenu du mail
faxtomail.email.projectReference.default=
+faxtomail.email.subject.re=Re \: %s
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-28 14:29:21 UTC (rev 284)
@@ -349,6 +349,29 @@
</label>
</div>
+ <div class="form-group" ng-if="selectedMailFolder.$parent">
+ <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" />
+ Hériter de l'adresse de réponse pour les rejets :</label>
+ <input type="text" class="form-control" disabled
+ ng-model="parentScopeValues.rejectResponseMailAddress" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMailAddress">
+ </div>
+ <div class="form-group">
+ <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="true" ng-if="selectedMailFolder.$parent" />
+ Définir l'adresse de réponse pour les rejets :</label>
+ <input type="text" class="form-control" ng-model="selectedMailFolder.rejectResponseMailAddress" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMailAddress || !selectedMailFolder.$parent">
+ </div>
+ <div class="form-group" ng-if="selectedMailFolder.$parent">
+ <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="false" />
+ Hériter du message de réponse pour les rejets :</label>
+ <textarea type="text" class="form-control" disabled
+ ng-model="parentScopeValues.rejectResponseMessage" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMessage"></textarea>
+ </div>
+ <div class="form-group">
+ <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="true" ng-if="selectedMailFolder.$parent" />
+ Définir le message de réponse pour les rejets :</label>
+ <textarea class="form-control" ng-model="selectedMailFolder.rejectResponseMessage" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMessage || !selectedMailFolder.$parent"></textarea>
+ </div>
+
<hr />
<div class="form-group" ng-if="selectedMailFolder.$parent">
@@ -382,30 +405,6 @@
<input type="text" class="form-control" ng-model="selectedMailFolder.faxDomain" ng-if="selectedMailFolder.useCurrentLevelFaxDomain || !selectedMailFolder.$parent">
</div>
- <hr />
-
- <div class="form-group" ng-if="selectedMailFolder.$parent">
- <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" />
- Hériter de l'adresse de réponse pour les rejets :</label>
- <input type="text" class="form-control" disabled
- ng-model="parentScopeValues.rejectResponseMailAddress" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMailAddress">
- </div>
- <div class="form-group">
- <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="true" ng-if="selectedMailFolder.$parent" />
- Définir l'adresse de réponse pour les rejets :</label>
- <input type="text" class="form-control" ng-model="selectedMailFolder.rejectResponseMailAddress" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMailAddress || !selectedMailFolder.$parent">
- </div>
- <div class="form-group" ng-if="selectedMailFolder.$parent">
- <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="false" />
- Hériter du message de réponse pour les rejets :</label>
- <textarea type="text" class="form-control" disabled
- ng-model="parentScopeValues.rejectResponseMessage" ng-if="!selectedMailFolder.useCurrentLevelRejectResponseMessage"></textarea>
- </div>
- <div class="form-group">
- <label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMessage" ng-value="true" ng-if="selectedMailFolder.$parent" />
- Définir le message de réponse pour les rejets :</label>
- <textarea class="form-control" ng-model="selectedMailFolder.rejectResponseMessage" ng-if="selectedMailFolder.useCurrentLevelRejectResponseMessage || !selectedMailFolder.$parent"></textarea>
- </div>
</div>
</div>
</div>
@@ -721,7 +720,7 @@
<label><input type="checkbox"
ng-model="readRightGroup"
ng-checked="selectedMailFolder.readRightGroups.containsByTopiaId(group)"
- ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group) || selectedMailFolder.writeRightGroups.containsByTopiaId(user)"
+ ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group) || selectedMailFolder.writeRightGroups.containsByTopiaId(group)"
ng-change="changeReadRightGroup(group)"> Lecture</label>
<label><input type="checkbox"
ng-model="writeRightGroup"
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-27 16:43:13 UTC (rev 283)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-28 14:29:21 UTC (rev 284)
@@ -332,7 +332,13 @@
topiaId: "new_" + guid(),
name: name,
children: [],
- archiveFolder: false
+ useCurrentLevelEtatAttente: true,
+ useCurrentLevelTableColumns: true,
+ useCurrentLevelFaxDomain: true,
+ useCurrentLevelEdiFolder: true,
+ useCurrentLevelRejectResponseMessage: true,
+ useCurrentLevelRejectResponseMailAddress: true,
+ archiveContainer: false
};
$scope.mailFolders.push(newRoot);
$scope._updateFlatMailFolders(); // update flat map
@@ -888,6 +894,7 @@
$scope.selectedMailFolder.writeRightGroups.splice(index, 1);
} else {
$scope.selectedMailFolder.writeRightGroups.push(group);
+ $scope.selectedMailFolder.readRightGroups.push(group);
}
};
// change le droit de déplacement du groupe
1
0
r283 - in trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content: demande print
by dcosse@users.forge.codelutin.com 27 Jun '14
by dcosse@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: dcosse
Date: 2014-06-27 18:43:13 +0200 (Fri, 27 Jun 2014)
New Revision: 283
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/283
Log:
Ajout de la possibilit?\195?\169 d'imprimer depuis la liste
Added:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.java
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-27 16:29:09 UTC (rev 282)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeListUIHandler.java 2014-06-27 16:43:13 UTC (rev 283)
@@ -28,6 +28,7 @@
import com.ezware.oxbow.swingbits.table.filter.TableRowFilterSupport;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -40,6 +41,7 @@
import com.franciaflex.faxtomail.ui.swing.actions.ComputeQuantitiesByRangeAction;
import com.franciaflex.faxtomail.ui.swing.actions.LoadFolderEmailsAction;
import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeFromListAction;
+import com.franciaflex.faxtomail.ui.swing.content.print.ComputeDemandeContent;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUI;
import com.franciaflex.faxtomail.ui.swing.content.reply.ReplyFormUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailDemandListHandler;
@@ -47,7 +49,6 @@
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.franciaflex.faxtomail.ui.swing.util.FolderTreeNode;
import jaxx.runtime.validator.swing.SwingValidator;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
@@ -69,6 +70,8 @@
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -89,6 +92,10 @@
/** Logger. */
private static final Log log = LogFactory.getLog(DemandeListUIHandler.class);
+ protected Map<String, String> pdfFieldValues;
+
+ protected DateFormat dayFormat = new SimpleDateFormat("dd/MM/yyyy");
+
public final PropertyChangeListener selectedDemandeChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -469,6 +476,14 @@
if (take) {
demandeUIModel.setTakenBy(currentUser);
}
+
+ final AttachmentFile demandFile = new AttachmentFileImpl();
+ demandFile.setFilename("demand_details");
+ ComputeDemandeContent generateDemandeContent = new ComputeDemandeContent();
+ byte[] demandContent = generateDemandeContent.getDocumentContent(demandeUIModel);
+ demandFile.setContent(demandContent);
+ FaxToMailUIUtil.print(demandFile, true);
+
for (Attachment attachment : demandeUIModel.getAttachment()) {
// force lasy loading
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-06-27 16:29:09 UTC (rev 282)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/AttachmentToPrintChooserUIHandler.java 2014-06-27 16:43:13 UTC (rev 283)
@@ -31,29 +31,17 @@
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.io.Closeables;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.pdfbox.examples.fdf.PrintFields;
-import org.apache.pdfbox.examples.fdf.SetField;
-import org.apache.pdfbox.pdmodel.PDDocument;
import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.List;
-import java.util.Map;
import static org.nuiton.i18n.I18n.t;
@@ -66,9 +54,7 @@
private static final Log log = LogFactory.getLog(AttachmentToPrintChooserUIHandler.class);
- protected Map<String, String> pdfFieldValues;
- protected DateFormat dayFormat = new SimpleDateFormat("dd/MM/yyyy");
@Override
@@ -84,7 +70,8 @@
// add demand details
final AttachmentFile demandFile = new AttachmentFileImpl();
demandFile.setFilename("demand_details");
- byte[] demandContent = getDocumentContent();
+ ComputeDemandeContent generateDemandeContent = new ComputeDemandeContent();
+ byte[] demandContent = generateDemandeContent.getDocumentContent(demand);
demandFile.setContent(demandContent);
getModel().addAttachmentToPrint(demandFile);
@@ -188,85 +175,5 @@
}
}
- public byte[] getDocumentContent() {
- pdfFieldValues = Maps.newHashMap();
- List<InputStream> streams = Lists.newArrayList();
- PDDocument resultDocument;
- byte[] result = null;
-
- try {
-
- InputStream emptyPage = getClass().getResourceAsStream("/pdf/demande.pdf");
- streams.add(emptyPage);
- resultDocument = PDDocument.load(emptyPage);
- SetField fields = new SetField();
- if (log.isTraceEnabled()) {
- log.trace("fields in document are:");
- PrintFields printFields = new PrintFields();
- printFields.printFields(resultDocument);
- }
-
- loadDocumentDedails();
-
-
- if (log.isDebugEnabled()) {
- log.debug("will fill form document:\n" + pdfFieldValues);
- }
-
- for (Map.Entry<String, String> field : pdfFieldValues.entrySet()) {
- String fieldName = field.getKey();
- String fieldValue = field.getValue();
- fields.setField(resultDocument, fieldName, fieldValue);
- }
-
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- resultDocument.save(out);
- resultDocument.close();
-
- result = out.toByteArray();
-
-
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("", e);
- }
- } finally {
- for (InputStream is : streams) {
- try {
- Closeables.close(is, false);
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("An exception occurred", e);
- }
- }
- }
- }
- return result;
- }
-
- protected void loadDocumentDedails() {
- DemandeUIModel demand = getModel().getDemand();
- setField("demand", demand.getObject());
- setField("receivedDate", dayFormat.format(demand.getReceptionDate()));
- setField("sender", demand.getSender());
- setField("object", demand.getObject());
- setField("clientCode", demand.getClientCode());
- setField("demandType", (demand.getDemandType() == null) ? "" : demand.getDemandType().getLabel());
- setField("priority", (demand.getPriority() == null) ? "" : demand.getPriority().getLabel());
- setField("projectReference", demand.getProjectReference());
- setField("companyReference", demand.getCompanyReference());
- setField("etatAttente", (demand.getEtatAttente() == null) ? "" : demand.getEtatAttente().getLabel());
- setField("status", (demand.getDemandStatus() == null) ? "" : demand.getDemandStatus().getLabel());
- setField("takenBy", (demand.getTakenBy() == null) ? "" : (demand.getTakenBy().getLogin() + " " + demand.getTakenBy().getFirstName() + " " + demand.getTakenBy().getLastName()));
- }
-
- protected void setField(String fieldName, String... value) {
- if (value == null) {
- pdfFieldValues.put(fieldName, "");
- } else {
- pdfFieldValues.put(fieldName, Joiner.on(" ").skipNulls().join(value));
- }
- }
}
Added: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.java (rev 0)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.java 2014-06-27 16:43:13 UTC (rev 283)
@@ -0,0 +1,112 @@
+package com.franciaflex.faxtomail.ui.swing.content.print;
+
+import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.io.Closeables;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pdfbox.examples.fdf.PrintFields;
+import org.apache.pdfbox.examples.fdf.SetField;
+import org.apache.pdfbox.pdmodel.PDDocument;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by davidcosse on 27/06/14.
+ */
+public class ComputeDemandeContent {
+
+ private static final Log log = LogFactory.getLog(ComputeDemandeContent.class);
+ protected Map<String, String> pdfFieldValues;
+ protected DateFormat dayFormat = new SimpleDateFormat("dd/MM/yyyy");
+
+
+ public byte[] getDocumentContent(DemandeUIModel demand) {
+ pdfFieldValues = Maps.newHashMap();
+ List<InputStream> streams = Lists.newArrayList();
+ PDDocument resultDocument;
+
+ byte[] result = null;
+
+ try {
+
+ InputStream emptyPage = getClass().getResourceAsStream("/pdf/demande.pdf");
+ streams.add(emptyPage);
+ resultDocument = PDDocument.load(emptyPage);
+ SetField fields = new SetField();
+ if (log.isTraceEnabled()) {
+ log.trace("fields in document are:");
+ PrintFields printFields = new PrintFields();
+ printFields.printFields(resultDocument);
+ }
+
+ loadDocumentDedails(demand);
+
+
+ if (log.isDebugEnabled()) {
+ log.debug("will fill form document:\n" + pdfFieldValues);
+ }
+
+ for (Map.Entry<String, String> field : pdfFieldValues.entrySet()) {
+ String fieldName = field.getKey();
+ String fieldValue = field.getValue();
+ fields.setField(resultDocument, fieldName, fieldValue);
+ }
+
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ resultDocument.save(out);
+ resultDocument.close();
+
+ result = out.toByteArray();
+
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("", e);
+ }
+ } finally {
+ for (InputStream is : streams) {
+ try {
+ Closeables.close(is, false);
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("An exception occurred", e);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ protected void loadDocumentDedails(DemandeUIModel demand) {
+ setField("demand", demand.getObject());
+ setField("receivedDate", dayFormat.format(demand.getReceptionDate()));
+ setField("sender", demand.getSender());
+ setField("object", demand.getObject());
+ setField("clientCode", demand.getClientCode());
+ setField("demandType", (demand.getDemandType() == null) ? "" : demand.getDemandType().getLabel());
+ setField("priority", (demand.getPriority() == null) ? "" : demand.getPriority().getLabel());
+ setField("projectReference", demand.getProjectReference());
+ setField("companyReference", demand.getCompanyReference());
+ setField("etatAttente", (demand.getEtatAttente() == null) ? "" : demand.getEtatAttente().getLabel());
+ setField("status", (demand.getDemandStatus() == null) ? "" : demand.getDemandStatus().getLabel());
+ setField("takenBy", (demand.getTakenBy() == null) ? "" : (demand.getTakenBy().getLogin() + " " + demand.getTakenBy().getFirstName() + " " + demand.getTakenBy().getLastName()));
+ }
+
+ protected void setField(String fieldName, String... value) {
+ if (value == null) {
+ pdfFieldValues.put(fieldName, "");
+ } else {
+ pdfFieldValues.put(fieldName, Joiner.on(" ").skipNulls().join(value));
+ }
+ }
+}
1
0
27 Jun '14
Author: echatellier
Date: 2014-06-27 18:29:09 +0200 (Fri, 27 Jun 2014)
New Revision: 282
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/282
Log:
Ouverture des pieces jointes suivant la commande de la configuration
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -0,0 +1,42 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ExtensionCommandTopiaDao extends AbstractExtensionCommandTopiaDao<ExtensionCommand> {
+
+ public ExtensionCommand findByExtension(String extension) {
+ String query = "FROM " + ExtensionCommand.class.getName() +
+ " WHERE lower(" + ExtensionCommand.PROPERTY_EXTENSION + ") = :extension";
+
+ Map<String, Object> args = new HashMap<>();
+ args.put("extension", extension);
+ ExtensionCommand result = findUniqueOrNull(query, args);
+ return result;
+ }
+
+} //ExtensionCommandTopiaDao
Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ExtensionCommandTopiaDao.java
___________________________________________________________________
Added: svn:eol-style
+ native
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-27 15:39:42 UTC (rev 281)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -56,6 +56,8 @@
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteImpl;
import com.franciaflex.faxtomail.persistence.entities.EtatAttenteTopiaDao;
+import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand;
+import com.franciaflex.faxtomail.persistence.entities.ExtensionCommandTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroupTopiaDao;
@@ -457,6 +459,12 @@
return faxToMailUserGroupDao.forAll().setOrderByArguments(FaxToMailUserGroup.PROPERTY_COMPLETE_NAME).findAll();
}
+ public ExtensionCommand getExtensionCommand(String extension) {
+ ExtensionCommandTopiaDao extensionCommandDao = getPersistenceContext().getExtensionCommandDao();
+ ExtensionCommand result = extensionCommandDao.findByExtension(extension);
+ return result;
+ }
+
/**
* Retourne l'ensemble des utilisateurs appartenant aux groupes gérés par les groupes chef.
*
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java 2014-06-27 15:39:42 UTC (rev 281)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/OpenAttachmentAction.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -64,7 +64,6 @@
getModel().fireAttachmentOpened(attachment, original);
FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment);
AttachmentFile attachmentFile = original ? attachment.getOriginalFile() : attachment.getEditedFile();
- File file = attachmentFile.getFile();
- DesktopUtil.browse(file.toURI());
+ FaxToMailUIUtil.openFile(getContext(), attachmentFile);
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-06-27 15:39:42 UTC (rev 281)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -64,6 +64,7 @@
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
import com.franciaflex.faxtomail.ui.swing.util.Cancelable;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
import com.google.common.collect.Lists;
/**
@@ -279,8 +280,7 @@
public void openAttachment(AttachmentFile attachment) {
- File file = attachment.getFile();
- DesktopUtil.browse(file.toURI());
+ FaxToMailUIUtil.openFile(getContext(), attachment);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-27 15:39:42 UTC (rev 281)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -24,11 +24,15 @@
import static org.nuiton.i18n.I18n.t;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Desktop;
+import java.awt.Font;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -64,17 +68,25 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Predicate;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.application.ApplicationBusinessException;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.jaxx.application.swing.util.ApplicationUIUtil;
+import org.nuiton.util.DesktopUtil;
import org.nuiton.util.FileUtil;
+import org.nuiton.util.StringUtil;
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
+import com.franciaflex.faxtomail.persistence.entities.AttachmentFileImpl;
+import com.franciaflex.faxtomail.persistence.entities.ExtensionCommand;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler;
@@ -324,15 +336,17 @@
if (log.isDebugEnabled()) {
log.debug("Force attachment loading " + attachment.getOriginalFileName());
}
- EmailService service = context.getEmailService();
- if (attachment.getOriginalFile() == null) {
- AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), true);
- attachment.setOriginalFile(file);
+ if (attachment.isPersisted()) {
+ EmailService service = context.getEmailService();
+ if (attachment.getOriginalFile() == null) {
+ AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), true);
+ attachment.setOriginalFile(file);
+ }
+ if (attachment.getEditedFile() == null) {
+ AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), false);
+ attachment.setEditedFile(file);
+ }
}
- if (attachment.getEditedFile() == null) {
- AttachmentFile file = service.getAttachmentFile(attachment.getTopiaId(), false);
- attachment.setEditedFile(file);
- }
}
public static Desktop getDesktopForPrint() {
@@ -417,4 +431,50 @@
public static String getEditedFileName(String originalFileName) {
return t("faxtomail.attachment.editedFile.name", originalFileName) + "-.pdf";
}
+
+ /**
+ * Ouvre un attachment en fonction de la configuration des extensions, ou à default le open système.
+ *
+ * @param context
+ * @param attachment
+ */
+ public static void openFile(FaxToMailUIContext context, AttachmentFile attachment) {
+
+ File file = attachment.getFile();
+ String filename = attachment.getFilename();
+ String extension = FilenameUtils.getExtension(filename);
+
+ // get configuration extension command
+ ExtensionCommand extCommand = null;
+ if (StringUtils.isNotBlank(extension)) {
+ ConfigurationService service = context.getConfigurationService();
+ extCommand = service.getExtensionCommand(extension);
+ }
+
+ // open file
+ if (extCommand != null && StringUtils.isNotBlank(extCommand.getOpenAttachmentCommand())) {
+ String command = extCommand.getOpenAttachmentCommand();
+ String[] args = StringUtil.split(command, " ");
+ List<String> comArgs = new ArrayList<String>();
+ for (String arg : args) {
+ String localArg = arg;
+ localArg = localArg.replace("%f", file.getAbsolutePath());
+ comArgs.add(localArg);
+ }
+ ProcessBuilder pb = new ProcessBuilder(comArgs);
+ // run process
+ if (log.isDebugEnabled()) {
+ log.debug("Open attachment with command : " + comArgs);
+ }
+ try {
+ pb.start();
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Cannot run convert command", e);
+ }
+ }
+ } else {
+ DesktopUtil.open(file);
+ }
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 15:39:42 UTC (rev 281)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 16:29:09 UTC (rev 282)
@@ -65,6 +65,7 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
@@ -511,11 +512,12 @@
String filename = attachment.getOriginalFileName();
String extension = FilenameUtils.getExtension(filename);
- Collection<ExtensionCommand> commands = CollectionUtils.emptyIfNull(configurationService.getConfiguration().getExtensionCommands());
- for (ExtensionCommand command : commands) {
- if (extension.equalsIgnoreCase(command.getExtension())) {
+ if (StringUtils.isNotBlank(extension)) {
+ ExtensionCommand command = configurationService.getExtensionCommand(extension);
+
+ // si une extension est configurée avec une commande non vide
+ if (command != null && StringUtils.isNotBlank(command.getConvertToPdfCommand())) {
attachment = convertToPdf(attachment, command);
- break;
}
}
return attachment;
@@ -545,11 +547,14 @@
// get process command
String command = extensionCommand.getConvertToPdfCommand();
- command = StringUtils.replaceOnce(command, "%f", "\"" + file.getAbsolutePath() + "\"");
- command = StringUtils.replaceOnce(command, "%o", "\"" + outfile.getAbsolutePath() + "\"");
-
String[] args = StringUtil.split(command, " ");
- List<String> comArgs = Arrays.asList(args);
+ List<String> comArgs = new ArrayList<String>();
+ for (String arg : args) {
+ String localArg = arg;
+ localArg = localArg.replace("%f", file.getAbsolutePath());
+ localArg = localArg.replace("%o", outfile.getAbsolutePath());
+ comArgs.add(localArg);
+ }
ProcessBuilder pb = new ProcessBuilder(comArgs);
// run process
if (log.isDebugEnabled()) {
1
0
27 Jun '14
Author: kmorin
Date: 2014-06-27 17:39:42 +0200 (Fri, 27 Jun 2014)
New Revision: 281
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/281
Log:
- cloture propre de l'appli swing
- prise en compte des dossiers affect?\195?\169s ?\195?\160 l'utilisateur
- g?\195?\169n?\195?\169ration du contenu du mail en pdf
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
trunk/faxtomail-ui-web/pom.xml
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -0,0 +1,10 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public enum NewClientType {
+
+ CREATION, UPDATE, DELETION
+}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -25,9 +25,12 @@
*/
import com.franciaflex.faxtomail.persistence.entities.Client;
+import com.franciaflex.faxtomail.persistence.entities.ClientImpl;
import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.NewClient;
+import com.franciaflex.faxtomail.persistence.entities.NewClientTopiaDao;
import com.franciaflex.faxtomail.services.FaxToMailServiceSupport;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
@@ -38,6 +41,7 @@
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.Binder;
import java.util.ArrayList;
import java.util.List;
@@ -64,6 +68,7 @@
if (CollectionUtils.isEmpty(clients)) {
emailAddress = emailAddress.substring(0, emailAddress.indexOf('@'));
+ emailAddress.replaceAll(" ", "");
if (NumberUtils.isNumber(emailAddress)) {
emailAddress = StringUtils.leftPad(emailAddress, 10, '0');
clients = clientDao.forFaxNumberEquals(emailAddress).findAll();
@@ -104,4 +109,25 @@
}
return client;
}
+
+ public void updateNewClients() {
+ NewClientTopiaDao dao = getPersistenceContext().getNewClientDao();
+ List<NewClient> newClients = dao.findAll();
+
+ Binder<NewClient, Client> binder = new Binder<>();
+ List<Client> clients = new ArrayList<>();
+ for (NewClient newClient : newClients) {
+ Client client = new ClientImpl();
+ binder.copyExcluding(newClient, client,
+ NewClient.PROPERTY_TOPIA_ID,
+ NewClient.PROPERTY_TOPIA_CREATE_DATE,
+ NewClient.PROPERTY_TOPIA_VERSION);
+ clients.add(client);
+ }
+ //TODO kmorin 20140626 update some clients and add others
+
+// dao.deleteAll(newClients);
+// getPersistenceContext().commit();
+ }
+
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -342,7 +342,7 @@
}
filter.setExpression(mailFilter.getExpression().toLowerCase());
- filter.setClientResponsiblePriority(mailFilter.isClientResponsiblePriority());
+ filter.setFilterFolderPriority(mailFilter.isFilterFolderPriority());
// mailFilter.getMailFolder().getTopiaId() can start with new_
MailFolder mailFolder = mailFolderCache.get(mailFilter.getMailFolder().getTopiaId());
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -326,6 +326,16 @@
firePropertyChanged(PROPERTY_CLIENT_CODE, oldValue, clientCode);
}
+ public boolean isFax() {
+ return editObject.isFax();
+ }
+
+ public void setFax(boolean fax) {
+ Object oldValue = isFax();
+ editObject.setFax(fax);
+ firePropertyChanged(Email.PROPERTY_FAX, oldValue, fax);
+ }
+
public void setClient(Client client) {
Object oldValue = getClient();
editObject.setClient(client);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -156,6 +156,7 @@
Color foreground;
if (!colorNotAffectedFolders
+ || context.getCurrentUser().isAffectedFoldersEmpty()
|| context.getCurrentUser().containsAffectedFolders(node.getMailFolder())) {
foreground = Color.BLACK;
} else {
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-web/pom.xml 2014-06-27 15:39:42 UTC (rev 281)
@@ -287,6 +287,12 @@
<groupId>org.webjars</groupId>
<artifactId>respond</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.itextpdf</groupId>
+ <artifactId>itextpdf</artifactId>
+ </dependency>
+
</dependencies>
<build>
Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java (rev 0)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -0,0 +1,32 @@
+package com.franciaflex.faxtomail.web.job;
+
+import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
+import com.franciaflex.faxtomail.services.service.ClientService;
+import com.franciaflex.faxtomail.services.service.EmailService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class ClientUpdateJob extends AbstractFaxToMailJob {
+
+ private static final Log log = LogFactory.getLog(ClientUpdateJob.class);
+
+ protected FaxToMailServiceContext serviceContext;
+
+ @Override
+ public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+ serviceContext = getServiceContext(jobExecutionContext);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Running ClientUpdateJob at " + serviceContext.getNow());
+ }
+
+ ClientService clientService = serviceContext.newService(ClientService.class);
+ clientService.updateNewClients();
+ }
+}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 15:39:42 UTC (rev 281)
@@ -26,9 +26,17 @@
import static org.nuiton.i18n.I18n.t;
+import java.awt.image.RenderedImage;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.util.ArrayList;
@@ -42,7 +50,6 @@
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Address;
-import javax.mail.BodyPart;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
@@ -58,6 +65,11 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
+import com.itextpdf.text.Document;
+import com.itextpdf.text.DocumentException;
+import com.itextpdf.text.PageSize;
+import com.itextpdf.text.Paragraph;
+import com.itextpdf.text.pdf.PdfWriter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils;
@@ -286,7 +298,20 @@
email.setClient(client);
MailFolder mailFolder;
- if (filter.isClientResponsiblePriority()) {
+ if (filter.isFilterFolderPriority()) {
+ if (client == null &&
+ (filter.getMailFolder().getRejectUnknownSender() != null &&
+ filter.getMailFolder().getRejectUnknownSender())) {
+ // client unknown filter active
+ // unknown client -> message rejected
+ MailFolder folderTmp = filter.getMailFolder();
+ emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
+ continue;
+ }
+ // to default folder
+ mailFolder = filter.getMailFolder();
+
+ } else {
// add to person in charge or reject the mail if client is unknown
if (
client == null ||
@@ -309,24 +334,14 @@
FaxToMailUser personInCharge = client.getPersonInCharge();
mailFolder = mailFolderService.getFolderForFaxToMailUser(personInCharge);
}
- } else {
- if(client == null &&
- (filter.getMailFolder().getRejectUnknownSender() != null &&
- filter.getMailFolder().getRejectUnknownSender())) {
- // client unknown filter active
- // unknown client -> message rejected
- MailFolder folderTmp = filter.getMailFolder();
- emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
- continue;
- }
- // to default folder
- mailFolder = filter.getMailFolder();
}
- if (mailFolder != null) {
- email.setMailFolder(mailFolder);
- modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
+ // if no folder found, do not save the mail
+ if (mailFolder == null) {
+ continue;
}
+ email.setMailFolder(mailFolder);
+ modifiedProperties.add(Email.PROPERTY_MAIL_FOLDER);
}
Date receivedDate = message.getReceivedDate();
@@ -358,6 +373,9 @@
email.setOriginalEmail(emailSource.toString());
List<Attachment> attachements = new ArrayList<>();
+ Attachment attachment = convertTextToPdf(emailSource.toString(), email.getObject());
+ attachements.add(attachment);
+
if (message.isMimeType("multipart/*")) {
decomposeMultipartEmail(attachements, message, email, emailService);
// } else {
@@ -565,4 +583,35 @@
return attachment;
}
+
+ public Attachment convertTextToPdf(String content, String name) throws IOException, DocumentException {
+
+ File target = File.createTempFile("faxtomail-", ".tmp");
+ target.deleteOnExit();
+
+ Document document = new Document();
+ FileOutputStream fos = new FileOutputStream(target);
+ PdfWriter writer = PdfWriter.getInstance(document, fos);
+ writer.open();
+
+ document.setPageSize(PageSize.A4);
+ document.open();
+
+ document.add(new Paragraph(content));
+
+ document.close();
+ writer.close();
+
+ // convert content to blob
+ EmailService emailService = serviceContext.newService(EmailService.class);
+ AttachmentFile attachmentFileNew = emailService.getAttachmentFileFromStream(new FileInputStream(target));
+ attachmentFileNew.setFilename(name + ".pdf");
+
+ Attachment attachment = new AttachmentImpl();
+ attachment.setOriginalFile(attachmentFileNew);
+ attachment.setOriginalFileName(name);
+ attachment.setAddedByUser(false);
+
+ return attachment;
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 15:39:42 UTC (rev 281)
@@ -899,7 +899,7 @@
<tr ng-repeat="mailFilter in rootFolderMailFilters[mailFolder.topiaId]">
<td>{{mailFilter.expression}}</td>
<td>{{mailFilter.mailFolder.$fullPath}}</td>
- <td>{{mailFilter.clientResponsiblePriority ? 'Oui' : 'Non'}}</td>
+ <td>{{mailFilter.filterFolderPriority ? 'Oui' : 'Non'}}</td>
<td><a class="btn btn-danger btn-xs" ng-click="removeFilter(mailFolder, mailFilter)">
<span class="glyphicon glyphicon-remove"></span>
</a></td>
@@ -917,14 +917,14 @@
<select class="form-control" ng-model="newFilter.mailFolder" ng-options="mailFolder.$fullPath for mailFolder in flatMailFolders[mailFolder.topiaId]"></select>
</div>
<div class="form-group">
- <label for="clientResponsiblePriorityField">Utiliser le dossier de la règle en priorité : </label>
+ <label for="filterFolderPriorityField">Utiliser le dossier de la règle en priorité : </label>
<label class="radio-inline">
<input type="radio"
- ng-model="newFilter.clientResponsiblePriority" ng-value="false"> non
+ ng-model="newFilter.filterFolderPriority" ng-value="false"> non
</label>
<label class="radio-inline">
<input type="radio"
- ng-model="newFilter.clientResponsiblePriority" ng-value="true"> oui
+ ng-model="newFilter.filterFolderPriority" ng-value="true"> oui
</label>
</div>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-27 15:23:36 UTC (rev 280)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-27 15:39:42 UTC (rev 281)
@@ -936,7 +936,7 @@
ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$window', 'ConfigurationData',
function($scope, $window, ConfigurationData) {
//{Object} New accout empty filter
- $scope.newFilter = {clientResponsiblePriority:true};
+ $scope.newFilter = { filterFolderPriority: false };
// option de la configuration 'sortable'
$scope.sortableOptions = {
@@ -957,7 +957,7 @@
}
$scope.rootFolderMailFilters[rootMailFolder.topiaId].push($scope.newFilter);
// clear form
- $scope.newFilter = {clientResponsiblePriority:false};
+ $scope.newFilter = { filterFolderPriority: false };
};
// remove filter
1
0
r280 - trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 27 Jun '14
by echatellier@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: echatellier
Date: 2014-06-27 17:23:36 +0200 (Fri, 27 Jun 2014)
New Revision: 280
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/280
Log:
Fix tooltip
Add doc
Fix rigths
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 15:02:46 UTC (rev 279)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 15:23:36 UTC (rev 280)
@@ -124,6 +124,7 @@
<div class="form-group">
<label for="openAttachmentCommandField">Ouverture :</label>
<input id="openAttachmentCommandField" type="text" class="form-control" ng-model="extensionCommand.openAttachmentCommand" placeholder="" />
+ <p class="help-block">Utilisez <code>%f</code> pour representer le fichier en entrée de la commande</p>
</div>
</td>
</tr>
@@ -229,12 +230,14 @@
<a class="btn btn-success btn-xs" data-nodrag ng-click="toggle(this)" ng-disabled="!mailFolder.children || mailFolder.children.length == 0">
<span class="glyphicon" ng-class="{'glyphicon-chevron-right': !collapsed, 'glyphicon-chevron-down': collapsed}"></span>
</a>
- <a ng-click="editMailFolder(mailFolder)">{{mailFolder.name}} <span class="badge">{{mailFolder.$cumulativeCount}}</span></a>
+ <a ng-click="editMailFolder(mailFolder)">{{mailFolder.name}}</a>
<a class="pull-right btn btn-info btn-xs" data-nodrag ng-click="newArchiveSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.hasArchiveFolder && !mailFolder.archiveFolder" tooltip="Créer un dossier d'archive"><span class="glyphicon glyphicon-plus"></span></a>
- <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.archiveFolder"><span class="glyphicon glyphicon-plus"></span></a>
- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteFolder(this)" ng-disabled="mailFolder.$cumulativeCount > 0"
- tooltip="{{mailFolder.$cumulativeCount > 0 && 'Ce dossier contient ' + mailFolder.$cumulativeCount + ' demandes !'|| 'Supprimer ce dossier'}}">
- <span class="glyphicon glyphicon-remove"></span></a>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubFolder(this)" style="margin-left: 8px;" ng-show="!mailFolder.archiveFolder" tooltip="Créer un sous-dossier"><span class="glyphicon glyphicon-plus"></span></a>
+ <span class="pull-right" tooltip="{{mailFolder.$cumulativeCount > 0 && 'Ce dossier contient ' + mailFolder.$cumulativeCount + ' demandes et ne peut pas être supprimé !'|| 'Supprimer ce dossier'}}">
+ <a class="btn btn-danger btn-xs" data-nodrag ng-click="deleteFolder(this)" ng-disabled="mailFolder.$cumulativeCount > 0">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ </span>
</div>
<ol ui-tree-nodes="options" ng-model="mailFolder.children" ng-class="{hidden: !collapsed}">
<li ng-repeat="mailFolder in mailFolder.children" ui-tree-node ng-include="'nodes_renderer.html'">
@@ -718,7 +721,7 @@
<label><input type="checkbox"
ng-model="readRightGroup"
ng-checked="selectedMailFolder.readRightGroups.containsByTopiaId(group)"
- ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group)"
+ ng-disabled="parentScopeValues.readRightGroups.containsByTopiaId(group) || selectedMailFolder.writeRightGroups.containsByTopiaId(user)"
ng-change="changeReadRightGroup(group)"> Lecture</label>
<label><input type="checkbox"
ng-model="writeRightGroup"
1
0
r279 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by dcosse@users.forge.codelutin.com 27 Jun '14
by dcosse@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: dcosse
Date: 2014-06-27 17:02:46 +0200 (Fri, 27 Jun 2014)
New Revision: 279
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/279
Log:
rejet des mails dont le client n'est pas connu, correction sur l'arborescence des dossiers
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-27 14:50:53 UTC (rev 278)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-06-27 15:02:46 UTC (rev 279)
@@ -650,4 +650,28 @@
getPersistenceContext().commit();
}
+
+ public void rejectEmail(String from, String to, String subject,
+ String content) throws EmailException, MessagingException, IOException {
+
+ final String smtpUser = getApplicationConfig().getSmtpUser();
+ final String password = getApplicationConfig().getSmtpPassword();
+ final boolean useSsl = getApplicationConfig().isSmtpUseSsl();
+
+ MultiPartEmail message = new MultiPartEmail();
+ message.setHostName(getApplicationConfig().getSmtpHost());
+ message.setSmtpPort(getApplicationConfig().getSmtpPort());
+ if (StringUtils.isNotBlank(smtpUser) && password != null) {
+ message.setAuthenticator(new DefaultAuthenticator(smtpUser, password));
+ }
+ message.setSSLOnConnect(useSsl);
+
+ message.setCharset(EmailConstants.UTF_8);
+ message.setFrom(from);
+ message.addTo(to);
+ message.setSubject(subject);
+ message.setMsg(content);
+
+ message.send();
+ }
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-06-27 14:50:53 UTC (rev 278)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailActionSupport.java 2014-06-27 15:02:46 UTC (rev 279)
@@ -26,6 +26,7 @@
import java.util.Map;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserAbstract;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Result;
@@ -59,6 +60,30 @@
public static final String NEXT = "next";
+ protected static final Multimap<Class<?>, String> GSON_EXCLUSIONS = HashMultimap.create();
+
+ static {
+ // Fill exclusion map
+ GSON_EXCLUSIONS.put(FaxToMailUserAbstract.class, FaxToMailUser.PROPERTY_AFFECTED_FOLDERS);
+ GSON_EXCLUSIONS.put(MailFolderAbstract.class, MailFolder.PROPERTY_PARENT);
+ }
+
+ protected static final ExclusionStrategy EXCLUSION_STRATEGY = new ExclusionStrategy() {
+ @Override
+ public boolean shouldSkipField(FieldAttributes f) {
+ // TODO AThimel 06/08/13 Maybe another Multimap implementation will do the job ?
+ Class<?> declaringClass = f.getDeclaringClass();
+ String attributeName = f.getName();
+ boolean result = GSON_EXCLUSIONS.containsEntry(declaringClass, attributeName);
+ return result;
+ }
+
+ @Override
+ public boolean shouldSkipClass(Class<?> clazz) {
+ return false;
+ }
+ };
+
protected FaxToMailConfiguration applicationConfig;
protected FaxToMailSession session;
@@ -106,25 +131,8 @@
public static Gson getGson() {
if (gson == null) {
GsonBuilder builder = new GsonBuilder();
-
// exclusion
- final Multimap<Class<?>, String> gsonExclusions = HashMultimap.create();
- gsonExclusions.put(MailFolderAbstract.class, MailFolder.PROPERTY_PARENT);
- builder.addSerializationExclusionStrategy(new ExclusionStrategy() {
- @Override
- public boolean shouldSkipField(FieldAttributes f) {
- // TODO AThimel 06/08/13 Maybe another Multimap implementation will do the job ?
- Class<?> declaringClass = f.getDeclaringClass();
- String attributeName = f.getName();
- boolean result = gsonExclusions.containsEntry(declaringClass, attributeName);
- return result;
- }
-
- @Override
- public boolean shouldSkipClass(Class<?> clazz) {
- return false;
- }
- });
+ builder.addSerializationExclusionStrategy(EXCLUSION_STRATEGY);
// Renseigne a gson comment instancier les Impl à partir des interfaces Topia
FaxToMailEntityEnum[] classes = FaxToMailEntityEnum.getContracts();
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 14:50:53 UTC (rev 278)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-27 15:02:46 UTC (rev 279)
@@ -285,19 +285,41 @@
}
email.setClient(client);
- MailFolder mailFolder = null;
+ MailFolder mailFolder;
if (filter.isClientResponsiblePriority()) {
+ // add to person in charge or reject the mail if client is unknown
if (
client == null ||
client.getPersonInCharge() == null ||
client.getPersonInCharge().getAffectedFolders() == null ||
client.getPersonInCharge().getAffectedFolders().isEmpty()) {
+ if(client == null &&
+ (filter.getMailFolder().getRejectUnknownSender() != null &&
+ filter.getMailFolder().getRejectUnknownSender())) {
+ // rejected client mail unknown filter activated
+ // mail rejected
+ MailFolder folderTmp = filter.getMailFolder();
+ emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
+ continue;
+ }
+ // client mailFolder unknown -> to default folder
mailFolder = filter.getMailFolder();
} else {
+ // to client mailFolder
FaxToMailUser personInCharge = client.getPersonInCharge();
mailFolder = mailFolderService.getFolderForFaxToMailUser(personInCharge);
}
} else {
+ if(client == null &&
+ (filter.getMailFolder().getRejectUnknownSender() != null &&
+ filter.getMailFolder().getRejectUnknownSender())) {
+ // client unknown filter active
+ // unknown client -> message rejected
+ MailFolder folderTmp = filter.getMailFolder();
+ emailService.rejectEmail(email.getRecipient(), email.getSender(), email.getObject(), folderTmp.getRejectResponseMessage());
+ continue;
+ }
+ // to default folder
mailFolder = filter.getMailFolder();
}
if (mailFolder != null) {
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 14:50:53 UTC (rev 278)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-27 15:02:46 UTC (rev 279)
@@ -896,7 +896,7 @@
<tr ng-repeat="mailFilter in rootFolderMailFilters[mailFolder.topiaId]">
<td>{{mailFilter.expression}}</td>
<td>{{mailFilter.mailFolder.$fullPath}}</td>
- <td>{{mailFilter.clientResponsiblePriority ? 'Non' : 'Oui'}}</td>
+ <td>{{mailFilter.clientResponsiblePriority ? 'Oui' : 'Non'}}</td>
<td><a class="btn btn-danger btn-xs" ng-click="removeFilter(mailFolder, mailFilter)">
<span class="glyphicon glyphicon-remove"></span>
</a></td>
@@ -917,11 +917,11 @@
<label for="clientResponsiblePriorityField">Utiliser le dossier de la règle en priorité : </label>
<label class="radio-inline">
<input type="radio"
- ng-model="newFilter.clientResponsiblePriority" ng-value="false"> oui
+ ng-model="newFilter.clientResponsiblePriority" ng-value="false"> non
</label>
<label class="radio-inline">
<input type="radio"
- ng-model="newFilter.clientResponsiblePriority" ng-value="true"> non
+ ng-model="newFilter.clientResponsiblePriority" ng-value="true"> oui
</label>
</div>
</div>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-27 14:50:53 UTC (rev 278)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-27 15:02:46 UTC (rev 279)
@@ -936,7 +936,7 @@
ConfigurationModule.controller('ConfigurationFilterController', ['$scope', '$window', 'ConfigurationData',
function($scope, $window, ConfigurationData) {
//{Object} New accout empty filter
- $scope.newFilter = {clientResponsiblePriority:false};
+ $scope.newFilter = {clientResponsiblePriority:true};
// option de la configuration 'sortable'
$scope.sortableOptions = {
1
0
r278 - in trunk: . faxtomail-persistence/src/main/xmi faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service
by echatellier@users.forge.codelutin.com 27 Jun '14
by echatellier@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: echatellier
Date: 2014-06-27 16:50:53 +0200 (Fri, 27 Jun 2014)
New Revision: 278
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/278
Log:
Fix database attachment
Added:
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java
trunk/pom.xml
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-27 14:22:11 UTC (rev 277)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-06-27 14:50:53 UTC (rev 278)
@@ -24,7 +24,6 @@
model.tagValue.notGenerateToString=true
model.tagValue.constantPrefix=PROPERTY_
model.tagValue.hibernateAttributeType.java.lang.String=text
-model.tagValue.hibernateAttributeType.byte[]=binary
model.tagValue.useEnumerationName=true
model.tagValue.doNotGenerateBooleanGetMethods=true
@@ -60,6 +59,9 @@
# AttachmentFile
com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.filename.tagvalue.notNull=true
com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.notNull=true
+# il faut mettre une valeur > � 8000 pour que la mapping g�n�re un type varbinary(max)
+com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagValue.hibernateAttributeType=binary
+com.franciaflex.faxtomail.persistence.entities.AttachmentFile.attribute.content.tagvalue.length=9999999
# MailFolder
com.franciaflex.faxtomail.persistence.entities.MailFolder.class.tagvalue.naturalIdMutable=true
Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-06-27 14:22:11 UTC (rev 277)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-06-27 14:50:53 UTC (rev 278)
@@ -62,8 +62,7 @@
protected File databaseFile;
- protected FaxToMailTopiaApplicationContext newApplicationContext(String dataBase) {
-
+ protected Map<String, String> getDatabaseConfiguration(String dataBase) {
Map<String, String> hibernateH2Config = new HashMap<String, String>();
hibernateH2Config.putAll(getApplicationConfig().getTopiaProperties());
@@ -92,7 +91,14 @@
if (log.isDebugEnabled()) {
log.debug("jdbc url is\n" + jdbcUrl);
}
+
+ return hibernateH2Config;
+ }
+ protected FaxToMailTopiaApplicationContext newApplicationContext(String dataBase) {
+
+ Map<String, String> hibernateH2Config = getDatabaseConfiguration(dataBase);
+
FaxToMailTopiaApplicationContext applicationContext = new FaxToMailTopiaApplicationContext(hibernateH2Config);
if (log.isTraceEnabled()) {
@@ -241,7 +247,9 @@
}
// clear full directory
- FileUtils.deleteDirectory(databaseFile);
+ if (databaseFile != null) {
+ FileUtils.deleteDirectory(databaseFile);
+ }
}
protected static FaxToMailConfiguration getApplicationConfig() {
Added: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java (rev 0)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java 2014-06-27 14:50:53 UTC (rev 278)
@@ -0,0 +1,54 @@
+package com.franciaflex.faxtomail.services.service;
+
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hibernate.cfg.Environment;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class MiscTest extends AbstractFaxToMailServiceTest {
+
+ @Override
+ protected Map<String, String> getDatabaseConfiguration(String dataBase) {
+ Map<String, String> hibernateH2Config = new HashMap<String, String>();
+
+ hibernateH2Config.put(Environment.DIALECT, "org.hibernate.dialect.SQLServer2008Dialect");
+ hibernateH2Config.put(Environment.DRIVER, "net.sourceforge.jtds.jdbc.Driver");
+ hibernateH2Config.put(Environment.USER, "fx");
+ hibernateH2Config.put(Environment.PASS, "FX2013!");
+ hibernateH2Config.put(Environment.HBM2DDL_AUTO, "");
+ hibernateH2Config.put(Environment.URL, "jdbc:jtds:sqlserver://192.168.100.247:1433/faxtomailtest");
+ return hibernateH2Config;
+ }
+
+ @Test
+ public void getSqlServerSchema() {
+ getApplicationContext().showCreateSchema();
+ }
+}
Property changes on: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-27 14:22:11 UTC (rev 277)
+++ trunk/pom.xml 2014-06-27 14:50:53 UTC (rev 278)
@@ -104,8 +104,8 @@
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<nuitonWebVersion>1.16</nuitonWebVersion>
- <eugeneVersion>2.10</eugeneVersion>
- <topiaVersion>3.0-beta-6</topiaVersion>
+ <eugeneVersion>2.11-SNAPSHOT</eugeneVersion>
+ <topiaVersion>3.0-SNAPSHOT</topiaVersion>
<hibernateVersion>4.3.5.Final</hibernateVersion>
<h2Version>1.3.176</h2Version>
1
0
r277 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions
by kmorin@users.forge.codelutin.com 27 Jun '14
by kmorin@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: kmorin
Date: 2014-06-27 16:22:11 +0200 (Fri, 27 Jun 2014)
New Revision: 277
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/277
Log:
correction de d?\195?\169tection du droit d'?\195?\169criture
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-06-27 06:58:01 UTC (rev 276)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-06-27 14:22:11 UTC (rev 277)
@@ -70,7 +70,7 @@
MailFolder folder = currentEmail.getMailFolder();
boolean canWrite = false;
- while (!canWrite && folder.getParent() != null) {
+ while (!canWrite && folder != null) {
canWrite = folder.containsWriteRightUsers(currentUser)
|| !CollectionUtils.intersection(folder.getWriteRightGroups(),
currentUser.getUserGroups()).isEmpty();
1
0
r276 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing
by echatellier@users.forge.codelutin.com 27 Jun '14
by echatellier@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: echatellier
Date: 2014-06-27 08:58:01 +0200 (Fri, 27 Jun 2014)
New Revision: 276
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/276
Log:
Fix i18n for windows
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-06-26 21:26:35 UTC (rev 275)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-06-27 06:58:01 UTC (rev 276)
@@ -54,6 +54,8 @@
import org.jdesktop.swingx.auth.LoginService;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.jaxx.application.ApplicationConfiguration;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.jaxx.application.swing.ApplicationUIContext;
@@ -350,7 +352,13 @@
log.info(String.format("Starts i18n with locale [%s]", i18nLocale));
}
- I18n.init(new ClassPathI18nInitializer(), i18nLocale);
+ try {
+ // production case
+ I18n.init(new DefaultI18nInitializer("faxtomail-i18n"), i18nLocale);
+ } catch (RuntimeException ex) {
+ // fallback case : strange ide behaviour (eclipse)
+ I18n.init(new ClassPathI18nInitializer(), i18nLocale);
+ }
// try to autologin user from username of current X session
autologinUser();
1
0
r274 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web
by echatellier@users.forge.codelutin.com 27 Jun '14
by echatellier@users.forge.codelutin.com 27 Jun '14
27 Jun '14
Author: echatellier
Date: 2014-06-26 23:22:45 +0200 (Thu, 26 Jun 2014)
New Revision: 274
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/274
Log:
erreur de commit ?
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-26 20:48:29 UTC (rev 273)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/FaxToMailInterceptor.java 2014-06-26 21:22:45 UTC (rev 274)
@@ -144,14 +144,14 @@
faxToMailSession.setAuthenticatedFaxToMailUser(user);
// test si l'utilisateur est admin
-// List<String> adminGroups = serviceContext.getApplicationConfig().getLdapAdminGroups();
-// if (user != null && CollectionUtils.isNotEmpty(adminGroups) && user.getUserGroups() != null) {
-// for (FaxToMailUserGroup group : user.getUserGroups()) {
-// if (adminGroups.contains(group.getFullPath())) {
+ List<String> adminGroups = serviceContext.getApplicationConfig().getLdapAdminGroups();
+ if (user != null && CollectionUtils.isNotEmpty(adminGroups) && user.getUserGroups() != null) {
+ for (FaxToMailUserGroup group : user.getUserGroups()) {
+ if (adminGroups.contains(group.getCompleteName())) {
faxToMailSession.setAdmin(true);
-// }
-// }
-// }
+ }
+ }
+ }
}
}
2
1