Author: glandais Date: 2008-02-25 15:28:24 +0000 (Mon, 25 Feb 2008) New Revision: 1233 Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java trunk/simexplorer-is/src/site/fr/rst/todo.rst Log: Paginer la recherche des ?\195?\169l?\195?\169ments dont l'utilisateur est propri?\195?\169taire Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManager.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -70,12 +70,23 @@ * Gets the permissions owned by. * * @param user the user + * @param count the count + * @param indexStart the index start * * @return the permissions owned by */ - public List<Permission> getPermissionsOwnedBy(User user); - + public List<Permission> getPermissionsOwnedBy(User user, int indexStart, int count); + /** + * Gets the permissions owned by count. + * + * @param user the user + * + * @return the permissions owned by count + */ + public int getPermissionsOwnedByCount(User user); + + /** * Gets the businnes ids of elements visible by user. null means all elements. * * @param token the token Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/credentials/CredentialManagerImpl.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -187,11 +187,16 @@ * @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#getPermissionsOwnedBy(fr.cemagref.simexplorer.is.security.entities.User) */ @Override - public List<Permission> getPermissionsOwnedBy(User user) { - List<Permission> permissionsOwnedBy = daoPermission.getPermissionsOwnedBy(user); + public List<Permission> getPermissionsOwnedBy(User user, int indexStart, int count) { + List<Permission> permissionsOwnedBy = daoPermission.getPermissionsOwnedBy(user, indexStart, count); return permissionsOwnedBy; } + public int getPermissionsOwnedByCount(User user) { + int permissionsOwnedByCount = daoPermission.getPermissionsOwnedByCount(user); + return permissionsOwnedByCount; + } + /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.security.credentials.CredentialManager#getElementsVisibleBy(fr.cemagref.simexplorer.is.security.entities.User) */ Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermission.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -22,6 +22,7 @@ import fr.cemagref.simexplorer.is.security.entities.Actor; import fr.cemagref.simexplorer.is.security.entities.Permission; +import fr.cemagref.simexplorer.is.security.entities.User; /** * The Interface DaoPermission. @@ -51,12 +52,23 @@ * Gets the permissions. * * @param actor the actor + * @param count the count + * @param indexStart the index start * * @return the permissions */ - public List<Permission> getPermissionsOwnedBy(Actor actor); - + public List<Permission> getPermissionsOwnedBy(Actor actor, int indexStart, int count); + /** + * Gets the permissions owned by count. + * + * @param user the user + * + * @return the permissions owned by count + */ + public int getPermissionsOwnedByCount(Actor user); + + /** * Save permission. * * @param p the p @@ -86,5 +98,5 @@ * @return ids visible */ public List<String> getBusinessIdsVisibleBy(Collection<Actor> actors); - + } Modified: trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-security/src/java/fr/cemagref/simexplorer/is/security/dao/DaoPermissionImpl.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -28,6 +28,7 @@ import fr.cemagref.simexplorer.is.security.entities.Actor; import fr.cemagref.simexplorer.is.security.entities.Permission; +import fr.cemagref.simexplorer.is.security.entities.User; /** * The Class DaoPermissionImpl. @@ -65,13 +66,21 @@ * @see fr.cemagref.simexplorer.is.security.dao.DaoPermission#getPermissionsOwnedBy(fr.cemagref.simexplorer.is.security.entities.Actor) */ @Override - public List<Permission> getPermissionsOwnedBy(Actor actor) { + public List<Permission> getPermissionsOwnedBy(Actor actor, int indexStart, int count) { List<Permission> permissions = CollectionUtil.toGenericList(em.createQuery( "select p from Permission p where p.actor=:actor and p.owner = true").setParameter("actor", actor) - .getResultList(), Permission.class); + .setFirstResult(indexStart).setMaxResults(count).getResultList(), Permission.class); return permissions; } + public int getPermissionsOwnedByCount(Actor actor) { + Object singleResult = em.createQuery( + "select count(p) from Permission p where p.actor=:actor and p.owner = true").setParameter("actor", + actor).getSingleResult(); + int result = ((Number) singleResult).intValue(); + return result; + } + /* (non-Javadoc) * @see fr.cemagref.simexplorer.is.security.dao.DaoActor#savePermission(fr.cemagref.simexplorer.is.security.entities.Permission) */ @@ -104,8 +113,7 @@ public List<String> getBusinessIdsVisibleBy(Collection<Actor> actors) { StringBuffer query = new StringBuffer(); query.append("select p.businessId from Permission p").append( - " where (p.canRead = true or p.canAdmin = true or p.owner = true)").append( - " and p.actor in (:actors)"); + " where (p.canRead = true or p.canAdmin = true or p.owner = true)").append(" and p.actor in (:actors)"); List<String> businessIds = CollectionUtil.toGenericList(em.createQuery(query.toString()).setParameter("actors", actors).getResultList(), String.class); return businessIds; Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationService.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -40,8 +40,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public String loginUser(String login, String password) - throws SimExplorerException; + public String loginUser(String login, String password) throws SimExplorerException; /** * Request account. @@ -51,8 +50,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void requestAccount(String login, String mail) - throws SimExplorerException; + public void requestAccount(String login, String mail) throws SimExplorerException; /** * Save user. @@ -65,8 +63,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public User saveUser(String token, String login, String mail) - throws SimExplorerException; + public User saveUser(String token, String login, String mail) throws SimExplorerException; /** * Reset password. @@ -76,8 +73,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void resetPassword(String token, String login) - throws SimExplorerException; + public void resetPassword(String token, String login) throws SimExplorerException; /** * Change password. @@ -89,19 +85,17 @@ * * @throws SimExplorerException the sim explorer service exception */ -// public void changePassword(String token, String password) -// throws SimExplorerException; - + // public void changePassword(String token, String password) + // throws SimExplorerException; /** * Gets the user. - * + * * @param token the token - * @param id the id + * @param id the id * @return the user * @throws SimExplorerException the sim explorer service exception */ - public User getUser(String token, Integer id) - throws SimExplorerException; + public User getUser(String token, Integer id) throws SimExplorerException; /** * Gets the user. @@ -113,8 +107,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public User getUser(String token, String login) - throws SimExplorerException; + public User getUser(String token, String login) throws SimExplorerException; /** * Update user. @@ -126,8 +119,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public User updateUser(String token, User user) - throws SimExplorerException; + public User updateUser(String token, User user) throws SimExplorerException; /** * Delete user. @@ -137,8 +129,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void deleteUser(String token, Integer id) - throws SimExplorerException; + public void deleteUser(String token, Integer id) throws SimExplorerException; /** * Gets the users. @@ -161,8 +152,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public User[] getUsersOfGroup(String token, Group group) - throws SimExplorerException; + public User[] getUsersOfGroup(String token, Group group) throws SimExplorerException; /** * Sets the users of group. @@ -173,8 +163,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void setUsersOfGroup(String token, Group group, - Integer[] usersInGroup) throws SimExplorerException; + public void setUsersOfGroup(String token, Group group, Integer[] usersInGroup) throws SimExplorerException; /** * Sets the groups of group. @@ -185,8 +174,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) - throws SimExplorerException; + public void setGroupsOfGroup(String token, Group group, Integer[] groupsIds) throws SimExplorerException; /** * Gets the groups of user. @@ -198,8 +186,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group[] getGroupsOfUser(String token, User user) - throws SimExplorerException; + public Group[] getGroupsOfUser(String token, User user) throws SimExplorerException; /** * Gets the groups of group. @@ -211,8 +198,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group[] getGroupsOfGroup(String token, Group group) - throws SimExplorerException; + public Group[] getGroupsOfGroup(String token, Group group) throws SimExplorerException; /** * Sets the groups of user. @@ -223,8 +209,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void setGroupsOfUser(String token, User user, Integer[] groupsIds) - throws SimExplorerException; + public void setGroupsOfUser(String token, User user, Integer[] groupsIds) throws SimExplorerException; /** * Save group. @@ -236,8 +221,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group saveGroup(String token, String name) - throws SimExplorerException; + public Group saveGroup(String token, String name) throws SimExplorerException; /** * Gets the group. @@ -249,8 +233,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group getGroup(String token, Integer id) - throws SimExplorerException; + public Group getGroup(String token, Integer id) throws SimExplorerException; /** * Gets the group. @@ -262,8 +245,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group getGroup(String token, String name) - throws SimExplorerException; + public Group getGroup(String token, String name) throws SimExplorerException; /** * Update group. @@ -275,8 +257,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group updateGroup(String token, Group group) - throws SimExplorerException; + public Group updateGroup(String token, Group group) throws SimExplorerException; /** * Delete group. @@ -286,8 +267,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public void deleteGroup(String token, Integer id) - throws SimExplorerException; + public void deleteGroup(String token, Integer id) throws SimExplorerException; /** * Gets the groups. @@ -310,8 +290,7 @@ * * @throws SimExplorerException the sim explorer service exception */ - public Group[] getGroupsOwnedBy(String token, User user) - throws SimExplorerException; + public Group[] getGroupsOwnedBy(String token, User user) throws SimExplorerException; /** * Gets the logged user. @@ -332,16 +311,28 @@ * * @return the elements owned by */ - public String[] getElementsOwnedBy(String token, User user); - + public int getElementsOwnedByCount(String token, User user); + /** + * Gets the elements owned by. + * + * @param token the token + * @param user the user + * @param indexStart the index start + * @param count the count + * + * @return the elements owned by + */ + public String[] getElementsOwnedBy(String token, User user, int indexStart, int count); + + /** * Gets the permissions. * * @param uuid the uuid * @param token the token * * @return the permissions - * @throws SimExplorerException + * @throws SimExplorerException */ public Permission[] getPermissions(String token, String uuid) throws SimExplorerException; @@ -351,9 +342,8 @@ * @param uuid the uuid * @param permissions the permissions * @param token the token - * @throws SimExplorerException + * @throws SimExplorerException */ public void setPermissions(String token, String uuid, Permission[] permissions) throws SimExplorerException; - } Modified: trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-service/src/java/fr/cemagref/simexplorer/is/service/AuthenticationServiceImpl.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -777,13 +777,17 @@ * @see fr.cemagref.simexplorer.is.service.AuthenticationService#getElementsOwnedBy(java.lang.String, fr.cemagref.simexplorer.is.security.entities.User) */ @Override - public String[] getElementsOwnedBy(String token, User user) { + public String[] getElementsOwnedBy(String token, User user, int indexStart, int count) { List<String> uuids = new ArrayList<String>(); - List<Permission> permissions = credentialManager.getPermissionsOwnedBy(user); + List<Permission> permissions = credentialManager.getPermissionsOwnedBy(user, indexStart, count); for (Permission permission : permissions) { uuids.add(permission.getBusinessId()); } return uuids.toArray(new String[uuids.size()]); } + public int getElementsOwnedByCount(String token, User user) { + return credentialManager.getPermissionsOwnedByCount(user); + } + } Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -22,7 +22,9 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.exceptions.SimExplorerException; +import fr.cemagref.simexplorer.is.security.entities.User; import fr.cemagref.simexplorer.is.storage.SearchColumn; +import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; /** @@ -32,18 +34,42 @@ */ public class ElementDataSource implements GridDataSource { + /** + * The Enum ElementListType. + */ + public enum ElementListType { + + /** The Application list. */ + ApplicationList, + + /** The Search query. */ + SearchQuery, + + /** The Elements owned by. */ + ElementsOwnedBy; + } + + /** The element list type. */ + private ElementListType elementListType; + /** Query being searched. */ - private String query = ""; + private String searchQuery = ""; /** Query being searched. */ private SearchColumn searchColumn = SearchColumn.AllFields; + /** The user. */ + private User user; + /** Bookmark on first item index. */ private int indexStart = 0; /** Cached entities. */ private MetaData[] entities = null; + /** The elements owned by. */ + private String[] elementsOwnedBy = null; + /** Authentification token. */ private String token; @@ -51,14 +77,12 @@ * Build datasource with text query. * * @param token the token - * @param query the query - * @param searchColumn the search column + * @param elementListType the element list type */ - public ElementDataSource(String token, String query, SearchColumn searchColumn) { + public ElementDataSource(String token, ElementListType elementListType) { super(); - this.query = query; + this.elementListType = elementListType; this.token = token; - this.searchColumn = searchColumn; } /* (non-Javadoc) @@ -67,11 +91,20 @@ public int getAvailableRows() { int result; try { - if (query == null) { + switch (elementListType) { + case ApplicationList: result = RemoteStorageService.getStorageService().findApplicationsCount(token, true); - } else { - result = RemoteStorageService.getStorageService().findFullTextCount(token, query, + break; + case SearchQuery: + result = RemoteStorageService.getStorageService().findFullTextCount(token, searchQuery, searchColumn.toString(), false); + break; + case ElementsOwnedBy: + result = RemoteSecurityService.getAuthentificationService().getElementsOwnedByCount(token, user); + break; + default: + result = 0; + break; } } catch (SimExplorerException e) { throw new RuntimeException(e); @@ -90,6 +123,16 @@ * @see org.apache.tapestry.grid.GridDataSource#getRowValue(int)token */ public Object getRowValue(int index) { + if (elementListType == ElementListType.ElementsOwnedBy) { + MetaData metadata = null; + try { + metadata = RemoteStorageService.getStorageService().getMetadata(token, + elementsOwnedBy[index - indexStart]); + } catch (Exception e) { + metadata = null; + } + return metadata; + } return entities[index - indexStart]; } @@ -104,17 +147,61 @@ if (sortModel != null) { sortColumn = sortModel.getPropertyName(); } - - if (query == null) { + switch (elementListType) { + case ApplicationList: entities = RemoteStorageService.getStorageService().findApplications(token, true, startIndex, 1 + endIndex - startIndex, sortColumn, ascending); - } else { - entities = RemoteStorageService.getStorageService().findFullText(token, query, searchColumn.toString(), - false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending); + break; + case SearchQuery: + entities = RemoteStorageService.getStorageService().findFullText(token, searchQuery, + searchColumn.toString(), false, startIndex, 1 + endIndex - startIndex, sortColumn, ascending); + break; + case ElementsOwnedBy: + elementsOwnedBy = RemoteSecurityService.getAuthentificationService().getElementsOwnedBy(token, user, + startIndex, 1 + endIndex - startIndex); + break; + default: + break; } } catch (SimExplorerException e) { throw new RuntimeException(e); } } + /** + * Gets the element list type. + * + * @return the element list type + */ + public ElementListType getElementListType() { + return elementListType; + } + + /** + * Sets the search query. + * + * @param searchQuery the new search query + */ + public void setSearchQuery(String searchQuery) { + this.searchQuery = searchQuery; + } + + /** + * Sets the search column. + * + * @param searchColumn the new search column + */ + public void setSearchColumn(SearchColumn searchColumn) { + this.searchColumn = searchColumn; + } + + /** + * Sets the user. + * + * @param user the new user + */ + public void setUser(User user) { + this.user = user; + } + } Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -34,7 +34,7 @@ import fr.cemagref.simexplorer.is.storage.SearchColumn; import fr.cemagref.simexplorer.is.ui.web.components.SimGrid; import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; -import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; +import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource.ElementListType; import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; import fr.cemagref.simexplorer.is.ui.web.tools.ModelFactory; @@ -114,7 +114,18 @@ * @return the elements */ public ElementDataSource getElements() { - return new ElementDataSource(getToken(), this.query, this.searchColumn); + ElementListType listType = ElementListType.SearchQuery; + if (this.query == null) { + listType = ElementListType.ApplicationList; + } else { + listType = ElementListType.SearchQuery; + } + ElementDataSource elementDataSource = new ElementDataSource(getToken(), listType); + if (this.query != null) { + elementDataSource.setSearchQuery(this.query); + elementDataSource.setSearchColumn(this.searchColumn); + } + return elementDataSource; } /** Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -36,6 +36,8 @@ import fr.cemagref.simexplorer.is.exceptions.SimExplorerException; import fr.cemagref.simexplorer.is.security.entities.Group; import fr.cemagref.simexplorer.is.security.entities.User; +import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; +import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource.ElementListType; import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage; import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; @@ -188,20 +190,10 @@ * * @throws SimExplorerException the sim explorer exception */ - public List<MetaData> getElementsOwnedBy() throws SimExplorerException { - List<MetaData> metadatas = new ArrayList<MetaData>(); - - String[] elementsOwnedBy = RemoteSecurityService.getAuthentificationService().getElementsOwnedBy(getToken(), - user); - - for (int i = 0; i < elementsOwnedBy.length; i++) { - MetaData metadata = RemoteStorageService.getStorageService().getMetadata(getToken(), elementsOwnedBy[i]); - if (metadata != null) { - metadatas.add(metadata); - } - } - - return metadatas; + public ElementDataSource getElementsOwnedBy() throws SimExplorerException { + ElementDataSource elementDataSource = new ElementDataSource(getToken(), ElementListType.ElementsOwnedBy); + elementDataSource.setUser(user); + return elementDataSource; } /** Modified: trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java =================================================================== --- trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ModelFactory.java 2008-02-25 15:28:24 UTC (rev 1233) @@ -45,12 +45,12 @@ * * @param beanModelSource the bean model source * @param resources the resources - * @param dateSortable the date sortable + * @param sortable the sortable * * @return the meta data model */ public static BeanModel getMetaDataModel(BeanModelSource beanModelSource, ComponentResources resources, - boolean dateSortable) { + boolean sortable) { BeanModel model = beanModelSource.create(MetaData.class, false, resources); List<String> wantedProperties = new ArrayList<String>(); wantedProperties.add("uuid"); @@ -61,6 +61,9 @@ wantedProperties.add("elementClassLabel"); List<String> properties = model.getPropertyNames(); for (String property : properties) { + if (!sortable) { + model.get(property).sortable(false); + } if (!wantedProperties.contains(property)) { model = model.remove(property); } Modified: trunk/simexplorer-is/src/site/fr/rst/todo.rst =================================================================== --- trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-25 14:15:49 UTC (rev 1232) +++ trunk/simexplorer-is/src/site/fr/rst/todo.rst 2008-02-25 15:28:24 UTC (rev 1233) @@ -36,7 +36,6 @@ - Application web - * (NOK) [2] Recherche sur différents critères * (NOK) Création d'une page d'administration des droits : + Filtre sur le propriétaire via un utilisateur ou un groupe (pour les administrateurs) @@ -54,7 +53,6 @@ ----- [1] Un élément peut avoir plusieurs propriétaires, une personne écrivant un nouvelle version est ajouté à cette liste -> OK - [2] Recherche full text sur tous les champs -> envoyer mail [3] L'élément conserve son id si l'utilisateur a les droits d'écriture, sinon un nouvel élément est créé. [4] Un élément peut être supprimer si, et seulement si, l'élement n'est utilisé que par un autre élément au maximum, qui sera lui aussi supprimé selon les même rêgles. Les éléments supprimés sont tous les enfants (quelque soit le niveau), qui n'ont qu'un seul parent. @@ -82,7 +80,6 @@ égaux, vérifier que les données sont effectivement égales - ( OK) Filtrage des listes en fonction des droits (implémentation d'un Filter Lucene, conservation de l'indépendance du stockage et de la sécurité) - - (NOK) Paginer la recherche des éléments dont l'utilisateur est propriétaire - ( OK) Gestion du tri sur toutes les colonnes pour les recherches - (NOK) Créer les interfaces accessibles via d'autres protocoles que RMI (WebService, CORBA).