r620 - in trunk: . faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports faxtomail-service/src/main/resources/db/migration/h2 faxtomail-service/src/main/resources/db/migration/postgres faxtomail-service/src/main/resources/db/migration/sqlserver faxtomail-service/src/tes
Author: echatellier Date: 2014-09-18 11:29:19 +0200 (Thu, 18 Sep 2014) New Revision: 620 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/620 Log: Modifications newclient et edireturn Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql Removed: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java trunk/faxtomail-service/src/test/resources/csv/clients.csv trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp trunk/pom.xml Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java 2014-09-18 09:29:19 UTC (rev 620) @@ -33,8 +33,13 @@ import org.nuiton.topia.persistence.internal.AbstractTopiaDao; import org.nuiton.util.pagination.PaginationParameter; +import com.google.gson.Gson; + public abstract class AbstractFaxToMailTopiaDao<E extends TopiaEntity> extends AbstractTopiaDao<E> { - + + /** Instance unique de Gson. (certainement pas le meilleur endroit pour la placer). */ + public static final Gson GSON_INSTANCE = new Gson(); + /** * Find all entity for current table not contained in provided collection. * Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,65 @@ +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.lang.reflect.Type; +import java.util.List; + +import com.google.gson.reflect.TypeToken; + +public class ClientImpl extends ClientAbstract { + + /** serialVersionUID. */ + private static final long serialVersionUID = 645048064844251689L; + + private static final Type LIST_STRING_GSON_TYPE = new TypeToken<List<String>>() {}.getType(); + + @Override + public void setEmailAddresses(List<String> emails) { + String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(emails); + setEmailAddressesJson(json); + } + + @Override + public List<String> getEmailAddresses() { + String json = getEmailAddressesJson(); + List<String> emailAddress = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); + return emailAddress; + } + + @Override + public void setFaxNumbers(List<String> faxNumbers) { + String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(faxNumbers); + setFaxNumbersJson(json); + } + + @Override + public List<String> getFaxNumbers() { + String json = getFaxNumbersJson(); + List<String> faxNumbers = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, LIST_STRING_GSON_TYPE); + return faxNumbers; + } + +} Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,58 @@ +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% + */ + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import com.google.common.base.Preconditions; + +public class ClientTopiaDao extends AbstractClientTopiaDao<Client> { + + protected List<Client> forPropertyJsonLike(String property, String value) { + Preconditions.checkArgument(StringUtils.isNotBlank(value), "Empty value can produce unexcepted results"); + + String query = "FROM " + Client.class.getName() + " WHERE " + property + " LIKE :propValue"; + + Map<String, Object> args = new HashMap<>(); + args.put("propValue", "%" + value + "%"); + List<Client> result = findAll(query, args); + return result; + } + + public List<Client> forEmailAddressesJsonLike(String emailAddress) { + List<Client> result = forPropertyJsonLike(Client.PROPERTY_EMAIL_ADDRESSES_JSON, emailAddress); + return result; + } + + public List<Client> forFaxNumbersJsonLike(String faxNumber) { + List<Client> result = forPropertyJsonLike(Client.PROPERTY_FAX_NUMBERS_JSON, faxNumber); + return result; + } + +} //ClientTopiaDao Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/ClientTopiaDao.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,38 @@ +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% + */ + +/** + * Défini les colonnes de la table EdiReturn en base de données, mais non géré par Topia. + * + * @author Eric Chatellier + */ +public class EdiReturn { + + public static final String PROPERTY_RANGE_ROW_TOPIA_ID = "rangeRowTopiaId"; + public static final String PROPERTY_COMMAND_NUMBER = "commandNumber"; + public static final String PROPERTY_ERROR = "error"; + +} Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/EdiReturn.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/HistoryImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -27,7 +27,6 @@ import java.lang.reflect.Type; import java.util.Set; -import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; public class HistoryImpl extends HistoryAbstract { @@ -35,17 +34,18 @@ /** serialVersionUID. */ private static final long serialVersionUID = 7357010358014312848L; + private static final Type SET_STRING_GSON_TYPE = new TypeToken<Set<String>>() {}.getType(); + @Override public void setFields(Set<String> field) { - String fieldsAsString = new Gson().toJson(field); - setFieldsJson(fieldsAsString); + String json = AbstractFaxToMailTopiaDao.GSON_INSTANCE.toJson(field); + setFieldsJson(json); } @Override public Set<String> getFields() { - String fieldsAsString = getFieldsJson(); - Type type = new TypeToken<Set<String>>() {}.getType(); - Set<String> fields = new Gson().fromJson(fieldsAsString, type); + String json = getFieldsJson(); + Set<String> fields = AbstractFaxToMailTopiaDao.GSON_INSTANCE.fromJson(json, SET_STRING_GSON_TYPE); return fields; } Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java =================================================================== --- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java (rev 0) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,45 @@ +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% + */ + +/** + * Défini les colonnes de la table NewClient en base de données, mais non géré par Topia. + * + * @author Eric Chatellier + */ +public class NewClient { + + public static final String PROPERTY_NAME = "name"; + public static final String PROPERTY_EMAIL_ADDRESS = "emailAddress"; + public static final String PROPERTY_FAX_NUMBER = "faxNumber"; + public static final String PROPERTY_CARACTERISTIC1 = "caracteristic1"; + public static final String PROPERTY_CARACTERISTIC2 = "caracteristic2"; + public static final String PROPERTY_CARACTERISTIC3 = "caracteristic3"; + public static final String PROPERTY_CODE = "code"; + public static final String PROPERTY_BRAND = "brand"; + public static final String PROPERTY_COMPANY = "company"; + public static final String PROPERTY_PERSON_IN_CHARGE = "personInCharge"; + +} Property changes on: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClient.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: 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-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/NewClientType.java 2014-09-18 09:29:19 UTC (rev 620) @@ -1,33 +0,0 @@ -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) - */ -public enum NewClientType { - - CREATION, UPDATE, DELETION -} Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties =================================================================== --- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-09-18 09:29:19 UTC (rev 620) @@ -42,13 +42,12 @@ com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.requiredFields.tagvalue.hibernateAttributeType=com.franciaflex.faxtomail.persistence.hibernate.MailFieldEnumSetUserType # Client -com.franciaflex.faxtomail.persistence.entities.Client.attribute.brand.tagvalue.naturalId=true +com.franciaflex.faxtomail.persistence.entities.Client.attribute.company.tagvalue.naturalId=true com.franciaflex.faxtomail.persistence.entities.Client.attribute.code.tagvalue.naturalId=true # NewClient com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.code.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.brand.tagvalue.notNull=true -com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.type.tagvalue.notNull=true +com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.company.tagvalue.notNull=true # EdiReturn com.franciaflex.faxtomail.persistence.entities.EdiReturn.attribute.rangeRowTopiaId.tagvalue.notNull=true Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo =================================================================== (Binary files differ) Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientServiceImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -24,14 +24,20 @@ * #L% */ +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; import java.util.List; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.map.MultiKeyMap; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.util.beans.Binder; -import org.nuiton.util.beans.BinderFactory; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.topia.persistence.support.TopiaSqlWork; import com.franciaflex.faxtomail.persistence.entities.Client; import com.franciaflex.faxtomail.persistence.entities.ClientImpl; @@ -40,8 +46,6 @@ import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser; import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserTopiaDao; import com.franciaflex.faxtomail.persistence.entities.NewClient; -import com.franciaflex.faxtomail.persistence.entities.NewClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.NewClientType; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.base.Preconditions; @@ -73,7 +77,7 @@ Client client = null; List<Client> clients; if (StringUtils.isNotBlank(emailAddress)) { - clients = clientDao.forEmailAddressEquals(emailAddress).findAll(); + clients = clientDao.forEmailAddressesJsonLike(emailAddress); // on essaye de voir si on peut gérer l'adresse de l'expediteur comme un fax if (CollectionUtils.isEmpty(clients)) { @@ -81,7 +85,7 @@ // NumberUtils.isNumber peut echouer (notation octal) if (StringUtils.isNumeric(faxNumber)) { emailAddress = StringUtils.leftPad(faxNumber, 10, '0'); - clients = clientDao.forFaxNumberEquals(emailAddress).findAll(); + clients = clientDao.forFaxNumbersJsonLike(emailAddress); email.setFax(true); } } @@ -119,75 +123,139 @@ */ @Override public void updateNewClients() { - NewClientTopiaDao newClientDao = getPersistenceContext().getNewClientDao(); - ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); - FaxToMailUserTopiaDao faxToMailUserDao = getPersistenceContext().getFaxToMailUserDao(); - Iterable<NewClient> newClients = newClientDao.findAll(); - Binder<NewClient, Client> binder = BinderFactory.newBinder(NewClient.class, Client.class); - - for (NewClient newClient : newClients) { - - NewClientType type = newClient.getType(); - switch (type) { - case CREATION: - case UPDATE: - // find client to create or update - Client client = clientDao.forCodeEquals(newClient.getCode()) - .addEquals(Client.PROPERTY_BRAND, newClient.getBrand()).findUniqueOrNull(); - if (client == null) { - client = new ClientImpl(); - if (type == NewClientType.UPDATE && log.isWarnEnabled()) { - log.warn(String.format("Can't find client code %s/%s to update. Client created.", newClient.getCode(), newClient.getBrand())); + final ClientTopiaDao clientDao = getPersistenceContext().getClientDao(); + final FaxToMailUserTopiaDao faxToMailUserDao = getPersistenceContext().getFaxToMailUserDao(); + + TopiaSqlSupport sqlSupport = getPersistenceContext().getSqlSupport(); + sqlSupport.doSqlWork(new TopiaSqlWork() { + + @Override + public void execute(Connection connection) throws SQLException { + + // attention, le sql à pour cible postgresql, mssql, h2, il doit rester simple + String query = String.format("SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s", + NewClient.PROPERTY_NAME, + NewClient.PROPERTY_EMAIL_ADDRESS, + NewClient.PROPERTY_FAX_NUMBER, + NewClient.PROPERTY_CARACTERISTIC1, + NewClient.PROPERTY_CARACTERISTIC2, + NewClient.PROPERTY_CARACTERISTIC3, + NewClient.PROPERTY_CODE, + NewClient.PROPERTY_BRAND, + NewClient.PROPERTY_COMPANY, + NewClient.PROPERTY_PERSON_IN_CHARGE, + NewClient.class.getSimpleName()); + Statement stat = connection.createStatement(); + + // get query result set + ResultSet resultSet = stat.executeQuery(query); + // cache utilise pour mettre à jour les mêmes client dans le cas ou + // il reviennt plusieurs fois + MultiKeyMap<String, Client> clientCache = new MultiKeyMap<>(); + + // parse result set + while (resultSet.next()) { + String name = resultSet.getString(NewClient.PROPERTY_NAME); + String emailAddress = resultSet.getString(NewClient.PROPERTY_EMAIL_ADDRESS); + String faxNumber = resultSet.getString(NewClient.PROPERTY_FAX_NUMBER); + String caracteristic1 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC1); + String caracteristic2 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC2); + String caracteristic3 = resultSet.getString(NewClient.PROPERTY_CARACTERISTIC3); + String code = resultSet.getString(NewClient.PROPERTY_CODE); + String brand = resultSet.getString(NewClient.PROPERTY_BRAND); + String company = resultSet.getString(NewClient.PROPERTY_COMPANY); + String personInCharge = resultSet.getString(NewClient.PROPERTY_PERSON_IN_CHARGE); + + // clear some data + if ("null".equalsIgnoreCase(caracteristic1)) { + caracteristic1 = null; + } + if ("null".equalsIgnoreCase(caracteristic2)) { + caracteristic2 = null; + } + if ("null".equalsIgnoreCase(caracteristic3)) { + caracteristic3 = null; + } + if ("null".equalsIgnoreCase(brand)) { + brand = null; + } + if ("null".equalsIgnoreCase(emailAddress)) { + emailAddress = null; + } + if (faxNumber != null) { + faxNumber = StringUtils.removePattern(faxNumber, "[^0-9]"); + if (faxNumber.isEmpty() || faxNumber.equals("0")) { + faxNumber = null; } - } else { - if (type == NewClientType.CREATION && log.isWarnEnabled()) { - log.warn(String.format("Creating a already existing client %s/%s. Client updated.", newClient.getCode(), newClient.getBrand())); - } } - // update client instance - binder.copyExcluding(newClient, client, - Client.PROPERTY_TOPIA_ID, - Client.PROPERTY_TOPIA_CREATE_DATE, - Client.PROPERTY_TOPIA_VERSION); + // save data + Client client = clientCache.get(code, company); + if (client == null) { + client = clientDao.forCodeEquals(code).addEquals(Client.PROPERTY_COMPANY, company).findUnique(); + if (client == null) { + client = new ClientImpl(); + client.setCode(code); + client.setCompany(company); + } - // update person in charge - FaxToMailUser personInCharge = null; - if (StringUtils.isNotBlank(newClient.getPersonInCharge())) { - personInCharge = faxToMailUserDao.forLoginEquals(newClient.getPersonInCharge()).findUniqueOrNull(); - } - client.setPersonInCharge(personInCharge); + client.setName(name); + client.setCaracteristic1(caracteristic1); + client.setCaracteristic2(caracteristic2); + client.setCaracteristic3(caracteristic3); + client.setBrand(brand); + + // clear current adresses and fax numbers + client.setEmailAddresses(null); + client.setFaxNumbers(null); - // persist - if (client.isPersisted()) { - clientDao.update(client); - } else { - clientDao.create(client); + // look for personInCharge + FaxToMailUser faxToMailUserInCharge = null; + if (StringUtils.isNotBlank(personInCharge)) { + faxToMailUserInCharge = faxToMailUserDao.forLoginEquals(personInCharge).findUniqueOrNull(); + } + client.setPersonInCharge(faxToMailUserInCharge); + + if (client.isPersisted()) { + client = clientDao.update(client); + } else { + client = clientDao.create(client); + } + + // update cache + clientCache.put(code, company, client); } - break; - - case DELETION: - Client deleteClient = clientDao.forCodeEquals(newClient.getCode()) - .addEquals(Client.PROPERTY_BRAND, newClient.getBrand()).findUniqueOrNull(); - if (deleteClient == null) { - if (log.isWarnEnabled()) { - log.warn(String.format("Can't find client code %s/%s to delete", newClient.getCode(), newClient.getBrand())); + // only manage emailAdress and faxNumber in this case client is in cache + if (StringUtils.isNotBlank(emailAddress)) { + List<String> currentAddresses = client.getEmailAddresses(); + if (currentAddresses == null) { + currentAddresses = new ArrayList<String>(); } - } else { - // FIXME le delete ne fonctionnera pas si des mails porte sur ce client - clientDao.delete(deleteClient); - if (log.isDebugEnabled()) { - log.debug(String.format("Client %s/%s deleted", newClient.getCode(), newClient.getBrand())); + currentAddresses.add(emailAddress); + client.setEmailAddresses(currentAddresses); + client = clientDao.update(client); + } + // and............................ faxNumber + if (StringUtils.isNotBlank(faxNumber)) { + List<String> faxNumbers = client.getFaxNumbers(); + if (faxNumbers == null) { + faxNumbers = new ArrayList<String>(); } + faxNumbers.add(faxNumber); + client.setFaxNumbers(faxNumbers); + client = clientDao.update(client); } - break; + } + + // delete all rows + stat = connection.createStatement(); + stat.execute("DELETE FROM " + NewClient.class.getSimpleName()); + } - - } - - newClientDao.deleteAll(newClients); + }); + getPersistenceContext().commit(); } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -37,6 +37,10 @@ import java.io.StringWriter; import java.io.Writer; import java.nio.charset.StandardCharsets; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -73,6 +77,8 @@ import org.nuiton.csv.ImportRuntimeException; import org.nuiton.jaxx.application.ApplicationTechnicalException; import org.nuiton.topia.persistence.TopiaEntities; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.topia.persistence.support.TopiaSqlWork; import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderFactory; import org.nuiton.util.pagination.PaginationParameter; @@ -94,7 +100,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Splitter; import com.google.common.base.Strings; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -1195,45 +1200,56 @@ @Override public void updateRangeRowsWithEdiReturns() { - EdiReturnTopiaDao ediReturnDao = getPersistenceContext().getEdiReturnDao(); - RangeRowTopiaDao rangeRowTopiaDao = getPersistenceContext().getRangeRowDao(); - EmailTopiaDao emailTopiaDao = getPersistenceContext().getEmailDao(); + final RangeRowTopiaDao rangeRowTopiaDao = getPersistenceContext().getRangeRowDao(); + final EmailTopiaDao emailTopiaDao = getPersistenceContext().getEmailDao(); - Set<Email> emailsToUpdate = new HashSet<>(); + final 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>() { + TopiaSqlSupport sqlSupport = getPersistenceContext().getSqlSupport(); + sqlSupport.doSqlWork(new TopiaSqlWork() { + @Override - public String apply(EdiReturn ediReturn) { - return ediReturn.getRangeRowTopiaId(); - } - }); + public void execute(Connection connection) throws SQLException { - List<RangeRow> rangeRows = rangeRowTopiaDao.forTopiaIdIn(rangeRowsIds).findAll(); - Map<String, RangeRow> rangeRowsById = Maps.uniqueIndex(rangeRows, TopiaEntities.getTopiaIdFunction()); + // attention, le sql à pour cible postgresql, mssql, h2, il doit rester simple + String query = String.format("SELECT %s, %s, %s FROM %s", + EdiReturn.PROPERTY_RANGE_ROW_TOPIA_ID, + EdiReturn.PROPERTY_COMMAND_NUMBER, + EdiReturn.PROPERTY_ERROR, + EdiReturn.class.getSimpleName()); + Statement stat = connection.createStatement(); - for (EdiReturn ediReturn : ediReturns) { - RangeRow rangeRow = rangeRowsById.get(ediReturn.getRangeRowTopiaId()); - Email email = emailTopiaDao.forRangeRowContains(rangeRow).findUnique(); + // execute query + ResultSet resultSet = stat.executeQuery(query); + while (resultSet.next()) { - if (StringUtils.isNotBlank(ediReturn.getError())) { - //error - email.setEdiError(ediReturn.getError()); + String rangeRowTopiaId = resultSet.getString(EdiReturn.PROPERTY_RANGE_ROW_TOPIA_ID); + String commandNumber = resultSet.getString(EdiReturn.PROPERTY_COMMAND_NUMBER); + String error = resultSet.getString(EdiReturn.PROPERTY_ERROR); - } else { - rangeRow.setCommandNumber(ediReturn.getCommandNumber()); + // manage email and range row + RangeRow rangeRow = rangeRowTopiaDao.forTopiaIdEquals(rangeRowTopiaId).findUnique(); + Email email = emailTopiaDao.forRangeRowContains(rangeRow).findUnique(); + + if (StringUtils.isNotBlank(error)) { + //error + email.setEdiError(error); + } else { + rangeRow.setCommandNumber(commandNumber); + rangeRowTopiaDao.update(rangeRow); + } + + email.setDemandStatus(DemandStatus.IN_PROGRESS); + emailsToUpdate.add(email); + } + + // delete all rows + stat = connection.createStatement(); + stat.execute("DELETE FROM " + EdiReturn.class.getSimpleName()); } + }); - 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/InitFaxToMailServiceImpl.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailServiceImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -39,6 +39,7 @@ import java.util.Map; import java.util.Random; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -344,12 +345,21 @@ List<RangeRow> rangeRows = new ArrayList<>(); Client client = clients.get(random.nextInt(clients.size())); - String sender = client.getEmailAddress(); boolean fax = false; - if (sender == null && client.getFaxNumber() != null) { - sender = client.getFaxNumber(); + List<String> senders = client.getEmailAddresses(); + List<String> faxNumbers = client.getFaxNumbers(); + if (CollectionUtils.isEmpty(senders) && CollectionUtils.isNotEmpty(faxNumbers)) { + senders = Collections.singletonList(client.getFaxNumbers().get(0)); fax = true; } + String sender = null; + if (CollectionUtils.isNotEmpty(senders)) { + sender = senders.get(0); + } + String faxNumber = null; + if (CollectionUtils.isNotEmpty(faxNumbers)) { + faxNumber = faxNumbers.get(0); + } boolean opened = random.nextBoolean(); @@ -371,7 +381,7 @@ Email.PROPERTY_FAX, fax, Email.PROPERTY_CLIENT, client, Email.PROPERTY_PROJECT_REFERENCE, projectRef, - Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now), + Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(now), Email.PROPERTY_RECEPTION_DATE, now, Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, @@ -419,7 +429,7 @@ Email.PROPERTY_FAX, fax, Email.PROPERTY_CLIENT, client, Email.PROPERTY_PROJECT_REFERENCE, projectRef, - Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday), + Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(yesterday), Email.PROPERTY_RECEPTION_DATE, yesterday, Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -28,10 +28,13 @@ import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.commons.collections4.map.MultiKeyMap; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.nuiton.csv.Import; import org.nuiton.csv.ImportRuntimeException; import org.nuiton.jaxx.application.ApplicationTechnicalException; @@ -45,7 +48,6 @@ import com.franciaflex.faxtomail.persistence.entities.DemandTypeTopiaDao; import com.franciaflex.faxtomail.persistence.entities.EmailAccount; import com.franciaflex.faxtomail.persistence.entities.EmailAccountTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; import com.franciaflex.faxtomail.persistence.entities.MailFolder; @@ -54,7 +56,9 @@ import com.franciaflex.faxtomail.persistence.entities.Range; import com.franciaflex.faxtomail.persistence.entities.RangeTopiaDao; import com.franciaflex.faxtomail.persistence.entities.WaitingState; +import com.franciaflex.faxtomail.persistence.entities.WaitingStateTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; +import com.franciaflex.faxtomail.services.service.imports.ClientImportBean; import com.franciaflex.faxtomail.services.service.imports.ClientImportModel; import com.franciaflex.faxtomail.services.service.imports.DemandTypeImportModel; import com.franciaflex.faxtomail.services.service.imports.EmailAccountImportModel; @@ -105,21 +109,51 @@ ClientTopiaDao dao = getPersistenceContext().getClientDao(); ClientImportModel clientImportModel = new ClientImportModel(';'); - Binder<Client, Client> clientBinder = BinderFactory.newBinder(Client.class); - Import<Client> importer = null; + Binder<ClientImportBean, Client> clientBinder = BinderFactory.newBinder(ClientImportBean.class, Client.class); + Import<ClientImportBean> importer = null; try { importer = Import.newImport(clientImportModel, new InputStreamReader(inputStream, getApplicationConfig().getImportFileEncoding())); - for (Client client : importer) { - - Client current = dao.forCodeEquals(client.getCode()).addEquals(Client.PROPERTY_BRAND, client.getBrand()).findAnyOrNull(); + + MultiKeyMap<String, Client> clientCache = new MultiKeyMap<>(); + for (ClientImportBean client : importer) { + + Client current = clientCache.get(client.getCode(), client.getCompany()); if (current == null) { - current = new ClientImpl(); + current = dao.forCodeEquals(client.getCode()).addEquals(Client.PROPERTY_COMPANY, client.getCompany()).findAnyOrNull(); + if (current == null) { + current = new ClientImpl(); + } + + clientBinder.copyExcluding(client, current, + Client.PROPERTY_TOPIA_ID, + Client.PROPERTY_TOPIA_CREATE_DATE, + Client.PROPERTY_TOPIA_VERSION); + + // clear current adresses and fax numbers + current.setEmailAddresses(null); + current.setFaxNumbers(null); + + // update cache + clientCache.put(client.getCode(), client.getCompany(), current); } - clientBinder.copyExcluding(client, current, - Client.PROPERTY_TOPIA_ID, - Client.PROPERTY_TOPIA_CREATE_DATE, - Client.PROPERTY_TOPIA_VERSION); + // manage special collections + if (StringUtils.isNotBlank(client.getEmailAddress())) { + List<String> currentAddresses = current.getEmailAddresses(); + if (currentAddresses == null) { + currentAddresses = new ArrayList<String>(); + } + currentAddresses.add(client.getEmailAddress()); + current.setEmailAddresses(currentAddresses); + } + if (StringUtils.isNotBlank(client.getFaxNumber())) { + List<String> faxNumbers = current.getFaxNumbers(); + if (faxNumbers == null) { + faxNumbers = new ArrayList<String>(); + } + faxNumbers.add(client.getFaxNumber()); + current.setFaxNumbers(faxNumbers); + } if (client.isPersisted()) { current = dao.update(current); Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java (rev 0) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,56 @@ +package com.franciaflex.faxtomail.services.service.imports; + +/* + * #%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.ClientImpl; + +public class ClientImportBean extends ClientImpl { + + /** serialVersionUID. */ + private static final long serialVersionUID = 5690836443815313312L; + + public static final String PROPERTY_EMAIL_ADDRESS = "emailAddress"; + public static final String PROPERTY_FAX_NUMBER = "faxNumber"; + + protected String emailAddress; + + protected String faxNumber; + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getFaxNumber() { + return faxNumber; + } + + public void setFaxNumber(String faxNumber) { + this.faxNumber = faxNumber; + } +} Property changes on: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportBean.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/imports/ClientImportModel.java 2014-09-18 09:29:19 UTC (rev 620) @@ -25,7 +25,6 @@ */ import com.franciaflex.faxtomail.persistence.entities.Client; -import com.franciaflex.faxtomail.persistence.entities.ClientImpl; import org.apache.commons.lang3.StringUtils; import org.nuiton.csv.ValueParser; @@ -37,7 +36,7 @@ * @author Kevin Morin (Code Lutin) * */ -public class ClientImportModel extends AbstractImportModel<Client> { +public class ClientImportModel extends AbstractImportModel<ClientImportBean> { public ClientImportModel(char separator) { super(separator); @@ -61,19 +60,24 @@ } if (s != null) { s = StringUtils.removePattern(s, "[^0-9]"); + if ("0".equals(s) || s.isEmpty()) { + s = null; + } } + return s; } }; - newMandatoryColumn("Id_Correspondance", Client.PROPERTY_ID); - newMandatoryColumn("Societe", Client.PROPERTY_BRAND); + newIgnoredColumn("Id_Correspondance"); + newMandatoryColumn("Societe", Client.PROPERTY_COMPANY); + newMandatoryColumn("Marque", Client.PROPERTY_BRAND, nullParser); newMandatoryColumn("Nom", Client.PROPERTY_NAME); newMandatoryColumn("Caracteristique1", Client.PROPERTY_CARACTERISTIC1, nullParser); newMandatoryColumn("Caracteristique2", Client.PROPERTY_CARACTERISTIC2, nullParser); newMandatoryColumn("Caracteristique3", Client.PROPERTY_CARACTERISTIC3, nullParser); - newMandatoryColumn("Numero_Fax", Client.PROPERTY_FAX_NUMBER, faxParser); - newMandatoryColumn("Adresse_Mail", Client.PROPERTY_EMAIL_ADDRESS, nullParser); + newMandatoryColumn("Numero_Fax", ClientImportBean.PROPERTY_FAX_NUMBER, faxParser); + newMandatoryColumn("Adresse_Mail", ClientImportBean.PROPERTY_EMAIL_ADDRESS, nullParser); newMandatoryColumn("Code_Client", Client.PROPERTY_CODE); newIgnoredColumn("Client_Top"); @@ -82,7 +86,7 @@ } @Override - public Client newEmptyInstance() { - return new ClientImpl(); + public ClientImportBean newEmptyInstance() { + return new ClientImportBean(); } } Added: trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql =================================================================== --- trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql (rev 0) +++ trunk/faxtomail-service/src/main/resources/db/migration/h2/V1_0_0_620__modification_newclient_edireturn.sql 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,43 @@ + +-- remove topia from newclient +drop table newclient; +create table newClient ( + name longvarchar, + emailAddress longvarchar, + faxNumber longvarchar, + caracteristic1 longvarchar, + caracteristic2 longvarchar, + caracteristic3 longvarchar, + code longvarchar not null, + company longvarchar not null, + brand longvarchar, + personInCharge longvarchar, + unique (code, company, emailAddress, faxNumber) +); + +-- remove topia from edireturn +drop table edireturn; +create table ediReturn ( + rangeRowTopiaId longvarchar not null, + commandNumber longvarchar, + error longvarchar, + unique (rangeRowTopiaId) +); + +-- clear client table +update email set client = null; +delete from client; + +-- add company in client +--drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; + +alter table client drop emailAddress; +alter table client drop faxNumber; +alter table client drop id; + +alter table client add company longvarchar not NULL; +alter table client add emailAddressesJson longvarchar; +alter table client add faxNumbersJson longvarchar; +alter table client alter brand SET NULL; + +alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); Added: trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql =================================================================== --- trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql (rev 0) +++ trunk/faxtomail-service/src/main/resources/db/migration/postgres/V1_0_0_620__modification_newclient_edireturn.sql 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,43 @@ + +-- remove topia from newclient +drop table newclient; +create table newClient ( + name text, + emailAddress text, + faxNumber text, + caracteristic1 text, + caracteristic2 text, + caracteristic3 text, + code text not null, + company text not null, + brand text, + personInCharge text, + unique (code, company, emailAddress, faxNumber) +); + +-- remove topia from edireturn +drop table edireturn; +create table ediReturn ( + rangeRowTopiaId text not null, + commandNumber text, + error text, + unique (rangeRowTopiaId) +); + +-- clear client table +update email set client = null; +delete from client; + +-- add company in client +--drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; + +alter table client drop emailAddress; +alter table client drop faxNumber; +alter table client drop id; + +alter table client add company text not NULL; +alter table client add emailAddressesJson text; +alter table client add faxNumbersJson text; +alter table client alter brand drop not NULL; + +alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); Added: trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql =================================================================== --- trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql (rev 0) +++ trunk/faxtomail-service/src/main/resources/db/migration/sqlserver/V1_0_0_620__modification_newclient_edireturn.sql 2014-09-18 09:29:19 UTC (rev 620) @@ -0,0 +1,48 @@ + +-- remove topia from newclient +drop table newclient; +GO +create table newClient ( + name varchar(MAX), + emailAddress varchar(MAX), + faxNumber varchar(MAX), + caracteristic1 varchar(MAX), + caracteristic2 varchar(MAX), + caracteristic3 varchar(MAX), + code varchar(MAX) not null, + company varchar(MAX) not null, + brand varchar(MAX), + personInCharge varchar(MAX), + unique (code, company, emailAddress, faxNumber) +); +GO + +-- remove topia from edireturn +drop table edireturn; +GO +create table ediReturn ( + rangeRowTopiaId varchar(255) not null, + commandNumber varchar(MAX), + error varchar(MAX), + unique (rangeRowTopiaId) +); +GO + +-- clear client table +update email set client = null; +delete from client; + +-- add company in client +--drop constraint UK_b4ck8pelycojqmbrd8n36mdfw; + +alter table client drop emailAddress; +alter table client drop faxNumber; +alter table client drop id; + +alter table client add company text not NULL; +alter table client add emailAddressesJson varchar(MAX); +alter table client add faxNumbersJson varchar(MAX); +alter table client alter brand drop not NULL; + +alter table client add constraint UK_kqpy7y2f4onck5julevr0hfg1 unique (code, company); +GO Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/AbstractFaxToMailServiceTest.java 2014-09-18 09:29:19 UTC (rev 620) @@ -26,6 +26,9 @@ import java.io.File; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -39,7 +42,8 @@ import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; import org.junit.After; -import org.nuiton.util.FileUtil; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.topia.persistence.support.TopiaSqlWork; import com.franciaflex.faxtomail.FaxToMailConfiguration; import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; @@ -101,105 +105,71 @@ return hibernateH2Config; } - protected FaxToMailTopiaApplicationContext newApplicationContext(String dataBase) { + protected FaxToMailTopiaApplicationContext getApplicationContext() { - Map<String, String> hibernateH2Config = getDatabaseConfiguration(dataBase); + if (applicationContext == null) { + String databaseName = UUID.randomUUID().toString(); + Map<String, String> hibernateH2Config = getDatabaseConfiguration(databaseName); - FaxToMailTopiaApplicationContext applicationContext = new FaxToMailTopiaApplicationContext(hibernateH2Config); - - if (log.isTraceEnabled()) { - log.trace("created root context " + applicationContext); + applicationContext = new FaxToMailTopiaApplicationContext(hibernateH2Config); + addMissingTable(applicationContext); + + if (log.isTraceEnabled()) { + log.trace("created root context " + applicationContext); + } } return applicationContext; } - protected boolean isDatabaseWithReferential() { - return false; - } + /** + * Ajoute manuellement les tables qui ne sont pas gérées par Topia. + * + * @param applicationContext application context + */ + protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { + FaxToMailTopiaPersistenceContext persistenceContext = applicationContext.newPersistenceContext(); + TopiaSqlSupport sqlSupport = persistenceContext.getSqlSupport(); + sqlSupport.doSqlWork(new TopiaSqlWork() { + @Override + public void execute(Connection connection) throws SQLException { + + Statement stat = connection.createStatement(); - protected FaxToMailTopiaApplicationContext getApplicationContext() { + stat.executeUpdate("create table newClient ( " + + "name longvarchar, " + + "emailAddress longvarchar, " + + "faxNumber longvarchar, " + + "caracteristic1 longvarchar, " + + "caracteristic2 longvarchar, " + + "caracteristic3 longvarchar, " + + "code longvarchar not null, " + + "company longvarchar not null, " + + "brand longvarchar, " + + "personInCharge longvarchar, " + + "unique (code, company, emailAddress, faxnumber)" + + "); "); + + stat.executeUpdate("create table ediReturn ( " + + "rangeRowTopiaId longvarchar not null," + + "commandNumber longvarchar, " + + "error longvarchar, " + + "unique (rangeRowTopiaId) " + + ")"); + + connection.commit(); - String databaseName = UUID.randomUUID().toString(); - - if (isDatabaseWithReferential()) { - - File tempDirFile = SystemUtils.getJavaIoTmpDir(); - - File databaseRefFile = new File(tempDirFile, DATABASE_REF); - - if (!databaseRefFile.exists()) { - - if (log.isTraceEnabled()) { - log.trace("create referential data base"); - } - - FaxToMailTopiaApplicationContext applicationContext = newApplicationContext(DATABASE_REF); - - FaxToMailServiceContext serviceContext = FaxToMailServiceContext.newDirectServiceContext(applicationContext); - - serviceContext.setApplicationConfig(getApplicationConfig()); - - InitFaxToMailService initFaxToMailService = serviceContext.getInitFaxToMailService(); - - initFaxToMailService.init(); - - if (log.isTraceEnabled()) { - log.trace("closing transaction " + applicationContext); - } - - applicationContext.close(); - - File lockFile = new File(databaseRefFile, "h2data.lock.db"); - - int countWaiting = 0; - - while (lockFile.exists() && countWaiting < 150) { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - throw new RuntimeException("can't wait", e); - } - countWaiting++; - } - - if (lockFile.exists()) { - throw new RuntimeException("database ref is not close after 30 seconds !"); - } - } + }); - File databaseFile = new File(tempDirFile, databaseName); - - if (log.isTraceEnabled()) { - log.trace("Copy referential database to " + databaseFile.getName()); - } - - try { - FileUtil.copyAndRenameRecursively(databaseRefFile, databaseFile, false, null, null, false); - } catch (IOException e) { - throw new RuntimeException("can't copy database Ref", e); - } - - if (log.isTraceEnabled()) { - log.trace("Copy referential database : Complete"); - } - } - - return newApplicationContext(databaseName); + persistenceContext.close(); } protected FaxToMailTopiaPersistenceContext newPersistenceContext() { - if (applicationContext == null) { - - applicationContext = getApplicationContext(); - - } - FaxToMailTopiaPersistenceContext persistenceContext; - persistenceContext = applicationContext.newPersistenceContext(); + persistenceContext = getApplicationContext().newPersistenceContext(); if (log.isTraceEnabled()) { log.trace("opened transaction " + persistenceContext); Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/ClientServiceTest.java 2014-09-18 09:29:19 UTC (rev 620) @@ -1,17 +1,5 @@ package com.franciaflex.faxtomail.services.service; -import java.io.IOException; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.NewClient; -import com.franciaflex.faxtomail.persistence.entities.NewClientImpl; -import com.franciaflex.faxtomail.persistence.entities.NewClientTopiaDao; -import com.franciaflex.faxtomail.persistence.entities.NewClientType; - /* * #%L * FaxToMail :: Service @@ -36,6 +24,22 @@ * #L% */ +import java.io.IOException; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.topia.persistence.support.TopiaSqlWork; + +import com.franciaflex.faxtomail.persistence.entities.Client; +import com.franciaflex.faxtomail.persistence.entities.ClientTopiaDao; +import com.franciaflex.faxtomail.persistence.entities.NewClient; + /** * Test de client service. * @@ -54,7 +58,12 @@ @Test public void testImportClientCount() { ClientTopiaDao clientDao = getServiceContext().getPersistenceContext().getClientDao(); + + // asserts Assert.assertEquals(4, clientDao.count()); + // les emails et les fax ont une gestion particuliere + Assert.assertFalse(clientDao.forEmailAddressesJsonLike("gerard.menvussa@code.com").isEmpty()); + Assert.assertFalse(clientDao.forFaxNumbersJsonLike("0498877665").isEmpty()); } /** @@ -64,37 +73,51 @@ public void testAddNewClientInTmpTable() { ClientService clientService = newService(ClientService.class); - NewClientTopiaDao newClientDao = getServiceContext().getPersistenceContext().getNewClientDao(); ClientTopiaDao clientDao = getServiceContext().getPersistenceContext().getClientDao(); // asserts - Assert.assertNull(clientDao.forEmailAddressEquals("gerard.menvussa@lutin.com").findAnyOrNull()); + Assert.assertTrue(clientDao.forEmailAddressesJsonLike("gerard.menvussa@lutin.com").isEmpty()); // add new clients - NewClient newClient = new NewClientImpl(); - newClient.setCode("99154"); - newClient.setBrand("FX"); - newClient.setEmailAddress("gerard.menvussa@lutin.com"); - newClient.setType(NewClientType.UPDATE); - newClient = newClientDao.create(newClient); + TopiaSqlSupport sqlSupport = getServiceContext().getPersistenceContext().getSqlSupport(); + sqlSupport.doSqlWork(new TopiaSqlWork() { + @Override + public void execute(Connection connection) throws SQLException { - // precedure de mise à jour - clientService.updateNewClients(); + String query = String.format("INSERT INTO %s(%s,%s,%s,%s,%s) VALUES(?, ?, ?, ?, ?)", + NewClient.class.getSimpleName(), + NewClient.PROPERTY_CODE, + NewClient.PROPERTY_COMPANY, + NewClient.PROPERTY_BRAND, + NewClient.PROPERTY_EMAIL_ADDRESS, + NewClient.PROPERTY_NAME); - // asserts - Assert.assertNotNull(clientDao.forEmailAddressEquals("gerard.menvussa@lutin.com").findAnyOrNull()); + PreparedStatement stat = connection.prepareStatement(query); + stat.setString(1, "99154"); + stat.setString(2, "FX"); + stat.setString(3, "FX"); + stat.setString(4, "gerard.menvussa@lutin.com"); + stat.setString(5, "Gerard"); + int result = stat.executeUpdate(); + Assert.assertEquals(1, result); - // add new clients - NewClient deleteClient = new NewClientImpl(); - deleteClient.setCode("99154"); - deleteClient.setBrand("FX"); - deleteClient.setType(NewClientType.DELETION); - deleteClient = newClientDao.create(deleteClient); + stat.setString(1, "99154"); + stat.setString(2, "FX"); + stat.setString(3, "FX"); + stat.setString(4, "gerard.menvussa+test@lutin.com"); + stat.setString(5, "Gerard"); + result = stat.executeUpdate(); + Assert.assertEquals(1, result); + } + }); // precedure de mise à jour clientService.updateNewClients(); // asserts - Assert.assertNull(clientDao.forCodeEquals("99154").findAnyOrNull()); + List<Client> clients = clientDao.forEmailAddressesJsonLike("gerard.menvussa@lutin.com"); + Assert.assertEquals(1, clients.size()); + Assert.assertEquals(2, clients.get(0).getEmailAddresses().size()); + } } Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java 2014-09-18 09:29:19 UTC (rev 620) @@ -31,12 +31,14 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -242,12 +244,21 @@ List<RangeRow> rangeRows = new ArrayList<>(); Client client = clients.get(0); - String sender = client.getEmailAddress(); boolean fax = false; - if (sender == null && client.getFaxNumber() != null) { - sender = client.getFaxNumber(); + List<String> senders = client.getEmailAddresses(); + List<String> faxNumbers = client.getFaxNumbers(); + if (CollectionUtils.isEmpty(senders) && CollectionUtils.isNotEmpty(faxNumbers)) { + senders = Collections.singletonList(client.getFaxNumbers().get(0)); fax = true; } + String sender = null; + if (CollectionUtils.isNotEmpty(senders)) { + sender = senders.get(0); + } + String faxNumber = null; + if (CollectionUtils.isNotEmpty(faxNumbers)) { + faxNumber = faxNumbers.get(0); + } boolean opened = true; //random.nextBoolean(); @@ -264,12 +275,13 @@ String projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(now)); - Email email = emailDao.create(Email.PROPERTY_SENDER, sender, + Email email = emailDao.create( + Email.PROPERTY_SENDER, sender, Email.PROPERTY_FAX, fax, Email.PROPERTY_CLIENT, client, Email.PROPERTY_PROJECT_REFERENCE, projectRef, Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " - + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(now), + + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(now), Email.PROPERTY_RECEPTION_DATE, now, Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, @@ -282,9 +294,11 @@ DemandType demandType = types.get(0); // types.get(0) à des gammes obligatoires if (FaxToMailServiceUtils.contains(demandType.getRequiredFields(), MailField.RANGE_ROW)) { for (int j = 0; j < 4; j++) { - RangeRow rangeRow = rangeRowDao.create(RangeRow.PROPERTY_RANGE, ranges.get(j), - RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), RangeRow.PROPERTY_PRODUCT_QUANTITY, - 50, RangeRow.PROPERTY_SAV_QUANTITY, 60); + RangeRow rangeRow = rangeRowDao.create( + RangeRow.PROPERTY_RANGE, ranges.get(j), + RangeRow.PROPERTY_COMMAND_NUMBER, RandomStringUtils.randomNumeric(6), + RangeRow.PROPERTY_PRODUCT_QUANTITY, 50, + RangeRow.PROPERTY_SAV_QUANTITY, 60); rangeRows.add(rangeRow); } email.setRangeRow(rangeRows); @@ -306,11 +320,12 @@ Email.PROPERTY_MAIL_FOLDER, Email.PROPERTY_DEMAND_STATUS)); projectRef = t("faxtomail.email.projectReference.default", dateDecorator.toString(yesterday)); - email = emailDao.create(Email.PROPERTY_SENDER, sender, + email = emailDao.create( + Email.PROPERTY_SENDER, sender, Email.PROPERTY_FAX, fax, Email.PROPERTY_CLIENT,client, Email.PROPERTY_PROJECT_REFERENCE, projectRef, Email.PROPERTY_OBJECT, client.getCaracteristic1() + " / " + client.getCode() + " / " - + client.getName() + " / " + client.getFaxNumber() + " / " + dateDecorator.toString(yesterday), + + client.getName() + " / " + faxNumber + " / " + dateDecorator.toString(yesterday), Email.PROPERTY_RECEPTION_DATE, yesterday, Email.PROPERTY_MAIL_FOLDER, folder, Email.PROPERTY_DEMAND_STATUS, opened ? DemandStatus.IN_PROGRESS : DemandStatus.UNTREATED, Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java 2014-09-18 09:29:19 UTC (rev 620) @@ -31,6 +31,8 @@ import org.junit.Ignore; import org.junit.Test; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; + /** * Class utilitaire permettant de générer facilement les schemas pour différentes base de données. * @@ -68,6 +70,11 @@ hibernateH2Config.put(Environment.URL, "jdbc:postgresql:faxtomail");*/ return hibernateH2Config; } + + @Override + protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { + // not needed here (and not working) + } @Test public void getSqlServerSchema() { Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java =================================================================== --- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/migration/FlywayMigrationTest.java 2014-09-18 09:29:19 UTC (rev 620) @@ -43,6 +43,7 @@ import org.nuiton.topia.persistence.support.TopiaSqlQuery; import org.nuiton.util.FileUtil; +import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaApplicationContext; import com.franciaflex.faxtomail.services.service.AbstractFaxToMailServiceTest; /** @@ -80,6 +81,11 @@ return hibernateH2Config; } + + @Override + protected void addMissingTable(FaxToMailTopiaApplicationContext applicationContext) { + // on desactive la creation des tables dans ce cas car la base est existante + } /** * Vérifie la version de la base de données après les migrations qui sont sensées être passée. Modified: trunk/faxtomail-service/src/test/resources/csv/clients.csv =================================================================== --- trunk/faxtomail-service/src/test/resources/csv/clients.csv 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-service/src/test/resources/csv/clients.csv 2014-09-18 09:29:19 UTC (rev 620) @@ -1,5 +1,5 @@ -Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client -253042;FX;John Doe;A;71 Allo;NULL;03 12 34 56 78;john@doe.fr;99153 -253142;FX;Gerard Menvussa;A+;40 Nabi;NULL;05 12 23 34 45;gerard.menvussa@code.com;99154 -253242;FX;Ella Elli;NULL;38 LA;NULL;04 98 87 76 65;NULL;99184 -253243;FX;Cossé David;NULL;38 LA;NULL;04 98 87 76 65;david.cosse@sfr.fr;22152 \ No newline at end of file +Id_Correspondance;Societe;Marque;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client +253042;FX;FX;John Doe;A;71 Allo;NULL;03 12 34 56 78;john@doe.fr;99153 +253142;FX;;Gerard Menvussa;A+;40 Nabi;NULL;05 12 23 34 45;gerard.menvussa@code.com;99154 +253242;FX;FX;Ella Elli;NULL;38 LA;NULL;04 98 87 76 65;NULL;99184 +253243;FX;;Cossé David;NULL;38 LA;NULL;04 98 87 76 65;david.cosse@sfr.fr;22152 \ No newline at end of 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-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/job/MailFilterJob.java 2014-09-18 09:29:19 UTC (rev 620) @@ -322,10 +322,16 @@ String object; if (client != null) { + //TODO echatellier : a valider que l'on affiche bien le premier mail du client + String faxNumber = "-"; + if (CollectionUtils.isNotEmpty(client.getFaxNumbers())) { + faxNumber = client.getFaxNumbers().get(0); + } + object = ObjectUtils.defaultIfNull(client.getCaracteristic1(), "-") + " / " + ObjectUtils.defaultIfNull(client.getCode(), "-") + " / " + ObjectUtils.defaultIfNull(client.getName(), "-") + " / " + - ObjectUtils.defaultIfNull(client.getFaxNumber(), "-") + " / " + + faxNumber + " / " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date()); modifiedProperties.add(Email.PROPERTY_CLIENT); Modified: 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 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/import-input.jsp 2014-09-18 09:29:19 UTC (rev 620) @@ -44,7 +44,7 @@ <div class="form-group"> <label for="clientField" class="control-label">Fichier client :</label> <input type="file" id="clientField" name="clientFile" class="form-control"> - <p class="help-block">Format du fichier csv : <code>Id_Correspondance;Societe;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client</code><br /> + <p class="help-block">Format du fichier csv : <code>Societe;Marque;Nom;Caracteristique1;Caracteristique2;Caracteristique3;Numero_Fax;Adresse_Mail;Code_Client</code><br /> Encodage du fichier csv : <code>${applicationConfig.importFileEncoding}</code></p> </div> <button type="submit" class="btn btn-primary navbar-btn">Valider</button> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-09-17 08:37:38 UTC (rev 619) +++ trunk/pom.xml 2014-09-18 09:29:19 UTC (rev 620) @@ -479,6 +479,12 @@ <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.2.1</version> + <exclusions> + <exclusion> + <groupId>c3p0</groupId> + <artifactId>c3p0</artifactId> + </exclusion> + </exclusions> </dependency> <dependency>
participants (1)
-
echatellier@users.forge.codelutin.com