Author: tchemit Date: 2011-11-09 20:41:58 +0100 (Wed, 09 Nov 2011) New Revision: 32 Url: http://forge.codelutin.com/repositories/revision/echobase/32 Log: use new Pager object (should be pushed to nuiton-utils) + new filter Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseTopiaTransactionFilter.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/AbstractJSONPaginedAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsers.java Removed: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersDatas.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml trunk/echobase-ui/src/main/resources/config/struts-json.xml trunk/echobase-ui/src/main/resources/config/struts-user.xml trunk/echobase-ui/src/main/resources/struts.xml trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2011-11-09 19:41:58 UTC (rev 32) @@ -35,6 +35,8 @@ import fr.ifremer.echobase.entities.meta.TableMeta; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.persistence.TopiaDAO; @@ -55,29 +57,39 @@ */ public class DbEditorService extends AbstractEchoBaseService { + /** Logger. */ + private static final Log log = LogFactory.getLog(DbEditorService.class); + + protected DecoratorService decoratorService; + + protected DecoratorService getDecoratorService() { + if (decoratorService == null) { + + decoratorService = serviceContext.newService(DecoratorService.class); + } + return decoratorService; + } + public static class ResultDatas { /** Total count. */ int count; /** Loaded datas (for the given asked page). */ - Map[] rows; + Map<?, ?>[] rows; + public ResultDatas(int count, Map<?, ?>[] rows) { + this.count = count; + this.rows = rows; + } + public int getCount() { return count; } - public void setCount(int count) { - this.count = count; - } - public Map[] getRows() { return rows; } - - public void setRows(Map[] rows) { - this.rows = rows; - } } public TableMeta getTableMetas(String tableName) { @@ -86,10 +98,9 @@ return result; } - //TODO Use an object to filter datas and do pagination + //TODO Use an object to filter datas public ResultDatas getDatas(String tableName, - int from, - int to, + Pager pager, String sidx, Boolean ascendantOrder) { @@ -99,7 +110,27 @@ Class<? extends TopiaEntity> contract = entityEnum.getContract(); try { TopiaDAO dao = EchoBaseDAOHelper.getDAO(getTransaction(), contract); - ResultDatas result = new ResultDatas(); + + // first query to count datas + TopiaQuery countQuery = dao.createQuery("e"); + countQuery.addSelect("count(*)"); + int count = dao.countByQuery(countQuery); + + pager.setRecords(count); + pager.computeIndexesAndPageCount(); + + int from = pager.getStartIndex(); + int to = pager.getEndIndex(); + + if (log.isInfoEnabled()) { + log.info("Count = " + count); + log.info("page = " + pager.getPageNumber()); + log.info("pageSize = " + pager.getPageSize()); + log.info("from = " + from); + log.info("to = " + to); + log.info("pageCount= " + pager.getPageCount()); + } + TopiaQuery query = dao.createQuery("e"); if (StringUtils.isNotEmpty(sidx)) { if (ascendantOrder) { @@ -108,22 +139,17 @@ query.addOrderDesc(sidx); } } + query.setLimit(from, to - 1); List<?> all = dao.findAllByQuery(query); - int count = all.size(); - if (count < to) { - to = count; - } - Map[] rows = new Map[to - from]; + Map<?, ?>[] rows = new Map[to - from]; - int j = 0; - for (int i = from; i < to; i++) { - TopiaEntity entity = (TopiaEntity) all.get(i); + int i = 0; + for (Object o : all) { + TopiaEntity entity = (TopiaEntity) o; Map<String, Object> row = loadRow(tableMeta, entity); - rows[j++] = row; + rows[i++] = row; } - - result.setCount(all.size()); - result.setRows(rows); + ResultDatas result = new ResultDatas(count, rows); return result; } catch (TopiaException eee) { throw new EchoBaseTechnicalException("Could not obtain data", eee); @@ -197,7 +223,6 @@ } finally { monitor.setBean(null); } - } protected Map<String, Object> loadRow(TableMeta tableMeta, TopiaEntity entity) { @@ -207,8 +232,24 @@ row.put("id", entity.getTopiaId()); for (ColumnMeta columnMeta : tableMeta) { String propertyName = columnMeta.getName(); - Object property = - operator.get(propertyName, entity); + + // get property value + Object property = operator.get(propertyName, entity); + if (columnMeta.isFK() && property != null) { + + // this is a foreign key, just keep the topiaid + String topiaId = ((TopiaEntity) property).getTopiaId(); + + // decorate the entity + String decorate = getDecoratorService().decorate( + getLocale(), property, null); + + // keep the decorate value + row.put(propertyName + "_lib", decorate); + + // use as the property his topiaid + property = topiaId; + } row.put(propertyName, property); } return row; Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,124 @@ +/* + * #%L + * EchoBase :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.services; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import fr.ifremer.echobase.entities.EchoBaseUser; +import org.apache.commons.collections.CollectionUtils; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.util.decorator.Decorator; +import org.nuiton.util.decorator.DecoratorMulti18nProvider; +import org.nuiton.util.decorator.DecoratorUtil; +import org.nuiton.util.decorator.JXPathDecorator; + +import java.util.Collection; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** + * Service to decorate entities. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class DecoratorService extends AbstractEchoBaseService { + + protected final DecoratorMulti18nProvider decoratorProvider; + + public DecoratorService() { + decoratorProvider = new EchoBaseDecoratorProvider(); + } + + public <O> Decorator<O> getDecorator(Locale locale, + Class<O> type, + String context) { + Preconditions.checkNotNull(type, "Decorator type can not be null!"); + Decorator<O> decorator = decoratorProvider.getDecoratorByType(locale, type, context); + Preconditions.checkNotNull( + decorator, + "Could not find decorator for type " + type + + " and context " + context + ); + return decorator; + } + + public String decorate(Locale locale, Object o, String context) { + Decorator<?> decorator = getDecorator(locale, o.getClass(), context); + String result = decorator.toString(o); + return result; + } + + public <O> List<O> sortToList(Locale locale, Collection<O> beans, String context) { + Preconditions.checkNotNull(beans); + List<O> list = Lists.newArrayList(beans); + getDecoratorAndSort(locale, context, list); + return list; + } + + public <E extends TopiaEntity> Map<String, String> sortAndDecorate(Locale locale, + Collection<E> beans, + String context) { + Preconditions.checkNotNull(beans); + List<E> list = Lists.newArrayList(beans); + + Decorator<E> decorator = getDecoratorAndSort(locale, context, list); + Map<String, String> result = Maps.newLinkedHashMap(); + for (E bean : list) { + result.put(bean.getTopiaId(), decorator.toString(bean)); + } + return result; + } + + protected <O> Decorator<O> getDecoratorAndSort(Locale locale, + String context, + List<O> list) { + Decorator<O> decorator = null; + if (CollectionUtils.isNotEmpty(list)) { + O object = list.get(0); + Preconditions.checkNotNull(object); + decorator = decoratorProvider.getDecorator(locale, object, context); + Preconditions.checkNotNull( + decorator, + "Could not find decorator for type " + object.getClass() + + " and context " + context + ); + DecoratorUtil.sort((JXPathDecorator<O>) decorator, list, 0); + } + return decorator; + } + + static class EchoBaseDecoratorProvider extends DecoratorMulti18nProvider { + + @Override + protected void loadDecorators(Locale locale) { + + // trip decorator + registerJXPathDecorator(locale, EchoBaseUser.class, "${email}$s"); + + } + } +} Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DecoratorService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,109 @@ +/* + * #%L + * EchoBase :: Services + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.services; + +import org.apache.commons.lang3.tuple.Pair; +import org.nuiton.util.PagerUtil; + +import java.io.Serializable; + +/** + * A simple pager bean. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Pager implements Serializable { + + private static final long serialVersionUID = 1L; + + protected int records; + + protected int startIndex; + + protected int endIndex; + + protected int pageNumber; + + protected int pageSize; + + protected int pageCount; + + public int getRecords() { + return records; + } + + public int getStartIndex() { + return startIndex; + } + + public int getEndIndex() { + return endIndex; + } + + public int getPageNumber() { + return pageNumber; + } + + public int getPageSize() { + return pageSize; + } + + public int getPageCount() { + return pageCount; + } + + public void setRecords(int records) { + this.records = records; + } + + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + public void setEndIndex(int endIndex) { + this.endIndex = endIndex; + } + + public void setPageNumber(int pageNumber) { + this.pageNumber = pageNumber; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public void setPageCount(int pageCount) { + this.pageCount = pageCount; + } + + public void computeIndexesAndPageCount() { + Pair<Integer, Integer> pageBound = + PagerUtil.getPageBound(records, pageNumber, pageSize); + startIndex = pageBound.getLeft(); + endIndex = pageBound.getRight(); + pageCount = PagerUtil.getTotalPage(records, pageSize); + } + +} Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/Pager.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-09 19:41:58 UTC (rev 32) @@ -31,6 +31,7 @@ import fr.ifremer.echobase.entities.EchoBaseUserDTO; import org.apache.commons.lang3.StringUtils; import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.util.StringUtil; import java.util.List; @@ -42,8 +43,27 @@ public class UserService extends AbstractEchoBaseService { public List<EchoBaseUser> getUsers() { + return getUsers(null); + } + + public List<EchoBaseUser> getUsers(Pager pager) { try { - List<EchoBaseUser> users = getDAO().findAll(); + List<EchoBaseUser> users; + + EchoBaseUserDAO dao = getDAO(); + if (pager == null) { + + users = dao.findAll(); + } else { + + // get user count + long count = dao.count(); + pager.setRecords((int) count); + pager.computeIndexesAndPageCount(); + TopiaQuery query = dao.createQuery("e"); + query.setLimit(pager.getStartIndex(), pager.getEndIndex() - 1); + users = dao.findAllByQuery(query); + } return users; } catch (TopiaException eee) { throw new EchoBaseTechnicalException(eee); Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseTopiaTransactionFilter.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseTopiaTransactionFilter.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseTopiaTransactionFilter.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,66 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui; + +import com.google.common.base.Supplier; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaRuntimeException; +import org.nuiton.web.filter.TopiaTransactionFilter; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EchoBaseTopiaTransactionFilter extends TopiaTransactionFilter { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(EchoBaseTopiaTransactionFilter.class); + + @Override + protected TopiaContext beginTransaction() throws TopiaRuntimeException { + EchoBaseApplicationContext applicationContext = + EchoBaseActionSupport.getEchoBaseApplicationContext(); + Supplier<TopiaContext> rootContextSupplier = + applicationContext.getRootContextSupplier(); + + TopiaContext rootContext = rootContextSupplier.get(); + TopiaContext transaction = null; + try { + transaction = rootContext.beginTransaction(); + } catch (TopiaException eee) { + throw new TopiaRuntimeException("Could not start transaction", eee); + } + if (log.isDebugEnabled()) { + log.debug("Starts a new echo transaction " + transaction); + } + return transaction; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseTopiaTransactionFilter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-09 19:41:58 UTC (rev 32) @@ -31,10 +31,13 @@ import fr.ifremer.echobase.services.EchoBaseServiceFactory; import fr.ifremer.echobase.ui.EchoBaseApplicationContext; import fr.ifremer.echobase.ui.EchoBaseSession; +import org.apache.struts2.StrutsStatics; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.framework.TopiaTransactionAware; +import org.nuiton.web.filter.TopiaTransactionFilter; import org.nuiton.web.struts2.BaseAction; +import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; @@ -54,9 +57,6 @@ private static final long serialVersionUID = 1L; - public static final String LOG_LINE = - "--------------------------------------------------------------------------------"; - /** Key to store the {@link EchoBaseSession} instance in the session's map. */ protected static final String SESSION_PARAMETER = "echoBaseSession"; @@ -68,7 +68,7 @@ private SimpleDateFormat monthFormat; public static EchoBaseApplicationContext getEchoBaseApplicationContext() { - Map<String, Object> application = ActionContext.getContext().getApplication(); + Map<String, Object> application = getActionContext().getApplication(); EchoBaseApplicationContext applicationContext = (EchoBaseApplicationContext) application.get(APPLICATION_CONTEXT_PARAMETER); return applicationContext; @@ -87,8 +87,7 @@ * Actions may <strong>not</strong> call it directly by use * {@link #newService(Class)} instead. */ - protected transient EchoBaseServiceFactory serviceFactory = - new EchoBaseServiceFactory(); + protected transient EchoBaseServiceFactory serviceFactory; protected transient EchoBaseServiceContext serviceContext; @@ -98,7 +97,8 @@ if (echoBaseSession == null) { // load it from session - Map<String, Object> strutsSession = ActionContext.getContext().getSession(); + Map<String, Object> strutsSession = + getActionContext().getSession(); EchoBaseSession session = (EchoBaseSession) strutsSession.get(SESSION_PARAMETER); @@ -132,12 +132,19 @@ getTransaction(), getConfiguration(), getEchoBaseApplicationContext().getDbMeta(), - serviceFactory + getServiceFactory() ); } return serviceContext; } + public EchoBaseServiceFactory getServiceFactory() { + if (serviceFactory == null) { + serviceFactory = new EchoBaseServiceFactory(); + } + return serviceFactory; + } + /** * Sub-classes should use this method to easily get a service instance. * @@ -145,12 +152,18 @@ * @return A newly created service of the expected type with necessary data set */ public <E extends EchoBaseService> E newService(Class<E> serviceClass) { - E service = serviceFactory.newService(serviceClass, getServiceContext()); + E service = getServiceFactory().newService(serviceClass, + getServiceContext()); return service; } @Override public TopiaContext getTransaction() { + if (transaction == null) { + HttpServletRequest request = (HttpServletRequest) + getActionContext().get(StrutsStatics.HTTP_REQUEST); + transaction = TopiaTransactionFilter.getTransaction(request); + } return transaction; } @@ -183,4 +196,7 @@ return monthFormat; } + protected static ActionContext getActionContext() { + return ActionContext.getContext(); + } } Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2011-11-09 19:41:58 UTC (rev 32) @@ -1,220 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.actions.dbeditor; - -import fr.ifremer.echobase.services.DbEditorService; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.json.JSONUtil; - -import java.util.Map; - -/** - * To obtain the data for the given request. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class GetEntities extends EchoBaseActionSupport { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = LogFactory.getLog(GetEntities.class); - - private static final String SIDX_PREFIX = "tableDatas_"; - - /** Name of the table to load. */ - protected String tableName; - - /** Datas of the given table. */ - protected Map<?,?>[] datas; - - //get how many rows we want to have into the grid - rowNum attribute in the grid - protected Integer rows = 0; - - //Get the requested page. By default grid sets this to 1. - protected Integer page = 0; - - // sorting order - asc or desc - protected String sord; - - // get index row - i.e. user click to sort. - protected String sidx; - - // Search Field - protected String searchField; - - // The Search String - protected String searchString; - - // he Search Operation ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'] - protected String searchOper; - - protected String filters; - - // Your Total Pages - protected Integer total = 0; - - // All Record - protected Integer records = 0; - - public Map<?,?>[] getDatas() { - return datas; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - @Override - public String execute() throws Exception { - DbEditorService dbEditorService = newService(DbEditorService.class); - - int to = rows * page; - int from = to - rows; - - Boolean ascendantOrder = null; - - if (StringUtils.isNotEmpty(sidx)) { - - // there is a sort to do - sidx = sidx.substring(SIDX_PREFIX.length()); - - ascendantOrder = "asc".equals(sord); - } - - Object filterObject = null; - - - if (StringUtils.isNotEmpty(filters)) { - filterObject = JSONUtil.deserialize(filters); - } - - if (log.isInfoEnabled()) { - log.info("searchField = " + searchField); - log.info("searchField = " + searchField); - log.info("searchString = " + searchString); - log.info("searchOper = " + searchOper); - log.info("filters = " + filters); - log.info("filterObject = " + filterObject); - log.info("sidx = " + sidx); - log.info("sord = " + sord); - } - - DbEditorService.ResultDatas resultDatas = - dbEditorService.getDatas(tableName, from, to, sidx, ascendantOrder); - - datas = resultDatas.getRows(); - - records = resultDatas.getCount(); - - //calculate the total pages for the query - total = (int) Math.ceil((double) records / (double) rows); - - return SUCCESS; - } - - public Integer getRows() { - return rows; - } - - public void setRows(Integer rows) { - this.rows = rows; - } - - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public String getSord() { - return sord; - } - - public void setSord(String sord) { - this.sord = sord; - } - - public String getSidx() { - return sidx; - } - - public void setSidx(String sidx) { - this.sidx = sidx; - } - - public String getSearchField() { - return searchField; - } - - public void setSearchField(String searchField) { - this.searchField = searchField; - } - - public String getSearchString() { - return searchString; - } - - public void setSearchString(String searchString) { - this.searchString = searchString; - } - - public String getSearchOper() { - return searchOper; - } - - public void setSearchOper(String searchOper) { - this.searchOper = searchOper; - } - - public Integer getTotal() { - return total; - } - - public void setTotal(Integer total) { - this.total = total; - } - - public Integer getRecords() { - return records; - } - - public void setRecords(Integer records) { - this.records = records; - } - - public String getFilters() { - return filters; - } - - public void setFilters(String filters) { - this.filters = filters; - } -} Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/AbstractJSONPaginedAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/AbstractJSONPaginedAction.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/AbstractJSONPaginedAction.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,138 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.json; + +import fr.ifremer.echobase.services.Pager; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.apache.commons.lang.StringUtils; +import org.apache.struts2.json.JSONException; +import org.apache.struts2.json.JSONUtil; + +/** + * Abstract JSON action with pagination support. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public abstract class AbstractJSONPaginedAction extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + public abstract Integer getRows(); + + public abstract Integer getPage(); + + public abstract Integer getTotal(); + + public abstract Integer getRecords(); + + protected Pager pager = new Pager(); + +// //get how many rows we want to have into the grid - rowNum attribute in the grid +// protected Integer rows = 0; +// +// //Get the requested page. By default grid sets this to 1. +// protected Integer page = 0; + + // sorting order - asc or desc + protected String sord; + + // get index row - i.e. user click to sort. + protected String sidx; + + protected String filters; + +// // Your Total Pages +// protected Integer total = 0; +// +// // All Record +// protected Integer records = 0; + + /** Prefix added to the sidx when used. */ + protected final String sidx_prefix; + + protected AbstractJSONPaginedAction(String sidx_prefix) { + this.sidx_prefix = sidx_prefix; + } + + public void setRows(Integer rows) { + pager.setPageSize(rows); + } + + public void setPage(Integer page) { + pager.setPageNumber(page); + } + + public String getSord() { + return sord; + } + + public void setSord(String sord) { + this.sord = sord; + } + + public String getSidx() { + return sidx; + } + + public void setSidx(String sidx) { + this.sidx = sidx; + } + + public String getFilters() { + return filters; + } + + public void setFilters(String filters) { + this.filters = filters; + } + + protected String getSortColumn() { + String result = null; + if (useSort()) { + result = sidx.substring(sidx_prefix.length()); + } + return result; + } + + protected Boolean isSortAscendant() { + Boolean result = null; + if (useSort()) { + result = "asc".equals(sord); + } + return result; + } + + protected boolean useSort() { + return StringUtils.isNotEmpty(sidx); + } + + protected Object getFilterObject() throws JSONException { + Object filterObject = null; + if (StringUtils.isNotEmpty(filters)) { + filterObject = JSONUtil.deserialize(filters); + } + return filterObject; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/AbstractJSONPaginedAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetEntities.java (from rev 30, trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java) =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetEntities.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetEntities.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,116 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.json; + +import fr.ifremer.echobase.services.DbEditorService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Map; + +/** + * To obtain the data for the given request. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class GetEntities extends AbstractJSONPaginedAction { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(GetEntities.class); + + /** Name of the table to load. */ + protected String tableName; + + /** Datas of the given table. */ + protected Map<?, ?>[] datas; + + public GetEntities() { + super("tableDatas_"); + } + + public Map<?, ?>[] getDatas() { + return datas; + } + + @Override + public Integer getRows() { + return pager.getPageSize(); + } + + @Override + public Integer getPage() { + return pager.getPageNumber(); + } + + @Override + public Integer getTotal() { + return pager.getPageCount(); + } + + @Override + public Integer getRecords() { + return pager.getRecords(); + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + @Override + public String execute() throws Exception { + + Boolean ascendantOrder = isSortAscendant(); + String sortColumn = getSortColumn(); + Object filterObject = getFilterObject(); + + if (log.isInfoEnabled()) { + log.info("filters = " + getFilters()); + log.info("filterObject = " + filterObject); + log.info("sidx = " + sortColumn); + log.info("sord = " + ascendantOrder); + } + + DbEditorService dbEditorService = newService(DbEditorService.class); + + DbEditorService.ResultDatas resultDatas = dbEditorService.getDatas( + tableName, + pager, + sortColumn, + ascendantOrder + ); + + datas = resultDatas.getRows(); + + if (log.isInfoEnabled()) { + log.info("Total page = " + getTotal()); + } + + return SUCCESS; + } + + +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetEntities.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsers.java (from rev 25, trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersDatas.java) =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsers.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsers.java 2011-11-09 19:41:58 UTC (rev 32) @@ -0,0 +1,87 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.json; + +import fr.ifremer.echobase.entities.EchoBaseUser; +import fr.ifremer.echobase.entities.EchoBaseUserDTO; +import fr.ifremer.echobase.services.UserService; + +import java.util.ArrayList; +import java.util.List; + +/** + * Obtains all users of the echobase internal database. + * + * @author sletellier <letellier@codelutin.com> + * @since 0.1 + */ +public class GetUsers extends AbstractJSONPaginedAction { + + private static final long serialVersionUID = 1L; + + protected List<EchoBaseUserDTO> users; + + public GetUsers() { + super("users_"); + } + + public List<EchoBaseUserDTO> getUsers() { + return users; + } + + @Override + public Integer getRows() { + return pager.getPageSize(); + } + + @Override + public Integer getPage() { + return pager.getPageNumber(); + } + + @Override + public Integer getTotal() { + return pager.getPageCount(); + } + + @Override + public Integer getRecords() { + return pager.getRecords(); + } + + @Override + public String execute() throws Exception { + + List<EchoBaseUser> allUsers = + newService(UserService.class).getUsers(pager); + + users = new ArrayList<EchoBaseUserDTO>(allUsers.size()); + for (EchoBaseUser user : allUsers) { + users.add(user.toDTO()); + } + + return SUCCESS; + } + +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsers.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersDatas.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersDatas.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersDatas.java 2011-11-09 19:41:58 UTC (rev 32) @@ -1,63 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.actions.json; - -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.entities.EchoBaseUserDTO; -import fr.ifremer.echobase.services.UserService; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; - -import java.util.ArrayList; -import java.util.List; - -/** - * Obtains all users of the echobase internal database. - * - * @author sletellier <letellier@codelutin.com> - * @since 0.1 - */ -public class GetUsersDatas extends EchoBaseActionSupport { - - private static final long serialVersionUID = 1L; - - protected List<EchoBaseUserDTO> users; - - public List<EchoBaseUserDTO> getUsers() { - return users; - } - - @Override - public String execute() throws Exception { - - List<EchoBaseUser> allUsers = newService(UserService.class).getUsers(); - - users = new ArrayList<EchoBaseUserDTO>(allUsers.size()); - for (EchoBaseUser user : allUsers) { - users.add(user.toDTO()); - } - - return SUCCESS; - } - -} Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2011-11-09 19:41:58 UTC (rev 32) @@ -26,6 +26,7 @@ import com.opensymphony.xwork2.ActionInvocation; import fr.ifremer.echobase.ui.EchoBaseSession; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import fr.ifremer.echobase.ui.actions.LoginAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -60,6 +61,29 @@ boolean userLoggued = echoBaseSession.getEchoBaseUser() != null; if (!userLoggued) { + + boolean autoLogin = + EchoBaseActionSupport.getEchoBaseApplicationContext().getConfiguration().getOptionAsBoolean("autoLogin"); + + if (autoLogin) { + // by-pass login + + if (log.isInfoEnabled()) { + log.info("AutotLogin with admin/admin user"); + } + LoginAction loginAction = new LoginAction(); + loginAction.setSession(invocation.getInvocationContext().getSession()); + loginAction.setEmail("admin"); + loginAction.setPassword("admin"); + try { + loginAction.doLogin(); + } catch (Exception eee) { + if (log.isErrorEnabled()) { + log.error("Could not auto-login", eee); + } + } + return true; + } if (log.isInfoEnabled()) { log.info("No user loggued!"); } Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java 2011-11-09 19:41:58 UTC (rev 32) @@ -1,64 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.interceptors; - -import com.google.common.base.Supplier; -import fr.ifremer.echobase.ui.EchoBaseApplicationContext; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaException; -import org.nuiton.web.struts2.interceptor.OpenTopiaTransactionInterceptor; - -/** - * Implementation of the {@link OpenTopiaTransactionInterceptor} giving how to - * create a new topia transaction on a EchoBase database. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class EchoBaseTransactionInterceptorImpl extends OpenTopiaTransactionInterceptor { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(EchoBaseTransactionInterceptorImpl.class); - - @Override - protected TopiaContext beginTransaction() throws TopiaException { - EchoBaseApplicationContext applicationContext = - EchoBaseActionSupport.getEchoBaseApplicationContext(); - Supplier<TopiaContext> rootContextSupplier = - applicationContext.getRootContextSupplier(); - - TopiaContext rootContext = rootContextSupplier.get(); - TopiaContext transaction = rootContext.beginTransaction(); - if (log.isDebugEnabled()) { - log.debug("Starts a new echo transaction " + transaction); - } - return transaction; - } -} Modified: trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2011-11-09 19:41:58 UTC (rev 32) @@ -38,7 +38,7 @@ </action> <action name="getTableDatas" - class="fr.ifremer.echobase.ui.actions.dbeditor.GetEntities"> + class="fr.ifremer.echobase.ui.actions.json.GetEntities"> <interceptor-ref name="basicStackLoggued"/> <result type="json"/> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-json.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-json.xml 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/resources/config/struts-json.xml 2011-11-09 19:41:58 UTC (rev 32) @@ -32,7 +32,7 @@ <package name="json" extends="loggued" namespace="/json"> <action name="getUsers" - class="fr.ifremer.echobase.ui.actions.json.GetUsersDatas"> + class="fr.ifremer.echobase.ui.actions.json.GetUsers"> <interceptor-ref name="basicStackLoggued"/> <interceptor-ref name="checkUserIsAdmin"/> <result type="json"/> Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-09 19:41:58 UTC (rev 32) @@ -37,7 +37,7 @@ <result name="input">/WEB-INF/jsp/user/login.jsp</result> <result name="error">/WEB-INF/jsp/user/login.jsp</result> <result name="redirect" type="redirect">${redirectAction}</result> - <interceptor-ref name="echoBaseParamsPrepareParamsStack"/> + <interceptor-ref name="paramsPrepareParamsStack"/> </action> <!-- logout action --> Modified: trunk/echobase-ui/src/main/resources/struts.xml =================================================================== --- trunk/echobase-ui/src/main/resources/struts.xml 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/resources/struts.xml 2011-11-09 19:41:58 UTC (rev 32) @@ -44,12 +44,12 @@ <constant name="struts.multipart.maxSize" value="209715200"/> <constant name="struts.freemarker.templatesCache" value="true"/> - <package name="default" extends="struts-default" abstract="true" + <package name="default" extends="json-default" abstract="true" namespace="/"> - <result-types> + <!--result-types> <result-type name="json" class="org.apache.struts2.json.JSONResult"/> - </result-types> + </result-types--> <interceptors> @@ -57,10 +57,6 @@ <interceptor name="paramRemover" class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/> - <!-- to manage the echobase topia transaction inside an action --> - <interceptor name="topiaTransaction" - class="fr.ifremer.echobase.ui.interceptors.EchoBaseTransactionInterceptorImpl"/> - <!-- to clean some properties from the echobase session --> <interceptor name="cleanEchoBaseSession" class="fr.ifremer.echobase.ui.interceptors.CleanEchoBaseSessionInterceptor"/> @@ -91,30 +87,18 @@ <interceptors> - <!-- echobase basic authenticated stack --> - <interceptor-stack name="echoBaseBasicStack"> - <interceptor-ref name="topiaTransaction"/> - <interceptor-ref name="basicStack"/> - </interceptor-stack> - - <!-- echobase stack with params--> - <interceptor-stack name="echoBaseParamsPrepareParamsStack"> - <interceptor-ref name="topiaTransaction"/> - <interceptor-ref name="paramsPrepareParamsStack"/> - </interceptor-stack> - <!-- basic authenticated stack --> <interceptor-stack name="basicStackLoggued"> <interceptor-ref name="i18n"/> <interceptor-ref name="checkUserLoggued"/> - <interceptor-ref name="echoBaseBasicStack"/> + <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- authenticated stack with params--> <interceptor-stack name="paramsPrepareParamsStackLoggued"> <interceptor-ref name="i18n"/> <interceptor-ref name="checkUserLoggued"/> - <interceptor-ref name="echoBaseParamsPrepareParamsStack"/> + <interceptor-ref name="paramsPrepareParamsStack"/> </interceptor-stack> </interceptors> @@ -136,7 +120,6 @@ <param name="paramNames">request_locale</param> </interceptor-ref> <interceptor-ref name="checkUserLoggued"/> - <interceptor-ref name="topiaTransaction"/> </action> </package> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp 2011-11-09 19:41:58 UTC (rev 32) @@ -59,19 +59,15 @@ <sjg:grid id="users" caption="%{getText('echobase.title.users')}" dataType="json" href="%{loadUrl}" gridModel="users" - pager="true" pagerButtons="false" pagerInput="false" - navigator="true" - rownumbers="false" - autowidth="true" + pager="true" pagerButtons="true" pagerInput="true" + navigator="true" rownumbers="false" autowidth="true" onSelectRowTopics='users-rowSelect' onCompleteTopics='users-cleanSelect' - navigatorEdit="false" - navigatorDelete="false" - navigatorSearch="false" - navigatorRefresh="false" + navigatorEdit="false" navigatorDelete="false" + navigatorSearch="false" navigatorRefresh="false" navigatorAdd="false" editinline="false" resizable="true" - height="100" + rowList="10,15,20, 50" rowNum="10" navigatorExtraButtons="{ add: { title : 'Ajouter', icon: 'ui-icon-plus', topic: 'users-rowAdd' }, update: { title : 'Mettre à jour', icon: 'ui-icon-pencil', topic: 'users-rowUpdate' }, Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-09 19:41:12 UTC (rev 31) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-09 19:41:58 UTC (rev 32) @@ -30,8 +30,8 @@ <display-name>EchoBase</display-name> <filter> - <filter-name>topiaCloseTransaction</filter-name> - <filter-class>org.nuiton.web.struts2.filter.CloseTopiaTransactionFilter</filter-class> + <filter-name>topiaTransaction</filter-name> + <filter-class>fr.ifremer.echobase.ui.EchoBaseTopiaTransactionFilter</filter-class> </filter> <filter> @@ -54,7 +54,7 @@ </filter> <filter-mapping> - <filter-name>topiaCloseTransaction</filter-name> + <filter-name>topiaTransaction</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>