Author: tchemit Date: 2011-11-04 13:06:39 +0100 (Fri, 04 Nov 2011) New Revision: 9 Url: http://forge.codelutin.com/repositories/revision/echobase/9 Log: add DTO for JSON purposes + remove generated i18n Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/ExportQueryImpl.java Modified: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties trunk/echobase-entities/src/main/xmi/echobase.properties trunk/echobase-entities/src/main/xmi/echobase.zargo 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-04 10:09:27 UTC (rev 8) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2011-11-04 12:06:39 UTC (rev 9) @@ -27,6 +27,7 @@ import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaContextFactory; import org.nuiton.util.ApplicationConfig; import org.nuiton.util.ArgumentsParserException; import org.nuiton.util.FileUtil; @@ -84,20 +85,29 @@ } public File getDataDirectory() { - File v = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.DATA_DIRECTORY.key); - return v; + File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.DATA_DIRECTORY.key); + Preconditions.checkNotNull(file); + return file; } public Version getApplicationVersion() { Version v = applicationConfig.getOptionAsVersion(EchoBaseConfigurationOption.VERSION.key); + Preconditions.checkNotNull(v); return v; } public URL getApplicationSite() { URL url = applicationConfig.getOptionAsURL(EchoBaseConfigurationOption.SITE_URL.key); + Preconditions.checkNotNull(url); return url; } + public Class<?> getDriverClass() { + Class<?> klass = applicationConfig.getOptionAsClass(TopiaContextFactory.CONFIG_DRIVER); + Preconditions.checkNotNull(klass); + return klass; + } + /** * Creates a directory given the configuration given key. * 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-04 10:09:27 UTC (rev 8) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/EchoBaseTopiaRootContextSupplierFactory.java 2011-11-04 12:06:39 UTC (rev 9) @@ -104,6 +104,11 @@ Properties properties = config.getProperties(); + return newDatabaseFromProperties(properties); + } + + public Supplier<TopiaContext> newDatabaseFromProperties(Properties properties) { + if (log.isDebugEnabled()) { log.debug("Database settings are :"); Set<String> keysToDisplay = Sets.newHashSet( Added: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java (rev 0) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.java 2011-11-04 12:06:39 UTC (rev 9) @@ -0,0 +1,53 @@ +/* + * #%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; + +/** + * Default implementation of the {@link EchoBaseUser}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class EchoBaseUserImpl extends EchoBaseUserAbstract { + + private static final long serialVersionUID = 1L; + + @Override + public EchoBaseUserDTO toDTO() { + EchoBaseUserDTO dto = new EchoBaseUserDTOImpl(); + dto.setAdmin(isAdmin()); + dto.setEmail(getEmail()); + dto.setPassword(getPassword()); + dto.setId(getTopiaId()); + return dto; + } + + @Override + public void fromDTO(EchoBaseUserDTO dto) { + setAdmin(dto.isAdmin()); + setEmail(dto.getEmail()); + setPassword(dto.getPassword()); + } + +} Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserImpl.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/ExportQueryImpl.java =================================================================== --- trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/ExportQueryImpl.java (rev 0) +++ trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/ExportQueryImpl.java 2011-11-04 12:06:39 UTC (rev 9) @@ -0,0 +1,47 @@ +/* + * #%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; + +/** + * Default implementation of the {@link ExportQuery}. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class ExportQueryImpl extends ExportQueryAbstract { + + private static final long serialVersionUID = 1L; + + @Override + public ExportQueryDTO toDTO() { + ExportQueryDTO dto = new ExportQueryDTOImpl(); + dto.setDescription(getDescription()); + dto.setId(getTopiaId()); + dto.setLastModifiedDate(getLastModifiedDate()); + dto.setLastModifiedUser(getLastModifiedUser().toDTO()); + dto.setName(getName()); + dto.setSqlQuery(getSqlQuery()); + return dto; + } +} Property changes on: trunk/echobase-entities/src/main/java/fr/ifremer/echobase/entities/ExportQueryImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native 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-04 10:09:27 UTC (rev 8) +++ trunk/echobase-entities/src/main/resources/i18n/echobase-entities_fr_FR.properties 2011-11-04 12:06:39 UTC (rev 9) @@ -1,16 +1 @@ -echobase.common.admin= -echobase.common.description= -echobase.common.echoBaseUser= -echobase.common.email= -echobase.common.exportQuery= -echobase.common.lastModifiedDate= -echobase.common.lastModifiedUser= -echobase.common.login= -echobase.common.name= -echobase.common.password= -echobase.common.sqlQuery= echobase.config.data.directory.description= -echobase.config.internal.db.directory.description= -echobase.config.parameterProfiles.storage.directory.description= -echobase.config.treatment.working.directory.description= -echobase.user.log.directory.description= Modified: trunk/echobase-entities/src/main/xmi/echobase.properties =================================================================== --- trunk/echobase-entities/src/main/xmi/echobase.properties 2011-11-04 10:09:27 UTC (rev 8) +++ trunk/echobase-entities/src/main/xmi/echobase.properties 2011-11-04 12:06:39 UTC (rev 9) @@ -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 Modified: trunk/echobase-entities/src/main/xmi/echobase.zargo =================================================================== (Binary files differ)