Author: echatellier Date: 2014-06-02 22:34:14 +0200 (Mon, 02 Jun 2014) New Revision: 124 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/124 Log: Correction de la sauvegarde des etats attente et mail folder cr?\195?\169?\195?\169s Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-06-02 20:10:28 UTC (rev 123) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-06-02 20:34:14 UTC (rev 124) @@ -32,6 +32,7 @@ import java.util.Map; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.persistence.TopiaIdFactory; @@ -43,6 +44,7 @@ import com.franciaflex.faxtomail.persistence.entities.MailFilter; import com.franciaflex.faxtomail.persistence.entities.MailFilterTopiaDao; import com.franciaflex.faxtomail.persistence.entities.MailFolder; +import com.franciaflex.faxtomail.persistence.entities.MailFolderImpl; import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao; import com.franciaflex.faxtomail.services.FaxToMailServiceSupport; import com.google.common.collect.Lists; @@ -101,15 +103,15 @@ } Collection<MailFolder> result = Lists.newArrayList(); MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao(); - TopiaIdFactory factory = getPersistenceContext().getTopiaIdFactory(); + //TopiaIdFactory factory = getPersistenceContext().getTopiaIdFactory(); Binder<MailFolder, MailFolder> binderMailFolder = BinderFactory.newBinder(MailFolder.class); for (MailFolder mailFolder : mailFolders) { Collection<MailFolder> children = saveMailFolders(mailFolder, mailFolder.getChildren()); MailFolder currentMailFolder; - if (!factory.isTopiaId(mailFolder.getTopiaId())) { - currentMailFolder = dao.create(); + if (StringUtils.isBlank(mailFolder.getTopiaId()) || mailFolder.getTopiaId().startsWith("new_")) { + currentMailFolder = new MailFolderImpl(); } else { currentMailFolder = dao.findByTopiaId(mailFolder.getTopiaId()); } Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java =================================================================== --- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-02 20:10:28 UTC (rev 123) +++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-06-02 20:34:14 UTC (rev 124) @@ -106,20 +106,23 @@ for (EtatAttente etatAttente : etatAttentes) { // get current etat attente EtatAttente currentEtatAttente; - if (StringUtils.isNoneBlank(etatAttente.getTopiaId())) { + if (StringUtils.isBlank(etatAttente.getTopiaId()) || etatAttente.getTopiaId().startsWith("new_")) { + currentEtatAttente = new EtatAttenteImpl(); + } else { currentEtatAttente = allEtatAttenteIndex.remove(etatAttente.getTopiaId()); - } else { - currentEtatAttente = new EtatAttenteImpl(); } // copy - binderEtatAttente.copy(etatAttente, currentEtatAttente); + binderEtatAttente.copyExcluding(etatAttente, currentEtatAttente, + EtatAttente.PROPERTY_TOPIA_ID, + EtatAttente.PROPERTY_TOPIA_CREATE_DATE, + EtatAttente.PROPERTY_TOPIA_VERSION); // persist if (currentEtatAttente.isPersisted()) { + etatAttenteDAO.update(currentEtatAttente); + } else { etatAttenteDAO.create(currentEtatAttente); - } else { - etatAttenteDAO.update(currentEtatAttente); } } Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java =================================================================== --- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-02 20:10:28 UTC (rev 123) +++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-06-02 20:34:14 UTC (rev 124) @@ -25,7 +25,6 @@ */ import java.lang.reflect.Type; -import java.util.Collections; import java.util.List; import java.util.Map; Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-02 20:10:28 UTC (rev 123) +++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-06-02 20:34:14 UTC (rev 124) @@ -78,8 +78,8 @@ $scope.selectedEtatAttente = etatAttente; // initialize le tableau d'action si vide - if (!$scope.selectedEtatAttente.actions) { - $scope.selectedEtatAttente.actions = []; + if (!$scope.selectedEtatAttente.mainActions) { + $scope.selectedEtatAttente.mainActions = []; } if (!$scope.selectedEtatAttente.fields) { $scope.selectedEtatAttente.fields = []; @@ -147,7 +147,8 @@ if (name) { var newRoot = { topiaId: "new_" + guid(), - name: name + name: name, + children: [] }; $scope.mailFolders.push(newRoot); @@ -167,8 +168,8 @@ if (!$scope.selectedMailFolder.replyAddresses) { $scope.selectedMailFolder.replyAddresses = []; } - if (!$scope.selectedMailFolder.folderActions) { - $scope.selectedMailFolder.folderActions = []; + if (!$scope.selectedMailFolder.contextActions) { + $scope.selectedMailFolder.contextActions = []; } if (!$scope.selectedMailFolder.folderTableColumns) { $scope.selectedMailFolder.folderTableColumns = []; @@ -203,6 +204,7 @@ var name = $window.prompt("Nom du nouveau noeud ? "); if (name) { nodeData.children.push({ + topiaId: "new_" + guid(), name: name, children: [] });