Faxtomail-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 1934 discussions
r494 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service
by kmorin@users.forge.codelutin.com 07 Aug '14
by kmorin@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: kmorin
Date: 2014-08-07 18:11:14 +0200 (Thu, 07 Aug 2014)
New Revision: 494
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/494
Log:
integration des fetchs
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-08-07 15:54:09 UTC (rev 493)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-08-07 16:11:14 UTC (rev 494)
@@ -37,7 +37,7 @@
# DemandType
com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.label.tagvalue.naturalId=true
-com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.fields.tagvalue.unique=true
+com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.fields.stereotype=unique
# Client
com.franciaflex.faxtomail.persistence.entities.Client.attribute.brand.tagvalue.naturalId=true
@@ -88,7 +88,7 @@
# History
com.franciaflex.faxtomail.persistence.entities.History.attribute.type.tagvalue.notNull=true
-com.franciaflex.faxtomail.persistence.entities.History.attribute.fields.tagvalue.unique=true
+com.franciaflex.faxtomail.persistence.entities.History.attribute.fields.stereotype=unique
# FaxToMailUser
com.franciaflex.faxtomail.persistence.entities.FaxToMailUser.attribute.login.tagvalue.naturalId=true
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-08-07 15:54:09 UTC (rev 493)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-07 16:11:14 UTC (rev 494)
@@ -494,7 +494,7 @@
.addNotEquals(Email.PROPERTY_DEMAND_STATUS, DemandStatus.ARCHIVED)
.addAllFetches(
Email.PROPERTY_DEMAND_TYPE,
-// Email.PROPERTY_DEMAND_TYPE + "." + DemandType.PROPERTY_FIELDS,
+ Email.PROPERTY_DEMAND_TYPE + "." + DemandType.PROPERTY_FIELDS,
Email.PROPERTY_RANGE_ROW,
Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE,
Email.PROPERTY_HISTORY,
@@ -511,12 +511,6 @@
)
.findPage(page);
- // fetch fields manually to avoid a multiple bags exception in the previous query
- for (Email email : result.getElements()) {
- if (email.getDemandType() != null) {
- Hibernate.initialize(email.getDemandType().getFields());
- }
- }
} else {
List<Email> elements = Collections.emptyList();
result = PaginationResult.of(elements, 0, page);
1
0
r493 - 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/resources/db/migration faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit
by kmorin@users.forge.codelutin.com 07 Aug '14
by kmorin@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: kmorin
Date: 2014-08-07 17:54:09 +0200 (Thu, 07 Aug 2014)
New Revision: 493
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/493
Log:
integration des fetchs
Added:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java
trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_492__add_emailGroup_emails_idx.sql
Modified:
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/EmailServiceImpl.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
Added: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java (rev 0)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/MailFolderImpl.java 2014-08-07 15:54:09 UTC (rev 493)
@@ -0,0 +1,32 @@
+package com.franciaflex.faxtomail.persistence.entities;
+
+/**
+ * @author Kevin Morin (Code Lutin)
+ * @since x.x
+ */
+public class MailFolderImpl extends MailFolderAbstract {
+
+ protected Boolean folderReadable;
+ protected Boolean folderWritable;
+
+ @Override
+ public Boolean isFolderReadable() {
+ return folderReadable;
+ }
+
+ @Override
+ public void setFolderReadable(Boolean folderReadable) {
+ this.folderReadable = folderReadable;
+ }
+
+ @Override
+ public Boolean isFolderWritable() {
+ return folderWritable;
+ }
+
+ @Override
+ public void setFolderWritable(Boolean folderWritable) {
+ this.folderWritable = folderWritable;
+ }
+
+}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties
===================================================================
--- trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-08-07 15:41:29 UTC (rev 492)
+++ trunk/faxtomail-persistence/src/main/xmi/faxtomail.properties 2014-08-07 15:54:09 UTC (rev 493)
@@ -37,6 +37,7 @@
# DemandType
com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.label.tagvalue.naturalId=true
+com.franciaflex.faxtomail.persistence.entities.DemandType.attribute.fields.tagvalue.unique=true
# Client
com.franciaflex.faxtomail.persistence.entities.Client.attribute.brand.tagvalue.naturalId=true
@@ -47,7 +48,7 @@
com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.brand.tagvalue.notNull=true
com.franciaflex.faxtomail.persistence.entities.NewClient.attribute.type.tagvalue.notNull=true
-#\u00a0EdiReturn
+# EdiReturn
com.franciaflex.faxtomail.persistence.entities.EdiReturn.attribute.rangeRowTopiaId.tagvalue.notNull=true
# EmailAccount
@@ -87,8 +88,8 @@
# History
com.franciaflex.faxtomail.persistence.entities.History.attribute.type.tagvalue.notNull=true
+com.franciaflex.faxtomail.persistence.entities.History.attribute.fields.tagvalue.unique=true
-
# FaxToMailUser
com.franciaflex.faxtomail.persistence.entities.FaxToMailUser.attribute.login.tagvalue.naturalId=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/EmailServiceImpl.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-07 15:41:29 UTC (rev 492)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-07 15:54:09 UTC (rev 493)
@@ -492,13 +492,13 @@
result = dao.forMailFolderEquals(folder)
.addNull(Email.PROPERTY_ARCHIVE_DATE)
.addNotEquals(Email.PROPERTY_DEMAND_STATUS, DemandStatus.ARCHIVED)
- .addAllFetches(Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_DEMAND_STATUS,
+ .addAllFetches(
+ Email.PROPERTY_DEMAND_TYPE,
+// Email.PROPERTY_DEMAND_TYPE + "." + DemandType.PROPERTY_FIELDS,
Email.PROPERTY_RANGE_ROW,
Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE,
Email.PROPERTY_HISTORY,
Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER,
- Email.PROPERTY_HISTORY + "." + History.PROPERTY_TYPE,
Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS,
Email.PROPERTY_REPLIES,
Email.PROPERTY_ATTACHMENT,
@@ -507,13 +507,16 @@
Email.PROPERTY_EMAIL_GROUP,
Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL,
Email.PROPERTY_ETAT_ATTENTE,
- Email.PROPERTY_PRIORITY)
+ Email.PROPERTY_PRIORITY
+ )
.findPage(page);
-// //FIXME kmorin 20140805 fetch
-// for (Email email : result.getElements()) {
-// fetchEmailData(email);
-// }
+ // fetch fields manually to avoid a multiple bags exception in the previous query
+ for (Email email : result.getElements()) {
+ if (email.getDemandType() != null) {
+ Hibernate.initialize(email.getDemandType().getFields());
+ }
+ }
} else {
List<Email> elements = Collections.emptyList();
result = PaginationResult.of(elements, 0, page);
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java 2014-08-07 15:41:29 UTC (rev 492)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java 2014-08-07 15:54:09 UTC (rev 493)
@@ -30,14 +30,17 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.Hibernate;
import org.nuiton.util.pagination.PaginationParameter;
import com.franciaflex.faxtomail.persistence.entities.EmailTopiaDao;
@@ -107,44 +110,57 @@
MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
List<MailFolder> result = new ArrayList<>(dao.getReadableFolders(user));
for (MailFolder f : result) {
- findReadableFolders(f);
+ findReadableFolders(f, user, false);
+
+ while (f.getParent() != null) {
+ f = f.getParent();
+
+ Hibernate.initialize(f);
+ f.setFolderReadable(false);
+ f.setFolderWritable(false);
+
+ fetchFolderAttributes(f);
+ }
}
return result;
}
- protected void findReadableFolders(MailFolder folder) {
- folder.sizeFolderTableColumns();
- //TODO kmorin 20140806 put rights for user in impl
- folder.sizeWriteRightGroups();
- folder.sizeWriteRightUsers();
- folder.sizeRanges();
- folder.sizeReplyAddresses();
- folder.sizeReplyDomains();
+ protected void findReadableFolders(MailFolder folder, FaxToMailUser user, boolean writable) {
+ folder.setFolderReadable(true);
- if (folder.sizeEtatAttentes() > 0) {
- for (EtatAttente etatAttente : folder.getEtatAttentes()) {
- etatAttente.sizeInvalidFormDisabledActions();
- etatAttente.sizeValidFormDisabledActions();
- }
+ if (!writable && folder.sizeWriteRightGroups() > 0) {
+ writable = CollectionUtils.containsAny(folder.getWriteRightGroups(), user.getUserGroups());
}
-
- if (folder.sizeDemandTypes() > 0) {
- for (DemandType demandType : folder.getDemandTypes()) {
- if (demandType.sizeFields() > 0) {
- for (MailField mailField : demandType.getFields()) {
- mailField.toString();
- }
- }
- }
+ if (!writable && folder.sizeWriteRightUsers() > 0) {
+ writable = folder.containsWriteRightUsers(user);
}
+ folder.setFolderWritable(writable);
+ fetchFolderAttributes(folder);
+
if (folder.isChildrenNotEmpty()) {
for (MailFolder child : folder.getChildren()) {
- findReadableFolders(child);
+ findReadableFolders(child, user, writable);
}
}
}
+ protected void fetchFolderAttributes(MailFolder folder) {
+ Hibernate.initialize(folder.getFolderTableColumns());
+ Hibernate.initialize(folder.getRanges());
+ Hibernate.initialize(folder.getReplyAddresses());
+ Hibernate.initialize(folder.getReplyDomains());
+
+ if (folder.sizeEtatAttentes() > 0) {
+ for (EtatAttente etatAttente : folder.getEtatAttentes()) {
+ Hibernate.initialize(etatAttente.getInvalidFormDisabledActions());
+ Hibernate.initialize(etatAttente.getValidFormDisabledActions());
+ }
+ }
+
+ Hibernate.initialize(folder.getDemandTypes());
+ }
+
@Override
public List<MailFolder> getRootMailFoldersWithMoveRights(FaxToMailUser user) {
List<MailFolder> rootFolders = getRootMailFolders();
Added: trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_492__add_emailGroup_emails_idx.sql
===================================================================
--- trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_492__add_emailGroup_emails_idx.sql (rev 0)
+++ trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_492__add_emailGroup_emails_idx.sql 2014-08-07 15:54:09 UTC (rev 493)
@@ -0,0 +1,6 @@
+ALTER TABLE email ADD COLUMN emailgroup_idx ${indexType};
+
+UPDATE email SET emailgroup_idx = (
+ SELECT COUNT(topiaid) FROM email sub
+ WHERE sub.email = emailgroup.email AND (sub.topiacreatedate || sub.topiaid) < (emailgroup.topiacreatedate || emailgroup.topiaid)
+);
\ No newline at end of file
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-08-07 15:41:29 UTC (rev 492)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-08-07 15:54:09 UTC (rev 493)
@@ -100,16 +100,9 @@
FaxToMailUser currentUser = getContext().getCurrentUser();
MailFolder folder = currentEmail.getMailFolder();
- boolean canWrite = false;
- while (!canWrite && folder != null) {
- canWrite = folder.containsWriteRightUsers(currentUser)
- || !CollectionUtils.intersection(folder.getWriteRightGroups(),
- currentUser.getUserGroups()).isEmpty();
- folder = folder.getParent();
- }
-
- if (currentEmail.getArchiveDate() != null || !canWrite) {
+ if (currentEmail.getArchiveDate() != null || !Boolean.TRUE.equals(folder.isFolderWritable())) {
currentEmail.setEditable(false);
+
} else if (takenBy != null && !currentUser.equals(takenBy)) {
String htmlMessage = String.format(
AbstractApplicationUIHandler.CONFIRMATION_FORMAT,
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-08-07 15:41:29 UTC (rev 492)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/transmit/MailFolderChooserUIHandler.java 2014-08-07 15:54:09 UTC (rev 493)
@@ -70,7 +70,7 @@
// init tree
Collection<MailFolder> folders = serviceContext.getMailFolderService().
- getRootMailFoldersWithMoveRights(getContext().getCurrentUser());
+ getRootMailFoldersWithMoveRights(getContext().getCurrentUser());
JTree navigationTree = ui.getNavigationTree();
Map<MailFolder, FolderTreeNode> nodesByFolder =
1
0
r492 - trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap
by echatellier@users.forge.codelutin.com 07 Aug '14
by echatellier@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: echatellier
Date: 2014-08-07 17:41:29 +0200 (Thu, 07 Aug 2014)
New Revision: 492
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/492
Log:
Remove random
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java 2014-08-07 13:20:57 UTC (rev 491)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ldap/LdapServiceMock.java 2014-08-07 15:41:29 UTC (rev 492)
@@ -50,7 +50,7 @@
FaxToMailUserTopiaDao userDao = getPersistenceContext().getFaxToMailUserDao();
FaxToMailUserGroupTopiaDao groupDao = getPersistenceContext().getFaxToMailUserGroupDao();
- fakeUser = userDao.forAll().findAnyOrNull();
+ fakeUser = userDao.forAll().setOrderByArguments(FaxToMailUser.PROPERTY_TOPIA_ID).findFirstOrNull();
// create user
if (fakeUser == null) {
1
0
r491 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util
by kmorin@users.forge.codelutin.com 07 Aug '14
by kmorin@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: kmorin
Date: 2014-08-07 15:20:57 +0200 (Thu, 07 Aug 2014)
New Revision: 491
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/491
Log:
integration des fetchs
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
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-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -492,12 +492,28 @@
result = dao.forMailFolderEquals(folder)
.addNull(Email.PROPERTY_ARCHIVE_DATE)
.addNotEquals(Email.PROPERTY_DEMAND_STATUS, DemandStatus.ARCHIVED)
+ .addAllFetches(Email.PROPERTY_DEMAND_TYPE,
+ Email.PROPERTY_DEMAND_STATUS,
+ Email.PROPERTY_RANGE_ROW,
+ Email.PROPERTY_RANGE_ROW + "." + RangeRow.PROPERTY_RANGE,
+ Email.PROPERTY_HISTORY,
+ Email.PROPERTY_HISTORY + "." + History.PROPERTY_FAX_TO_MAIL_USER,
+ Email.PROPERTY_HISTORY + "." + History.PROPERTY_TYPE,
+ Email.PROPERTY_HISTORY + "." + History.PROPERTY_FIELDS,
+ Email.PROPERTY_REPLIES,
+ Email.PROPERTY_ATTACHMENT,
+ Email.PROPERTY_TAKEN_BY,
+ Email.PROPERTY_CLIENT,
+ Email.PROPERTY_EMAIL_GROUP,
+ Email.PROPERTY_EMAIL_GROUP + "." + EmailGroup.PROPERTY_EMAIL,
+ Email.PROPERTY_ETAT_ATTENTE,
+ Email.PROPERTY_PRIORITY)
.findPage(page);
- //FIXME kmorin 20140805 fetch
- for (Email email : result.getElements()) {
- fetchEmailData(email);
- }
+// //FIXME kmorin 20140805 fetch
+// for (Email email : result.getElements()) {
+// fetchEmailData(email);
+// }
} else {
List<Email> elements = Collections.emptyList();
result = PaginationResult.of(elements, 0, page);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -102,9 +102,13 @@
Collection<RangeRow> rangeRows = demand.getRangeRow();
if (rangeRows != null) {
for (RangeRow rangeRow : rangeRows) {
- RangeRowModel rangeRowModel = new RangeRowModel();
- rangeRowModel.fromEntity(rangeRow);
- demand.getValidRangeRowModels().add(rangeRowModel);
+ if (rangeRow != null) {
+ RangeRowModel rangeRowModel = new RangeRowModel();
+ rangeRowModel.fromEntity(rangeRow);
+ if (rangeRowModel.isValid()) {
+ demand.addValidRangeRow(rangeRowModel);
+ }
+ }
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/SaveDemandeAction.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -74,6 +74,15 @@
}
Collection<RangeRowModel> rows = model.getValidRangeRowModels();
+
+ boolean cont = true;
+ while (cont) {
+ try {
+ model.removeRangeRow(null);
+ } catch (IllegalArgumentException eee) {
+ cont = false;
+ }
+ }
Collection<RangeRow> rangeRows = model.getRangeRow();
if (rangeRows == null) {
rangeRows = new ArrayList<>();
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentEditorUIModel.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -45,7 +45,7 @@
//protected File file;
protected boolean editable = true;
- protected final Collection<Attachment> attachments = new ArrayList<Attachment>();
+ protected final List<Attachment> attachments = new ArrayList<Attachment>();
protected List<AttachmentListener> openingListeners = new ArrayList<AttachmentListener>();
@@ -70,11 +70,11 @@
firePropertyChange(PROPERTY_EDITABLE, oldValue, editable);
}
- public Collection<Attachment> getAttachment() {
+ public List<Attachment> getAttachment() {
return attachments;
}
- public void addAllAttachment(Collection<Attachment> attachments) {
+ public void addAllAttachment(List<Attachment> attachments) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
this.attachments.addAll(attachments);
firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, this.attachments);
@@ -92,7 +92,7 @@
firePropertyChange(AttachmentModelAware.PROPERTY_ATTACHMENT, oldValue, attachments);
}
- public void setAttachment(Collection<Attachment> attachments) {
+ public void setAttachment(List<Attachment> attachments) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
this.attachments.clear();
if (attachments != null) {
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -47,7 +47,7 @@
List<Attachment> getAttachment();
- void addAllAttachment(Collection<Attachment> attachments);
+ void addAllAttachment(List<Attachment> attachments);
void addAttachment(Attachment attachment);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/ButtonAttachment.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -27,6 +27,7 @@
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.ui.swing.FaxToMailUIContext;
import com.franciaflex.faxtomail.ui.swing.util.AbstractToolbarPopupButton;
+import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections4.CollectionUtils;
import java.beans.PropertyChangeEvent;
@@ -56,7 +57,7 @@
if (attachmentModelAware != null) {
List<Attachment> oldValue = (List<Attachment>) evt.getOldValue();
- Collection<Attachment> toAdd = CollectionUtils.subtract(attachments, oldValue);
+ List<Attachment> toAdd = ListUtils.subtract(attachments, oldValue);
attachmentModelAware.addAllAttachment(toAdd);
Collection<Attachment> toRemove = CollectionUtils.subtract(oldValue, attachments);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -197,19 +197,19 @@
// init range model
final RangeTableModel rangeTableModel = new RangeTableModel(columnModel);
- List<RangeRowModel> rangeRowModels = new ArrayList<RangeRowModel>();
+ List<RangeRowModel> rangeRowModels = model.getValidRangeRowModels();
- Collection<RangeRow> rangeRows = model.getRangeRow();
- if (rangeRows != null) {
- for (RangeRow rangeRow : rangeRows) {
- RangeRowModel rangeRowModel = new RangeRowModel();
- rangeRowModel.fromEntity(rangeRow);
- rangeRowModels.add(rangeRowModel);
- // on ajoute toutes les lignes de rangeRow,
- // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides
- model.getValidRangeRowModels().add(rangeRowModel);
- }
- }
+// Collection<RangeRow> rangeRows = model.getRangeRow();
+// if (rangeRows != null) {
+// for (RangeRow rangeRow : rangeRows) {
+// RangeRowModel rangeRowModel = new RangeRowModel();
+// rangeRowModel.fromEntity(rangeRow);
+// rangeRowModels.add(rangeRowModel);
+// // on ajoute toutes les lignes de rangeRow,
+// // qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides
+// model.getValidRangeRowModels().add(rangeRowModel);
+// }
+// }
rangeTableModel.setRows(rangeRowModels);
Map<String, Integer> quantities = FaxToMailUIUtil.computeQuantities(rangeRowModels);
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-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -163,19 +163,21 @@
int savNb = 0;
if (rangeRows != null) {
for (RangeRow rangeRow : rangeRows) {
- Integer quotationQuantity = rangeRow.getQuotationQuantity();
- if (quotationQuantity != null) {
- quotationNb += quotationQuantity;
- }
+ if (rangeRow != null) {
+ Integer quotationQuantity = rangeRow.getQuotationQuantity();
+ if (quotationQuantity != null) {
+ quotationNb += quotationQuantity;
+ }
- Integer productQuantity = rangeRow.getProductQuantity();
- if (productQuantity != null) {
- pfNb += productQuantity;
- }
+ Integer productQuantity = rangeRow.getProductQuantity();
+ if (productQuantity != null) {
+ pfNb += productQuantity;
+ }
- Integer savQuantity = rangeRow.getSavQuantity();
- if (savQuantity != null) {
- savNb += savQuantity;
+ Integer savQuantity = rangeRow.getSavQuantity();
+ if (savQuantity != null) {
+ savNb += savQuantity;
+ }
}
}
}
@@ -458,7 +460,7 @@
Collection<String> commandNumbers = Collections2.transform(rangeRow, new Function<RangeRow, String>() {
@Override
public String apply(RangeRow input) {
- return input.getCommandNumber();
+ return input != null ? input.getCommandNumber() : "";
}
});
Collections2.filter(commandNumbers, new Predicate<String>() {
@@ -598,7 +600,7 @@
}
@Override
- public void addAllAttachment(Collection<Attachment> attachment) {
+ public void addAllAttachment(List<Attachment> attachment) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.addAll(attachment);
firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
@@ -835,7 +837,9 @@
public void addValidRangeRow(RangeRowModel row) {
Object oldValue = new ArrayList<RangeRowModel>(validRangeRowModels);
- validRangeRowModels.add(row);
+ if (!validRangeRowModels.contains(row)) {
+ validRangeRowModels.add(row);
+ }
firePropertyChanged(PROPERTY_VALID_RANGE_ROW_MODELS, oldValue, validRangeRowModels);
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-08-07 10:49:15 UTC (rev 490)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-08-07 13:20:57 UTC (rev 491)
@@ -201,7 +201,7 @@
tableCellRenderer = new QuantityTableCellRenderer(new Function<RangeRow, Integer>() {
@Override
public Integer apply(RangeRow input) {
- return input.getProductQuantity();
+ return input != null ? input.getProductQuantity() : null;
}
});
break;
@@ -209,7 +209,7 @@
tableCellRenderer = new QuantityTableCellRenderer(new Function<RangeRow, Integer>() {
@Override
public Integer apply(RangeRow input) {
- return input.getSavQuantity();
+ return input != null ? input.getSavQuantity() : null;
}
});
break;
1
0
r490 - trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service
by athimel@users.forge.codelutin.com 07 Aug '14
by athimel@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: athimel
Date: 2014-08-07 12:49:15 +0200 (Thu, 07 Aug 2014)
New Revision: 490
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/490
Log:
Add test on getEmailForFolder method
Modified:
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java
Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java 2014-08-07 08:31:16 UTC (rev 489)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/EmailServiceTest.java 2014-08-07 10:49:15 UTC (rev 490)
@@ -26,10 +26,16 @@
import java.io.IOException;
import java.util.Collections;
+import java.util.Set;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.MailFolderTopiaDao;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.nuiton.topia.persistence.TopiaEntities;
import org.nuiton.util.pagination.PaginationParameter;
import org.nuiton.util.pagination.PaginationResult;
@@ -126,4 +132,27 @@
AttachmentFile attachmentFile = service.getEmailDetailAsAttachment(testEmail);
Assert.assertNotNull(attachmentFile);
}
+
+ @Test
+ public void testGetEmailForFolder() {
+
+ // tests fetch + pagination
+
+ PaginationParameter page = PaginationParameter.of(0, 7, Email.PROPERTY_RECEPTION_DATE, false);
+ MailFolderTopiaDao mailFolderDao = getServiceContext().getPersistenceContext().getMailFolderDao();
+ MailFolder cyril = mailFolderDao.forNameEquals("Cyril").findUnique();
+
+ PaginationResult<Email> page1 = service.getEmailForFolder(cyril, getCurrentUser(), page);
+ Assert.assertEquals(10, page1.getCount());
+ Assert.assertEquals(7, page1.getElements().size());
+
+ PaginationResult<Email> page2 = service.getEmailForFolder(cyril, getCurrentUser(), page1.getNextPage());
+ Assert.assertEquals(10, page2.getCount());
+ Assert.assertEquals(3, page2.getElements().size());
+
+ Set<String> page1Ids = Sets.newHashSet(Iterables.transform(page1.getElements(), TopiaEntities.getTopiaIdFunction()));
+ Set<String> page2Ids = Sets.newHashSet(Iterables.transform(page2.getElements(), TopiaEntities.getTopiaIdFunction()));
+ Assert.assertTrue(Sets.intersection(page1Ids, page2Ids).isEmpty());
+
+ }
}
1
0
r489 - in trunk/faxtomail-service/src/main: java/com/franciaflex/faxtomail/services java/com/franciaflex/faxtomail/services/validators resources
by echatellier@users.forge.codelutin.com 07 Aug '14
by echatellier@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: echatellier
Date: 2014-08-07 10:31:16 +0200 (Thu, 07 Aug 2014)
New Revision: 489
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/489
Log:
fixes #5524: Surcharge du validateur email pour supporter le domaine ".fax"
Added:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java
Modified:
trunk/faxtomail-service/src/main/resources/validators.xml
Added: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java (rev 0)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java 2014-08-07 08:31:16 UTC (rev 489)
@@ -0,0 +1,42 @@
+package com.franciaflex.faxtomail.services.validators;
+
+/*
+ * #%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.opensymphony.xwork2.validator.validators.EmailValidator;
+
+/**
+ * Surcharge du validateur d'email par default de struts pour autoriser en plus le domaine ".fax".
+ */
+public class FaxToMailEmailValidator extends EmailValidator {
+
+ // see XW-371
+ public static final String EMAIL_ADDRESS_PATTERN =
+ "\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx|fax)$\\b";
+
+ public FaxToMailEmailValidator() {
+ setRegex(EMAIL_ADDRESS_PATTERN);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/validators/FaxToMailEmailValidator.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/faxtomail-service/src/main/resources/validators.xml
===================================================================
--- trunk/faxtomail-service/src/main/resources/validators.xml 2014-08-07 08:16:40 UTC (rev 488)
+++ trunk/faxtomail-service/src/main/resources/validators.xml 2014-08-07 08:31:16 UTC (rev 489)
@@ -23,7 +23,6 @@
#L%
-->
-
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator Config 1.0//EN"
"http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
@@ -40,7 +39,6 @@
<validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
<validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
<validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
- <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
<!-- les validateurs fournis par nuiton-validator -->
<validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/>
@@ -48,4 +46,6 @@
<validator name="skipablefieldexpression" class="org.nuiton.validator.xwork2.field.NuitonFieldExpressionValidator"/>
<validator name="existingFile" class="org.nuiton.validator.xwork2.field.ExistingFileFieldValidator"/>
+ <!-- les validateur specifiques -->
+ <validator name="email" class="com.franciaflex.faxtomail.services.validators.FaxToMailEmailValidator"/>
</validators>
1
0
r488 - in trunk/faxtomail-service/src: main/java/com/franciaflex/faxtomail/services main/java/com/franciaflex/faxtomail/services/service test/java/com/franciaflex/faxtomail/services/service
by echatellier@users.forge.codelutin.com 07 Aug '14
by echatellier@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: echatellier
Date: 2014-08-07 10:16:40 +0200 (Thu, 07 Aug 2014)
New Revision: 488
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/488
Log:
Add licence header
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java
trunk/faxtomail-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-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
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-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/DecoratorService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -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 org.nuiton.decorator.Decorator;
/**
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceFactory.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -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%
+ */
+
/**
* @author Arnaud Thimel (Code Lutin)
*/
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/FaxToMailServiceInvocationHandler.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -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 org.apache.commons.io.IOUtils;
import java.lang.reflect.InvocationHandler;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ClientService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.services.FaxToMailService;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.Configuration;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.Attachment;
import com.franciaflex.faxtomail.persistence.entities.AttachmentFile;
import com.franciaflex.faxtomail.persistence.entities.Email;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/InitFaxToMailService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.services.FaxToMailService;
/**
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.services.FaxToMailService;
import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
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-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.Client;
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.EmailAccount;
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.services.FaxToMailService;
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ValidationService.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import com.franciaflex.faxtomail.persistence.entities.Email;
import com.franciaflex.faxtomail.services.FaxToMailService;
import org.nuiton.validator.NuitonValidatorResult;
Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java 2014-08-07 08:10:55 UTC (rev 487)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestData.java 2014-08-07 08:16:40 UTC (rev 488)
@@ -1,5 +1,29 @@
package com.franciaflex.faxtomail.services.service;
+/*
+ * #%L
+ * FaxToMail :: Service
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2014 Franciaflex, Code Lutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
import java.io.IOException;
import com.franciaflex.faxtomail.services.FaxToMailService;
1
0
r487 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util faxtomail-ui-web
by echatellier@users.forge.codelutin.com 07 Aug '14
by echatellier@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: echatellier
Date: 2014-08-07 10:10:55 +0200 (Thu, 07 Aug 2014)
New Revision: 487
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/487
Log:
Fix lazy collections in search ui
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
trunk/faxtomail-ui-web/pom.xml
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-08-07 07:54:58 UTC (rev 486)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-07 08:10:55 UTC (rev 487)
@@ -64,6 +64,7 @@
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
+import org.hibernate.Hibernate;
import org.nuiton.topia.persistence.TopiaEntities;
import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;
import org.nuiton.util.beans.Binder;
@@ -525,7 +526,7 @@
@Override
public Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
- Email email = getEmailByTopiaId(emailDao, emailId);
+ Email email = getEmailById(emailId);
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
History history = historyDao.create(History.PROPERTY_TYPE, type,
@@ -551,7 +552,7 @@
@Override
public Email takeEmail(String emailId, FaxToMailUser user) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
- Email email = getEmailByTopiaId(emailDao, emailId);
+ Email email = getEmailById(emailId);
email.setTakenBy(user);
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
@@ -580,7 +581,7 @@
// get current lock on mail if any
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao();
- Email email = getEmailByTopiaId(emailDao, emailId);
+ Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
MailLock mailLock = mailLockDao.forLockOnEquals(email).findUniqueOrNull();
// if no lock found, create new one
@@ -670,6 +671,11 @@
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
PaginationResult<Email> result = emailDao.search(emailFilter, readMailFolders, pagination);
+ // Fetch lazy field for list display
+ for (Email email : result.getElements()) {
+ fetchEmailData(email);
+ }
+
return result;
}
@@ -1029,7 +1035,7 @@
}
}
- protected void setField( PDDocument pdfDocument, String name, String value ) throws IOException {
+ protected void setField(PDDocument pdfDocument, String name, String value ) throws IOException {
PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField field = acroForm.getField( name );
@@ -1038,47 +1044,36 @@
} else if (log.isWarnEnabled()) {
log.warn("Can't find field " + name + " in pdf form");
}
- }
-
- protected Email getEmailByTopiaId(EmailTopiaDao emailDao, String emailId) {
- Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
- fetchEmailData(email);
- return email;
}
protected void fetchEmailData(Email email) {
if (email.getDemandType() != null) {
- for (MailField mailField : email.getDemandType().getFields()) {
- mailField.toString();
- }
+ Hibernate.initialize(email.getDemandType().getFields());
}
if (email.sizeRangeRow() > 0) {
for (RangeRow rangeRow : email.getRangeRow()) {
- if (rangeRow.getRange() != null) {
- rangeRow.getRange().getLabel();
- }
+ Hibernate.initialize(rangeRow.getRange());
}
}
if (email.sizeHistory() > 0) {
for (History history : email.getHistory()) {
history.getType();
- if (history.getFaxToMailUser() != null) {
- history.getFaxToMailUser().getTrigraph();
- }
+ Hibernate.initialize(history.getType());
+ Hibernate.initialize(history.getFaxToMailUser());
history.sizeFields();
}
}
email.sizeReplies();
email.sizeAttachment();
- email.getTakenBy();
- email.getClient();
- email.getDemandStatus();
+ Hibernate.initialize(email.getTakenBy());
+ Hibernate.initialize(email.getClient());
+ Hibernate.initialize(email.getDemandStatus());
if (email.getEmailGroup() != null) {
email.getEmailGroup().sizeEmail();
}
- email.getEtatAttente();
- email.getPriority();
+ Hibernate.initialize(email.getEtatAttente());
+ Hibernate.initialize(email.getPriority());
}
}
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-07 07:54:58 UTC (rev 486)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailUIHandler.java 2014-08-07 08:10:55 UTC (rev 487)
@@ -111,7 +111,6 @@
@Override
public Component getTopestUI() {
- Component result;
ApplicationActionUI actionUI = getContext().getActionUI();
return actionUI;
}
@@ -245,7 +244,7 @@
final AbstractApplicationUIHandler handler = dialogContent.getHandler();
- if (handler instanceof org.nuiton.jaxx.application.swing.util.Cancelable) {
+ if (handler instanceof Cancelable) {
// add a auto-close action
JRootPane rootPane = result.getRootPane();
@@ -263,7 +262,6 @@
}
});
}
-
SwingUtil.center(getContext().getMainUI(), result);
result.setVisible(true);
}
@@ -308,7 +306,6 @@
});
}
- result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
result.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
Modified: trunk/faxtomail-ui-web/pom.xml
===================================================================
--- trunk/faxtomail-ui-web/pom.xml 2014-08-07 07:54:58 UTC (rev 486)
+++ trunk/faxtomail-ui-web/pom.xml 2014-08-07 08:10:55 UTC (rev 487)
@@ -88,11 +88,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.jaxx</groupId>
- <artifactId>jaxx-application-api</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
1
0
r486 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing
by echatellier@users.forge.codelutin.com 07 Aug '14
by echatellier@users.forge.codelutin.com 07 Aug '14
07 Aug '14
Author: echatellier
Date: 2014-08-07 09:54:58 +0200 (Thu, 07 Aug 2014)
New Revision: 486
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/486
Log:
Fix message display
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-08-06 16:21:34 UTC (rev 485)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/FaxToMailUIContext.java 2014-08-07 07:54:58 UTC (rev 486)
@@ -39,6 +39,7 @@
import javax.swing.JOptionPane;
import com.franciaflex.faxtomail.services.service.InitFaxToMailServiceImpl;
+
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.swing.session.BeanDoubleListState;
@@ -58,6 +59,7 @@
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.jaxx.application.ApplicationBusinessException;
import org.nuiton.jaxx.application.ApplicationConfiguration;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.jaxx.application.swing.ApplicationUIContext;
@@ -391,7 +393,7 @@
// show login dialog
Status loginStatus = JXLoginPane.showLoginDialog(null, pane);
if (loginStatus == Status.CANCELLED) {
- throw new ApplicationTechnicalException("Authentication canceled");
+ throw new ApplicationBusinessException("Authentication canceled");
}
}
1
0
06 Aug '14
Author: kmorin
Date: 2014-08-06 18:21:34 +0200 (Wed, 06 Aug 2014)
New Revision: 485
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/485
Log:
integration des fetchs
Modified:
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.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/EmailServiceImpl.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.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/demande/history/HistoryListUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationServiceImpl.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -99,10 +99,14 @@
@Override
public Configuration getConfiguration() {
ConfigurationTopiaDao dao = getPersistenceContext().getConfigurationDao();
- Configuration config = dao.forAll().findUniqueOrNull();
+ Configuration config = dao.forAll().addAllFetches(
+ Configuration.PROPERTY_SEARCH_DISPLAY_COLUMNS,
+ Configuration.PROPERTY_INVALID_FORM_DISABLED_ACTIONS
+ ).findUniqueOrNull();
if (config == null) {
config = new ConfigurationImpl();
}
+ config.sizeInvalidFormDisabledActions();
return config;
}
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-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -36,8 +36,7 @@
void transmitPendingDemandsToEdi();
-// PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page);
- List<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page);
+ PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page);
List<MailFolder> getChildrenRecursively(MailFolder folder);
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-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -65,6 +65,7 @@
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.nuiton.topia.persistence.TopiaEntities;
+import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import org.nuiton.util.pagination.PaginationParameter;
@@ -95,6 +96,7 @@
@Override
public Email getEmailById(String id) {
Email email = getPersistenceContext().getEmailDao().forTopiaIdEquals(id).findUnique();
+ fetchEmailData(email);
return email;
}
@@ -131,8 +133,12 @@
email.setClient(client);
if (attachments != null) {
- Collection<Attachment> currentAttachments = CollectionUtils.emptyIfNull(email.getAttachment());
- Map<String, Attachment> currentAttachmentIndex = new HashMap<>(Maps.uniqueIndex(currentAttachments, TopiaEntities.getTopiaIdFunction()));
+ AttachmentTopiaDao attachmentTopiaDao = getPersistenceContext().getAttachmentDao();
+ List<Attachment> currentAttachments = attachmentTopiaDao.forTopiaIdIn(email.getAttachmentTopiaIds()).findAll();
+ if (currentAttachments == null) {
+ currentAttachments = new ArrayList<>();
+ }
+ Map<String, Attachment> currentAttachmentIndex = new HashMap<>(Maps.uniqueIndex(currentAttachments, TopiaEntities.getTopiaIdFunction()));
AttachmentFileTopiaDao attachementFileTopiaDao = getPersistenceContext().getAttachmentFileDao();
for (Attachment attachment : attachments) {
@@ -147,7 +153,7 @@
// get session attachment from id
Attachment currentAttachment;
- if (StringUtils.isNoneBlank(attachment.getTopiaId())) {
+ if (StringUtils.isNotBlank(attachment.getTopiaId())) {
currentAttachment = currentAttachmentIndex.remove(attachment.getTopiaId());
} else {
currentAttachment = new AttachmentImpl();
@@ -196,14 +202,16 @@
if (!currentAttachment.isPersisted()) {
// persist using cascade
- email.addAttachment(currentAttachment);
+ currentAttachments.add(currentAttachment);
}
}
// delete not found attachments
for (Attachment attachment : currentAttachmentIndex.values()) {
- email.removeAttachment(attachment);
+ currentAttachments.remove(attachment);
}
+
+ email.setAttachment(currentAttachments);
}
if (email.getRangeRow() != null) {
@@ -461,11 +469,11 @@
* @return paginated results
*/
@Override
-// public PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page) {
- public List<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page) {
+ public PaginationResult<Email> getEmailForFolder(MailFolder folder, FaxToMailUser currentUser, PaginationParameter page) {
+ MailFolderTopiaDao mailFolderTopiaDao = getPersistenceContext().getMailFolderDao();
// check if user can read current folder
- MailFolder loopFolder = folder;
+ MailFolder loopFolder = mailFolderTopiaDao.forTopiaIdEquals(folder.getTopiaId()).findUnique();
boolean readable = false;
while (!readable && loopFolder != null) {
// user
@@ -477,68 +485,21 @@
}
// perform request or not depending on rigths
- List<Email> result;
+ PaginationResult<Email> result;
if (readable) {
EmailTopiaDao dao = getPersistenceContext().getEmailDao();
result = dao.forMailFolderEquals(folder)
.addNull(Email.PROPERTY_ARCHIVE_DATE)
.addNotEquals(Email.PROPERTY_DEMAND_STATUS, DemandStatus.ARCHIVED)
- .addAllFetches(
- Email.PROPERTY_ETAT_ATTENTE,
- Email.PROPERTY_CLIENT,
- Email.PROPERTY_PRIORITY,
- Email.PROPERTY_TAKEN_BY,
-// Email.PROPERTY_DEMAND_STATUS,
-// Email.PROPERTY_DEMAND_TYPE,
- Email.PROPERTY_DEMAND_TYPE + "." + DemandType.PROPERTY_FIELDS,
- Email.PROPERTY_RANGE_ROW,
- Email.PROPERTY_HISTORY,
- Email.PROPERTY_REPLIES,
- Email.PROPERTY_EMAIL_GROUP
- )
-// .findPage(page);
- .findAll();
+ .findPage(page);
+
//FIXME kmorin 20140805 fetch
- for (Email email : result) {
- if (email.getDemandType() != null) {
- email.getDemandType().getFields();
- email.getDemandType().sizeFields();
- }
-// if (email.getRangeRow() != null) {
-// for (RangeRow rangeRow : email.getRangeRow()) {
-// rangeRow.getRange();
-// }
-// }
-// if (email.getAttachment() != null) {
-// for (Attachment attachment : email.getAttachment()) {
-// attachment.getEditedFile();
-// attachment.getOriginalFile();
-// }
-// }
-// if (email.getHistory() != null) {
-// for (History history : email.getHistory()) {
-// history.getType();
-// history.getFaxToMailUser();
-// }
-// }
-// email.getReplies();
-// email.sizeReplies();
-// email.getRepliesTopiaIds();
-// email.getTakenBy();
-// email.getClient();
-// email.getDemandStatus();
-// if (email.getEmailGroup() != null) {
-// email.getEmailGroup().getEmail();
-// email.getEmailGroup().sizeEmail();
-// email.getEmailGroup().getEmailTopiaIds();
-// }
-// email.getEtatAttente();
-// email.getPriority();
+ for (Email email : result.getElements()) {
+ fetchEmailData(email);
}
} else {
List<Email> elements = Collections.emptyList();
-// result = PaginationResult.of(elements, 0, page);
- result = new ArrayList<>();
+ result = PaginationResult.of(elements, 0, page);
}
return result;
}
@@ -564,7 +525,7 @@
@Override
public Email addToHistory(String emailId, HistoryType type, FaxToMailUser user, Date date, String... fields) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
- Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
+ Email email = getEmailByTopiaId(emailDao, emailId);
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
History history = historyDao.create(History.PROPERTY_TYPE, type,
@@ -590,7 +551,7 @@
@Override
public Email takeEmail(String emailId, FaxToMailUser user) {
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
- Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
+ Email email = getEmailByTopiaId(emailDao, emailId);
email.setTakenBy(user);
HistoryTopiaDao historyDao = getPersistenceContext().getHistoryDao();
@@ -619,7 +580,7 @@
// get current lock on mail if any
EmailTopiaDao emailDao = getPersistenceContext().getEmailDao();
MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao();
- Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
+ Email email = getEmailByTopiaId(emailDao, emailId);
MailLock mailLock = mailLockDao.forLockOnEquals(email).findUniqueOrNull();
// if no lock found, create new one
@@ -884,7 +845,11 @@
public AttachmentFile getAttachmentFile(String attachmentId, boolean original) {
AttachmentTopiaDao dao = getPersistenceContext().getAttachmentDao();
Attachment attachment = dao.forTopiaIdEquals(attachmentId).findUnique();
- return original ? attachment.getOriginalFile() : attachment.getEditedFile();
+ AttachmentFile result = original ? attachment.getOriginalFile() : attachment.getEditedFile();
+ if (result != null) {
+ result.getFilename();
+ }
+ return result;
}
@@ -1074,4 +1039,46 @@
log.warn("Can't find field " + name + " in pdf form");
}
}
+
+ protected Email getEmailByTopiaId(EmailTopiaDao emailDao, String emailId) {
+ Email email = emailDao.forTopiaIdEquals(emailId).findUnique();
+ fetchEmailData(email);
+ return email;
+ }
+
+ protected void fetchEmailData(Email email) {
+ if (email.getDemandType() != null) {
+ for (MailField mailField : email.getDemandType().getFields()) {
+ mailField.toString();
+ }
+ }
+ if (email.sizeRangeRow() > 0) {
+ for (RangeRow rangeRow : email.getRangeRow()) {
+ if (rangeRow.getRange() != null) {
+ rangeRow.getRange().getLabel();
+ }
+ }
+ }
+ if (email.sizeHistory() > 0) {
+ for (History history : email.getHistory()) {
+ history.getType();
+ if (history.getFaxToMailUser() != null) {
+ history.getFaxToMailUser().getTrigraph();
+ }
+ history.sizeFields();
+ }
+ }
+ email.sizeReplies();
+ email.sizeAttachment();
+
+ email.getTakenBy();
+ email.getClient();
+ email.getDemandStatus();
+
+ if (email.getEmailGroup() != null) {
+ email.getEmailGroup().sizeEmail();
+ }
+ email.getEtatAttente();
+ email.getPriority();
+ }
}
Modified: trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java
===================================================================
--- trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/MailFolderServiceImpl.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -34,6 +34,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandType;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -103,16 +104,8 @@
@Override
public List<MailFolder> getRootMailFoldersWithReadingRights(FaxToMailUser user) {
-// List<MailFolder> rootFolders = getRootMailFolders();
-// List<MailFolder> result = new ArrayList<>();
-//
-// for (MailFolder folder : rootFolders) {
-// findReadableFolders(folder, user, result);
-// }
-
MailFolderTopiaDao dao = getPersistenceContext().getMailFolderDao();
List<MailFolder> result = new ArrayList<>(dao.getReadableFolders(user));
- //FIXME kmorin 20140805 fetch
for (MailFolder f : result) {
findReadableFolders(f);
}
@@ -120,20 +113,28 @@
}
protected void findReadableFolders(MailFolder folder) {
- //FIXME kmorin 20140805 fetch
- folder.getFolderTableColumns();
folder.sizeFolderTableColumns();
- folder.getReadRightGroups();
- folder.getReadRightGroupsTopiaIds();
- folder.getReadRightUsers();
- folder.getReadRightUsersTopiaIds();
- folder.getEtatAttentes();
- folder.sizeEtatAttentes();
- folder.getEtatAttentesTopiaIds();
- if (folder.getDemandTypes() != null) {
+ //TODO kmorin 20140806 put rights for user in impl
+ folder.sizeWriteRightGroups();
+ folder.sizeWriteRightUsers();
+ folder.sizeRanges();
+ folder.sizeReplyAddresses();
+ folder.sizeReplyDomains();
+
+ if (folder.sizeEtatAttentes() > 0) {
+ for (EtatAttente etatAttente : folder.getEtatAttentes()) {
+ etatAttente.sizeInvalidFormDisabledActions();
+ etatAttente.sizeValidFormDisabledActions();
+ }
+ }
+
+ if (folder.sizeDemandTypes() > 0) {
for (DemandType demandType : folder.getDemandTypes()) {
- demandType.getFields();
- demandType.sizeFields();
+ if (demandType.sizeFields() > 0) {
+ for (MailField mailField : demandType.getFields()) {
+ mailField.toString();
+ }
+ }
}
}
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-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielServiceImpl.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -71,7 +71,7 @@
@Override
public List<DemandType> getAllDemandType() {
DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao();
- return dao.findAll();
+ return dao.forAll().addAllFetches(DemandType.PROPERTY_FIELDS).findAll();
}
@Override
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-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/InitTestDataImpl.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -82,6 +82,7 @@
*
* @throws IOException
*/
+ @Override
public void initTestData() throws IOException {
if (log.isDebugEnabled()) {
log.debug("Init test data");
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/LoadFolderEmailsAction.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -85,11 +85,9 @@
MailFolder folder = model.getSelectedFolder();
FaxToMailUser currentUser = getContext().getCurrentUser();
-// PaginationResult<Email> paginationResult = getContext().newServiceContext().getEmailService()
-// .getEmailForFolder(folder, currentUser, model.getPaginationParameter());
-// List<Email> emails = paginationResult.getElements();
- List<Email> emails = getContext().newServiceContext().getEmailService()
- .getEmailForFolder(folder, currentUser, model.getPaginationParameter());
+ PaginationResult<Email> paginationResult = getContext().newServiceContext().getEmailService()
+ .getEmailForFolder(folder, currentUser, model.getPaginationParameter());
+ List<Email> emails = paginationResult.getElements();
if (log.isDebugEnabled()) {
log.debug(emails.size() + " emails in folder " + folder.getName());
}
@@ -97,7 +95,7 @@
List<DemandeUIModel> demands = new ArrayList<DemandeUIModel>();
for (Email email : emails) {
DemandeUIModel demand = new DemandeUIModel();
- demand.fromEntity(email, false);
+ demand.fromEntity(email);
// on ajoute toutes les lignes de rangeRow,
// qui sont toutes valides puisqu'on les récupère de la base et qu'on ne sauvegarde que les lignes valides
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ShowDemandeAction.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -64,6 +64,7 @@
try {
FaxToMailServiceContext serviceContext = getContext().newServiceContext();
serviceContext.getEmailService().lockEmail(currentEmail.getTopiaId(), currentUser);
+
} catch (AlreadyLockedMailException ex) {
result = false;
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/attachment/AttachmentModelAware.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -28,6 +28,7 @@
import java.io.Serializable;
import java.util.Collection;
+import java.util.List;
/**
* To place on model wich supports attachments.
@@ -44,7 +45,7 @@
// Integer getObjectId();
- Collection<Attachment> getAttachment();
+ List<Attachment> getAttachment();
void addAllAttachment(Collection<Attachment> attachments);
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-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIModel.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -97,11 +97,11 @@
protected final Email editObject = new EmailImpl();
- protected final Collection<Attachment> attachments = new ArrayList<Attachment>();
+ protected final List<Attachment> attachments = new ArrayList<Attachment>();
- protected final Collection<DemandeUIModel> groupedDemandes = new ArrayList<DemandeUIModel>();
+ protected final List<DemandeUIModel> groupedDemandes = new ArrayList<DemandeUIModel>();
- protected final Collection<RangeRowModel> validRangeRowModels = new ArrayList<RangeRowModel>();
+ protected final List<RangeRowModel> validRangeRowModels = new ArrayList<RangeRowModel>();
protected History firstOpeningHistory;
@@ -187,20 +187,16 @@
}
- @Override
- public void fromEntity(Email entity) {
- fromEntity(entity, true);
- }
-
/**
* Surcharge pour dupliquer correctement les pieces jointes sans charger le contenu binaire en mémoire.
*/
- public void fromEntity(Email entity, boolean full) {
- //super.fromEntity(entity);
- fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT);
+ @Override
+ public void fromEntity(Email entity) {
+// super.fromEntity(entity);
+ fromBeanBinder.copyExcluding(entity, this, Email.PROPERTY_ATTACHMENT, Email.PROPERTY_MAIL_FOLDER);
// On ne copie pas entierrement les attachments pour ne pas force le chargement du contenu binaire du fichier en mémoire.
- Collection<Attachment> attachmentCopy = new ArrayList<Attachment>();
+ List<Attachment> attachmentCopy = new ArrayList<Attachment>();
if (entity.getAttachment() != null) {
for (Attachment attachment : entity.getAttachment()) {
Attachment clone = new AttachmentImpl();
@@ -481,7 +477,7 @@
firePropertyChanged(Email.PROPERTY_HISTORY, null, history);
}
- public Collection<History> getHistory() {
+ public List<History> getHistory() {
return editObject.getHistory();
}
@@ -597,7 +593,7 @@
}
@Override
- public Collection<Attachment> getAttachment() {
+ public List<Attachment> getAttachment() {
return new ArrayList<Attachment>(attachments);
}
@@ -622,7 +618,7 @@
firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
- public void setAttachment(Collection<Attachment> attachment) {
+ public void setAttachment(List<Attachment> attachment) {
Object oldValue = new ArrayList<Attachment>(getAttachment());
attachments.clear();
if (attachment != null) {
@@ -631,7 +627,7 @@
firePropertyChange(Email.PROPERTY_ATTACHMENT, oldValue, getAttachment());
}
- public Collection<RangeRow> getRangeRow() {
+ public List<RangeRow> getRangeRow() {
return editObject.getRangeRow();
}
@@ -779,7 +775,7 @@
}
- public Collection<DemandeUIModel> getGroupedDemandes() {
+ public List<DemandeUIModel> getGroupedDemandes() {
return groupedDemandes;
}
@@ -817,7 +813,7 @@
firePropertyChange(Email.PROPERTY_REPLIES, null, getReplies());
}
- public Collection<Reply> getReplies() {
+ public List<Reply> getReplies() {
return editObject.getReplies();
}
@@ -826,11 +822,11 @@
}
- public Collection<RangeRowModel> getValidRangeRowModels() {
+ public List<RangeRowModel> getValidRangeRowModels() {
return validRangeRowModels;
}
- public void setValidRangeRowModels(Collection<RangeRowModel> validRangeRowModels) {
+ public void setValidRangeRowModels(List<RangeRowModel> validRangeRowModels) {
Object oldValue = new ArrayList<RangeRowModel>(validRangeRowModels);
this.validRangeRowModels.clear();
this.validRangeRowModels.addAll(validRangeRowModels);
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/history/HistoryListUIHandler.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -98,7 +98,12 @@
JXList list = ui.getHistories();
list.setCellRenderer(new HistoryListCellRenderer());
JaxxDefaultListModel listModel = new JaxxDefaultListModel<History>();
- final List<History> histories = new ArrayList<History>(getModel().getHistory());
+ final List<History> histories;
+ if (getModel().getHistory() != null) {
+ histories = new ArrayList<History>(getModel().getHistory());
+ } else {
+ histories = new ArrayList<History>();
+ }
//sort histories by modification date
Collections.sort(histories, Ordering.natural().onResultOf(new Function<History, Comparable>() {
@Override
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-08-06 16:17:40 UTC (rev 484)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/AbstractFaxToMailDemandListHandler.java 2014-08-06 16:21:34 UTC (rev 485)
@@ -267,8 +267,8 @@
DemandeUIModel selectedEmail = tableModel.getEntry(rowIndex);
onDoubleClickOnDemande(selectedEmail);
FaxToMailUIContext context = getContext();
-
- // reset transaction
+
+ //TODO kmorin 02140806 put in action
FaxToMailServiceContext serviceContext = context.newServiceContext();
Email email = serviceContext.getEmailService().addToHistory(selectedEmail.getTopiaId(),
HistoryType.OPENING,
1
0