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
June 2014
- 6 participants
- 194 discussions
Author: echatellier
Date: 2014-06-29 20:47:40 +0200 (Sun, 29 Jun 2014)
New Revision: 291
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/291
Log:
yoala is not in nexus proxy cache
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-29 18:46:52 UTC (rev 290)
+++ trunk/pom.xml 2014-06-29 18:47:40 UTC (rev 291)
@@ -151,13 +151,6 @@
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
-
- <repository>
- <id>yoava</id>
- <name>AOL yoava</name>
- <url>http://evgenyg.artifactoryonline.com/evgenyg/repo</url>
- </repository>
-
</repositories>
<pluginRepositories>
1
0
r290 - in trunk: . faxtomail-ui-web/src/main/webapp/WEB-INF faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 29 Jun '14
by echatellier@users.forge.codelutin.com 29 Jun '14
29 Jun '14
Author: echatellier
Date: 2014-06-29 20:46:52 +0200 (Sun, 29 Jun 2014)
New Revision: 290
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/290
Log:
Update bootstrap, select2, angularjs, jquery-ui
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
trunk/pom.xml
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-29 18:21:17 UTC (rev 289)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-29 18:46:52 UTC (rev 290)
@@ -90,9 +90,9 @@
<input type="text" id="configurationEmailMaxSizeField" class="form-control" ng-model="configuration.emailMaxSize" />
</div>
- <div class="form-group">
- Actions autorisées lorsque la demande n'a pas d'état d'attente et est <strong>invalide</strong> :
- <label class="checkbox" ng-repeat="(mailAction,label) in mailActions">
+ Actions autorisées lorsque la demande n'a pas d'état d'attente et est <strong>invalide</strong> :
+ <div class="checkbox" ng-repeat="(mailAction,label) in mailActions">
+ <label>
<input type="checkbox" ng-checked="configuration.invalidFormDisabledActions.indexOf(mailAction) == -1"
ng-click="changeInvalidAction(mailAction)"> {{label}}
</label>
@@ -169,16 +169,20 @@
<div class="col-md-8" ng-if="selectedEtatAttente">
<h3>Édition de l'état d'attente {{selectedEtatAttente.label}}</h3>
Actions autorisées lorsque la demande est <strong>valide</strong> :
- <label class="checkbox" ng-repeat="(mailAction,label) in mailActions">
- <input type="checkbox" ng-checked="selectedEtatAttente.validFormDisabledActions.indexOf(mailAction) == -1"
- ng-click="changeEtatAttenteValidAction(mailAction)"> {{label}}
- </label>
+ <div class="checkbox" ng-repeat="(mailAction,label) in mailActions">
+ <label>
+ <input type="checkbox" ng-checked="selectedEtatAttente.validFormDisabledActions.indexOf(mailAction) == -1"
+ ng-click="changeEtatAttenteValidAction(mailAction)"> {{label}}
+ </label>
+ </div>
Actions autorisées lorsque la demande est <strong>invalide</strong> :
- <label class="checkbox" ng-repeat="(mailAction,label) in mailActions">
- <input type="checkbox" ng-checked="selectedEtatAttente.invalidFormDisabledActions.indexOf(mailAction) == -1"
- ng-click="changeEtatAttenteInvalidAction(mailAction)"> {{label}}
- </label>
+ <div class="checkbox" ng-repeat="(mailAction,label) in mailActions">
+ <label>
+ <input type="checkbox" ng-checked="selectedEtatAttente.invalidFormDisabledActions.indexOf(mailAction) == -1"
+ ng-click="changeEtatAttenteInvalidAction(mailAction)"> {{label}}
+ </label>
+ </div>
</div>
<div class="col-md-8" ng-if="!selectedEtatAttente">
<em>Sélectionnez un état d'attente.</em>
@@ -207,10 +211,12 @@
<div class="col-md-8" ng-if="selectedDemandType">
<h3>Édition du type de document {{selectedDemandType.label}}</h3>
Champs obligatoires pour le type de document :
- <label class="checkbox" ng-repeat="(mailField,label) in canBeRequiredMailFields">
- <input type="checkbox" ng-checked="selectedDemandType.fields.indexOf(mailField) != -1"
- ng-click="changeDemandTypeField(mailField)"> {{label}}
- </label>
+ <div class="checkbox" ng-repeat="(mailField,label) in canBeRequiredMailFields">
+ <label>
+ <input type="checkbox" ng-checked="selectedDemandType.fields.indexOf(mailField) != -1"
+ ng-click="changeDemandTypeField(mailField)"> {{label}}
+ </label>
+ </div>
</div>
<div class="col-md-8" ng-if="!selectedDemandType">
<em>Sélectionnez un type de document.</em>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-29 18:21:17 UTC (rev 289)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-06-29 18:46:52 UTC (rev 290)
@@ -24,9 +24,9 @@
<groups xmlns="http://www.isdc.ro/wro">
<group name='webjar-select2' abstract="true">
- <css>classpath:META-INF/resources/webjars/select2/3.4.8/select2.css</css>
- <js>classpath:META-INF/resources/webjars/select2/3.4.8/select2.js</js>
- <js>classpath:META-INF/resources/webjars/select2/3.4.8/select2_locale_fr.js</js>
+ <css>classpath:META-INF/resources/webjars/select2/3.5.0/select2.css</css>
+ <js>classpath:META-INF/resources/webjars/select2/3.5.0/select2.js</js>
+ <js>classpath:META-INF/resources/webjars/select2/3.5.0/select2_locale_fr.js</js>
</group>
<group name='webjar-chosen' abstract="true">
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-29 18:21:17 UTC (rev 289)
+++ trunk/pom.xml 2014-06-29 18:46:52 UTC (rev 290)
@@ -548,7 +548,7 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-bootstrap</artifactId>
- <version>3.1.1-1</version>
+ <version>3.2.0-1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
@@ -575,14 +575,14 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-jquery-ui</artifactId>
- <version>1.10.4-1</version>
+ <version>1.11.0-1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>select2</artifactId>
- <version>3.4.8-1</version>
+ <version>3.5.0</version>
<scope>runtime</scope>
</dependency>
@@ -596,7 +596,7 @@
<dependency>
<groupId>org.nuiton.js</groupId>
<artifactId>nuiton-js-angularjs</artifactId>
- <version>1.2.17-1</version>
+ <version>1.2.18-1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
1
0
29 Jun '14
Author: kmorin
Date: 2014-06-29 20:21:17 +0200 (Sun, 29 Jun 2014)
New Revision: 289
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/289
Log:
- ne pas afficher les dossiers d'archive dans les listes de dossier
- correction quand on supprime le dossier d'archive
Modified:
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-29 18:20:30 UTC (rev 288)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-29 18:21:17 UTC (rev 289)
@@ -77,10 +77,13 @@
folderCount += $scope.mailFoldersUsage[mailFolder.topiaId];
}
- result.push(mailFolder);
if (mailFolder.archiveFolder) {
parent.hasArchiveFolder = true;
+
+ } else {
+ result.push(mailFolder);
}
+
folderCount += recursiveAddMailFolder(result, mailFolder.children, rootFolder, mailFolder.$fullPath, mailFolder);
// et on modifie encore (tant qu'on a commencé !!!)
@@ -427,6 +430,9 @@
}
// remove current folder
+ if (nodeData.archiveFolder) {
+ nodeData.$parent.hasArchiveFolder = false;
+ }
scope.remove(scope);
// update filter meta map
$scope.updateMetaFilter();
1
0
r288 - trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
by echatellier@users.forge.codelutin.com 29 Jun '14
by echatellier@users.forge.codelutin.com 29 Jun '14
29 Jun '14
Author: echatellier
Date: 2014-06-29 20:20:30 +0200 (Sun, 29 Jun 2014)
New Revision: 288
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/288
Log:
Correction affichage
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-29 17:44:09 UTC (rev 287)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-06-29 18:20:30 UTC (rev 288)
@@ -251,7 +251,7 @@
</div>
</div>
- <div class="col-md-8" ng-show="!selectedMailFolder.archiveFolder">
+ <div class="col-md-8" ng-show="selectedMailFolder && !selectedMailFolder.archiveFolder">
<h3>Édition du dossier {{selectedMailFolder.name}}</h3>
<div class="panel-group" id="accordion">
1
0
r287 - trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job
by kmorin@users.forge.codelutin.com 29 Jun '14
by kmorin@users.forge.codelutin.com 29 Jun '14
29 Jun '14
Author: kmorin
Date: 2014-06-29 19:44:09 +0200 (Sun, 29 Jun 2014)
New Revision: 287
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/287
Log:
nettoyage
Modified:
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java
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-29 17:42:07 UTC (rev 286)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-29 17:44:09 UTC (rev 287)
@@ -60,13 +60,10 @@
import javax.mail.Part;
import javax.mail.Session;
import javax.mail.Store;
-import javax.mail.internet.ContentType;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -80,17 +77,12 @@
import com.itextpdf.text.pdf.PdfWriter;
import gui.ava.html.image.generator.HtmlImageGenerator;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.Charsets;
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.htmlcleaner.CleanerProperties;
-import org.htmlcleaner.HtmlCleaner;
-import org.htmlcleaner.PrettyXmlSerializer;
-import org.htmlcleaner.TagNode;
import org.nuiton.decorator.Decorator;
import org.nuiton.util.StringUtil;
import org.quartz.JobExecutionContext;
@@ -113,10 +105,7 @@
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
-import org.xhtmlrenderer.pdf.ITextRenderer;
-import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
/**
* @author Kevin Morin (Code Lutin)
@@ -651,8 +640,6 @@
public Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException, ParserConfigurationException, SAXException, DocumentException {
- File source = File.createTempFile("faxtomail-", ".html");
- source.deleteOnExit();
File target = File.createTempFile("faxtomail-", ".png");
target.deleteOnExit();
@@ -679,16 +666,7 @@
}
}
-// CleanerProperties props = new CleanerProperties();
-
-// do parsing
-// TagNode tagNode = new HtmlCleaner(props).clean(content);
-
-// serialize to xml file
-// new PrettyXmlSerializer(props).writeToFile(tagNode, source.getAbsolutePath(), "utf-8");
-
HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
-// imageGenerator.loadUrl(source.toURI().toURL());
imageGenerator.loadHtml(content);
imageGenerator.saveAsImage(target);
1
0
29 Jun '14
Author: kmorin
Date: 2014-06-29 19:42:07 +0200 (Sun, 29 Jun 2014)
New Revision: 286
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/286
Log:
- am?\195?\169lioration de la g?\195?\169n?\195?\169ration des mail en pj
- am?\195?\169lioration de l'?\195?\169dition des pj
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.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/content/pdfeditor/PDFEditorUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.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/pom.xml
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -25,7 +25,13 @@
*/
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import org.apache.commons.io.Charsets;
+import javax.mail.MessagingException;
+import javax.mail.Part;
+import javax.mail.internet.ContentType;
+import java.nio.charset.Charset;
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
@@ -44,4 +50,11 @@
faxNumber += "@" + folder.getFaxDomain();
return faxNumber;
}
+
+ public static Charset getCharset(Part part) throws MessagingException {
+ ContentType contentType = new ContentType(part.getContentType());
+ String charsetName = contentType.getParameter("charset");
+ Charset charset = Charsets.toCharset(charsetName);
+ return charset;
+ }
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/EditAttachmentAction.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -58,10 +58,16 @@
@Override
public void doAction() throws Exception {
+ FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
MainUI mainUI = getContext().getMainUI();
PDFEditorUI dialogContent = new PDFEditorUI(getUI());
- FaxToMailUIUtil.forceAttachmentFileLoading(getContext(), attachment);
/*boolean editedNull = attachment.getEditedFileName() == null;
AttachmentFile attachmentFile = editedNull ? attachment.getOriginalFile() : attachment.getEditedFile();
if (attachmentFile == null) {
@@ -77,4 +83,5 @@
getHandler().openDialog(dialogContent, attachment.getOriginalFileName(), mainUI.getSize());
dialogContent.getModel().toEntity(attachment);
}
+
}
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/GenerateAnnotatedAttachmentAction.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -116,13 +116,14 @@
float zoom = model.getZoom();
int rotation = model.getRotation();
+
for (int i = 0 ; i < pageNb ; i++) {
PdfContentByte cb = pdfStamper.getOverContent(i + 1);
- PdfDictionary pageDict;
- pageDict = pdfReader.getPageN(i + 1);
- int pageRotation = pdfReader.getPageRotation(i + 1);
- pageDict.put(PdfName.ROTATE, new PdfNumber((360 + pageRotation + rotation) % 360));
+// PdfDictionary pageDict;
+// pageDict = pdfReader.getPageN(i + 1);
+// int pageRotation = pdfReader.getPageRotation(i + 1);
+// pageDict.put(PdfName.ROTATE, new PdfNumber((360 + pageRotation + rotation) % 360));
for (PDFEditorNoteUI note : model.getPages()[i].getNotes()) {
@@ -240,6 +241,7 @@
// convert content to blob
InputStream is = new BufferedInputStream(new FileInputStream(target));
AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(is);
+ attachmentFileNew.setRotation(rotation);
String fileName = getModel().getNotNullFile().getFilename();
attachmentFileNew.setFilename(FaxToMailUIUtil.getEditedFileName(fileName));
getModel().setEditedFile(attachmentFileNew);
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-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -39,6 +39,7 @@
import com.franciaflex.faxtomail.persistence.entities.Priority;
import com.franciaflex.faxtomail.persistence.entities.RangeRow;
import com.franciaflex.faxtomail.persistence.entities.Reply;
+import com.franciaflex.faxtomail.services.FaxToMailServiceUtils;
import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailBeanUIModel;
import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentModelAware;
import com.google.common.base.Function;
@@ -967,7 +968,7 @@
// if it is a text part, the,n this is the email content
String disposition = bp.getDisposition();
if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
- Charset charset = getCharset(bp);
+ Charset charset = FaxToMailServiceUtils.getCharset(bp);
String content = IOUtils.toString(bp.getInputStream(), charset);
if (bp.isMimeType("text/plain")) {
plainContent = content;
@@ -982,13 +983,6 @@
}
}
- protected Charset getCharset(Part part) throws MessagingException {
- ContentType contentType = new ContentType(part.getContentType());
- String charsetName = contentType.getParameter("charset");
- Charset charset = Charsets.toCharset(charsetName);
- return charset;
- }
-
@Override
public boolean isEmpty() {
return false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIHandler.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -233,7 +233,7 @@
@Override
public void onCloseUI() {
-
+// getModel()
}
public void addNote() {
@@ -515,6 +515,7 @@
// convert content to blob
AttachmentFile attachmentFileNew = getContext().getEmailService().getAttachmentFileFromStream(new FileInputStream(target));
attachmentFileNew.setFilename(attachmentFile.getFilename() + ".pdf");
+ attachmentFileNew.setRotation(0);
getModel().setEditedFile(attachmentFileNew);
return target;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/pdfeditor/PDFEditorUIModel.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -138,6 +138,7 @@
Object oldValue = getEditedFile();
editObject.setEditedFile(file);
firePropertyChange(Attachment.PROPERTY_EDITED_FILE, oldValue, file);
+ setRotation(file != null ? file.getRotation() : 0);
}
public AttachmentFile getEditedFile() {
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-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -171,7 +171,7 @@
|| context.getCurrentUser().isAffectedFoldersEmpty()
|| context.getCurrentUser().containsAffectedFolders(node.getMailFolder())) {
- foreground = hasFocus ? Color.WHITE : Color.BLACK;
+ foreground = sel ? Color.WHITE : Color.BLACK;
} else {
foreground = Color.LIGHT_GRAY;
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-web/pom.xml 2014-06-29 17:42:07 UTC (rev 286)
@@ -293,6 +293,11 @@
<artifactId>itextpdf</artifactId>
</dependency>
+ <dependency>
+ <groupId>gui.ava</groupId>
+ <artifactId>html2image</artifactId>
+ </dependency>
+
</dependencies>
<build>
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-29 16:50:40 UTC (rev 285)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-06-29 17:42:07 UTC (rev 286)
@@ -28,11 +28,13 @@
import java.awt.image.RenderedImage;
import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
+import java.io.StringBufferInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.ByteBuffer;
@@ -46,6 +48,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import javax.activation.DataHandler;
import javax.activation.DataSource;
@@ -62,6 +65,9 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
@@ -72,6 +78,7 @@
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
+import gui.ava.html.image.generator.HtmlImageGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.Charsets;
import org.apache.commons.io.FileUtils;
@@ -80,6 +87,10 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.htmlcleaner.CleanerProperties;
+import org.htmlcleaner.HtmlCleaner;
+import org.htmlcleaner.PrettyXmlSerializer;
+import org.htmlcleaner.TagNode;
import org.nuiton.decorator.Decorator;
import org.nuiton.util.StringUtil;
import org.quartz.JobExecutionContext;
@@ -102,6 +113,10 @@
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.EmailService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
+import org.xhtmlrenderer.pdf.ITextRenderer;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
/**
* @author Kevin Morin (Code Lutin)
@@ -221,7 +236,7 @@
int messageNumber = count - i;
Message message = folder.getMessage(messageNumber);
- Charset charset = getCharset(message);
+ Charset charset = FaxToMailServiceUtils.getCharset(message);
List<String> modifiedProperties = new ArrayList<>();
@@ -352,10 +367,7 @@
}
- Date receivedDate = message.getReceivedDate();
- if (receivedDate == null) {
- receivedDate = message.getSentDate();
- }
+ Date receivedDate = new Date();
email.setReceptionDate(receivedDate);
modifiedProperties.add(Email.PROPERTY_RECEPTION_DATE);
@@ -380,19 +392,25 @@
emailSource.append("\n").append(originalContent);
email.setOriginalEmail(emailSource.toString());
- List<Attachment> attachements = new ArrayList<>();
- Attachment attachment = convertTextToPdf(emailSource.toString(), t("faxtomail.email.content.attachment.fileName"));
- attachements.add(attachment);
+ List<Attachment> attachments = new ArrayList<>();
+ if (message.isMimeType("multipart/*")) {
+ String htmlContent = decomposeMultipartEmail(attachments, message, email, emailService);
+ if (htmlContent != null) {
+ Attachment attachment = convertHTMLToPdf(attachments, htmlContent, t("faxtomail.email.content.attachment.fileName"));
+ attachments.add(attachment);
+ }
- if (message.isMimeType("multipart/*")) {
- decomposeMultipartEmail(attachements, message, email, emailService);
- // } else {
+ } else {
// String content = IOUtils.toString(message.getInputStream(), charset);
// email.setPlainContent(content);
+// Charset charset = FaxToMailServiceUtils.getCharset(bp);
+ String content = IOUtils.toString(message.getInputStream(), charset);
+ Attachment attachment = convertTextToPdf(content, t("faxtomail.email.content.attachment.fileName"));
+ attachments.add(0, attachment);
}
emailService.saveEmail(email,
- attachements,
+ attachments,
email.getClient() != null ? email.getClient().getCode() : null,
null,
modifiedProperties.toArray(new String[modifiedProperties.size()]));
@@ -428,28 +446,36 @@
* @param emailService email service
* @throws Exception
*/
- protected void decomposeMultipartEmail(List<Attachment> attachments, Part part, Email email, EmailService emailService) throws Exception {
+ protected String decomposeMultipartEmail(List<Attachment> attachments, Part part, Email email, EmailService emailService) throws Exception {
+ String result = null;
+
DataSource dataSource = part.getDataHandler().getDataSource();
MimeMultipart mimeMultipart = new MimeMultipart(dataSource);
int multiPartCount = mimeMultipart.getCount();
for (int j = 0; j < multiPartCount; j++) {
MimeBodyPart bp = (MimeBodyPart) mimeMultipart.getBodyPart(j);
- Charset charset = getCharset(bp);
- // if it is a text part, the,n this is the email content
+ // if it is a text part, then this is the email content
String disposition = bp.getDisposition();
if (bp.isMimeType("text/*") && !Part.ATTACHMENT.equals(disposition)) {
-// String content = IOUtils.toString(bp.getInputStream(), charset);
-// if (bp.isMimeType("text/plain")) {
-// email.setPlainContent(content);
-// } else {
-// email.setHtmlContent(content);
-// }
+ Charset charset = FaxToMailServiceUtils.getCharset(bp);
+ String content = IOUtils.toString(bp.getInputStream(), charset);
+ if (bp.isMimeType("text/plain")) {
+ Attachment attachment = convertTextToPdf(content, t("faxtomail.email.content.attachment.fileName"));
+ attachments.add(attachment);
+
+ } else {
+ result = content;
+ }
+
// if it is multipart part, decompose it
} else if (bp.isMimeType("multipart/*")) {
- decomposeMultipartEmail(attachments, bp, email, emailService);
+ String htmlContent = decomposeMultipartEmail(attachments, bp, email, emailService);
+ if (htmlContent != null) {
+ result = htmlContent;
+ }
// else, this is an attachment
} else {
@@ -465,7 +491,6 @@
// remove the guillemets between the id
-
if (fileName == null && contentID == null) {
break;
} else if (fileName == null) {
@@ -501,15 +526,9 @@
attachments.add(attachment);
}
}
+ return result;
}
- protected Charset getCharset(Part part) throws MessagingException {
- ContentType contentType = new ContentType(part.getContentType());
- String charsetName = contentType.getParameter("charset");
- Charset charset = Charsets.toCharset(charsetName);
- return charset;
- }
-
/**
* Retourne un input stream sur une piece jointe convertie ou pas.
*
@@ -601,7 +620,6 @@
}
public Attachment convertTextToPdf(String content, String name) throws IOException, DocumentException {
-
File target = File.createTempFile("faxtomail-", ".tmp");
target.deleteOnExit();
@@ -630,4 +648,60 @@
return attachment;
}
+
+ public Attachment convertHTMLToPdf(List<Attachment> attachments, String content, String name) throws IOException, ParserConfigurationException, SAXException, DocumentException {
+
+ File source = File.createTempFile("faxtomail-", ".html");
+ source.deleteOnExit();
+ File target = File.createTempFile("faxtomail-", ".png");
+ target.deleteOnExit();
+
+ content = content.replaceAll("<meta (.*?)>(</meta>)?", "");
+ for (Attachment attachment : attachments) {
+ String key = attachment.getContentId();
+ if (key == null) {
+ key = attachment.getOriginalFileName();
+ }
+
+ // get file content
+ AttachmentFile attachmentFile = attachment.getOriginalFile();
+ File file = attachmentFile.getFile();
+
+ // replace the inline attachments with the extracted attachment file url
+ // match les patterns:
+ // <td background="cid:bg.gif" height="52">
+ // <img border=0 src="cid:bg.gif" />
+ // <img src='cid:5e9ef859-ea65-4f9b-a9fa-30d4a2c5837c'
+ content = content.replaceAll("(\\w+)=([\"'])cid:" + Pattern.quote(key) + "([\"'])", "$1=$2file://" + file.getAbsolutePath() + "$3");
+
+ if (log.isDebugEnabled()) {
+ log.debug("Mapping attachment id " + key + " to file " + file.getAbsolutePath());
+ }
+ }
+
+// CleanerProperties props = new CleanerProperties();
+
+// do parsing
+// TagNode tagNode = new HtmlCleaner(props).clean(content);
+
+// serialize to xml file
+// new PrettyXmlSerializer(props).writeToFile(tagNode, source.getAbsolutePath(), "utf-8");
+
+ HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
+// imageGenerator.loadUrl(source.toURI().toURL());
+ imageGenerator.loadHtml(content);
+ imageGenerator.saveAsImage(target);
+
+ // convert content to blob
+ EmailService emailService = serviceContext.newService(EmailService.class);
+ AttachmentFile attachmentFileNew = emailService.getAttachmentFileFromStream(new FileInputStream(target));
+ attachmentFileNew.setFilename(name + ".png");
+
+ Attachment attachment = new AttachmentImpl();
+ attachment.setOriginalFile(attachmentFileNew);
+ attachment.setOriginalFileName(name);
+ attachment.setAddedByUser(false);
+
+ return attachment;
+ }
}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-06-29 16:50:40 UTC (rev 285)
+++ trunk/pom.xml 2014-06-29 17:42:07 UTC (rev 286)
@@ -151,7 +151,15 @@
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
+
+ <repository>
+ <id>yoava</id>
+ <name>AOL yoava</name>
+ <url>http://evgenyg.artifactoryonline.com/evgenyg/repo</url>
+ </repository>
+
</repositories>
+
<pluginRepositories>
<pluginRepository>
<id>faxtomail-public-group</id>
@@ -631,13 +639,19 @@
<artifactId>pdfbox</artifactId>
<version>${pdfboxVersion}</version>
</dependency>
+
+ <dependency>
+ <groupId>gui.ava</groupId>
+ <artifactId>html2image</artifactId>
+ <version>0.9</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
<build>
-
<pluginManagement>
<plugins>
1
0
r285 - in trunk: faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-service/src/main/java/com/franciaflex/faxtomail/services faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print faxtomail-ui-swing/src/main/resources/i18n faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job
by echatellier@users.forge.codelutin.com 29 Jun '14
by echatellier@users.forge.codelutin.com 29 Jun '14
29 Jun '14
Author: echatellier
Date: 2014-06-29 18:50:40 +0200 (Sun, 29 Jun 2014)
New Revision: 285
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/285
Log:
Fix build
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.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/job/ClientUpdateJob.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFilterTopiaDao.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.persistence.entities;
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $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%
+ */
+
public class MailFilterTopiaDao extends AbstractMailFilterTopiaDao<MailFilter> {
@Override
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderTopiaDao.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.persistence.entities;
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $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%
+ */
+
public class MailFolderTopiaDao extends AbstractMailFolderTopiaDao<MailFolder> {
@Override
Modified: 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 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.persistence.entities;
+/*
+ * #%L
+ * FaxToMail :: Persistence
+ * $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%
+ */
+
/**
* @author Kevin Morin (Code Lutin)
* @since x.x
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceUtils.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services;
+/*
+ * #%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 com.franciaflex.faxtomail.persistence.entities.MailFolder;
/**
Modified: 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 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/print/ComputeDemandeContent.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.ui.swing.content.print;
+/*
+ * #%L
+ * FaxToMail :: UI
+ * $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 com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
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-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-ui-swing/src/main/resources/i18n/faxtomail-ui-swing_fr_FR.properties 2014-06-29 16:50:40 UTC (rev 285)
@@ -105,6 +105,7 @@
faxtomail.demande.demandStatus.label=Statut
faxtomail.demande.demandType.label=Type
faxtomail.demande.docType.label=Type
+faxtomail.demande.ediCodeNumber.label=
faxtomail.demande.ediError.label=Retour EDI
faxtomail.demande.etatAttente.label=État attente
faxtomail.demande.fax.label=Fax
Modified: 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 2014-06-28 14:29:21 UTC (rev 284)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/ClientUpdateJob.java 2014-06-29 16:50:40 UTC (rev 285)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.web.job;
+/*
+ * #%L
+ * FaxToMail :: Web
+ * $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 com.franciaflex.faxtomail.services.FaxToMailServiceContext;
import com.franciaflex.faxtomail.services.service.ClientService;
import com.franciaflex.faxtomail.services.service.EmailService;
1
0
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