Echobase-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
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- 1820 discussions
r22 - in trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities: . meta
by tchemit@users.forge.codelutin.com 08 Nov '11
by tchemit@users.forge.codelutin.com 08 Nov '11
08 Nov '11
Author: tchemit
Date: 2011-11-08 15:06:34 +0100 (Tue, 08 Nov 2011)
New Revision: 22
Url: http://forge.codelutin.com/repositories/revision/echobase/22
Log:
add db metas api
Added:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/ColumnMeta.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/DbMeta.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/TableMeta.java
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/ColumnMeta.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/ColumnMeta.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/ColumnMeta.java 2011-11-08 14:06:34 UTC (rev 22)
@@ -0,0 +1,93 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $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.entities.meta;
+
+import org.hibernate.mapping.Column;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+* Define the meta data.
+*
+* @author tchemit <chemit(a)codelutin.com>
+* @since 0.1
+*/
+public class ColumnMeta implements Serializable {
+
+ protected static ColumnMeta newMeta(String name, String label, Class<?> type) {
+ return new ColumnMeta(name, label, type);
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ protected String i18nKey;
+
+ protected Column hibernateColumn;
+
+ protected Class<?> type;
+
+ public ColumnMeta(String name, Class<?> type) {
+ this(name, name, type);
+ }
+
+ public ColumnMeta(String name, String i18nKey, Class<?> type) {
+ this.name = name;
+ this.i18nKey = i18nKey;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public String getColumnType() {
+ String result = "string";
+ if (boolean.class.equals(type)) {
+ result = "boolean";
+ } else if (Date.class.equals(type)) {
+ result = "date";
+ }
+ return result;
+ }
+
+ public boolean isFK() {
+ return TopiaEntity.class.isAssignableFrom(type);
+ }
+
+ public Column getHibernateColumn() {
+ return hibernateColumn;
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/ColumnMeta.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/DbMeta.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/DbMeta.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/DbMeta.java 2011-11-08 14:06:34 UTC (rev 22)
@@ -0,0 +1,85 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $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.entities.meta;
+
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Define metas about a db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class DbMeta implements Iterable<TableMeta> {
+
+ protected List<TableMeta> tables;
+
+ protected final EchoBaseEntityEnum[] entityEnums;
+
+ public DbMeta(EchoBaseEntityEnum[] entityEnums) {
+ this.entityEnums = entityEnums;
+ }
+
+ public List<String> getTableNames() {
+ List<String> result = Lists.newArrayList();
+ for (TableMeta tableMeta : getTables()) {
+ result.add(tableMeta.getName());
+ }
+ return result;
+ }
+
+ public List<TableMeta> getTables() {
+ if (tables == null) {
+ tables = Lists.newArrayList();
+ for (EchoBaseEntityEnum entityEnum : entityEnums) {
+ TableMeta tableMeta = new TableMeta(entityEnum);
+ tables.add(tableMeta);
+ }
+ }
+ return tables;
+ }
+
+ public TableMeta getTable(String tableName) {
+ Preconditions.checkNotNull(tableName);
+ TableMeta result = null;
+ for (TableMeta tableMeta : getTables()) {
+ if (tableName.equals(tableMeta.getName())) {
+ result = tableMeta;
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Iterator<TableMeta> iterator() {
+ return getTables().iterator();
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/DbMeta.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/TableMeta.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/TableMeta.java (rev 0)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/TableMeta.java 2011-11-08 14:06:34 UTC (rev 22)
@@ -0,0 +1,125 @@
+/*
+ * #%L
+ * EchoBase :: Entities
+ *
+ * $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.entities.meta;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.util.EntityOperator;
+
+import java.beans.Introspector;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Define metas of a given db table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class TableMeta implements Serializable, Iterable<ColumnMeta> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String name;
+
+ protected final String i18nKey;
+
+ protected final EntityOperator<?> operator;
+
+ protected final EchoBaseEntityEnum entityEnum;
+
+ protected List<ColumnMeta> columns;
+
+ public TableMeta(EchoBaseEntityEnum entityEnum) {
+ Preconditions.checkNotNull(entityEnum);
+ this.entityEnum = entityEnum;
+ name = entityEnum.getImplementationFQN();
+ Class<? extends TopiaEntity> contract = entityEnum.getContract();
+ i18nKey = "echobase.common." +
+ Introspector.decapitalize(contract.getSimpleName());
+ operator = EchoBaseDAOHelper.getOperator(contract);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public EchoBaseEntityEnum getEntityEnum() {
+ return entityEnum;
+ }
+
+ public String getI18nKey() {
+ return i18nKey;
+ }
+
+ public EntityOperator<?> getOperator() {
+ return operator;
+ }
+
+ public ColumnMeta getColumns(String columnName) {
+ Preconditions.checkNotNull(columnName);
+ ColumnMeta result = null;
+ for (ColumnMeta columnMeta : getColumns()) {
+ if (columnName.equals(columnMeta.getName())) {
+ result = columnMeta;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public List<String> getColumnNames() {
+ List<String> result = Lists.newLinkedList();
+ for (ColumnMeta columnMeta : getColumns()) {
+ result.add(columnMeta.getName());
+ }
+ return result;
+ }
+
+ public List<ColumnMeta> getColumns() {
+ if (columns == null) {
+ columns = Lists.newLinkedList();
+ Class<? extends TopiaEntity> contract = entityEnum.getContract();
+ EntityOperator<? extends TopiaEntity> operator =
+ EchoBaseDAOHelper.getOperator(contract);
+ List<String> properties = operator.getProperties();
+ for (String property : properties) {
+ Class<?> propertyType = operator.getPropertyType(property);
+ String i18nKey = "echobase.common." + property;
+ ColumnMeta tableMeta = ColumnMeta.newMeta(property, i18nKey, propertyType);
+ columns.add(tableMeta);
+ }
+ }
+ return columns;
+ }
+
+ @Override
+ public Iterator<ColumnMeta> iterator() {
+ return getColumns().iterator();
+ }
+}
Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/meta/TableMeta.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r21 - in trunk/echobase-ui/src/main: java/fr/ifremer/echobase/ui java/fr/ifremer/echobase/ui/actions java/fr/ifremer/echobase/ui/actions/dbeditor java/fr/ifremer/echobase/ui/actions/json java/fr/ifremer/echobase/ui/interceptors resources resources/config webapp/WEB-INF/jsp webapp/WEB-INF/jsp/dbeditor
by tchemit@users.forge.codelutin.com 08 Nov '11
by tchemit@users.forge.codelutin.com 08 Nov '11
08 Nov '11
Author: tchemit
Date: 2011-11-08 10:03:06 +0100 (Tue, 08 Nov 2011)
New Revision: 21
Url: http://forge.codelutin.com/repositories/revision/echobase/21
Log:
change chemit to tchemit + begin of dbeditor ui
Added:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/DbEditorUtil.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetTableDatas.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadTablePage.java
trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp
Removed:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
Modified:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
trunk/echobase-ui/src/main/resources/struts.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp
Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -1,255 +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;
-
-import com.google.common.base.Supplier;
-import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseTechnicalException;
-import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
-import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.EchoBaseUserDTO;
-import fr.ifremer.echobase.entities.EchoBaseUserDTOImpl;
-import fr.ifremer.echobase.entities.EchoBaseUserImpl;
-import fr.ifremer.echobase.services.EchoBaseServiceContext;
-import fr.ifremer.echobase.services.EchoBaseServiceContextImpl;
-import fr.ifremer.echobase.services.EchoBaseServiceFactory;
-import fr.ifremer.echobase.services.UserService;
-import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
-import fr.ird.converter.FloatConverter;
-import org.apache.commons.beanutils.ConvertUtils;
-import org.apache.commons.beanutils.Converter;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.framework.TopiaUtil;
-import org.nuiton.util.converter.ConverterUtil;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
-
-/**
- * To listen start or end of the application.
- * <p/>
- * On start we will load the configuration and check connection to internal
- * database, creates schema and create an admin user in none found in database.
- * <p/>
- * On stop, just release the application configuration.
- *
- * @author chemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class ApplicationListener implements ServletContextListener {
-
- /** Logger. */
- protected static final Log log =
- LogFactory.getLog(ApplicationListener.class);
-
- private Supplier<TopiaContext> rootContextSupplier;
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
-
- if (log.isInfoEnabled()) {
- log.info("Application starting at " + new Date() + "...");
- }
-
- // init I18n
- DefaultI18nInitializer i18nInitializer =
- new DefaultI18nInitializer("echobase-i18n");
- i18nInitializer.setMissingKeyReturnNull(true);
- I18n.init(i18nInitializer, Locale.getDefault());
-
- EchoBaseApplicationContext applicationContext = new EchoBaseApplicationContext();
- sce.getServletContext().setAttribute(EchoBaseActionSupport.APPLICATION_CONTEXT_PARAMETER, applicationContext);
-
- // initialize configuration
- EchoBaseConfiguration configuration = new EchoBaseConfiguration();
- applicationContext.setConfiguration(configuration);
-
- if (log.isInfoEnabled()) {
- log.info("Initializing RootContextSupplier...");
- }
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
- rootContextSupplier = factory.newDatabaseFromConfig(configuration);
- applicationContext.setRootContextSupplier(rootContextSupplier);
-
- // register our not locale dependant converter
- Converter converter = ConverterUtil.getConverter(Float.class);
- if (converter != null) {
- ConvertUtils.deregister(Float.class);
- }
- ConvertUtils.register(new FloatConverter(), Float.class);
-
- // init database (and create minimal admin user if required)
- try {
- boolean schemaExist = isSchemaCreated();
- if (!schemaExist) {
-
- updateSchema(configuration);
- }
-
- createAdminUser(configuration);
- } catch (TopiaException e) {
- throw new EchoBaseTechnicalException("Could not init db", e);
- }
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
-
- if (log.isInfoEnabled()) {
- log.info("Application is ending at " + new Date() + "...");
- }
- if (rootContextSupplier != null) {
- if (log.isInfoEnabled()) {
- log.info("Shuting down RootContextSupplier...");
- }
- TopiaContext rootContext = rootContextSupplier.get();
- if (!rootContext.isClosed()) {
- try {
- rootContext.closeContext();
- } catch (TopiaException te) {
- if (log.isErrorEnabled()) {
- log.error("Could not close rootContext", te);
- }
- }
- }
- }
- }
-
- protected void updateSchema(EchoBaseConfiguration configuration) throws TopiaException {
- if (log.isInfoEnabled()) {
- log.info("Will create or update schema for db.");
- }
- // must create the schema
-
- Properties dbConf = configuration.getProperties();
-
- dbConf.put("hibernate.hbm2ddl.auto", "update");
-
- EchoBaseTopiaRootContextSupplierFactory factory =
- new EchoBaseTopiaRootContextSupplierFactory();
- Supplier<TopiaContext> topiaContextSupplier =
- factory.newDatabaseFromProperties(dbConf);
-
- // start a connexion to load schema
- TopiaContext tx = null;
-
- try {
- tx = topiaContextSupplier.get().beginTransaction();
-
- } finally {
-
- // no more update of schema...
- dbConf.put("hibernate.hbm2ddl.auto", "none");
-
- closeTransaction(tx);
- }
- }
-
- /**
- * Creates the adminsitrator ({@code admin/admin}) on the internal
- * database.
- *
- * @param configuration EchoBase configuration
- * @throws TopiaException if could not create the user.
- */
- protected void createAdminUser(EchoBaseConfiguration configuration) throws TopiaException {
-
- EchoBaseServiceFactory serviceFactory =
- new EchoBaseServiceFactory();
- TopiaContext transaction = rootContextSupplier.get().beginTransaction();
-
- try {
- EchoBaseServiceContext serviceContext = new EchoBaseServiceContextImpl(
- transaction,
- configuration,
- serviceFactory
- );
-
- UserService service = serviceFactory.newService(UserService.class, serviceContext);
-
- List<EchoBaseUser> users = service.getUsers();
-
- if (CollectionUtils.isEmpty(users)) {
-
- // no users in database create the admin user
- if (log.isInfoEnabled()) {
- log.info("No user in database, will create default " +
- "admin user (password admin).");
- }
-
- EchoBaseUserDTO userDTO = new EchoBaseUserDTOImpl();
- userDTO.setEmail("admin");
- userDTO.setPassword("admin");
- userDTO.setAdmin(true);
- service.createOrUpdate(userDTO);
- }
- } finally {
- transaction.closeContext();
- }
-
- }
-
- protected boolean isSchemaCreated() throws TopiaException {
-
- TopiaContextImplementor tx =
- (TopiaContextImplementor)
- rootContextSupplier.get();
- try {
- boolean schemaFound = TopiaUtil.isSchemaExist(
- tx.getHibernateConfiguration(),
- EchoBaseUserImpl.class.getName()
- );
-
- return schemaFound;
-
- } finally {
- closeTransaction(tx);
- }
- }
-
- /**
- * Try to close the given transaction.
- *
- * @param tx the transaction to close
- * @throws TopiaException if could not close the transaction
- */
- protected void closeTransaction(TopiaContext tx) throws TopiaException {
- if (tx != null && !tx.isClosed()) {
- tx.closeContext();
- }
- }
-
-}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -28,7 +28,7 @@
import org.nuiton.topia.TopiaContext;
/**
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseApplicationContext {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -65,7 +65,7 @@
* <p/>
* On stop, just release the application configuration.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseApplicationListener implements ServletContextListener {
@@ -198,7 +198,8 @@
serviceFactory
);
- UserService service = serviceFactory.newService(UserService.class, serviceContext);
+ UserService service =
+ serviceFactory.newService(UserService.class, serviceContext);
List<EchoBaseUser> users = service.getUsers();
@@ -215,11 +216,18 @@
userDTO.setPassword("admin");
userDTO.setAdmin(true);
service.createOrUpdate(userDTO);
+
+ for (int i = 0; i < 1000; i++) {
+
+ userDTO.setEmail("admin" + i);
+ userDTO.setPassword("admin");
+ userDTO.setAdmin(true);
+ service.createOrUpdate(userDTO);
+ }
}
} finally {
transaction.closeContext();
}
-
}
protected boolean isSchemaCreated() throws TopiaException {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -33,7 +33,7 @@
/**
* The session object of EchoBase to put in servlet session.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseSession {
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-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -47,7 +47,7 @@
* we do NOT want this behaviour in gui, prefer to return the marked
* untranslated key.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseActionSupport extends BaseAction implements TopiaTransactionAware {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -26,7 +26,7 @@
/**
* Operations possible for a simple CRUD.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public enum EditActionEnum {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -38,7 +38,7 @@
/**
* Login and Logout action.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class LoginAction extends EchoBaseActionSupport implements SessionAware {
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/DbEditorUtil.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/DbEditorUtil.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/DbEditorUtil.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -0,0 +1,67 @@
+package fr.ifremer.echobase.ui.actions.dbeditor;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import fr.ifremer.echobase.entities.EchoBaseDAOHelper;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.ExportQuery;
+import fr.ifremer.echobase.services.DbEditorService;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.beans.Introspector;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Helper for the db editor.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class DbEditorUtil {
+
+ protected static Map<String, String> tableNames;
+
+ public static Map<String, String> getTableNames() {
+
+ if (tableNames == null) {
+ tableNames = Maps.newTreeMap();
+ Class<? extends TopiaEntity>[] contractClasses =
+ EchoBaseDAOHelper.getContractClasses();
+ for (Class<? extends TopiaEntity> contractClass : contractClasses) {
+ tableNames.put(contractClass.getName(), _("echobase.common." + Introspector.decapitalize(contractClass.getSimpleName())));
+ }
+ }
+ return tableNames;
+ }
+
+ public static List<DbEditorService.TableMeta> getTableMeta(String tableName, TopiaContext transaction) {
+
+ List<DbEditorService.TableMeta> result = Lists.newLinkedList();
+ if (EchoBaseUser.class.getName().equals(tableName)) {
+// result.add(newMeta(EchoBaseUser.TOPIA_ID, String.class));
+ result.add(DbEditorService.newMeta(EchoBaseUser.PROPERTY_EMAIL, String.class));
+ result.add(DbEditorService.newMeta(EchoBaseUser.PROPERTY_ADMIN, boolean.class));
+ }
+
+ if (ExportQuery.class.getName().equals(tableName)) {
+
+// result.add(newMeta(ExportQuery.TOPIA_ID, String.class));
+ result.add(DbEditorService.newMeta(ExportQuery.PROPERTY_NAME, String.class));
+ result.add(DbEditorService.newMeta(ExportQuery.PROPERTY_DESCRIPTION, String.class));
+ result.add(DbEditorService.newMeta(ExportQuery.PROPERTY_SQL_QUERY, String.class));
+ result.add(DbEditorService.newMeta(ExportQuery.PROPERTY_LAST_MODIFIED_DATE, Date.class));
+ result.add(DbEditorService.newMeta(ExportQuery.PROPERTY_LAST_MODIFIED_USER, EchoBaseUser.class));
+ }
+ return result;
+ }
+
+ protected DbEditorUtil() {
+ // helper classes, avoid constructor
+ }
+
+}
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetTableDatas.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetTableDatas.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetTableDatas.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -0,0 +1,37 @@
+package fr.ifremer.echobase.ui.actions.dbeditor;
+
+import com.google.common.collect.Lists;
+import fr.ifremer.echobase.services.DbEditorService;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+
+import java.util.List;
+
+/**
+ * To obtain the data for the given request.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class GetTableDatas extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Name of the table to load. */
+ protected String tableName;
+
+ /** Metas of the table */
+ protected List<DbEditorService.TableMeta> tableMetas;
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ @Override
+ public String execute() throws Exception {
+ tableMetas = Lists.newLinkedList();
+ tableMetas.addAll(DbEditorUtil.getTableMeta(tableName));
+ return SUCCESS;
+ }
+
+
+}
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadTablePage.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadTablePage.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadTablePage.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -0,0 +1,84 @@
+package fr.ifremer.echobase.ui.actions.dbeditor;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import fr.ifremer.echobase.entities.EchoBaseEntityEnum;
+import fr.ifremer.echobase.services.DbEditorService;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import org.apache.commons.lang.StringUtils;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Table;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * To load the db editor page.s
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class LoadTablePage extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ /** Name of the table to load. */
+ protected String tableName;
+
+ /** All tables availables */
+ protected Map<String, String> tableNames;
+
+ /** Metas of the table */
+ protected List<DbEditorService.TableMeta> tableMetas;
+
+ public String getTableName() {
+ return tableName;
+ }
+
+ public Map<String, String> getTableNames() {
+ return tableNames;
+ }
+
+ public List<DbEditorService.TableMeta> getTableMetas() {
+ return tableMetas;
+ }
+
+ public void setTableName(String tableName) {
+ this.tableName = tableName;
+ }
+
+ @Override
+ public String input() throws Exception {
+ tableNames = Maps.newTreeMap();
+ tableNames.putAll(DbEditorUtil.getTableNames());
+ if (StringUtils.isNotEmpty(tableName)) {
+
+ // load also table metas
+ EchoBaseEntityEnum entityEnum = EchoBaseEntityEnum.valueOf(tableName);
+ Preconditions.checkNotNull(entityEnum);
+ String implementationFQN = entityEnum.getImplementationFQN();
+ TopiaContextImplementor tx = (TopiaContextImplementor) getTransaction();
+ Configuration hibernateConfiguration = tx.getHibernateConfiguration();
+ PersistentClass classMapping = hibernateConfiguration.getClassMapping(implementationFQN);
+ Table table = classMapping.getTable();
+ Iterator<?> columnIterator = table.getColumnIterator();
+ while (columnIterator.hasNext()) {
+ Column column = (Column) columnIterator.next();
+ String name = column.getName();
+ if (TopiaEntity.TOPIA_CREATE_DATE.equals(name)) {
+
+ // skip it
+ }
+ }
+ tableMetas = Lists.newLinkedList();
+ tableMetas.addAll(DbEditorUtil.getTableMeta(tableName, getTransaction()));
+ }
+ return INPUT;
+ }
+}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -41,7 +41,7 @@
private static final long serialVersionUID = 1L;
- protected transient UserService service;
+// protected transient UserService service;
protected List<EchoBaseUserDTO> users;
@@ -49,17 +49,18 @@
return users;
}
- protected UserService getUserService() {
- if (service == null) {
- service = newService(UserService.class);
- }
- return service;
- }
+// protected UserService getUserService() {
+// if (service == null) {
+// service = newService(UserService.class);
+// }
+// return service;
+// }
@Override
public String execute() throws Exception {
- List<EchoBaseUser> allUsers = getUserService().getUsers();
+// List<EchoBaseUser> allUsers = getUserService().getUsers();
+ List<EchoBaseUser> allUsers = newService(UserService.class).getUsers();
users = new ArrayList<EchoBaseUserDTO>(allUsers.size());
for (EchoBaseUser user : allUsers) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2011-11-08 09:03:06 UTC (rev 21)
@@ -38,7 +38,7 @@
/**
* To check if some data are in the user session.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @see EchoBaseSession
* @since 0.1
*/
Added: trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml (rev 0)
+++ trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2011-11-08 09:03:06 UTC (rev 21)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.1.7.dtd">
+
+<struts>
+
+ <package name="dbeditor" extends="loggued" namespace="/dbeditor">
+
+ <action name="dbeditor" method="input"
+ class="fr.ifremer.echobase.ui.actions.dbeditor.LoadTablePage">
+ <interceptor-ref name="basicStackLoggued"/>
+ <result name="input">/WEB-INF/jsp/dbeditor/dbeditor.jsp</result>
+ </action>
+
+ <action name="getTableDatas"
+ class="fr.ifremer.echobase.ui.actions.dbeditor.GetTableDatas">
+ <interceptor-ref name="basicStackLoggued"/>
+ <result type="json"/>
+ </action>
+
+ </package>
+
+</struts>
+
Modified: trunk/echobase-ui/src/main/resources/struts.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/struts.xml 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/resources/struts.xml 2011-11-08 09:03:06 UTC (rev 21)
@@ -141,6 +141,7 @@
</package>
+ <include file="config/struts-dbeditor.xml"/>
<include file="config/struts-json.xml"/>
<include file="config/struts-user.xml"/>
Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp 2011-11-08 09:03:06 UTC (rev 21)
@@ -0,0 +1,89 @@
+<%--
+ #%L
+ EchoBase :: UI
+
+ $Id: export.jsp 17 2011-11-07 10:57:50Z tchemit $
+ $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/weba… $
+ %%
+ 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%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+
+<s:url id="reloadUrl" action="dbeditor" namespace="/dbeditor"/>
+
+<title><s:text name="echobase.title.dbEditor"/></title>
+
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+
+ $('[name="tableName"]').change(function(event) {
+
+ var url = "${reloadUrl}?" + $.param({ tableName:this.value});
+ window.location = url;
+ });
+ });
+</script>
+
+<div>
+<s:select key="tableName" href='%{getTableNamesUrl}'
+ label='%{getText("echobase.common.tableName")}'
+
+ list="tableNames" headerKey="" headerValue=""/>
+
+ </div>
+<br/>
+
+<s:if test="tableName == ''">
+ <p>Aucune table sélectionnée</p>
+</s:if>
+<s:else>
+
+ <s:url id="loadUrl" action="getTableDatas" namespace="/dbeditor"
+ escapeAmp="false">
+ <s:param name="tableName" value="%{tableName}"/>
+ </s:url>
+
+ <sjg:grid id="tableDatas"
+ caption="%{getText('echobase.common.tableDatas', tableNames[tableName])}"
+ dataType="json" href="%{loadUrl}" gridModel="trips"
+ pager="true" pagerButtons="false" pagerInput="false"
+ navigator="true" autowidth="true" rownumbers="false"
+ navigatorEdit="true"
+ navigatorDelete="false"
+ navigatorSearch="true"
+ navigatorRefresh="true"
+ navigatorAdd="false"
+ resizable="true" editinline="false">
+
+ <sjg:gridColumn name="id" title="id" hidden="true"/>
+
+ <s:iterator value="tableMetas" var="meta" status="status">
+
+ <sjg:gridColumn name="%{#meta.name}" title="%{#meta.label}"
+ edittype="%{#meta.columnType}"
+ sortable="false" editable="true"/>
+
+ </s:iterator>
+
+ </sjg:grid>
+
+</s:else>
+
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2011-11-08 09:01:17 UTC (rev 20)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2011-11-08 09:03:06 UTC (rev 21)
@@ -28,4 +28,5 @@
<h2><s:text name="echobase.label.welcome"/></h2>
+<s:a action="dbeditor" namespace="/dbeditor">Modification du référentiel</s:a>
<hr/>
\ No newline at end of file
1
0
r20 - trunk/echobase-services/src/main/java/fr/ifremer/echobase/services
by tchemit@users.forge.codelutin.com 08 Nov '11
by tchemit@users.forge.codelutin.com 08 Nov '11
08 Nov '11
Author: tchemit
Date: 2011-11-08 10:01:17 +0100 (Tue, 08 Nov 2011)
New Revision: 20
Url: http://forge.codelutin.com/repositories/revision/echobase/20
Log:
add DbEdtiorservice + some cleans on services
Added:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java (rev 0)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -0,0 +1,116 @@
+/*
+ * #%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.collect.Lists;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import org.apache.commons.beanutils.ResultSetDynaClass;
+import org.hibernate.mapping.Column;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+import java.io.Serializable;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Service to edit the database.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class DbEditorService extends AbstractEchoBaseService {
+
+ protected static TableMeta newMeta(String name, Class<?> type) {
+ return new TableMeta(name, type);
+ }
+
+ public List<TableMeta> getMetas(String tableName) {
+ List<TableMeta> result = Lists.newLinkedList();
+ return result;
+ }
+
+ public ResultSetDynaClass getDatas(String tableName) {
+ try {
+ ResultSetDynaClass result = null;
+ result = new ResultSetDynaClass(null);
+ return result;
+ } catch (SQLException eee) {
+ throw new EchoBaseTechnicalException("Could not obtain data", eee);
+ }
+ }
+
+ public static class TableMeta implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ protected String label;
+
+ protected Column hibernateColumn;
+
+ protected Class<?> type;
+
+ public TableMeta(String name, Class<?> type) {
+ this(name, name, type);
+ }
+
+ public TableMeta(String name, String label, Class<?> type) {
+ this.name = name;
+ this.label = label;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+
+ public String getColumnType() {
+ String result = "string";
+ if (boolean.class.equals(type)) {
+ result = "boolean";
+ } else if (Date.class.equals(type)) {
+ result = "date";
+ }
+ return result;
+ }
+
+ public boolean isFK() {
+ return TopiaEntity.class.isAssignableFrom(type);
+ }
+
+ public Column getHibernateColumn() {
+ return hibernateColumn;
+ }
+ }
+}
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/DbEditorService.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/EchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-08 08:56:23 UTC (rev 19)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -28,7 +28,7 @@
* Contract to place on each EchBase service to push the {@code serviceContext}
* inside the service.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @see EchoBaseServiceContext
* @since 0.1
*/
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2011-11-08 08:56:23 UTC (rev 19)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -32,7 +32,7 @@
* Objects provided may be injected in services returned by
* {@link EchoBaseServiceFactory#newService(Class, EchoBaseServiceContext)}
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public interface EchoBaseServiceContext {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2011-11-08 08:56:23 UTC (rev 19)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -29,7 +29,7 @@
/** Instances of this class will be given to service factory.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
**/
public class EchoBaseServiceContextImpl implements EchoBaseServiceContext {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-08 08:56:23 UTC (rev 19)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -30,7 +30,7 @@
/**
* Factory of services.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseServiceFactory {
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-08 08:56:23 UTC (rev 19)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-08 09:01:17 UTC (rev 20)
@@ -38,17 +38,12 @@
/**
* @author sletellier <letellier(a)codelutin.com>
* @since 0.1
- **/
+ */
public class UserService extends AbstractEchoBaseService {
- public EchoBaseUserDAO getDAO() throws TopiaException {
- return EchoBaseDAOHelper.getEchoBaseUserDAO(getTransaction());
- }
-
- public List<EchoBaseUser> getUsers() throws EchoBaseTechnicalException {
+ public List<EchoBaseUser> getUsers() {
try {
List<EchoBaseUser> users = getDAO().findAll();
-
return users;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -58,7 +53,16 @@
public EchoBaseUser getUserById(String topiaId) {
try {
EchoBaseUser user = getDAO().findByTopiaId(topiaId);
+ return user;
+ } catch (TopiaException eee) {
+ throw new EchoBaseTechnicalException(eee);
+ }
+ }
+ public EchoBaseUser getUserByEmail(String email) {
+ Preconditions.checkNotNull(email);
+ try {
+ EchoBaseUser user = getDAO().findByEmail(email);
return user;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -84,7 +88,6 @@
user.setPassword(encodePassword(password));
}
dao.update(user);
-
getTransaction().commitTransaction();
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
@@ -95,26 +98,13 @@
try {
EchoBaseUserDAO dao = getDAO();
EchoBaseUser user = dao.findByTopiaId(userDTO.getId());
-
dao.delete(user);
-
getTransaction().commitTransaction();
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
}
- public EchoBaseUser getUserByEmail(String email) {
- Preconditions.checkNotNull(email);
- try {
- EchoBaseUserDAO dao = getDAO();
- EchoBaseUser user = dao.findByEmail(email);
- return user;
- } catch (TopiaException eee) {
- throw new EchoBaseTechnicalException(eee);
- }
- }
-
public boolean checkPassword(EchoBaseUser user,
String password) throws Exception {
String s = encodePassword(password);
@@ -125,4 +115,8 @@
String encodedPassword = StringUtil.encodeMD5(password);
return encodedPassword;
}
+
+ protected EchoBaseUserDAO getDAO() throws TopiaException {
+ return EchoBaseDAOHelper.getEchoBaseUserDAO(getTransaction());
+ }
}
1
0
r19 - in trunk/echobase-entities/src: license main/java/fr/ifremer/echobase main/java/fr/ifremer/echobase/entities main/resources/i18n main/xmi
by tchemit@users.forge.codelutin.com 08 Nov '11
by tchemit@users.forge.codelutin.com 08 Nov '11
08 Nov '11
Author: tchemit
Date: 2011-11-08 09:56:23 +0100 (Tue, 08 Nov 2011)
New Revision: 19
Url: http://forge.codelutin.com/repositories/revision/echobase/19
Log:
add missing configuration + readd i18n (needed for db editor)
Modified:
trunk/echobase-entities/src/license/THIRD-PARTY.properties
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java
trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
trunk/echobase-entities/src/main/xmi/echobase.properties
Modified: trunk/echobase-entities/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/echobase-entities/src/license/THIRD-PARTY.properties 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/license/THIRD-PARTY.properties 2011-11-08 08:56:23 UTC (rev 19)
@@ -24,3 +24,4 @@
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
javax.transaction--jta--1.1=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+echobase.title.dbEditor=Editeur de données
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-08 08:56:23 UTC (rev 19)
@@ -41,15 +41,16 @@
/**
* EchoBase configuration
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseConfiguration {
/** Logger. */
- protected static final Log log = LogFactory.getLog(EchoBaseConfiguration.class);
+ protected static final Log log =
+ LogFactory.getLog(EchoBaseConfiguration.class);
- /** Delegate application config object containing all the configuration. */
+ /** Delegate application config object containing configuration. */
protected ApplicationConfig applicationConfig;
public EchoBaseConfiguration() {
@@ -90,6 +91,18 @@
return file;
}
+ public File getWarDirectory() {
+ File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.WAR_DIRECTORY.key);
+ Preconditions.checkNotNull(file);
+ return file;
+ }
+
+ public File getWarLocation() {
+ File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.WAR_LOCATION.key);
+ Preconditions.checkNotNull(file);
+ return file;
+ }
+
public Version getApplicationVersion() {
Version v = applicationConfig.getOptionAsVersion(EchoBaseConfigurationOption.VERSION.key);
Preconditions.checkNotNull(v);
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-08 08:56:23 UTC (rev 19)
@@ -34,31 +34,31 @@
/**
* All EchoBase configuration options.
*
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public enum EchoBaseConfigurationOption implements ApplicationConfig.OptionDef {
/** Main directory where to put echobase data (logs, and others...). */
- DATA_DIRECTORY(
- "data.directory",
- n_("echobase.config.data.directory.description"),
- "/var/local/echobase",
- File.class),
-
- PASSWORD_DIGEST_ALGORITHM(
- "password.digest.algorithm",
- "Algorithme de hashage à utiliser pour les mot de passe",
- "SHA1", String.class),
- VERSION(
- "project.version",
+ DATA_DIRECTORY("data.directory",
+ n_("echobase.config.data.directory.description"),
+ "/var/local/echobase",
+ File.class),
+ VERSION("project.version",
"Version de l'application",
"", Version.class),
- SITE_URL(
- "project.siteUrl",
- "URL du site de l'application",
- "", URL.class);
+ SITE_URL("project.siteUrl",
+ "URL du site de l'application",
+ "", URL.class),
+ WAR_DIRECTORY("war.directory",
+ "Répertoire où est stoqué le war",
+ "/var/local/echobase/war", File.class),
+ WAR_LOCATION("war.location",
+ "Chemin complêt d'accès au war",
+ "${war.directory}/echobase-${project.version}.war",
+ File.class);
+
/** Configuration key. */
protected final String key;
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2011-11-08 08:56:23 UTC (rev 19)
@@ -24,7 +24,7 @@
package fr.ifremer.echobase;
/**
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseTechnicalException extends RuntimeException {
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-08 08:56:23 UTC (rev 19)
@@ -42,7 +42,7 @@
import java.util.Set;
/**
- * @author chemit <chemit(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
public class EchoBaseTopiaRootContextSupplierFactory {
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java 2011-11-08 08:56:23 UTC (rev 19)
@@ -38,7 +38,6 @@
EchoBaseUserDTO dto = new EchoBaseUserDTOImpl();
dto.setAdmin(isAdmin());
dto.setEmail(getEmail());
-// dto.setPassword(getPassword());
dto.setId(getTopiaId());
return dto;
}
@@ -47,7 +46,5 @@
public void fromDTO(EchoBaseUserDTO dto) {
setAdmin(dto.isAdmin());
setEmail(dto.getEmail());
-// setPassword(dto.getPassword());
}
-
}
Modified: trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties
===================================================================
--- trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2011-11-08 08:56:23 UTC (rev 19)
@@ -1 +1,14 @@
-echobase.config.data.directory.description=
+echobase.common.admin=Administrateur
+echobase.common.description=Description
+echobase.common.echoBaseUser=Utilisateur
+echobase.common.echoBaseUserDTO=
+echobase.common.email=Courriel
+echobase.common.exportQuery=Requête d'export
+echobase.common.exportQueryDTO=
+echobase.common.id=Identifiant
+echobase.common.lastModifiedDate=Date de dernière modification
+echobase.common.lastModifiedUser=Utilisateur de dernière modification
+echobase.common.name=Nom
+echobase.common.password=Mot de passe
+echobase.common.sqlQuery=Requête SQL
+echobase.config.data.directory.description=Chemin de l'application
Modified: trunk/echobase-entities/src/main/xmi/echobase.properties
===================================================================
--- trunk/echobase-entities/src/main/xmi/echobase.properties 2011-11-07 16:20:09 UTC (rev 18)
+++ trunk/echobase-entities/src/main/xmi/echobase.properties 2011-11-08 08:56:23 UTC (rev 19)
@@ -22,7 +22,7 @@
# #L%
###
-#model.tagValue.i18n=echobase.common.
+model.tagValue.i18n=echobase.common.
model.tagValue.notGenerateToString=true
model.tagValue.generateOperatorForDAOHelper=true
model.tagValue.generateStandaloneEnumForDAOHelper=true
1
0
07 Nov '11
Author: sletellier
Date: 2011-11-07 17:20:09 +0100 (Mon, 07 Nov 2011)
New Revision: 18
Url: http://forge.codelutin.com/repositories/revision/echobase/18
Log:
- Update files headers
- Copy T3 usefull class (EditActionEnum)
- Add struts-json config file
- Implement user CRUD
- Display user menu only for admin
- Fix delete method in userService
Added:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java
trunk/echobase-ui/src/main/resources/config/struts-json.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userForm.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp
Removed:
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-ui/src/license/THIRD-PARTY.properties
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
trunk/echobase-ui/src/main/resources/struts.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp
trunk/echobase-ui/src/main/webapp/css/screen.css
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-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -97,6 +97,8 @@
EchoBaseUser user = dao.findByTopiaId(userDTO.getId());
dao.delete(user);
+
+ getTransaction().commitTransaction();
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
Modified: trunk/echobase-ui/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/echobase-ui/src/license/THIRD-PARTY.properties 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/license/THIRD-PARTY.properties 2011-11-07 16:20:09 UTC (rev 18)
@@ -14,8 +14,8 @@
# - Lesser General Public License (LGPL) v 3.0
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
+# - Lesser General Public License v2.1,Mozilla Public License 1.1 (MPL)
# - MIT License
-# - MPL 1.1
# - Mozilla Public License version 1.1
# - The Apache Software License, Version 1.1
# - The Apache Software License, Version 2.0
@@ -28,7 +28,7 @@
# Please fill the missing licenses for dependencies :
#
#
-#Thu Nov 03 15:10:38 CET 2011
+#Mon Nov 07 17:18:07 CET 2011
antlr--antlr--2.7.6=BSD License
asm--asm--3.1=http\://asm.ow2.org/license.html
asm--asm-commons--3.1=http\://asm.ow2.org/license.html
@@ -36,6 +36,7 @@
cglib--cglib-nodep--2.1_3=The Apache Software License, Version 2.0
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
dom4j--dom4j--1.6.1=BSD License
+javassist--javassist--3.8.0.GA=Lesser General Public License v2.1,Mozilla Public License 1.1 (MPL)
javax.servlet--servlet-api--2.5=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
javax.transaction--jta--1.1=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
net.java.dev.jna--jna--3.3.0=Lesser General Public License (LGPL v. 2.1)
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EditActionEnum.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -0,0 +1,39 @@
+/*
+ * #%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;
+
+/**
+ * Operations possible for a simple CRUD.
+ *
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public enum EditActionEnum {
+
+ CREATE,
+ EDIT,
+ DETAIL,
+ DELETE,
+ CLONE
+}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -23,174 +23,160 @@
*/
package fr.ifremer.echobase.ui.actions;
+import com.opensymphony.xwork2.Preparable;
import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserDTO;
+import fr.ifremer.echobase.entities.EchoBaseUserDTOImpl;
import fr.ifremer.echobase.services.UserService;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.ArrayList;
-import java.util.List;
-
/**
+ * Action to manage user (create - update - change password,...)
+ *
* @author sletellier <letellier(a)codelutin.com>
* @since 0.1
*/
-public class UserAction extends EchoBaseActionSupport {
+public class UserAction extends EchoBaseActionSupport implements Preparable {
+ protected static final Log log = LogFactory.getLog(UserAction.class);
+
private static final long serialVersionUID = 1L;
- protected static final Log log = LogFactory.getLog(UserAction.class);
+ public static final String BACK_TO_LIST = "backToList";
protected transient UserService service;
- // Grid model
- protected List<EchoBaseUserDTO> userList;
- protected EchoBaseUserDTO selectedUserDto;
+ protected EchoBaseUserDTO user;
- //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;
- // Your Total Pages
- protected Integer total = 0;
- // All Record
- protected Integer records = 0;
+ protected String userEditAction;
- public EchoBaseUserDTO getSelectedUserDto() {
- return selectedUserDto;
+ public String getUserEditAction() {
+ return userEditAction;
}
- public void setSelectedUserDto(EchoBaseUserDTO selectedUserDto) {
- this.selectedUserDto = selectedUserDto;
+ public void setUserEditAction(String userEditAction) {
+ this.userEditAction = userEditAction;
}
- public Integer getRows() {
- return rows;
+ protected UserService getUserService() {
+ if (service == null) {
+ service = newService(UserService.class);
+ }
+ return service;
}
- public void setRows(Integer rows) {
- this.rows = rows;
- }
+ @Override
+ public void prepare() throws Exception {
- public Integer getPage() {
- return page;
- }
+ String userId = getUser().getId();
+ if (!StringUtils.isEmpty(userId)) {
- public void setPage(Integer page) {
- this.page = page;
- }
+ // load user
+ user = getUserService().getUserById(userId).toDTO();
- public String getSord() {
- return sord;
+ log.info("Selected user " + user.getEmail());
+ }
}
- public void setSord(String sord) {
- this.sord = sord;
- }
+ public String doCreateOrUpdate() throws Exception {
+ EchoBaseUserDTO user = getUser();
+ String userEmail = user.getEmail();
- public String getSidx() {
- return sidx;
- }
+ if (log.isInfoEnabled()) {
+ log.info("will create user " + userEmail);
+ }
- public void setSidx(String sidx) {
- this.sidx = sidx;
+ // create user
+ getUserService().createOrUpdate(user);
+ return BACK_TO_LIST;
}
- public String getSearchField() {
- return searchField;
- }
+ public String doDelete() throws Exception {
+ EchoBaseUserDTO user = getUser();
+ String userEmail = user.getEmail();
- public void setSearchField(String searchField) {
- this.searchField = searchField;
+ if (log.isInfoEnabled()) {
+ log.info("will delete user " + userEmail);
+ }
+ getUserService().delete(user);
+ return BACK_TO_LIST;
}
- public String getSearchString() {
- return searchString;
- }
+ @Override
+ public void validate() {
- public void setSearchString(String searchString) {
- this.searchString = searchString;
- }
+ EditActionEnum action = getEditActionEnum();
- public String getSearchOper() {
- return searchOper;
- }
+ log.info("Edit action : " + action);
- public void setSearchOper(String searchOper) {
- this.searchOper = searchOper;
- }
+ if (action == null) {
- public Integer getTotal() {
- return total;
- }
+ // no validation (no edit action)
+ return;
+ }
- public void setTotal(Integer total) {
- this.total = total;
- }
+ EchoBaseUserDTO user = getUser();
+ String userEmail = user.getEmail();
- public Integer getRecords() {
- return records;
- }
+ switch (action) {
- public void setRecords(Integer records) {
- this.records = records;
- }
+ case CREATE:
- protected UserService getService() {
- if (service == null) {
- service = newService(UserService.class);
- }
- return service;
- }
+ // login + password required
+ if (StringUtils.isEmpty(userEmail)) {
- public List<EchoBaseUserDTO> getUserList() {
- return userList;
- }
+ // empty user login
+ addFieldError("user.email", _("echobase.error.required.email"));
+ } else {
- public void setUserList(List<EchoBaseUserDTO> userList) {
- this.userList = userList;
- }
+ // check login not already used
+ EchoBaseUser login;
+ try {
+ login = getUserService().getUserByEmail(userEmail);
+ } catch (Exception e) {
- @Override
- public String execute() throws Exception {
+ // could not get user
+ throw new IllegalStateException(
+ "Could not obtain user " + userEmail, e);
+ }
+ if (login != null) {
+ addFieldError("user.email", _("echobase.error.email.already.used"));
+ }
+ }
- List<EchoBaseUser> users = getService().getUsers();
+ String userPassword = user.getPassword();
+ if (StringUtils.isEmpty(userPassword)) {
- // Fill dtos
- int size = users.size();
- setRecords(size);
+ // empty user password
+ addFieldError("user.password", _("echobase.error.required.password"));
+ }
- //calculate the total pages for the query
- setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
- List<EchoBaseUserDTO> userList = new ArrayList<EchoBaseUserDTO>(size);
- for (EchoBaseUser user : users) {
- userList.add(user.toDTO());
- }
- log.info(size + " users founds");
+ break;
+ case EDIT:
- setUserList(userList);
+ // at the moment nothing to validate
+ break;
+ case DELETE:
- return super.execute();
+ // Do nothing
+ default:
+ // nothing to validate
+ }
}
- public String createOrUpdate() throws Exception {
- getService().createOrUpdate(selectedUserDto);
- return SUCCESS;
+ public EchoBaseUserDTO getUser() {
+ if (user == null) {
+ user = new EchoBaseUserDTOImpl();
+ }
+ return user;
}
- public String delete() throws Exception {
- getService().delete(selectedUserDto);
- return SUCCESS;
+ protected EditActionEnum getEditActionEnum() {
+ if (userEditAction == null) {
+ return null;
+ }
+ return EditActionEnum.valueOf(userEditAction);
}
}
Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/GetUsersAction.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -0,0 +1,72 @@
+/*
+ * #%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(a)codelutin.com>
+ * @since 0.1
+ */
+public class GetUsersAction extends EchoBaseActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected transient UserService service;
+
+ protected List<EchoBaseUserDTO> users;
+
+ public List<EchoBaseUserDTO> getUsers() {
+ return users;
+ }
+
+ protected UserService getUserService() {
+ if (service == null) {
+ service = newService(UserService.class);
+ }
+ return service;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ List<EchoBaseUser> allUsers = getUserService().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/validators/EchoBaseFieldValidatorSupport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -1,11 +1,11 @@
/*
* #%L
- * T3 :: Web
+ * EchoBase :: UI
*
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
+ * 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
@@ -28,7 +28,7 @@
import java.util.Arrays;
/**
- * Base T3 validator.
+ * Base EchoBase validator.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 16:20:09 UTC (rev 18)
@@ -1,11 +1,11 @@
/*
* #%L
- * T3 :: Web
+ * EchoBase :: UI
*
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
+ * 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
Added: trunk/echobase-ui/src/main/resources/config/struts-json.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-json.xml (rev 0)
+++ trunk/echobase-ui/src/main/resources/config/struts-json.xml 2011-11-07 16:20:09 UTC (rev 18)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ #%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%
+ -->
+
+
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.1.7.dtd">
+
+<struts>
+
+ <package name="json" extends="loggued" namespace="/json">
+
+ <action name="getUsers"
+ class="fr.ifremer.echobase.ui.actions.json.GetUsersAction">
+ <interceptor-ref name="basicStackLoggued"/>
+ <interceptor-ref name="checkUserIsAdmin"/>
+ <result type="json"/>
+ </action>
+
+ </package>
+
+</struts>
+
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 16:20:09 UTC (rev 18)
@@ -56,30 +56,20 @@
<action name="userList" class="fr.ifremer.echobase.ui.actions.UserAction">
<interceptor-ref name="basicStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
- <result name="success">/WEB-INF/jsp/user/users.jsp</result>
+ <result name="success">/WEB-INF/jsp/user/userList.jsp</result>
</action>
- <!-- get lists of users -->
- <action name="userListData" class="fr.ifremer.echobase.ui.actions.UserAction">
- <interceptor-ref name="basicStackLoggued"/>
+ <!-- get detail of a user -->
+ <action name="userForm" class="fr.ifremer.echobase.ui.actions.UserAction"
+ method="input">
+ <interceptor-ref name="paramsPrepareParamsStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
- <result name="success" type="json"/>
+ <result name="input">/WEB-INF/jsp/user/userForm.jsp</result>
+ <result name="error">/WEB-INF/jsp/user/userForm.jsp</result>
+ <result name="success">/WEB-INF/jsp/user/userForm.jsp</result>
+ <result name="backToList" type="redirectAction">userList</result>
</action>
- <!-- update or create (if not exist) user -->
- <action name="createOrUpdate" method="createOrUpdate" class="fr.ifremer.echobase.ui.actions.UserAction">
- <interceptor-ref name="basicStackLoggued"/>
- <interceptor-ref name="checkUserIsAdmin"/>
- <result name="success">/WEB-INF/jsp/user/users.jsp</result>
- </action>
-
- <!-- delete user -->
- <action name="delete" method="delete" class="fr.ifremer.echobase.ui.actions.UserAction">
- <interceptor-ref name="basicStackLoggued"/>
- <interceptor-ref name="checkUserIsAdmin"/>
- <result name="success">/WEB-INF/jsp/user/users.jsp</result>
- </action>
-
</package>
</struts>
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml 2011-11-07 16:20:09 UTC (rev 18)
@@ -1,11 +1,11 @@
<!--
#%L
- T3 :: Web
+ EchoBase :: UI
$Id$
$HeadURL$
%%
- Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
+ 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
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-07 16:20:09 UTC (rev 18)
@@ -1,3 +1,5 @@
+echobase.action.create=Créer
+echobase.action.delete=Suppression
echobase.action.locale.english=Anglais
echobase.action.locale.french=Français
echobase.action.login=Connection
@@ -2,11 +4,20 @@
echobase.action.logout=Déconnection
+echobase.action.save=Sauvegarder
echobase.common.admin=Administrateur
echobase.common.email=Email
echobase.common.password=Mot de passe
echobase.common.save=Sauvegarder
+echobase.common.user=Utilisateur
echobase.error.bad.password=Mot de passe incorrrect
+echobase.error.email.already.used=
echobase.error.login.unknown=Utilisateur inconnu
+echobase.error.required.email=L'email est obligatoire
+echobase.error.required.password=Le mot de passe est obligatoire
echobase.export.queryDescription=Description
echobase.export.queryName=Nom
echobase.export.querySql=SQL
+echobase.label.admin.user.create=Création d'un utilisateur
+echobase.label.admin.user.delete=Suppression d'un utilisateur
+echobase.label.admin.user.edit=Edition d'un utilisateur
+echobase.label.info.changePassword=Changement du mot de passe
echobase.label.language=Language
Modified: trunk/echobase-ui/src/main/resources/struts.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/struts.xml 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/resources/struts.xml 2011-11-07 16:20:09 UTC (rev 18)
@@ -141,14 +141,8 @@
</package>
- <!--<include file="config/struts-json.xml"/>-->
- <!--<include file="config/struts-io.xml"/>-->
+ <include file="config/struts-json.xml"/>
<include file="config/struts-user.xml"/>
- <!--<include file="config/struts-trip.xml"/>-->
- <!--<include file="config/struts-level0.xml"/>-->
- <!--<include file="config/struts-level1.xml"/>-->
- <!--<include file="config/struts-level2.xml"/>-->
- <!--<include file="config/struts-level3.xml"/>-->
</struts>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-07 16:20:09 UTC (rev 18)
@@ -23,6 +23,9 @@
--%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<s:set var="userIsAdmin" value="%{#session.echoBaseSession.echoBaseUser.admin}"/>
+
<div class='displayBlock'>
<div class='floatLeft'>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp 2011-11-07 16:20:09 UTC (rev 18)
@@ -33,11 +33,11 @@
<li>
<s:a action="export"><s:text name="echobase.menu.logs"/></s:a>
</li>
- <%--<s:if--%>
- <%--test="%{userIsAdmin}">--%>
+ <s:if
+ test="%{userIsAdmin}">
<li>
<s:a action="userList" namespace="/user"><s:text name="echobase.menu.users"/></s:a>
</li>
- <%--</s:if>--%>
+ </s:if>
</ul>
</div>
Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userForm.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userForm.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userForm.jsp 2011-11-07 16:20:09 UTC (rev 18)
@@ -0,0 +1,112 @@
+<%--
+ #%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%
+ --%>
+<%@ page import="fr.ifremer.echobase.ui.actions.EditActionEnum" %>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+
+<script type="text/javascript"
+ src="<s:url value='/js/gridHelper.js' />"></script>
+
+<%-- CRUD constants --%>
+<s:set name="create"><%=EditActionEnum.CREATE.toString()%></s:set>
+<s:set name="edit"><%=EditActionEnum.EDIT.toString()%></s:set>
+<s:set name="delete"><%=EditActionEnum.DELETE.toString()%></s:set>
+
+<s:if test="userEditAction == #create">
+ <s:set name="title"><s:text name="echobase.label.admin.user.create"/></s:set>
+</s:if>
+<s:elseif test="userEditAction == #edit">
+ <s:set name="title"><s:text name="echobase.label.admin.user.edit"/></s:set>
+</s:elseif>
+<s:elseif test="userEditAction == #delete">
+ <s:set name="title"><s:text name="echobase.label.admin.user.delete"/></s:set>
+</s:elseif>
+
+<title><s:property value="#title"/></title>
+
+<h2><s:property value="#title"/></h2>
+
+<s:if test="userEditAction == #create">
+
+ <%--Create user--%>
+
+ <s:form method="post" validate="true" namespace="/user">
+ <fieldset>
+ <legend>
+ <s:text name="echobase.common.user"/>
+ </legend>
+ <s:hidden key="userEditAction" label=""/>
+ <s:textfield key="user.email" label="%{getText('echobase.common.email')}"
+ size="40" required="true"/>
+ <s:password key="user.password" label="%{getText('echobase.common.password')}"
+ size="40" required="true"/>
+ <s:checkbox key="user.admin" label="%{getText('echobase.common.admin')}"/>
+ </fieldset>
+ <br/>
+ <s:submit action="userForm" method="doCreateOrUpdate" key="echobase.action.create" align="right"/>
+ </s:form>
+</s:if>
+<s:elseif test="userEditAction == #edit">
+
+ <%--Update user--%>
+
+ <s:form method="post" validate="true" namespace="/user">
+ <fieldset>
+ <legend>
+ <s:text name="echobase.common.user"/>
+ </legend>
+ <s:hidden key="user.id" label=""/>
+ <s:hidden key="userEditAction" label=""/>
+ <s:textfield key="user.email" label="%{getText('echobase.common.email')}"
+ size="40"/>
+ <s:password name="user.password" value="" key="echobase.common.password"
+ size="40"/>
+ <s:checkbox value="%{user.admin}" key="echobase.common.admin"/>
+ </fieldset>
+ <p><s:text name="echobase.label.info.changePassword"/></p>
+ <br/>
+ <s:submit action="userForm" method="doCreateOrUpdate" key="echobase.action.save" align="right"/>
+ </s:form>
+</s:elseif>
+<s:elseif test="userEditAction == #delete">
+
+ <%--Delete user--%>
+
+ <s:form method="post" validate="true" namespace="/user">
+ <fieldset>
+ <legend>
+ <s:text name="echobase.common.user"/>
+ </legend>
+ <s:hidden name="user.id" label=""/>
+ <s:hidden name="userEditAction" label=""/>
+ <s:textfield key="user.email" label="%{getText('echobase.common.email')}"
+ size="40" disabled="true"/>
+ <s:checkbox value="%{user.admin}" key="echobase.common.admin" disabled="true"/>
+ </fieldset>
+ <br/>
+ <s:submit action="userForm" method="doDelete" key="echobase.action.delete" align="right"/>
+ </s:form>
+</s:elseif>
+
Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp (from rev 17, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp)
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp (rev 0)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp 2011-11-07 16:20:09 UTC (rev 18)
@@ -0,0 +1,85 @@
+<%@ page import="fr.ifremer.echobase.ui.actions.EditActionEnum" %>
+<%--
+#%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%
+--%>
+<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<script type="text/javascript"
+ src="<s:url value='/js/gridHelper.js' />"></script>
+
+<title><s:text name="echobase.title.users"/></title>
+
+<s:url id="loadUrl" action="getUsers" namespace="/json" escapeAmp="false"/>
+
+<s:url id="addUrl" action="userForm" namespace="/user" escapeAmp="false" method="input">
+ <s:param name="userEditAction"><%=EditActionEnum.CREATE%></s:param>
+</s:url>
+
+<s:url id="editUrl" action="userForm" namespace="/user" escapeAmp="false" method="input">
+ <s:param name="userEditAction"><%=EditActionEnum.EDIT%></s:param>
+</s:url>
+
+<s:url id="delUrl" action="userForm" namespace="/user" escapeAmp="false" method="input">
+ <s:param name="userEditAction"><%=EditActionEnum.DELETE%></s:param>
+</s:url>
+
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+ $.addRowSelectTopic('users');
+ $.addClearSelectTopic('users');
+ $.addAddRowTopic('users', '${addUrl}');
+ $.addSingleRowTopic('users', 'Update', '${editUrl}', 'user.id');
+ $.addSingleRowTopic('users', 'Delete', '${delUrl}', 'user.id');
+ });
+</script>
+
+<h2><s:text name="echobase.title.users"/></h2>
+<br/>
+
+<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"
+ onSelectRowTopics='users-rowSelect'
+ onCompleteTopics='users-cleanSelect'
+ navigatorEdit="false"
+ navigatorDelete="false"
+ navigatorSearch="false"
+ navigatorRefresh="false"
+ navigatorAdd="false"
+ editinline="false" resizable="true"
+ height="100"
+ navigatorExtraButtons="{
+ add: { title : 'Ajouter', icon: 'ui-icon-plus', topic: 'users-rowAdd' },
+ update: { title : 'Mettre à jour', icon: 'ui-icon-pencil', topic: 'users-rowUpdate' },
+ delete : { title : 'Supprimer', icon: 'ui-icon-trash', topic: 'users-rowDelete' }
+ }">
+ <sjg:gridColumn name="id" title="id" hidden="true"/>
+ <sjg:gridColumn name="email" width="600" title='%{getText("echobase.common.email")}'
+ sortable="false"/>
+ <sjg:gridColumn name="admin" title='%{getText("echobase.common.admin")}'
+ sortable="false" width="100" formatter="checkbox"/>
+</sjg:grid>
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/userList.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-07 16:20:09 UTC (rev 18)
@@ -1,100 +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%
- --%>
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
-
-<title><s:text name="echobase.title.users"/></title>
-
-<h2><s:text name="echobase.title.users"/></h2>
-
-<hr/>
-
-<s:url id="userListUrl" namespace="/user" action="userListData"/>
-<s:url id="saveUrl" namespace="/user" action="createOrUpdate"/>
-
-<sjg:grid id="usersList"
- caption='%{getText("echobase.user.gridTitle")}'
- dataType="json"
- title="%{getText('echobase.user.gridTitle')}"
- href="%{userListUrl}"
- pager="false"
- navigator="true"
- rowNum="-1"
- navigatorAddOptions="{
- height:280,
- reloadAfterSubmit:true,
- afterSubmit:function(response, postdata) {
- return isError(response.responseText);
- }
- }"
- navigatorEdit="true"
- navigatorEditOptions="{
- height:280,
- reloadAfterSubmit:true,
- afterSubmit:function(response, postdata) {
- return isError(response.responseText);
- }
- }"
- navigatorDelete="true"
- navigatorDeleteOptions="{
- height:280,
- reloadAfterSubmit:true,
- afterSubmit:function(response, postdata) {
- return isError(response.responseText);
- }
- }"
- gridModel="userList"
- editurl="%{saveUrl}"
- editinline="false"
- rownumbers="true"
- multiselect="false"
- autowidth="true"
- viewrecords="true">
-
- <sjg:gridColumn name="id"
- title='id'
- key="true"
- hidden="true"/>
-
- <sjg:gridColumn name="email"
- title='%{getText("echobase.common.email")}'
- sortable="true"
- editable="true"
- edittype="text"/>
-
- <sjg:gridColumn name="password"
- title='%{getText("echobase.common.password")}'
- editable="true"
- edittype="password"
- hidden="true"/>
-
- <sjg:gridColumn name="admin"
- title='%{getText("echobase.common.admin")}'
- sortable="true"
- editable="true"
- edittype="checkbox"/>
-
-</sjg:grid>
\ No newline at end of file
Modified: trunk/echobase-ui/src/main/webapp/css/screen.css
===================================================================
--- trunk/echobase-ui/src/main/webapp/css/screen.css 2011-11-07 10:57:50 UTC (rev 17)
+++ trunk/echobase-ui/src/main/webapp/css/screen.css 2011-11-07 16:20:09 UTC (rev 18)
@@ -26,7 +26,7 @@
}
.fontsize11 {
-font-size: 11px;
+ font-size: 11px;
}
.ui-tabs-panel pre {
@@ -48,6 +48,10 @@
text-align: center;
}
+.hidden {
+ display:none;
+}
+
.displayBlock {
display:block;
}
1
0
r17 - in trunk: echobase-services/src/main/java/fr/ifremer/echobase/services echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators echobase-ui/src/main/resources echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions echobase-ui/src/main/webapp/WEB-INF/jsp/export
by tchemit@users.forge.codelutin.com 07 Nov '11
by tchemit@users.forge.codelutin.com 07 Nov '11
07 Nov '11
Author: tchemit
Date: 2011-11-07 11:57:50 +0100 (Mon, 07 Nov 2011)
New Revision: 17
Url: http://forge.codelutin.com/repositories/revision/echobase/17
Log:
svn properties + headers
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
trunk/echobase-ui/src/main/resources/echobase.properties
trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml
trunk/echobase-ui/src/main/resources/validators.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportQueryForm.jsp
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.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/UserAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:57:50 UTC (rev 17)
@@ -1,3 +1,26 @@
+/*
+ * #%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;
import fr.ifremer.echobase.entities.EchoBaseUser;
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.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/validators/EchoBaseFieldValidatorSupport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 10:57:50 UTC (rev 17)
@@ -2,8 +2,8 @@
* #%L
* T3 :: Web
*
- * $Id: T3BaseFieldValidatorSupport.java 623 2011-10-24 14:43:56Z chemit $
- * $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/java/fr/ird/t3/web/v… $
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.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/validators/LoginValidator.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:57:50 UTC (rev 17)
@@ -2,8 +2,8 @@
* #%L
* T3 :: Web
*
- * $Id: LoginValidator.java 623 2011-10-24 14:43:56Z chemit $
- * $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/java/fr/ird/t3/web/v… $
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
* %%
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/echobase.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/echobase.properties 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/resources/echobase.properties 2011-11-07 10:57:50 UTC (rev 17)
@@ -1,3 +1,26 @@
+###
+# #%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%
+###
hibernate.hbm2ddl.auto=none
hibernate.show_sql=false
hibernate.dialect=org.hibernate.dialect.H2Dialect
Property changes on: trunk/echobase-ui/src/main/resources/echobase.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml 2011-11-07 10:57:50 UTC (rev 17)
@@ -2,8 +2,8 @@
#%L
T3 :: Web
- $Id: LoginAction-login-validation.xml 614 2011-10-22 00:49:05Z chemit $
- $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/resources/fr/ird/t3/… $
+ $Id$
+ $HeadURL$
%%
Copyright (C) 2010 - 2011 IRD, Codelutin, Tony Chemit
%%
Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/LoginAction-login-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/echobase-ui/src/main/resources/validators.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/validators.xml 2011-11-07 10:55:42 UTC (rev 16)
+++ trunk/echobase-ui/src/main/resources/validators.xml 2011-11-07 10:57:50 UTC (rev 17)
@@ -1,4 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator Config 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-config-1.0.dtd">
Property changes on: trunk/echobase-ui/src/main/resources/validators.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/export.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/export/exportQueryForm.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r16 - in trunk: echobase-services/src/main/java/fr/ifremer/echobase echobase-services/src/main/java/fr/ifremer/echobase/services echobase-services/src/main/resources echobase-services/src/main/resources/i18n echobase-ui/src/main/java/fr/ifremer/echobase/ui echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators echobase-ui/src/main/webapp/WEB-INF
by tchemit@users.forge.codelutin.com 07 Nov '11
by tchemit@users.forge.codelutin.com 07 Nov '11
07 Nov '11
Author: tchemit
Date: 2011-11-07 11:55:42 +0100 (Mon, 07 Nov 2011)
New Revision: 16
Url: http://forge.codelutin.com/repositories/revision/echobase/16
Log:
let's play it by the nflogement way :)
Added:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java
Removed:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/
trunk/echobase-services/src/main/resources/META-INF/
trunk/echobase-services/src/main/resources/echobase-config
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,216 +0,0 @@
-/*
- * #%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;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import fr.ifremer.echobase.services.EchoBaseServiceInitializable;
-import fr.ifremer.echobase.services.EchoBaseServiceInjectable;
-import fr.ifremer.echobase.services.EchoBaseServiceSingleton;
-import fr.ifremer.echobase.services.IOCService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.framework.TopiaTransactionAware;
-import org.nuiton.util.ObjectUtil;
-
-import java.util.Map;
-
-/**
- * To obtain services.
- *
- * @author chemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public class EchoBaseObjectFactory {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(EchoBaseObjectFactory.class);
-
- /**
- * Shared application configuration.
- * <p/>
- * <b>Note:</b> this configuration must be filled before any invocation
- * to a service.
- */
- protected static EchoBaseConfiguration configuration;
-
- /**
- * Sets the shared application configuration.
- *
- * @param configuration the shared application configuration to set
- */
- public static void setConfiguration(EchoBaseConfiguration configuration) {
- EchoBaseObjectFactory.configuration = configuration;
- }
-
- /**
- * Get the shared application configuration.
- *
- * @return the share application configuration, or {@code null} if none
- * was setted
- */
- public static EchoBaseConfiguration getConfiguration() {
- return configuration;
- }
-
- /**
- * Obtain a new EchoBase factory.
- * <p/>
- * <strong>Note:</strong> The shared configuration must have been setted
- * before using this method via the method
- * {@link #setConfiguration(EchoBaseConfiguration)}
- *
- * @return the new instanciated EchoBase factory.
- */
- public static EchoBaseObjectFactory newInstance() {
- // must have a configuration to start the factory
- Preconditions.checkNotNull(
- configuration,
- "No EchoBase appliation configuration registred.");
-
- if (log.isInfoEnabled()) {
- log.info("New EchoBaseObjectFactory with configuration " + configuration);
- }
- // instanciate factory
- EchoBaseObjectFactory factory = new EchoBaseObjectFactory();
- return factory;
- }
-
- /**
- * Destroy the static states of this class (mainly should be called at the
- * end of the application).
- */
- public static void destroy() {
- setConfiguration(null);
- }
-
- /**
- * To store shared services.
- * <p/>
- * A shared service is in fact a singleton so can keep it once for all
- * while using {@link #newService(Class)}.
- */
- protected final Map<Class<?>, ?> services;
-
- /**
- * Gets an instance of the service of the given type.
- * <p/>
- * If the service is marked as share, then the same instance will be
- * always delivred, otheriwse a new instance will be each time created.
- *
- * @param serviceClass the type of service to obtain
- * @param <S> the type of service to obtain
- * @return the instance of required service
- */
- public <S> S newService(Class<S> serviceClass) {
- S service = newService0(serviceClass, null);
- return service;
- }
-
- /**
- * Gets an instance of the transactional service of the given type.
- * <p/>
- * The given transaction will be injected into the transactional service.
- * <p/>
- * <strong>Note:</strong> To avoid problems, a transactional service should
- * always not to be shared service.
- *
- * @param serviceClass the type of the service to obtain
- * @param tx the transaction to inject in the service
- * @param <S> the type of the service to obtain
- * @return the instance of the required service
- */
- public <S extends TopiaTransactionAware> S newTransactionalService(Class<S> serviceClass,
- TopiaContext tx) {
- S service = newService0(serviceClass, tx);
- return service;
- }
-
- @Override
- protected void finalize() throws Throwable {
- if (services != null) {
- services.clear();
- }
- super.finalize();
- }
-
- /** Protected constructor to avoid external instanciations... */
- protected EchoBaseObjectFactory() {
- services = Maps.newHashMap();
- }
-
- /**
- * Gets a service given his type.
- * <p/>
- * It will first search in cache (if service is marked as shared).
- * <p/>
- * If not found, then creates the new service and can do some stuffs on
- * the freshly instanciaed service.
- *
- * @param serviceClass the type of service to obtain
- * @param tx the optinal transaction to set
- * @param <S> the type of service to obtain
- * @return the required service (from cache) or freshly instanciated
- * @see EchoBaseServiceInitializable
- */
- @SuppressWarnings({"unchecked"})
- private <S> S newService0(Class<S> serviceClass, TopiaContext tx) {
- Object service = null;
- if (EchoBaseServiceSingleton.class.isAssignableFrom(serviceClass)) {
-
- // try to obtain it from cache
- service = services.get(serviceClass);
- }
- if (service == null) {
-
- service = ObjectUtil.newInstance(serviceClass);
- if (tx != null && service instanceof TopiaTransactionAware) {
- TopiaTransactionAware transactionAware = (TopiaTransactionAware) service;
- transactionAware.setTransaction(tx);
- }
- if (service instanceof EchoBaseServiceInitializable) {
- EchoBaseServiceInitializable initializable = (EchoBaseServiceInitializable) service;
- initializable.init(this);
- }
- if (service instanceof EchoBaseServiceInjectable) {
- try {
- newService(IOCService.class).injectExcept(service);
- } catch (Exception e) {
- throw new IllegalStateException(
- "Could not inject into service " + service, e);
- }
- }
- if (service instanceof EchoBaseServiceSingleton) {
- ((Map) services).put(serviceClass, service);
- }
- }
- return (S) service;
- }
-
- public TopiaContext beginTransaction() {
- //TODO Make it happens
- return null;
- }
-}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -25,7 +25,11 @@
package fr.ifremer.echobase.services;
/**
+ * Contract to place on each EchBase service to push the {@code serviceContext}
+ * inside the service.
+ *
* @author chemit <chemit(a)codelutin.com>
+ * @see EchoBaseServiceContext
* @since 0.1
*/
public interface EchoBaseService {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -26,11 +26,14 @@
import fr.ifremer.echobase.EchoBaseTechnicalException;
import java.lang.reflect.InvocationTargetException;
+
/**
+ * Factory of services.
+ *
* @author chemit <chemit(a)codelutin.com>
* @since 0.1
- **/
- public class EchoBaseServiceFactory {
+ */
+public class EchoBaseServiceFactory {
public <E extends EchoBaseService> E newService(Class<E> clazz, EchoBaseServiceContext serviceContext) {
// instantiate service using empty constructor
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,46 +0,0 @@
-/*
- * #%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;
-
-/**
- * @author chemit <chemit(a)codelutin.com>
- * @since 0.1
- **/
-import fr.ifremer.echobase.EchoBaseObjectFactory;
-
-/**
- * Contract for service which need an intialization after their instanciation.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
- */
-public interface EchoBaseServiceInitializable {
-
- /**
- * Init the service using the T3 service factory which instanciated the service.
- *
- * @param factory the factory used to instanciate the service
- */
- void init(EchoBaseObjectFactory factory);
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,34 +0,0 @@
-/*
- * #%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;
-
-/**
- * Contract for service which need an injections.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public interface EchoBaseServiceInjectable {
-
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,38 +0,0 @@
-/*
- * #%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 fr.ifremer.echobase.EchoBaseObjectFactory;
-
-/**
- * A contract to mark a shared service.
- * <p/>
- * A shared service will be keep as a singleton in the {@link EchoBaseObjectFactory}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public interface EchoBaseServiceSingleton {
-}
Deleted: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,166 +0,0 @@
-/*
- * #%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.collect.Lists;
-import fr.ifremer.echobase.EchoBaseObjectFactory;
-import fr.ifremer.echobase.services.ioc.Injector;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ServiceLoader;
-
-/**
- * Service to inject stuff using T3 IOC engine.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @see Injector
- * @since 0.1
- */
-public class IOCService implements EchoBaseServiceInitializable, EchoBaseServiceSingleton {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(IOCService.class);
-
- protected Collection<Injector<?, ?>> injectors;
-
- @Override
- public void init(EchoBaseObjectFactory factory) {
- for (Injector<?, ?> injector : getInjectors()) {
- injector.init(factory);
- }
- }
-
- public void injectExcept(Object bean,
- Class<?>... excludedInjectors) throws Exception {
-
- // obtain the list of available injectors
- Collection<Injector<?, ?>> injectorsToUse;
-
- if (excludedInjectors.length == 0) {
-
- // use all injectors
- injectorsToUse = getInjectors();
- } else {
- injectorsToUse = Lists.newArrayList(getInjectors());
- List<Class<?>> annotations = Arrays.asList(excludedInjectors);
- Iterator<Injector<?, ?>> itr = injectorsToUse.iterator();
- while (itr.hasNext()) {
- Injector<?, ?> injector = itr.next();
- if (annotations.contains(injector.getAnnotationType())) {
- itr.remove();
- }
- }
- }
-
- // get all fields for the given type
- injectForType(bean, bean.getClass(), injectorsToUse);
- }
-
- public void injectOnly(Object bean,
- Class<?>... onlyInjectors) throws Exception {
-
- // obtain the list of available injectors
- Collection<Injector<?, ?>> injectorsToUse =
- Lists.newArrayList(getInjectors());
- List<Class<?>> annotations = Arrays.asList(onlyInjectors);
- Iterator<Injector<?, ?>> itr = injectorsToUse.iterator();
- while (itr.hasNext()) {
- Injector<?, ?> injector = itr.next();
- if (!annotations.contains(injector.getAnnotationType())) {
- itr.remove();
- }
- }
-
- // get all fields for the given type
- injectForType(bean, bean.getClass(), injectorsToUse);
- }
-
- protected void injectForType(Object bean,
- Class<?> beanType,
- Collection<Injector<?, ?>> injectors) throws Exception {
- Field[] fields = beanType.getDeclaredFields();
- for (Field field : fields) {
-
- if (Modifier.isFinal(field.getModifiers())) {
-
- // nothing to affect to a final field
- continue;
- }
-
- if (Modifier.isStatic(field.getModifiers())) {
-
- // nothing to affect to a static field
- continue;
- }
-
- Injector injector = getInjector(field, injectors);
- if (injector != null) {
- if (log.isDebugEnabled()) {
- log.debug("Will use injector " + injector + " for " + field);
- }
- injector.processField(field, bean);
- }
- }
- Class<?> superclass = beanType.getSuperclass();
- if (superclass != null && superclass.isAssignableFrom(beanType)) {
- injectForType(bean, superclass, injectors);
- }
- }
-
- protected Injector<?, ?> getInjector(Field field,
- Collection<Injector<?, ?>> injectors) {
-
- Injector<?, ?> result = null;
- for (Injector<?, ?> injector : injectors) {
- Class<? extends Annotation> annotationType =
- injector.getAnnotationType();
- if (field.isAnnotationPresent(annotationType)) {
- result = injector;
- break;
- }
- }
-
- return result;
- }
-
- protected Collection<Injector<?, ?>> getInjectors() {
- if (injectors == null) {
- injectors = Lists.newArrayList();
- for (Injector<?, ?> injector :
- ServiceLoader.load(Injector.class)) {
-
- injectors.add(injector);
- }
- }
- return injectors;
- }
-}
Deleted: trunk/echobase-services/src/main/resources/echobase-config
===================================================================
--- trunk/echobase-services/src/main/resources/echobase-config 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/resources/echobase-config 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,2 +0,0 @@
-application.version=${project.version}
-application.site.url=${project.url}
Modified: trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties
===================================================================
--- trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2011-11-07 10:55:42 UTC (rev 16)
@@ -1,9 +0,0 @@
-echobase.config.data.directory.description=
-echobase.config.internal.db.directory.description=
-echobase.config.level0.weightedSetWeight.description=
-echobase.config.parameterProfiles.storage.directory.description=
-echobase.config.rf1.maximumrate.description=
-echobase.config.rf1.minimumrate.description=
-echobase.config.stratum.weightRatio.description=
-echobase.config.treatment.working.directory.description=
-echobase.user.log.directory.description=
Copied: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java (from rev 14, trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java)
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java (rev 0)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -0,0 +1,255 @@
+/*
+ * #%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.EchoBaseConfiguration;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.EchoBaseUserDTO;
+import fr.ifremer.echobase.entities.EchoBaseUserDTOImpl;
+import fr.ifremer.echobase.entities.EchoBaseUserImpl;
+import fr.ifremer.echobase.services.EchoBaseServiceContext;
+import fr.ifremer.echobase.services.EchoBaseServiceContextImpl;
+import fr.ifremer.echobase.services.EchoBaseServiceFactory;
+import fr.ifremer.echobase.services.UserService;
+import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport;
+import fr.ird.converter.FloatConverter;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.Converter;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.framework.TopiaUtil;
+import org.nuiton.util.converter.ConverterUtil;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Properties;
+
+/**
+ * To listen start or end of the application.
+ * <p/>
+ * On start we will load the configuration and check connection to internal
+ * database, creates schema and create an admin user in none found in database.
+ * <p/>
+ * On stop, just release the application configuration.
+ *
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public class EchoBaseApplicationListener implements ServletContextListener {
+
+ /** Logger. */
+ protected static final Log log =
+ LogFactory.getLog(EchoBaseApplicationListener.class);
+
+ private Supplier<TopiaContext> rootContextSupplier;
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Application starting at " + new Date() + "...");
+ }
+
+ // init I18n
+ DefaultI18nInitializer i18nInitializer =
+ new DefaultI18nInitializer("echobase-i18n");
+ i18nInitializer.setMissingKeyReturnNull(true);
+ I18n.init(i18nInitializer, Locale.getDefault());
+
+ EchoBaseApplicationContext applicationContext = new EchoBaseApplicationContext();
+ sce.getServletContext().setAttribute(EchoBaseActionSupport.APPLICATION_CONTEXT_PARAMETER, applicationContext);
+
+ // initialize configuration
+ EchoBaseConfiguration configuration = new EchoBaseConfiguration();
+ applicationContext.setConfiguration(configuration);
+
+ if (log.isInfoEnabled()) {
+ log.info("Initializing RootContextSupplier...");
+ }
+ EchoBaseTopiaRootContextSupplierFactory factory =
+ new EchoBaseTopiaRootContextSupplierFactory();
+ rootContextSupplier = factory.newDatabaseFromConfig(configuration);
+ applicationContext.setRootContextSupplier(rootContextSupplier);
+
+ // register our not locale dependant converter
+ Converter converter = ConverterUtil.getConverter(Float.class);
+ if (converter != null) {
+ ConvertUtils.deregister(Float.class);
+ }
+ ConvertUtils.register(new FloatConverter(), Float.class);
+
+ // init database (and create minimal admin user if required)
+ try {
+ boolean schemaExist = isSchemaCreated();
+ if (!schemaExist) {
+
+ updateSchema(configuration);
+ }
+
+ createAdminUser(configuration);
+ } catch (TopiaException e) {
+ throw new EchoBaseTechnicalException("Could not init db", e);
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Application is ending at " + new Date() + "...");
+ }
+ if (rootContextSupplier != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Shuting down RootContextSupplier...");
+ }
+ TopiaContext rootContext = rootContextSupplier.get();
+ if (!rootContext.isClosed()) {
+ try {
+ rootContext.closeContext();
+ } catch (TopiaException te) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not close rootContext", te);
+ }
+ }
+ }
+ }
+ }
+
+ protected void updateSchema(EchoBaseConfiguration configuration) throws TopiaException {
+ if (log.isInfoEnabled()) {
+ log.info("Will create or update schema for db.");
+ }
+ // must create the schema
+
+ Properties dbConf = configuration.getProperties();
+
+ dbConf.put("hibernate.hbm2ddl.auto", "update");
+
+ EchoBaseTopiaRootContextSupplierFactory factory =
+ new EchoBaseTopiaRootContextSupplierFactory();
+ Supplier<TopiaContext> topiaContextSupplier =
+ factory.newDatabaseFromProperties(dbConf);
+
+ // start a connexion to load schema
+ TopiaContext tx = null;
+
+ try {
+ tx = topiaContextSupplier.get().beginTransaction();
+
+ } finally {
+
+ // no more update of schema...
+ dbConf.put("hibernate.hbm2ddl.auto", "none");
+
+ closeTransaction(tx);
+ }
+ }
+
+ /**
+ * Creates the adminsitrator ({@code admin/admin}) on the internal
+ * database.
+ *
+ * @param configuration EchoBase configuration
+ * @throws TopiaException if could not create the user.
+ */
+ protected void createAdminUser(EchoBaseConfiguration configuration) throws TopiaException {
+
+ EchoBaseServiceFactory serviceFactory =
+ new EchoBaseServiceFactory();
+ TopiaContext transaction = rootContextSupplier.get().beginTransaction();
+
+ try {
+ EchoBaseServiceContext serviceContext = new EchoBaseServiceContextImpl(
+ transaction,
+ configuration,
+ serviceFactory
+ );
+
+ UserService service = serviceFactory.newService(UserService.class, serviceContext);
+
+ List<EchoBaseUser> users = service.getUsers();
+
+ if (CollectionUtils.isEmpty(users)) {
+
+ // no users in database create the admin user
+ if (log.isInfoEnabled()) {
+ log.info("No user in database, will create default " +
+ "admin user (password admin).");
+ }
+
+ EchoBaseUserDTO userDTO = new EchoBaseUserDTOImpl();
+ userDTO.setEmail("admin");
+ userDTO.setPassword("admin");
+ userDTO.setAdmin(true);
+ service.createOrUpdate(userDTO);
+ }
+ } finally {
+ transaction.closeContext();
+ }
+
+ }
+
+ protected boolean isSchemaCreated() throws TopiaException {
+
+ TopiaContextImplementor tx =
+ (TopiaContextImplementor)
+ rootContextSupplier.get();
+ try {
+ boolean schemaFound = TopiaUtil.isSchemaExist(
+ tx.getHibernateConfiguration(),
+ EchoBaseUserImpl.class.getName()
+ );
+
+ return schemaFound;
+
+ } finally {
+ closeTransaction(tx);
+ }
+ }
+
+ /**
+ * Try to close the given transaction.
+ *
+ * @param tx the transaction to close
+ * @throws TopiaException if could not close the transaction
+ */
+ protected void closeTransaction(TopiaContext tx) throws TopiaException {
+ if (tx != null && !tx.isClosed()) {
+ tx.closeContext();
+ }
+ }
+
+}
Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.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/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -120,7 +120,6 @@
// remove user from session
userSession.setEchoBaseUser(null);
- userSession.setObjectFactory(null);
// remove echoBaseSession from application session
ActionContext.getContext().getSession().remove(SESSION_PARAMETER);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:55:42 UTC (rev 16)
@@ -25,7 +25,6 @@
import com.opensymphony.xwork2.validator.ValidationException;
import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.EchoBaseUserDTO;
import fr.ifremer.echobase.services.UserService;
/**
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-07 10:46:58 UTC (rev 15)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-07 10:55:42 UTC (rev 16)
@@ -75,7 +75,7 @@
<listener>
<description>Init</description>
- <listener-class>fr.ifremer.echobase.ui.ApplicationListener</listener-class>
+ <listener-class>fr.ifremer.echobase.ui.EchoBaseApplicationListener</listener-class>
</listener>
<welcome-file-list>
1
0
07 Nov '11
Author: sletellier
Date: 2011-11-07 11:46:58 +0100 (Mon, 07 Nov 2011)
New Revision: 15
Url: http://forge.codelutin.com/repositories/revision/echobase/15
Log:
Update javadoc
Modified:
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/AbstractInjector.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectDAO.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntitiesById.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntityById.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectFromDAO.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/Injector.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorDAO.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntitiesById.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntityById.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorFromDAO.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/HomeAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/AbstractCheckInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -42,7 +42,7 @@
* EchoBase configuration
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class EchoBaseConfiguration {
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -34,7 +34,8 @@
/**
* All EchoBase configuration options.
*
- * @since 1.0
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
*/
public enum EchoBaseConfigurationOption implements ApplicationConfig.OptionDef {
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -23,6 +23,10 @@
*/
package fr.ifremer.echobase;
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
public class EchoBaseTechnicalException extends RuntimeException {
private static final long serialVersionUID = 1L;
Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java
===================================================================
--- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -41,6 +41,10 @@
import java.util.Properties;
import java.util.Set;
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
public class EchoBaseTopiaRootContextSupplierFactory {
/** Logger. */
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/EchoBaseObjectFactory.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -41,7 +41,7 @@
* To obtain services.
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class EchoBaseObjectFactory {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -26,7 +26,8 @@
import org.nuiton.topia.TopiaContext;
/**
- * @author sletellier
+ * @author sletellier <letellier(a)codelutin.com>
+ * @since 0.1
*/
public class AbstractEchoBaseService implements EchoBaseService {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -24,6 +24,10 @@
package fr.ifremer.echobase.services;
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
public interface EchoBaseService {
void setServiceContext(EchoBaseServiceContext serviceContext);
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -31,6 +31,9 @@
* This contract represents objects you must provide when asking for a service.
* Objects provided may be injected in services returned by
* {@link EchoBaseServiceFactory#newService(Class, EchoBaseServiceContext)}
+ *
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
*/
public interface EchoBaseServiceContext {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContextImpl.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -27,7 +27,11 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import org.nuiton.topia.TopiaContext;
-/** Instances of this class will be given to service factory. */
+/** Instances of this class will be given to service factory.
+ *
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ **/
public class EchoBaseServiceContextImpl implements EchoBaseServiceContext {
protected TopiaContext transaction;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceFactory.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -26,9 +26,12 @@
import fr.ifremer.echobase.EchoBaseTechnicalException;
import java.lang.reflect.InvocationTargetException;
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ **/
+ public class EchoBaseServiceFactory {
-public class EchoBaseServiceFactory {
-
public <E extends EchoBaseService> E newService(Class<E> clazz, EchoBaseServiceContext serviceContext) {
// instantiate service using empty constructor
E service;
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInitializable.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -23,7 +23,10 @@
*/
package fr.ifremer.echobase.services;
-
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ **/
import fr.ifremer.echobase.EchoBaseObjectFactory;
/**
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceInjectable.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -27,7 +27,7 @@
* Contract for service which need an injections.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public interface EchoBaseServiceInjectable {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSingleton.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -32,7 +32,7 @@
* A shared service will be keep as a singleton in the {@link EchoBaseObjectFactory}.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public interface EchoBaseServiceSingleton {
}
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/IOCService.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -43,7 +43,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see Injector
- * @since 1.0
+ * @since 0.1
*/
public class IOCService implements EchoBaseServiceInitializable, EchoBaseServiceSingleton {
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-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -35,7 +35,10 @@
import java.util.List;
-/** @author sletellier */
+/**
+ * @author sletellier <letellier(a)codelutin.com>
+ * @since 0.1
+ **/
public class UserService extends AbstractEchoBaseService {
public EchoBaseUserDAO getDAO() throws TopiaException {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/AbstractInjector.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/AbstractInjector.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/AbstractInjector.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -38,7 +38,7 @@
* Abstract injector with some useful logi.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public abstract class AbstractInjector<A extends Annotation, B> implements Injector<A, B> {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectDAO.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectDAO.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectDAO.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectorDAO
- * @since 1.0
+ * @since 0.1
*/
@Retention(RUNTIME)
@Target(FIELD)
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntitiesById.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntitiesById.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntitiesById.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectorEntitiesById
- * @since 1.0
+ * @since 0.1
*/
@Retention(RUNTIME)
@Target(FIELD)
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntityById.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntityById.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectEntityById.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectorEntityById
- * @since 1.0
+ * @since 0.1
*/
@Retention(RUNTIME)
@Target(FIELD)
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectFromDAO.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectFromDAO.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectFromDAO.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectorFromDAO
- * @since 1.0
+ * @since 0.1
*/
@Retention(RUNTIME)
@Target(FIELD)
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/Injector.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/Injector.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/Injector.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -35,7 +35,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see IOCService
- * @since 1.0
+ * @since 0.1
*/
public interface Injector<A extends Annotation, B> extends EchoBaseServiceInitializable {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorDAO.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorDAO.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorDAO.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectDAO
- * @since 1.0
+ * @since 0.1
*/
public class InjectorDAO extends AbstractInjector<InjectDAO, TopiaTransactionAware> {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntitiesById.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntitiesById.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntitiesById.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -40,7 +40,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectEntitiesById
- * @since 1.0
+ * @since 0.1
*/
public class InjectorEntitiesById extends AbstractInjector<InjectEntitiesById, TopiaTransactionAware> {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntityById.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntityById.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorEntityById.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -37,8 +37,8 @@
* Fires the {@link InjectEntityById} annotation.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
* @see InjectEntityById
+ * @since 0.1
*/
public class InjectorEntityById extends AbstractInjector<InjectEntityById, TopiaTransactionAware> {
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorFromDAO.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorFromDAO.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/ioc/InjectorFromDAO.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -41,7 +41,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see InjectFromDAO
- * @since 1.0
+ * @since 0.1
*/
public class InjectorFromDAO extends AbstractInjector<InjectFromDAO, TopiaTransactionAware> {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -66,7 +66,7 @@
* On stop, just release the application configuration.
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class ApplicationListener implements ServletContextListener {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -27,6 +27,10 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import org.nuiton.topia.TopiaContext;
+/**
+ * @author chemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
public class EchoBaseApplicationContext {
protected EchoBaseConfiguration configuration;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -34,7 +34,7 @@
* The session object of EchoBase to put in servlet session.
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class EchoBaseSession {
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-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -48,7 +48,7 @@
* untranslated key.
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class EchoBaseActionSupport extends BaseAction implements TopiaTransactionAware {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/HomeAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/HomeAction.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/HomeAction.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -28,7 +28,7 @@
* To go to the home page.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class HomeAction extends EchoBaseActionSupport {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -39,7 +39,7 @@
* Login and Logout action.
*
* @author chemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class LoginAction extends EchoBaseActionSupport implements SessionAware {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -1,20 +1,17 @@
package fr.ifremer.echobase.ui.actions;
-import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.entities.EchoBaseUser;
-import fr.ifremer.echobase.entities.EchoBaseUserDAO;
import fr.ifremer.echobase.entities.EchoBaseUserDTO;
import fr.ifremer.echobase.services.UserService;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaException;
import java.util.ArrayList;
import java.util.List;
/**
- * @author sletellier
+ * @author sletellier <letellier(a)codelutin.com>
+ * @since 0.1
*/
public class UserAction extends EchoBaseActionSupport {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/AbstractCheckInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/AbstractCheckInterceptor.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/AbstractCheckInterceptor.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -36,7 +36,7 @@
* Abstract check interceptor.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public abstract class AbstractCheckInterceptor extends AbstractInterceptor {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -40,7 +40,7 @@
*
* @author chemit <chemit(a)codelutin.com>
* @see EchoBaseSession
- * @since 1.0
+ * @since 0.1
*/
public class CheckInUserSessionInterceptor extends AbstractCheckInterceptor {
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-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -33,7 +33,7 @@
* To check user is loggued. If not, then redirect to the {@link #loginAction}.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class CheckLogguedInterceptor extends AbstractCheckInterceptor {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckUserIsAdmin.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -33,7 +33,7 @@
* To check if logged user is admin.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class CheckUserIsAdmin extends AbstractCheckInterceptor {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -39,7 +39,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @see EchoBaseSession
- * @since 1.0
+ * @since 0.1
*/
public class CleanEchoBaseSessionInterceptor extends AbstractInterceptor {
private static final long serialVersionUID = 1L;
Modified: 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-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/EchoBaseTransactionInterceptorImpl.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -37,7 +37,7 @@
* create a new topia transaction on a EchoBase database.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class EchoBaseTransactionInterceptorImpl extends OpenTopiaTransactionInterceptor {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/EchoBaseFieldValidatorSupport.java 2011-11-07 10:46:58 UTC (rev 15)
@@ -31,7 +31,7 @@
* Base T3 validator.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public abstract class EchoBaseFieldValidatorSupport extends NuitonFieldValidatorSupport {
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:46:58 UTC (rev 15)
@@ -52,7 +52,7 @@
<interceptor-ref name="basicStack"/>
</action>
- <!-- Display lists of users -->
+ <!-- display lists of users -->
<action name="userList" class="fr.ifremer.echobase.ui.actions.UserAction">
<interceptor-ref name="basicStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-07 10:32:04 UTC (rev 14)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-07 10:46:58 UTC (rev 15)
@@ -42,6 +42,7 @@
href="%{userListUrl}"
pager="false"
navigator="true"
+ rowNum="-1"
navigatorAddOptions="{
height:280,
reloadAfterSubmit:true,
@@ -89,7 +90,7 @@
editable="true"
edittype="password"
hidden="true"/>
- gridModel
+
<sjg:gridColumn name="admin"
title='%{getText("echobase.common.admin")}'
sortable="true"
1
0
r14 - in trunk/echobase-ui/src/main: java/fr/ifremer/echobase/ui java/fr/ifremer/echobase/ui/actions java/fr/ifremer/echobase/ui/validators resources/config resources/i18n
by tchemit@users.forge.codelutin.com 07 Nov '11
by tchemit@users.forge.codelutin.com 07 Nov '11
07 Nov '11
Author: tchemit
Date: 2011-11-07 11:32:04 +0100 (Mon, 07 Nov 2011)
New Revision: 14
Url: http://forge.codelutin.com/repositories/revision/echobase/14
Log:
fix login + clean ui classes
Added:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/json/
Modified:
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-07 10:30:22 UTC (rev 13)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2011-11-07 10:32:04 UTC (rev 14)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.echobase.ui;
-import fr.ifremer.echobase.EchoBaseObjectFactory;
import fr.ifremer.echobase.entities.EchoBaseUser;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -42,46 +41,6 @@
/** Logger. */
private static final Log log = LogFactory.getLog(EchoBaseSession.class);
-// /**
-// * Obtain the user EchoBase session.
-// * <p/>
-// * If not found in application session, then will instanciate it and
-// * push it in it.
-// * <p/>
-// * At the creation time the session, it will also set his object factory.
-// *
-// * @return the user EchoBase session (never null)
-// */
-// public static EchoBaseSession getEchoBaseSession() {
-// Map<String, Object> session = ActionContext.getContext().getSession();
-// EchoBaseSession echoBaseSession = (EchoBaseSession)
-// session.get(SESSION_PARAMETER_ECHO_BASE_SESSION);
-// if (echoBaseSession == null) {
-// // let's create it
-// echoBaseSession = new EchoBaseSession();
-// echoBaseSession.setObjectFactory(EchoBaseObjectFactory.newInstance());
-// session.put(SESSION_PARAMETER_ECHO_BASE_SESSION, echoBaseSession);
-// }
-// return echoBaseSession;
-// }
-
-// /**
-// * Tests if user is loggued (means the {@link #getEchoBaseUser()} is not null).
-// *
-// * @return {@code true} if user is loggued, {@code false} otherwise
-// */
-// public static boolean isUserInSession() {
-// EchoBaseSession session = getEchoBaseSession();
-// boolean result = session.getEchoBaseUser() != null;
-// return result;
-// }
-
- /** Key used to store this EchoBase session in application session */
-// public static final String SESSION_PARAMETER_ECHO_BASE_SESSION = "echobaseSession";
-
- /** Key to set EchoBase factory in this session. */
- protected static final String PROPERTY_OBJECT_FACTORY = "objectFactory";
-
/** Key to set User connected in this session. */
protected static final String PROPERTY_ECHO_BASE_USER = "echobaseUser";
@@ -89,24 +48,6 @@
protected Map<String, Object> store;
/**
- * Gets the object factory dedicated for this user.
- *
- * @return the user's object factory or {@code null} if not in session
- */
- public EchoBaseObjectFactory getObjectFactory() {
- return get(PROPERTY_OBJECT_FACTORY, EchoBaseObjectFactory.class);
- }
-
- /**
- * Sets in this session the object factory.
- *
- * @param objectFactory the new object factory to use in this session
- */
- public void setObjectFactory(EchoBaseObjectFactory objectFactory) {
- set(PROPERTY_OBJECT_FACTORY, objectFactory);
- }
-
- /**
* Gets the informations of user as soon as the user is loggued.
*
* @return the informations of loggued user or {@code null} if not in session
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-07 10:30:22 UTC (rev 13)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2011-11-07 10:32:04 UTC (rev 14)
@@ -23,15 +23,12 @@
*/
package fr.ifremer.echobase.ui.actions;
-import com.google.common.base.Preconditions;
import com.opensymphony.xwork2.ActionContext;
import fr.ifremer.echobase.EchoBaseConfiguration;
-import fr.ifremer.echobase.EchoBaseObjectFactory;
import fr.ifremer.echobase.services.EchoBaseService;
import fr.ifremer.echobase.services.EchoBaseServiceContext;
import fr.ifremer.echobase.services.EchoBaseServiceContextImpl;
import fr.ifremer.echobase.services.EchoBaseServiceFactory;
-import fr.ifremer.echobase.services.IOCService;
import fr.ifremer.echobase.ui.EchoBaseApplicationContext;
import fr.ifremer.echobase.ui.EchoBaseSession;
import org.nuiton.topia.TopiaContext;
@@ -122,13 +119,6 @@
return getEchoBaseApplicationContext().getConfiguration().getApplicationVersion().toString();
}
- public EchoBaseObjectFactory getServiceFactory() {
- Preconditions.checkNotNull(echoBaseSession,
- "No echo base user session injected.");
- EchoBaseObjectFactory factory = echoBaseSession.getObjectFactory();
- return factory;
- }
-
/**
* Fabrique pour récupérer le ServiceContext tel qu'il devrait être fourni
* à la fabrication d'un service.
@@ -162,18 +152,6 @@
this.transaction = transaction;
}
- public IOCService getIocService() {
- return getServiceFactory().newService(IOCService.class);
- }
-
- protected void injectExcept(Class<?>... annotations) throws Exception {
- getIocService().injectExcept(this, annotations);
- }
-
- protected void injectOnly(Class<?>... annotations) throws Exception {
- getIocService().injectOnly(this, annotations);
- }
-
public String formatDate(Date date) {
String result = getDateFormat().format(date);
return result;
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:30:22 UTC (rev 13)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:32:04 UTC (rev 14)
@@ -32,7 +32,7 @@
* Check user login.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 1.0
+ * @since 0.1
*/
public class LoginValidator extends EchoBaseFieldValidatorSupport {
@@ -42,7 +42,7 @@
UserService userService =
(UserService) getFieldValue("userService", object);
- String login = (String) getFieldValue("login", object);
+ String login = (String) getFieldValue("email", object);
String password = (String) getFieldValue("password", object);
if (log.isInfoEnabled()) {
@@ -56,14 +56,14 @@
if (user == null) {
// user not found
- addFieldError("login", _("t3.error.login.unknown"));
+ addFieldError("email", _("echobase.error.login.unknown"));
return;
}
boolean passwordOk = userService.checkPassword(user, password);
if (!passwordOk) {
- addFieldError("password", _("t3.error.bad.password"));
+ addFieldError("password", _("echobase.error.bad.password"));
}
} catch (Exception e) {
if (log.isErrorEnabled()) {
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:30:22 UTC (rev 13)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:32:04 UTC (rev 14)
@@ -38,8 +38,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="topiaTransaction"/>
- <interceptor-ref name="basicStack"/>
+ <interceptor-ref name="echoBaseParamsPrepareParamsStack"/>
</action>
<!-- logout action -->
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-07 10:30:22 UTC (rev 13)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-07 10:32:04 UTC (rev 14)
@@ -6,6 +6,8 @@
echobase.common.email=Email
echobase.common.password=Mot de passe
echobase.common.save=Sauvegarder
+echobase.error.bad.password=Mot de passe incorrrect
+echobase.error.login.unknown=Utilisateur inconnu
echobase.export.queryDescription=Description
echobase.export.queryName=Nom
echobase.export.querySql=SQL
@@ -27,5 +29,3 @@
echobase.title.login=Connection
echobase.title.users=Adminitration des utilisateurs
echobase.user.gridTitle=Liste des utilisateurs
-t3.error.bad.password=
-t3.error.login.unknown=
1
0
07 Nov '11
Author: sletellier
Date: 2011-11-07 11:30:22 +0100 (Mon, 07 Nov 2011)
New Revision: 13
Url: http://forge.codelutin.com/repositories/revision/echobase/13
Log:
- Dont return dtos in service
- Clean project
- Fix traductions
- Debug user page
- Remove hasActionError and hasActionMessages
Modified:
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
trunk/echobase-ui/src/main/resources/config/struts-user.xml
trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java
===================================================================
--- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/AbstractEchoBaseService.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -1,3 +1,26 @@
+/*
+ * #%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.nuiton.topia.TopiaContext;
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-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -1,3 +1,26 @@
+/*
+ * #%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;
@@ -10,7 +33,6 @@
import org.nuiton.topia.TopiaException;
import org.nuiton.util.StringUtil;
-import java.util.ArrayList;
import java.util.List;
/** @author sletellier */
@@ -20,26 +42,21 @@
return EchoBaseDAOHelper.getEchoBaseUserDAO(getTransaction());
}
- public List<EchoBaseUserDTO> getUsers() throws EchoBaseTechnicalException {
+ public List<EchoBaseUser> getUsers() throws EchoBaseTechnicalException {
try {
List<EchoBaseUser> users = getDAO().findAll();
- // Fill dtos
- List<EchoBaseUserDTO> usersDtos = new ArrayList<EchoBaseUserDTO>(users.size());
- for (EchoBaseUser user : users) {
- usersDtos.add(user.toDTO());
- }
- return usersDtos;
+ return users;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
}
- public EchoBaseUserDTO getUserById(String topiaId) {
+ public EchoBaseUser getUserById(String topiaId) {
try {
EchoBaseUser user = getDAO().findByTopiaId(topiaId);
- return user.toDTO();
+ return user;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
@@ -82,18 +99,18 @@
}
}
- public EchoBaseUserDTO getUserByEmail(String email) {
+ public EchoBaseUser getUserByEmail(String email) {
Preconditions.checkNotNull(email);
try {
EchoBaseUserDAO dao = getDAO();
EchoBaseUser user = dao.findByEmail(email);
- return user.toDTO();
+ return user;
} catch (TopiaException eee) {
throw new EchoBaseTechnicalException(eee);
}
}
- public boolean checkPassword(EchoBaseUserDTO user,
+ public boolean checkPassword(EchoBaseUser user,
String password) throws Exception {
String s = encodePassword(password);
return s.equals(user.getPassword());
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/ApplicationListener.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -27,6 +27,7 @@
import fr.ifremer.echobase.EchoBaseConfiguration;
import fr.ifremer.echobase.EchoBaseTechnicalException;
import fr.ifremer.echobase.EchoBaseTopiaRootContextSupplierFactory;
+import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserDTO;
import fr.ifremer.echobase.entities.EchoBaseUserDTOImpl;
import fr.ifremer.echobase.entities.EchoBaseUserImpl;
@@ -181,7 +182,7 @@
* Creates the adminsitrator ({@code admin/admin}) on the internal
* database.
*
- * @param configuration
+ * @param configuration EchoBase configuration
* @throws TopiaException if could not create the user.
*/
protected void createAdminUser(EchoBaseConfiguration configuration) throws TopiaException {
@@ -199,7 +200,7 @@
UserService service = serviceFactory.newService(UserService.class, serviceContext);
- List<EchoBaseUserDTO> users = service.getUsers();
+ List<EchoBaseUser> users = service.getUsers();
if (CollectionUtils.isEmpty(users)) {
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/LoginAction.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -25,8 +25,7 @@
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.interceptor.I18nInterceptor;
-import fr.ifremer.echobase.entities.EchoBaseUserDTO;
-import fr.ifremer.echobase.entities.EchoBaseUserImpl;
+import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.services.UserService;
import fr.ifremer.echobase.ui.EchoBaseSession;
import org.apache.commons.logging.Log;
@@ -91,14 +90,12 @@
public String doLogin() throws Exception {
- EchoBaseUserDTO user = getUserService().getUserByEmail(email);
+ EchoBaseUser user = getUserService().getUserByEmail(email);
EchoBaseSession userSession = getEchoBaseSession();
// user is authorized, keep it in his echoBaseSession
- EchoBaseUserImpl echoBaseUser = new EchoBaseUserImpl();
- echoBaseUser.fromDTO(user);
- userSession.setEchoBaseUser(echoBaseUser);
+ userSession.setEchoBaseUser(user);
// add locale in echoBaseSession if required
Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE);
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/UserAction.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -1,8 +1,16 @@
package fr.ifremer.echobase.ui.actions;
+import fr.ifremer.echobase.EchoBaseTechnicalException;
+import fr.ifremer.echobase.entities.EchoBaseUser;
+import fr.ifremer.echobase.entities.EchoBaseUserDAO;
import fr.ifremer.echobase.entities.EchoBaseUserDTO;
import fr.ifremer.echobase.services.UserService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaException;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -12,8 +20,113 @@
private static final long serialVersionUID = 1L;
+ protected static final Log log = LogFactory.getLog(UserAction.class);
+
protected transient UserService service;
+ // Grid model
+ protected List<EchoBaseUserDTO> userList;
+ protected EchoBaseUserDTO selectedUserDto;
+
+ //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;
+ // Your Total Pages
+ protected Integer total = 0;
+ // All Record
+ protected Integer records = 0;
+
+ public EchoBaseUserDTO getSelectedUserDto() {
+ return selectedUserDto;
+ }
+
+ public void setSelectedUserDto(EchoBaseUserDTO selectedUserDto) {
+ this.selectedUserDto = selectedUserDto;
+ }
+
+ 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;
+ }
+
protected UserService getService() {
if (service == null) {
service = newService(UserService.class);
@@ -22,14 +135,42 @@
}
public List<EchoBaseUserDTO> getUserList() {
- return getService().getUsers();
+ return userList;
}
- public void createOrUpdate(EchoBaseUserDTO userDTO) {
- getService().createOrUpdate(userDTO);
+ public void setUserList(List<EchoBaseUserDTO> userList) {
+ this.userList = userList;
}
- public void delete(EchoBaseUserDTO userDTO) {
- getService().delete(userDTO);
+ @Override
+ public String execute() throws Exception {
+
+ List<EchoBaseUser> users = getService().getUsers();
+
+ // Fill dtos
+ int size = users.size();
+ setRecords(size);
+
+ //calculate the total pages for the query
+ setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
+ List<EchoBaseUserDTO> userList = new ArrayList<EchoBaseUserDTO>(size);
+ for (EchoBaseUser user : users) {
+ userList.add(user.toDTO());
+ }
+ log.info(size + " users founds");
+
+ setUserList(userList);
+
+ return super.execute();
}
+
+ public String createOrUpdate() throws Exception {
+ getService().createOrUpdate(selectedUserDto);
+ return SUCCESS;
+ }
+
+ public String delete() throws Exception {
+ getService().delete(selectedUserDto);
+ return SUCCESS;
+ }
}
Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java
===================================================================
--- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/validators/LoginValidator.java 2011-11-07 10:30:22 UTC (rev 13)
@@ -24,6 +24,7 @@
package fr.ifremer.echobase.ui.validators;
import com.opensymphony.xwork2.validator.ValidationException;
+import fr.ifremer.echobase.entities.EchoBaseUser;
import fr.ifremer.echobase.entities.EchoBaseUserDTO;
import fr.ifremer.echobase.services.UserService;
@@ -50,7 +51,7 @@
try {
// check in db that user is ok
- EchoBaseUserDTO user = userService.getUserByEmail(login);
+ EchoBaseUser user = userService.getUserByEmail(login);
if (user == null) {
Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml
===================================================================
--- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2011-11-07 10:30:22 UTC (rev 13)
@@ -53,25 +53,32 @@
<interceptor-ref name="basicStack"/>
</action>
- <!-- get lists of users -->
+ <!-- Display lists of users -->
<action name="userList" class="fr.ifremer.echobase.ui.actions.UserAction">
<interceptor-ref name="basicStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
- <result name="input">/WEB-INF/jsp/user/users.jsp</result>
+ <result name="success">/WEB-INF/jsp/user/users.jsp</result>
</action>
+ <!-- get lists of users -->
+ <action name="userListData" class="fr.ifremer.echobase.ui.actions.UserAction">
+ <interceptor-ref name="basicStackLoggued"/>
+ <interceptor-ref name="checkUserIsAdmin"/>
+ <result name="success" type="json"/>
+ </action>
+
<!-- update or create (if not exist) user -->
- <action name="createOrUpdate" class="fr.ifremer.echobase.ui.actions.UserAction">
+ <action name="createOrUpdate" method="createOrUpdate" class="fr.ifremer.echobase.ui.actions.UserAction">
<interceptor-ref name="basicStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
- <result name="input">/WEB-INF/jsp/user/users.jsp</result>
+ <result name="success">/WEB-INF/jsp/user/users.jsp</result>
</action>
<!-- delete user -->
- <action name="delete" class="fr.ifremer.echobase.ui.actions.UserAction">
+ <action name="delete" method="delete" class="fr.ifremer.echobase.ui.actions.UserAction">
<interceptor-ref name="basicStackLoggued"/>
<interceptor-ref name="checkUserIsAdmin"/>
- <result name="input">/WEB-INF/jsp/user/users.jsp</result>
+ <result name="success">/WEB-INF/jsp/user/users.jsp</result>
</action>
</package>
Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties
===================================================================
--- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-07 10:30:22 UTC (rev 13)
@@ -13,6 +13,7 @@
echobase.label.locale.english=Anglais
echobase.label.locale.french=Français
echobase.label.login=Connection
+echobase.label.user.login=Utilisateur \: %s
echobase.label.welcome=Bienvenue
echobase.menu.export=Exports
echobase.menu.import=Imports
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2011-11-07 10:30:22 UTC (rev 13)
@@ -41,17 +41,18 @@
<div id="body">
- <s:if test="hasActionMessages()">
- <div class="info_success">
- <s:actionmessage/>
- </div>
- </s:if>
+ <%-- TODO sletellier 20111104 : add this --%>
+ <%--<s:if test="hasActionMessages()">--%>
+ <%--<div class="info_success">--%>
+ <%--<s:actionmessage/>--%>
+ <%--</div>--%>
+ <%--</s:if>--%>
- <s:if test="hasActionErrors()">
- <div class="info_error">
- <s:actionerror/>
- </div>
- </s:if>
+ <%--<s:if test="hasActionErrors()">--%>
+ <%--<div class="info_error">--%>
+ <%--<s:actionerror/>--%>
+ <%--</div>--%>
+ <%--</s:if>--%>
<d:body/>
</div>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2011-11-07 10:30:22 UTC (rev 13)
@@ -32,9 +32,9 @@
<div id='headerRight'>
<div>
<s:text name="echobase.label.user.login">
- <%--<s:param>--%>
- <%--<s:property value="#session.echoBaseSession.echoBaseUser.login"/>--%>
- <%--</s:param>--%>
+ <s:param>
+ <s:property value="#session.echoBaseSession.echoBaseUser.email"/>
+ </s:param>
</s:text>
<ul>
<li>
@@ -45,9 +45,9 @@
</ul>
</div>
<br/>
- <%@ include file="menu.jsp" %>
- <%@ include file="i18n.jsp" %>
+ <%@ include file="i18n.jsp" %>
<br/>
</div>
+ <%@ include file="menu.jsp" %>
</div>
<hr/>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/menu.jsp 2011-11-07 10:30:22 UTC (rev 13)
@@ -36,7 +36,7 @@
<%--<s:if--%>
<%--test="%{userIsAdmin}">--%>
<li>
- <s:a namespace="admin" action="users"><s:text name="echobase.menu.users"/></s:a>
+ <s:a action="userList" namespace="/user"><s:text name="echobase.menu.users"/></s:a>
</li>
<%--</s:if>--%>
</ul>
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/users.jsp 2011-11-07 10:30:22 UTC (rev 13)
@@ -21,7 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
--%>
-<%@page contentType="text/html" pageEncoding="UTF-8" %>
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
@@ -32,14 +32,15 @@
<hr/>
-<s:url id="userListUrl" namespace="/users" action="userList"/>
-<s:url id="saveUrl" namespace="/users" action="createOrUpdate" />
+<s:url id="userListUrl" namespace="/user" action="userListData"/>
+<s:url id="saveUrl" namespace="/user" action="createOrUpdate"/>
<sjg:grid id="usersList"
caption='%{getText("echobase.user.gridTitle")}'
dataType="json"
+ title="%{getText('echobase.user.gridTitle')}"
href="%{userListUrl}"
- pager="true"
+ pager="false"
navigator="true"
navigatorAddOptions="{
height:280,
@@ -64,9 +65,7 @@
return isError(response.responseText);
}
}"
- gridModel="gridModel"
- rowList="10,100,1000"
- rowNum="10"
+ gridModel="userList"
editurl="%{saveUrl}"
editinline="false"
rownumbers="true"
@@ -75,6 +74,7 @@
viewrecords="true">
<sjg:gridColumn name="id"
+ title='id'
key="true"
hidden="true"/>
@@ -89,7 +89,7 @@
editable="true"
edittype="password"
hidden="true"/>
-
+ gridModel
<sjg:gridColumn name="admin"
title='%{getText("echobase.common.admin")}'
sortable="true"
Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-04 14:01:05 UTC (rev 12)
+++ trunk/echobase-ui/src/main/webapp/WEB-INF/web.xml 2011-11-07 10:30:22 UTC (rev 13)
@@ -30,16 +30,14 @@
<display-name>EchoBase</display-name>
<filter>
- <filter-name>struts-prepare</filter-name>
- <filter-class>
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter
- </filter-class>
+ <filter-name>topiaCloseTransaction</filter-name>
+ <filter-class>org.nuiton.web.struts2.filter.CloseTopiaTransactionFilter</filter-class>
</filter>
<filter>
- <filter-name>struts-execute</filter-name>
+ <filter-name>struts-prepare</filter-name>
<filter-class>
- org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter
+ org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter
</filter-class>
</filter>
@@ -49,27 +47,29 @@
</filter>
<filter>
- <filter-name>topiaCloseTransaction</filter-name>
- <filter-class>org.nuiton.web.struts2.filter.CloseTopiaTransactionFilter</filter-class>
+ <filter-name>struts-execute</filter-name>
+ <filter-class>
+ org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter
+ </filter-class>
</filter>
<filter-mapping>
- <filter-name>struts-prepare</filter-name>
+ <filter-name>topiaCloseTransaction</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>sitemesh</filter-name>
+ <filter-name>struts-prepare</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>struts-execute</filter-name>
+ <filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>topiaCloseTransaction</filter-name>
+ <filter-name>struts-execute</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
1
0