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
July 2014
- 3 participants
- 155 discussions
r456 - trunk/faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 31 Jul '14
by echatellier@users.forge.codelutin.com 31 Jul '14
31 Jul '14
Author: echatellier
Date: 2014-07-31 18:44:24 +0200 (Thu, 31 Jul 2014)
New Revision: 456
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/456
Log:
Fix undefined for rootFolders
Modified:
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-31 16:38:29 UTC (rev 455)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-31 16:44:24 UTC (rev 456)
@@ -104,6 +104,7 @@
$scope.flatMailFolders[mailFolder.topiaId] = [];
var cumulativeCount = recursiveAddMailFolder($scope.flatMailFolders[mailFolder.topiaId], mailFolder.children, mailFolder, mailFolder.name, mailFolder);
mailFolder.$cumulativeCount = cumulativeCount;
+ mailFolder.$fullPath = mailFolder.name;
});
};
$scope._updateFlatMailFolders();
1
0
r455 - 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/content/search faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin
by echatellier@users.forge.codelutin.com 31 Jul '14
by echatellier@users.forge.codelutin.com 31 Jul '14
31 Jul '14
Author: echatellier
Date: 2014-07-31 18:38:29 +0200 (Thu, 31 Jul 2014)
New Revision: 455
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/455
Log:
Update user and group from ldap and remove non real user and real groups
Added:
trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_454__add_ldap_config.sql
Modified:
trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.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/ReferentielService.java
trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java
Modified: trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java
===================================================================
--- trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java 2014-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-persistence/src/main/java/com/franciaflex/faxtomail/persistence/entities/AbstractFaxToMailTopiaDao.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -24,6 +24,8 @@
* #L%
*/
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -33,6 +35,20 @@
public abstract class AbstractFaxToMailTopiaDao<E extends TopiaEntity> extends AbstractTopiaDao<E> {
+ /**
+ * Find all entity for current table not contained in provided collection.
+ *
+ * @param others others elements
+ * @return remaining elements
+ */
+ public List<E> forNotIn(Collection<E> others) {
+ String query = "FROM " + getEntityClass().getName() + " E" +
+ " WHERE E not in (:others)";
+ Map<String, Object> args = new HashMap<>();
+ args.put("others", others);
+ return findAll(query, args);
+ }
+
public <K> List<K> find(String hql, Map<String, Object> hqlParameters, PaginationParameter pager) {
return super.find(hql, hqlParameters, pager);
}
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
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-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ConfigurationService.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -430,11 +430,6 @@
emailAccountTopiaDao.deleteAll(emailAccountMap.values());
}
- public List<FaxToMailUser> getAllUsers() {
- FaxToMailUserTopiaDao faxToMailUserDao = getPersistenceContext().getFaxToMailUserDao();
- return faxToMailUserDao.forAll().setOrderByArguments(FaxToMailUser.PROPERTY_FIRST_NAME, FaxToMailUser.PROPERTY_LAST_NAME).findAll();
- }
-
public void saveUserFolders(Map<String, Collection<MailFolder>> userFolders) {
FaxToMailUserTopiaDao faxToMailUserTopiaDao = getPersistenceContext().getFaxToMailUserDao();
@@ -453,11 +448,6 @@
getPersistenceContext().commit();
}
- public List<FaxToMailUserGroup> getAllGroups() {
- FaxToMailUserGroupTopiaDao faxToMailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
- return faxToMailUserGroupDao.forAll().setOrderByArguments(FaxToMailUserGroup.PROPERTY_COMPLETE_NAME).findAll();
- }
-
public ExtensionCommand getExtensionCommand(String extension) {
ExtensionCommandTopiaDao extensionCommandDao = getPersistenceContext().getExtensionCommandDao();
ExtensionCommand result = extensionCommandDao.findByExtension(extension);
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-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/LdapService.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -24,7 +24,10 @@
* #L%
*/
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@@ -42,7 +45,6 @@
import com.franciaflex.faxtomail.services.service.ldap.AuthenticationException;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
-import com.unboundid.ldap.sdk.LDAPSearchException;
import com.unboundid.ldap.sdk.SearchResult;
import com.unboundid.ldap.sdk.SearchResultEntry;
import com.unboundid.ldap.sdk.SearchScope;
@@ -52,28 +54,6 @@
private static final Log log = LogFactory.getLog(LdapService.class);
/**
- * Retourne le nombre d'utilisateur en base.
- *
- * @return user count
- */
- public long getUserCount() {
- FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
- long result = faxtomailUserDao.count();
- return result;
- }
-
- /**
- * Retourne le nombre de groupe en base.
- *
- * @return group count
- */
- public long getGroupCount() {
- FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
- long result = faxtomailUserGroupDao.count();
- return result;
- }
-
- /**
* Update all user and group from ldap.
*/
public void updateLdapData() {
@@ -85,33 +65,77 @@
getApplicationConfig().getLdapUser(),
getApplicationConfig().getLdapPassword());
if (connection.isConnected()) {
- String baseDN = "OU=Utilisateurs,OU=Mac-Groupe,DC=mac-groupe,DC=net";
- // on recupere d'abord les organisationUnit
- SearchResult unitResult = connection.search(baseDN, SearchScope.SUB, "(objectClass=organizationalUnit)");
- List<SearchResultEntry> unitEntries = unitResult.getSearchEntries();
+
+ FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
+ FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
+
+ // cache group DN > faxtomail user group instance
+ Map<String, FaxToMailUserGroup> groupCache = new HashMap<>();
+ // cache user DN > faxtomail user instance
+ Map<String, FaxToMailUser> userCache = new HashMap<>();
+
+ // get all groups
+ String groupsBaseDN = "OU=Mac-Groupe,DC=mac-groupe,DC=net";
+ String groupsFilter = "(objectCategory=CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net)";
+ SearchResult groupsResult = connection.search(groupsBaseDN, SearchScope.SUB, groupsFilter);
+ List<SearchResultEntry> groupEntries = groupsResult.getSearchEntries();
+ for (SearchResultEntry groupEntry : groupEntries) {
+ String groupDN = groupEntry.getDN();
+ String groupPath = getGroupCompleteName(groupDN);
+ String groupName = StringUtils.substringAfterLast(groupPath, "/");
+ FaxToMailUserGroup userGroup = faxtomailUserGroupDao.forNameEquals(groupName).findUniqueOrNull();
+ if (userGroup == null) {
+ userGroup = faxtomailUserGroupDao.create(
+ FaxToMailUserGroup.PROPERTY_NAME, groupName,
+ FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, groupPath);
+ }
+ groupCache.put(groupDN, userGroup);
+ }
+
+ // get all users (
+ String usersBaseDN = "OU=Mac-Groupe,DC=mac-groupe,DC=net";
+ String usersFilter = "(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net)";
+ // on recupere d'abord les organisationUnit pour fractionner les requettes
+ // sinon au dela de 1000 resultats ca veux plus
+ SearchResult usersResult = connection.search(usersBaseDN, SearchScope.SUB, "(objectClass=organizationalUnit)");
+ List<SearchResultEntry> unitEntries = usersResult.getSearchEntries();
for (SearchResultEntry unitEntry : unitEntries) {
if (log.isDebugEnabled()) {
log.debug("Search for unit " + unitEntry.getDN());
}
- SearchResult userResult = connection.search(unitEntry.getDN(), SearchScope.ONE, "(objectClass=user)");
+ SearchResult userResult = connection.search(unitEntry.getDN(), SearchScope.ONE, usersFilter);
List<SearchResultEntry> userEntries = userResult.getSearchEntries();
for (SearchResultEntry userEntry : userEntries) {
String login = userEntry.getAttributeValue("sAMAccountName");
+ String userDN = userEntry.getDN();
if (login == null) {
if (log.isWarnEnabled()) {
- log.warn("Null sAMAccountName for DN " + userEntry.getDN());
+ log.warn("Null sAMAccountName for DN " + userDN);
}
} else {
login = login.toLowerCase();
- updateUserFormLdap(userEntry, login);
+ FaxToMailUser user = updateUserFormLdap(connection, userEntry, login, groupCache);
+ userCache.put(userDN, user);
}
}
}
+ // make remaining user and groups in database as 'hidden'
+ Collection<FaxToMailUser> usersToHide = faxtomailUserDao.forNotIn(userCache.values());
+ for (FaxToMailUser userToHide : usersToHide) {
+ userToHide.setHidden(true);
+ faxtomailUserDao.update(userToHide);
+ }
+ Collection<FaxToMailUserGroup> userGroupsToHide = faxtomailUserGroupDao.forNotIn(groupCache.values());
+ for (FaxToMailUserGroup userGroupToHide : userGroupsToHide) {
+ userGroupToHide.setHidden(true);
+ faxtomailUserGroupDao.update(userGroupToHide);
+ }
getPersistenceContext().commit();
}
+
} catch (LDAPException ex) {
throw new RuntimeException("Can't connect to ldap", ex);
} finally {
@@ -195,7 +219,6 @@
searchEntry = searchResult.getSearchEntries().get(0);
userDN = searchEntry.getDN();
}
- adminConnect.close();
}
if (searchEntry != null) {
@@ -207,7 +230,7 @@
if (userConnect.isConnected()) {
// update in database
- result = updateUserFormLdap(searchEntry, login);
+ result = updateUserFormLdap(adminConnect, searchEntry, login, null);
getPersistenceContext().commit();
userConnect.close();
@@ -217,6 +240,7 @@
} else {
throw new AuthenticationException("Utilisateur inconnu : " + login);
}
+ adminConnect.close();
} catch (LDAPException ex) {
if (log.isWarnEnabled()) {
@@ -257,19 +281,20 @@
if (!searchResult.getSearchEntries().isEmpty()) {
searchEntry = searchResult.getSearchEntries().get(0);
}
- adminConnect.close();
+
} else {
throw new AuthenticationException("Utilisateur inconnu : " + login);
}
if( searchEntry != null ) {
// update in database
- result = updateUserFormLdap(searchEntry, login);
+ result = updateUserFormLdap(adminConnect, searchEntry, login, null);
getPersistenceContext().commit();
-
} else {
throw new AuthenticationException("Utilisateur inconnu : " + login);
}
+
+ adminConnect.close();
} catch (LDAPException ex) {
if (log.isWarnEnabled()) {
log.warn("Can't login to ldap", ex);
@@ -282,12 +307,14 @@
/**
* Update user (or create) in database from ldap search result entry.
*
+ * @param adminConnect admin connection used to load groups content
* @param searchEntry entry containing data
* @param login login
+ * @param groupCache group cache when mass update (can be null)
* @return updated user
- * @throws LDAPSearchException
+ * @throws LDAPException
*/
- protected FaxToMailUser updateUserFormLdap(SearchResultEntry searchEntry, String login) throws LDAPSearchException {
+ protected FaxToMailUser updateUserFormLdap(LDAPConnection adminConnect, SearchResultEntry searchEntry, String login, Map<String, FaxToMailUserGroup> groupCache) throws LDAPException {
FaxToMailUser user;
@@ -300,6 +327,7 @@
user = new FaxToMailUserImpl();
user.setLogin(login);
}
+ user.setHidden(false);
// update other ldap fields
String fullName = searchEntry.getAttributeValue("name");
@@ -321,15 +349,30 @@
String[] groups = searchEntry.getAttributeValues("memberOf");
if (ArrayUtils.isNotEmpty(groups)) {
for (String group : groups) {
- String groupPath = getGroupCompleteName(group);
- String groupName = StringUtils.substringAfterLast(groupPath, "/");
- FaxToMailUserGroup userGroup = faxtomailUserGroupDao.forNameEquals(groupName).findUniqueOrNull();
- if (userGroup == null) {
- userGroup = faxtomailUserGroupDao.create(
- FaxToMailUserGroup.PROPERTY_NAME, groupName,
- FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, groupPath);
+
+ // en mass-update, on a le cache
+ if (groupCache != null) {
+ FaxToMailUserGroup userGroup = groupCache.get(group);
+ if (userGroup != null) {
+ user.addUserGroups(userGroup);
+ }
+ } else {
+ // parmis tous les groupes, on n'utilise que ceux qui sont de la catégories
+ // CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net
+ SearchResultEntry groupSearchEntry = adminConnect.getEntry(group);
+ String objectCategory = groupSearchEntry.getAttributeValue("objectCategory");
+ if ("CN=Group,CN=Schema,CN=Configuration,DC=mac-groupe,DC=net".equals(objectCategory)) {
+ String groupPath = getGroupCompleteName(group);
+ String groupName = StringUtils.substringAfterLast(groupPath, "/");
+ FaxToMailUserGroup userGroup = faxtomailUserGroupDao.forNameEquals(groupName).findUniqueOrNull();
+ if (userGroup == null) {
+ userGroup = faxtomailUserGroupDao.create(
+ FaxToMailUserGroup.PROPERTY_NAME, groupName,
+ FaxToMailUserGroup.PROPERTY_COMPLETE_NAME, groupPath);
+ }
+ user.addUserGroups(userGroup);
+ }
}
- user.addUserGroups(userGroup);
}
}
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-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -70,22 +70,22 @@
public List<DemandType> getAllDemandType() {
DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao();
- return new ArrayList<>(dao.findAll());
+ return dao.findAll();
}
public List<Priority> getAllPriority() {
PriorityTopiaDao dao = getPersistenceContext().getPriorityDao();
- return new ArrayList<>(dao.findAll());
+ return dao.findAll();
}
public List<Range> getAllRange() {
RangeTopiaDao dao = getPersistenceContext().getRangeDao();
- return new ArrayList<>(dao.findAll());
+ return dao.findAll();
}
public List<EtatAttente> getAllEtatAttente() {
EtatAttenteTopiaDao dao = getPersistenceContext().getEtatAttenteDao();
- return new ArrayList<>(dao.findAll());
+ return dao.findAll();
}
public Map<String, Long> getEtatAttentesUsage() {
@@ -96,7 +96,7 @@
public List<Client> getAllClients() {
ClientTopiaDao dao = getPersistenceContext().getClientDao();
- return new ArrayList<>(dao.findAll());
+ return dao.findAll();
}
public List<Client> importClients(InputStream inputStream) {
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-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/UserService.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -24,7 +24,6 @@
* #L%
*/
-import java.util.ArrayList;
import java.util.List;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
@@ -38,9 +37,31 @@
*/
public class UserService extends FaxToMailServiceSupport {
- public List<FaxToMailUser> getAllUsers() {
+ /**
+ * Retourne le nombre d'utilisateur en base.
+ *
+ * @return user count
+ */
+ public long getActiveUserCount() {
+ FaxToMailUserTopiaDao faxtomailUserDao = getPersistenceContext().getFaxToMailUserDao();
+ long result = faxtomailUserDao.forHiddenEquals(false).count();
+ return result;
+ }
+
+ /**
+ * Retourne le nombre de groupe en base.
+ *
+ * @return group count
+ */
+ public long getActiveGroupCount() {
+ FaxToMailUserGroupTopiaDao faxtomailUserGroupDao = getPersistenceContext().getFaxToMailUserGroupDao();
+ long result = faxtomailUserGroupDao.forHiddenEquals(false).count();
+ return result;
+ }
+
+ public List<FaxToMailUser> getAllActiveUsers() {
FaxToMailUserTopiaDao dao = getPersistenceContext().getFaxToMailUserDao();
- return new ArrayList<>(dao.findAll());
+ return dao.forHiddenEquals(false).setOrderByArguments(FaxToMailUser.PROPERTY_FIRST_NAME, FaxToMailUser.PROPERTY_LAST_NAME).findAll();
}
public FaxToMailUser getUserByLogin(String login) {
@@ -49,9 +70,9 @@
return user;
}
- public List<FaxToMailUserGroup> getAllUserGroups() {
+ public List<FaxToMailUserGroup> getAllActiveUserGroups() {
FaxToMailUserGroupTopiaDao dao = getPersistenceContext().getFaxToMailUserGroupDao();
- return new ArrayList<>(dao.findAll());
+ return dao.forHiddenEquals(false).setOrderByArguments(FaxToMailUserGroup.PROPERTY_COMPLETE_NAME).findAll();
}
public FaxToMailUser getUser(String topiaId) {
Added: trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_454__add_ldap_config.sql
===================================================================
--- trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_454__add_ldap_config.sql (rev 0)
+++ trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_454__add_ldap_config.sql 2014-07-31 16:38:29 UTC (rev 455)
@@ -0,0 +1,6 @@
+
+-- add user and group hidden configuration
+alter table FaxToMailUserGroup add column hidden ${booleanType};
+update FaxToMailUserGroup set hidden = 'f';
+alter table FaxToMailUser add column hidden ${booleanType};
+update FaxToMailUser set hidden = 'f';
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -110,7 +110,7 @@
ReferentielService referentielService = getContext().getReferentielService();
- List<FaxToMailUser> users = getContext().getUserService().getAllUsers();
+ List<FaxToMailUser> users = getContext().getUserService().getAllActiveUsers();
SearchUIModel model = getModel();
initBeanFilterableComboBox(ui.getTakenByComboBox(),
users,
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -100,7 +100,7 @@
final ReferentielService referentielService = getContext().getReferentielService();
// this loading take 1,5 seconds
- List<FaxToMailUser> users = getContext().getUserService().getAllUsers();
+ List<FaxToMailUser> users = getContext().getUserService().getAllActiveUsers();
SearchUIModel model = getModel();
initBeanFilterableComboBox(ui.getTakenByComboBox(),
users,
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -51,6 +51,7 @@
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
+import com.franciaflex.faxtomail.services.service.UserService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
import com.google.gson.reflect.TypeToken;
import com.opensymphony.xwork2.Preparable;
@@ -70,6 +71,8 @@
protected ConfigurationService configurationService;
+ protected UserService userService;
+
protected ReferentielService referentielService;
protected MailFolderService mailFolderService;
@@ -116,8 +119,8 @@
emailAccounts = configurationService.getEmailAccountsWithoutPasswords();
mailFilters = configurationService.getMailFilters();
configuration = configurationService.getConfiguration();
- users = configurationService.getAllUsers();
- groups = configurationService.getAllGroups();
+ users = userService.getAllActiveUsers();
+ groups = userService.getAllActiveUserGroups();
return INPUT;
}
@@ -135,6 +138,10 @@
this.configurationService = configurationService;
}
+ public void setUserService(UserService userService) {
+ this.userService = userService;
+ }
+
public void setReferentielService(ReferentielService referentielService) {
this.referentielService = referentielService;
}
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java 2014-07-31 14:19:39 UTC (rev 454)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/LdapAction.java 2014-07-31 16:38:29 UTC (rev 455)
@@ -35,6 +35,7 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailTopiaPersistenceContext;
import com.franciaflex.faxtomail.services.FaxToMailServiceContext;
import com.franciaflex.faxtomail.services.service.LdapService;
+import com.franciaflex.faxtomail.services.service.UserService;
import com.franciaflex.faxtomail.web.FaxToMailActionSupport;
import com.opensymphony.xwork2.Preparable;
@@ -49,7 +50,7 @@
private static final Log log = LogFactory.getLog(LdapAction.class);
- protected LdapService ldapService;
+ protected UserService userService;
protected long userCount;
@@ -61,8 +62,8 @@
this.applicationContext = applicationContext;
}
- public void setLdapService(LdapService ldapService) {
- this.ldapService = ldapService;
+ public void setUserService(UserService userService) {
+ this.userService = userService;
}
public long getUserCount() {
@@ -84,8 +85,8 @@
@Override
@Action("ldap-input")
public String input() throws Exception {
- userCount = ldapService.getUserCount();
- groupCount = ldapService.getGroupCount();
+ userCount = userService.getActiveUserCount();
+ groupCount = userService.getActiveGroupCount();
return INPUT;
}
1
0
r454 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search
by echatellier@users.forge.codelutin.com 31 Jul '14
by echatellier@users.forge.codelutin.com 31 Jul '14
31 Jul '14
Author: echatellier
Date: 2014-07-31 16:19:39 +0200 (Thu, 31 Jul 2014)
New Revision: 454
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/454
Log:
Load users only once
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-31 13:07:07 UTC (rev 453)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchToGroupUIHandler.java 2014-07-31 14:19:39 UTC (rev 454)
@@ -26,6 +26,7 @@
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.EmailFilter;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.GroupAction;
@@ -109,24 +110,25 @@
ReferentielService referentielService = getContext().getReferentielService();
+ List<FaxToMailUser> users = getContext().getUserService().getAllUsers();
SearchUIModel model = getModel();
initBeanFilterableComboBox(ui.getTakenByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getTakenBy());
initBeanFilterableComboBox(ui.getModifiedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getModifiedBy());
initBeanFilterableComboBox(ui.getArchivedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getArchivedBy());
initBeanFilterableComboBox(ui.getTransferByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getTransferBy());
initBeanFilterableComboBox(ui.getPrintedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getPrintingBy());
initBeanFilterableComboBox(ui.getRepliedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getReplyBy());
initCheckBoxComboBox(ui.getDocTypeComboBox(),
Modified: trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java
===================================================================
--- trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-31 13:07:07 UTC (rev 453)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/search/SearchUIHandler.java 2014-07-31 14:19:39 UTC (rev 454)
@@ -22,8 +22,29 @@
* #L%
*/
+import static org.nuiton.i18n.I18n.t;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.JComponent;
+import javax.swing.ListSelectionModel;
+
+import jaxx.runtime.validator.swing.SwingValidator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
+
import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
import com.franciaflex.faxtomail.persistence.entities.EmailFilter;
+import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.services.service.ReferentielService;
import com.franciaflex.faxtomail.ui.swing.actions.SearchAction;
@@ -33,24 +54,6 @@
import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
import com.franciaflex.faxtomail.ui.swing.util.DemandeTableModel;
-import jaxx.runtime.validator.swing.SwingValidator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdesktop.swingx.JXTable;
-import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
-
-import javax.swing.*;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* Handler of UI {@link SearchUIHandler}.
*
@@ -93,26 +96,29 @@
initUI(ui);
+ long before = System.currentTimeMillis();
final ReferentielService referentielService = getContext().getReferentielService();
+ // this loading take 1,5 seconds
+ List<FaxToMailUser> users = getContext().getUserService().getAllUsers();
SearchUIModel model = getModel();
initBeanFilterableComboBox(ui.getTakenByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getTakenBy());
initBeanFilterableComboBox(ui.getModifiedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getModifiedBy());
initBeanFilterableComboBox(ui.getArchivedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getArchivedBy());
initBeanFilterableComboBox(ui.getTransferByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getTransferBy());
initBeanFilterableComboBox(ui.getPrintedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getPrintingBy());
initBeanFilterableComboBox(ui.getRepliedByComboBox(),
- getContext().getUserService().getAllUsers(),
+ users,
model.getReplyBy());
initCheckBoxComboBox(ui.getDocTypeComboBox(),
@@ -163,7 +169,7 @@
}
}
});
-
+
if (getContext().getSearch() != null) {
try {
SearchAction searchAction = getContext().getActionFactory().createLogicAction(this, SearchAction.class);
@@ -176,7 +182,8 @@
getContext().getErrorHelper().showErrorDialog(t("faxtomail.search.action.error"));
}
}
-
+ long after = System.currentTimeMillis();
+ System.out.println("Time = " + (after - before) + " ms");
}
public void searchDemandes() {
1
0
r453 - trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande
by echatellier@users.forge.codelutin.com 31 Jul '14
by echatellier@users.forge.codelutin.com 31 Jul '14
31 Jul '14
Author: echatellier
Date: 2014-07-31 15:07:07 +0200 (Thu, 31 Jul 2014)
New Revision: 453
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/453
Log:
fixes #5521: Redefinition de certaines m?\195?\169thode par copier/coller pour changer l'action de sauvegarde en action bloquante pour qu'elle bloque l'action de rechergement de l'ui suivante et que cela ne fasse pas de conflit.
Modified:
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
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-07-31 10:08:13 UTC (rev 452)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-07-31 13:07:07 UTC (rev 453)
@@ -22,23 +22,32 @@
* #L%
*/
-import com.franciaflex.faxtomail.persistence.entities.Attachment;
-import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
-import com.franciaflex.faxtomail.persistence.entities.DemandType;
-import com.franciaflex.faxtomail.persistence.entities.Email;
-import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
-import com.franciaflex.faxtomail.persistence.entities.HistoryType;
-import com.franciaflex.faxtomail.persistence.entities.MailField;
-import com.franciaflex.faxtomail.persistence.entities.MailFolder;
-import com.franciaflex.faxtomail.persistence.entities.Range;
-import com.franciaflex.faxtomail.persistence.entities.RangeRow;
-import com.franciaflex.faxtomail.services.service.ReferentielService;
-import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction;
-import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
-import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
-import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
+import static org.nuiton.i18n.I18n.t;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextPane;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableCellEditor;
+
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections4.CollectionUtils;
@@ -50,6 +59,8 @@
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.jdesktop.swingx.table.TableColumnModelExt;
+import org.nuiton.jaxx.application.swing.action.AbstractApplicationAction;
+import org.nuiton.jaxx.application.swing.action.ApplicationUIAction;
import org.nuiton.jaxx.application.swing.tab.TabHandler;
import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.jaxx.application.swing.table.MoveToNextEditableCellAction;
@@ -58,27 +69,23 @@
import org.nuiton.jaxx.application.swing.table.MoveToPreviousEditableRowAction;
import org.nuiton.util.beans.BeanMonitor;
-import javax.swing.*;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableCellEditor;
+import com.franciaflex.faxtomail.persistence.entities.Attachment;
+import com.franciaflex.faxtomail.persistence.entities.DemandStatus;
+import com.franciaflex.faxtomail.persistence.entities.DemandType;
+import com.franciaflex.faxtomail.persistence.entities.Email;
+import com.franciaflex.faxtomail.persistence.entities.EtatAttente;
+import com.franciaflex.faxtomail.persistence.entities.HistoryType;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
+import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.Range;
+import com.franciaflex.faxtomail.persistence.entities.RangeRow;
+import com.franciaflex.faxtomail.services.service.ReferentielService;
+import com.franciaflex.faxtomail.ui.swing.actions.SaveDemandeAction;
+import com.franciaflex.faxtomail.ui.swing.content.attachment.AttachmentEditorUIModel;
+import com.franciaflex.faxtomail.ui.swing.util.AbstractFaxToMailUIHandler;
+import com.franciaflex.faxtomail.ui.swing.util.CloseableUI;
+import com.franciaflex.faxtomail.ui.swing.util.FaxToMailUIUtil;
-import java.awt.*;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import static org.nuiton.i18n.I18n.t;
-
/**
* Handler of UI {@link DemandeUIHandler}.
*
@@ -435,13 +442,12 @@
@Override
public boolean quitUI() {
BeanMonitor monitor = getMonitor();
- log.info(Arrays.toString(monitor.getModifiedProperties()));
- boolean result = quitScreen(
+ boolean result = quitScreen2(
true,
monitor.wasModified(),
t("faxtomail.demande.askCancelEditBeforeLeaving.cancelSave"),
t("faxtomail.demande.askSaveBeforeLeaving.save"),
- getContext().getActionFactory().createUIAction(this, SaveDemandeAction.class)
+ getContext().getActionFactory().createLogicAction(this, SaveDemandeAction.class)
);
// mettre ca ici et non dans le close, car pour un onglet, le close n'est pas appelé
@@ -452,6 +458,59 @@
return result;
}
+ /**
+ * Gros copier/coller de quitScreen() pour appeler runActionAndWait au lieu de saveAction.actionPerformed(null); par defaut
+ * pour tenter de corriger un problème de concurrence entre l'action de sauvegarde de l'email
+ * et l'action de rechargement de l'arbre qui fait un closeTransaction au même moment.
+ *
+ * @param modelIsValid
+ * @param modelIsModify
+ * @param askGiveUpMessage
+ * @param askSaveMessage
+ * @param saveAction
+ * @return
+ */
+ protected boolean quitScreen2(boolean modelIsValid, boolean modelIsModify, String askGiveUpMessage, String askSaveMessage,
+ SaveDemandeAction saveAction) {
+ boolean result;
+
+ if (!modelIsValid) {
+
+ // model is not valid
+ // ask user to qui or not
+ result = askCancelEditBeforeLeaving(askGiveUpMessage);
+
+ } else if (modelIsModify) {
+
+ // something is modify ask user what to do
+ int answer = askSaveBeforeLeaving(askSaveMessage);
+ switch (answer) {
+ case JOptionPane.YES_OPTION:
+
+ // ok save
+ //saveAction.actionPerformed(null);
+ //XXX echatellier 2010731 : action bloquante
+ getContext().getActionEngine().runActionAndWait(saveAction);
+ result = true;
+ break;
+ case JOptionPane.NO_OPTION:
+
+ // do not save but can still quit the screen (so nothing to do)
+ result = true;
+ break;
+ default:
+ // do not save and stay here (so nothing to do)
+ result = false;
+
+ }
+ } else {
+
+ // model is valid and not modify, can safely quit screen
+ result = true;
+ }
+ return result;
+ }
+
@Override
public SwingValidator<DemandeUIModel> getValidator() {
return ui.getValidator();
1
0
Author: echatellier
Date: 2014-07-31 12:08:13 +0200 (Thu, 31 Jul 2014)
New Revision: 452
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/452
Log:
Update to topia 3.0-beta-11
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-07-30 13:51:22 UTC (rev 451)
+++ trunk/pom.xml 2014-07-31 10:08:13 UTC (rev 452)
@@ -105,8 +105,8 @@
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<nuitonWebVersion>1.16</nuitonWebVersion>
- <eugeneVersion>2.13-SNAPSHOT</eugeneVersion>
- <topiaVersion>3.0-SNAPSHOT</topiaVersion>
+ <eugeneVersion>2.12</eugeneVersion>
+ <topiaVersion>3.0-beta-11</topiaVersion>
<hibernateVersion>4.3.6.Final</hibernateVersion>
<h2Version>1.3.176</h2Version>
1
0
r451 - in trunk: faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande
by echatellier@users.forge.codelutin.com 30 Jul '14
by echatellier@users.forge.codelutin.com 30 Jul '14
30 Jul '14
Author: echatellier
Date: 2014-07-30 15:51:22 +0200 (Wed, 30 Jul 2014)
New Revision: 451
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/451
Log:
fixes #5542: les types sont ?\195?\160 mettre par soci?\195?\169t?\195?\169
fixes #5541: les gammes doivent ?\195?\170tre par soci?\195?\169t?\195?\169
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/ReferentielService.java
trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java
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-07-28 16:19:59 UTC (rev 450)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailService.java 2014-07-30 13:51:22 UTC (rev 451)
@@ -597,12 +597,16 @@
*/
public void unlockEmail(String emailId) {
MailLockTopiaDao mailLockDao = getPersistenceContext().getMailLockDao();
- MailLock mailLock = mailLockDao.forAll().addEquals(MailLock.PROPERTY_LOCK_ON + "." + Email.PROPERTY_TOPIA_ID, emailId).findUnique();
- mailLockDao.delete(mailLock);
- if (log.isDebugEnabled()) {
- log.debug("[UNLOCK] " + emailId + " unlocked");
+ MailLock mailLock = mailLockDao.forAll().addEquals(MailLock.PROPERTY_LOCK_ON + "." + Email.PROPERTY_TOPIA_ID, emailId).findUniqueOrNull();
+ // ca peut être null si c'est un emailId qui est valorisé suite à une creation et donc
+ // qui n'a pas été vérrouillé avant
+ if (mailLock != null) {
+ mailLockDao.delete(mailLock);
+ if (log.isDebugEnabled()) {
+ log.debug("[UNLOCK] " + emailId + " unlocked");
+ }
+ getPersistenceContext().commit();
}
- getPersistenceContext().commit();
}
/**
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-07-28 16:19:59 UTC (rev 450)
+++ trunk/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/ReferentielService.java 2014-07-30 13:51:22 UTC (rev 451)
@@ -32,8 +32,6 @@
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuiton.csv.Import;
import org.nuiton.csv.ImportRuntimeException;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
@@ -70,8 +68,6 @@
*/
public class ReferentielService extends FaxToMailServiceSupport {
- private static final Log log = LogFactory.getLog(ReferentielService.class);
-
public List<DemandType> getAllDemandType() {
DemandTypeTopiaDao dao = getPersistenceContext().getDemandTypeDao();
return new ArrayList<>(dao.findAll());
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-07-28 16:19:59 UTC (rev 450)
+++ trunk/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/demande/DemandeUIHandler.java 2014-07-30 13:51:22 UTC (rev 451)
@@ -132,10 +132,20 @@
MailFolder folder = model.getMailFolder();
ReferentielService referentielService = getContext().getReferentielService();
- initBeanFilterableComboBox(ui.getDocTypeComboBox(), referentielService.getAllDemandType(), model.getDemandType());
initBeanFilterableComboBox(ui.getPriorityComboBox(), referentielService.getAllPriority(), model.getPriority());
initBeanFilterableComboBox(ui.getStatusComboBox(), Arrays.asList(DemandStatus.values()), model.getDemandStatus());
+
+ // utilisation des etats d'attente défini pour le dossier (si défini)
+ List<DemandType> demandTypes = new ArrayList<DemandType>();
+ Collection<DemandType> folderDemandTypes = getDemandTypeForFolder(folder);
+ if (CollectionUtils.isEmpty(folderDemandTypes)) {
+ demandTypes.addAll(referentielService.getAllDemandType());
+ } else {
+ demandTypes.addAll(folderDemandTypes);
+ }
+ initBeanFilterableComboBox(ui.getDocTypeComboBox(), demandTypes, model.getDemandType());
+ // utilisation des etats d'attente défini pour le dossier (si défini)
List<EtatAttente> etatAttentes = new ArrayList<EtatAttente>();
Collection<EtatAttente> folderEtatAttentes = getEtatAttenteForFolder(folder);
if (CollectionUtils.isEmpty(folderEtatAttentes)) {
@@ -151,11 +161,19 @@
// init table
final JXTable table = ui.getRangeTable();
+ // utilisation des gammes défini pour le dossier (si défini)
+ List<Range> ranges = new ArrayList<Range>();
+ Collection<Range> folderRanges = getRangeForFolder(folder);
+ if (CollectionUtils.isEmpty(folderRanges)) {
+ ranges.addAll(referentielService.getAllRange());
+ } else {
+ ranges.addAll(folderRanges);
+ }
TableColumnModelExt columnModel = new DefaultTableColumnModelExt();
addComboDataColumnToModel(columnModel,
RangeTableModel.RANGE_COLUMN,
getDecorator(Range.class, null),
- referentielService.getAllRange());
+ ranges);
addColumnToModel(columnModel,
RangeTableModel.COMMAND_NUMBER_COLUMN);
addIntegerColumnToModel(columnModel,
@@ -439,7 +457,13 @@
return ui.getValidator();
}
- public Collection<EtatAttente> getEtatAttenteForFolder(MailFolder folder) {
+ /**
+ * Récupère recursivement jusqu'au parent, les etats d'attentes définis pour un dossier.
+ *
+ * @param folder base folder
+ * @return etat d'attente to use
+ */
+ protected Collection<EtatAttente> getEtatAttenteForFolder(MailFolder folder) {
Collection<EtatAttente> result = null;
while (CollectionUtils.isEmpty(result) && folder != null) {
result = folder.getEtatAttentes();
@@ -448,6 +472,36 @@
return result;
}
+ /**
+ * Récupère recursivement jusqu'au parent, les types de demande définies pour un dossier.
+ *
+ * @param folder base folder
+ * @return etat d'attente to use
+ */
+ protected Collection<DemandType> getDemandTypeForFolder(MailFolder folder) {
+ Collection<DemandType> result = null;
+ while (CollectionUtils.isEmpty(result) && folder != null) {
+ result = folder.getDemandTypes();
+ folder = folder.getParent();
+ }
+ return result;
+ }
+
+ /**
+ * Récupère recursivement jusqu'au parent, les gammes définies pour un dossier.
+ *
+ * @param folder base folder
+ * @return etat d'attente to use
+ */
+ protected Collection<Range> getRangeForFolder(MailFolder folder) {
+ Collection<Range> result = null;
+ while (CollectionUtils.isEmpty(result) && folder != null) {
+ result = folder.getRanges();
+ folder = folder.getParent();
+ }
+ return result;
+ }
+
public BeanMonitor getMonitor() {
return monitor;
}
1
0
r450 - in trunk/faxtomail-ui-web/src/main/webapp: WEB-INF WEB-INF/content/admin css js
by echatellier@users.forge.codelutin.com 28 Jul '14
by echatellier@users.forge.codelutin.com 28 Jul '14
28 Jul '14
Author: echatellier
Date: 2014-07-28 18:19:59 +0200 (Mon, 28 Jul 2014)
New Revision: 450
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/450
Log:
Add search support using select2 with angular
Added:
trunk/faxtomail-ui-web/src/main/webapp/js/select2.js
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 15:20:27 UTC (rev 449)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 16:19:59 UTC (rev 450)
@@ -451,15 +451,16 @@
</tbody>
</table>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newCustomerResponsibleField" class="control-label">Nouveau :</label>
- <select id="newCustomerResponsibleField" class="form-control" ng-model="newCustomerResponsible"
+ <select id="newCustomerResponsibleField" ui-select2 ng-model="newCustomerResponsible"
ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.customerResponsibles)"></select>
+
+ <a class="btn btn-success btn-xs" ng-click="addCustomerResponsible()" ng-disabled="!newCustomerResponsible">
+ <span class="glyphicon glyphicon-plus"></span>
+ </a>
</div>
- <a class="btn btn-success btn-xs" ng-click="addCustomerResponsible()" ng-disabled="!newCustomerResponsible">
- <span class="glyphicon glyphicon-plus"></span>
- </a>
</div>
</div>
</div>
@@ -840,10 +841,10 @@
</tr>
</tbody>
</table>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newRightUserField" class="control-label">Nouveau utilisateur :</label>
- <select id="newRightUserField" class="form-control"
+ <select id="newRightUserField" ui-select2
ng-model="newRightUser"
ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)">
</select>
@@ -853,10 +854,10 @@
</div>
</div>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newRightGroupField" class="control-label">Nouveau groupe :</label>
- <select id="newRightGroupField" class="form-control"
+ <select id="newRightGroupField" ui-select2
ng-model="newRightGroup"
ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedMailFolder.rightGroups)">
</select>
@@ -922,10 +923,10 @@
</tr>
</tbody>
</table>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newRightUserField" class="control-label">Nouveau utilisateur :</label>
- <select id="newRightUserField" class="form-control"
+ <select id="newRightUserField" ui-select2
ng-model="newRightUser"
ng-options="user as user.firstName + ' ' + user.lastName for user in users|filter:filterByAlreadyInCollection(selectedMailFolder.rightUsers)">
</select>
@@ -935,10 +936,10 @@
</div>
</div>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newRightGroupField" class="control-label">Nouveau groupe :</label>
- <select id="newRightGroupField" class="form-control"
+ <select id="newRightGroupField" ui-select2
ng-model="newRightGroup"
ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedMailFolder.rightGroups)">
</select>
@@ -1144,10 +1145,10 @@
<div class="col-md-8" ng-show="selectedGroupChef">
<h3>Édition du chef de groupe</h3>
- <div class="form-inline">
+ <div class="form">
<div class="form-group required">
<label for="groupChefUserGroupField" class="control-label">Chef du groupe : </label>
- <select id="groupChefUserGroupField" class="form-control" ng-required="selectedGroupChef"
+ <select id="groupChefUserGroupField" ui-select2 ng-required="selectedGroupChef"
ng-model="selectedGroupChef.userGroup"
ng-options="group as group.completeName for group in groups|filter:availableNewGroupChef">
<option value=""></option>
@@ -1177,12 +1178,13 @@
</tr>
</tbody>
</table>
- <div class="form-inline">
+ <div class="form">
<div class="form-group">
<label for="newManagedGroupField" class="control-label">Nouveau groupe :</label>
- <select id="newManagedGroupField" class="form-control"
- ng-model="newManagedGroup" width="'100%'" searchContains="true"
- ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedGroupChef.managedGroups)" >
+ <select id="newManagedGroupField" ui-select2
+ ng-model="newManagedGroup"
+ ng-options="group as group.completeName for group in groups|filter:filterByAlreadyInCollection(selectedGroupChef.managedGroups)">
+ <option value=""></option>
</select>
<a class="btn btn-success btn-xs" ng-click="addManagedGroup()" ng-disabled="!newManagedGroup">
<span class="glyphicon glyphicon-plus"></span>
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-07-28 15:20:27 UTC (rev 449)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/wro.xml 2014-07-28 16:19:59 UTC (rev 450)
@@ -45,6 +45,11 @@
<js>classpath:META-INF/resources/webjars/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.js</js>
</group>
+ <group name='select2' abstract="true">
+ <group-ref>webjar-select2</group-ref>
+ <js>/js/select2.js</js>
+ </group>
+
<group name='select2sortable' abstract="true">
<group-ref>webjar-select2</group-ref>
<js>/js/select2sortable.js</js>
@@ -79,6 +84,7 @@
</group>
<group name='faxtomail-configuration'>
+ <group-ref>select2</group-ref>
<group-ref>select2sortable</group-ref>
<group-ref>angular-chosen</group-ref>
<group-ref>webjar-angular-ui-sortable</group-ref>
Modified: trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-07-28 15:20:27 UTC (rev 449)
+++ trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-07-28 16:19:59 UTC (rev 450)
@@ -57,6 +57,14 @@
}
.select2-container {
+ width: 70%;
+}
+
+.select2-offscreen {
+ position: fixed !important;
+}
+/* select 2 sortable */
+.select2-container-multi {
width: 100%;
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 15:20:27 UTC (rev 449)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 16:19:59 UTC (rev 450)
@@ -22,7 +22,7 @@
* #L%
*/
-var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.sortable', 'localytics.directives', 'ui.select2.sortable']);
+var ConfigurationModule = angular.module('ConfigurationModule', ['FaxToMail', 'ui.tree', 'ui.select2', 'ui.sortable', 'localytics.directives', 'ui.select2.sortable']);
/**
* Global configuration controller.
Added: trunk/faxtomail-ui-web/src/main/webapp/js/select2.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/select2.js (rev 0)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/select2.js 2014-07-28 16:19:59 UTC (rev 450)
@@ -0,0 +1,193 @@
+/** %%Ignore-License
+ *
+ * C'est une version patché de ui.select2 pour supporter le ng-options.
+ * En attendant https://github.com/angular-ui/ui-select2/issues/46
+ */
+(function () {
+ "use strict";
+ var module = angular.module('ui.select2', []);
+
+ module.value('uiSelect2Config', {})
+
+ module.directive('uiSelect2', ['uiSelect2Config', '$timeout', '$compile', '$parse', '$q', '$rootScope',
+ function (uiSelect2Config, $timeout, $compile, $parse, $q, $rootScope) {
+ var options = {};
+ if (uiSelect2Config) {
+ angular.extend(options, uiSelect2Config);
+ }
+ return {
+ require: '?ngModel',
+ link: function(scope, element, attrs, ngModel) {
+
+ // instance-specific options
+ var opts = setupOptions();
+ setupAttributeAndClassSynchronization();
+ setupCleanupOnDestroy();
+
+ if (attrs.isOpen) {
+ setupIsOpenBinding();
+ }
+
+ if (attrs.query) {
+ setupQueryHandler();
+ } else {
+ scheduleResyncAfterEveryDigest();
+ }
+
+ element.select2(opts);
+ return;
+
+
+ //Privates
+ function setupOptions() {
+ return angular.extend({}, options, scope.$eval(attrs.uiSelect2));
+ }
+
+ function scheduleResyncAfterEveryDigest() {
+ //After every digest make sure that select2's value is in sync
+ var scheduledValue = false;
+ scope.$watch(function() {
+ //Only schedule once per digest cycle regardles of times watch is called;
+ if (!scheduledValue) {
+ scheduledValue = true;
+ $timeout(function() {
+ element.select2('val', element.val());
+ scheduledValue = false;
+ }, 0, false);
+ }
+ });
+ }
+
+
+ function setupIsOpenBinding() {
+ var isOpen = false;
+ var isOpenExpression = $parse(attrs.isOpen);
+ scope.$watch(isOpenExpression, function(value) {
+ if (value && !isOpen) {
+ $timeout(function() {
+ isOpen = true;
+ element.select2('open');
+ }, 0, false);
+
+ }
+ if (!value && isOpen) {
+ $timeout(function() {
+ element.select2('close');
+ isOpen = false;
+ element.select2('close');
+ }, 0, false);
+ }
+ });
+
+ element.on('select2-open.select2', function() {
+ scope.$apply(function() {
+ isOpen = true;
+ isOpenExpression.assign(scope, true);
+ });
+ });
+
+ element.on('select2-close.select2', function() {
+ scope.$apply(function() {
+ isOpen = false;
+ isOpenExpression.assign(scope, false);
+ });
+ });
+ }
+
+
+ function setupCleanupOnDestroy() {
+ element.on("$destroy", function() {
+ element.select2("destroy");
+ element.off('.select2');
+ });
+ }
+
+
+ function setupAttributeAndClassSynchronization() {
+ attrs.$observe('disabled', function(value) {
+ element.select2('enable', !value);
+ });
+
+ attrs.$observe('readonly', function(value) {
+ element.select2('readonly', !!value);
+ });
+
+ // Update valid and dirty statuses
+ if (ngModel) {
+ ngModel.$parsers.push(function(value) {
+ var div = element.select2("container");
+ div
+ .toggleClass('ng-invalid', !ngModel.$valid)
+ .toggleClass('ng-valid', ngModel.$valid)
+ .toggleClass('ng-invalid-required', !ngModel.$valid)
+ .toggleClass('ng-valid-required', ngModel.$valid)
+ .toggleClass('ng-dirty', ngModel.$dirty)
+ .toggleClass('ng-pristine', ngModel.$pristine);
+ return value;
+ });
+ }
+ }
+
+
+ function setupQueryHandler() {
+ var queryResults = [];
+ ngModel.$parsers.unshift(function(value) {
+ var result = queryResults[value];
+ return result;
+ });
+
+ ngModel.$formatters.push(function(value) {
+ if (value) {
+ var label = scope.$eval(attrs.queryLabel, {
+ option: value
+ });
+ element.select2('data', {
+ text: label
+ });
+ }
+ });
+
+ opts.query = function(query) {
+ if (query.page === 1) {
+ queryResults = [];
+ }
+
+ var queryOptions = {
+ term: query.term,
+ page: query.page,
+ context: query.context
+ };
+ var resultPromiseOrObject = scope.$eval(attrs.query, {
+ query: queryOptions
+ });
+
+ $q.when(resultPromiseOrObject).then(function(result) {
+ var select2Results = [];
+ var i = queryResults.length;
+
+ angular.forEach(result.results, function(option) {
+ var context = {
+ option: option
+ };
+ var label = scope.$eval(attrs.queryLabel, context);
+ select2Results.push({
+ id: i,
+ text: label
+ });
+ i++;
+ });
+
+ queryResults = queryResults.concat(result.results);
+ query.callback({
+ results: select2Results,
+ more: result.more
+ });
+ });
+ };
+ }
+
+ }
+ };
+ }
+ ]);
+})();
1
0
r449 - trunk/faxtomail-ui-web/src/main/resources
by echatellier@users.forge.codelutin.com 28 Jul '14
by echatellier@users.forge.codelutin.com 28 Jul '14
28 Jul '14
Author: echatellier
Date: 2014-07-28 17:20:27 +0200 (Mon, 28 Jul 2014)
New Revision: 449
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/449
Log:
Je valide, c'est annoying
Modified:
trunk/faxtomail-ui-web/src/main/resources/log4j.properties
Modified: trunk/faxtomail-ui-web/src/main/resources/log4j.properties
===================================================================
--- trunk/faxtomail-ui-web/src/main/resources/log4j.properties 2014-07-28 15:14:22 UTC (rev 448)
+++ trunk/faxtomail-ui-web/src/main/resources/log4j.properties 2014-07-28 15:20:27 UTC (rev 449)
@@ -41,6 +41,6 @@
#log4j.logger.com.franciaflex.faxtomail.web.FaxToMailInterceptor=WARN
# annoying errors
-#log4j.logger.com.opensymphony.xwork2.interceptor.ParametersInterceptor=FATAL
-#log4j.logger.com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler=FATAL
-#log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=ERROR
+log4j.logger.com.opensymphony.xwork2.interceptor.ParametersInterceptor=FATAL
+log4j.logger.com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler=FATAL
+log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=ERROR
1
0
r448 - in trunk: faxtomail-persistence/src/main/xmi faxtomail-service/src/main/resources/db/migration faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin faxtomail-ui-web/src/main/webapp/js
by echatellier@users.forge.codelutin.com 28 Jul '14
by echatellier@users.forge.codelutin.com 28 Jul '14
28 Jul '14
Author: echatellier
Date: 2014-07-28 17:14:22 +0200 (Mon, 28 Jul 2014)
New Revision: 448
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/448
Log:
refs #5542, #5541 : D?\195?\169finition des gammes et des types de documents par dossier
Added:
trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_448__add_mail_folder_level_configuration.sql
Modified:
trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java
trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-persistence/src/main/xmi/faxtomail.zargo
===================================================================
(Binary files differ)
Added: trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_448__add_mail_folder_level_configuration.sql
===================================================================
--- trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_448__add_mail_folder_level_configuration.sql (rev 0)
+++ trunk/faxtomail-service/src/main/resources/db/migration/V1_0_0_448__add_mail_folder_level_configuration.sql 2014-07-28 15:14:22 UTC (rev 448)
@@ -0,0 +1,6 @@
+
+-- add mail folder level configuration
+alter table mailfolder add column useCurrentLevelDemandType ${booleanType};
+alter table mailfolder add column useCurrentLevelRange ${booleanType};
+update mailfolder set useCurrentLevelDemandType = 'f';
+update mailfolder set useCurrentLevelRange = 'f';
Modified: trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java
===================================================================
--- trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java 2014-07-28 14:22:34 UTC (rev 447)
+++ trunk/faxtomail-service/src/test/java/com/franciaflex/faxtomail/services/service/MiscTest.java 2014-07-28 15:14:22 UTC (rev 448)
@@ -36,6 +36,7 @@
*
* @author Eric Chatellier
*/
+@Ignore
public class MiscTest extends AbstractFaxToMailServiceTest {
@Override
Modified: trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java
===================================================================
--- trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-07-28 14:22:34 UTC (rev 447)
+++ trunk/faxtomail-ui-web/src/main/java/com/franciaflex/faxtomail/web/action/admin/ConfigurationAction.java 2014-07-28 15:14:22 UTC (rev 448)
@@ -29,8 +29,6 @@
import java.util.List;
import java.util.Map;
-import com.franciaflex.faxtomail.persistence.entities.MailField;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Action;
@@ -46,8 +44,10 @@
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUser;
import com.franciaflex.faxtomail.persistence.entities.FaxToMailUserGroup;
import com.franciaflex.faxtomail.persistence.entities.MailAction;
+import com.franciaflex.faxtomail.persistence.entities.MailField;
import com.franciaflex.faxtomail.persistence.entities.MailFilter;
import com.franciaflex.faxtomail.persistence.entities.MailFolder;
+import com.franciaflex.faxtomail.persistence.entities.Range;
import com.franciaflex.faxtomail.services.service.ConfigurationService;
import com.franciaflex.faxtomail.services.service.MailFolderService;
import com.franciaflex.faxtomail.services.service.ReferentielService;
@@ -82,6 +82,8 @@
protected List<DemandType> demandTypes;
+ protected List<Range> ranges;
+
protected List<MailFolder> mailFolders;
protected Map<String, Long> mailFoldersUsage;
@@ -108,6 +110,7 @@
etatAttentes = referentielService.getAllEtatAttente();
etatAttentesUsage = referentielService.getEtatAttentesUsage();
demandTypes = referentielService.getAllDemandType();
+ ranges = referentielService.getAllRange();
mailFolders = mailFolderService.getRootMailFolders();
mailFoldersUsage = mailFolderService.getMailFoldersUsage();
emailAccounts = configurationService.getEmailAccountsWithoutPasswords();
@@ -170,6 +173,10 @@
this.demandTypes = getGson().fromJson(json, type);
}
+ public List<Range> getRanges() {
+ return ranges;
+ }
+
public List<MailFolder> getMailFolders() {
return mailFolders;
}
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 14:22:34 UTC (rev 447)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 15:14:22 UTC (rev 448)
@@ -44,6 +44,7 @@
'etatAttentes': <s:property value="toJson(etatAttentes)" escapeHtml="false"/>,
'etatAttentesUsage': <s:property value="toJson(etatAttentesUsage)" escapeHtml="false"/>,
'demandTypes': <s:property value="toJson(demandTypes)" escapeHtml="false"/>,
+ 'ranges': <s:property value="toJson(ranges)" escapeHtml="false"/>,
'mailFolders': <s:property value="toJson(mailFolders)" escapeHtml="false"/>,
'mailFoldersUsage': <s:property value="toJson(mailFoldersUsage)" escapeHtml="false"/>,
'searchDisplayColumns': <s:property value="toJson(configuration.searchDisplayColumns)" escapeHtml="false"/>,
@@ -268,7 +269,7 @@
</a>
</h4>
</div>
- <div id="collapse0" class="panel-collapse collapse in" ng-form="generalForm">
+ <div id="collapse0" class="panel-collapse collapse" ng-form="generalForm">
<div class="panel-body">
<div class="form-group">
<label class="control-label">Autoriser le déplacement de demandes vers ce dossier ?</label><br />
@@ -568,7 +569,7 @@
</div>
</div>
- <!-- Liste des emails expéditeur -->
+ <!-- Sélection des états d'attentes possibles pour ce dossier -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
@@ -593,7 +594,7 @@
<label>
<input type="radio" ng-model="selectedMailFolder.useCurrentLevelEtatAttente" ng-value="true"
ng-change="initFolderEtatAttente()" ng-if="selectedMailFolder.$parent" />
- Définir des états d'attente pour ce dossier :
+ Définir les états d'attente pour ce dossier :
</label>
<div class="checkbox" ng-repeat="etatAttente in etatAttentes" ng-if="selectedMailFolder.useCurrentLevelEtatAttente || !selectedMailFolder.$parent">
<label>
@@ -604,6 +605,82 @@
</div>
</div>
</div>
+
+ <!-- Sélection des types de demandes possibles pour ce dossier -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">
+ Sélection des types de demandes possibles pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse4" class="panel-collapse collapse">
+ <div class="panel-body">
+ <label ng-if="selectedMailFolder.$parent">
+ <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType"
+ ng-value="false" ng-change="initFolderDemandTypes()" />
+ Hériter des types de demande déclarés sur les dossiers parent :
+ </label>
+ <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelDemandType">
+ <label>
+ <input type="checkbox" ng-checked="parentScopeValues.demandTypes.containsByTopiaId(demandType)"
+ disabled> {{demandType.label}}
+ </label>
+ </div>
+ <label>
+ <input type="radio" ng-model="selectedMailFolder.useCurrentLevelDemandType" ng-value="true"
+ ng-change="initFolderDemandTypes()" ng-if="selectedMailFolder.$parent" />
+ Définir les types de demande pour ce dossier :
+ </label>
+ <div class="checkbox" ng-repeat="demandType in demandTypes" ng-if="selectedMailFolder.useCurrentLevelDemandType || !selectedMailFolder.$parent">
+ <label>
+ <input type="checkbox" ng-checked="selectedMailFolder.demandTypes.containsByTopiaId(demandType)"
+ ng-click="changeFolderDemandType(demandType)"> {{demandType.label}}
+ </label>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Sélection des gammes possibles pour ce dossier -->
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse5">
+ Sélection des gammes possibles pour ce dossier
+ </a>
+ </h4>
+ </div>
+ <div id="collapse5" class="panel-collapse collapse">
+ <div class="panel-body">
+ <label ng-if="selectedMailFolder.$parent">
+ <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange"
+ ng-value="false" ng-change="initFolderRanges()" />
+ Hériter des gammes déclarées sur les dossiers parent :
+ </label>
+ <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.$parent && !selectedMailFolder.useCurrentLevelRange">
+ <label>
+ <input type="checkbox" ng-checked="parentScopeValues.ranges.containsByTopiaId(range)"
+ disabled> {{range.label}}
+ </label>
+ </div>
+ <div>
+ <label>
+ <input type="radio" ng-model="selectedMailFolder.useCurrentLevelRange" ng-value="true"
+ ng-change="initFolderRanges()" ng-if="selectedMailFolder.$parent" />
+ Définir les gammes pour ce dossier :
+ </label>
+ <div class="checkbox" ng-repeat="range in ranges" ng-if="selectedMailFolder.useCurrentLevelRange || !selectedMailFolder.$parent">
+ <label>
+ <input type="checkbox" ng-checked="selectedMailFolder.ranges.containsByTopiaId(range)"
+ ng-click="changeFolderRange(range)"> {{range.label}}
+ </label>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
<!-- configuration des colonnes a afficher -->
<div class="panel panel-default">
@@ -673,12 +750,12 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
- <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse7">
Droits
</a>
</h4>
</div>
- <div id="collapse4" class="panel-collapse collapse">
+ <div id="collapse7" class="panel-collapse collapse">
<div class="panel-body">
<!-- Droits d'accès -->
<table id="rights" class="table table-bordered">
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 14:22:34 UTC (rev 447)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 15:14:22 UTC (rev 448)
@@ -39,6 +39,8 @@
$scope.tableMailFields = ConfigurationData.tableMailFields;
//{Array} les etats d'attentes disponibles
$scope.etatAttentes = ConfigurationData.etatAttentes;
+ //{Array} les gammes disponibles
+ $scope.ranges = ConfigurationData.ranges;
//{Array} les types de documents
$scope.demandTypes = ConfigurationData.demandTypes;
//{Array} mail folders
@@ -445,6 +447,8 @@
useCurrentLevelEdiFolder: false,
useCurrentLevelRejectResponseMessage: false,
useCurrentLevelRejectResponseMailAddress: false,
+ useCurrentLevelDemandType: false,
+ useCurrentLevelRange: false,
archiveFolder: true
};
@@ -520,6 +524,12 @@
if (!$scope.selectedMailFolder.etatAttentes) {
$scope.selectedMailFolder.etatAttentes = [];
}
+ if (!$scope.selectedMailFolder.demandTypes) {
+ $scope.selectedMailFolder.demandTypes = [];
+ }
+ if (!$scope.selectedMailFolder.ranges) {
+ $scope.selectedMailFolder.ranges = [];
+ }
if (!$scope.selectedMailFolder.readRightUsers) {
$scope.selectedMailFolder.readRightUsers = [];
}
@@ -604,6 +614,8 @@
replyDomains: [],
folderTableColumns: [],
etatAttentes: [],
+ demandTypes: [],
+ ranges: [],
//rigths
readRightUsers: [],
readRightGroups: [],
@@ -700,6 +712,12 @@
if ((!$scope.parentScopeValues.etatAttentes || $scope.parentScopeValues.etatAttentes.length == 0) && folder.etatAttentes) {
$scope.parentScopeValues.etatAttentes = folder.etatAttentes;
}
+ if ((!$scope.parentScopeValues.demandTypes || $scope.parentScopeValues.demandTypes.length == 0) && folder.demandTypes) {
+ $scope.parentScopeValues.demandTypes = folder.demandTypes;
+ }
+ if ((!$scope.parentScopeValues.ranges || $scope.parentScopeValues.ranges.length == 0) && folder.ranges) {
+ $scope.parentScopeValues.ranges = folder.ranges;
+ }
// move to parent first to keed parent order for collection
if (folder.$parent) {
@@ -882,7 +900,49 @@
$scope.selectedMailFolder.etatAttentes.push(etatAttente);
}
};
+
+ // initialise la liste des types de demandes avec celle des niveaux supérieurs
+ $scope.initFolderDemandTypes = function() {
+ if ($scope.selectedMailFolder.useCurrentLevelDemandType) {
+ if ($scope.parentScopeValues.demandTypes) {
+ $scope.selectedMailFolder.demandTypes = $scope.parentScopeValues.demandTypes.slice(); // soft copy
+ }
+ } else {
+ delete $scope.selectedMailFolder.demandTypes;
+ }
+ };
+ // selection/deselection d'un type de demande possible pour ce dossier
+ $scope.changeFolderDemandType = function(demandType) {
+ var index = $scope.selectedMailFolder.demandTypes.indexOfByTopiaId(demandType);
+ if (index != -1) {
+ $scope.selectedMailFolder.demandTypes.splice(index, 1);
+ } else {
+ $scope.selectedMailFolder.demandTypes.push(demandType);
+ }
+ };
+
+ // initialise la liste des gammes avec celle des niveaux supérieurs
+ $scope.initFolderRanges = function() {
+ if ($scope.selectedMailFolder.useCurrentLevelRange) {
+ if ($scope.parentScopeValues.ranges) {
+ $scope.selectedMailFolder.ranges = $scope.parentScopeValues.ranges.slice(); // soft copy
+ }
+ } else {
+ delete $scope.selectedMailFolder.ranges;
+ }
+ };
+
+ // selection/deselection d'une gamme possible pour ce dossier
+ $scope.changeFolderRange = function(range) {
+ var index = $scope.selectedMailFolder.ranges.indexOfByTopiaId(range);
+ if (index != -1) {
+ $scope.selectedMailFolder.ranges.splice(index, 1);
+ } else {
+ $scope.selectedMailFolder.ranges.push(range);
+ }
+ };
+
// initialise la liste des colonnes sélectionnées avec celle des niveaux supérieurs
$scope.initFolderColumns = function() {
if ($scope.selectedMailFolder.useCurrentLevelTableColumns) {
1
0
r447 - in trunk/faxtomail-ui-web/src/main/webapp: WEB-INF/content/admin js
by echatellier@users.forge.codelutin.com 28 Jul '14
by echatellier@users.forge.codelutin.com 28 Jul '14
28 Jul '14
Author: echatellier
Date: 2014-07-28 16:22:34 +0200 (Mon, 28 Jul 2014)
New Revision: 447
Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/447
Log:
Affichage de 'Autoriser le transfer EDI' par dossier.
Modified:
trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 14:05:34 UTC (rev 446)
+++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-28 14:22:34 UTC (rev 447)
@@ -214,11 +214,6 @@
<input type="checkbox" ng-checked="selectedDemandType.fields.indexOf(mailField) != -1"
ng-click="changeDemandTypeField(mailField)"> {{label}}
</label>
- <span ng-show="mailField == 'RANGE_ROW'">(<label>
- <input type="checkbox" ng-model="selectedDemandType.ediTransfer"
- ng-disabled="selectedDemandType.fields.indexOf(mailField) == -1"/> Autoriser le transfert EDI
- <i class="fa fa-info-circle" tooltip="Si cette case est cochée, les demandes valides seront transférées à l'EDI pour le traitement des numéros de commande des gammes, sinon les demandes passerons directement dans le statut 'en cours'"></i>
- </label>)</span>
</div>
</div>
<div class="col-md-8" ng-if="!selectedDemandType">
@@ -340,23 +335,6 @@
({{parentScopeValues.openAttachmentReportNoTaken ? 'Oui' : 'Non'}})
</label>
</div>
-
- <div class="form-group">
- <label class="control-label">Refuser les mails dont l'email est inconnu de la base client</label><br />
- <label class="radio-inline">
- <input type="radio"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="true"> oui
- </label>
- <label class="radio-inline">
- <input type="radio"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="false"> non
- </label>
- <label class="radio-inline" ng-if="selectedMailFolder.$parent">
- <input type="radio"
- ng-model="selectedMailFolder.rejectUnknownSender" ng-value="undefined"> hériter du dossier parent
- ({{parentScopeValues.rejectUnknownSender ? 'Oui' : 'Non'}})
- </label>
- </div>
<div class="form-group" ng-if="selectedMailFolder.$parent">
<label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelRejectResponseMailAddress" ng-value="false" />
@@ -385,6 +363,23 @@
<hr />
+ <div class="form-group">
+ <label class="control-label">Autoriser le transfert EDI ?</label><br />
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.ediTransfer" ng-value="true"> oui
+ </label>
+ <label class="radio-inline">
+ <input type="radio"
+ ng-model="selectedMailFolder.ediTransfer" ng-value="false"> non
+ </label>
+ <label class="radio-inline" ng-if="selectedMailFolder.$parent">
+ <input type="radio"
+ ng-model="selectedMailFolder.ediTransfer" ng-value="undefined"> hériter du dossier parent
+ ({{parentScopeValues.ediTransfer ? 'Oui' : 'Non'}})
+ </label>
+ </div>
+
<div class="form-group" ng-if="selectedMailFolder.$parent">
<label><input type="radio" ng-model="selectedMailFolder.useCurrentLevelEdiFolder" ng-value="false" />
Hériter du dossier de dépôt des demandes EDI sur le serveur :</label>
Modified: trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js
===================================================================
--- trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 14:05:34 UTC (rev 446)
+++ trunk/faxtomail-ui-web/src/main/webapp/js/configuration.js 2014-07-28 14:22:34 UTC (rev 447)
@@ -595,6 +595,7 @@
$scope.selectedMailFolder.openAttachmentReportNoTaken = $scope.selectedMailFolder.openAttachmentReportNoTaken || false;
$scope.selectedMailFolder.printActionEqualTakeAction = $scope.selectedMailFolder.printActionEqualTakeAction || false;
$scope.selectedMailFolder.rejectUnknownSender = $scope.selectedMailFolder.rejectUnknownSender || false;
+ $scope.selectedMailFolder.ediTransfer = $scope.selectedMailFolder.ediTransfer|| false;
}
// initialisation des valeurs du parent
@@ -678,6 +679,9 @@
if (angular.isUndefined($scope.parentScopeValues.rejectUnknownSender)) {
$scope.parentScopeValues.rejectUnknownSender = folder.rejectUnknownSender;
}
+ if (angular.isUndefined($scope.parentScopeValues.ediTransfer)) {
+ $scope.parentScopeValues.ediTransfer = folder.ediTransfer;
+ }
if (!$scope.parentScopeValues.faxDomain) {
$scope.parentScopeValues.faxDomain = folder.faxDomain;
}
1
0