r104 - in trunk: . faxtomail-persistence/src/main/resources faxtomail-ui-web faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin
Author: echatellier Date: 2014-05-28 11:27:47 +0200 (Wed, 28 May 2014) New Revision: 104 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/104 Log: refs #4661: [TECH] R?\195?\169f?\195?\169rentiels Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp Modified: trunk/faxtomail-persistence/src/main/resources/faxToMail.properties trunk/faxtomail-ui-web/pom.xml trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp trunk/pom.xml Modified: trunk/faxtomail-persistence/src/main/resources/faxToMail.properties =================================================================== --- trunk/faxtomail-persistence/src/main/resources/faxToMail.properties 2014-05-27 16:37:04 UTC (rev 103) +++ trunk/faxtomail-persistence/src/main/resources/faxToMail.properties 2014-05-28 09:27:47 UTC (rev 104) @@ -35,8 +35,8 @@ #hibernate.connection.password=FX2013! hibernate.hbm2ddl.auto=update -hibernate.show_sql=false -hibernate.format_sql=true +#hibernate.show_sql=false +#hibernate.format_sql=true #hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy hibernate.c3p0.min_size=5 Modified: trunk/faxtomail-ui-web/pom.xml =================================================================== --- trunk/faxtomail-ui-web/pom.xml 2014-05-27 16:37:04 UTC (rev 103) +++ trunk/faxtomail-ui-web/pom.xml 2014-05-28 09:27:47 UTC (rev 104) @@ -194,6 +194,11 @@ </dependency> <dependency> + <groupId>org.nuiton.web</groupId> + <artifactId>nuiton-struts2</artifactId> + </dependency> + + <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> </dependency> Added: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java (rev 0) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java 2014-05-28 09:27:47 UTC (rev 104) @@ -0,0 +1,123 @@ +package com.franciaflex.faxtomail.web.action.admin; + +/* + * #%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 java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.convention.annotation.Result; + +import com.franciaflex.faxtomail.services.service.ReferentielService; +import com.franciaflex.faxtomail.web.FaxToMailActionSupport; + +public class ImportAction extends FaxToMailActionSupport { + + private static final Log log = LogFactory.getLog(ImportAction.class); + + protected ReferentielService referentielService; + + protected File clientFile; + protected File demandTypeFile; + protected File rangeFile; + protected File priorityFile; + protected File etatAttenteFile; + + public void setReferentielService(ReferentielService referentielService) { + this.referentielService = referentielService; + } + + public void setClientFile(File clientFile) { + this.clientFile = clientFile; + } + + public void setDemandTypeFile(File demandTypeFile) { + this.demandTypeFile = demandTypeFile; + } + + public void setRangeFile(File rangeFile) { + this.rangeFile = rangeFile; + } + + public void setPriorityFile(File priorityFile) { + this.priorityFile = priorityFile; + } + + public void setEtatAttenteFile(File etatAttenteFile) { + this.etatAttenteFile = etatAttenteFile; + } + + @Override + @org.apache.struts2.convention.annotation.Action("import-input") + public String input() throws Exception { + return INPUT; + } + + @Override + @org.apache.struts2.convention.annotation.Action(results = { + @Result(type = "redirectAction", params = {"actionName", "import-input"})}) + public String execute() throws Exception { + String result = super.execute(); + + // clientFile + if (clientFile != null) { + try (InputStream is = new FileInputStream(clientFile)) { + referentielService.importClients(is); + } + } + + // demandTypeFile + if (demandTypeFile != null) { + try (InputStream is = new FileInputStream(demandTypeFile)) { + referentielService.importDemandTypes(is); + } + } + + // rangeFile + if (rangeFile != null) { + try (InputStream is = new FileInputStream(rangeFile)) { + referentielService.importRanges(is); + } + } + + // priorityFile + if (priorityFile != null) { + try (InputStream is = new FileInputStream(priorityFile)) { + referentielService.importPriorities(is); + } + } + + // etatAttenteFile + if (etatAttenteFile != null) { + try (InputStream is = new FileInputStream(etatAttenteFile)) { + referentielService.importEtatAttentes(is); + } + } + + return result; + } +} Property changes on: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ImportAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native 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-05-27 16:37:04 UTC (rev 103) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-05-28 09:27:47 UTC (rev 104) @@ -443,13 +443,12 @@ </tbody> </table> </div> - - <nav class="navbar navbar-default navbar-fixed-bottom"> - <div class="container"> - <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button> - </div> - </nav> </div> + <nav class="navbar navbar-default navbar-fixed-bottom"> + <div class="container"> + <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button> + </div> + </nav> </s:form> </div> </div> Added: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp (rev 0) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-05-28 09:27:47 UTC (rev 104) @@ -0,0 +1,96 @@ +<%-- + #%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% + --%> +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<!DOCTYPE html> +<%@taglib uri="/struts-tags" prefix="s" %> + +<html> + <head> + <title>Import</title> + <link rel="stylesheet" type="text/css" href="<s:url value='/css/configuration.css' />" /> + </head> + + <body> + <div> + <!-- navbar --> + <header class="navbar navbar-inverse navbar-static-top bs-docs-nav" id="top" role="banner"> + <div class="container"> + <div class="navbar-header"> + <a href="<s:url value='/' />" class="navbar-brand">FaxToMail</a> + </div> + <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> + <ul class="nav navbar-nav"> + <li><a href="<s:url action='configuration-input' />" class="navbar-brand">Configuration</a></li> + <li class="active"><a href="<s:url action='import-input' />" class="navbar-brand">Import</a></li> + </ul> + </div> + </div> + </header> + + <div id="main-container" class="container"> + + <h1 class="page-header">Import</h1> + + <s:form id="main_form" action="import" method="post" enctype="multipart/form-data"> + + <div class="form-group"> + <label for="clientField">Fichier client</label> + <input type="file" id="clientField" name="clientFile"> + <p class="help-block">Format du fichier csv : <code>Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Client_Top;Numero_Fax;Adresse_Mail;Code_Client;Objet_Message;Destination</code></p> + </div> + + <div class="form-group"> + <label for="etatAttenteField">Fichier état d'attente</label> + <input type="file" id="etatAttenteField" name="etatAttenteFile"> + <p class="help-block">Format du fichier csv : <code>etatattente</code></p> + </div> + + <div class="form-group"> + <label for="demandTypeField">Fichier types de demande</label> + <input type="file" id="demandTypeField" name="demandTypeFile"> + <p class="help-block">Format du fichier csv : <code>demandetype</code></p> + </div> + + <div class="form-group"> + <label for="rangeField">Fichier gamme</label> + <input type="file" id="rangeField" name="rangeFile"> + <p class="help-block">Format du fichier csv : <code>gamme</code></p> + </div> + + <div class="form-group"> + <label for="priorityField">Fichier priorite</label> + <input type="file" id="priorityField" name="priorityFile"> + <p class="help-block">Format du fichier csv : <code>priorite</code></p> + </div> + + <nav class="navbar navbar-default navbar-fixed-bottom"> + <div class="container"> + <button type="submit" class="btn btn-primary navbar-btn pull-right">Valider</button> + </div> + </nav> + </s:form> + </div> + </div> + </body> +</html> Property changes on: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-05-27 16:37:04 UTC (rev 103) +++ trunk/pom.xml 2014-05-28 09:27:47 UTC (rev 104) @@ -417,6 +417,7 @@ <groupId>org.nuiton.web</groupId> <artifactId>nuiton-struts2</artifactId> <version>${nuitonWebVersion}</version> + <scope>runtime</scope> </dependency> <dependency>
participants (1)
-
echatellier@users.forge.codelutin.com