r111 - in trunk/echobase-ui: . src/main/java/fr/ifremer/echobase/ui/actions/dbeditor src/main/resources/config src/main/resources/i18n src/main/webapp/WEB-INF src/main/webapp/WEB-INF/jsp/dbeditor
Author: tchemit Date: 2011-11-23 19:01:02 +0100 (Wed, 23 Nov 2011) New Revision: 111 Url: http://forge.codelutin.com/repositories/revision/echobase/111 Log: finish dbeditor (import-export is ok now) + use the final csv api Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/csvImportResult.jsp Removed: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/modifImportResult.jsp Modified: trunk/echobase-ui/pom.xml trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp Modified: trunk/echobase-ui/pom.xml =================================================================== --- trunk/echobase-ui/pom.xml 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/pom.xml 2011-11-23 18:01:02 UTC (rev 111) @@ -286,7 +286,27 @@ </configuration> </plugin> - <plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + + <profile> + <id>do-release</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + <properties> + <env>prod</env> + </properties> + + <build> + <plugins> + <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> @@ -311,23 +331,8 @@ </overlays> </configuration> </plugin> - </plugins> - </pluginManagement> - </build> - - <profiles> - - <profile> - <id>do-release</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <properties> - <env>prod</env> - </properties> + </plugins> + </build> </profile> <profile> Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2011-11-23 18:01:02 UTC (rev 111) @@ -24,18 +24,16 @@ package fr.ifremer.echobase.ui.actions.dbeditor; import com.google.common.collect.Maps; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.entities.meta.ColumnMeta; import fr.ifremer.echobase.entities.meta.DbMeta; import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; -import static org.nuiton.i18n.I18n.l_; - /** * A abstract action which can load the table names and a selected table * meta datas. @@ -47,40 +45,40 @@ private static final long serialVersionUID = 1L; - /** Name of the table to load. */ - protected String tableName; + /** Type of entity to load. */ + protected EchoBaseEntityEnum entityType; - /** All tables availables */ - protected Map<String, String> tableNames; + /** All entities availables. */ + protected Map<String, String> entityTypes; - /** Metas of the table */ + /** Metas of the table. */ protected TableMeta tableMeta; - public Map<String, String> getTableNames() { - return tableNames; + public Map<String, String> getEntityTypes() { + return entityTypes; } public List<ColumnMeta> getColumnMetas() { return tableMeta.getColumns(); } - public void setTableName(String tableName) { - this.tableName = tableName; + public void setEntityType(EchoBaseEntityEnum entityType) { + this.entityType = entityType; } - public String getTableName() { - return tableName; + public EchoBaseEntityEnum getEntityType() { + return entityType; } public void load() throws Exception { - tableNames = Maps.newTreeMap(); + entityTypes = Maps.newTreeMap(); DbMeta dbMeta = getEchoBaseApplicationContext().getDbMeta(); for (TableMeta tableMeta : dbMeta) { String name = tableMeta.getName(); String i18nKey = tableMeta.getI18nKey(); - tableNames.put(name, l_(getLocale(), i18nKey)); + entityTypes.put(name, _(i18nKey)); } - if (StringUtils.isEmpty(tableName)) { + if (entityType == null) { // no table selected addActionMessage(_("echobase.info.no.table.selected")); @@ -88,7 +86,7 @@ // load table metas DbEditorService dbEditorService = newService(DbEditorService.class); - tableMeta = dbEditorService.getTableMetas(tableName); + tableMeta = dbEditorService.getTableMetas(entityType); } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2011-11-23 18:01:02 UTC (rev 111) @@ -23,13 +23,13 @@ */ package fr.ifremer.echobase.ui.actions.dbeditor; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.io.File; -import java.io.FileInputStream; +import java.io.ByteArrayInputStream; import java.io.InputStream; /** @@ -45,14 +45,14 @@ /** Logger. */ private static final Log log = LogFactory.getLog(ImportTable.class); - /** Name of the table to load. */ - protected String tableName; + /** Type of entity to export. */ + protected EchoBaseEntityEnum entityType; /** Default file name to create. */ protected String exportFileName; /** Stream of the file to export. */ - protected InputStream inputStream; + protected transient InputStream inputStream; /** Length of the file to export. */ protected long contentLength; @@ -60,8 +60,8 @@ /** Type of the file to export. */ protected String contentType; - public void setTableName(String tableName) { - this.tableName = tableName; + public void setEntityType(EchoBaseEntityEnum entityType) { + this.entityType = entityType; } public void setExportFileName(String exportFileName) { @@ -87,14 +87,16 @@ @Override public String execute() throws Exception { - DbEditorService dbEditorService = newService(DbEditorService.class); + DbEditorService service = newService(DbEditorService.class); - File file = dbEditorService.exportDatas(tableName); + String content = service.exportDatas(entityType); + if (log.isDebugEnabled()) { + log.debug("file to export " + content); + } + contentLength = content.length(); contentType = "text/csv"; - contentLength = file.length(); - inputStream = new FileInputStream(file); - + inputStream = new ByteArrayInputStream(content.getBytes()); return SUCCESS; } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2011-11-23 18:01:02 UTC (rev 111) @@ -23,7 +23,7 @@ */ package fr.ifremer.echobase.ui.actions.dbeditor; -import fr.ifremer.echobase.entities.EntityModificationLogImpl; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.AbstractJSONPaginedAction; import org.apache.commons.logging.Log; @@ -44,8 +44,8 @@ /** Logger. */ private static final Log log = LogFactory.getLog(ImportTable.class); - /** Name of the table to load. */ - protected String tableName; + /** Type of entity to load. */ + protected EchoBaseEntityEnum entityType; /** Datas of the given table. */ protected Map<?, ?>[] datas; @@ -54,6 +54,10 @@ super("datas_"); } + public void setEntityType(EchoBaseEntityEnum entityType) { + this.entityType = entityType; + } + public Map<?, ?>[] getDatas() { return datas; } @@ -78,10 +82,6 @@ return pager.getRecords(); } - public void setTableName(String tableName) { - this.tableName = tableName; - } - @Override public String execute() throws Exception { @@ -96,10 +96,10 @@ log.debug("sord = " + ascendantOrder); } - DbEditorService dbEditorService = newService(DbEditorService.class); + DbEditorService service = newService(DbEditorService.class); - datas = dbEditorService.getDatas( - tableName, + datas = service.getDatas( + entityType, pager, sortColumn, ascendantOrder @@ -114,7 +114,7 @@ public String entityModificationLogs() throws Exception { - tableName = EntityModificationLogImpl.class.getName(); + entityType = EchoBaseEntityEnum.EntityModificationLog; execute(); return SUCCESS; } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2011-11-23 18:01:02 UTC (rev 111) @@ -24,6 +24,7 @@ package fr.ifremer.echobase.ui.actions.dbeditor; import com.google.common.collect.Maps; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.entities.meta.ColumnMeta; import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.services.DbEditorService; @@ -42,8 +43,8 @@ private static final long serialVersionUID = 1L; - /** Name of the table to load. */ - protected String tableName; + /** Type of entity to load. */ + protected EchoBaseEntityEnum entityType; /** Id of entity to load. */ protected String id; @@ -54,8 +55,8 @@ /** Universe of columns metat datas of the selected entity type. */ protected Map<String, ColumnMeta> metas; - public void setTableName(String tableName) { - this.tableName = tableName; + public void setEntityType(EchoBaseEntityEnum entityType) { + this.entityType = entityType; } public void setId(String id) { @@ -73,11 +74,12 @@ @Override public String execute() throws Exception { - DbEditorService dbEditorService = newService(DbEditorService.class); + DbEditorService service = newService(DbEditorService.class); - datas = dbEditorService.getData(tableName, id); + TableMeta table = serviceContext.getDbMeta().getTable(entityType); + + datas = service.getData(table, id); - TableMeta table = serviceContext.getDbMeta().getTable(tableName); List<ColumnMeta> columnMetas = table.getColumns(); metas = Maps.newHashMap(); for (ColumnMeta columnMeta : columnMetas) { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2011-11-23 18:01:02 UTC (rev 111) @@ -23,6 +23,7 @@ */ package fr.ifremer.echobase.ui.actions.dbeditor; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; import org.nuiton.topia.persistence.TopiaEntity; @@ -40,11 +41,13 @@ private static final long serialVersionUID = 1L; + /** Type of entity to load. */ + protected EchoBaseEntityEnum entityType; + + /** Entities loaded (key are id, values are decoration of entity). */ protected Map<String, String> entities; - protected String entityType; - - public void setEntityType(String entityType) { + public void setEntityType(EchoBaseEntityEnum entityType) { this.entityType = entityType; } @@ -56,7 +59,8 @@ public String execute() throws Exception { DbEditorService service = newService(DbEditorService.class); - List<TopiaEntity> foreignEntities = service.getForeignDatas(entityType); + List<? extends TopiaEntity> foreignEntities = + service.getForeignDatas(entityType.getContract()); entities = sortAndDecorate(foreignEntities, null); return SUCCESS; Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2011-11-23 18:01:02 UTC (rev 111) @@ -24,15 +24,13 @@ package fr.ifremer.echobase.ui.actions.dbeditor; import com.google.common.base.Throwables; -import com.google.common.collect.Lists; import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import fr.ifremer.echobase.services.CsvImportResult; import fr.ifremer.echobase.services.DbEditorService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.util.beans.PropertyDiff; import java.io.File; -import java.util.List; /** * To import datas from import file. @@ -53,15 +51,22 @@ /** WTF ? */ protected File importFile; + /** Flag to authorize to create an entity if not found in db. */ + protected boolean createIfNotFound = true; + /** WTF ? */ protected String importFileContentType; /** WTF ? */ protected String importFileFileName; - /** WTF ? */ - protected List<PropertyDiff[]> propertyDiffs; + /** CSV import result */ + private CsvImportResult result; + public CsvImportResult getResult() { + return result; + } + public File getImportFile() { return importFile; } @@ -86,16 +91,14 @@ this.importFileFileName = importFileFileName; } - public List<PropertyDiff[]> getPropertyDiffs() { - if (propertyDiffs == null) { - return Lists.newArrayList(); - } - return propertyDiffs; + + public boolean isCreateIfNotFound() { + return createIfNotFound; } -// public void setPropertyDiffs(List<PropertyDiff[]> propertyDiffs) { -// this.propertyDiffs = propertyDiffs; -// } + public void setCreateIfNotFound(boolean createIfNotFound) { + this.createIfNotFound = createIfNotFound; + } @Override public String input() throws Exception { @@ -111,9 +114,11 @@ DbEditorService dbEditorService = newService(DbEditorService.class); try { - propertyDiffs = dbEditorService.importDatas(tableName, - importFile, - getEchoBaseSession().getEchoBaseUser()); + result = dbEditorService.importDatas(getEntityType(), + importFileFileName, + importFile, + createIfNotFound, + getEchoBaseSession().getEchoBaseUser()); } catch (Exception eee) { String message = "Failed to import datas : "; @@ -122,19 +127,7 @@ return ERROR; } - for (PropertyDiff[] diffs : propertyDiffs) { - for (PropertyDiff diff : diffs) { - String msg = _("echobase.message.modified.property", - diff.getSourceProperty(), - diff.getSourceValue(), - diff.getTargetValue()); - log.info(msg); - - addActionMessage(msg); - } - } - return SUCCESS; } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/LoadEntities.java 2011-11-23 18:01:02 UTC (rev 111) @@ -35,6 +35,7 @@ private static final long serialVersionUID = 1L; + /** Default name of the export file. */ protected String exportFileName; public String getExportFileName() { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2011-11-23 18:01:02 UTC (rev 111) @@ -24,12 +24,12 @@ package fr.ifremer.echobase.ui.actions.dbeditor; import com.google.common.collect.Maps; +import fr.ifremer.echobase.entities.EchoBaseEntityEnum; import fr.ifremer.echobase.entities.meta.TableMeta; import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; import org.apache.commons.lang3.StringUtils; import org.apache.struts2.interceptor.ParameterAware; -import org.nuiton.util.beans.PropertyDiff; import java.util.List; import java.util.Map; @@ -44,8 +44,8 @@ private static final long serialVersionUID = 1L; - /** Name of the table to load. */ - protected String tableName; + /** Type of entity to save. */ + protected EchoBaseEntityEnum entityType; /** id of entity to save. */ protected String id; @@ -55,14 +55,10 @@ protected Map<String, String[]> params; - public void setTableName(String tableName) { - this.tableName = tableName; + public void setEntityType(EchoBaseEntityEnum entityType) { + this.entityType = entityType; } - public String getTableName() { - return tableName; - } - public void setId(String id) { this.id = id; } @@ -70,8 +66,8 @@ @Override public String execute() throws Exception { - DbEditorService dbEditorService = newService(DbEditorService.class); - TableMeta tableMeta = dbEditorService.getTableMetas(tableName); + DbEditorService service = newService(DbEditorService.class); + TableMeta tableMeta = service.getTableMetas(entityType); Map<String, String> properties = Maps.newHashMap(); List<String> columnNames = tableMeta.getColumnNames(); for (String columnName : columnNames) { @@ -93,19 +89,12 @@ } } - PropertyDiff[] diffs = - dbEditorService.saveEntity(tableMeta, - id, - properties, - getEchoBaseSession().getEchoBaseUser()); + service.saveEntity(tableMeta, + id, + properties, + getEchoBaseSession().getEchoBaseUser()); - for (PropertyDiff diff : diffs) { - addActionMessage(_("echobase.message.modified.property", - diff.getSourceProperty(), - diff.getSourceValue(), - diff.getTargetValue()) - ); - } + return SUCCESS; } Modified: trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/resources/config/struts-dbeditor.xml 2011-11-23 18:01:02 UTC (rev 111) @@ -75,9 +75,8 @@ <!-- Import some entities from a csv file --> <action name="doImport" class="fr.ifremer.echobase.ui.actions.dbeditor.ImportTable"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result>/WEB-INF/jsp/dbeditor/modifImportResult.jsp</result> + <result>/WEB-INF/jsp/dbeditor/csvImportResult.jsp</result> <result name="input">/WEB-INF/jsp/dbeditor/dbeditor.jsp</result> - <result name="error">/WEB-INF/jsp/dbeditor/modifImportResult.jsp</result> </action> <!-- Export a selected entity type to a csv file --> 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-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2011-11-23 18:01:02 UTC (rev 111) @@ -21,6 +21,7 @@ echobase.common.admin=Administrateur echobase.common.comment=Commentaire echobase.common.email=Email +echobase.common.entityType=Type d'entité echobase.common.jdbcLogin=Login de connexion echobase.common.jdbcPassword=Mot de passe echobase.common.jdbcUrl=Url de connexion @@ -47,10 +48,11 @@ echobase.header.request.result=Résultat de la requête sql echobase.header.user.gridTitle=Liste des utilisateurs echobase.header.voyageSelect=Selectionnez un voyage -echobase.info.dbeditor.propertyDiffsResult=Nombres d'entrées modifiés \: %s +echobase.info.dbeditor.propertyDiffsResult=Résultat d'import de données echobase.info.no.sqlQuery.saved=Aucune requête d'export sql enregistré echobase.info.no.sqlQuery.selected=Aucune requête d'export sql sélectionnée echobase.info.no.table.selected=Aucune table sélectionnée +echobase.label.createIfNotFound=Créer les entités non trouvées en base echobase.label.embeddedApplicationFileName=Nom de l'archive à télécharger echobase.label.embeddedWarFileName=Nom du war à utiliser echobase.label.exportFileName=Nom du fichier d'export @@ -66,11 +68,12 @@ echobase.label.locale.english=Anglais echobase.label.locale.french=Français echobase.label.login=Connexion +echobase.label.numberOfCreatedEntities=Nombre d'entitiés créées +echobase.label.numberOfUpdatedEntities=Nombre d'entitiés mises à jour echobase.label.query.description=Description echobase.label.query.name=Nom echobase.label.query.sql=SQL echobase.label.sqlQueries=Requêtes enregistrées -echobase.label.tableName=Nom de la table echobase.label.user.login=Utilisateur \: %s echobase.label.voyageToSelect=Voyage à exporter echobase.legend.dbeditor.edit=Edition de '%s' Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2011-11-23 18:01:02 UTC (rev 111) @@ -30,6 +30,7 @@ <pattern>/user/login*</pattern> <pattern>/index*</pattern> <pattern>/dbeditor/getForeignEntities*</pattern> + <pattern>/dbeditor/doExport*</pattern> <pattern>/export/exportSqlResult*</pattern> </excludes> Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/csvImportResult.jsp (from rev 107, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/modifImportResult.jsp) =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/csvImportResult.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/csvImportResult.jsp 2011-11-23 18:01:02 UTC (rev 111) @@ -0,0 +1,49 @@ +<%-- + #%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" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<title><s:text name="echobase.title.dbEditor"/></title> + +<h2> + <s:text name="echobase.info.dbeditor.propertyDiffsResult"/> +</h2> + +<fieldset> + <s:label key="result.entityType" + label="%{getText('echobase.common.entityType')}"/> + + <s:label key="result.importFileName" + label="%{getText('echobase.label.importFile')}"/> + + <s:label key="result.numberCreated" + label="%{getText('echobase.label.numberOfCreatedEntities')}"/> + + <s:label key="result.numberUpdated" + label="%{getText('echobase.label.numberOfUpdatedEntities')}"/> +</fieldset> + +<s:a namespace="/dbeditor" action="dbeditor"> + <s:param name="entityType" value="%{result.entityType}"/> + <s:text name="echobase.action.return"/> +</s:a> Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/csvImportResult.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/dbeditor.jsp 2011-11-23 18:01:02 UTC (rev 111) @@ -31,7 +31,7 @@ <s:url id="reloadUrl" action="dbeditor" namespace="/dbeditor"/> <s:url id="getTableData" action="getTableData" namespace="/dbeditor"/> -<s:set name="tableSelected" value="%{tableName != null && tableName != ''}"/> +<s:set name="tableSelected" value="%{entityType != null}"/> <title><s:text name="echobase.title.dbEditor"/></title> @@ -51,8 +51,8 @@ }); // on table name change, let's reload reload this page - $('[name="tableName"]').change(function(event) { - var url = "${reloadUrl}?" + $.param({tableName:this.value}); + $('[name="entityType"]').change(function(event) { + var url = "${reloadUrl}?" + $.param({entityType:this.value}); window.location = url; }); @@ -78,11 +78,11 @@ var id = jQuery.struts2_jquery['datas']['selectedRow']; // get table name - var tableName = "${tableName}"; + var entityType = "${entityType}"; // get entity value from json jQuery.getJSON("${getTableData}", - { "tableName":tableName, "id":id }, function (result) { + { "entityType":entityType, "id":id }, function (result) { // get metadatas from the response var metas = result.metas; @@ -182,8 +182,8 @@ } </script> -<s:select key="tableName" label='%{getText("echobase.label.tableName")}' - list="tableNames" headerKey="" headerValue=""/> +<s:select key="entityType" label='%{getText("echobase.common.entityType")}' + list="entityTypes" headerKey="" headerValue=""/> <br class="clearBoth"/> @@ -199,16 +199,19 @@ <s:form id="importForm" namespace="/dbeditor" method="post" enctype="multipart/form-data"> - <s:hidden key="tableName" label=''/> + <s:hidden key="entityType" label=''/> <s:file key="importFile" required="true" label="%{getText('echobase.label.importFile')}"/> + + <s:checkbox key='createIfNotFound' value='true' + label='%{getText("echobase.label.createIfNotFound")}'/> <br/> <s:submit key="echobase.action.importTable" action="doImport" align="right"/> </s:form> <s:form id="exportForm" namespace="/dbeditor" method="post"> - <s:hidden key="tableName" label=''/> + <s:hidden key="entityType" label=''/> <s:textfield key="exportFileName" required="true" size="100" label="%{getText('echobase.label.exportFileName')}"/> @@ -225,11 +228,11 @@ <s:if test="tableSelected"> <s:url id="loadUrl" action="getTableDatas" namespace="/dbeditor" escapeAmp="false"> - <s:param name="tableName" value="%{tableName}"/> + <s:param name="entityType" value="%{entityType}"/> </s:url> <s:set var="tableI18nName" - value="%{getText('echobase.common.tableDatas', tableNames[tableName])}"/> + value="%{getText('echobase.common.tableDatas', entityTypes[entityType])}"/> <sjg:grid id="datas" dataType="json" href="%{loadUrl}" gridModel="datas" caption="%{tableI18nName}" @@ -284,9 +287,9 @@ </s:text> </legend> - <s:hidden key="tableName" label=''/> + <s:hidden key="entityType" label=''/> - <s:hidden id="id" name="id"/> + <s:hidden key="id" label=''/> <s:iterator value="columnMetas" var="meta" status="status"> <s:if test="#meta.fK"> Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/modifImportResult.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/modifImportResult.jsp 2011-11-23 17:51:57 UTC (rev 110) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/dbeditor/modifImportResult.jsp 2011-11-23 18:01:02 UTC (rev 111) @@ -1,36 +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" pageEncoding="utf-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<title><s:text name="echobase.title.dbEditor"/></title> - -<h2> - <s:text name="echobase.info.dbeditor.propertyDiffsResult"> - <s:param value="%{propertyDiffs.size}"/> - </s:text> -</h2> -<s:a namespace="/dbeditor" action="dbeditor"> - <s:param name="tableName" value="%{tableName}"/> - <s:text name="echobase.action.return"/> -</s:a>
participants (1)
-
tchemit@users.forge.codelutin.com