Tutti-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
April 2014
- 5 participants
- 75 discussions
Author: tchemit
Date: 2014-04-22 23:58:53 +0200 (Tue, 22 Apr 2014)
New Revision: 1721
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1721
Log:
fix i18n version
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-22 17:00:37 UTC (rev 1720)
+++ trunk/pom.xml 2014-04-22 21:58:53 UTC (rev 1721)
@@ -136,7 +136,7 @@
<signatureVersion>1.0</signatureVersion>
<!-- libraries version -->
- <nuitonI18nVersion>3.1</nuitonI18nVersion>
+ <nuitonI18nVersion>3.0</nuitonI18nVersion>
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<eugenePluginVersion>2.7.4</eugenePluginVersion>
<!--<hibernateVersion>3.6.10.Final</hibernateVersion>-->
1
0
Author: tchemit
Date: 2014-04-22 19:00:37 +0200 (Tue, 22 Apr 2014)
New Revision: 1720
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1720
Log:
refs #4979 (use adagio 3.5.2)
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-22 16:10:25 UTC (rev 1719)
+++ trunk/pom.xml 2014-04-22 17:00:37 UTC (rev 1720)
@@ -136,14 +136,14 @@
<signatureVersion>1.0</signatureVersion>
<!-- libraries version -->
- <nuitonI18nVersion>3.0</nuitonI18nVersion>
+ <nuitonI18nVersion>3.1</nuitonI18nVersion>
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<eugenePluginVersion>2.7.4</eugenePluginVersion>
<!--<hibernateVersion>3.6.10.Final</hibernateVersion>-->
<jaxxVersion>2.8.4</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<slf4jVersion>1.7.5</slf4jVersion>
- <adagioVersion>3.5.2-SNAPSHOT</adagioVersion>
+ <adagioVersion>3.5.2</adagioVersion>
<bluecoveVersion>2.1.0</bluecoveVersion>
<hibernateVersion>4.3.1.Final</hibernateVersion>
<springVersion>4.0.1.RELEASE</springVersion>
1
0
r1719 - trunk/tutti-ui-swing/src/main/resources/icons
by tchemit@users.forge.codelutin.com 22 Apr '14
by tchemit@users.forge.codelutin.com 22 Apr '14
22 Apr '14
Author: tchemit
Date: 2014-04-22 18:10:25 +0200 (Tue, 22 Apr 2014)
New Revision: 1719
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1719
Log:
refs #4958 (add icons)
Added:
trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-dirty.png
trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-ready-to-sync.png
trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-waiting.png
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-dirty.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-dirty.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-ready-to-sync.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-ready-to-sync.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-waiting.png
===================================================================
(Binary files differ)
Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-cruise-waiting.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
1
0
21 Apr '14
Author: tchemit
Date: 2014-04-21 15:27:20 +0200 (Mon, 21 Apr 2014)
New Revision: 1718
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1718
Log:
refs-60 #4979
Added:
trunk/tutti-persistence/src/main/resources/applicationContext-conf-tutti.xml
trunk/tutti-persistence/src/main/resources/queries-failsafe.hbm.xml
trunk/tutti-persistence/src/main/resources/tutti-conf.xml
Removed:
trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/
trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml
Modified:
trunk/pom.xml
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java
trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml
trunk/tutti-persistence/src/main/resources/ehcache.xml
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
trunk/tutti-persistence/src/main/resources/tuttiBeanRefFactory.xml
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/resources/beanRefFactoryWitNoDb.xml
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
trunk/tutti-ui-swing/pom.xml
trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/pom.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -139,13 +139,14 @@
<nuitonI18nVersion>3.0</nuitonI18nVersion>
<nuitonValidatorVersion>3.0-rc-1</nuitonValidatorVersion>
<eugenePluginVersion>2.7.4</eugenePluginVersion>
- <hibernateVersion>3.6.10.Final</hibernateVersion>
+ <!--<hibernateVersion>3.6.10.Final</hibernateVersion>-->
<jaxxVersion>2.8.4</jaxxVersion>
<swingXVersion>1.6.4</swingXVersion>
<slf4jVersion>1.7.5</slf4jVersion>
- <adagioVersion>3.4.1</adagioVersion>
+ <adagioVersion>3.5.2-SNAPSHOT</adagioVersion>
<bluecoveVersion>2.1.0</bluecoveVersion>
- <springVersion>3.2.3.RELEASE</springVersion>
+ <hibernateVersion>4.3.1.Final</hibernateVersion>
+ <springVersion>4.0.1.RELEASE</springVersion>
<hsqldbVersion>1.8.0.10</hsqldbVersion>
<!-- I18n configuration -->
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfiguration.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -25,14 +25,11 @@
*/
import com.google.common.base.Charsets;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Sets;
-import com.google.common.io.Files;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
+import fr.ifremer.adagio.core.config.AdagioConfiguration;
+import fr.ifremer.adagio.core.config.AdagioConfigurationOption;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import fr.ifremer.tutti.type.CoordinateEditorType;
import fr.ifremer.tutti.type.WeightUnit;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.logging.Log;
@@ -41,6 +38,7 @@
import org.nuiton.config.ApplicationConfigHelper;
import org.nuiton.config.ApplicationConfigProvider;
import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.config.ConfigOptionDef;
import org.nuiton.jaxx.application.ApplicationConfiguration;
import org.nuiton.jaxx.application.ApplicationIOUtil;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
@@ -48,15 +46,13 @@
import javax.swing.KeyStroke;
import java.awt.Color;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URL;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
-import java.util.Properties;
+import java.util.Map;
import java.util.Set;
import static org.nuiton.i18n.I18n.t;
@@ -82,10 +78,48 @@
TuttiConfiguration.instance = instance;
}
+ public static Set<ApplicationConfigProvider> getDefaultApplicationConfig(ApplicationConfig applicationConfig) {
+
+ // get all config providers
+ Set<ApplicationConfigProvider> providers =
+ ApplicationConfigHelper.getProviders(null,
+ null,
+ null,
+ true);
+
+ // load all default options
+ ApplicationConfigHelper.loadAllDefaultOption(applicationConfig,
+ providers);
+
+ // Override some adagio default config
+ Map<ConfigOptionDef, ConfigOptionDef> translateOptions = new HashMap<>();
+
+ translateOptions.put(TuttiConfigurationOption.BASEDIR, AdagioConfigurationOption.BASEDIR);
+ translateOptions.put(TuttiConfigurationOption.DATA_DIRECTORY, AdagioConfigurationOption.DATA_DIRECTORY);
+ translateOptions.put(TuttiConfigurationOption.DB_NAME, AdagioConfigurationOption.DB_NAME);
+ translateOptions.put(TuttiConfigurationOption.JDBC_USERNAME, AdagioConfigurationOption.JDBC_USERNAME);
+ translateOptions.put(TuttiConfigurationOption.JDBC_PASSWORD, AdagioConfigurationOption.JDBC_PASSWORD);
+ translateOptions.put(TuttiConfigurationOption.JDBC_URL, AdagioConfigurationOption.JDBC_URL);
+
+ for (Map.Entry<ConfigOptionDef, ConfigOptionDef> entry : translateOptions.entrySet()) {
+ ConfigOptionDef tuttiKey = entry.getKey();
+ ConfigOptionDef adagioKey = entry.getValue();
+ String tuttiOptionValue = String.format("${%s}", tuttiKey.getKey());
+ applicationConfig.setDefaultOption(adagioKey.getKey(), tuttiOptionValue);
+ }
+
+ applicationConfig.setDefaultOption(AdagioConfigurationOption.DB_ENUMERATION_RESOURCE.getKey(),
+ "classpath*:adagio-db-enumerations.properties,classpath*:tutti-db-enumerations.properties");
+
+ return providers;
+ }
+
protected final String[] optionKeyToNotSave;
protected File configFile;
+ protected AdagioConfiguration adagioConfig;
+
public TuttiConfiguration(ApplicationConfig applicationConfig) {
super(applicationConfig);
optionKeyToNotSave = null;
@@ -94,18 +128,8 @@
public TuttiConfiguration(String file, String... args) {
super(new ApplicationConfig());
applicationConfig.setEncoding(Charsets.UTF_8.name());
+ Set<ApplicationConfigProvider> providers = getDefaultApplicationConfig(applicationConfig);
- // get all config providers
- Set<ApplicationConfigProvider> providers =
- ApplicationConfigHelper.getProviders(null,
- null,
- null,
- true);
-
- // load all default options
- ApplicationConfigHelper.loadAllDefaultOption(applicationConfig,
- providers);
-
// get all transient and final option keys
Set<String> optionToSkip =
ApplicationConfigHelper.getTransientOptionKeys(providers);
@@ -148,8 +172,12 @@
tuttiBasedir.getAbsolutePath());
}
- public void initConfig(RessourceClassLoader resourceLoader) {
+ public void initConfig() {
+ // Give the same applicationConfig to adagio
+ adagioConfig = new AdagioConfiguration(applicationConfig);
+ AdagioConfiguration.setInstance(adagioConfig);
+
File directory = getDbDirectory();
ApplicationIOUtil.forceMkdir(directory, t("tutti.io.mkDir.error", directory));
directory = getDbAttachmentDirectory();
@@ -174,34 +202,6 @@
ApplicationIOUtil.forceMkdir(tmpDirectory, t("tutti.io.mkDir.error", tmpDirectory));
ApplicationIOUtil.forceMkdir(getReportBackupDirectory(), t("tutti.io.mkDir.error", getReportBackupDirectory()));
-
- // add a predicate to search the configuration file from his directory instead of the class-path
- resourceLoader.addSearchInDirectoriesPredicate(new Predicate<String>() {
-
- Set<String> matchingNames = Sets.newHashSet(
- getDbConfigurationPath().getName(),
- getDbEnumerationPath().getName());
-
- @Override
- public boolean apply(String input) {
- return matchingNames.contains(input);
- }
- });
-
- // get configuration file path
- File configurationPath = getDbConfigurationPath();
-
- // add his directory in path to search
- resourceLoader.addDirectory(configurationPath.getParentFile());
-
- // get enumeration file path
- File enumerationPath = getDbEnumerationPath();
-
- // add his directory in path to search
- resourceLoader.addDirectory(enumerationPath.getParentFile());
-
- // generate external configuration files if required
- generateExternalDbFiles(false);
}
public void prepareDirectories() {
@@ -227,25 +227,6 @@
t("tutti.io.mkDir.error", getReportBackupDirectory()));
}
- public void generateExternalDbFiles(boolean force) {
-
- try {
- // always generate db configuration file
- // see http://forge.codelutin.com/issues/2352
- generateDbConfiguration(true);
-
- } catch (IOException e) {
- throw new ApplicationTechnicalException(t("tutti.persistence.config.generateFile.error"));
- }
-
- try {
-
- generateDbEnumerationConfiguration(force);
- } catch (IOException e) {
- throw new ApplicationTechnicalException(t("tutti.persistence.config.generateEnumFile.error"));
- }
- }
-
public File newTempFile(String basename) {
return new File(getTmpDirectory(), basename + "_" + System.nanoTime());
}
@@ -339,10 +320,6 @@
//--- Option getter ------------------------------------------------------//
//------------------------------------------------------------------------//
- public File getDbConfigurationPath() {
- return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_CONFIGURATION_PATH.getKey());
- }
-
public File getDbDirectory() {
return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_DIRECTORY.getKey());
}
@@ -372,10 +349,6 @@
return result;
}
- public File getDbEnumerationPath() {
- return applicationConfig.getOptionAsFile(TuttiConfigurationOption.DB_ENUMERATION_PATH.getKey());
- }
-
public String getJdbcUrl() {
return applicationConfig.getOption(TuttiConfigurationOption.JDBC_URL.getKey());
}
@@ -663,96 +636,96 @@
//--- Internal methods ---------------------------------------------------//
//------------------------------------------------------------------------//
- protected void generateDbConfiguration(boolean force) throws IOException {
+// protected void generateDbConfiguration(boolean force) throws IOException {
+//
+// File destination = getDbConfigurationPath();
+//
+// if (force || !destination.exists()) {
+//
+// // load db configuration template (tutti-db.properties)
+//
+// if (log.isInfoEnabled()) {
+// log.info("Generate " + destination + " from classpath.");
+// }
+// Properties result = new Properties();
+// InputStream in = getClass().getResourceAsStream("/tutti-db-conf.properties");
+// try {
+// result.load(in);
+// in.close();
+// } finally {
+// IOUtils.closeQuietly(in);
+// }
+//
+// // replace some values from ApplicationConfig
+//
+// result.put("dataSource.jdbc.driver", getJdbcDriver().getName());
+// result.put("dataSource.jdbc.username", getJdbcUsername());
+// result.put("dataSource.jdbc.password", getJdbcPassword());
+// result.put("dataSource.jdbc.url", getJdbcUrl());
+// result.put("hibernate.dialect", getHibernateDialect().getName());
+// result.put("hibernate.show_sql", isHibernateShowSql() + "");
+// result.put("hibernate.format_sql", isHibernateFormatSql() + "");
+// result.put("hibernate.use_sql_comments", isHibernateUseSqlComment() + "");
+// result.put("ehcache.disk.store.dir", getCacheDirectory().getAbsolutePath());
+//
+// // write result file at destination
+//
+// BufferedWriter writer = Files.newWriter(destination, Charsets.UTF_8);
+// try {
+// result.store(writer, "Generated by " + getClass().getName());
+// writer.close();
+// } finally {
+// IOUtils.closeQuietly(writer);
+// }
+// }
+// }
- File destination = getDbConfigurationPath();
+// protected void generateDbEnumerationConfiguration(boolean force) throws IOException {
+//
+// File destination = getDbEnumerationPath();
+//
+// if (force || !destination.exists()) {
+//
+// // load enumeration mapping from classpath (enumerations.properties)
+//
+// if (log.isInfoEnabled()) {
+// log.info("Generate " + destination + " from classpath.");
+// }
+//
+// Properties result = new Properties();
+// InputStream in = getClass().getResourceAsStream("/tutti-db-enumerations.properties");
+// try {
+// result.load(in);
+// in.close();
+// } finally {
+// IOUtils.closeQuietly(in);
+// }
+//
+// // replace some values from ApplicationConfig
+//
+//
+// // write result file at destination
+//
+// BufferedWriter writer =
+// Files.newWriter(destination, Charsets.UTF_8);
+// try {
+// result.store(writer, "Generated by " + getClass().getName());
+// writer.close();
+// } finally {
+// IOUtils.closeQuietly(writer);
+// }
+// }
+// }
- if (force || !destination.exists()) {
-
- // load db configuration template (tutti-db.properties)
-
- if (log.isInfoEnabled()) {
- log.info("Generate " + destination + " from classpath.");
- }
- Properties result = new Properties();
- InputStream in = getClass().getResourceAsStream("/tutti-db-conf.properties");
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
-
- // replace some values from ApplicationConfig
-
- result.put("dataSource.jdbc.driver", getJdbcDriver().getName());
- result.put("dataSource.jdbc.username", getJdbcUsername());
- result.put("dataSource.jdbc.password", getJdbcPassword());
- result.put("dataSource.jdbc.url", getJdbcUrl());
- result.put("hibernate.dialect", getHibernateDialect().getName());
- result.put("hibernate.show_sql", isHibernateShowSql() + "");
- result.put("hibernate.format_sql", isHibernateFormatSql() + "");
- result.put("hibernate.use_sql_comments", isHibernateUseSqlComment() + "");
- result.put("ehcache.disk.store.dir", getCacheDirectory().getAbsolutePath());
-
- // write result file at destination
-
- BufferedWriter writer = Files.newWriter(destination, Charsets.UTF_8);
- try {
- result.store(writer, "Generated by " + getClass().getName());
- writer.close();
- } finally {
- IOUtils.closeQuietly(writer);
- }
- }
- }
-
- protected void generateDbEnumerationConfiguration(boolean force) throws IOException {
-
- File destination = getDbEnumerationPath();
-
- if (force || !destination.exists()) {
-
- // load enumeration mapping from classpath (enumerations.properties)
-
- if (log.isInfoEnabled()) {
- log.info("Generate " + destination + " from classpath.");
- }
-
- Properties result = new Properties();
- InputStream in = getClass().getResourceAsStream("/tutti-db-enumerations.properties");
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
-
- // replace some values from ApplicationConfig
-
-
- // write result file at destination
-
- BufferedWriter writer =
- Files.newWriter(destination, Charsets.UTF_8);
- try {
- result.store(writer, "Generated by " + getClass().getName());
- writer.close();
- } finally {
- IOUtils.closeQuietly(writer);
- }
- }
- }
-
- public Properties getDbEnumerations() throws IOException {
- Properties result = new Properties();
- BufferedReader in = Files.newReader(getDbEnumerationPath(), Charsets.UTF_8);
- try {
- result.load(in);
- in.close();
- } finally {
- IOUtils.closeQuietly(in);
- }
- return result;
- }
+// public Properties getDbEnumerations() throws IOException {
+// Properties result = new Properties();
+// BufferedReader in = Files.newReader(getDbEnumerationPath(), Charsets.UTF_8);
+// try {
+// result.load(in);
+// in.close();
+// } finally {
+// IOUtils.closeQuietly(in);
+// }
+// return result;
+// }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/TuttiConfigurationOption.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -123,18 +123,6 @@
"${tutti.data.directory}/protocol",
File.class),
- DB_CONFIGURATION_PATH(
- "tutti.persistence.db.configurationPath",
- n("tutti.config.option.persistence.db.configurationPath.description"),
- "${tutti.data.directory}/dbconf/conf.properties",
- File.class),
-
- DB_ENUMERATION_PATH(
- "tutti.persistence.db.enumerationPath",
- n("tutti.config.option.persistence.db.enumerationPath.description"),
- "${tutti.data.directory}/dbconf/enumerations-v3.properties",
- File.class),
-
DB_NAME(
"tutti.persistence.db.name",
n("tutti.config.option.persistence.db.name.description"),
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -61,664 +61,6 @@
AccidentalBatchPersistenceService,
IndividualObservationBatchPersistenceService {
- //------------------------------------------------------------------------//
- //-- Technical methods --//
- //------------------------------------------------------------------------//
-
String getImplementationName();
-// /**
-// * To clear all caches.
-// *
-// * @since 1.0.1
-// */
-// void clearAllCaches();
-//
-//// /**
-//// * @return the enumeration file (where all constant mapping are defined).
-//// * @since 2.4
-//// */
-//// TuttiEnumerationFile getEnumerationFile();
-//
-// /**
-// * To invoke the given call code.
-// * <p/>
-// * <strong>Note:</strong> this is mainly to execute a code in a single
-// * transaction.
-// *
-// * @param call call to invoke
-// * @param <V> return type
-// * @return the return of the call
-// * @since 2.4
-// */
-// @Transactional(readOnly = false)
-// <V> V invoke(Callable<V> call);
-//
-// Version getDbVersion();
-//
-// Version getApplicationVersion();
-//
-// void updateSchema();
-//
-// void sanityDb();
-
-// //------------------------------------------------------------------------//
-// //-- Referential methods --//
-// //------------------------------------------------------------------------//
-//
-// /**
-// * @return all available zones (used by a {@link Program}.
-// * @see Program#getZone()
-// * @see Program#setZone(TuttiLocation)
-// * @since 0.3
-// */
-// List<TuttiLocation> getAllProgramZone();
-//
-// /**
-// * @return all countries.
-// * @since 0.1
-// */
-// List<TuttiLocation> getAllCountry();
-//
-// /**
-// * @return all harbours (used by a {@link Cruise}).
-// * @see {@link Cruise#getDepartureLocation()}
-// * @see {@link Cruise#setDepartureLocation(TuttiLocation)}
-// * @see {@link Cruise#getReturnLocation()}
-// * @see {@link Cruise#setReturnLocation(TuttiLocation)}
-// * @since 1.2
-// */
-//
-// List<TuttiLocation> getAllHarbour();
-//
-// /**
-// * Get the list of location of type strata that match the given zone id.
-// *
-// * @param zoneId id of the parent zone (can not be null)
-// * @return the stratas with given zone id as location parent
-// * @since 1.0
-// */
-// List<TuttiLocation> getAllFishingOperationStrata(String zoneId);
-//
-// /**
-// * Get the list of location of type substra that match the given zone id or
-// * if not null the given strata id.
-// *
-// * @param zoneId id of the parent zone (can not be null)
-// * @param strataId id of the optional parent strata
-// * @return the list of localite with given zone id as location parent / or strata
-// * @since 1.0
-// */
-// List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
-//
-// /**
-// * Get the list of location of type substra that match the given zone id or
-// * if not null the given strata id or if not null the given substrata id if
-// * not null.
-// *
-// * @param zoneId id of the parent zone (can not be null)
-// * @param strataId id of the optional parent strata
-// * @param subStrataId id of the optional parent subStrata
-// * @return the list of localite with given zone id as location parent / or strata or substrata
-// * @since 1.0
-// */
-// List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
-//
-// /**
-// * @return all scientific vessels (used by a {@link Cruise}).
-// * @see Cruise#getVessel()
-// * @see Cruise#setVessel(Vessel)
-// * @since 0.3
-// */
-// List<Vessel> getAllScientificVessel();
-//
-// /**
-// * @return all commercial vessels (used by a {@link Cruise}).
-// * @see Cruise#getVessel()
-// * @see Cruise#setVessel(Vessel)
-// * @since 0.3
-// */
-// List<Vessel> getAllFishingVessel();
-//
-// /**
-// * Get all species (referent or synonym) with with {@link Species#getSurveyCode()}
-// * filled by optional protocol.
-// *
-// * @return all species with {@code surveyCode} filled if possible.
-// * @since 0.1
-// */
-// List<Species> getAllSpecies();
-//
-// /**
-// * Get all {@code referent} species with {@link Species#getSurveyCode()}
-// * filled by optional protocol.
-// *
-// * @return all species with {@code surveyCode} filled if possible.
-// * @since 1.0
-// */
-// List<Species> getAllReferentSpecies();
-//
-// /**
-// * Obtain a species with external code as vernacular code given his referenceTaxonId.
-// * <p/>
-// * <strong>Note:</strong> {@link Species#getRefTaxCode()} will not be
-// * filled by with method.
-// *
-// * @param referenceTaxonId id of the reference taxon of the species to load
-// * @return the species or {@code null} if not found.
-// * @see Species#getReferenceTaxonId()
-// * @see Species#getVernacularCode()
-// * @since 2.0
-// */
-// Species getSpeciesByReferenceTaxonIdWithVernacularCode(Integer referenceTaxonId);
-//
-// /**
-// * @return all caracteristics of the system.
-// * @since 1.0
-// */
-// List<Caracteristic> getAllCaracteristic();
-//
-// /**
-// * @return all caracteristics of the system with the ones which are protected.
-// * @since 2.3
-// */
-// List<Caracteristic> getAllCaracteristicWithProtected();
-//
-// /**
-// * @return all caracteristics of the system useable for {@link SampleCategoryModel}.
-// * @since 2.4
-// */
-// List<Caracteristic> getAllCaracteristicForSampleCategory();
-//
-// /**
-// * @return all numeric caracteristics of the system.
-// * @since 1.0.2
-// */
-// List<Caracteristic> getAllNumericCaracteristic();
-//
-// Caracteristic getSizeCategoryCaracteristic();
-//
-// Caracteristic getSexCaracteristic();
-//
-// Caracteristic getSortedUnsortedCaracteristic();
-//
-// Caracteristic getMaturityCaracteristic();
-//
-// Caracteristic getAgeCaracteristic();
-//
-// Caracteristic getMarineLitterCategoryCaracteristic();
-//
-// Caracteristic getMarineLitterSizeCategoryCaracteristic();
-//
-// Caracteristic getVerticalOpeningCaracteristic();
-//
-// Caracteristic getHorizontalOpeningWingCaracteristic();
-//
-// Caracteristic getHorizontalOpeningDoorCaracteristic();
-//
-// Caracteristic getDeadOrAliveCaracteristic();
-//
-// Caracteristic getPmfmIdCaracteristic();
-//
-// Caracteristic getWeightMeasuredCaracteristic();
-//
-// Caracteristic getCaracteristic(Integer pmfmId);
-//
-// Predicate<SpeciesAbleBatch> getVracBatchPredicate();
-//
-// boolean isVracBatch(SpeciesAbleBatch speciesBatch);
-//
-// boolean isTemporary(TuttiReferentialEntity entity);
-//
-// List<Gear> getAllScientificGear();
-//
-// List<Gear> getAllFishingGear();
-//
-// List<Person> getAllPerson();
-//
-// /**
-// * @return all object type
-// * @since 1.0.2
-// */
-// List<ObjectType> getAllObjectType();
-//
-// Person getPerson(Integer personId);
-//
-// Gear getGear(Integer gearCode);
-//
-// Vessel getVessel(String vesselCode);
-//
-// ObjectType getObjectType(String objectTypeCode);
-//
-// /**
-// * Import given temporary species.
-// *
-// * @param species species to import
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<Species> importTemporarySpecies(List<Species> species);
-//
-// /**
-// * Import given temporary vessels.
-// *
-// * @param vessels vessels to import
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<Vessel> importTemporaryVessel(List<Vessel> vessels);
-//
-// /**
-// * Import given temporary persons.
-// *
-// * @param persons persons to import
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<Person> importTemporaryPerson(List<Person> persons);
-//
-// /**
-// * Import given temporary gears.
-// *
-// * @param gears gears to import
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<Gear> importTemporaryGear(List<Gear> gears);
-
- //------------------------------------------------------------------------//
- //-- Attachments methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * Get all attachments for the given object {@code objectId} of type.
-// *
-// * @param objectType type of attachment (see {@link AttachementObjectTypeEnum})
-// * @param objectId id of the object
-// * @return list of all attachments for the given {@code objectId}.
-// * @see AttachementObjectTypeEnum
-// */
-// List<Attachment> getAllAttachments(AttachementObjectTypeEnum objectType,
-// Integer objectId);
-//
-// /**
-// * Get the file of the given {@code attachmentId}.
-// *
-// * @param attachmentId id of the attachment
-// * @return the file for the given attachment
-// */
-// File getAttachmentFile(String attachmentId);
-//
-// /**
-// * Creates the given attachment.
-// *
-// * @param attachment attachment to create
-// * @param file file to store in this attachment
-// * @return the attachment with his id.
-// */
-// @Transactional(readOnly = false)
-// Attachment createAttachment(Attachment attachment, File file);
-//
-// /**
-// * Saves the given attachment.
-// *
-// * @param attachment attachment to create
-// * @return the attachment with his id.
-// */
-// @Transactional(readOnly = false)
-// Attachment saveAttachment(Attachment attachment);
-//
-// /**
-// * Deletes the given attachment given his id.
-// *
-// * @param attachmentId id of the attachment to delete
-// */
-// @Transactional(readOnly = false)
-// void deleteAttachment(String attachmentId);
-
- //------------------------------------------------------------------------//
- //-- Program methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * Get all programs.
-// * <p/>
-// * <strong>Note:</strong> For each program, his zone is loaded.
-// *
-// * @return the list of programs found in db.
-// */
-// List<Program> getAllProgram();
-//
-// /**
-// * Get the program for the given {@code id}.
-// * <p/>
-// * <strong>Note:</strong> his zone is loaded.
-// *
-// * @param id id of the program to load
-// * @return the loaded program
-// */
-// Program getProgram(String id);
-//
-// @Transactional(readOnly = false)
-// Program createProgram(Program bean);
-//
-// @Transactional(readOnly = false)
-// Program saveProgram(Program bean);
-
- //------------------------------------------------------------------------//
- //-- Cruise methods --//
- //------------------------------------------------------------------------//
-
-// List<Cruise> getAllCruise(String programId);
-//
-// Cruise getCruise(String id);
-//
-// @Transactional(readOnly = false)
-// Cruise createCruise(Cruise bean);
-//
-// @Transactional(readOnly = false)
-// Cruise saveCruise(Cruise bean, boolean updateVessel, boolean updateGear);
-//
-// CaracteristicMap getGearCaracteristics(String cruiseId,
-// String gearId,
-// short rankOrder);
-//
-// boolean isOperationUseGears(Integer cruiseId, Collection<Gear> gears);
-//
-// @Transactional(readOnly = false)
-// void saveGearCaracteristics(Gear gear, Cruise cruise);
-
- //------------------------------------------------------------------------//
- //-- Protocol methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * The protocol used by the persistence lay (used to consolidate entites).
-// *
-// * @return The protocol used by the persistence layer
-// * @see #setProtocol(TuttiProtocol)
-// * @since 2.6
-// */
-// TuttiProtocol getProtocol();
-//
-// /**
-// * Set the protocol to use by the persistence layer.
-// *
-// * @param protocol the new protocol to use (can be null)
-// * @see #getProtocol()
-// * @since 2.6
-// */
-// void setProtocol(TuttiProtocol protocol);
-//
-// List<String> getAllProtocolNames();
-//
-// List<TuttiProtocol> getAllProtocol();
-//
-// boolean isProtocolExist(String id);
-//
-// TuttiProtocol getProtocol(String id);
-//
-// @Transactional(readOnly = false)
-// TuttiProtocol createProtocol(TuttiProtocol bean);
-//
-// @Transactional(readOnly = false)
-// TuttiProtocol saveProtocol(TuttiProtocol bean);
-//
-// @Transactional(readOnly = false)
-// void deleteProtocol(String id);
-
- //------------------------------------------------------------------------//
- //-- FishingOperation methods --//
- //------------------------------------------------------------------------//
-
-// int getFishingOperationCount(String cruiseId);
-//
-// List<String> getAllFishingOperationIds(String cruiseId);
-//
-// List<FishingOperation> getAllFishingOperation(String cruiseId);
-//
-// FishingOperation getFishingOperation(String id);
-//
-// List<Vessel> getFishingOperationSecondaryVessel(String fishingOperationId);
-//
-// @Transactional(readOnly = false)
-// FishingOperation createFishingOperation(FishingOperation bean);
-//
-// @Transactional(readOnly = false)
-// FishingOperation saveFishingOperation(FishingOperation bean);
-//
-// @Transactional(readOnly = false)
-// void deleteFishingOperation(String id);
-
- //------------------------------------------------------------------------//
- //-- CatchBatch methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * @param operationId id of the fishing operation
-// * @return {@code true} if there is a catchBatch for the given fishing
-// * operation, {@code false} otherwise.
-// * @since 2.2
-// */
-// boolean isFishingOperationWithCatchBatch(String operationId);
-//
-// /**
-// * Get the catchBatch from the fishing Operation id.
-// * <p/>
-// * If batch model is not compatible with Tutti then a
-// * {@link InvalidBatchModelException} will be thrown.
-// *
-// * @param id id of the fihsing operation
-// * @return found catchbatch
-// * @throws InvalidBatchModelException if batch model is not compatible
-// * with Tutti.
-// */
-// CatchBatch getCatchBatchFromFishingOperation(String id) throws InvalidBatchModelException;
-//
-// /**
-// * Create the given CatchBatch and return it.
-// *
-// * @param bean catchBatch to create
-// * @return created catchBatch
-// */
-// @Transactional(readOnly = false)
-// CatchBatch createCatchBatch(CatchBatch bean);
-//
-// /**
-// * Save the given catchBatch and return it.
-// *
-// * @param bean batch to save
-// * @return the saved catchBatch
-// */
-// @Transactional(readOnly = false)
-// CatchBatch saveCatchBatch(CatchBatch bean);
-
- //------------------------------------------------------------------------//
- //-- Species Batch methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * Get the batch parent of all root {@link SpeciesBatch} for the given
-// * fishing operation.
-// * <p/>
-// * <strong>Note:</strong> All childs of the batch should be loaded here.
-// *
-// * @param fishingOperationId if of the fishing operation to seek
-// * @param sampleCategoryModel [optional] sample category model to check
-// * @return the list of root {@link SpeciesBatch}
-// * @throws InvalidBatchModelException if batch does not respect the sample category model
-// * @since 2.4
-// */
-// BatchContainer<SpeciesBatch> getRootSpeciesBatch(String fishingOperationId,
-// SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
-//
-// @Transactional(readOnly = false)
-// SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId);
-//
-// @Transactional(readOnly = false)
-// SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
-//
-// @Transactional(readOnly = false)
-// void deleteSpeciesBatch(String id);
-//
-// @Transactional(readOnly = false)
-// void deleteSpeciesSubBatch(String id);
-//
-// @Transactional(readOnly = false)
-// void changeSpeciesBatchSpecies(String batchId, Species species);
-//
-// /**
-// * Get all frequencies for the given species batch.
-// *
-// * @param speciesBatchId the id of the species batch to seek.
-// * @return the list of frequencies for the given specues batch id
-// * @since 1.0
-// */
-// List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId);
-//
-// /**
-// * Get all frequencies for the given root species batch container.
-// *
-// * @param batchContainer the root batch containter
-// * @return the list of species frequencies indexed by their species
-// * @since 3.3
-// */
-// Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer);
-//
-// /**
-// * Save all given {@link SpeciesBatchFrequency} into the given
-// * {@code speciesBatchId}. If some are not existing then creates them.
-// * <p/>
-// * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
-// *
-// * @param speciesBatchId id of the {@link SpeciesBatch} to use
-// * @param frequencies list of frequencies to create or update
-// * @return the persisted list of frequencies
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
-// List<SpeciesBatchFrequency> frequencies);
-
- //------------------------------------------------------------------------//
- //-- Benthos Batch methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * Get the batch parent of all root {@link BenthosBatch} for the given
-// * fishing operation.
-// * <p/>
-// * <strong>Note:</strong> All childs of the batch should be loaded here.
-// *
-// * @param fishingOperationId if of the fishing operation to seek
-// * @param sampleCategoryModel [optional] sample category model to check
-// * @return the list of root {@link BenthosBatch}
-// * @throws InvalidBatchModelException if batch does not respect the sample category model
-// * @since 2.4
-// */
-// BatchContainer<BenthosBatch> getRootBenthosBatch(String fishingOperationId,
-// SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
-//
-// @Transactional(readOnly = false)
-// BenthosBatch createBenthosBatch(BenthosBatch bean, String parentBatchId);
-//
-// @Transactional(readOnly = false)
-// BenthosBatch saveBenthosBatch(BenthosBatch bean);
-//
-// @Transactional(readOnly = false)
-// void deleteBenthosBatch(String id);
-//
-// @Transactional(readOnly = false)
-// void deleteBenthosSubBatch(String id);
-//
-// @Transactional(readOnly = false)
-// void changeBenthosBatchSpecies(String batchId, Species species);
-//
-// /**
-// * Get all frequencies for the given species batch.
-// *
-// * @param benthosBatchId the id of the species batch to seek.
-// * @return the list of frequencies for the given specues batch id
-// * @since 1.0
-// */
-// List<BenthosBatchFrequency> getAllBenthosBatchFrequency(String benthosBatchId);
-//
-// /**
-// * Get all frequencies for the given root benthos batch container.
-// *
-// * @param batchContainer the root batch containter
-// * @return the list of benthos frequencies indexed by their species
-// * @since 3.3
-// */
-// Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer);
-//
-// /**
-// * Save all given {@link BenthosBatchFrequency} into the given
-// * {@code benthosBatchId}. If some are not existing then creates them.
-// * <p/>
-// * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
-// *
-// * @param benthosBatchId id of the {@link BenthosBatch} to use
-// * @param frequencies list of frequencies to create or update
-// * @return the persisted list of frequencies
-// * @since 1.0
-// */
-// @Transactional(readOnly = false)
-// List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId,
-// List<BenthosBatchFrequency> frequencies);
-
- //------------------------------------------------------------------------//
- //-- MarineLitter Batch methods --//
- //------------------------------------------------------------------------//
-
-// /**
-// * Get the batch parent of all root {@link MarineLitterBatch} for the given
-// * fishing operation.
-// * <p/>
-// * <strong>Note:</strong> All childs of the batch should be loaded here.
-// *
-// * @param fishingOperationId if of the fishing operation to seek
-// * @return the list of root {@link MarineLitterBatch}
-// * @since 1.3
-// */
-// BatchContainer<MarineLitterBatch> getRootMarineLitterBatch(String fishingOperationId);
-//
-// @Transactional(readOnly = false)
-// MarineLitterBatch createMarineLitterBatch(MarineLitterBatch bean);
-//
-// @Transactional(readOnly = false)
-// MarineLitterBatch saveMarineLitterBatch(MarineLitterBatch bean);
-//
-// @Transactional(readOnly = false)
-// void deleteMarineLitterBatch(String id);
-
- //------------------------------------------------------------------------//
- //-- Accidental Batch methods --//
- //------------------------------------------------------------------------//
-
-// List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId);
-//
-// @Transactional(readOnly = false)
-// AccidentalBatch createAccidentalBatch(AccidentalBatch bean);
-//
-// @Transactional(readOnly = false)
-// AccidentalBatch saveAccidentalBatch(AccidentalBatch bean);
-//
-// @Transactional(readOnly = false)
-// void deleteAccidentalBatch(String id);
-
- //------------------------------------------------------------------------//
- //-- IndividualObservation Batch methods --//
- //------------------------------------------------------------------------//
-
-// List<IndividualObservationBatch> getAllIndividualObservationBatch(String fishingOperationId);
-//
-// @Transactional(readOnly = false)
-// IndividualObservationBatch createIndividualObservationBatch(IndividualObservationBatch bean);
-//
-// @Transactional(readOnly = false)
-// IndividualObservationBatch saveIndividualObservationBatch(IndividualObservationBatch bean);
-//
-// @Transactional(readOnly = false)
-// void deleteIndividualObservationBatch(String id);
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -115,9 +115,6 @@
@Resource(name = "benthosBatchPersistenceService")
protected BenthosBatchPersistenceService benthosBatchService;
-// @Resource(name = "commonBatchPersistenceService")
-// protected CommonBatchPersistenceService commonBatchService;
-
@Resource(name = "marineLitterBatchPersistenceService")
protected MarineLitterBatchPersistenceService marineLitterBatchService;
@@ -177,6 +174,11 @@
}
@Override
+ public void clearCache(String cacheName) {
+ technicalPersistenceService.clearCache(cacheName);
+ }
+
+ @Override
public void init() {
if (log.isInfoEnabled()) {
log.info("Open persistence driver " + getImplementationName());
@@ -188,7 +190,6 @@
catchBatchService.init();
speciesBatchService.init();
benthosBatchService.init();
-// commonBatchService.init();
marineLitterBatchService.init();
accidentalBatchService.init();
individualObservationBatchService.init();
@@ -215,13 +216,12 @@
catchBatchService.close();
speciesBatchService.close();
benthosBatchService.close();
-// commonBatchService.close();
marineLitterBatchService.close();
accidentalBatchService.close();
individualObservationBatchService.close();
protocolService.close();
attachmentService.close();
- TuttiPersistenceServiceLocator.close();
+ TuttiPersistenceServiceLocator.shutdownTutti();
}
}
}
@@ -366,8 +366,8 @@
}
@Override
- public Caracteristic getHorizontalOpeningWingCaracteristic() {
- return referentialService.getHorizontalOpeningWingCaracteristic();
+ public Caracteristic getHorizontalOpeningWingsCaracteristic() {
+ return referentialService.getHorizontalOpeningWingsCaracteristic();
}
@Override
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -108,6 +108,10 @@
public void clearAllCaches() {
throw notImplemented();
}
+ @Override
+ public void clearCache(String cacheName) {
+ throw notImplemented();
+ }
@Override
public List<TuttiLocation> getAllProgramZone() {
@@ -225,7 +229,7 @@
}
@Override
- public Caracteristic getHorizontalOpeningWingCaracteristic() {
+ public Caracteristic getHorizontalOpeningWingsCaracteristic() {
throw notImplemented();
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -30,8 +30,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.classic.Session;
import org.hibernate.type.Type;
import javax.annotation.Resource;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -33,11 +33,13 @@
import fr.ifremer.adagio.core.dao.data.fishingArea.FishingArea2RegulationLocationDao;
import fr.ifremer.adagio.core.dao.data.fishingArea.FishingArea2RegulationLocationPK;
import fr.ifremer.adagio.core.dao.data.fishingArea.FishingAreaDao;
+import fr.ifremer.adagio.core.dao.data.fishingArea.FishingAreaImpl;
import fr.ifremer.adagio.core.dao.data.measure.GearPhysicalMeasurement;
import fr.ifremer.adagio.core.dao.data.measure.GearUseMeasurement;
import fr.ifremer.adagio.core.dao.data.measure.VesselUseMeasurement;
import fr.ifremer.adagio.core.dao.data.operation.FishingOperationDao;
import fr.ifremer.adagio.core.dao.data.operation.Operation;
+import fr.ifremer.adagio.core.dao.data.operation.OperationImpl;
import fr.ifremer.adagio.core.dao.data.operation.OperationVesselAssociation;
import fr.ifremer.adagio.core.dao.data.operation.OperationVesselAssociationDao;
import fr.ifremer.adagio.core.dao.data.operation.OperationVesselAssociationPK;
@@ -575,8 +577,8 @@
if (CollectionUtils.isNotEmpty(fishingAreas)) {
for (FishingArea fishingArea : fishingAreas) {
fishingArea.setProduce(null);
- fishingArea2RegulationLocationDao.remove(fishingArea.getRegulationLocation());
- fishingArea.getRegulationLocation().clear();
+ fishingArea2RegulationLocationDao.remove(fishingArea.getRegulationLocations());
+ fishingArea.getRegulationLocations().clear();
}
getCurrentSession().flush();
fishingAreaDao.remove(fishingAreas);
@@ -845,7 +847,7 @@
} else {
fishingArea = gearUseFeatures.getFishingAreas().iterator().next();
- notChangedRegulationLocation = Lists.newArrayList(fishingArea.getRegulationLocation());
+ notChangedRegulationLocation = Lists.newArrayList(fishingArea.getRegulationLocations());
// Reset all other fishing areas
}
@@ -1136,14 +1138,14 @@
FishingArea2RegulationLocation fa2rl = FishingArea2RegulationLocation.Factory.newInstance();
FishingArea2RegulationLocationPK fa2rlPK = new FishingArea2RegulationLocationPK();
fa2rl.setFishingArea2RegulationLocationPk(fa2rlPK);
- fa2rlPK.setFishingArea(fishingArea);
+ fa2rlPK.setFishingArea((FishingAreaImpl) fishingArea);
fa2rlPK.setLocation(load(LocationImpl.class, source.getStrata().getIdAsInt()));
notChangedRegulationLocation.remove(fa2rl);
- if (fishingArea.getRegulationLocation() == null) {
- fishingArea.setRegulationLocation(Sets.newHashSet(fa2rl));
+ if (fishingArea.getRegulationLocations() == null) {
+ fishingArea.setRegulationLocations(Sets.newHashSet(fa2rl));
} else {
- fishingArea.getRegulationLocation().add(fa2rl);
+ fishingArea.getRegulationLocations().add(fa2rl);
}
if (statisticalLocationId == null) {
statisticalLocationId = source.getStrata().getIdAsInt();
@@ -1155,15 +1157,15 @@
FishingArea2RegulationLocation fa2rl = FishingArea2RegulationLocation.Factory.newInstance();
FishingArea2RegulationLocationPK fa2rlPK = new FishingArea2RegulationLocationPK();
fa2rl.setFishingArea2RegulationLocationPk(fa2rlPK);
- fa2rlPK.setFishingArea(fishingArea);
+ fa2rlPK.setFishingArea((FishingAreaImpl) fishingArea);
fa2rlPK.setLocation(load(LocationImpl.class, source.getSubStrata().getIdAsInt()));
notChangedRegulationLocation.remove(fa2rl);
- if (fishingArea.getRegulationLocation() == null) {
- fishingArea.setRegulationLocation(Sets.newHashSet(fa2rl));
+ if (fishingArea.getRegulationLocations() == null) {
+ fishingArea.setRegulationLocations(Sets.newHashSet(fa2rl));
} else {
- fishingArea.getRegulationLocation().add(fa2rl);
+ fishingArea.getRegulationLocations().add(fa2rl);
}
if (statisticalLocationId == null) {
statisticalLocationId = source.getSubStrata().getIdAsInt();
@@ -1175,28 +1177,28 @@
FishingArea2RegulationLocation fa2rl = FishingArea2RegulationLocation.Factory.newInstance();
FishingArea2RegulationLocationPK fa2rlPK = new FishingArea2RegulationLocationPK();
fa2rl.setFishingArea2RegulationLocationPk(fa2rlPK);
- fa2rlPK.setFishingArea(fishingArea);
+ fa2rlPK.setFishingArea((FishingAreaImpl) fishingArea);
fa2rlPK.setLocation(load(LocationImpl.class, source.getLocation().getIdAsInt()));
notChangedRegulationLocation.remove(fa2rl);
- if (fishingArea.getRegulationLocation() == null) {
- fishingArea.setRegulationLocation(Sets.newHashSet(fa2rl));
+ if (fishingArea.getRegulationLocations() == null) {
+ fishingArea.setRegulationLocations(Sets.newHashSet(fa2rl));
} else {
- fishingArea.getRegulationLocation().add(fa2rl);
+ fishingArea.getRegulationLocations().add(fa2rl);
}
if (statisticalLocationId == null) {
statisticalLocationId = source.getLocation().getIdAsInt();
}
}
- fishingArea.getRegulationLocation().removeAll(notChangedRegulationLocation);
+ fishingArea.getRegulationLocations().removeAll(notChangedRegulationLocation);
// Fishing Area location (should be a statistical location)
if (statisticalLocationId == null) {
gearUseFeatures.getFishingAreas().remove(fishingArea);
//Nothing to do : a gearUseFeatures.getFishingAreas().clear() has been done before
- if (fishingArea.getRegulationLocation() != null) {
- fishingArea.getRegulationLocation().clear();
+ if (fishingArea.getRegulationLocations() != null) {
+ fishingArea.getRegulationLocations().clear();
}
} else if (statisticalLocationId != null) {
fishingArea.setLocation(load(LocationImpl.class, statisticalLocationId));
@@ -1388,10 +1390,9 @@
for (String vesselCode : vesselCodes) {
OperationVesselAssociation ova = null;
- OperationVesselAssociationPK ovaPK =
- OperationVesselAssociationPK.Factory.newInstance();
+ OperationVesselAssociationPK ovaPK = new OperationVesselAssociationPK();
ovaPK.setVessel(load(VesselImpl.class, vesselCode));
- ovaPK.setOperation(target);
+ ovaPK.setOperation((OperationImpl) target);
// If vessel is equal as cruise vessel : do note store any VesselOperationAssociation entity
if (vesselCode.equals(target.getVessel().getCode())) {
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -26,7 +26,6 @@
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import org.springframework.cache.annotation.CacheEvict;
import java.util.List;
@@ -54,7 +53,6 @@
* @see #getProtocol()
* @since 2.6
*/
- @CacheEvict(value = {"species", "referentSpecies", "referentSpeciesById", "referentSpeciesByIdVernacular"}, allEntries = true)
void setProtocol(TuttiProtocol protocol);
boolean isProtocolExist(String id);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -25,7 +25,6 @@
*/
import com.google.common.collect.Lists;
-import org.nuiton.jaxx.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocols;
@@ -34,10 +33,12 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationIOUtil;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.io.File;
import java.util.Collection;
import java.util.Collections;
@@ -61,6 +62,9 @@
public static TuttiProtocol sharedProtocol;
+ @Resource(name = "technicalPersistenceService")
+ protected TechnicalPersistenceService technicalService;
+
public TuttiProtocol getProtocol() {
return sharedProtocol;
}
@@ -70,6 +74,19 @@
log.debug("Set shared protocol: " + protocol);
}
sharedProtocol = protocol;
+
+ try {
+ technicalService.clearCache("species");
+ technicalService.clearCache("referentSpecies");
+ technicalService.clearCache("referentSpeciesById");
+ technicalService.clearCache("referentSpeciesByIdVernacula");
+ } catch (Exception e) {
+
+ //FIXME This
+ if (log.isErrorEnabled()) {
+ log.error("Could not clear caches", e);
+ }
+ }
}
@Override
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -241,7 +241,7 @@
Caracteristic getVerticalOpeningCaracteristic();
- Caracteristic getHorizontalOpeningWingCaracteristic();
+ Caracteristic getHorizontalOpeningWingsCaracteristic();
Caracteristic getHorizontalOpeningDoorCaracteristic();
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -628,8 +628,8 @@
}
@Override
- public Caracteristic getHorizontalOpeningWingCaracteristic() {
- Integer pmfmId = enumeration.PMFM_ID_HORIZONTAL_OPENING_WING;
+ public Caracteristic getHorizontalOpeningWingsCaracteristic() {
+ Integer pmfmId = enumeration.PMFM_ID_HORIZONTAL_OPENING_WINGS;
Caracteristic result = thisService.getCaracteristic(pmfmId);
return result;
}
@@ -772,7 +772,8 @@
null,
source.getInternationalRegistrationCode(),
registrationLocationId, source.getName(),
- vesselTypeId);
+ vesselTypeId,
+ true);
// Fill the result bean
Vessel result = Vessels.newVessel();
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -30,6 +30,8 @@
*/
void clearAllCaches();
+ void clearCache(String cacheName);
+
/**
* To invoke the given call code.
* <p/>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -5,11 +5,14 @@
import fr.ifremer.adagio.core.dao.technical.VersionNotFoundException;
import fr.ifremer.adagio.core.service.technical.CacheService;
import fr.ifremer.adagio.core.service.technical.sanity.DatabaseSanityService;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Status;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
+import org.springframework.cache.Cache;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -97,4 +100,15 @@
public void clearAllCaches() {
cacheService.clearAllCaches();
}
+
+ @Override
+ public void clearCache(String cacheName) {
+ Cache cache = cacheService.getCache(cacheName);
+ if (cache != null) {
+ Ehcache nativeCache = (Ehcache) cache.getNativeCache();
+ if (Status.STATUS_ALIVE.equals(nativeCache.getStatus())) {
+ cacheService.clearCache(cacheName);
+ }
+ }
+ }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -44,265 +44,265 @@
*/
public class TuttiEnumerationFile {
- @Value("${GearClassificationId.SCIENTIFIC_CRUISE}")
+ @Value("${adagio.enumeration.GearClassificationId.SCIENTIFIC_CRUISE}")
public final Integer GEAR_CLASSIFICIATION_ID_SCIENTIFIC = null;
- @Value("${GearClassificationId.FAO}")
+ @Value("${adagio.enumeration.GearClassificationId.FAO}")
public final Integer GEAR_CLASSIFICIATION_ID_FISHING = null;
- @Value("${LocationClassificationId.TERRITORIAL}")
+ @Value("${adagio.enumeration.LocationClassificationId.TERRITORIAL}")
public final Integer LOCATION_CLASSIFICATION_ID_TERRITORIAL = null;
- @Value("${LocationClassificationId.SECTOR}")
+ @Value("${adagio.enumeration.LocationClassificationId.SECTOR}")
public final Integer LOCATION_CLASSIFICATION_ID_SECTOR = null;
- @Value("${LocationLabel.FRANCE}")
+ @Value("${adagio.enumeration.LocationLabel.FRANCE}")
public final String LOCATION_LABEL_DEFAULT_COUNTRY = null;
- @Value("${LocationLevelId.PAYS_ISO3}")
+ @Value("${adagio.enumeration.LocationLevelId.PAYS_ISO3}")
public final Integer LOCATION_LEVEL_ID_COUNTRY = null;
- @Value("${LocationLevelId.PORT}")
+ @Value("${adagio.enumeration.LocationLevelId.PORT}")
public final Integer LOCATION_LEVEL_ID_HARBOUR = null;
- @Value("${LocationLevelId.LOCALITE}")
+ @Value("${adagio.enumeration.LocationLevelId.SCIENTIFIC_CRUISE_LOCALITE}")
public final Integer LOCATION_LEVEL_ID_LOCALITE = null;
- @Value("${LocationLevelId.PROGRAM}")
+ @Value("${adagio.enumeration.LocationLevelId.SCIENTIFIC_CRUISE_PROGRAM}")
public final Integer LOCATION_LEVEL_ID_PROGRAM = null;
- @Value("${LocationLevelId.STRATA}")
+ @Value("${adagio.enumeration.LocationLevelId.SCIENTIFIC_CRUISE_STRATA}")
public final Integer LOCATION_LEVEL_ID_STRATA = null;
- @Value("${LocationLevelId.SUB_STRATA}")
+ @Value("${adagio.enumeration.LocationLevelId.SCIENTIFIC_CRUISE_SUB_STRATA}")
public final Integer LOCATION_LEVEL_ID_SUB_STRATA = null;
- @Value("${ParameterCode.AGE}")
+ @Value("${adagio.enumeration.ParameterCode.AGE}")
public final String PARAMETER_CODE_AGE = null;
- @Value("${ParameterCode.WEIGHT}")
+ @Value("${adagio.enumeration.ParameterCode.WEIGHT}")
public final String PARAMETER_CODE_WEIGHT = null;
- @Value("${PmfmId.SIZE_CATEGORY}")
+ @Value("${adagio.enumeration.PmfmId.SIZE_CATEGORY}")
public final Integer PMFM_ID_SIZE_CATEGORY = null;
- @Value("${PmfmId.SEX}")
+ @Value("${adagio.enumeration.PmfmId.SEX}")
public final Integer PMFM_ID_SEX = null;
- @Value("${PmfmId.SORTED_UNSORTED}")
+ @Value("${adagio.enumeration.PmfmId.SORTED_UNSORTED}")
public final Integer PMFM_ID_SORTED_UNSORTED = null;
- @Value("${PmfmId.MATURITY}")
+ @Value("${adagio.enumeration.PmfmId.MATURITY}")
public final Integer PMFM_ID_MATURITY = null;
- @Value("${PmfmId.MARINE_LITTER_TYPE}")
+ @Value("${adagio.enumeration.PmfmId.MARINE_LITTER_TYPE}")
public final Integer PMFM_ID_MARINE_LITTER_TYPE = null;
- @Value("${PmfmId.MARINE_LITTER_SIZE_CATEGORY}")
+ @Value("${adagio.enumeration.PmfmId.MARINE_LITTER_SIZE_CATEGORY}")
public final Integer PMFM_ID_MARINE_LITTER_SIZE_CATEGORY = null;
- @Value("${PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE}")
+ @Value("${adagio.enumeration.PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE}")
public final Integer PMFM_ID_SORTING_TYPE = null;
- @Value("${PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE_2}")
+ @Value("${adagio.enumeration.PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE_2}")
public final Integer PMFM_ID_SORTING_TYPE_2 = null;
- @Value("${UnitId.NONE}")
+ @Value("${adagio.enumeration.UnitId.NONE}")
public final Integer UNIT_ID_NONE = null;
- @Value("${UserProfilId.OBSERVER}")
+ @Value("${adagio.enumeration.UserProfilId.OBSERVER}")
public final Integer USER_PROFIL_ID_OBSERVER = null;
- @Value("${UserProfilId.PROJECT_MEMBER}")
+ @Value("${adagio.enumeration.UserProfilId.PROJECT_MEMBER}")
public final Integer USER_PROFIL_ID_PROJECT_MEMBER = null;
- @Value("${UserProfilId.USER}")
+ @Value("${adagio.enumeration.UserProfilId.USER}")
public final Integer USER_PROFIL_ID_USER = null;
- @Value("${UserProfilId.DEPARTEMENT_PREFIX}")
+ @Value("${adagio.enumeration.UserProfilId.DEPARTEMENT_PREFIX}")
public final String USER_PROFIL_ID_DEPARTEMENT_PREFIX = null;
- @Value("${VesselTypeId.SCIENTIFIC_RESEARCH_VESSEL}")
+ @Value("${adagio.enumeration.VesselTypeId.SCIENTIFIC_RESEARCH_VESSEL}")
public final Integer VESSEL_TYPE_ID_SCIENTIFIC = null;
- @Value("${VesselTypeId.FISHING_VESSEL}")
+ @Value("${adagio.enumeration.VesselTypeId.FISHING_VESSEL}")
public final Integer VESSEL_TYPE_ID_FISHING = null;
- @Value("${LocationLevelId.RECTANGLE_STATISTIQUE_MED}")
- public final Integer RECTANGLE_STATISTIQUE_MED = null;
+// @Value("${adagio.enumeration.LocationLevelId.RECTANGLE_STATISTIQUE_MED}")
+// public final Integer RECTANGLE_STATISTIQUE_MED = null;
- @Value("${LocationLevelId.RECTANGLE_STATISTIQUE}")
+ @Value("${adagio.enumeration.LocationLevelId.RECTANGLE_STATISTIQUE}")
public final Integer RECTANGLE_STATISTIQUE = null;
- @Value("${QualitativeValueId.SORTED_VRAC}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTED_VRAC}")
public final Integer QUALITATIVE_VRAC_ID = null;
- @Value("${QualitativeValueId.SORTED_HORS_VRAC}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTED_HORS_VRAC}")
public final Integer QUALITATIVE_HORS_VRAC_ID = null;
- @Value("${QualitativeValueId.UNSORTED}")
+ @Value("${adagio.enumeration.QualitativeValueId.UNSORTED}")
public final Integer QUALITATIVE_UNSORTED_ID = null;
- @Value("${QualitativeValueId.SEX_MALE}")
+ @Value("${adagio.enumeration.QualitativeValueId.SEX_MALE}")
public final Integer QUALITATIVE_SEX_MALE_ID = null;
- @Value("${QualitativeValueId.SEX_FEMALE}")
+ @Value("${adagio.enumeration.QualitativeValueId.SEX_FEMALE}")
public final Integer QUALITATIVE_SEX_FEMALE_ID = null;
- @Value("${QualitativeValueId.SEX_UNDEFINED}")
+ @Value("${adagio.enumeration.QualitativeValueId.SEX_UNDEFINED}")
public final Integer QUALITATIVE_SEX_UNDEFINED_ID = null;
- @Value("${QualitativeValueId.MATURITY_1}")
+ @Value("${adagio.enumeration.QualitativeValueId.MATURITY_1}")
public final Integer QUALITATIVE_MATURITY_1_ID = null;
- @Value("${QualitativeValueId.MATURITY_2}")
+ @Value("${adagio.enumeration.QualitativeValueId.MATURITY_2}")
public final Integer QUALITATIVE_MATURITY_2_ID = null;
- @Value("${QualitativeValueId.MATURITY_3}")
+ @Value("${adagio.enumeration.QualitativeValueId.MATURITY_3}")
public final Integer QUALITATIVE_MATURITY_3_ID = null;
- @Value("${QualitativeValueId.MATURITY_4}")
+ @Value("${adagio.enumeration.QualitativeValueId.MATURITY_4}")
public final Integer QUALITATIVE_MATURITY_4_ID = null;
- @Value("${QualitativeValueId.MATURITY_5}")
+ @Value("${adagio.enumeration.QualitativeValueId.MATURITY_5}")
public final Integer QUALITATIVE_MATURITY_5_ID = null;
- @Value("${QualitativeValueId.SIZE_SMALL}")
+ @Value("${adagio.enumeration.QualitativeValueId.SIZE_SMALL}")
public final Integer QUALITATIVE_SIZE_SMALL_ID = null;
- @Value("${QualitativeValueId.SIZE_MEDIUM}")
+ @Value("${adagio.enumeration.QualitativeValueId.SIZE_MEDIUM}")
public final Integer QUALITATIVE_SIZE_MEDIUM_ID = null;
- @Value("${QualitativeValueId.SIZE_BIG}")
+ @Value("${adagio.enumeration.QualitativeValueId.SIZE_BIG}")
public final Integer QUALITATIVE_SIZE_BIG_ID = null;
- @Value("${QualitativeValueId.SORTING_TYPE_SPECIES}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_SPECIES}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_SPECIES = null;
- @Value("${QualitativeValueId.SORTING_TYPE_BENTHOS}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_BENTHOS}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_BENTHOS = null;
- @Value("${QualitativeValueId.SORTING_TYPE_MARINE_LITTER}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_MARINE_LITTER}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER = null;
- @Value("${QualitativeValueId.SORTING_TYPE_2_ALIVE_NOT_ITEMIZED}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_2_ALIVE_NOT_ITEMIZED}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED = null;
- @Value("${QualitativeValueId.SORTING_TYPE_2_INERT}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_2_INERT}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_2_INERT = null;
- @Value("${QualitativeValueId.SORTING_TYPE_2_ALIVE_ITEMIZED}")
+ @Value("${adagio.enumeration.QualitativeValueId.SORTING_TYPE_2_ALIVE_ITEMIZED}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED = null;
- @Value("${StatusCode.ENABLE}")
+ @Value("${adagio.enumeration.StatusCode.ENABLE}")
public final String STATUS_VALID_CODE = null;
- @Value("${StatusCode.TEMPORARY}")
+ @Value("${adagio.enumeration.StatusCode.TEMPORARY}")
public final String STATUS_TEMPORARY_CODE = null;
- @Value("${PersonId.UNKNOWN_RECORDER_PERSON}")
+ @Value("${adagio.enumeration.PersonId.UNKNOWN_RECORDER_PERSON}")
public final Integer PERSON_ID_UNKNOWN_RECORDER_PERSON = null;
- @Value("${QualityFlagCode.NOTQUALIFIED}")
+ @Value("${adagio.enumeration.QualityFlagCode.NOTQUALIFIED}")
public final String QUALITY_FLAG_CODE_NOT_QUALIFIED = null;
- @Value("${QualityFlagCode.DOUBTFUL}")
+ @Value("${adagio.enumeration.QualityFlagCode.DOUBTFUL}")
public final String QUALITY_FLAG_CODE_DOUBTFUL = null;
- @Value("${PmfmId.STATION_NUMBER}")
+ @Value("${adagio.enumeration.PmfmId.STATION_NUMBER}")
public final Integer PMFM_ID_STATION_NUMBER = null;
- @Value("${PmfmId.TRAWL_DISTANCE}")
+ @Value("${adagio.enumeration.PmfmId.TRAWL_DISTANCE}")
public final Integer PMFM_ID_TRAWL_DISTANCE = null;
- @Value("${PmfmId.RECTILINEAR_OPERATION}")
+ @Value("${adagio.enumeration.PmfmId.RECTILINEAR_OPERATION}")
public final Integer PMFM_ID_RECTILINEAR_OPERATION = null;
- @Value("${QualitativeValueId.RECTILINEAR_OPERATION_YES}")
+ @Value("${adagio.enumeration.QualitativeValueId.RECTILINEAR_OPERATION_YES}")
public final Integer QUALITATIVE_RECTILINEAR_OPERATION_YES = null;
- @Value("${QualitativeValueId.RECTILINEAR_OPERATION_NO}")
+ @Value("${adagio.enumeration.QualitativeValueId.RECTILINEAR_OPERATION_NO}")
public final Integer QUALITATIVE_RECTILINEAR_OPERATION_NO = null;
- @Value("${PmfmId.HAUL_VALID}")
+ @Value("${adagio.enumeration.PmfmId.HAUL_VALID}")
public final Integer PMFM_ID_HAUL_VALID = null;
- @Value("${QualitativeValueId.HAUL_VALID_YES}")
+ @Value("${adagio.enumeration.QualitativeValueId.HAUL_VALID_YES}")
public final Integer QUALITATIVE_HAUL_VALID_YES = null;
- @Value("${QualitativeValueId.HAUL_VALID_NO}")
+ @Value("${adagio.enumeration.QualitativeValueId.HAUL_VALID_NO}")
public final Integer QUALITATIVE_HAUL_VALID_NO = null;
- @Value("${PmfmId.MULTIRIG_NUMBER}")
+ @Value("${adagio.enumeration.PmfmId.MULTIRIG_NUMBER}")
public final Integer PMFM_ID_MULTIRIG_NUMBER = null;
- @Value("${PmfmId.MULTIRIG_AGGREGATION}")
+ @Value("${adagio.enumeration.PmfmId.MULTIRIG_AGGREGATION}")
public final Integer PMFM_ID_MULTIRIG_AGGREGATION = null;
- @Value("${PmfmId.WEIGHT_MEASURED}")
+ @Value("${adagio.enumeration.PmfmId.WEIGHT_MEASURED}")
public final Integer PMFM_ID_WEIGHT_MEASURED = null;
- @Value("${DepartmentId.UNKNOWN_RECORDER_DEPARTMENT}")
+ @Value("${adagio.enumeration.DepartmentId.UNKNOWN_RECORDER_DEPARTMENT}")
public final Integer DEPARTMENT_ID_UNKNOWN_RECORDER_DEPARTMENT = null;
- @Value("${PmfmId.AGE}")
+ @Value("${adagio.enumeration.PmfmId.AGE}")
public final Integer PMFM_ID_AGE = null;
- @Value("${PmfmId.SURVEY_PART}")
+ @Value("${adagio.enumeration.PmfmId.SURVEY_PART}")
public final Integer PMFM_ID_SURVEY_PART = null;
- @Value("${PmfmId.VERTICAL_OPENING}")
+ @Value("${adagio.enumeration.PmfmId.VERTICAL_OPENING}")
public final Integer PMFM_ID_VERTICAL_OPENING = null;
- @Value("${PmfmId.HORIZONTAL_OPENING_WING}")
- public final Integer PMFM_ID_HORIZONTAL_OPENING_WING = null;
+ @Value("${adagio.enumeration.PmfmId.HORIZONTAL_OPENING_WINGS}")
+ public final Integer PMFM_ID_HORIZONTAL_OPENING_WINGS = null;
- @Value("${PmfmId.HORIZONTAL_OPENING_DOOR}")
+ @Value("${adagio.enumeration.PmfmId.HORIZONTAL_OPENING_DOOR}")
public final Integer PMFM_ID_HORIZONTAL_OPENING_DOOR = null;
- @Value("${PmfmId.DEAD_OR_ALIVE}")
+ @Value("${adagio.enumeration.PmfmId.DEAD_OR_ALIVE}")
public final Integer PMFM_ID_DEAD_OR_ALIVE = null;
- @Value("${ProgramCode.SCIENTIFIC_CRUISE_PREFIX}")
+ @Value("${adagio.enumeration.ProgramCode.SCIENTIFIC_CRUISE_PREFIX}")
public final String PROGRAM_CODE_SCIENTIFIC_CRUISE_PREFIX = null;
- @Value("${TaxonGroupTypeCode.COMMERCIAL_SPECIES}")
+ @Value("${adagio.enumeration.TaxonGroupTypeCode.COMMERCIAL_SPECIES}")
public final String TAXON_GROUP_TYPE_ID_COMMERCIAL_SPECIES = null;
- @Value("${ObjectTypeCode.SCIENTIFIC_CRUISE}")
+ @Value("${adagio.enumeration.ObjectTypeCode.SCIENTIFIC_CRUISE}")
public final String OBJECT_TYPE_SCIENTIFIC_CRUISE = null;
- @Value("${ObjectTypeCode.CATCH_BATCH}")
+ @Value("${adagio.enumeration.ObjectTypeCode.CATCH_BATCH}")
public final String OBJECT_TYPE_CATCH_BATCH = null;
- @Value("${ObjectTypeCode.BATCH}")
+ @Value("${adagio.enumeration.ObjectTypeCode.BATCH}")
public final String OBJECT_TYPE_BATCH = null;
- @Value("${ObjectTypeCode.OPERATION}")
+ @Value("${adagio.enumeration.ObjectTypeCode.OPERATION}")
public final String OBJECT_TYPE_OPERATION = null;
- @Value("${ObjectTypeCode.SAMPLE}")
+ @Value("${adagio.enumeration.ObjectTypeCode.SAMPLE}")
public final String OBJECT_TYPE_SAMPLE = null;
- @Value("${VesselPersonRoleId.SCIENTIFIC_CRUISE_MANAGER}")
+ @Value("${adagio.enumeration.VesselPersonRoleId.SCIENTIFIC_CRUISE_MANAGER}")
public final Integer VESSEL_PERSON_ROLE_ID_SCIENTIFIC_CRUISE_MANAGER = null;
- @Value("${VesselPersonRoleId.SORT_ROOM_MANAGER}")
+ @Value("${adagio.enumeration.VesselPersonRoleId.SORT_ROOM_MANAGER}")
public final Integer VESSEL_PERSON_ROLE_ID_SORT_ROOM_MANAGER = null;
- @Value("${VesselPersonRoleId.RECORDER_PERSON}")
+ @Value("${adagio.enumeration.VesselPersonRoleId.RECORDER_PERSON}")
public final Integer VESSEL_PERSON_ROLE_ID_RECORDER_PERSON = null;
- @Value("${TranscribingTypeId.TAXINOMIE_REFTAX_MNEMONIQUE}")
+ @Value("${adagio.enumeration.TranscribingTypeId.TAXINOMIE_REFTAX_MNEMONIQUE}")
public final Integer TRANSCRIBING_TYPE_ID_REFTAX = null;
- @Value("${TranscribingTypeId.TAXINOMIE_COMMUN_NOM_VERNACULAIRE}")
+ @Value("${adagio.enumeration.TranscribingTypeId.TAXINOMIE_COMMUN_NOM_VERNACULAIRE}")
public final Integer TRANSCRIBING_TYPE_ID_VERNACULAIRE = null;
- @Value("${MatrixId.PRODUCT_BATCH}")
+ @Value("${adagio.enumeration.MatrixId.PRODUCT_BATCH}")
public final Integer MATRIX_ID_PRODUCT_BATCH = null;
- @Value("${PmfmId.ID_PSFM}")
+ @Value("${adagio.enumeration.PmfmId.ID_PSFM}")
public final Integer PMFM_ID_ID_PSFM = null;
protected Set<Integer> propertedPmfmIds;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -146,7 +146,7 @@
return service;
}
- public static void close() {
+ public static void shutdownTutti() {
instance().shutdown();
}
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test/DatabaseResource.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -32,7 +32,6 @@
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.TuttiConfigurationOption;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.TuttiPersistence;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
@@ -76,10 +75,10 @@
public static long BUILD_TIMESTAMP = System.nanoTime();
- private static ClassLoader oldClassLoader;
+// private static ClassLoader oldClassLoader;
+//
+// protected RessourceClassLoader loader;
- protected RessourceClassLoader loader;
-
private File resourceDirectory;
private TuttiConfiguration config;
@@ -156,10 +155,6 @@
this.destroyResources = destroyResources;
}
- public void updateSchema(TuttiPersistence persistenceService) {
-
- }
-
@Override
public Statement apply(final Statement base, final Description description) {
@@ -181,11 +176,10 @@
public void prepareConfig(ApplicationConfig applicationConfig,
File resourceDirectory) {
- applicationConfig.loadDefaultOptions(
- TuttiConfigurationOption.values());
- applicationConfig.setDefaultOption(
- "tutti.data.directory",
- new File(resourceDirectory, "data").getAbsolutePath());
+ TuttiConfiguration.getDefaultApplicationConfig(applicationConfig);
+
+ applicationConfig.setDefaultOption(TuttiConfigurationOption.DATA_DIRECTORY.getKey(),
+ new File(resourceDirectory, "data").getAbsolutePath());
}
public File copyClassPathResource(String path, String destinationName) throws IOException {
@@ -225,11 +219,6 @@
resourceDirectory = FileUtil.getTestSpecificDirectory(testClass, "", null, BUILD_TIMESTAMP);
- loader = new RessourceClassLoader(testClass.getClassLoader());
-
- oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
-
ConverterUtil.deregister();
ConverterUtil.initConverters();
@@ -313,16 +302,12 @@
Preconditions.checkState("true".equals(readonly), "readonly property must be at true value in read mode test in db confg: " + dbConfig);
}
- config.initConfig(loader);
+ config.initConfig();
if (log.isInfoEnabled()) {
log.info("Use db: " + config.getJdbcUrl());
}
- if (log.isDebugEnabled()) {
- log.debug("Use conf.properties at " + config.getDbConfigurationPath());
- }
-
if (beanFactoryReferenceLocation != null) {
TuttiPersistenceServiceLocator.initTutti(
beanFactoryReferenceLocation,
@@ -416,15 +401,15 @@
}
}
- // push back old classLoader
- if (oldClassLoader != null) {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
+// // push back old classLoader
+// if (oldClassLoader != null) {
+// Thread.currentThread().setContextClassLoader(oldClassLoader);
+// }
}
protected void closeSpring() {
- TuttiPersistenceServiceLocator.close();
+ TuttiPersistenceServiceLocator.shutdownTutti();
if (beanFactoryReferenceLocation != null) {
Added: trunk/tutti-persistence/src/main/resources/applicationContext-conf-tutti.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/applicationContext-conf-tutti.xml (rev 0)
+++ trunk/tutti-persistence/src/main/resources/applicationContext-conf-tutti.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Tutti :: Persistence API
+ $Id$
+ $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-persistence/src/main/r… $
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ 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%
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+ <bean id="adagioConfiguration" class="fr.ifremer.adagio.core.config.AdagioConfiguration"
+ factory-method="getInstance" depends-on="tuttiConfiguration">
+ </bean>
+
+ <bean id="tuttiConfiguration" class="fr.ifremer.tutti.TuttiConfiguration"
+ factory-method="getInstance">
+ </bean>
+
+
+</beans>
Property changes on: trunk/tutti-persistence/src/main/resources/applicationContext-conf-tutti.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -47,26 +47,26 @@
<bean id="tuttiProgramsCache" parent="abstractEternalCache">
<property name="cacheName" value="programs" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiProgramZonesCache" parent="abstractEternalCache">
<property name="cacheName" value="programZones" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="countriesCache" parent="abstractEternalCache">
<property name="cacheName" value="countries" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="harboursCache" parent="abstractEternalCache">
<property name="cacheName" value="harbours" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiPmfmsCache" parent="abstractEternalCache">
@@ -90,56 +90,56 @@
<bean id="tuttiFishingVesselsCache" parent="abstractEternalCache">
<property name="cacheName" value="fishingVessels" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiFishingVesselByCodeCache" parent="abstractEternalCache">
<property name="cacheName" value="vesselByCode" />
- <property name="maxElementsInMemory" value="40000"/>
- <property name="maxElementsOnDisk" value="40000"/>
+ <!--<property name="maxElementsInMemory" value="40000"/>-->
+ <!--<property name="maxElementsOnDisk" value="40000"/>-->
</bean>
<bean id="tuttiSpeciesCache" parent="abstractEternalCache">
<property name="cacheName" value="species" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiReferentSpeciesCache" parent="abstractEternalCache">
<property name="cacheName" value="referentSpecies" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiReferentSpeciesByIdCache" parent="abstractEternalCache">
<property name="cacheName" value="referentSpeciesById" />
- <property name="maxElementsInMemory" value="20000"/>
- <property name="maxElementsOnDisk" value="20000"/>
+ <!--<property name="maxElementsInMemory" value="20000"/>-->
+ <!--<property name="maxElementsOnDisk" value="20000"/>-->
</bean>
<bean id="tuttiReferentSpeciesByIdVenacularCache" parent="abstractEternalCache">
<property name="cacheName" value="referentSpeciesByIdVernacular" />
- <property name="maxElementsInMemory" value="20000"/>
- <property name="maxElementsOnDisk" value="20000"/>
+ <!--<property name="maxElementsInMemory" value="20000"/>-->
+ <!--<property name="maxElementsOnDisk" value="20000"/>-->
</bean>
<bean id="tuttiGearsCache" parent="abstractEternalCache">
<property name="cacheName" value="gears" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiPersonsCache" parent="abstractEternalCache">
<property name="cacheName" value="persons" />
- <property name="maxElementsInMemory" value="1"/>
- <property name="maxElementsOnDisk" value="1"/>
+ <!--<property name="maxElementsInMemory" value="1"/>-->
+ <!--<property name="maxElementsOnDisk" value="1"/>-->
</bean>
<bean id="tuttiPersonByIdCache" parent="abstractEternalCache">
<property name="cacheName" value="personById" />
- <property name="maxElementsInMemory" value="1000"/>
- <property name="maxElementsOnDisk" value="1000"/>
+ <!--<property name="maxElementsInMemory" value="1000"/>-->
+ <!--<property name="maxElementsOnDisk" value="1000"/>-->
</bean>
</beans>
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/resources/ehcache.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/ehcache.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/ehcache.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -62,19 +62,27 @@
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
- overflowToDisk="true"/>
+ overflowToDisk="true" />
- <cache name="org.hibernate.cache.UpdateTimestampsCache"
+ <cache name="org.hibernate.cache.StandardQueryCache"
eternal="false"
maxElementsInMemory="10000"
timeToIdleSeconds="300"
timeToLiveSeconds="300"
overflowToDisk="false"/>
- <cache name="org.hibernate.cache.StandardQueryCache"
+
+ <cache name="org.hibernate.cache.spi.UpdateTimestampsCache"
eternal="false"
maxElementsInMemory="10000"
timeToIdleSeconds="300"
timeToLiveSeconds="300"
overflowToDisk="false"/>
+ <cache name="org.hibernate.cache.internal.StandardQueryCache"
+ eternal="false"
+ maxElementsInMemory="10000"
+ timeToIdleSeconds="300"
+ timeToLiveSeconds="300"
+ overflowToDisk="false"/>
+
</ehcache>
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2014-04-21 13:27:20 UTC (rev 1718)
@@ -21,11 +21,13 @@
tutti.config.option.persistence.db.cache.directory.description=
tutti.config.option.persistence.db.configurationPath.description=
tutti.config.option.persistence.db.directory.description=
+tutti.config.option.persistence.db.enumeration.path=
tutti.config.option.persistence.db.enumerationPath.description=
tutti.config.option.persistence.db.name.description=
tutti.config.option.persistence.db.protocol.directory.description=
tutti.config.option.persistence.hibernate.dialect.description=
tutti.config.option.persistence.hibernate.formatSql.description=
+tutti.config.option.persistence.hibernate.queriesFile.description=
tutti.config.option.persistence.hibernate.showSql.description=
tutti.config.option.persistence.hibernate.useSqlComment.description=
tutti.config.option.persistence.jdbc.driver.description=
@@ -108,11 +110,3 @@
tutti.persistence.loader.error=
tutti.persistence.protocol.delete.error=
tutti.persistence.protocol.fromFile.error=
-tutti.persistence.synchronizeReferential.prepare.step1=
-tutti.persistence.synchronizeReferential.prepare.step2=
-tutti.persistence.synchronizeReferential.prepare.step3=
-tutti.persistence.synchronizeReferential.prepare.step4=
-tutti.persistence.synchronizeReferential.synchronize.step1=
-tutti.persistence.synchronizeReferential.synchronize.step2=
-tutti.persistence.synchronizeReferential.synchronizeTable=
-tutti.persistence.tableMetadata.instanciation.error=
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2014-04-21 13:27:20 UTC (rev 1718)
@@ -21,11 +21,13 @@
tutti.config.option.persistence.db.cache.directory.description=Répertoire où sont stockées les caches de persistance
tutti.config.option.persistence.db.configurationPath.description=Chemin du fichier de configuration d'Adagio
tutti.config.option.persistence.db.directory.description=Répertoire où est la base de données
+tutti.config.option.persistence.db.enumeration.path=
tutti.config.option.persistence.db.enumerationPath.description=Chemin du fichier de correspondance des constantes
tutti.config.option.persistence.db.name.description=Nom du fichier de la base de données
tutti.config.option.persistence.db.protocol.directory.description=Répertoire où sont conservés les protocoles
tutti.config.option.persistence.hibernate.dialect.description=Le dialecte hibernate utilisée pour communiquer avec la base de données
tutti.config.option.persistence.hibernate.formatSql.description=Option pour ajouter les commentaires dans les requêtes sql générées
+tutti.config.option.persistence.hibernate.queriesFile.description=Option pour changer les requêtes supplémentaires
tutti.config.option.persistence.hibernate.showSql.description=Option pour afficher ou non les requête sql dans les logs
tutti.config.option.persistence.hibernate.useSqlComment.description=Option pour ajouter les commentaires dans les requêtes sql générées
tutti.config.option.persistence.jdbc.driver.description=Le pilote JDBC utilisé pour communiquer avec la base de données
@@ -108,11 +110,3 @@
tutti.persistence.loader.error=Erreur de conversion du dossier %s en URL
tutti.persistence.protocol.delete.error=Erreur lors de la suppression du protocole %1s (fichier %2s)
tutti.persistence.protocol.fromFile.error=Erreur lors de l'import du protocole du fichier %s
-tutti.persistence.synchronizeReferential.prepare.step1=Connexion à la base de synchronisation
-tutti.persistence.synchronizeReferential.prepare.step2=Connexion à la base à synchroniser
-tutti.persistence.synchronizeReferential.prepare.step3=Vérification de la compatibilité des schémas
-tutti.persistence.synchronizeReferential.prepare.step4=Lecture de la table %s
-tutti.persistence.synchronizeReferential.synchronize.step1=Mise à jour de la table %s
-tutti.persistence.synchronizeReferential.synchronize.step2=Sauvegarde des données dans la base locale
-tutti.persistence.synchronizeReferential.synchronizeTable=Mise à jour de la table %s
-tutti.persistence.tableMetadata.instanciation.error=Erreur à l'initialisation de %s
Copied: trunk/tutti-persistence/src/main/resources/queries-failsafe.hbm.xml (from rev 1712, trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml)
===================================================================
--- trunk/tutti-persistence/src/main/resources/queries-failsafe.hbm.xml (rev 0)
+++ trunk/tutti-persistence/src/main/resources/queries-failsafe.hbm.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -0,0 +1,889 @@
+<?xml version="1.0"?>
+<!--
+ #%L
+ Tutti :: Persistence API
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2012 Ifremer
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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 General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
+
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+
+ <!-- ===================================================================== -->
+ <!-- === Requete sur données thématiques [DAT-XXX] === -->
+ <!-- ===================================================================== -->
+
+ <!-- [DAT-01] Get all programs (to list with no detail) -->
+ <query cacheable="true" name="allPrograms">
+ <![CDATA[
+ SELECT
+ p.code,
+ p.name,
+ p.description,
+ l.id,
+ l.label,
+ l.name
+ FROM
+ ProgramImpl p
+ LEFT OUTER JOIN p.locations l
+ WHERE
+ p.code LIKE :codePattern
+ AND (
+ l is null OR (
+ l.locationLevel.id = :locationLevelId
+ AND l.locationClassification.id = :locationClassificationId
+ )
+ )
+ ]]>
+ <query-param name="codePattern" type="java.lang.String"/>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
+ <query-param name="locationClassificationId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- [DAT-02] Get all cruises for a given program (to list with no detail) -->
+ <query cacheable="true" name="allCruises">
+ <![CDATA[
+ SELECT
+ c.id,
+ c.name,
+ c.departureDateTime
+ FROM
+ ScientificCruiseImpl c
+ WHERE
+ c.program.code = :programCode
+ ORDER BY
+ c.departureDateTime desc
+ ]]>
+ <query-param name="programCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [DAT-03] Get a detail program -->
+ <query cacheable="true" name="program">
+ <![CDATA[
+ SELECT
+ p.code,
+ p.name,
+ p.description,
+ l.id,
+ l.label,
+ l.name
+ FROM
+ ProgramImpl p
+ LEFT OUTER JOIN p.locations l
+ WHERE
+ p.code = :programCode
+ AND (
+ l is null OR (
+ l.locationLevel.id = :locationLevelId
+ AND l.locationClassification.id = :locationClassificationId
+ )
+ )
+ ORDER BY l.label
+ ]]>
+ <query-param name="programCode" type="java.lang.String"/>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
+ <query-param name="locationClassificationId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- [DAT-04] Get a detail cruise -->
+ <query cacheable="true" name="cruise">
+ <![CDATA[
+ SELECT
+ ft.departureLocation.id as departureLocationId,
+ ft.returnLocation.id as returnLocationId,
+ sc.program.code AS programCode,
+ sc.name AS name,
+ sc.departureDateTime AS departureDateTime,
+ sc.returnDateTime AS returnDateTime,
+ sc.vessel.code AS vesselCode,
+ mp.id AS managerId,
+ sc.comments AS scientificCruiseComments,
+ (SELECT sm.alphanumericalValue
+ FROM SurveyMeasurementImpl sm
+ WHERE sm.fishingTrip.id=ft.id AND sm.pmfm.id= :pmfmIdSurveyPart
+ ) AS surveyPart
+ FROM
+ ScientificCruiseImpl sc
+ LEFT OUTER JOIN sc.fishingTrips ft
+ LEFT OUTER JOIN sc.managerPerson mp
+ WHERE
+ sc.id = :cruiseId
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="pmfmIdSurveyPart" type="java.lang.Integer"/>
+ </query>
+
+ <!-- [DAT-05] Get all vesselPersonFeatures for a given cruise -->
+ <query cacheable="true" name="allCruiseVesselPersonFeatures">
+ <![CDATA[
+ SELECT
+ vpf.person.id AS personId,
+ vpr.id AS roleId,
+ vpf.rankOrder
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.vesselPersonFeatures vpf
+ JOIN vpf.vesselPersonRoles vpr
+ WHERE
+ sc.id = :cruiseId
+ ORDER By vpf.rankOrder
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allCruiseGears">
+ <![CDATA[
+ SELECT
+ gpf.gear.id AS gearId,
+ gpf.rankOrder AS rankOrder,
+ MAX(CASE gpm.pmfm.id
+ WHEN :pmfmIdTrawlNet THEN gpm.numericalValue
+ ELSE 0
+ END) as trawlNet,
+ count(o.id) as operationCount
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.gearPhysicalFeatures gpf
+ LEFT OUTER JOIN gpf.gearPhysicalMeasurements gpm
+ LEFT OUTER JOIN gpf.operations o
+ WHERE
+ sc.id = :cruiseId
+ GROUP BY
+ gpf.gear.id, gpf.rankOrder
+ ORDER BY gpf.rankOrder ASC
+ ]]>
+ <!--ORDER BY count(o.id) DESC-->
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="pmfmIdTrawlNet" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="updateOperationsVessel">
+ <![CDATA[
+ UPDATE FishingOperationImpl o
+ SET o.vessel.id=:vesselId
+ WHERE
+ o IN (
+ FROM FishingOperationImpl fo
+ WHERE fo.fishingTrip.scientificCruise.id=:cruiseId
+ )
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="vesselId" type="java.lang.String"/>
+ </query>
+
+ <query cacheable="true" name="gearCaracteristics">
+ <![CDATA[
+ SELECT
+ gpm
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.gearPhysicalFeatures gpf
+ LEFT OUTER JOIN gpf.gearPhysicalMeasurements gpm
+ WHERE
+ sc.id = :cruiseId
+ AND gpf.gear.id = :gearId
+ AND gpf.rankOrder = :rankOrder
+ AND gpm != null
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="gearId" type="java.lang.Integer"/>
+ <query-param name="rankOrder" type="java.lang.Short"/>
+ </query>
+
+ <query cacheable="true" name="allCruiseSecondaryVessels">
+ <![CDATA[
+ SELECT
+ va.operationVesselAssociationPk.vessel.code AS associatedVesselCode
+ FROM
+ ScientificCruiseImpl sc
+ JOIN sc.fishingTrips ft
+ JOIN ft.operations o
+ JOIN o.operationVesselAssociations va
+ WHERE
+ sc.id = :cruiseId
+ GROUP BY
+ va.operationVesselAssociationPk.vessel
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allFishingOperationIds">
+ <![CDATA[
+ SELECT
+ o.id AS id
+ FROM
+ FishingOperationImpl o
+ WHERE
+ o.fishingTrip.scientificCruise.id=:cruiseId
+ ORDER BY
+ o.startDateTime
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allFishingOperations">
+ <![CDATA[
+ SELECT
+ o.id AS id,
+ o.name AS name,
+ o.startDateTime AS startDateTime,
+ (select vum.alphanumericalValue from VesselUseMeasurementImpl vum where vum.vesselUseFeatures.id = vuf.id and vum.pmfm.id=:pmfmIdStationNumber) AS stationNumber,
+ (select gum.alphanumericalValue from GearUseMeasurementImpl gum where gum.gearUseFeatures.id = guf.id and gum.pmfm.id=:pmfmIdMultirigAggregation) AS multirigAggregation
+ FROM
+ FishingOperationImpl o
+ LEFT OUTER JOIN o.gearUseFeatures guf
+ LEFT OUTER JOIN guf.gear g
+ LEFT OUTER JOIN o.vesselUseFeatures vuf
+ WHERE
+ o.fishingTrip.scientificCruise.id=:cruiseId
+ ORDER BY
+ o.startDateTime
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="pmfmIdStationNumber" type="java.lang.Integer"/>
+ <query-param name="pmfmIdMultirigAggregation" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allFishingOperationsWithGear">
+ <![CDATA[
+ SELECT
+ g.id AS gearId,
+ guf.rankOrder as gufRankOrder
+ FROM
+ FishingOperationImpl o
+ INNER JOIN o.gearUseFeatures guf
+ LEFT OUTER JOIN guf.gear g
+ WHERE
+ o.fishingTrip.scientificCruise.id=:cruiseId
+ AND g.id in (:gearIds)
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="gearIds" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="updateOperationsGear">
+ <![CDATA[
+ UPDATE GearUseFeaturesImpl guf
+ SET guf.rankOrder=:newRankOrder
+ WHERE
+ guf IN (
+ SELECT
+ guf
+ FROM
+ FishingOperationImpl o
+ INNER JOIN o.gearUseFeatures guf
+ WHERE
+ o.fishingTrip.scientificCruise.id=:cruiseId
+ AND guf.rankOrder= :oldRankOrder
+ AND guf.gear.id= :gearId
+ )
+ ]]>
+ <query-param name="cruiseId" type="java.lang.Integer"/>
+ <query-param name="gearId" type="java.lang.Integer"/>
+ <query-param name="oldRankOrder" type="java.lang.Short"/>
+ <query-param name="newRankOrder" type="java.lang.Short"/>
+ </query>
+
+ <query cacheable="true" name="fishingOperation">
+ <![CDATA[
+ SELECT
+ o.name AS name,
+ guf.rankOrder AS rankOrder,
+ max(o.startDateTime) AS startDateTime,
+ max(o.endDateTime) AS endDateTime,
+ max(o.comments) AS comments,
+ max(g.id) AS gearId,
+ (select vp_start from VesselPositionImpl vp_start where vp_start.operation.id = o.id and vp_start.dateTime = o.startDateTime) AS startVesselPosition,
+ (select vp_end from VesselPositionImpl vp_end where vp_end.operation.id = o.id and vp_end.dateTime = o.endDateTime) AS endVesselPosition,
+ max(case when (rl.locationLevel.id = :locationLevelIdStrata) then rl.id else null end) AS strataId,
+ max(case when (rl.locationLevel.id = :locationLevelIdSubStrata) then rl.id else null end) AS subStrataId,
+ max(case when (rl.locationLevel.id = :locationLevelIdLocalite) then rl.id else null end) AS localiteId,
+ max(o.vessel.code) as vesselCode
+ FROM
+ FishingOperationImpl o
+ INNER JOIN o.gearUseFeatures guf
+ LEFT OUTER JOIN guf.gear g
+ LEFT OUTER JOIN guf.fishingAreas fa
+ LEFT OUTER JOIN fa.regulationLocations fa2rl
+ LEFT OUTER JOIN fa2rl.id.location rl
+ WHERE
+ o.id=:fishingOperationId
+ GROUP BY o.name, guf.rankOrder
+ ]]>
+ <!--LEFT OUTER JOIN o.operationVesselAssociations va-->
+ <!--max(case when (va.isCatchOnOperationVessel = false) then va.id.vessel.code else o.vessel.code end) as vesselCode-->
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ <query-param name="locationLevelIdStrata" type="java.lang.Integer"/>
+ <query-param name="locationLevelIdSubStrata" type="java.lang.Integer"/>
+ <query-param name="locationLevelIdLocalite" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="fishingOperationSecondaryVessel">
+ <![CDATA[
+ SELECT
+ va.operationVesselAssociationPk.vessel.code,
+ va.isCatchOnOperationVessel
+ FROM
+ FishingOperationImpl o
+ LEFT OUTER JOIN o.operationVesselAssociations va
+ WHERE
+ o.id=:fishingOperationId
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="fishingOperationRankOrder">
+ <![CDATA[
+ SELECT
+ count(o1.id) + 1 as fishingOperationRankOrder
+ FROM
+ FishingOperationImpl o1,
+ FishingOperationImpl o2
+ WHERE
+ o1.fishingTrip.id = o2.fishingTrip.id
+ AND o1.startDateTime < o2.startDateTime
+ AND o2.id = :fishingOperationId
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="fishingOperationVesselUseFeatures">
+ <![CDATA[
+ SELECT
+ vum.pmfm.id as pmfmId,
+ vum.numericalValue as numericalValue,
+ vum.alphanumericalValue as alphanumericalValue,
+ vum.qualitativeValue.id as qualitativeValueId
+ from
+ VesselUseFeaturesImpl vuf
+ join vuf.vesselUseMeasurements vum
+ WHERE
+ vuf.operation.id = :fishingOperationId
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="fishingOperationGearUseFeatures">
+ <![CDATA[
+ SELECT
+ gum.pmfm.id as pmfmId,
+ gum.numericalValue as numericalValue,
+ gum.alphanumericalValue as alphanumericalValue,
+ gum.qualitativeValue.id as qualitativeValueId
+ from
+ GearUseFeaturesImpl guf
+ join guf.gearUseMeasurements gum
+ WHERE
+ guf.operation.id = :fishingOperationId
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- Get all vesselPersonFeatures for a given fishing operation -->
+ <query cacheable="true" name="fishingOperationVesselPersonFeatures">
+ <![CDATA[
+ SELECT
+ vpf.person.id AS personId,
+ vpr.id AS roleId,
+ vpf.rankOrder
+ FROM
+ VesselPersonFeaturesImpl vpf
+ JOIN vpf.vesselPersonRoles vpr
+ WHERE
+ vpf.operation.id = :fishingOperationId
+ ORDER By vpf.rankOrder
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="updateFishingOperationCatchBatch">
+ <![CDATA[
+ UPDATE FishingOperationImpl o
+ SET o.catchBatch.id=:catchBatchId
+ WHERE
+ o.id=:fishingOperationId
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ <query-param name="catchBatchId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allFishingOperationSamplesWithoutBatch">
+ <![CDATA[
+ SELECT
+ s.id AS id,
+ s.referenceTaxon.id AS referenceTaxon,
+ s.comments AS comment
+ FROM
+ SampleImpl s
+ WHERE
+ s.fishingOperation.id= :fishingOperationId
+ AND s.batch IS NULL
+ ORDER BY
+ s.id
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allFishingOperationSamplesWithBatch">
+ <![CDATA[
+ SELECT
+ s.id AS id,
+ s.referenceTaxon.id AS referenceTaxon,
+ s.comments AS comment
+ FROM
+ SampleImpl s
+ WHERE
+ s.fishingOperation.id= :fishingOperationId
+ AND s.batch.id = :batchId
+ ORDER BY
+ s.id
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ <query-param name="batchId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="sampleMeasurements">
+ <![CDATA[
+ SELECT
+ sm.pmfm.id as pmfmId,
+ sm.numericalValue as numericalValue,
+ sm.alphanumericalValue as alphanumericalValue,
+ sm.qualitativeValue.id as qualitativeValueId
+ from
+ SampleMeasurementImpl sm
+ WHERE
+ sm.sample.id = :sampleId
+ ]]>
+ <query-param name="sampleId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="catchBatch">
+ <![CDATA[
+ SELECT
+ cb.id AS catchBatchId,
+ cbQm.numericalValue as totalWeight,
+ b1.id AS id1,
+ b1.samplingRatioText as samplingRatioText1,
+ (select qm.numericalValue from QuantificationMeasurementImpl qm where qm.batch.id=b1.id and qm.isReferenceQuantification=true) AS weight1,
+ (select sm.qualitativeValue.id from SortingMeasurementImpl sm where sm.sortingBatch.id=b1.id and sm.pmfm.id=:pmfmIdSorted) AS qv2,
+ b2.id AS id2,
+ b2.samplingRatioText AS samplingRatioText2,
+ (select qm.numericalValue from QuantificationMeasurementImpl qm where qm.batch.id=b2.id and qm.isReferenceQuantification=true) AS weight2,
+ (select sm.qualitativeValue.id from SortingMeasurementImpl sm where sm.sortingBatch.id=b2.id and sm.pmfm.id=:pmfmIdSortingType) AS qv2
+ FROM
+ CatchBatchImpl cb
+ INNER JOIN cb.childBatchs b1
+ LEFT OUTER JOIN b1.childBatchs b2
+ LEFT OUTER JOIN cb.quantificationMeasurements cbQm
+ WHERE
+ cb.fishingOperation.id = :fishingOperationId
+ AND (
+ cbQm is null
+ OR cbQm.isReferenceQuantification=true
+ )
+ ORDER BY b1.id, b2.id
+ ]]>
+ <query-param name="fishingOperationId" type="java.lang.Integer"/>
+ <query-param name="pmfmIdSorted" type="java.lang.Integer"/>
+ <query-param name="pmfmIdSortingType" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allSpeciesBatchFrequency">
+ <![CDATA[
+ SELECT
+ b.id as batchId,
+ b.individualCount AS individualCount,
+ qm.numericalValue AS weight,
+ b.comments AS comments,
+ sm.pmfm.id AS pmfmId,
+ sm.numericalValue AS numValue
+ FROM
+ SortingBatchImpl b
+ LEFT OUTER JOIN b.sortingMeasurements sm
+ LEFT OUTER JOIN b.quantificationMeasurements qm
+ WHERE
+ b.parentBatch.id=:parentBatchId
+ AND (
+ qm is null
+ OR qm.isReferenceQuantification=true
+ )
+ AND sm.numericalValue is not null
+ AND sm.pmfm.parameter.isAlphanumeric=false
+ AND sm.pmfm.parameter.isQualitative=false
+ ORDER BY sm.numericalValue
+ ]]>
+ <query-param name="parentBatchId" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="allAttachment">
+ <![CDATA[
+ SELECT
+ m.objectType.code as attachmentObjectType,
+ m.objectId AS attachmentObjectId,
+ m.id AS attachmentId,
+ m.path AS attachmentPath,
+ m.name AS attachmentName,
+ m.comments as attachmentComment
+ FROM
+ MeasurementFileImpl m
+ WHERE
+ m.objectId = :objectId
+ AND m.objectType.code = :objectTypeCode
+ ORDER BY m.id
+ ]]>
+ <query-param name="objectId" type="java.lang.Integer"/>
+ <query-param name="objectTypeCode" type="java.lang.Integer"/>
+ </query>
+
+ <query cacheable="true" name="attachment">
+ <![CDATA[
+ SELECT
+ m.objectType.code as attachmentObjectType,
+ m.objectId AS attachmentObjectId,
+ m.id AS attachmentId,
+ m.path AS attachmentPath,
+ m.name AS attachmentName,
+ m.comments as attachmentComment
+ FROM
+ MeasurementFileImpl m
+ WHERE
+ m.id = :attachmentId
+ ]]>
+ <query-param name="attachmentId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- ===================================================================== -->
+ <!-- === Requete techniques sur référentiels [REF-TXXX] === -->
+ <!-- ===================================================================== -->
+
+ <!-- [REF-T01] Get a pmfm caracteristics by this id -->
+ <query cacheable="true" name="pmfmById">
+ <![CDATA[
+ SELECT
+ p.id AS pmfmId,
+ p.parameter.name AS parameterName,
+ p.matrix.name AS matrixName,
+ p.fraction.name AS fractionName,
+ p.method.name AS methodName,
+ p.parameter.isAlphanumeric AS isAlphanumeric,
+ p.parameter.isQualitative AS isQualitative,
+ p.signifFiguresNumber,
+ p.maximumNumberDecimals,
+ p.precision,
+ case when (p.unit.id = :unitIdNone) then '' else p.unit.symbol end AS symbol,
+ p.status AS status
+ FROM PmfmImpl p
+ WHERE
+ p.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND p.parameter.isCalculated = false
+ AND p.id= :pmfmId
+ ]]>
+ <query-param name="pmfmId" type="java.lang.Integer"/>
+ <query-param name="unitIdNone" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-T02] Get a pmfm qualitative values from his id -->
+ <query cacheable="true" name="pmfmQualitativeValues">
+ <![CDATA[
+ SELECT
+ qv.id AS id,
+ qv.name,
+ case when (qv.description is null) then qv.name else qv.description end AS description,
+ qv.status AS status
+ FROM
+ PmfmImpl p JOIN p.qualitativeValues qv
+ WHERE
+ p.id= :pmfmId
+ AND qv.status.code IN (:statusValidCode, :statusTemporaryCode)
+ ]]>
+ <query-param name="pmfmId" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-T03] Get all caracteristics -->
+ <query cacheable="true" name="allPmfm">
+ <![CDATA[
+ SELECT
+ p.id AS pmfmId,
+ p.parameter.name AS parameterName,
+ p.matrix.name AS matrixName,
+ p.fraction.name AS fractionName,
+ p.method.name AS methodName,
+ p.parameter.isAlphanumeric AS isAlphanumeric,
+ p.parameter.isQualitative AS isQualitative,
+ p.signifFiguresNumber,
+ p.maximumNumberDecimals,
+ p.precision,
+ case when (p.unit.id = :unitIdNone) then '' else p.unit.symbol end AS symbol,
+ p.status AS status
+ FROM PmfmImpl p
+ WHERE
+ p.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND p.parameter.isCalculated = false
+ ]]>
+ <query-param name="unitIdNone" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-T04] Get all locations by level and classification -->
+ <query cacheable="true" name="allLocationsByLevelAndClassificiation">
+ <![CDATA[
+ SELECT
+ l.id as locationId,
+ l.label as locationLabel,
+ l.name as locationName,
+ l.status as status
+ FROM LocationImpl l
+ WHERE
+ l.locationLevel.id = :locationLevelId
+ AND l.locationClassification.id = :locationClassificationId
+ AND l.status.code IN (:statusValidCode, :statusTemporaryCode)
+ ]]>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
+ <query-param name="locationClassificationId" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-T05] Get a location by his id -->
+ <query cacheable="true" name="locationById">
+ <![CDATA[
+ SELECT
+ l.id as locationId,
+ l.label as locationLabel,
+ l.name as locationName,
+ l.status as status
+ FROM
+ LocationImpl l
+ WHERE
+ l.id = :locationId
+ ]]>
+ <query-param name="locationId" type="java.lang.Integer"/>
+ </query>
+
+
+ <!-- [REF-T06] Get all ObjectType -->
+ <query cacheable="true" name="allObjectType">
+ <![CDATA[
+ SELECT
+ p.code AS objectTypeCode,
+ p.name AS objectTypeName,
+ p.description AS objectTypeDescription
+ FROM ObjectTypeImpl p
+ ]]>
+ </query>
+
+ <!-- [REF-T06-1] Get one ObjectType -->
+ <query cacheable="true" name="objectType">
+ <![CDATA[
+ SELECT
+ p.code AS objectTypeCode,
+ p.name AS objectTypeName,
+ p.description AS objectTypeDescription
+ FROM ObjectTypeImpl p
+ WHERE p.code = :objectTypeCode
+ ]]>
+ <query-param name="objectTypeCode" type="java.lang.String"/>
+ </query>
+
+ <!-- ===================================================================== -->
+ <!-- === Requete sur référentiels [REF-XXX] === -->
+ <!-- ===================================================================== -->
+
+ <!-- [REF-01] Get all fishing operation strata / substrata / localite -->
+ <query cacheable="true" name="allFishingOperationLocationByParent">
+ <![CDATA[
+ SELECT
+ l.id as locationId,
+ l.label as locationLabel,
+ l.name as locationName,
+ l.status as status
+ FROM
+ LocationImpl l,
+ LocationHierarchyImpl lh
+ WHERE
+ l.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND l.locationLevel.id = :locationLevelId
+ AND l.locationClassification.id = :locationClassificationId
+ AND l.id = lh.locationHierarchyPk.location.id
+ AND lh.locationHierarchyPk.parent.id = :parentId
+ AND lh.locationHierarchyPk.parent.locationLevel.id = :parentLocationLevelId
+ ]]>
+ <query-param name="parentId" type="java.lang.Integer"/>
+ <query-param name="parentLocationLevelId" type="java.lang.Integer"/>
+ <query-param name="locationLevelId" type="java.lang.Integer"/>
+ <query-param name="locationClassificationId" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-02] Get all vessel for a given vesselType -->
+ <query cacheable="true" name="allVessels">
+ <![CDATA[
+ SELECT
+ v.code AS vesselCode,
+ vrp.registrationCode AS nationalRegistrationCode,
+ vrp.internationalRegistrationCode as internationalRegistrationCode,
+ vf.name AS vesselName,
+ v.status AS status
+ FROM
+ VesselImpl v
+ INNER JOIN v.vesselRegistrationPeriods AS vrp
+ LEFT OUTER JOIN v.vesselFeatures AS vf
+ WHERE
+ v.vesselType.id = :vesselTypeId
+ AND v.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND vrp.vesselRegistrationPeriodPk.startDateTime <= :refDate
+ AND vf.startDateTime <= :refDate
+ AND coalesce(vrp.endDateTime, :refDate) >= :refDate
+ AND coalesce(vf.endDateTime, :refDate) >= :refDate
+ )
+ ]]>
+ <query-param name="vesselTypeId" type="java.lang.Integer"/>
+ <query-param name="refDate" type="java.util.Date"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-02-1] Get a vessel -->
+ <query cacheable="true" name="vessel">
+ <![CDATA[
+ SELECT
+ v.code AS vesselCode,
+ vrp.registrationCode AS nationalRegistrationCode,
+ vrp.internationalRegistrationCode as internationalRegistrationCode,
+ vf.name AS vesselName,
+ v.status AS status
+ FROM
+ VesselImpl v
+ INNER JOIN v.vesselRegistrationPeriods AS vrp
+ LEFT OUTER JOIN v.vesselFeatures AS vf
+ WHERE
+ v.code = :vesselCode
+ AND v.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND NOT(coalesce(vrp.endDateTime, '2999-12-31 00:00:00') < coalesce(:refDate,sysdate)
+ OR vrp.vesselRegistrationPeriodPk.startDateTime > coalesce(:refDate,sysdate)
+ )
+ ORDER BY vf.startDateTime DESC
+ ]]>
+ <query-param name="vesselCode" type="java.lang.String"/>
+ <query-param name="refDate" type="java.util.Date"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-03] Get all gears for a given gearType -->
+ <query cacheable="true" name="allGears">
+ <![CDATA[
+ SELECT
+ g.id,
+ g.label,
+ g.name,
+ g.gearClassification,
+ g.status AS status
+ FROM GearImpl g
+ WHERE
+ g.gearClassification.id= :gearClassificiationId
+ AND g.status.code IN (:statusValidCode, :statusTemporaryCode)
+ ]]>
+ <query-param name="gearClassificiationId" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-03-1] Get a gear -->
+ <query cacheable="true" name="gear">
+ <![CDATA[
+ SELECT
+ g.id,
+ g.label,
+ g.name,
+ g.gearClassification,
+ g.status AS status
+ FROM GearImpl g
+ WHERE
+ g.id = :gearId
+ ]]>
+ <query-param name="gearId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- [REF-04] Get all persons -->
+ <query cacheable="true" name="allPersons">
+ <![CDATA[
+ SELECT DISTINCT
+ p.id,
+ p.lastname,
+ p.firstname,
+ p.department.code,
+ p.status
+ FROM
+ PersonImpl p
+ LEFT OUTER JOIN p.profils pp
+ WHERE
+ p.status.code IN (:statusValidCode, :statusTemporaryCode)
+ AND pp.id IN (
+ :observerProfilId,
+ :projectMemberProfilId,
+ :userProfilId
+ )
+ AND p.department.code LIKE concat(:departementPrefixCode , '%')
+ ]]>
+ <query-param name="observerProfilId" type="java.lang.Integer"/>
+ <query-param name="projectMemberProfilId" type="java.lang.Integer"/>
+ <query-param name="userProfilId" type="java.lang.Integer"/>
+ <query-param name="statusValidCode" type="java.lang.String"/>
+ <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ <query-param name="departementPrefixCode" type="java.lang.String"/>
+ </query>
+
+ <!-- [REF-04-1] Get one person -->
+ <query cacheable="true" name="person">
+ <![CDATA[
+ SELECT DISTINCT
+ p.id,
+ p.lastname,
+ p.firstname,
+ p.department.code,
+ p.status
+ FROM PersonImpl p
+ WHERE p.id = :personId
+ ]]>
+ <query-param name="personId" type="java.lang.Integer"/>
+ </query>
+
+ <!-- ===================================================================== -->
+ <!-- === Fetch profiles === -->
+ <!-- ===================================================================== -->
+
+
+ <!--<fetch-profile name="tutti">-->
+ <!--TODO Create fetch profile to avoid eager loading -->
+ <!--</fetch-profile>-->
+
+
+</hibernate-mapping>
Deleted: trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -1,889 +0,0 @@
-<?xml version="1.0"?>
-<!--
- #%L
- Tutti :: Persistence API
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2012 Ifremer
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU 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 General Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/gpl-3.0.html>.
- #L%
- -->
-
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-<hibernate-mapping>
-
- <!-- ===================================================================== -->
- <!-- === Requete sur données thématiques [DAT-XXX] === -->
- <!-- ===================================================================== -->
-
- <!-- [DAT-01] Get all programs (to list with no detail) -->
- <query cacheable="true" name="allPrograms">
- <![CDATA[
- SELECT
- p.code,
- p.name,
- p.description,
- l.id,
- l.label,
- l.name
- FROM
- ProgramImpl p
- LEFT OUTER JOIN p.locations l
- WHERE
- p.code LIKE :codePattern
- AND (
- l is null OR (
- l.locationLevel.id = :locationLevelId
- AND l.locationClassification.id = :locationClassificationId
- )
- )
- ]]>
- <query-param name="codePattern" type="java.lang.String"/>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="locationClassificationId" type="java.lang.Integer"/>
- </query>
-
- <!-- [DAT-02] Get all cruises for a given program (to list with no detail) -->
- <query cacheable="true" name="allCruises">
- <![CDATA[
- SELECT
- c.id,
- c.name,
- c.departureDateTime
- FROM
- ScientificCruiseImpl c
- WHERE
- c.program.code = :programCode
- ORDER BY
- c.departureDateTime desc
- ]]>
- <query-param name="programCode" type="java.lang.String"/>
- </query>
-
- <!-- [DAT-03] Get a detail program -->
- <query cacheable="true" name="program">
- <![CDATA[
- SELECT
- p.code,
- p.name,
- p.description,
- l.id,
- l.label,
- l.name
- FROM
- ProgramImpl p
- LEFT OUTER JOIN p.locations l
- WHERE
- p.code = :programCode
- AND (
- l is null OR (
- l.locationLevel.id = :locationLevelId
- AND l.locationClassification.id = :locationClassificationId
- )
- )
- ORDER BY l.label
- ]]>
- <query-param name="programCode" type="java.lang.String"/>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="locationClassificationId" type="java.lang.Integer"/>
- </query>
-
- <!-- [DAT-04] Get a detail cruise -->
- <query cacheable="true" name="cruise">
- <![CDATA[
- SELECT
- ft.departureLocation.id as departureLocationId,
- ft.returnLocation.id as returnLocationId,
- sc.program.code AS programCode,
- sc.name AS name,
- sc.departureDateTime AS departureDateTime,
- sc.returnDateTime AS returnDateTime,
- sc.vessel.code AS vesselCode,
- mp.id AS managerId,
- sc.comments AS scientificCruiseComments,
- (SELECT sm.alphanumericalValue
- FROM SurveyMeasurementImpl sm
- WHERE sm.fishingTrip.id=ft.id AND sm.pmfm.id= :pmfmIdSurveyPart
- ) AS surveyPart
- FROM
- ScientificCruiseImpl sc
- LEFT OUTER JOIN sc.fishingTrips ft
- LEFT OUTER JOIN sc.managerPerson mp
- WHERE
- sc.id = :cruiseId
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="pmfmIdSurveyPart" type="java.lang.Integer"/>
- </query>
-
- <!-- [DAT-05] Get all vesselPersonFeatures for a given cruise -->
- <query cacheable="true" name="allCruiseVesselPersonFeatures">
- <![CDATA[
- SELECT
- vpf.person.id AS personId,
- vpr.id AS roleId,
- vpf.rankOrder
- FROM
- ScientificCruiseImpl sc
- JOIN sc.fishingTrips ft
- JOIN ft.vesselPersonFeatures vpf
- JOIN vpf.vesselPersonRoles vpr
- WHERE
- sc.id = :cruiseId
- ORDER By vpf.rankOrder
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allCruiseGears">
- <![CDATA[
- SELECT
- gpf.gear.id AS gearId,
- gpf.rankOrder AS rankOrder,
- MAX(CASE gpm.pmfm.id
- WHEN :pmfmIdTrawlNet THEN gpm.numericalValue
- ELSE 0
- END) as trawlNet,
- count(o.id) as operationCount
- FROM
- ScientificCruiseImpl sc
- JOIN sc.fishingTrips ft
- JOIN ft.gearPhysicalFeatures gpf
- LEFT OUTER JOIN gpf.gearPhysicalMeasurements gpm
- LEFT OUTER JOIN gpf.operations o
- WHERE
- sc.id = :cruiseId
- GROUP BY
- gpf.gear.id, gpf.rankOrder
- ORDER BY gpf.rankOrder ASC
- ]]>
- <!--ORDER BY count(o.id) DESC-->
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="pmfmIdTrawlNet" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="updateOperationsVessel">
- <![CDATA[
- UPDATE FishingOperationImpl o
- SET o.vessel.id=:vesselId
- WHERE
- o IN (
- FROM FishingOperationImpl fo
- WHERE fo.fishingTrip.scientificCruise.id=:cruiseId
- )
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="vesselId" type="java.lang.String"/>
- </query>
-
- <query cacheable="true" name="gearCaracteristics">
- <![CDATA[
- SELECT
- gpm
- FROM
- ScientificCruiseImpl sc
- JOIN sc.fishingTrips ft
- JOIN ft.gearPhysicalFeatures gpf
- LEFT OUTER JOIN gpf.gearPhysicalMeasurements gpm
- WHERE
- sc.id = :cruiseId
- AND gpf.gear.id = :gearId
- AND gpf.rankOrder = :rankOrder
- AND gpm != null
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="gearId" type="java.lang.Integer"/>
- <query-param name="rankOrder" type="java.lang.Short"/>
- </query>
-
- <query cacheable="true" name="allCruiseSecondaryVessels">
- <![CDATA[
- SELECT
- va.operationVesselAssociationPk.vessel.code AS associatedVesselCode
- FROM
- ScientificCruiseImpl sc
- JOIN sc.fishingTrips ft
- JOIN ft.operations o
- JOIN o.operationVesselAssociations va
- WHERE
- sc.id = :cruiseId
- GROUP BY
- va.operationVesselAssociationPk.vessel
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allFishingOperationIds">
- <![CDATA[
- SELECT
- o.id AS id
- FROM
- FishingOperationImpl o
- WHERE
- o.fishingTrip.scientificCruise.id=:cruiseId
- ORDER BY
- o.startDateTime
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allFishingOperations">
- <![CDATA[
- SELECT
- o.id AS id,
- o.name AS name,
- o.startDateTime AS startDateTime,
- (select vum.alphanumericalValue from VesselUseMeasurementImpl vum where vum.vesselUseFeatures.id = vuf.id and vum.pmfm.id=:pmfmIdStationNumber) AS stationNumber,
- (select gum.alphanumericalValue from GearUseMeasurementImpl gum where gum.gearUseFeatures.id = guf.id and gum.pmfm.id=:pmfmIdMultirigAggregation) AS multirigAggregation
- FROM
- FishingOperationImpl o
- LEFT OUTER JOIN o.gearUseFeatures guf
- LEFT OUTER JOIN guf.gear g
- LEFT OUTER JOIN o.vesselUseFeatures vuf
- WHERE
- o.fishingTrip.scientificCruise.id=:cruiseId
- ORDER BY
- o.startDateTime
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="pmfmIdStationNumber" type="java.lang.Integer"/>
- <query-param name="pmfmIdMultirigAggregation" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allFishingOperationsWithGear">
- <![CDATA[
- SELECT
- g.id AS gearId,
- guf.rankOrder as gufRankOrder
- FROM
- FishingOperationImpl o
- INNER JOIN o.gearUseFeatures guf
- LEFT OUTER JOIN guf.gear g
- WHERE
- o.fishingTrip.scientificCruise.id=:cruiseId
- AND g.id in (:gearIds)
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="gearIds" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="updateOperationsGear">
- <![CDATA[
- UPDATE GearUseFeaturesImpl guf
- SET guf.rankOrder=:newRankOrder
- WHERE
- guf IN (
- SELECT
- guf
- FROM
- FishingOperationImpl o
- INNER JOIN o.gearUseFeatures guf
- WHERE
- o.fishingTrip.scientificCruise.id=:cruiseId
- AND guf.rankOrder= :oldRankOrder
- AND guf.gear.id= :gearId
- )
- ]]>
- <query-param name="cruiseId" type="java.lang.Integer"/>
- <query-param name="gearId" type="java.lang.Integer"/>
- <query-param name="oldRankOrder" type="java.lang.Short"/>
- <query-param name="newRankOrder" type="java.lang.Short"/>
- </query>
-
- <query cacheable="true" name="fishingOperation">
- <![CDATA[
- SELECT
- o.name AS name,
- guf.rankOrder AS rankOrder,
- max(o.startDateTime) AS startDateTime,
- max(o.endDateTime) AS endDateTime,
- max(o.comments) AS comments,
- max(g.id) AS gearId,
- (select vp_start from VesselPositionImpl vp_start where vp_start.operation.id = o.id and vp_start.dateTime = o.startDateTime) AS startVesselPosition,
- (select vp_end from VesselPositionImpl vp_end where vp_end.operation.id = o.id and vp_end.dateTime = o.endDateTime) AS endVesselPosition,
- max(case when (rl.locationLevel.id = :locationLevelIdStrata) then rl.id else null end) AS strataId,
- max(case when (rl.locationLevel.id = :locationLevelIdSubStrata) then rl.id else null end) AS subStrataId,
- max(case when (rl.locationLevel.id = :locationLevelIdLocalite) then rl.id else null end) AS localiteId,
- max(o.vessel.code) as vesselCode
- FROM
- FishingOperationImpl o
- INNER JOIN o.gearUseFeatures guf
- LEFT OUTER JOIN guf.gear g
- LEFT OUTER JOIN guf.fishingAreas fa
- LEFT OUTER JOIN fa.regulationLocation fa2rl
- LEFT OUTER JOIN fa2rl.id.location rl
- WHERE
- o.id=:fishingOperationId
- GROUP BY o.name, guf.rankOrder
- ]]>
- <!--LEFT OUTER JOIN o.operationVesselAssociations va-->
- <!--max(case when (va.isCatchOnOperationVessel = false) then va.id.vessel.code else o.vessel.code end) as vesselCode-->
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- <query-param name="locationLevelIdStrata" type="java.lang.Integer"/>
- <query-param name="locationLevelIdSubStrata" type="java.lang.Integer"/>
- <query-param name="locationLevelIdLocalite" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="fishingOperationSecondaryVessel">
- <![CDATA[
- SELECT
- va.operationVesselAssociationPk.vessel.code,
- va.isCatchOnOperationVessel
- FROM
- FishingOperationImpl o
- LEFT OUTER JOIN o.operationVesselAssociations va
- WHERE
- o.id=:fishingOperationId
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="fishingOperationRankOrder">
- <![CDATA[
- SELECT
- count(o1.id) + 1 as fishingOperationRankOrder
- FROM
- FishingOperationImpl o1,
- FishingOperationImpl o2
- WHERE
- o1.fishingTrip.id = o2.fishingTrip.id
- AND o1.startDateTime < o2.startDateTime
- AND o2.id = :fishingOperationId
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="fishingOperationVesselUseFeatures">
- <![CDATA[
- SELECT
- vum.pmfm.id as pmfmId,
- vum.numericalValue as numericalValue,
- vum.alphanumericalValue as alphanumericalValue,
- vum.qualitativeValue.id as qualitativeValueId
- from
- VesselUseFeaturesImpl vuf
- join vuf.vesselUseMeasurements vum
- WHERE
- vuf.operation.id = :fishingOperationId
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="fishingOperationGearUseFeatures">
- <![CDATA[
- SELECT
- gum.pmfm.id as pmfmId,
- gum.numericalValue as numericalValue,
- gum.alphanumericalValue as alphanumericalValue,
- gum.qualitativeValue.id as qualitativeValueId
- from
- GearUseFeaturesImpl guf
- join guf.gearUseMeasurements gum
- WHERE
- guf.operation.id = :fishingOperationId
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <!-- Get all vesselPersonFeatures for a given fishing operation -->
- <query cacheable="true" name="fishingOperationVesselPersonFeatures">
- <![CDATA[
- SELECT
- vpf.person.id AS personId,
- vpr.id AS roleId,
- vpf.rankOrder
- FROM
- VesselPersonFeaturesImpl vpf
- JOIN vpf.vesselPersonRoles vpr
- WHERE
- vpf.operation.id = :fishingOperationId
- ORDER By vpf.rankOrder
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="updateFishingOperationCatchBatch">
- <![CDATA[
- UPDATE FishingOperationImpl o
- SET o.catchBatch.id=:catchBatchId
- WHERE
- o.id=:fishingOperationId
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- <query-param name="catchBatchId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allFishingOperationSamplesWithoutBatch">
- <![CDATA[
- SELECT
- s.id AS id,
- s.referenceTaxon.id AS referenceTaxon,
- s.comments AS comment
- FROM
- SampleImpl s
- WHERE
- s.fishingOperation.id= :fishingOperationId
- AND s.batch IS NULL
- ORDER BY
- s.id
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allFishingOperationSamplesWithBatch">
- <![CDATA[
- SELECT
- s.id AS id,
- s.referenceTaxon.id AS referenceTaxon,
- s.comments AS comment
- FROM
- SampleImpl s
- WHERE
- s.fishingOperation.id= :fishingOperationId
- AND s.batch.id = :batchId
- ORDER BY
- s.id
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- <query-param name="batchId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="sampleMeasurements">
- <![CDATA[
- SELECT
- sm.pmfm.id as pmfmId,
- sm.numericalValue as numericalValue,
- sm.alphanumericalValue as alphanumericalValue,
- sm.qualitativeValue.id as qualitativeValueId
- from
- SampleMeasurementImpl sm
- WHERE
- sm.sample.id = :sampleId
- ]]>
- <query-param name="sampleId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="catchBatch">
- <![CDATA[
- SELECT
- cb.id AS catchBatchId,
- cbQm.numericalValue as totalWeight,
- b1.id AS id1,
- b1.samplingRatioText as samplingRatioText1,
- (select qm.numericalValue from QuantificationMeasurementImpl qm where qm.batch.id=b1.id and qm.isReferenceQuantification=true) AS weight1,
- (select sm.qualitativeValue.id from SortingMeasurementImpl sm where sm.sortingBatch.id=b1.id and sm.pmfm.id=:pmfmIdSorted) AS qv2,
- b2.id AS id2,
- b2.samplingRatioText AS samplingRatioText2,
- (select qm.numericalValue from QuantificationMeasurementImpl qm where qm.batch.id=b2.id and qm.isReferenceQuantification=true) AS weight2,
- (select sm.qualitativeValue.id from SortingMeasurementImpl sm where sm.sortingBatch.id=b2.id and sm.pmfm.id=:pmfmIdSortingType) AS qv2
- FROM
- CatchBatchImpl cb
- INNER JOIN cb.childBatchs b1
- LEFT OUTER JOIN b1.childBatchs b2
- LEFT OUTER JOIN cb.quantificationMeasurements cbQm
- WHERE
- cb.fishingOperation.id = :fishingOperationId
- AND (
- cbQm is null
- OR cbQm.isReferenceQuantification=true
- )
- ORDER BY b1.id, b2.id
- ]]>
- <query-param name="fishingOperationId" type="java.lang.Integer"/>
- <query-param name="pmfmIdSorted" type="java.lang.Integer"/>
- <query-param name="pmfmIdSortingType" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allSpeciesBatchFrequency">
- <![CDATA[
- SELECT
- b.id as batchId,
- b.individualCount AS individualCount,
- qm.numericalValue AS weight,
- b.comments AS comments,
- sm.pmfm.id AS pmfmId,
- sm.numericalValue AS numValue
- FROM
- SortingBatchImpl b
- LEFT OUTER JOIN b.sortingMeasurements sm
- LEFT OUTER JOIN b.quantificationMeasurements qm
- WHERE
- b.parentBatch.id=:parentBatchId
- AND (
- qm is null
- OR qm.isReferenceQuantification=true
- )
- AND sm.numericalValue is not null
- AND sm.pmfm.parameter.isAlphanumeric=false
- AND sm.pmfm.parameter.isQualitative=false
- ORDER BY sm.numericalValue
- ]]>
- <query-param name="parentBatchId" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="allAttachment">
- <![CDATA[
- SELECT
- m.objectType.code as attachmentObjectType,
- m.objectId AS attachmentObjectId,
- m.id AS attachmentId,
- m.path AS attachmentPath,
- m.name AS attachmentName,
- m.comments as attachmentComment
- FROM
- MeasurementFileImpl m
- WHERE
- m.objectId = :objectId
- AND m.objectType.code = :objectTypeCode
- ORDER BY m.id
- ]]>
- <query-param name="objectId" type="java.lang.Integer"/>
- <query-param name="objectTypeCode" type="java.lang.Integer"/>
- </query>
-
- <query cacheable="true" name="attachment">
- <![CDATA[
- SELECT
- m.objectType.code as attachmentObjectType,
- m.objectId AS attachmentObjectId,
- m.id AS attachmentId,
- m.path AS attachmentPath,
- m.name AS attachmentName,
- m.comments as attachmentComment
- FROM
- MeasurementFileImpl m
- WHERE
- m.id = :attachmentId
- ]]>
- <query-param name="attachmentId" type="java.lang.Integer"/>
- </query>
-
- <!-- ===================================================================== -->
- <!-- === Requete techniques sur référentiels [REF-TXXX] === -->
- <!-- ===================================================================== -->
-
- <!-- [REF-T01] Get a pmfm caracteristics by this id -->
- <query cacheable="true" name="pmfmById">
- <![CDATA[
- SELECT
- p.id AS pmfmId,
- p.parameter.name AS parameterName,
- p.matrix.name AS matrixName,
- p.fraction.name AS fractionName,
- p.method.name AS methodName,
- p.parameter.isAlphanumeric AS isAlphanumeric,
- p.parameter.isQualitative AS isQualitative,
- p.signifFiguresNumber,
- p.maximumNumberDecimals,
- p.precision,
- case when (p.unit.id = :unitIdNone) then '' else p.unit.symbol end AS symbol,
- p.status AS status
- FROM PmfmImpl p
- WHERE
- p.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND p.parameter.isCalculated = false
- AND p.id= :pmfmId
- ]]>
- <query-param name="pmfmId" type="java.lang.Integer"/>
- <query-param name="unitIdNone" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-T02] Get a pmfm qualitative values from his id -->
- <query cacheable="true" name="pmfmQualitativeValues">
- <![CDATA[
- SELECT
- qv.id AS id,
- qv.name,
- case when (qv.description is null) then qv.name else qv.description end AS description,
- qv.status AS status
- FROM
- PmfmImpl p JOIN p.qualitativeValues qv
- WHERE
- p.id= :pmfmId
- AND qv.status.code IN (:statusValidCode, :statusTemporaryCode)
- ]]>
- <query-param name="pmfmId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-T03] Get all caracteristics -->
- <query cacheable="true" name="allPmfm">
- <![CDATA[
- SELECT
- p.id AS pmfmId,
- p.parameter.name AS parameterName,
- p.matrix.name AS matrixName,
- p.fraction.name AS fractionName,
- p.method.name AS methodName,
- p.parameter.isAlphanumeric AS isAlphanumeric,
- p.parameter.isQualitative AS isQualitative,
- p.signifFiguresNumber,
- p.maximumNumberDecimals,
- p.precision,
- case when (p.unit.id = :unitIdNone) then '' else p.unit.symbol end AS symbol,
- p.status AS status
- FROM PmfmImpl p
- WHERE
- p.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND p.parameter.isCalculated = false
- ]]>
- <query-param name="unitIdNone" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-T04] Get all locations by level and classification -->
- <query cacheable="true" name="allLocationsByLevelAndClassificiation">
- <![CDATA[
- SELECT
- l.id as locationId,
- l.label as locationLabel,
- l.name as locationName,
- l.status as status
- FROM LocationImpl l
- WHERE
- l.locationLevel.id = :locationLevelId
- AND l.locationClassification.id = :locationClassificationId
- AND l.status.code IN (:statusValidCode, :statusTemporaryCode)
- ]]>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="locationClassificationId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-T05] Get a location by his id -->
- <query cacheable="true" name="locationById">
- <![CDATA[
- SELECT
- l.id as locationId,
- l.label as locationLabel,
- l.name as locationName,
- l.status as status
- FROM
- LocationImpl l
- WHERE
- l.id = :locationId
- ]]>
- <query-param name="locationId" type="java.lang.Integer"/>
- </query>
-
-
- <!-- [REF-T06] Get all ObjectType -->
- <query cacheable="true" name="allObjectType">
- <![CDATA[
- SELECT
- p.code AS objectTypeCode,
- p.name AS objectTypeName,
- p.description AS objectTypeDescription
- FROM ObjectTypeImpl p
- ]]>
- </query>
-
- <!-- [REF-T06-1] Get one ObjectType -->
- <query cacheable="true" name="objectType">
- <![CDATA[
- SELECT
- p.code AS objectTypeCode,
- p.name AS objectTypeName,
- p.description AS objectTypeDescription
- FROM ObjectTypeImpl p
- WHERE p.code = :objectTypeCode
- ]]>
- <query-param name="objectTypeCode" type="java.lang.String"/>
- </query>
-
- <!-- ===================================================================== -->
- <!-- === Requete sur référentiels [REF-XXX] === -->
- <!-- ===================================================================== -->
-
- <!-- [REF-01] Get all fishing operation strata / substrata / localite -->
- <query cacheable="true" name="allFishingOperationLocationByParent">
- <![CDATA[
- SELECT
- l.id as locationId,
- l.label as locationLabel,
- l.name as locationName,
- l.status as status
- FROM
- LocationImpl l,
- LocationHierarchyImpl lh
- WHERE
- l.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND l.locationLevel.id = :locationLevelId
- AND l.locationClassification.id = :locationClassificationId
- AND l.id = lh.locationHierarchyPk.location.id
- AND lh.locationHierarchyPk.parent.id = :parentId
- AND lh.locationHierarchyPk.parent.locationLevel.id = :parentLocationLevelId
- ]]>
- <query-param name="parentId" type="java.lang.Integer"/>
- <query-param name="parentLocationLevelId" type="java.lang.Integer"/>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="locationClassificationId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-02] Get all vessel for a given vesselType -->
- <query cacheable="true" name="allVessels">
- <![CDATA[
- SELECT
- v.code AS vesselCode,
- vrp.registrationCode AS nationalRegistrationCode,
- vrp.internationalRegistrationCode as internationalRegistrationCode,
- vf.name AS vesselName,
- v.status AS status
- FROM
- VesselImpl v
- INNER JOIN v.vesselRegistrationPeriods AS vrp
- LEFT OUTER JOIN v.vesselFeatures AS vf
- WHERE
- v.vesselType.id = :vesselTypeId
- AND v.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND vrp.vesselRegistrationPeriodPk.startDateTime <= :refDate
- AND vf.startDateTime <= :refDate
- AND coalesce(vrp.endDateTime, :refDate) >= :refDate
- AND coalesce(vf.endDateTime, :refDate) >= :refDate
- )
- ]]>
- <query-param name="vesselTypeId" type="java.lang.Integer"/>
- <query-param name="refDate" type="java.util.Date"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-02-1] Get a vessel -->
- <query cacheable="true" name="vessel">
- <![CDATA[
- SELECT
- v.code AS vesselCode,
- vrp.registrationCode AS nationalRegistrationCode,
- vrp.internationalRegistrationCode as internationalRegistrationCode,
- vf.name AS vesselName,
- v.status AS status
- FROM
- VesselImpl v
- INNER JOIN v.vesselRegistrationPeriods AS vrp
- LEFT OUTER JOIN v.vesselFeatures AS vf
- WHERE
- v.code = :vesselCode
- AND v.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND NOT(coalesce(vrp.endDateTime, '2999-12-31 00:00:00') < coalesce(:refDate,sysdate)
- OR vrp.vesselRegistrationPeriodPk.startDateTime > coalesce(:refDate,sysdate)
- )
- ORDER BY vf.startDateTime DESC
- ]]>
- <query-param name="vesselCode" type="java.lang.String"/>
- <query-param name="refDate" type="java.util.Date"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-03] Get all gears for a given gearType -->
- <query cacheable="true" name="allGears">
- <![CDATA[
- SELECT
- g.id,
- g.label,
- g.name,
- g.gearClassification,
- g.status AS status
- FROM GearImpl g
- WHERE
- g.gearClassification.id= :gearClassificiationId
- AND g.status.code IN (:statusValidCode, :statusTemporaryCode)
- ]]>
- <query-param name="gearClassificiationId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-03-1] Get a gear -->
- <query cacheable="true" name="gear">
- <![CDATA[
- SELECT
- g.id,
- g.label,
- g.name,
- g.gearClassification,
- g.status AS status
- FROM GearImpl g
- WHERE
- g.id = :gearId
- ]]>
- <query-param name="gearId" type="java.lang.Integer"/>
- </query>
-
- <!-- [REF-04] Get all persons -->
- <query cacheable="true" name="allPersons">
- <![CDATA[
- SELECT DISTINCT
- p.id,
- p.lastname,
- p.firstname,
- p.department.code,
- p.status
- FROM
- PersonImpl p
- LEFT OUTER JOIN p.profils pp
- WHERE
- p.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND pp.id IN (
- :observerProfilId,
- :projectMemberProfilId,
- :userProfilId
- )
- AND p.department.code LIKE concat(:departementPrefixCode , '%')
- ]]>
- <query-param name="observerProfilId" type="java.lang.Integer"/>
- <query-param name="projectMemberProfilId" type="java.lang.Integer"/>
- <query-param name="userProfilId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- <query-param name="departementPrefixCode" type="java.lang.String"/>
- </query>
-
- <!-- [REF-04-1] Get one person -->
- <query cacheable="true" name="person">
- <![CDATA[
- SELECT DISTINCT
- p.id,
- p.lastname,
- p.firstname,
- p.department.code,
- p.status
- FROM PersonImpl p
- WHERE p.id = :personId
- ]]>
- <query-param name="personId" type="java.lang.Integer"/>
- </query>
-
- <!-- ===================================================================== -->
- <!-- === Fetch profiles === -->
- <!-- ===================================================================== -->
-
-
- <!--<fetch-profile name="tutti">-->
- <!--TODO Create fetch profile to avoid eager loading -->
- <!--</fetch-profile>-->
-
-
-</hibernate-mapping>
Added: trunk/tutti-persistence/src/main/resources/tutti-conf.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/tutti-conf.xml (rev 0)
+++ trunk/tutti-persistence/src/main/resources/tutti-conf.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+ <context:property-placeholder
+ location="classpath:conf.properties"
+ ignore-resource-not-found="false"
+ ignore-unresolvable="true"
+ system-properties-mode="OVERRIDE"/>
+ <context:property-placeholder
+ location="classpath:enumerations-v3.properties"
+ ignore-resource-not-found="false"
+ ignore-unresolvable="true"
+ system-properties-mode="OVERRIDE"/>
+
+</beans>
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/resources/tutti-conf.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2014-04-21 13:27:20 UTC (rev 1718)
@@ -21,316 +21,42 @@
# <http://www.gnu.org/licenses/gpl-3.0.html>.
# #L%
###
-# Version de preprod
-AcquisitionLevelCode.ACTIVITY=MONTHLY_ACTIVITY
-AcquisitionLevelCode.ACTIVITY_CALENDAR=ACTIVITY_CALENDAR
-AcquisitionLevelCode.BATCH=BATCH
-AcquisitionLevelCode.FISHING_EFFORT_CALENDAR=EFFORT_CALENDAR
-AcquisitionLevelCode.FISHING_OPERATION=OPERATION
-AcquisitionLevelCode.FISHING_TRIP=FISHING_TRIP
-AcquisitionLevelCode.FISHING_TRIP_PHYSICAL_GEAR=OBSERVED_FISHING_TRIP_PHYSICAL_GEAR
-AcquisitionLevelCode.LANDING=LANDING
-AcquisitionLevelCode.MONTHLY_EFFORT=MONTHLY_FISHING_EFFORT
-AcquisitionLevelCode.OBSERVED_LANDING=OBSERVED_LANDING
-AcquisitionLevelCode.OBSERVED_SALE=OBSERVED_SALE
-AcquisitionLevelCode.OBSERVED_TRIP_ON_BOARD=OBSERVED_FISHING_TRIP
-AcquisitionLevelCode.OPERATION=OPERATION_fake
-AcquisitionLevelCode.OPERATION_GROUP=OPERATION_GROUP
-AcquisitionLevelCode.PHYSICAL_GEAR=PHYSICAL_GEAR_SURVEY
-AcquisitionLevelCode.SALE=SALE
-AcquisitionLevelCode.SALE_SURVEY=SALE_SURVEY
-AcquisitionLevelCode.SAMPLE=SAMPLE
-AcquisitionLevelCode.SCIENTIFIC_CRUISE=SCIENTIFIC_CRUISE
-AcquisitionLevelCode.VESSEL_PHYSICALFEATURES=VESSEL_PHYSICAL_FEATURES
-AcquisitionLevelCode.YEARLYEFFORT=YEARLY_FISHING_EFFORT
-AcquisitionLevelCode.CONTROLS_REFERENTIAL=CONTROLS_REFERENTIAL
-ActivityCalendarNumericalPmfmIds.GREATER_VALUE_PMFM=241
-ActivityCalendarNumericalPmfmIds.LOWER_VALUE_PMFM=242
-AggregationLevelId.DAY=4
-AggregationLevelId.FISHING_TRIP=9
-AggregationLevelId.HOUR=3
-AggregationLevelId.MONTH=21
-AggregationLevelId.NONE=1
-AggregationLevelId.SEMESTER=7
-AggregationLevelId.TRIMESTER=6
-AggregationLevelId.YEAR=8
-CriteriaType.DEFAULT=0
-CriteriaType.EXISTS=3
-CriteriaType.JOIN=1
-CriteriaType.NOT_EXISTS=4
-CriteriaType.SELECT=2
-DepartmentCode.OUTSIDE=EXTERIEUR
-Filters.RESULTS_SIZE_WARNING_VALUE=10000
-FractionId.ALL=1
-FractionId.GEAR=2
-GearClassificationId.CNTS=5
-GearClassificationId.EU=4
-GearClassificationId.FAO=1
-GearClassificationId.SCIENTIFIC_CRUISE=5
-GearUseFeaturesOriginMapping.ACTIVITY_CALENDAR=Activit\u00E9 N-1|<PROGRAM>,Enqu\u00EAteur|<INVESTIGATOR>,Document d\u00E9claratif|<DECLARATIVE>,Ventes|OFIMER
-GearUseFeaturesOriginMapping.EFFORT_CALENDAR=Activit\u00E9 N-1|<PROGRAM>,Enqu\u00EAteur|<INVESTIGATOR>,Document d\u00E9claratif|<DECLARATIVE>,Ventes|OFIMER
-isActive.ACTIVE=1
-isActive.INACTIVE=0
-isActive.NOT_EXISTS=2
-LocationClassificationId.REGULATION=3
-LocationClassificationId.SECTOR=2
-LocationClassificationId.TERRITORIAL=1
-LocationLabel.FRANCE=FRA
-LocationLabel.MEDITERRANEAN_AND_BLACK_SEA=37
-LocationLevelId.CRIEE=7
-LocationLevelId.DEPARTEMENT=32
-LocationLevelId.FAO_ZONE=101
-LocationLevelId.PAYS_ISO3=21
-LocationLevelId.PORT=6
-LocationLevelId.QUARTIER=13
-LocationLevelId.RECTANGLE_STATISTIQUE=113
-LocationLevelId.REGION=31
-LocationLevelId.SOUS_RECTANGLE_STATISTIQUE=114
-ManageDataTypeId.ACTIVITY_CALENDAR=4
-ManageDataTypeId.OBSERVED_FISHING_TRIP_ON_BOARD=5
-ManageDataTypeId.PHYSICAL_GEAR_SURVEY=7
-ManageDataTypeId.SALE=8
-ManageDataTypeId.SCIENTIFIC_CRUISE=9
-MatrixId.FISHING_METIER=6
-MatrixId.GEAR=3
-MatrixId.OPERATION=21
-MatrixId.VESSEL=5
-MatrixId.SUPPORT_WITH_GEAR=17
-MatrixId.SUPPORT_WITH_METIER=18
-MethodId.ALIVE_WEIGHT_EQUIVALENT=5
-MethodId.ESTIMATED=45
-MethodId.HEIGHT_WEIGHT=47
-MethodId.TOTAL_BATCH=283
-OrderTypeId.NORTH_SOUTH_LOCATION_RANK=1
-ParameterCode.ANOTHER_SURVEY=ACCEPT_OTHER_SURVEY
-ParameterCode.BULK=SORTED
-ParameterCode.CALCULATED_WEIGHT=WEIGHT_CALCULATED
-ParameterCode.CONTRACT_CODE=CONTRACT_CODE
-ParameterCode.CREW_SIZE=CREW_SIZE
-ParameterCode.DATA_RELIABILITY=SURVEY_RELIABILITY
-ParameterCode.DISCARD_TYPE=DISCARD_TYPE
-ParameterCode.ENGIN_TIME=ENGIN_DURATION
-ParameterCode.FISHING_DAY_COUNT=FISHING_DURATION
-ParameterCode.GEAR_DEPTH=GEAR_DEPTH
-ParameterCode.IS_SAMPLING=IS_SAMPLING
-ParameterCode.LANDING_REJECTION=DISCARD_OR_LANDING
-ParameterCode.PRESENTATION=DRESSING
-ParameterCode.PROCEEDING=TRIP_PROGRESS
-ParameterCode.RECEPTION_QUALITY=WELCOME_QUALITY
-ParameterCode.SEA_DAY_COUNT=DURATION_AT_SEA
-ParameterCode.SEA_STATE=SEA_STATE
-ParameterCode.SEX=SEX
-ParameterCode.SIZE=LENGTH_TOTAL
-ParameterCode.STATUS=QUALITY
-ParameterCode.SURVEY_QUALIFICATION=SURVEY_QUALIFICATION
-ParameterCode.VALIDATION_PROGRAM=IS_VALIDATED_PRG
-ParameterCode.VALIDATION_SUPERVISOR=IS_VALIDATED
-ParameterCode.WEIGHT=WEIGHT
-ParameterCode.SIZE_UNLI_CAT=SIZE_UNLI_CAT
-ParameterCode.SIZE_UE_CAT=SIZE_UE_CAT
-ParameterCode.CASE=CASE
-ParameterCode.SORTING_TYPE=SORTING_TYPE
-ParameterCode.PRESERVATION=PRESERVATION
-ParameterCode.DRESSING=DRESSING
-ParameterCode.AGE=AGE
-ParameterCode.LENGTH_TOTAL=LENGTH_TOTAL
-ParameterCode.LONG_CARAPACE=LONG_CARAPACE
-ParameterCode.LENGTH_PREANAL=LENGTH_PREANAL
-ParameterCode.LENGTH=LENGTH
-ParameterCode.LENGTH_CARAPACE=LENGTH_CARAPACE
-ParameterCode.LENGTH_FORK=LENGTH_FORK
-ParameterCode.LENGTH_LM_FORK=LENGTH_LM_FORK
-ParameterCode.LENGTH_MANTLE=LENGTH_MANTLE
-ParameterCode.LENGTH_PELVIC=LENGTH_PELVIC
-ParameterCode.LENGTH_PRE_SUPRA_CAUDAL=LENGTH_PRE_SUPRA_CAUDAL
-ParameterCode.LENGTH_STANDARD=LENGTH_STANDARD
-ParameterCode.BEAM_LENGTH=BEAM_LENGTH
-ParameterCode.BEAM_TOTAL_LENGTH=BEAM_TOTAL_LENGTH
-ParameterCode.GEAR_TOTAL_LENGTH=GEAR_TOTAL_LENGTH
-ParameterCode.HEADLINE_LENGTH=HEADLINE_LENGTH
-ParameterCode.LBP=LBP
-ParameterCode.LG_ENGINS_PERDUS=LG_ENGINS_PERDUS
-ParameterCode.LG_RELEVEE=LG_RELEVEE
-ParameterCode.LOA=LOA
-ParameterCode.LONG=LONG
-ParameterCode.LONGLINE_LENGTH=LONGLINE_LENGTH
-ParameterCode.LONG_FORK=LONG_FORK
-ParameterCode.LONG_MANTLE=LONG_MANTLE
-ParameterCode.NET_LENGTH=NET_LENGTH
-ParameterCode.SEGMENT_LENGTH=SEGMENT_LENGTH
-ParameterCode.SEINE_LENGTH=SEINE_LENGTH
-ParameterCode.STD_CURVE_LENGTH=STD_CURVE_LENGTH
-ParameterCode.STD_STRAIGTH_LENGTH=STD_STRAIGTH_LENGTH
-ParameterCode.SWEEP_LENGTH=SWEEP_LENGTH
-ParameterCode.TOTAL_LENGTH_HAULED=TOTAL_LENGTH_HAULED
-ParameterCode.TOTAL_LENGTH_SOAKED=TOTAL_LENGTH_SOAKED
-ParameterCode.WARP_LENGTH=WARP_LENGTH
-ParameterCode.CIRCUMFERENCE=CIRCUMFERENCE
-ParameterCode.WIDTH=WIDTH
-ParameterGroupId.SURVEY_MEASUREMENT=21
-PmfmId.ALIVE_WEIGHT_CALCULATED=WEIGHT_CALCULATED;1;1;5
-PmfmId.CALCULATED_WEIGHT_CHILDREN_SUM=WEIGHT_CALCULATED;1;1;341
-PmfmId.WEIGHT_SIZE_CALCULATED=WEIGHT_CALCULATED;1;1;47
-PmfmId.WEIGHT_SIZE_EXTRAPOLATE=WEIGHT_CALCULATED;1;1;283
-PmfmId.WEIGHT_TOTAL_CALCULATED=WEIGHT_CALCULATED;1;1;22
-PmfmId.MAX_DURATION_FOR_OPERATION_WITH_GEAR=DUREE_MAX_OPERATION;17;1;1
-PmfmId.MAX_DISTANCE_FOR_OPERATION_WITH_GEAR=DISTANCE_MAX_OPERATION;17;1;1
-PmfmId.MAX_DURATION_FOR_OPERATION_WITH_METIER=DUREE_MAX_OPERATION;18;1;1
-PmfmId.MAX_DISTANCE_FOR_OPERATION_WITH_METIER=DISTANCE_MAX_OPERATION;18;1;1
-PmfmId.STORAGE_STATE=CLOSE_OBSVENTE_STOCK;61;61;21
-ProgramCode.ACTIVITY=SIH-ACTIFLOT
-ProgramCode.ACTIVITY_MERGE=SIH-ACTIFLOT-CONFLIT
-ProgramCode.DECLARATIVE_FLOW=SIH-ACTIPRED
-ProgramCode.PRE_RECOPESCA=SIH-preRECOPESCA
-ProgramCode.RECOPESCA=SIH-RECOPESCA
-ProgramCode.SIH_OBSERVED_FISHING_TRIP_ON_BOARD=SIH-OBSMER
-ProgramCode.SIH_OBSMER=SIH-OBSMER
-ProgramCode.SIH_STATPECHE_CONFLIT=SIH-ACTIFLOT-CONFLIT
-ProgramCode.STAT_PECHE=SIH-ACTIFLOT
-SaleDateControlByProgram.MAX_DAYS_AFTER_FISHING_TRIP=SIH-OBSMER|3,SIH-OBSVENTE|3
-BatchControl.SORTING_CRITERIA_PARAMETER_NEEDS_REFERENCE_WEIGHT=DRESSING,SIZE_UNLI_CAT,SEX
-BatchControl.CHILDREN_SUM_DIFFERENCE_BETWEEN_REFERENCE_AND_SIZE_WEIGHT_RULE1_THRESHOLD_PERCENT=SIH-OBSMER|50,SIH-OBSVENTE|50
-BatchControl.CHILDREN_SUM_DIFFERENCE_BETWEEN_REFERENCE_AND_SIZE_WEIGHT_RULE1_KILO_MIN=SIH-OBSMER|5,SIH-OBSVENTE|5
-BatchControl.CHILDREN_SUM_DIFFERENCE_BETWEEN_REFERENCE_AND_SIZE_WEIGHT_RULE2_THRESHOLD_PERCENT=SIH-OBSMER|100,SIH-OBSVENTE|100
-BatchControl.CHILDREN_SUM_DIFFERENCE_BETWEEN_REFERENCE_AND_SIZE_WEIGHT_RULE2_KILO_MAX=SIH-OBSMER|5,SIH-OBSVENTE|5
-ProgramManagedDataTypeMapping.FISHING_TRIP=SIH-OBSMER|5
-ProgramManagedDataTypeMapping.SALE=SIH-OBSVENTE|8
-ProgramObjectTypeMapping.FISHING_TRIP=SIH-OBSMER|OBSERVED_FISHING_TRIP
-ProgramObjectTypeMapping.SALE=SIH-OBSVENTE|OBSERVED_SALE
-ProgramPrivilegeId.MANAGER=1
-ProgramPrivilegeId.QUALIFICATOR=5
-ProgramPrivilegeId.RECORDER=2
-ProgramPrivilegeId.VALIDATOR=4
-ProgramPrivilegeId.VIEWER=3
-QualitativeValueId.ABNORMAL=328
-QualitativeValueId.ANOTHER_SURVEY_NO=847
-QualitativeValueId.ANOTHER_SURVEY_YES=846
-QualitativeValueId.DIRECT_SURVEY=965
-QualitativeValueId.DISCARD_TYPE_ANIMALS=407
-QualitativeValueId.ESTIMATE_SURVEY=967
-QualitativeValueId.FRY_STATUS=142
-QualitativeValueId.INDIRECT_SURVEY=966
-QualitativeValueId.INTEGRAL_PRESENTATION=139
-QualitativeValueId.IS_SAMPLING=415
-QualitativeValueId.LANDING=203
-QualitativeValueId.NON_SEXED_SEX=302
-QualitativeValueId.VALIDATION_PROGRAM_DO_CORRECTION=942
-QualitativeValueId.VALIDATION_SUPERVISOR_NO=418
-QualitativeValueId.VALIDATION_SUPERVISOR_YES=417
-QualitativeValueId.SORTING_TYPE_TPN=1746
-QualitativeValueId.SORTING_TYPE_TCC=1747
-QualitativeValueId.REJECTED=204
-QualitativeValueId.VRAC=311
-QualityFlagCode.BAD=4
-QualityFlagCode.CORRECTED=5
-QualityFlagCode.DOUBTFUL=3
-QualityFlagCode.GOOD=1
-QualityFlagCode.INCOMPLETE=8
-QualityFlagCode.MISSING=9
-QualityFlagCode.NOTQUALIFIED=0
-QualityFlagCode.OUT_OF_STAT=2
-QualityFlagConfiguration.COLOR_MAPPING=GOOD|0,128,0;DOUBTFUL|255,128,0;BAD|255,0,0;CORRECTED|0,128,255
-QualityFlagConfiguration.INVALID_FLAG_LIST=2,4,8,9
-SaleTypeId.COOPERATIVE=-5
-SaleTypeId.CRIEE=1
-SaleTypeId.HORS_CONTROLE=9
-SaleTypeId.MARCHE_EXTERIEUR=5
-SaleTypeId.MARCHE_INTERIEUR=4
-SaleTypeId.MAREYEUR=2
-SaleTypeId.POISSONNIER=-6
-SaleTypeId.PRODUCTEUR=6
-SaleTypeId.RESTAURATION_COLLECTIVE=-3
-SaleTypeId.RESTAURATION_PRIVEE=-2
-SaleTypeId.RETRAIT_OP=7
-SaleTypeId.RETRAIT_SANITAIRE=8
-SaleTypeId.SUPERMARCHE=-4
-SaleTypeId.TRANSFORMATEUR=3
-SaleTypeId.VENTE_PARTICULIER=-1
-SamplingSchemeControl.MANDATORY_PROGRAM_LIST=SIH-OBSVENTE
-SpatialItemTypeId.DEPTH_GRADIENT=1
-SpatialItemTypeId.DISTANCE_TO_COAST_GRADIENT=3
-SpatialItemTypeId.GEAR=5
-SpatialItemTypeId.METIER=7
-SpatialItemTypeId.NEARBY_SPECIFIC_AREA=2
-SpatialItemTypeId.TAXON_GROUP=4
-StatusCode.DELETED=3
-StatusCode.DISABLE=0
-StatusCode.ENABLE=1
-StatusCode.TEMPORARY=2
-StorageStateValues.CLOSED=69
-SurveyQualificationId.DIRECT=0
-SurveyQualificationId.ESTIMATION=0
-SurveyQualificationId.INDIRECT=0
-SurveyQualificationId.PREDOCUMENTATION=0
-SurveyQualificationId.UNKNOWN=0
-SynchronizationStatus.DELETED=DELETED
-SynchronizationStatus.DIRTY=DIRTY
-SynchronizationStatus.READY_TO_SYNCHRONIZE=READY_TO_SYNC
-SynchronizationStatus.SYNCHRONIZED=SYNC
-TaxonGroupId.FISH=1712
-TaxonGroupTypeCode.COMMERCIAL_SPECIES=2
-TaxonGroupTypeCode.METIER_SPECIES=3
-TaxonomicLevelCode.SPECIES=SPECIES
-TaxonomicLevelCode.VARIETY=SUBSPECIES
-TranscribingSideId.IN=2
-TranscribingSideId.IN_OUT=3
-TranscribingSideId.OUT=1
-TranscribingSystemId.FAO=4
-TranscribingSystemId.HARMONIE=5
-TranscribingSystemId.OFIMER=3
-TranscribingSystemId.SIPA=2
-UnitId.DAY=17
-UnitId.DECIMAL_HOURS=9
-UnitId.MILLIMETER=6
-UnitId.NONE=1
-UserProfilId.OBSERVER=2
-UserProfilId.PROJECT_MEMBER=3
-UserProfilId.REFERENTIAL_ADMINISTRATOR=1
-UserProfilId.USER=4
-VesselTypeId.FISHING_VESSEL=1
-VesselTypeId.FISHING_VESSEL_GROUP=2
-VesselTypeId.PLEASURE_BOAT=4
-VesselTypeId.SCIENTIFIC_RESEARCH_VESSEL=8
-VesselTypeId.SHELLFISH_GATHERER=3
-ZoneCompetenceMapping.GROUND=Corse|394;391,Guadeloupe|430,Guyanne|423,La Réunion|433,Martinique|425,Mayotte|424;429,Méditerranée|408;410;420;415;419;415;419,Mer du nord manche atlantique|386;387;388;389;390;392;393;395;396;397;398;399;400;401;402;403;404;405;406;407;409;411;412;414;416;417;418;421;422;432;435;436,Saint Pierre et Miquelon|434
-ZoneCompetenceMapping.SEA=Corse|4022,Guadeloupe|4020,Guyanne|4020,La Réunion|4028,Martinique|4020,Mayotte|4028,Méditerranée|4022,Mer du nord manche atlantique|4018,Saint Pierre et Miquelon|4017
-ZoneCompetenceMapping.DEFAULT_LOCATION_LEVEL=Corse|142,Guadeloupe|158;159,Guyanne|154;156,La Réunion|151;152,Martinique|158;159,Mayotte|,Méditerranée|142,Mer du nord manche atlantique|113;114,Saint Pierre et Miquelon|101
+#MatrixId.SUPPORT_WITH_GEAR=17
+#MatrixId.SUPPORT_WITH_METIER=18
+#LocationLevelId.RECTANGLE_STATISTIQUE_MED=145
-# 10/01/2012 BLA Need to retrieve a Location from a given position (Lat/Long)
-LocationLevelId.RECTANGLE_STATISTIQUE_MED=145
-
################################################################################
### Ajout pour Tutti ###########################################################
################################################################################
-# zone d'étude
-LocationLevelId.PROGRAM=301
-# strate
-LocationLevelId.STRATA=302
-# sous strate
-LocationLevelId.SUB_STRATA=303
-# localité
-LocationLevelId.LOCALITE=304
-# radiale
-LocationLevelId.RADIALE=305
+# zone d'étude SCIENTIFIC_CRUISE_PROGRAM
+#LocationLevelId.PROGRAM=301
+# strate SCIENTIFIC_CRUISE_STRATA
+#LocationLevelId.STRATA=302
+# sous strate SCIENTIFIC_CRUISE_SUB_STRATA
+#LocationLevelId.SUB_STRATA=303
+# localité SCIENTIFIC_CRUISE_LOCALITE
+#LocationLevelId.LOCALITE=304
+# radiale SCIENTIFIC_CRUISE_RADIALE
+#LocationLevelId.RADIALE=305
# Catégorie Sex
-PmfmId.SEX=196
+#PmfmId.SEX=196
QualitativeValueId.SEX_UNDEFINED=299
-QualitativeValueId.SEX_MALE=300
-QualitativeValueId.SEX_FEMALE=301
+#QualitativeValueId.SEX_MALE=300
+#QualitativeValueId.SEX_FEMALE=301
# Catégorie classe de tri
-PmfmId.SIZE_CATEGORY=198
-QualitativeValueId.SIZE_SMALL=307
-QualitativeValueId.SIZE_MEDIUM=306
-QualitativeValueId.SIZE_BIG=305
+#PmfmId.SIZE_CATEGORY=198
+#QualitativeValueId.SIZE_SMALL=307
+#QualitativeValueId.SIZE_MEDIUM=306
+#QualitativeValueId.SIZE_BIG=305
# Catégorie Age
-PmfmId.AGE=1430
+#PmfmId.AGE=1430
# Catégorie maturité
-PmfmId.MATURITY=174
+#PmfmId.MATURITY=174
QualitativeValueId.MATURITY_1=272
QualitativeValueId.MATURITY_2=273
QualitativeValueId.MATURITY_3=274
@@ -338,44 +64,44 @@
QualitativeValueId.MATURITY_5=276
# Catégorie macro-déchet
-PmfmId.MARINE_LITTER_TYPE=1421
+#PmfmId.MARINE_LITTER_TYPE=1421
# Classe de taille macro-déchet
-PmfmId.MARINE_LITTER_SIZE_CATEGORY=1422
+#PmfmId.MARINE_LITTER_SIZE_CATEGORY=1422
# Pour stocker Cruise.surveyPart
-PmfmId.SURVEY_PART=1432
+#PmfmId.SURVEY_PART=1432
-PmfmId.STATION_NUMBER=1243
-PmfmId.TRAWL_DISTANCE=113
+#PmfmId.STATION_NUMBER=1243
+#PmfmId.TRAWL_DISTANCE=113
-PmfmId.HAUL_VALID=1163
-QualitativeValueId.HAUL_VALID_YES=1575
-QualitativeValueId.HAUL_VALID_NO=1576
+#PmfmId.HAUL_VALID=1163
+#QualitativeValueId.HAUL_VALID_YES=1575
+#QualitativeValueId.HAUL_VALID_NO=1576
-PmfmId.RECTILINEAR_OPERATION=192
-QualitativeValueId.RECTILINEAR_OPERATION_YES=277
-QualitativeValueId.RECTILINEAR_OPERATION_NO=278
+#PmfmId.RECTILINEAR_OPERATION=192
+#QualitativeValueId.RECTILINEAR_OPERATION_YES=277
+#QualitativeValueId.RECTILINEAR_OPERATION_NO=278
# PSFM "Nombre de poche" d'un chalut (écran campagne)
-PmfmId.MULTIRIG_NUMBER=1420
+#PmfmId.MULTIRIG_NUMBER=1420
# PSFM "Liste des poches observées" (écran opération)
-PmfmId.MULTIRIG_AGGREGATION=1424
+#PmfmId.MULTIRIG_AGGREGATION=1424
# PSFM "Poids - observation par une observateur" (écran captures, onglet espèce, benthos, etc)
-PmfmId.WEIGHT_MEASURED=220
+#PmfmId.WEIGHT_MEASURED=220
# PSFM "Vrac/Hors Vrac" - "Organisation des données campagnes"
-PmfmId.SORTED_UNSORTED=1428
-QualitativeValueId.SORTED_VRAC=311
-QualitativeValueId.SORTED_HORS_VRAC=310
-QualitativeValueId.UNSORTED=2146
+#PmfmId.SORTED_UNSORTED=1428
+#QualitativeValueId.SORTED_VRAC=311
+#QualitativeValueId.SORTED_HORS_VRAC=310
+#QualitativeValueId.UNSORTED=2146
-PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE=1429
-QualitativeValueId.SORTING_TYPE_SPECIES=2147
-QualitativeValueId.SORTING_TYPE_BENTHOS=2148
-QualitativeValueId.SORTING_TYPE_PLANCTON=2149
-QualitativeValueId.SORTING_TYPE_MARINE_LITTER=2150
-QualitativeValueId.SORTING_TYPE_ACCIDENTAL_CATCH=2151
+#PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE=1429
+#QualitativeValueId.SORTING_TYPE_SPECIES=2147
+#QualitativeValueId.SORTING_TYPE_BENTHOS=2148
+#QualitativeValueId.SORTING_TYPE_PLANCTON=2149
+#QualitativeValueId.SORTING_TYPE_MARINE_LITTER=2150
+#QualitativeValueId.SORTING_TYPE_ACCIDENTAL_CATCH=2151
PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE_2=1431
QualitativeValueId.SORTING_TYPE_2_ALIVE_NOT_ITEMIZED=2161
@@ -383,14 +109,14 @@
QualitativeValueId.SORTING_TYPE_2_ALIVE_ITEMIZED=2160
# PSFM "Ouverture verticale (chalut ou drague)" (pour export operation)
-PmfmId.VERTICAL_OPENING=832
+#PmfmId.VERTICAL_OPENING=832
# PSFM "Ouverture Horizontale aux pointes d'ailes" (pour export operation)
-PmfmId.HORIZONTAL_OPENING_WING=827
+#PmfmId.HORIZONTAL_OPENING_WING=827
# PSFM "Ouverture horizontale aux panneaux" (pour export operation)
-PmfmId.HORIZONTAL_OPENING_DOOR=830
+#PmfmId.HORIZONTAL_OPENING_DOOR=830
#PSFM "Remis à l'eau mort ou vivant"
-PmfmId.DEAD_OR_ALIVE=1393
+#PmfmId.DEAD_OR_ALIVE=1393
# PSFM "Pour référencer un autre id de pmfm"
PmfmId.ID_PSFM=1433
@@ -400,24 +126,24 @@
PmfmId.OTOLITHE_ID=1436
# (20=observateur volant, 95=Administrateur SIH) -> L'avantage du 20 est qu'il est inactif (=20), donc plus facilement detectable
-PersonId.UNKNOWN_RECORDER_PERSON=20
+#PersonId.UNKNOWN_RECORDER_PERSON=20
UserProfilId.DEPARTEMENT_PREFIX=PDG-
# 181=PDG-RBE (à confirmer par Vincent)
-DepartmentId.UNKNOWN_RECORDER_DEPARTMENT=181
+#DepartmentId.UNKNOWN_RECORDER_DEPARTMENT=181
-ProgramCode.SCIENTIFIC_CRUISE_PREFIX=CAM-
+#ProgramCode.SCIENTIFIC_CRUISE_PREFIX=CAM-
-ObjectTypeCode.SCIENTIFIC_CRUISE=SCIENTIFIC_CRUISE
-ObjectTypeCode.OPERATION=OPERATION
+#ObjectTypeCode.SCIENTIFIC_CRUISE=SCIENTIFIC_CRUISE
+#ObjectTypeCode.OPERATION=OPERATION
ObjectTypeCode.CATCH_BATCH=CATCH_BATCH
-ObjectTypeCode.BATCH=BATCH
-ObjectTypeCode.SAMPLE=SAMPLE
+#ObjectTypeCode.BATCH=BATCH
+#ObjectTypeCode.SAMPLE=SAMPLE
-VesselPersonRoleId.SCIENTIFIC_CRUISE_MANAGER=2
-VesselPersonRoleId.SORT_ROOM_MANAGER=3
-VesselPersonRoleId.RECORDER_PERSON=4
+#VesselPersonRoleId.SCIENTIFIC_CRUISE_MANAGER=2
+#VesselPersonRoleId.SORT_ROOM_MANAGER=3
+#VesselPersonRoleId.RECORDER_PERSON=4
TranscribingTypeId.TAXINOMIE_REFTAX_MNEMONIQUE=55
TranscribingTypeId.TAXINOMIE_COMMUN_NOM_VERNACULAIRE=56
Modified: trunk/tutti-persistence/src/main/resources/tuttiBeanRefFactory.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/tuttiBeanRefFactory.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/main/resources/tuttiBeanRefFactory.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -29,14 +29,12 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
- <import resource="classpath*:applicationContext-conf.xml"/>
-
<bean id="TuttiBeanRefFactory"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
- <value>classpath:applicationContext-conf.xml</value>
- <value>classpath:applicationContext-dataSource-${dataSource.type}.xml</value>
+ <value>classpath:applicationContext-conf-tutti.xml</value>
+ <value>classpath:applicationContext-dataSource-local.xml</value>
<value>classpath:applicationContext-entities.xml</value>
<value>classpath:applicationContext-service.xml</value>
<value>classpath:applicationContext-service-tutti.xml</value>
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -75,7 +75,7 @@
long buildTime = System.nanoTime();
attachment.setName("AttachmentName-" + buildTime);
attachment.setComment("AttachmentComment-" + buildTime);
- File fileToAttach = dbResource.getConfig().getDbConfigurationPath();
+ File fileToAttach = dbResource.getConfig().getConfigFile();
Attachment savedAttachment = service.createAttachment(attachment, fileToAttach);
assertAttachment(attachment, savedAttachment);
Modified: trunk/tutti-persistence/src/test/resources/beanRefFactoryWitNoDb.xml
===================================================================
--- trunk/tutti-persistence/src/test/resources/beanRefFactoryWitNoDb.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-persistence/src/test/resources/beanRefFactoryWitNoDb.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -33,7 +33,7 @@
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
- <value>applicationContext-conf.xml</value>
+ <value>classpath:applicationContext-conf-tutti.xml</value>
<value>applicationContext-service-resources.xml</value>
</list>
</constructor-arg>
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -220,6 +220,11 @@
driver.sanityDb();
}
+ @Override
+ public void clearCache(String cacheName) {
+ driver.clearCache(cacheName);
+ }
+
public static final DateFormat EXPORT_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
public static final String EXPORT_DIRECTORY_FORMAT = "tutti-%s-%s";
@@ -857,8 +862,8 @@
}
@Override
- public Caracteristic getHorizontalOpeningWingCaracteristic() {
- return driver.getHorizontalOpeningWingCaracteristic();
+ public Caracteristic getHorizontalOpeningWingsCaracteristic() {
+ return driver.getHorizontalOpeningWingsCaracteristic();
}
@Override
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -29,13 +29,12 @@
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.opensymphony.xwork2.util.ValueStack;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.validator.xwork2.XWork2ValidatorUtil;
import java.io.Closeable;
@@ -65,19 +64,14 @@
protected final TuttiDataContext dataContext;
- protected final RessourceClassLoader resourceLoader;
-
protected final LoadingCache<Class<? extends TuttiService>, TuttiService> services;
- public TuttiServiceContext(RessourceClassLoader resourceLoader,
- TuttiConfiguration config) {
- this(resourceLoader, config, new TuttiDataContext());
+ public TuttiServiceContext(TuttiConfiguration config) {
+ this(config, new TuttiDataContext());
}
- public TuttiServiceContext(RessourceClassLoader resourceLoader,
- TuttiConfiguration config,
+ public TuttiServiceContext(TuttiConfiguration config,
TuttiDataContext dataContext) {
- this.resourceLoader = resourceLoader;
this.config = config;
this.dataContext = dataContext;
// add datacontext in shared valueStack
@@ -103,10 +97,6 @@
return config;
}
- public RessourceClassLoader getResourceLoader() {
- return resourceLoader;
- }
-
public TuttiDataContext getDataContext() {
return dataContext;
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/TuttiExportService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -115,7 +115,7 @@
weightComputingService = getService(WeightComputingService.class);
verticalOpeningCaracteristic = persistenceService.getVerticalOpeningCaracteristic();
- horizontalOpeningWingCaracteristic = persistenceService.getHorizontalOpeningWingCaracteristic();
+ horizontalOpeningWingCaracteristic = persistenceService.getHorizontalOpeningWingsCaracteristic();
horizontalOpeningDoorCaracteristic = persistenceService.getHorizontalOpeningDoorCaracteristic();
weightMeasuredCaracteristic = persistenceService.getWeightMeasuredCaracteristic();
pmfmIdCaracteristic = persistenceService.getPmfmIdCaracteristic();
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialSynchronizeService.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -24,17 +24,16 @@
* #L%
*/
+import com.google.common.collect.ImmutableSet;
+import fr.ifremer.adagio.core.service.technical.synchro.ReferentialSynchroContext;
import fr.ifremer.adagio.core.service.technical.synchro.ReferentialSynchroResult;
import fr.ifremer.adagio.core.service.technical.synchro.ReferentialSynchroService;
-import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import fr.ifremer.tutti.service.AbstractTuttiService;
-import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiServiceContext;
import java.io.File;
-import java.util.Properties;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -42,40 +41,138 @@
*/
public class TuttiReferentialSynchronizeService extends AbstractTuttiService {
- protected PersistenceService persistenceService;
-
protected ReferentialSynchroService synchroService;
+ protected static Set<String> TABLE_NAMES = ImmutableSet.<String>builder().add(
+ "STATUS",
+ "QUALITY_FLAG",
+
+ // PMFM
+ "UNIT",
+ "AGGREGATION_LEVEL",
+ "PARAMETER_GROUP",
+ "QUALITATIVE_VALUE",
+ "PARAMETER",
+ "MATRIX",
+ "FRACTION",
+ "FRACTION2MATRIX",
+ "METHOD",
+ "PMFM",
+ "PMFM2QUALITATIVE_VALUE",
+
+ // GEAR
+ "GEAR_CLASSIFICATION",
+ "GEAR_CLASSIFICATION_ASSOCIATIO",
+ "GEAR",
+ "GEAR_ASSOCIATION",
+
+ // LOCATION
+ "LOCATION_CLASSIFICATION",
+ "LOCATION_LEVEL",
+ "LOCATION_ASSOCIATION",
+ "LOCATION",
+ "LOCATION_HIERARCHY",
+ "LOCATION_HIERARCHY_EXCEPTION",
+
+ // TAXON
+ "TAXONOMIC_LEVEL",
+ "REFERENCE_TAXON",
+ "TAXON_NAME",
+ "TAXON_INFORMATION",
+ "TAXON_INFORMATION_HISTORY",
+ "VIRTUAL_COMPONENT",
+ "TAXON_NAME_HISTORY",
+ "REFERENCE_DOCUMENT",
+ "AUTHOR",
+ "CITATION",
+
+ // TAXON GROUP
+ "TAXON_GROUP_TYPE",
+ "TAXON_GROUP",
+ "TAXON_GROUP_HISTORICAL_RECORD",
+ "TAXON_GROUP_INFORMATION",
+
+ // TRANSCRIBING
+ "TRANSCRIBING_ITEM",
+ "TRANSCRIBING_ITEM_TYPE",
+ "TRANSCRIBING_SIDE",
+ "TRANSCRIBING_SYSTEM",
+
+ // CONVERSION
+ "ROUND_WEIGHT_CONVERSION",
+ "WEIGHT_LENGTH_CONVERSION",
+ "UNIT_CONVERSION",
+
+ // VESSEL
+ "VESSEL_TYPE",
+ "VESSEL_REGISTRATION_PERIOD",
+ "VESSEL_FEATURES",
+ "VESSEL",
+
+ // PERSON
+ "USER_PROFIL",
+ "DEPARTMENT",
+ "PERSON",
+ "PERSON2USER_PROFIL",
+
+ // VESSEL_PERSON_ROLE
+ "VESSEL_PERSON_ROLE",
+ "VESSEL_PERSON",
+
+ // ORDER
+ "ORDER_ITEM",
+
+ // PROGRAM (since 3.3.5)
+ "PROGRAM",
+ "PROGRAM2LOCATION",
+ "PROGRAM2LOCATION_CLASSIF",
+
+ // STRATEGY (since 3.5)
+ "ACQUISITION_LEVEL",
+ "PROGRAM_PRIVILEGE",
+ "PROGRAM2DEPARTMENT",
+ "PROGRAM2PERSON_EXCEPTION",
+ "PROGRAM2PERSON",
+ "STRATEGY",
+ "STRATEGY2MANAGER_PERSON",
+ "PMFM_APPLIED_STRATEGY",
+ "APPLIED_STRATEGY",
+ "PMFM_STRATEGY",
+ "REFERENCE_TAXON_STRATEGY",
+ "STRATEGY2GEAR",
+ // FIXME-tchemit-2014-04-19 This table fails to update
+ //"APPLIED_PERIOD",
+
+ // OTHER
+ "PRECISION_TYPE",
+ "NUMERICAL_PRECISION",
+ "PHOTO_TYPE",
+ "OBJECT_TYPE",
+ "ORDER_TYPE",
+ "ANALYSIS_INSTRUMENT"
+ ).build();
+
@Override
public void setServiceContext(TuttiServiceContext context) {
super.setServiceContext(context);
synchroService = TuttiPersistenceServiceLocator.getReferentialSynchroService();
- persistenceService = getService(PersistenceService.class);
}
- public void prepare(File dbDirectory, ReferentialSynchroResult result) {
- Properties remoteConnectionProperties = getRemoteProperties(dbDirectory);
- synchroService.prepare(remoteConnectionProperties, result);
+ public ReferentialSynchroContext createSynchroContext(File dbDirectory) {
+ ReferentialSynchroContext synchroContext = ReferentialSynchroContext.newContext(
+ TABLE_NAMES,
+ dbDirectory,
+ new ReferentialSynchroResult()
+ );
+ return synchroContext;
}
- public void synchronize(File dbDirectory,
- ReferentialSynchroResult result) {
- Properties remoteConnectionProperties = getRemoteProperties(dbDirectory);
- synchroService.synchronize(remoteConnectionProperties, result);
+ public void prepare(ReferentialSynchroContext synchroContext) {
+ synchroService.prepare(synchroContext);
}
- protected Properties getRemoteProperties(File dbDirectory) {
- Properties remoteConnectionProperties = new Properties();
- TuttiConfiguration config = context.getConfig();
-
- String jdbcUrl = TuttiEntities.getJdbcUrl(dbDirectory,
- config.getDbName());
-
- TuttiEntities.fillConnectionProperties(remoteConnectionProperties,
- jdbcUrl,
- config.getJdbcUsername(),
- config.getJdbcPassword());
- return remoteConnectionProperties;
+ public void synchronize(ReferentialSynchroContext synchroContext) {
+ synchroService.synchronize(synchroContext);
}
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -53,9 +53,11 @@
protected TuttiServiceContext serviceContext;
- protected abstract TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiConfiguration config);
+// protected abstract TuttiServiceContext createServiceContext(RessourceClassLoader loader,
+// TuttiConfiguration config);
+ protected abstract TuttiServiceContext createServiceContext(TuttiConfiguration config);
+
@Before
public void setUp() throws Exception {
@@ -74,12 +76,12 @@
datadirectory.getAbsolutePath());
applicationConfig.parse();
- RessourceClassLoader loader =
- new RessourceClassLoader(getClass().getClassLoader());
+// RessourceClassLoader loader = new RessourceClassLoader(getClass().getClassLoader());
TuttiConfiguration config = new TuttiConfiguration(applicationConfig);
- serviceContext = createServiceContext(loader, config);
+// serviceContext = createServiceContext(loader, config);
+ serviceContext = createServiceContext(config);
ConverterUtil.deregister();
ConverterUtil.initConverters();
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -27,7 +27,6 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.LabelAware;
import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Attachments;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -75,9 +74,13 @@
private DecoratorService service;
+ // @Override
+// protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiConfiguration config) {
+// return new TuttiServiceContext(loader, config);
+// }
@Override
- protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiConfiguration config) {
- return new TuttiServiceContext(loader, config);
+ protected TuttiServiceContext createServiceContext(TuttiConfiguration config) {
+ return new TuttiServiceContext(config);
}
@Before
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ServiceDbResource.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -27,10 +27,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import org.nuiton.jaxx.application.ApplicationIOUtil;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.TuttiConfigurationOption;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -49,6 +47,7 @@
import org.junit.runner.Description;
import org.nuiton.config.ApplicationConfig;
import org.nuiton.i18n.I18n;
+import org.nuiton.jaxx.application.ApplicationIOUtil;
import java.io.File;
import java.io.IOException;
@@ -117,9 +116,10 @@
}
}
- protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiConfiguration config) {
- return new TuttiServiceContext(loader, config) {
+ // protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
+ protected TuttiServiceContext createServiceContext(TuttiConfiguration config) {
+// return new TuttiServiceContext(loader, config) {
+ return new TuttiServiceContext(config) {
Map<Class<?>, Integer> counts = Maps.newHashMap();
@@ -139,11 +139,11 @@
@Override
public void prepareConfig(ApplicationConfig applicationConfig,
File resourceDirectory) {
- applicationConfig.loadDefaultOptions(
- TuttiConfigurationOption.values());
+ TuttiConfiguration.getDefaultApplicationConfig(applicationConfig);
+
applicationConfig.setDefaultOption(
- "tutti.basedir",
+ TuttiConfigurationOption.BASEDIR.getKey(),
resourceDirectory.getAbsolutePath());
}
@@ -204,7 +204,8 @@
protected void before(Description description) throws Throwable {
super.before(description);
- serviceContext = createServiceContext(loader, getConfig());
+// serviceContext = createServiceContext(loader, getConfig());
+ serviceContext = createServiceContext(getConfig());
I18n.init(null, Locale.FRANCE);
serviceContext.getConfig().setCsvSeparator(';');
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -26,7 +26,6 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.TuttiConfiguration;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Cruises;
import fr.ifremer.tutti.persistence.entities.data.Program;
@@ -59,11 +58,16 @@
private TuttiDataContextFake dataContext;
@Override
- protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
- TuttiConfiguration config) {
- return new TuttiServiceContext(loader, config, dataContext = new TuttiDataContextFake());
+ protected TuttiServiceContext createServiceContext(TuttiConfiguration config) {
+ return new TuttiServiceContext(config, dataContext = new TuttiDataContextFake());
}
+// @Override
+// protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
+// TuttiConfiguration config) {
+// return new TuttiServiceContext(loader, config, dataContext = new TuttiDataContextFake());
+// }
+
@Before
public void setUp() throws Exception {
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/pom.xml 2014-04-21 13:27:20 UTC (rev 1718)
@@ -207,6 +207,33 @@
<artifactId>swingx-autocomplete</artifactId>
</dependency>
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -263,6 +290,15 @@
</goals>
</execution>
</executions>
+ <!-- Can't remove this, AdagionConfiguration expose it -->
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${springVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
</plugin>
<plugin>
Modified: trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/src/license/THIRD-PARTY.properties 2014-04-21 13:27:20 UTC (rev 1718)
@@ -1,15 +1,24 @@
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
#-------------------------------------------------------------------------------
# Already used licenses in project :
+# - AL 2.0
# - Affero General Public License (AGPL)
# - Apache License
+# - Apache License 2.0
+# - Apache License Version 2.0
+# - Apache License, version 2.0
# - BSD License
# - BSD-style license
+# - Common Development and Distribution License
# - Common Development and Distribution License (CDDL) v1.0
# - Common Public License Version 1.0
+# - Eclipse Distribution License (EDL), Version 1.0
+# - Eclipse Public License (EPL), Version 1.0
# - Eclipse Public License - v 1.0
# - GNU Affero General Public License v3
+# - GNU General Public License (GPL)
# - GNU General Public License - Version 2 with the class path exception
+# - GNU General Public License, Version 2 with the Classpath Exception
# - GNU Lesser General Public License (LGPL), version 2.1
# - GNU Library or Lesser General Public License
# - General Public License (GPL)
@@ -25,13 +34,12 @@
# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
-# - license.txt
+# - WTFPL
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Wed Jan 15 09:38:43 CET 2014
-antlr--antlr--2.7.6=BSD License
+#Mon Apr 21 10:43:33 CEST 2014
batik--batik-awt-util--1.6=The Apache Software License, Version 2.0
batik--batik-bridge--1.6=The Apache Software License, Version 2.0
batik--batik-css--1.6=The Apache Software License, Version 2.0
@@ -47,4 +55,4 @@
batik--batik-xml--1.6=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
-javax.transaction--jta--1.1=Common Development and Distribution License (CDDL) v1.0
+javassist--javassist--3.11.0.GA=The Apache Software License, Version 2.0
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiApplicationUpdaterCallBack.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -27,15 +27,15 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import org.nuiton.jaxx.application.ApplicationIOUtil;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
-import org.nuiton.jaxx.application.swing.action.ApplicationActionException;
import fr.ifremer.tutti.LabelAware;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.ui.swing.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationIOUtil;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
+import org.nuiton.jaxx.application.swing.action.ApplicationActionException;
import org.nuiton.updater.ApplicationInfo;
import org.nuiton.updater.ApplicationUpdaterCallback;
@@ -43,8 +43,8 @@
import java.util.List;
import java.util.Map;
-import static org.nuiton.i18n.I18n.t;
import static org.nuiton.i18n.I18n.n;
+import static org.nuiton.i18n.I18n.t;
/**
* CallBack to update jre, application, i18n.
@@ -203,20 +203,6 @@
TuttiConfiguration config = context.getConfig();
- // must remove the enumeration file at exit
- File enumerationPath = config.getDbEnumerationPath();
- ApplicationIOUtil.forceDeleteOnExit(
- enumerationPath,
- t("tutti.applicationUpdater.updateDone.deleteDirectory.enum.error", enumerationPath)
- );
-
- // must remove the db conf file at exit
- File dbConfPath = config.getDbConfigurationPath();
- ApplicationIOUtil.forceDeleteOnExit(
- dbConfPath,
- t("tutti.applicationUpdater.updateDone.deleteDirectory.dbConf.error", dbConfPath)
- );
-
//FIXME-check this is necessary: i18n is no more generated ?
// must also remove i18n directory
File i18nDirectory = context.getConfig().getI18nDirectory();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDbUpdaterCallBack.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -26,10 +26,8 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
+import fr.ifremer.adagio.core.service.technical.synchro.ReferentialSynchroContext;
import fr.ifremer.adagio.core.service.technical.synchro.ReferentialSynchroResult;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
-import org.nuiton.jaxx.application.swing.action.ApplicationActionException;
-import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
@@ -40,16 +38,22 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
+import org.nuiton.jaxx.application.swing.action.ApplicationActionException;
+import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
+import org.nuiton.jaxx.application.type.ApplicationProgressionModel;
import org.nuiton.updater.ApplicationInfo;
import org.nuiton.updater.ApplicationUpdater;
import org.nuiton.updater.ApplicationUpdaterCallback;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.util.Map;
+import static org.nuiton.i18n.I18n.n;
import static org.nuiton.i18n.I18n.t;
-import static org.nuiton.i18n.I18n.n;
/**
* CallBack to update db.
@@ -166,12 +170,12 @@
info.oldVersion, info.newVersion));
}
- // before install or update, regenerate db configuration files
+// // before install or update, regenerate db configuration files
+//
+// TuttiConfiguration configuration = regenerateDbConf();
+//
+// configuration.generateExternalDbFiles(true);
- TuttiConfiguration configuration = regenerateDbConf();
-
- configuration.generateExternalDbFiles(true);
-
if (dbInstalled) {
// first database, just copy it to correct directory
@@ -237,18 +241,21 @@
log.info(String.format("A database update was downloaded (oldVersion: %s, newVersion: %s), will launch a referential synchronize operation ", info.oldVersion, info.newVersion));
}
TuttiReferentialSynchronizeService service = context.getTuttiReferentialSynchronizeService();
- ReferentialSynchroResult result = new ReferentialSynchroResult();
+
File dbDirectory = getDbDirectory(info);
+ ReferentialSynchroContext synchroContext = service.createSynchroContext(dbDirectory);
+ ReferentialSynchroResult result = synchroContext.getResult();
+
ApplicationActionUI actionUI = context.getActionUI();
- actionUI.getModel().setProgressionModel(result.getProgressionModel());
- service.prepare(dbDirectory, result);
+ actionUI.getModel().setProgressionModel(new DelegateProgressionModel(result.getProgressionModel()));
+ service.prepare(synchroContext);
if (!result.isSuccess()) {
throw new ApplicationTechnicalException(t("tutti.applicationUpdater.synchroDB.prepare.error"), result.getError());
}
- service.synchronize(dbDirectory, result);
+ service.synchronize(synchroContext);
if (!result.isSuccess()) {
throw new ApplicationTechnicalException(t("tutti.applicationUpdater.synchroDB.synchro.error"), result.getError());
@@ -283,4 +290,78 @@
t("tutti.applicationUpdater.synchroDB.writeVersion.error", versionFile));
}
}
+
+ private static class DelegateProgressionModel extends ApplicationProgressionModel {
+
+ private static final long serialVersionUID = 1L;
+
+ private final fr.ifremer.adagio.core.type.ProgressionModel progressionModel;
+
+ public DelegateProgressionModel(fr.ifremer.adagio.core.type.ProgressionModel progressionModel) {
+
+ this.progressionModel = progressionModel;
+ this.progressionModel.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
+ }
+ });
+ }
+
+ @Override
+ public void setMessage(String message) {
+ progressionModel.setMessage(message);
+ }
+
+ @Override
+ public void increments(String message) {
+ progressionModel.increments(message);
+ }
+
+ @Override
+ public String getMessage() {
+ return progressionModel.getMessage();
+ }
+
+ @Override
+ public void setRate(float rate) {
+ progressionModel.setRate(rate);
+ }
+
+ @Override
+ public float getRate() {
+ return progressionModel.getRate();
+ }
+
+ @Override
+ public void increments(int nb) {
+ progressionModel.increments(nb);
+ }
+
+ @Override
+ public void setCurrent(int current) {
+ progressionModel.setCurrent(current);
+ }
+
+ @Override
+ public int getCurrent() {
+ return progressionModel.getCurrent();
+ }
+
+ @Override
+ public void adaptTotal(int total) {
+ progressionModel.adaptTotal(total);
+ }
+
+ @Override
+ public void setTotal(int total) {
+ progressionModel.setTotal(total);
+ }
+
+ @Override
+ public int getTotal() {
+ return progressionModel.getTotal();
+ }
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -29,7 +29,6 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.TuttiConfiguration;
import fr.ifremer.tutti.ichtyometer.feed.FeedReader;
-import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.service.ClosedPersistenceService;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
@@ -165,13 +164,6 @@
protected final TuttiConfiguration config;
/**
- * ClassLoader ressource.
- *
- * @since 0.3
- */
- protected final RessourceClassLoader resourceLoader;
-
- /**
* Service context used by any service.
*
* @since 0.1
@@ -330,8 +322,7 @@
protected TuttiUIContext(TuttiConfiguration config) {
this.config = config;
- this.resourceLoader = new RessourceClassLoader(Thread.currentThread().getContextClassLoader());
- this.serviceContext = new TuttiServiceContext(resourceLoader, config);
+ this.serviceContext = new TuttiServiceContext(config);
Map<Class, State> additionalStates = Maps.newHashMap();
additionalStates.put(BeanFilterableComboBox.class, new BeanFilterableComboBoxState());
@@ -405,9 +396,6 @@
config.prepareDirectories();
- // use our special classLoader (which will read some files from resources from a configuration directory)
- Thread.currentThread().setContextClassLoader(getResourceLoader());
-
// converters are stored in current classloader, we need then to rescan them
// each time we change current classloader
ConverterUtil.deregister();
@@ -428,7 +416,7 @@
// init db configuration
//--------------------------------------------------------------------//
- config.initConfig(getResourceLoader());
+ config.initConfig();
// // clean db cache (avoid a lots of headache :(
// File cacheDirectory = config.getServiceConfig().getPersistenceConfig().getCacheDirectory();
@@ -469,7 +457,7 @@
i18nLocale, i18nDirectory));
}
I18n.init(new UserI18nInitializer(
- i18nDirectory, new DefaultI18nInitializer("tutti-i18n")),
+ i18nDirectory, new DefaultI18nInitializer("tutti-i18n")),
i18nLocale);
@@ -950,10 +938,6 @@
}
}
- public RessourceClassLoader getResourceLoader() {
- return resourceLoader;
- }
-
//------------------------------------------------------------------------//
//-- Help methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2014-04-21 05:40:03 UTC (rev 1717)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/config/TuttiConfigUIHandler.java 2014-04-21 13:27:20 UTC (rev 1718)
@@ -241,12 +241,12 @@
.addOption(TuttiConfigurationOption.DB_CACHE_DIRECTORY)
.setOptionShortLabel(t("tutti.config.option.persistence.db.cache.directory.shortLabel"))
- .addOption(TuttiConfigurationOption.DB_CONFIGURATION_PATH)
- .setOptionShortLabel(t("tutti.config.option.persistence.db.configurationPath.shortLabel"))
+// .addOption(TuttiConfigurationOption.DB_CONFIGURATION_PATH)
+// .setOptionShortLabel(t("tutti.config.option.persistence.db.configurationPath.shortLabel"))
+//
+// .addOption(TuttiConfigurationOption.DB_ENUMERATION_PATH)
+// .setOptionShortLabel(t("tutti.config.option.persistence.db.enumerationPath.shortLabel"))
- .addOption(TuttiConfigurationOption.DB_ENUMERATION_PATH)
- .setOptionShortLabel(t("tutti.config.option.persistence.db.enumerationPath.shortLabel"))
-
.addOption(TuttiConfigurationOption.JDBC_URL)
.setOptionShortLabel(t("tutti.config.option.persistence.jdbc.url.shortLabel"))
1
0
21 Apr '14
Author: tchemit
Date: 2014-04-21 07:40:03 +0200 (Mon, 21 Apr 2014)
New Revision: 1717
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1717
Log:
refs #4959 : refactor batch model + improve tuttipersistence design
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CaracteristicQualitativeValues.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchTreeHelper.java
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/sanity/DatabaseSanityServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/IndividualObservationBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MeasurementPersistenceHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SamplePersistenceHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/UpdateSchemaTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
trunk/tutti-ui-swing/src/main/filtered-resources/log4j.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/sanity/DatabaseSanityServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/sanity/DatabaseSanityServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/sanity/DatabaseSanityServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -29,7 +29,6 @@
import fr.ifremer.adagio.core.service.technical.sanity.task.DatabaseSanityTask;
import org.hibernate.SessionFactory;
import org.hibernate.classic.Session;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -50,7 +49,7 @@
/**
* Session factory.
*/
- @Autowired
+ @Resource
protected SessionFactory sessionFactory;
/**
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/adagio/core/service/technical/synchro/ReferentialSynchroServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -38,12 +38,12 @@
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.tool.hbm2ddl.ColumnMetadata;
import org.nuiton.util.TimeLog;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.support.JdbcUtils;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
@@ -76,10 +76,10 @@
private static final TimeLog TIME =
new TimeLog(ReferentialSynchroServiceImpl.class);
- @Autowired
+ @Resource
protected DriverManagerDataSource dataSource;
- @Autowired
+ @Resource
protected SessionFactory sessionFactory;
protected Dialect localDialect;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -24,43 +24,21 @@
* #L%
*/
-import com.google.common.base.Predicate;
-import com.google.common.collect.Multimap;
-import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
-import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
-import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatch;
-import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.IndividualObservationBatch;
-import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
-import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
-import fr.ifremer.tutti.persistence.entities.referential.TuttiReferentialEntity;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
-import org.nuiton.util.Version;
+import fr.ifremer.tutti.persistence.service.AccidentalBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.AttachmentPersistenceService;
+import fr.ifremer.tutti.persistence.service.BenthosBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.CatchBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.CruisePersistenceService;
+import fr.ifremer.tutti.persistence.service.FishingOperationPersistenceService;
+import fr.ifremer.tutti.persistence.service.IndividualObservationBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.MarineLitterBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.ProgramPersistenceService;
+import fr.ifremer.tutti.persistence.service.ProtocolPersistenceService;
+import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
+import fr.ifremer.tutti.persistence.service.SpeciesBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.TechnicalPersistenceService;
import org.springframework.transaction.annotation.Transactional;
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.Callable;
-
/**
* Contract for a persistence driver used by Tutti.
*
@@ -68,7 +46,20 @@
* @since 0.1
*/
@Transactional(readOnly = true)
-public interface TuttiPersistence extends TuttiPersistenceServiceImplementor {
+public interface TuttiPersistence extends TuttiPersistenceServiceImplementor,
+ TechnicalPersistenceService,
+ BenthosBatchPersistenceService,
+ SpeciesBatchPersistenceService,
+ ReferentialPersistenceService,
+ CatchBatchPersistenceService,
+ AttachmentPersistenceService,
+ ProgramPersistenceService,
+ CruisePersistenceService,
+ ProtocolPersistenceService,
+ FishingOperationPersistenceService,
+ MarineLitterBatchPersistenceService,
+ AccidentalBatchPersistenceService,
+ IndividualObservationBatchPersistenceService {
//------------------------------------------------------------------------//
//-- Technical methods --//
@@ -76,658 +67,658 @@
String getImplementationName();
- /**
- * To clear all caches.
- *
- * @since 1.0.1
- */
- void clearAllCaches();
+// /**
+// * To clear all caches.
+// *
+// * @since 1.0.1
+// */
+// void clearAllCaches();
+//
+//// /**
+//// * @return the enumeration file (where all constant mapping are defined).
+//// * @since 2.4
+//// */
+//// TuttiEnumerationFile getEnumerationFile();
+//
+// /**
+// * To invoke the given call code.
+// * <p/>
+// * <strong>Note:</strong> this is mainly to execute a code in a single
+// * transaction.
+// *
+// * @param call call to invoke
+// * @param <V> return type
+// * @return the return of the call
+// * @since 2.4
+// */
+// @Transactional(readOnly = false)
+// <V> V invoke(Callable<V> call);
+//
+// Version getDbVersion();
+//
+// Version getApplicationVersion();
+//
+// void updateSchema();
+//
+// void sanityDb();
- /**
- * @return the enumeration file (where all constant mapping are defined).
- * @since 2.4
- */
- TuttiEnumerationFile getEnumerationFile();
+// //------------------------------------------------------------------------//
+// //-- Referential methods --//
+// //------------------------------------------------------------------------//
+//
+// /**
+// * @return all available zones (used by a {@link Program}.
+// * @see Program#getZone()
+// * @see Program#setZone(TuttiLocation)
+// * @since 0.3
+// */
+// List<TuttiLocation> getAllProgramZone();
+//
+// /**
+// * @return all countries.
+// * @since 0.1
+// */
+// List<TuttiLocation> getAllCountry();
+//
+// /**
+// * @return all harbours (used by a {@link Cruise}).
+// * @see {@link Cruise#getDepartureLocation()}
+// * @see {@link Cruise#setDepartureLocation(TuttiLocation)}
+// * @see {@link Cruise#getReturnLocation()}
+// * @see {@link Cruise#setReturnLocation(TuttiLocation)}
+// * @since 1.2
+// */
+//
+// List<TuttiLocation> getAllHarbour();
+//
+// /**
+// * Get the list of location of type strata that match the given zone id.
+// *
+// * @param zoneId id of the parent zone (can not be null)
+// * @return the stratas with given zone id as location parent
+// * @since 1.0
+// */
+// List<TuttiLocation> getAllFishingOperationStrata(String zoneId);
+//
+// /**
+// * Get the list of location of type substra that match the given zone id or
+// * if not null the given strata id.
+// *
+// * @param zoneId id of the parent zone (can not be null)
+// * @param strataId id of the optional parent strata
+// * @return the list of localite with given zone id as location parent / or strata
+// * @since 1.0
+// */
+// List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
+//
+// /**
+// * Get the list of location of type substra that match the given zone id or
+// * if not null the given strata id or if not null the given substrata id if
+// * not null.
+// *
+// * @param zoneId id of the parent zone (can not be null)
+// * @param strataId id of the optional parent strata
+// * @param subStrataId id of the optional parent subStrata
+// * @return the list of localite with given zone id as location parent / or strata or substrata
+// * @since 1.0
+// */
+// List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
+//
+// /**
+// * @return all scientific vessels (used by a {@link Cruise}).
+// * @see Cruise#getVessel()
+// * @see Cruise#setVessel(Vessel)
+// * @since 0.3
+// */
+// List<Vessel> getAllScientificVessel();
+//
+// /**
+// * @return all commercial vessels (used by a {@link Cruise}).
+// * @see Cruise#getVessel()
+// * @see Cruise#setVessel(Vessel)
+// * @since 0.3
+// */
+// List<Vessel> getAllFishingVessel();
+//
+// /**
+// * Get all species (referent or synonym) with with {@link Species#getSurveyCode()}
+// * filled by optional protocol.
+// *
+// * @return all species with {@code surveyCode} filled if possible.
+// * @since 0.1
+// */
+// List<Species> getAllSpecies();
+//
+// /**
+// * Get all {@code referent} species with {@link Species#getSurveyCode()}
+// * filled by optional protocol.
+// *
+// * @return all species with {@code surveyCode} filled if possible.
+// * @since 1.0
+// */
+// List<Species> getAllReferentSpecies();
+//
+// /**
+// * Obtain a species with external code as vernacular code given his referenceTaxonId.
+// * <p/>
+// * <strong>Note:</strong> {@link Species#getRefTaxCode()} will not be
+// * filled by with method.
+// *
+// * @param referenceTaxonId id of the reference taxon of the species to load
+// * @return the species or {@code null} if not found.
+// * @see Species#getReferenceTaxonId()
+// * @see Species#getVernacularCode()
+// * @since 2.0
+// */
+// Species getSpeciesByReferenceTaxonIdWithVernacularCode(Integer referenceTaxonId);
+//
+// /**
+// * @return all caracteristics of the system.
+// * @since 1.0
+// */
+// List<Caracteristic> getAllCaracteristic();
+//
+// /**
+// * @return all caracteristics of the system with the ones which are protected.
+// * @since 2.3
+// */
+// List<Caracteristic> getAllCaracteristicWithProtected();
+//
+// /**
+// * @return all caracteristics of the system useable for {@link SampleCategoryModel}.
+// * @since 2.4
+// */
+// List<Caracteristic> getAllCaracteristicForSampleCategory();
+//
+// /**
+// * @return all numeric caracteristics of the system.
+// * @since 1.0.2
+// */
+// List<Caracteristic> getAllNumericCaracteristic();
+//
+// Caracteristic getSizeCategoryCaracteristic();
+//
+// Caracteristic getSexCaracteristic();
+//
+// Caracteristic getSortedUnsortedCaracteristic();
+//
+// Caracteristic getMaturityCaracteristic();
+//
+// Caracteristic getAgeCaracteristic();
+//
+// Caracteristic getMarineLitterCategoryCaracteristic();
+//
+// Caracteristic getMarineLitterSizeCategoryCaracteristic();
+//
+// Caracteristic getVerticalOpeningCaracteristic();
+//
+// Caracteristic getHorizontalOpeningWingCaracteristic();
+//
+// Caracteristic getHorizontalOpeningDoorCaracteristic();
+//
+// Caracteristic getDeadOrAliveCaracteristic();
+//
+// Caracteristic getPmfmIdCaracteristic();
+//
+// Caracteristic getWeightMeasuredCaracteristic();
+//
+// Caracteristic getCaracteristic(Integer pmfmId);
+//
+// Predicate<SpeciesAbleBatch> getVracBatchPredicate();
+//
+// boolean isVracBatch(SpeciesAbleBatch speciesBatch);
+//
+// boolean isTemporary(TuttiReferentialEntity entity);
+//
+// List<Gear> getAllScientificGear();
+//
+// List<Gear> getAllFishingGear();
+//
+// List<Person> getAllPerson();
+//
+// /**
+// * @return all object type
+// * @since 1.0.2
+// */
+// List<ObjectType> getAllObjectType();
+//
+// Person getPerson(Integer personId);
+//
+// Gear getGear(Integer gearCode);
+//
+// Vessel getVessel(String vesselCode);
+//
+// ObjectType getObjectType(String objectTypeCode);
+//
+// /**
+// * Import given temporary species.
+// *
+// * @param species species to import
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<Species> importTemporarySpecies(List<Species> species);
+//
+// /**
+// * Import given temporary vessels.
+// *
+// * @param vessels vessels to import
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<Vessel> importTemporaryVessel(List<Vessel> vessels);
+//
+// /**
+// * Import given temporary persons.
+// *
+// * @param persons persons to import
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<Person> importTemporaryPerson(List<Person> persons);
+//
+// /**
+// * Import given temporary gears.
+// *
+// * @param gears gears to import
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<Gear> importTemporaryGear(List<Gear> gears);
- /**
- * To invoke the given call code.
- * <p/>
- * <strong>Note:</strong> this is mainly to execute a code in a single
- * transaction.
- *
- * @param call call to invoke
- * @param <V> return type
- * @return the return of the call
- * @since 2.4
- */
- @Transactional(readOnly = false)
- <V> V invoke(Callable<V> call);
-
- Version getDbVersion();
-
- Version getApplicationVersion();
-
- void updateSchema();
-
- void sanityDb();
-
//------------------------------------------------------------------------//
- //-- Referential methods --//
- //------------------------------------------------------------------------//
-
- /**
- * @return all available zones (used by a {@link Program}.
- * @see Program#getZone()
- * @see Program#setZone(TuttiLocation)
- * @since 0.3
- */
- List<TuttiLocation> getAllProgramZone();
-
- /**
- * @return all countries.
- * @since 0.1
- */
- List<TuttiLocation> getAllCountry();
-
- /**
- * @return all harbours (used by a {@link Cruise}).
- * @see {@link Cruise#getDepartureLocation()}
- * @see {@link Cruise#setDepartureLocation(TuttiLocation)}
- * @see {@link Cruise#getReturnLocation()}
- * @see {@link Cruise#setReturnLocation(TuttiLocation)}
- * @since 1.2
- */
-
- List<TuttiLocation> getAllHarbour();
-
- /**
- * Get the list of location of type strata that match the given zone id.
- *
- * @param zoneId id of the parent zone (can not be null)
- * @return the stratas with given zone id as location parent
- * @since 1.0
- */
- List<TuttiLocation> getAllFishingOperationStrata(String zoneId);
-
- /**
- * Get the list of location of type substra that match the given zone id or
- * if not null the given strata id.
- *
- * @param zoneId id of the parent zone (can not be null)
- * @param strataId id of the optional parent strata
- * @return the list of localite with given zone id as location parent / or strata
- * @since 1.0
- */
- List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
-
- /**
- * Get the list of location of type substra that match the given zone id or
- * if not null the given strata id or if not null the given substrata id if
- * not null.
- *
- * @param zoneId id of the parent zone (can not be null)
- * @param strataId id of the optional parent strata
- * @param subStrataId id of the optional parent subStrata
- * @return the list of localite with given zone id as location parent / or strata or substrata
- * @since 1.0
- */
- List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
-
- /**
- * @return all scientific vessels (used by a {@link Cruise}).
- * @see Cruise#getVessel()
- * @see Cruise#setVessel(Vessel)
- * @since 0.3
- */
- List<Vessel> getAllScientificVessel();
-
- /**
- * @return all commercial vessels (used by a {@link Cruise}).
- * @see Cruise#getVessel()
- * @see Cruise#setVessel(Vessel)
- * @since 0.3
- */
- List<Vessel> getAllFishingVessel();
-
- /**
- * Get all species (referent or synonym) with with {@link Species#getSurveyCode()}
- * filled by optional protocol.
- *
- * @return all species with {@code surveyCode} filled if possible.
- * @since 0.1
- */
- List<Species> getAllSpecies();
-
- /**
- * Get all {@code referent} species with {@link Species#getSurveyCode()}
- * filled by optional protocol.
- *
- * @return all species with {@code surveyCode} filled if possible.
- * @since 1.0
- */
- List<Species> getAllReferentSpecies();
-
- /**
- * Obtain a species with external code as vernacular code given his referenceTaxonId.
- * <p/>
- * <strong>Note:</strong> {@link Species#getRefTaxCode()} will not be
- * filled by with method.
- *
- * @param referenceTaxonId id of the reference taxon of the species to load
- * @return the species or {@code null} if not found.
- * @see Species#getReferenceTaxonId()
- * @see Species#getVernacularCode()
- * @since 2.0
- */
- Species getSpeciesByReferenceTaxonIdWithVernacularCode(Integer referenceTaxonId);
-
- /**
- * @return all caracteristics of the system.
- * @since 1.0
- */
- List<Caracteristic> getAllCaracteristic();
-
- /**
- * @return all caracteristics of the system with the ones which are protected.
- * @since 2.3
- */
- List<Caracteristic> getAllCaracteristicWithProtected();
-
- /**
- * @return all caracteristics of the system useable for {@link SampleCategoryModel}.
- * @since 2.4
- */
- List<Caracteristic> getAllCaracteristicForSampleCategory();
-
- /**
- * @return all numeric caracteristics of the system.
- * @since 1.0.2
- */
- List<Caracteristic> getAllNumericCaracteristic();
-
- Caracteristic getSizeCategoryCaracteristic();
-
- Caracteristic getSexCaracteristic();
-
- Caracteristic getSortedUnsortedCaracteristic();
-
- Caracteristic getMaturityCaracteristic();
-
- Caracteristic getAgeCaracteristic();
-
- Caracteristic getMarineLitterCategoryCaracteristic();
-
- Caracteristic getMarineLitterSizeCategoryCaracteristic();
-
- Caracteristic getVerticalOpeningCaracteristic();
-
- Caracteristic getHorizontalOpeningWingCaracteristic();
-
- Caracteristic getHorizontalOpeningDoorCaracteristic();
-
- Caracteristic getDeadOrAliveCaracteristic();
-
- Caracteristic getPmfmIdCaracteristic();
-
- Caracteristic getWeightMeasuredCaracteristic();
-
- Caracteristic getCaracteristic(Integer pmfmId);
-
- Predicate<SpeciesAbleBatch> getVracBatchPredicate();
-
- boolean isVracBatch(SpeciesAbleBatch speciesBatch);
-
- boolean isTemporary(TuttiReferentialEntity entity);
-
- List<Gear> getAllScientificGear();
-
- List<Gear> getAllFishingGear();
-
- List<Person> getAllPerson();
-
- /**
- * @return all object type
- * @since 1.0.2
- */
- List<ObjectType> getAllObjectType();
-
- Person getPerson(Integer personId);
-
- Gear getGear(Integer gearCode);
-
- Vessel getVessel(String vesselCode);
-
- ObjectType getObjectType(String objectTypeCode);
-
- /**
- * Import given temporary species.
- *
- * @param species species to import
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<Species> importTemporarySpecies(List<Species> species);
-
- /**
- * Import given temporary vessels.
- *
- * @param vessels vessels to import
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<Vessel> importTemporaryVessel(List<Vessel> vessels);
-
- /**
- * Import given temporary persons.
- *
- * @param persons persons to import
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<Person> importTemporaryPerson(List<Person> persons);
-
- /**
- * Import given temporary gears.
- *
- * @param gears gears to import
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<Gear> importTemporaryGear(List<Gear> gears);
-
- //------------------------------------------------------------------------//
//-- Attachments methods --//
//------------------------------------------------------------------------//
- /**
- * Get all attachments for the given object {@code objectId} of type.
- *
- * @param objectType type of attachment (see {@link AttachementObjectTypeEnum})
- * @param objectId id of the object
- * @return list of all attachments for the given {@code objectId}.
- * @see AttachementObjectTypeEnum
- */
- List<Attachment> getAllAttachments(AttachementObjectTypeEnum objectType,
- Integer objectId);
+// /**
+// * Get all attachments for the given object {@code objectId} of type.
+// *
+// * @param objectType type of attachment (see {@link AttachementObjectTypeEnum})
+// * @param objectId id of the object
+// * @return list of all attachments for the given {@code objectId}.
+// * @see AttachementObjectTypeEnum
+// */
+// List<Attachment> getAllAttachments(AttachementObjectTypeEnum objectType,
+// Integer objectId);
+//
+// /**
+// * Get the file of the given {@code attachmentId}.
+// *
+// * @param attachmentId id of the attachment
+// * @return the file for the given attachment
+// */
+// File getAttachmentFile(String attachmentId);
+//
+// /**
+// * Creates the given attachment.
+// *
+// * @param attachment attachment to create
+// * @param file file to store in this attachment
+// * @return the attachment with his id.
+// */
+// @Transactional(readOnly = false)
+// Attachment createAttachment(Attachment attachment, File file);
+//
+// /**
+// * Saves the given attachment.
+// *
+// * @param attachment attachment to create
+// * @return the attachment with his id.
+// */
+// @Transactional(readOnly = false)
+// Attachment saveAttachment(Attachment attachment);
+//
+// /**
+// * Deletes the given attachment given his id.
+// *
+// * @param attachmentId id of the attachment to delete
+// */
+// @Transactional(readOnly = false)
+// void deleteAttachment(String attachmentId);
- /**
- * Get the file of the given {@code attachmentId}.
- *
- * @param attachmentId id of the attachment
- * @return the file for the given attachment
- */
- File getAttachmentFile(String attachmentId);
-
- /**
- * Creates the given attachment.
- *
- * @param attachment attachment to create
- * @param file file to store in this attachment
- * @return the attachment with his id.
- */
- @Transactional(readOnly = false)
- Attachment createAttachment(Attachment attachment, File file);
-
- /**
- * Saves the given attachment.
- *
- * @param attachment attachment to create
- * @return the attachment with his id.
- */
- @Transactional(readOnly = false)
- Attachment saveAttachment(Attachment attachment);
-
- /**
- * Deletes the given attachment given his id.
- *
- * @param attachmentId id of the attachment to delete
- */
- @Transactional(readOnly = false)
- void deleteAttachment(String attachmentId);
-
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
- /**
- * Get all programs.
- * <p/>
- * <strong>Note:</strong> For each program, his zone is loaded.
- *
- * @return the list of programs found in db.
- */
- List<Program> getAllProgram();
+// /**
+// * Get all programs.
+// * <p/>
+// * <strong>Note:</strong> For each program, his zone is loaded.
+// *
+// * @return the list of programs found in db.
+// */
+// List<Program> getAllProgram();
+//
+// /**
+// * Get the program for the given {@code id}.
+// * <p/>
+// * <strong>Note:</strong> his zone is loaded.
+// *
+// * @param id id of the program to load
+// * @return the loaded program
+// */
+// Program getProgram(String id);
+//
+// @Transactional(readOnly = false)
+// Program createProgram(Program bean);
+//
+// @Transactional(readOnly = false)
+// Program saveProgram(Program bean);
- /**
- * Get the program for the given {@code id}.
- * <p/>
- * <strong>Note:</strong> his zone is loaded.
- *
- * @param id id of the program to load
- * @return the loaded program
- */
- Program getProgram(String id);
-
- @Transactional(readOnly = false)
- Program createProgram(Program bean);
-
- @Transactional(readOnly = false)
- Program saveProgram(Program bean);
-
//------------------------------------------------------------------------//
//-- Cruise methods --//
//------------------------------------------------------------------------//
- List<Cruise> getAllCruise(String programId);
+// List<Cruise> getAllCruise(String programId);
+//
+// Cruise getCruise(String id);
+//
+// @Transactional(readOnly = false)
+// Cruise createCruise(Cruise bean);
+//
+// @Transactional(readOnly = false)
+// Cruise saveCruise(Cruise bean, boolean updateVessel, boolean updateGear);
+//
+// CaracteristicMap getGearCaracteristics(String cruiseId,
+// String gearId,
+// short rankOrder);
+//
+// boolean isOperationUseGears(Integer cruiseId, Collection<Gear> gears);
+//
+// @Transactional(readOnly = false)
+// void saveGearCaracteristics(Gear gear, Cruise cruise);
- Cruise getCruise(String id);
-
- @Transactional(readOnly = false)
- Cruise createCruise(Cruise bean);
-
- @Transactional(readOnly = false)
- Cruise saveCruise(Cruise bean, boolean updateVessel, boolean updateGear);
-
- CaracteristicMap getGearCaracteristics(String cruiseId,
- String gearId,
- short rankOrder);
-
- boolean isOperationUseGears(Integer cruiseId, Collection<Gear> gears);
-
- @Transactional(readOnly = false)
- void saveGearCaracteristics(Gear gear, Cruise cruise);
-
//------------------------------------------------------------------------//
//-- Protocol methods --//
//------------------------------------------------------------------------//
- /**
- * The protocol used by the persistence lay (used to consolidate entites).
- *
- * @return The protocol used by the persistence layer
- * @see #setProtocol(TuttiProtocol)
- * @since 2.6
- */
- TuttiProtocol getProtocol();
+// /**
+// * The protocol used by the persistence lay (used to consolidate entites).
+// *
+// * @return The protocol used by the persistence layer
+// * @see #setProtocol(TuttiProtocol)
+// * @since 2.6
+// */
+// TuttiProtocol getProtocol();
+//
+// /**
+// * Set the protocol to use by the persistence layer.
+// *
+// * @param protocol the new protocol to use (can be null)
+// * @see #getProtocol()
+// * @since 2.6
+// */
+// void setProtocol(TuttiProtocol protocol);
+//
+// List<String> getAllProtocolNames();
+//
+// List<TuttiProtocol> getAllProtocol();
+//
+// boolean isProtocolExist(String id);
+//
+// TuttiProtocol getProtocol(String id);
+//
+// @Transactional(readOnly = false)
+// TuttiProtocol createProtocol(TuttiProtocol bean);
+//
+// @Transactional(readOnly = false)
+// TuttiProtocol saveProtocol(TuttiProtocol bean);
+//
+// @Transactional(readOnly = false)
+// void deleteProtocol(String id);
- /**
- * Set the protocol to use by the persistence layer.
- *
- * @param protocol the new protocol to use (can be null)
- * @see #getProtocol()
- * @since 2.6
- */
- void setProtocol(TuttiProtocol protocol);
-
- List<String> getAllProtocolNames();
-
- List<TuttiProtocol> getAllProtocol();
-
- boolean isProtocolExist(String id);
-
- TuttiProtocol getProtocol(String id);
-
- @Transactional(readOnly = false)
- TuttiProtocol createProtocol(TuttiProtocol bean);
-
- @Transactional(readOnly = false)
- TuttiProtocol saveProtocol(TuttiProtocol bean);
-
- @Transactional(readOnly = false)
- void deleteProtocol(String id);
-
//------------------------------------------------------------------------//
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
- int getFishingOperationCount(String cruiseId);
+// int getFishingOperationCount(String cruiseId);
+//
+// List<String> getAllFishingOperationIds(String cruiseId);
+//
+// List<FishingOperation> getAllFishingOperation(String cruiseId);
+//
+// FishingOperation getFishingOperation(String id);
+//
+// List<Vessel> getFishingOperationSecondaryVessel(String fishingOperationId);
+//
+// @Transactional(readOnly = false)
+// FishingOperation createFishingOperation(FishingOperation bean);
+//
+// @Transactional(readOnly = false)
+// FishingOperation saveFishingOperation(FishingOperation bean);
+//
+// @Transactional(readOnly = false)
+// void deleteFishingOperation(String id);
- List<String> getAllFishingOperationIds(String cruiseId);
-
- List<FishingOperation> getAllFishingOperation(String cruiseId);
-
- FishingOperation getFishingOperation(String id);
-
- List<Vessel> getFishingOperationSecondaryVessel(String fishingOperationId);
-
- @Transactional(readOnly = false)
- FishingOperation createFishingOperation(FishingOperation bean);
-
- @Transactional(readOnly = false)
- FishingOperation saveFishingOperation(FishingOperation bean);
-
- @Transactional(readOnly = false)
- void deleteFishingOperation(String id);
-
//------------------------------------------------------------------------//
//-- CatchBatch methods --//
//------------------------------------------------------------------------//
- /**
- * @param operationId id of the fishing operation
- * @return {@code true} if there is a catchBatch for the given fishing
- * operation, {@code false} otherwise.
- * @since 2.2
- */
- boolean isFishingOperationWithCatchBatch(String operationId);
+// /**
+// * @param operationId id of the fishing operation
+// * @return {@code true} if there is a catchBatch for the given fishing
+// * operation, {@code false} otherwise.
+// * @since 2.2
+// */
+// boolean isFishingOperationWithCatchBatch(String operationId);
+//
+// /**
+// * Get the catchBatch from the fishing Operation id.
+// * <p/>
+// * If batch model is not compatible with Tutti then a
+// * {@link InvalidBatchModelException} will be thrown.
+// *
+// * @param id id of the fihsing operation
+// * @return found catchbatch
+// * @throws InvalidBatchModelException if batch model is not compatible
+// * with Tutti.
+// */
+// CatchBatch getCatchBatchFromFishingOperation(String id) throws InvalidBatchModelException;
+//
+// /**
+// * Create the given CatchBatch and return it.
+// *
+// * @param bean catchBatch to create
+// * @return created catchBatch
+// */
+// @Transactional(readOnly = false)
+// CatchBatch createCatchBatch(CatchBatch bean);
+//
+// /**
+// * Save the given catchBatch and return it.
+// *
+// * @param bean batch to save
+// * @return the saved catchBatch
+// */
+// @Transactional(readOnly = false)
+// CatchBatch saveCatchBatch(CatchBatch bean);
- /**
- * Get the catchBatch from the fishing Operation id.
- * <p/>
- * If batch model is not compatible with Tutti then a
- * {@link InvalidBatchModelException} will be thrown.
- *
- * @param id id of the fihsing operation
- * @return found catchbatch
- * @throws InvalidBatchModelException if batch model is not compatible
- * with Tutti.
- */
- CatchBatch getCatchBatchFromFishingOperation(String id) throws InvalidBatchModelException;
-
- /**
- * Create the given CatchBatch and return it.
- *
- * @param bean catchBatch to create
- * @return created catchBatch
- */
- @Transactional(readOnly = false)
- CatchBatch createCatchBatch(CatchBatch bean);
-
- /**
- * Save the given catchBatch and return it.
- *
- * @param bean batch to save
- * @return the saved catchBatch
- */
- @Transactional(readOnly = false)
- CatchBatch saveCatchBatch(CatchBatch bean);
-
//------------------------------------------------------------------------//
//-- Species Batch methods --//
//------------------------------------------------------------------------//
- /**
- * Get the batch parent of all root {@link SpeciesBatch} for the given
- * fishing operation.
- * <p/>
- * <strong>Note:</strong> All childs of the batch should be loaded here.
- *
- * @param fishingOperationId if of the fishing operation to seek
- * @param sampleCategoryModel [optional] sample category model to check
- * @return the list of root {@link SpeciesBatch}
- * @throws InvalidBatchModelException if batch does not respect the sample category model
- * @since 2.4
- */
- BatchContainer<SpeciesBatch> getRootSpeciesBatch(String fishingOperationId,
- SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
+// /**
+// * Get the batch parent of all root {@link SpeciesBatch} for the given
+// * fishing operation.
+// * <p/>
+// * <strong>Note:</strong> All childs of the batch should be loaded here.
+// *
+// * @param fishingOperationId if of the fishing operation to seek
+// * @param sampleCategoryModel [optional] sample category model to check
+// * @return the list of root {@link SpeciesBatch}
+// * @throws InvalidBatchModelException if batch does not respect the sample category model
+// * @since 2.4
+// */
+// BatchContainer<SpeciesBatch> getRootSpeciesBatch(String fishingOperationId,
+// SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
+//
+// @Transactional(readOnly = false)
+// SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId);
+//
+// @Transactional(readOnly = false)
+// SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
+//
+// @Transactional(readOnly = false)
+// void deleteSpeciesBatch(String id);
+//
+// @Transactional(readOnly = false)
+// void deleteSpeciesSubBatch(String id);
+//
+// @Transactional(readOnly = false)
+// void changeSpeciesBatchSpecies(String batchId, Species species);
+//
+// /**
+// * Get all frequencies for the given species batch.
+// *
+// * @param speciesBatchId the id of the species batch to seek.
+// * @return the list of frequencies for the given specues batch id
+// * @since 1.0
+// */
+// List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId);
+//
+// /**
+// * Get all frequencies for the given root species batch container.
+// *
+// * @param batchContainer the root batch containter
+// * @return the list of species frequencies indexed by their species
+// * @since 3.3
+// */
+// Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer);
+//
+// /**
+// * Save all given {@link SpeciesBatchFrequency} into the given
+// * {@code speciesBatchId}. If some are not existing then creates them.
+// * <p/>
+// * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
+// *
+// * @param speciesBatchId id of the {@link SpeciesBatch} to use
+// * @param frequencies list of frequencies to create or update
+// * @return the persisted list of frequencies
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
+// List<SpeciesBatchFrequency> frequencies);
- @Transactional(readOnly = false)
- SpeciesBatch createSpeciesBatch(SpeciesBatch bean, String parentBatchId);
-
- @Transactional(readOnly = false)
- SpeciesBatch saveSpeciesBatch(SpeciesBatch bean);
-
- @Transactional(readOnly = false)
- void deleteSpeciesBatch(String id);
-
- @Transactional(readOnly = false)
- void deleteSpeciesSubBatch(String id);
-
- @Transactional(readOnly = false)
- void changeSpeciesBatchSpecies(String batchId, Species species);
-
- /**
- * Get all frequencies for the given species batch.
- *
- * @param speciesBatchId the id of the species batch to seek.
- * @return the list of frequencies for the given specues batch id
- * @since 1.0
- */
- List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId);
-
- /**
- * Get all frequencies for the given root species batch container.
- *
- * @param batchContainer the root batch containter
- * @return the list of species frequencies indexed by their species
- * @since 3.3
- */
- Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer);
-
- /**
- * Save all given {@link SpeciesBatchFrequency} into the given
- * {@code speciesBatchId}. If some are not existing then creates them.
- * <p/>
- * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
- *
- * @param speciesBatchId id of the {@link SpeciesBatch} to use
- * @param frequencies list of frequencies to create or update
- * @return the persisted list of frequencies
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId,
- List<SpeciesBatchFrequency> frequencies);
-
//------------------------------------------------------------------------//
//-- Benthos Batch methods --//
//------------------------------------------------------------------------//
- /**
- * Get the batch parent of all root {@link BenthosBatch} for the given
- * fishing operation.
- * <p/>
- * <strong>Note:</strong> All childs of the batch should be loaded here.
- *
- * @param fishingOperationId if of the fishing operation to seek
- * @param sampleCategoryModel [optional] sample category model to check
- * @return the list of root {@link BenthosBatch}
- * @throws InvalidBatchModelException if batch does not respect the sample category model
- * @since 2.4
- */
- BatchContainer<BenthosBatch> getRootBenthosBatch(String fishingOperationId,
- SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
+// /**
+// * Get the batch parent of all root {@link BenthosBatch} for the given
+// * fishing operation.
+// * <p/>
+// * <strong>Note:</strong> All childs of the batch should be loaded here.
+// *
+// * @param fishingOperationId if of the fishing operation to seek
+// * @param sampleCategoryModel [optional] sample category model to check
+// * @return the list of root {@link BenthosBatch}
+// * @throws InvalidBatchModelException if batch does not respect the sample category model
+// * @since 2.4
+// */
+// BatchContainer<BenthosBatch> getRootBenthosBatch(String fishingOperationId,
+// SampleCategoryModel sampleCategoryModel) throws InvalidBatchModelException;
+//
+// @Transactional(readOnly = false)
+// BenthosBatch createBenthosBatch(BenthosBatch bean, String parentBatchId);
+//
+// @Transactional(readOnly = false)
+// BenthosBatch saveBenthosBatch(BenthosBatch bean);
+//
+// @Transactional(readOnly = false)
+// void deleteBenthosBatch(String id);
+//
+// @Transactional(readOnly = false)
+// void deleteBenthosSubBatch(String id);
+//
+// @Transactional(readOnly = false)
+// void changeBenthosBatchSpecies(String batchId, Species species);
+//
+// /**
+// * Get all frequencies for the given species batch.
+// *
+// * @param benthosBatchId the id of the species batch to seek.
+// * @return the list of frequencies for the given specues batch id
+// * @since 1.0
+// */
+// List<BenthosBatchFrequency> getAllBenthosBatchFrequency(String benthosBatchId);
+//
+// /**
+// * Get all frequencies for the given root benthos batch container.
+// *
+// * @param batchContainer the root batch containter
+// * @return the list of benthos frequencies indexed by their species
+// * @since 3.3
+// */
+// Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer);
+//
+// /**
+// * Save all given {@link BenthosBatchFrequency} into the given
+// * {@code benthosBatchId}. If some are not existing then creates them.
+// * <p/>
+// * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
+// *
+// * @param benthosBatchId id of the {@link BenthosBatch} to use
+// * @param frequencies list of frequencies to create or update
+// * @return the persisted list of frequencies
+// * @since 1.0
+// */
+// @Transactional(readOnly = false)
+// List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId,
+// List<BenthosBatchFrequency> frequencies);
- @Transactional(readOnly = false)
- BenthosBatch createBenthosBatch(BenthosBatch bean, String parentBatchId);
-
- @Transactional(readOnly = false)
- BenthosBatch saveBenthosBatch(BenthosBatch bean);
-
- @Transactional(readOnly = false)
- void deleteBenthosBatch(String id);
-
- @Transactional(readOnly = false)
- void deleteBenthosSubBatch(String id);
-
- @Transactional(readOnly = false)
- void changeBenthosBatchSpecies(String batchId, Species species);
-
- /**
- * Get all frequencies for the given species batch.
- *
- * @param benthosBatchId the id of the species batch to seek.
- * @return the list of frequencies for the given specues batch id
- * @since 1.0
- */
- List<BenthosBatchFrequency> getAllBenthosBatchFrequency(String benthosBatchId);
-
- /**
- * Get all frequencies for the given root benthos batch container.
- *
- * @param batchContainer the root batch containter
- * @return the list of benthos frequencies indexed by their species
- * @since 3.3
- */
- Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer);
-
- /**
- * Save all given {@link BenthosBatchFrequency} into the given
- * {@code benthosBatchId}. If some are not existing then creates them.
- * <p/>
- * <strong>Note:</strong> This will as a side effect remove all previous frequency for this species batch.
- *
- * @param benthosBatchId id of the {@link BenthosBatch} to use
- * @param frequencies list of frequencies to create or update
- * @return the persisted list of frequencies
- * @since 1.0
- */
- @Transactional(readOnly = false)
- List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId,
- List<BenthosBatchFrequency> frequencies);
-
//------------------------------------------------------------------------//
//-- MarineLitter Batch methods --//
//------------------------------------------------------------------------//
- /**
- * Get the batch parent of all root {@link MarineLitterBatch} for the given
- * fishing operation.
- * <p/>
- * <strong>Note:</strong> All childs of the batch should be loaded here.
- *
- * @param fishingOperationId if of the fishing operation to seek
- * @return the list of root {@link MarineLitterBatch}
- * @since 1.3
- */
- BatchContainer<MarineLitterBatch> getRootMarineLitterBatch(String fishingOperationId);
+// /**
+// * Get the batch parent of all root {@link MarineLitterBatch} for the given
+// * fishing operation.
+// * <p/>
+// * <strong>Note:</strong> All childs of the batch should be loaded here.
+// *
+// * @param fishingOperationId if of the fishing operation to seek
+// * @return the list of root {@link MarineLitterBatch}
+// * @since 1.3
+// */
+// BatchContainer<MarineLitterBatch> getRootMarineLitterBatch(String fishingOperationId);
+//
+// @Transactional(readOnly = false)
+// MarineLitterBatch createMarineLitterBatch(MarineLitterBatch bean);
+//
+// @Transactional(readOnly = false)
+// MarineLitterBatch saveMarineLitterBatch(MarineLitterBatch bean);
+//
+// @Transactional(readOnly = false)
+// void deleteMarineLitterBatch(String id);
- @Transactional(readOnly = false)
- MarineLitterBatch createMarineLitterBatch(MarineLitterBatch bean);
-
- @Transactional(readOnly = false)
- MarineLitterBatch saveMarineLitterBatch(MarineLitterBatch bean);
-
- @Transactional(readOnly = false)
- void deleteMarineLitterBatch(String id);
-
//------------------------------------------------------------------------//
//-- Accidental Batch methods --//
//------------------------------------------------------------------------//
- List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId);
+// List<AccidentalBatch> getAllAccidentalBatch(String fishingOperationId);
+//
+// @Transactional(readOnly = false)
+// AccidentalBatch createAccidentalBatch(AccidentalBatch bean);
+//
+// @Transactional(readOnly = false)
+// AccidentalBatch saveAccidentalBatch(AccidentalBatch bean);
+//
+// @Transactional(readOnly = false)
+// void deleteAccidentalBatch(String id);
- @Transactional(readOnly = false)
- AccidentalBatch createAccidentalBatch(AccidentalBatch bean);
-
- @Transactional(readOnly = false)
- AccidentalBatch saveAccidentalBatch(AccidentalBatch bean);
-
- @Transactional(readOnly = false)
- void deleteAccidentalBatch(String id);
-
//------------------------------------------------------------------------//
//-- IndividualObservation Batch methods --//
//------------------------------------------------------------------------//
- List<IndividualObservationBatch> getAllIndividualObservationBatch(String fishingOperationId);
-
- @Transactional(readOnly = false)
- IndividualObservationBatch createIndividualObservationBatch(IndividualObservationBatch bean);
-
- @Transactional(readOnly = false)
- IndividualObservationBatch saveIndividualObservationBatch(IndividualObservationBatch bean);
-
- @Transactional(readOnly = false)
- void deleteIndividualObservationBatch(String id);
+// List<IndividualObservationBatch> getAllIndividualObservationBatch(String fishingOperationId);
+//
+// @Transactional(readOnly = false)
+// IndividualObservationBatch createIndividualObservationBatch(IndividualObservationBatch bean);
+//
+// @Transactional(readOnly = false)
+// IndividualObservationBatch saveIndividualObservationBatch(IndividualObservationBatch bean);
+//
+// @Transactional(readOnly = false)
+// void deleteIndividualObservationBatch(String id);
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,14 +25,8 @@
*/
import com.google.common.base.Predicate;
-import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
-import fr.ifremer.adagio.core.dao.technical.DatabaseSchemaDao;
-import fr.ifremer.adagio.core.dao.technical.DatabaseSchemaUpdateException;
-import fr.ifremer.adagio.core.dao.technical.VersionNotFoundException;
-import fr.ifremer.adagio.core.service.technical.CacheService;
-import fr.ifremer.adagio.core.service.technical.sanity.DatabaseSanityService;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
@@ -73,16 +67,15 @@
import fr.ifremer.tutti.persistence.service.ProtocolPersistenceService;
import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
import fr.ifremer.tutti.persistence.service.SpeciesBatchPersistenceService;
+import fr.ifremer.tutti.persistence.service.TechnicalPersistenceService;
import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.jaxx.application.ApplicationTechnicalException;
import org.nuiton.util.Version;
-import org.nuiton.util.VersionUtil;
-import org.springframework.beans.factory.annotation.Autowired;
+import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
@@ -101,53 +94,48 @@
private static final Log log =
LogFactory.getLog(TuttiPersistenceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "programPersistenceService")
protected ProgramPersistenceService programService;
- @Autowired
+ @Resource(name = "cruisePersistenceService")
protected CruisePersistenceService cruiseService;
- @Autowired
+ @Resource(name = "fishingOperationPersistenceService")
protected FishingOperationPersistenceService fishingOperationService;
- @Autowired
+ @Resource(name = "batchPersistenceService")
protected CatchBatchPersistenceService catchBatchService;
- @Autowired
+ @Resource(name = "speciesBatchPersistenceService")
protected SpeciesBatchPersistenceService speciesBatchService;
- @Autowired
+ @Resource(name = "benthosBatchPersistenceService")
protected BenthosBatchPersistenceService benthosBatchService;
- @Autowired
+// @Resource(name = "commonBatchPersistenceService")
+// protected CommonBatchPersistenceService commonBatchService;
+
+ @Resource(name = "marineLitterBatchPersistenceService")
protected MarineLitterBatchPersistenceService marineLitterBatchService;
- @Autowired
+ @Resource(name = "accidentalBatchPersistenceService")
protected AccidentalBatchPersistenceService accidentalBatchService;
- @Autowired
+ @Resource(name = "individualObservationBatchPersistenceService")
protected IndividualObservationBatchPersistenceService individualObservationBatchService;
- @Autowired
+ @Resource(name = "protocolPersistenceService")
protected ProtocolPersistenceService protocolService;
- @Autowired
+ @Resource(name = "attachmentPersistenceService")
protected AttachmentPersistenceService attachmentService;
- @Autowired
- protected DatabaseSanityService databaseSanityService;
+ @Resource(name = "technicalPersistenceService")
+ protected TechnicalPersistenceService technicalPersistenceService;
- @Autowired
- protected CacheService cacheService;
-
- @Autowired
- protected DatabaseSchemaDao databaseSchemaDao;
-
- protected Predicate<SpeciesAbleBatch> batchVracPredicate;
-
@Override
public String getImplementationName() {
return "Persistence Adagio implementation";
@@ -155,64 +143,37 @@
@Override
public void clearAllCaches() {
- cacheService.clearAllCaches();
+ technicalPersistenceService.clearAllCaches();
}
@Override
public TuttiEnumerationFile getEnumerationFile() {
- return referentialService.getEnumerationFile();
+ return technicalPersistenceService.getEnumerationFile();
}
@Override
public <V> V invoke(Callable<V> call) {
-
- try {
- V result = call.call();
- return result;
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ApplicationTechnicalException(e);
- }
+ return technicalPersistenceService.invoke(call);
}
@Override
public Version getDbVersion() {
- Version version = getDbVersion0();
- return version;
+ return technicalPersistenceService.getDbVersion();
}
- private Version getDbVersion0() {
- fr.ifremer.adagio.core.dao.technical.Version version;
- try {
- version = databaseSchemaDao.getSchemaVersion();
- } catch (VersionNotFoundException e) {
- if (log.isErrorEnabled()) {
- log.error("Could not find db version", e);
- }
- version = null;
- }
- return version == null ? null : VersionUtil.valueOf(version.toString());
- }
-
@Override
public Version getApplicationVersion() {
- fr.ifremer.adagio.core.dao.technical.Version version = databaseSchemaDao.getSchemaVersionIfUpdate();
- return VersionUtil.valueOf(version.toString());
+ return technicalPersistenceService.getApplicationVersion();
}
@Override
public void updateSchema() {
- try {
- databaseSchemaDao.updateSchema();
- } catch (DatabaseSchemaUpdateException e) {
- throw new ApplicationTechnicalException(e.getCause());
- }
+ technicalPersistenceService.updateSchema();
}
@Override
public void sanityDb() {
- databaseSanityService.sanity();
+ technicalPersistenceService.sanityDb();
}
@Override
@@ -227,15 +188,12 @@
catchBatchService.init();
speciesBatchService.init();
benthosBatchService.init();
+// commonBatchService.init();
marineLitterBatchService.init();
accidentalBatchService.init();
individualObservationBatchService.init();
protocolService.init();
attachmentService.init();
-
- TuttiEnumerationFile enumerationFile = getEnumerationFile();
-
- batchVracPredicate = TuttiEntities.newSpeciesAbleBatchCategoryPredicate(enumerationFile.PMFM_ID_SORTED_UNSORTED, enumerationFile.QUALITATIVE_VRAC_ID);
}
protected boolean close;
@@ -257,6 +215,7 @@
catchBatchService.close();
speciesBatchService.close();
benthosBatchService.close();
+// commonBatchService.close();
marineLitterBatchService.close();
accidentalBatchService.close();
individualObservationBatchService.close();
@@ -337,6 +296,11 @@
}
@Override
+ public Species getSpeciesByReferenceTaxonId(Integer referenceTaxonId) {
+ return referentialService.getSpeciesByReferenceTaxonId(referenceTaxonId);
+ }
+
+ @Override
public List<Caracteristic> getAllCaracteristic() {
return referentialService.getAllCaracteristic();
}
@@ -433,12 +397,12 @@
@Override
public boolean isVracBatch(SpeciesAbleBatch speciesBatch) {
- return batchVracPredicate.apply(speciesBatch);
+ return referentialService.isVracBatch(speciesBatch);
}
@Override
public Predicate<SpeciesAbleBatch> getVracBatchPredicate() {
- return batchVracPredicate;
+ return referentialService.getVracBatchPredicate();
}
@Override
@@ -482,6 +446,11 @@
}
@Override
+ public TuttiLocation getLocation(String id) {
+ return referentialService.getLocation(id);
+ }
+
+ @Override
public List<Species> importTemporarySpecies(List<Species> species) {
return referentialService.importTemporarySpecies(species);
}
@@ -531,6 +500,11 @@
attachmentService.deleteAttachment(attachmentId);
}
+ @Override
+ public void deleteAllAttachment(AttachementObjectTypeEnum objectType, Integer... objectIds) {
+ attachmentService.deleteAllAttachment(objectType, objectIds);
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
@@ -626,6 +600,11 @@
}
@Override
+ public List<String> getAllProtocolId() {
+ return protocolService.getAllProtocolId();
+ }
+
+ @Override
public TuttiProtocol saveProtocol(TuttiProtocol bean) {
return protocolService.saveProtocol(bean);
}
@@ -717,6 +696,11 @@
}
@Override
+ public Collection<FishingOperation> saveFishingOperations(Collection<FishingOperation> beans) {
+ return fishingOperationService.saveFishingOperations(beans);
+ }
+
+ @Override
public void deleteFishingOperation(String id) {
fishingOperationService.deleteFishingOperation(id);
}
@@ -745,6 +729,11 @@
return catchBatchService.saveCatchBatch(bean);
}
+ @Override
+ public void deleteCatchBatch(String fishingOperationId) {
+ catchBatchService.deleteCatchBatch(fishingOperationId);
+ }
+
//------------------------------------------------------------------------//
//-- Species Batch methods --//
//------------------------------------------------------------------------//
@@ -786,27 +775,9 @@
@Override
public Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer) {
-
- Multimap<Species, SpeciesBatchFrequency> result = ArrayListMultimap.create();
- for (SpeciesBatch speciesBatch : batchContainer.getChildren()) {
- getAllSpeciesBatchFrequencyForBatch(speciesBatch, result);
- }
- return result;
+ return speciesBatchService.getAllSpeciesBatchFrequencyForBatch(batchContainer);
}
- protected void getAllSpeciesBatchFrequencyForBatch(SpeciesBatch batch,
- Multimap<Species, SpeciesBatchFrequency> result) {
-
- List<SpeciesBatchFrequency> speciesBatchFrequency = getAllSpeciesBatchFrequency(batch.getId());
- result.putAll(batch.getSpecies(), speciesBatchFrequency);
-
- if (!batch.isChildBatchsEmpty()) {
- for (SpeciesBatch child : batch.getChildBatchs()) {
- getAllSpeciesBatchFrequencyForBatch(child, result);
- }
- }
- }
-
@Override
public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, List<SpeciesBatchFrequency> frequencies) {
return speciesBatchService.saveSpeciesBatchFrequency(speciesBatchId, frequencies);
@@ -853,28 +824,9 @@
@Override
public Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer) {
-
- Multimap<Species, BenthosBatchFrequency> result = ArrayListMultimap.create();
-
- for (BenthosBatch speciesBatch : batchContainer.getChildren()) {
- getAllBenthosBatchFrequencyForBatch(speciesBatch, result);
- }
- return result;
+ return benthosBatchService.getAllBenthosBatchFrequencyForBatch(batchContainer);
}
- protected void getAllBenthosBatchFrequencyForBatch(BenthosBatch batch,
- Multimap<Species, BenthosBatchFrequency> result) {
-
- List<BenthosBatchFrequency> speciesBatchFrequency = getAllBenthosBatchFrequency(batch.getId());
- result.putAll(batch.getSpecies(), speciesBatchFrequency);
-
- if (!batch.isChildBatchsEmpty()) {
- for (BenthosBatch child : batch.getChildBatchs()) {
- getAllBenthosBatchFrequencyForBatch(child, result);
- }
- }
- }
-
@Override
public List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId,
List<BenthosBatchFrequency> frequencies) {
@@ -929,6 +881,11 @@
accidentalBatchService.deleteAccidentalBatch(id);
}
+ @Override
+ public void deleteAccidentalBatchForFishingOperation(String fishingOperationId) {
+ accidentalBatchService.deleteAccidentalBatchForFishingOperation(fishingOperationId);
+ }
+
//------------------------------------------------------------------------//
//-- IndividualObservation Batch methods --//
//------------------------------------------------------------------------//
@@ -953,6 +910,11 @@
individualObservationBatchService.deleteIndividualObservationBatch(id);
}
+ @Override
+ public void deleteIndividualObservationBatchForFishingOperation(String fishingOperationId) {
+ individualObservationBatchService.deleteIndividualObservationBatchForFishingOperation(fishingOperationId);
+ }
+
//------------------------------------------------------------------------//
//-- Internal methods --//
//------------------------------------------------------------------------//
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -679,6 +679,46 @@
public void close() throws IOException {
}
+ @Override
+ public void deleteAccidentalBatchForFishingOperation(String fishingOperationId) {
+ throw notImplemented();
+ }
+
+ @Override
+ public void deleteAllAttachment(AttachementObjectTypeEnum objectType, Integer... objectIds) {
+ throw notImplemented();
+ }
+
+ @Override
+ public void deleteCatchBatch(String fishingOperationId) {
+ throw notImplemented();
+ }
+
+ @Override
+ public Collection<FishingOperation> saveFishingOperations(Collection<FishingOperation> beans) {
+ throw notImplemented();
+ }
+
+ @Override
+ public void deleteIndividualObservationBatchForFishingOperation(String fishingOperationId) {
+ throw notImplemented();
+ }
+
+ @Override
+ public List<String> getAllProtocolId() {
+ throw notImplemented();
+ }
+
+ @Override
+ public TuttiLocation getLocation(String id) {
+ throw notImplemented();
+ }
+
+ @Override
+ public Species getSpeciesByReferenceTaxonId(Integer referenceTaxonId) {
+ throw notImplemented();
+ }
+
protected RuntimeException notImplemented() {
return new RuntimeException("method not implemented");
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -418,7 +418,7 @@
* Take a {@code 5} digit context beacuse of rounding stuff to
* get exactly 4 correct digits.
*/
- private static final MathContext MATH_CONTEXT_4_DIGIT = new MathContext(5);
+ private static final MathContext MATH_CONTEXT_4_DIGIT = new MathContext(4);
private static DecimalFormatSymbols symbols;
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CaracteristicQualitativeValues.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CaracteristicQualitativeValues.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CaracteristicQualitativeValues.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -0,0 +1,17 @@
+package fr.ifremer.tutti.persistence.entities.referential;
+
+public class CaracteristicQualitativeValues extends AbstractCaracteristicQualitativeValues {
+
+ public static CaracteristicQualitativeValue getCaracteristicQualitativeValue(Caracteristic caracteristic, Integer id) {
+ CaracteristicQualitativeValue result = null;
+ if (id != null && !caracteristic.isQualitativeValueEmpty()) {
+ for (CaracteristicQualitativeValue caracteristicQualitativeValue : caracteristic.getQualitativeValue()) {
+ if (id.equals(caracteristicQualitativeValue.getIdAsInt())) {
+ result = caracteristicQualitativeValue;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/referential/CaracteristicQualitativeValues.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AbstractPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -33,8 +33,8 @@
import org.hibernate.SessionFactory;
import org.hibernate.classic.Session;
import org.hibernate.type.Type;
-import org.springframework.beans.factory.annotation.Autowired;
+import javax.annotation.Resource;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Calendar;
@@ -61,10 +61,10 @@
*
* @since 0.3
*/
- @Autowired
+ @Resource
protected SessionFactory sessionFactory;
- @Autowired
+ @Resource(name = "tuttiEnumerationFile")
protected TuttiEnumerationFile enumeration;
protected TuttiConfiguration config;
@@ -77,7 +77,8 @@
Preconditions.checkNotNull(
config, "No config found in " +
- TuttiConfiguration.class.getName());
+ TuttiConfiguration.class.getName()
+ );
}
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AccidentalBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -47,7 +47,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.type.IntegerType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -68,7 +67,7 @@
private static final Log log =
LogFactory.getLog(AccidentalBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "samplePersistenceHelper")
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -30,7 +30,6 @@
import fr.ifremer.adagio.core.dao.data.measure.file.MeasurementFileDao;
import fr.ifremer.adagio.core.dao.referential.ObjectTypeImpl;
import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
-import org.nuiton.jaxx.application.ApplicationIOUtil;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Attachments;
@@ -39,7 +38,7 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.nuiton.jaxx.application.ApplicationIOUtil;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.stereotype.Service;
@@ -68,7 +67,7 @@
protected static final String ATTACHMENT_PATH_FORMAT =
"%1$s/OBJ%2$s/%1$s-OBJ%2$s-%3$s.%4$s";
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "measurementFileDao")
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -24,6 +24,7 @@
* #L%
*/
+import com.google.common.collect.Multimap;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -97,6 +98,15 @@
List<BenthosBatchFrequency> getAllBenthosBatchFrequency(String benthosBatchId);
/**
+ * Get all frequencies for the given root benthos batch container.
+ *
+ * @param batchContainer the root batch containter
+ * @return the list of benthos frequencies indexed by their species
+ * @since 3.3
+ */
+ Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer);
+
+ /**
* Save all given {@link BenthosBatchFrequency} into the given
* {@code benthosBatchId}. If some are not existing then creates them.
* <p/>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,7 +25,9 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
@@ -46,10 +48,10 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
+import fr.ifremer.tutti.persistence.service.batch.BatchTreeHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
@@ -76,12 +78,18 @@
private static final Log log =
LogFactory.getLog(BenthosBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
+
+ @Resource(name = "measurementPersistenceHelper")
+ protected MeasurementPersistenceHelper measurementPersistenceHelper;
+
protected SampleCategoryModel sampleCategoryModel;
//------------------------------------------------------------------------//
@@ -103,13 +111,14 @@
CatchBatch catchBatch = batchHelper.getRootCatchBatchByFishingOperationId(fishingOperationId, false);
// Vrac / Benthos
- SortingBatch vracBenthosBatch = batchHelper.getSortingBatch(
- catchBatch,
- "Vrac > Benthos > Alive Itemized",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
- enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
- );
+ SortingBatch vracBenthosBatch = batchTreeHelper.getBenthosVracAliveItemizedRootBatch(catchBatch);
+// SortingBatch vracBenthosBatch = batchHelper.getSortingBatch(
+// catchBatch,
+// "Vrac > Benthos > Alive Itemized",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+// enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+// );
BatchContainer<BenthosBatch> result = new BatchContainer<BenthosBatch>();
if (vracBenthosBatch != null) {
@@ -134,12 +143,13 @@
}
// Hors-Vrac / Benthos
- SortingBatch horsVracBenthosBatch = batchHelper.getSortingBatch(
- catchBatch,
- "Hors Vrac > Benthos",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
- );
+ SortingBatch horsVracBenthosBatch = batchTreeHelper.getBenthosHorsVracRootBatch(catchBatch);
+// SortingBatch horsVracBenthosBatch = batchHelper.getSortingBatch(
+// catchBatch,
+// "Hors Vrac > Benthos",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+// );
if (horsVracBenthosBatch != null) {
for (Batch batch : horsVracBenthosBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch;
@@ -274,6 +284,28 @@
}
@Override
+ public Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer) {
+ Multimap<Species, BenthosBatchFrequency> result = ArrayListMultimap.create();
+ for (BenthosBatch speciesBatch : batchContainer.getChildren()) {
+ getAllSpeciesBatchFrequencyForBatch(speciesBatch, result);
+ }
+ return result;
+ }
+
+ protected void getAllSpeciesBatchFrequencyForBatch(BenthosBatch batch,
+ Multimap<Species, BenthosBatchFrequency> result) {
+
+ List<BenthosBatchFrequency> speciesBatchFrequency = getAllBenthosBatchFrequency(batch.getId());
+ result.putAll(batch.getSpecies(), speciesBatchFrequency);
+
+ if (!batch.isChildBatchsEmpty()) {
+ for (BenthosBatch child : batch.getChildBatchs()) {
+ getAllSpeciesBatchFrequencyForBatch(child, result);
+ }
+ }
+ }
+
+ @Override
public List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId,
List<BenthosBatchFrequency> frequencies) {
Preconditions.checkNotNull(benthosBatchId);
@@ -386,7 +418,7 @@
if (source.getSortingMeasurements().size() == 1) {
sm = source.getSortingMeasurements().iterator().next();
} else if (source.getReferenceTaxon() != null && source.getReferenceTaxon().getId() != null) {
- sm = batchHelper.getInheritedSortingMeasurement(source);
+ sm = measurementPersistenceHelper.getInheritedSortingMeasurement(source);
}
if (sm != null) {
boolean isSamplingCategory = sampleCategoryModel.containsCategoryId(
@@ -521,12 +553,12 @@
// Weight or SampleCategoryWeight
if (source.getWeight() == null && source.getSampleCategoryWeight() != null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getSampleCategoryWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
} else if (source.getWeight() != null && source.getSampleCategoryWeight() == null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -541,7 +573,7 @@
samplingRatioText = samplingRatioText.replaceAll(",", ".");
target.setSamplingRatioText(samplingRatioText);
target.setSamplingRatio(source.getWeight() / source.getSampleCategoryWeight());
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -552,7 +584,7 @@
Integer pmfmId = source.getSampleCategoryId();
// Do not store sorting measurement if pmfm = SORTED (already store in an ancestor batch)
if (!pmfmId.equals(enumeration.PMFM_ID_SORTED_UNSORTED)) {
- SortingMeasurement sortingMeasurement = batchHelper.setSortingMeasurement(
+ SortingMeasurement sortingMeasurement = measurementPersistenceHelper.setSortingMeasurement(
target,
pmfmId,
source.getSampleCategoryValue());
@@ -630,7 +662,7 @@
// Weight or SampleCategoryWeight
if (source.getWeight() != null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -639,7 +671,7 @@
// Sorting measurement
if ((source.getLengthStepCaracteristic() != null && source.getLengthStep() != null)) {
Integer pmfmId = source.getLengthStepCaracteristic().getIdAsInt();
- SortingMeasurement sortingMeasurement = batchHelper.setSortingMeasurement(target, pmfmId,
+ SortingMeasurement sortingMeasurement = measurementPersistenceHelper.setSortingMeasurement(target, pmfmId,
source.getLengthStep());
notChangedSortingMeasurements.remove(sortingMeasurement);
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -36,11 +36,11 @@
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.CatchBatchBean;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
+import fr.ifremer.tutti.persistence.service.batch.BatchTreeHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.FlushMode;
import org.hibernate.type.IntegerType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -57,15 +57,21 @@
private static final Log log =
LogFactory.getLog(CatchBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "attachmentPersistenceService")
protected AttachmentPersistenceService attachmentPersistenceService;
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
+
+ @Resource(name = "measurementPersistenceHelper")
+ protected MeasurementPersistenceHelper measurementPersistenceHelper;
+
//------------------------------------------------------------------------//
//-- CatchBatch methods --//
//------------------------------------------------------------------------//
@@ -95,11 +101,12 @@
}
// Vrac
- SortingBatch vracBatch = batchHelper.getSortingBatch(
- source,
- "Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = batchTreeHelper.getVracBatch(source);
+// SortingBatch vracBatch = batchHelper.getSortingBatch(
+// source,
+// "Vrac",
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_VRAC_ID);
if (vracBatch != null) {
@@ -107,33 +114,36 @@
result.setCatchTotalSortedTremisWeight(vracBatch.getWeightBeforeSampling());
// Vrac > Species
- SortingBatch vracSpeciesBatch = batchHelper.getSortingBatch(
- vracBatch,
- "Vrac > Species",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch vracSpeciesBatch = batchTreeHelper.getSpeciesVracRootBatch(vracBatch);
+// SortingBatch vracSpeciesBatch = batchHelper.getSortingBatch(
+// vracBatch,
+// "Vrac > Species",
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (vracSpeciesBatch != null) {
result.setSpeciesTotalSortedWeight(vracSpeciesBatch.getWeight());
// Vrac > Species > Inert
- SortingBatch inertBatch = batchHelper.getSortingBatch(
- vracSpeciesBatch,
- "Vrac > Species > Inert",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
+ SortingBatch inertBatch = batchTreeHelper.getSpeciesVracInertRootBatch(vracSpeciesBatch);
+// SortingBatch inertBatch = batchHelper.getSortingBatch(
+// vracSpeciesBatch,
+// "Vrac > Species > Inert",
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch != null) {
result.setSpeciesTotalInertWeight(inertBatch.getWeight());
}
// Vrac > Species > Alive not itemized
- SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
- vracSpeciesBatch,
- "Vrac > Species > Alive not itemized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ SortingBatch livingNotItemizedBatch = batchTreeHelper.getSpeciesVracAliveNotItemizedRootBatch(vracSpeciesBatch);
+// SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
+// vracSpeciesBatch,
+// "Vrac > Species > Alive not itemized",
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
if (livingNotItemizedBatch != null) {
result.setSpeciesTotalLivingNotItemizedWeight(livingNotItemizedBatch.getWeight());
@@ -141,32 +151,35 @@
}
// Vrac > Benthos
- SortingBatch vracBenthosBatch = batchHelper.getSortingBatch(
- vracBatch,
- "Vrac > Benthos",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch vracBenthosBatch = batchTreeHelper.getBenthosVracRootBatch(vracBatch);
+// SortingBatch vracBenthosBatch = batchHelper.getSortingBatch(
+// vracBatch,
+// "Vrac > Benthos",
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (vracBenthosBatch != null) {
result.setBenthosTotalSortedWeight(vracBenthosBatch.getWeight());
// Vrac > Benthos > Inert
- SortingBatch inertBatch = batchHelper.getSortingBatch(
- vracBenthosBatch,
- "Vrac > Benthos > Inert",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
+ SortingBatch inertBatch = batchTreeHelper.getBenthosVracInertRootBatch(vracBenthosBatch);
+// SortingBatch inertBatch = batchHelper.getSortingBatch(
+// vracBenthosBatch,
+// "Vrac > Benthos > Inert",
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch != null) {
result.setBenthosTotalInertWeight(inertBatch.getWeight());
}
// Vrac > Benthos > Alive no itemized
- SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
- vracBenthosBatch,
- "Vrac > Benthos > Alive not itemized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ SortingBatch livingNotItemizedBatch = batchTreeHelper.getBenthosVracAliveNotItemizedRootBatch(vracBenthosBatch);
+// SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
+// vracBenthosBatch,
+// "Vrac > Benthos > Alive not itemized",
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
if (livingNotItemizedBatch != null) {
result.setBenthosTotalLivingNotItemizedWeight(livingNotItemizedBatch.getWeight());
@@ -175,34 +188,38 @@
}
// Hors Vrac
- SortingBatch horsVracBatch = batchHelper.getSortingBatch(
- source,
- "Hors Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID);
+ SortingBatch horsVracBatch = batchTreeHelper.getHorsVracBatch(source);
+// SortingBatch horsVracBatch = batchHelper.getSortingBatch(
+// source,
+// "Hors Vrac",
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_HORS_VRAC_ID);
if (horsVracBatch != null) {
// Hors Vrac > Species
- batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > Species",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ batchTreeHelper.getSpeciesHorsVracRootBatch(horsVracBatch);
+// batchHelper.getSortingBatch(
+// horsVracBatch,
+// "Hors Vrac > Species",
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
// Hors Vrac > Benthos
- batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > Benthos",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ batchTreeHelper.getBenthosHorsVracRootBatch(horsVracBatch);
+// batchHelper.getSortingBatch(
+// horsVracBatch,
+// "Hors Vrac > Benthos",
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
// Hors Vrac > MarineLitter
- SortingBatch marineLitterBatch = batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > MarineLitter",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ SortingBatch marineLitterBatch = batchTreeHelper.getMarineLitterRootBatch(horsVracBatch);
+// SortingBatch marineLitterBatch = batchHelper.getSortingBatch(
+// horsVracBatch,
+// "Hors Vrac > MarineLitter",
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
if (marineLitterBatch != null) {
result.setMarineLitterTotalWeight(marineLitterBatch.getWeight());
@@ -210,11 +227,12 @@
}
// Non trié
- SortingBatch unsortedBatch = batchHelper.getSortingBatch(
- source,
- "Unsorted",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_UNSORTED_ID);
+ SortingBatch unsortedBatch = batchTreeHelper.getRejectedBatch(source);
+// SortingBatch unsortedBatch = batchHelper.getSortingBatch(
+// source,
+// "Unsorted",
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_UNSORTED_ID);
if (unsortedBatch != null) {
result.setCatchTotalRejectedWeight(unsortedBatch.getWeight());
@@ -310,7 +328,7 @@
// Total Weight
if (source.getCatchTotalWeight() != null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getCatchTotalWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -321,9 +339,11 @@
quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
}
- SortingBatch vracBatch = batchHelper.getVracBatch(target);
+ SortingBatch vracBatch = batchTreeHelper.getVracBatch(target);
+// SortingBatch vracBatch = batchHelper.getVracBatch(target);
- SortingBatch horsVracBatch = batchHelper.getHorsVracBatch(target);
+ SortingBatch horsVracBatch = batchTreeHelper.getHorsVracBatch(target);
+// SortingBatch horsVracBatch = batchHelper.getHorsVracBatch(target);
SortingBatch horsVracSpeciesRootBatch = null;
SortingBatch horsVracBenthosRootBatch = null;
@@ -331,12 +351,12 @@
if (horsVracBatch != null) {
- horsVracSpeciesRootBatch = batchHelper.getSpeciesHorsVracRootBatch(
- horsVracBatch);
- horsVracBenthosRootBatch = batchHelper.getBenthosHorsVracRootBatch(
- horsVracBatch);
- horsVracMarineLitterRootBatch = batchHelper.getMarineLitterRootBatch(
- horsVracBatch);
+ horsVracSpeciesRootBatch = batchTreeHelper.getSpeciesHorsVracRootBatch(horsVracBatch);
+// horsVracSpeciesRootBatch = batchHelper.getSpeciesHorsVracRootBatch(horsVracBatch);
+ horsVracBenthosRootBatch = batchTreeHelper.getBenthosHorsVracRootBatch(horsVracBatch);
+// horsVracBenthosRootBatch = batchHelper.getBenthosHorsVracRootBatch(horsVracBatch);
+ horsVracMarineLitterRootBatch = batchTreeHelper.getMarineLitterRootBatch(horsVracBatch);
+// horsVracMarineLitterRootBatch = batchHelper.getMarineLitterRootBatch(horsVracBatch);
}
SortingBatch speciesVracBatch = null;
@@ -350,26 +370,27 @@
SortingBatch benthosVracAliveItemizeRootBatch = null;
if (vracBatch != null) {
- speciesVracBatch = batchHelper.getSpeciesVracRootBatch(
- vracBatch);
+ speciesVracBatch = batchTreeHelper.getSpeciesVracRootBatch(vracBatch);
+// speciesVracBatch = batchHelper.getSpeciesVracRootBatch(vracBatch);
if (speciesVracBatch != null) {
- speciesVracAliveNotItemizeRootBatch = batchHelper.getSpeciesVracAliveNotItemizeRootBatch(
- speciesVracBatch);
- speciesVracInertRootBatch = batchHelper.getSpeciesVracInertRootBatch(
- speciesVracBatch);
- speciesVracAliveItemizeRootBatch = batchHelper.getSpeciesVracAliveItemizeRootBatch(
- speciesVracBatch);
+ speciesVracAliveNotItemizeRootBatch = batchTreeHelper.getSpeciesVracAliveNotItemizedRootBatch(speciesVracBatch);
+// speciesVracAliveNotItemizeRootBatch = batchHelper.getSpeciesVracAliveNotItemizedRootBatch(speciesVracBatch);
+ speciesVracInertRootBatch = batchTreeHelper.getSpeciesVracInertRootBatch(speciesVracBatch);
+// speciesVracInertRootBatch = batchHelper.getSpeciesVracInertRootBatch(speciesVracBatch);
+ speciesVracAliveItemizeRootBatch = batchTreeHelper.getSpeciesVracAliveItemizedRootBatch(speciesVracBatch);
+// speciesVracAliveItemizeRootBatch = batchHelper.getSpeciesVracAliveItemizeRootBatch(speciesVracBatch);
}
- benthosVracBatch = batchHelper.getBenthosVracRootBatch(vracBatch);
+ benthosVracBatch = batchTreeHelper.getBenthosVracRootBatch(vracBatch);
+// benthosVracBatch = batchHelper.getBenthosVracRootBatch(vracBatch);
if (benthosVracBatch != null) {
- benthosVracAliveNotItemizeRootBatch = batchHelper.getBenthosVracAliveNotItemizeRootBatch(
- benthosVracBatch);
- benthosVracInertRootBatch = batchHelper.getBenthosVracInertRootBatch(
- benthosVracBatch);
- benthosVracAliveItemizeRootBatch = batchHelper.getBenthosVracAliveItemizeRootBatch(
- benthosVracBatch);
+ benthosVracAliveNotItemizeRootBatch = batchTreeHelper.getBenthosVracAliveNotItemizedRootBatch(benthosVracBatch);
+// benthosVracAliveNotItemizeRootBatch = batchHelper.getBenthosVracAliveNotItemizedRootBatch(benthosVracBatch);
+ benthosVracInertRootBatch = batchTreeHelper.getBenthosVracInertRootBatch(benthosVracBatch);
+// benthosVracInertRootBatch = batchHelper.getBenthosVracInertRootBatch(benthosVracBatch);
+ benthosVracAliveItemizeRootBatch = batchTreeHelper.getBenthosVracAliveItemizedRootBatch(benthosVracBatch);
+// benthosVracAliveItemizeRootBatch = batchHelper.getBenthosVracAliveItemizeRootBatch(benthosVracBatch);
}
}
@@ -412,8 +433,9 @@
needHorsVracBenthos ||
needHorsVracMarineLitter;
- boolean needUnsorted = batchHelper.getRejectedBatch(target) != null ||
+ boolean needUnsorted = batchTreeHelper.getRejectedBatch(target) != null ||
source.getCatchTotalRejectedWeight() != null;
+// boolean needUnsorted = batchHelper.getRejectedBatch(target) != null ||
// ---------------------------------------------------------------------
// Vrac
@@ -421,7 +443,7 @@
if (needVrac) {
- vracBatch = batchHelper.getOrCreateVracBatch(
+ vracBatch = batchTreeHelper.getOrCreateVracBatch(
target,
source.getCatchTotalSortedCarousselWeight(),
source.getCatchTotalSortedTremisWeight());
@@ -431,7 +453,7 @@
// ---------------------------------------------------------------------
// Vrac / Species
// ---------------------------------------------------------------------
- speciesVracBatch = batchHelper.getOrCreateSpeciesVracRootBatch(
+ speciesVracBatch = batchTreeHelper.getOrCreateSpeciesVracRootBatch(
target,
vracBatch,
source.getSpeciesTotalSortedWeight());
@@ -440,7 +462,7 @@
// ---------------------------------------------------------------------
// Vrac / Species / Alive not itemized
// ---------------------------------------------------------------------
- batchHelper.getOrCreateSpeciesVracAliveNotItemizeRootBatch(
+ batchTreeHelper.getOrCreateSpeciesVracAliveNotItemizedRootBatch(
target,
speciesVracBatch,
source.getSpeciesTotalLivingNotItemizedWeight());
@@ -450,7 +472,7 @@
// ---------------------------------------------------------------------
// Vrac / Species / Inert (not alive)
// ---------------------------------------------------------------------
- batchHelper.getOrCreateSpeciesVracInertRootBatch(
+ batchTreeHelper.getOrCreateSpeciesVracInertRootBatch(
target,
speciesVracBatch,
source.getSpeciesTotalInertWeight());
@@ -460,7 +482,7 @@
// ---------------------------------------------------------------------
// Vrac / Species / Alive itemized
// ---------------------------------------------------------------------
- batchHelper.getOrCreateSpeciesVracAliveItemizeRootBatch(
+ batchTreeHelper.getOrCreateSpeciesVracAliveItemizedRootBatch(
target,
speciesVracBatch);
}
@@ -471,7 +493,7 @@
// ---------------------------------------------------------------------
// Vrac > Benthos
// ---------------------------------------------------------------------
- benthosVracBatch = batchHelper.getOrCreateBenthosVracRootBatch(
+ benthosVracBatch = batchTreeHelper.getOrCreateBenthosVracRootBatch(
target,
vracBatch,
source.getBenthosTotalSortedWeight());
@@ -480,7 +502,7 @@
// ---------------------------------------------------------------------
// Vrac / Benthos / Alive not itemized
// ---------------------------------------------------------------------
- batchHelper.getOrCreateBenthosVracAliveNotItemizeRootBatch(
+ batchTreeHelper.getOrCreateBenthosVracAliveNotItemizedRootBatch(
target,
benthosVracBatch,
source.getBenthosTotalLivingNotItemizedWeight());
@@ -490,7 +512,7 @@
// ---------------------------------------------------------------------
// Vrac / Benthos / Inert (not alive)
// ---------------------------------------------------------------------
- batchHelper.getOrCreateBenthosVracInertRootBatch(
+ batchTreeHelper.getOrCreateBenthosVracInertRootBatch(
target,
benthosVracBatch,
source.getBenthosTotalInertWeight());
@@ -500,7 +522,7 @@
// ---------------------------------------------------------------------
// Vrac / Benthos / Alive itemized
// ---------------------------------------------------------------------
- batchHelper.getOrCreateBenthosVracAliveItemizeRootBatch(
+ batchTreeHelper.getOrCreateBenthosVracAliveItemizedRootBatch(
target,
benthosVracBatch);
}
@@ -513,13 +535,13 @@
// ---------------------------------------------------------------------
// Hors Vrac
// ---------------------------------------------------------------------
- horsVracBatch = batchHelper.getOrCreateHorsVracBatch(target);
+ horsVracBatch = batchTreeHelper.getOrCreateHorsVracBatch(target);
if (needHorsVracSpecies) {
// ---------------------------------------------------------------------
// Hors Vrac > Species
// ---------------------------------------------------------------------
- batchHelper.getOrCreateSpeciesHorsVracRootBatch(
+ batchTreeHelper.getOrCreateSpeciesHorsVracRootBatch(
target,
horsVracBatch);
}
@@ -528,7 +550,7 @@
// ---------------------------------------------------------------------
// Hors Vrac > Benthos
// ---------------------------------------------------------------------
- batchHelper.getOrCreateBenthosHorsVracRootBatch(
+ batchTreeHelper.getOrCreateBenthosHorsVracRootBatch(
target,
horsVracBatch);
}
@@ -537,7 +559,7 @@
// ---------------------------------------------------------------------
// Hors Vrac > MarineLitter
// ---------------------------------------------------------------------
- batchHelper.getOrCreateMarineLitterRootBatch(
+ batchTreeHelper.getOrCreateMarineLitterRootBatch(
target,
horsVracBatch,
source.getMarineLitterTotalWeight());
@@ -548,7 +570,7 @@
// ---------------------------------------------------------------------
// Unsorted (=rejected)
// ---------------------------------------------------------------------
- batchHelper.getOrCreateRejectedBatch(
+ batchTreeHelper.getOrCreateRejectedBatch(
target, source.getCatchTotalRejectedWeight());
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -82,7 +82,6 @@
import org.hibernate.type.ShortType;
import org.hibernate.type.StringType;
import org.nuiton.jaxx.application.ApplicationBusinessException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -110,16 +109,16 @@
private static final Log log =
LogFactory.getLog(CruisePersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "programPersistenceService")
protected ProgramPersistenceService programService;
- @Autowired
+ @Resource(name = "fishingOperationPersistenceService")
protected FishingOperationPersistenceService fishingOperationService;
- @Autowired
+ @Resource(name = "vesselPersonFeaturesPersistenceHelper")
protected VesselPersonFeaturesPersistenceHelper vesselPersonFeaturesPersistenceHelper;
@Resource(name = "scientificCruiseDao")
@@ -695,7 +694,8 @@
}
return result;
}
- });
+ }
+ );
boolean gearRemoved = isOperationUseGears(target.getId(), gears);
if (gearRemoved) {
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -81,7 +81,6 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.FlushMode;
import org.hibernate.type.IntegerType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -110,22 +109,22 @@
private static final Log log =
LogFactory.getLog(FishingOperationPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "batchPersistenceService")
protected CatchBatchPersistenceService catchBatchService;
- @Autowired
+ @Resource(name = "accidentalBatchPersistenceService")
protected AccidentalBatchPersistenceService accidentalBatchService;
- @Autowired
+ @Resource(name = "attachmentPersistenceService")
protected AttachmentPersistenceService attachmentPersistenceService;
- @Autowired
+ @Resource(name = "vesselPersonFeaturesPersistenceHelper")
protected VesselPersonFeaturesPersistenceHelper vesselPersonFeaturesPersistenceHelper;
- @Autowired
+ @Resource(name = "measurementPersistenceHelper")
protected MeasurementPersistenceHelper measurementPersistenceHelper;
@Resource(name = "scientificCruiseDao")
@@ -411,6 +410,7 @@
}
return result;
}
+
@Override
public FishingOperation createFishingOperation(FishingOperation bean) {
Preconditions.checkNotNull(bean);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/IndividualObservationBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/IndividualObservationBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/IndividualObservationBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -50,7 +50,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.type.IntegerType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -71,10 +70,10 @@
private static final Log log =
LogFactory.getLog(IndividualObservationBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "attachmentPersistenceService")
protected AttachmentPersistenceService attachmentPersistenceService;
@Resource(name = "samplePersistenceHelper")
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -40,9 +40,9 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
+import fr.ifremer.tutti.persistence.service.batch.BatchTreeHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -61,12 +61,18 @@
private static final Log log =
LogFactory.getLog(MarineLitterBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
+ @Resource(name = "measurementPersistenceHelper")
+ protected MeasurementPersistenceHelper measurementPersistenceHelper;
+
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
+
protected Integer marineLitterCategory;
protected Integer marineLitterSizeCategory;
@@ -95,9 +101,9 @@
CatchBatch catchBatch = batchHelper.getRootCatchBatchByFishingOperationId(fishingOperationId, false);
// Get marine litter root batch
- SortingBatch sortingBatch = getMarineLitterParentBatch(catchBatch);
+ SortingBatch sortingBatch = batchTreeHelper.getMarineLitterRootBatch(catchBatch);
- BatchContainer<MarineLitterBatch> result = new BatchContainer<MarineLitterBatch>();
+ BatchContainer<MarineLitterBatch> result = new BatchContainer<>();
if (sortingBatch != null) {
result.setId(sortingBatch.getId());
@@ -219,7 +225,7 @@
// If parent and root need to be set
if (target.getId() == null || target.getRootBatch() == null) {
- setBatchParents(target, catchBatch);
+ batchHelper.setMarineLitterBatchParents(target, catchBatch);
}
// RankOrder (initialize once, at creation)
@@ -245,7 +251,7 @@
// Weight
if (source.getWeight() != null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -254,7 +260,7 @@
// MarineLitterCategory
if (source.getMarineLitterCategory() != null) {
- SortingMeasurement measurement = batchHelper.setSortingMeasurement(
+ SortingMeasurement measurement = measurementPersistenceHelper.setSortingMeasurement(
target,
marineLitterCategory,
source.getMarineLitterCategory().getIdAsInt()
@@ -265,7 +271,7 @@
// MarineLitterSizeCategory
if (source.getMarineLitterSizeCategory() != null) {
- SortingMeasurement measurement = batchHelper.setSortingMeasurement(
+ SortingMeasurement measurement = measurementPersistenceHelper.setSortingMeasurement(
target,
marineLitterSizeCategory,
source.getMarineLitterSizeCategory().getIdAsInt()
@@ -299,37 +305,20 @@
}
}
- public void setBatchParents(SortingBatch target, CatchBatch catchBatch) {
-
- Preconditions.checkNotNull(target);
-
- SortingBatch parentBatch = getMarineLitterParentBatch(catchBatch);
-
- if (parentBatch == null) {
-
- SortingBatch horsVracBatch = batchHelper.getOrCreateHorsVracBatch(
- catchBatch
- );
-
- parentBatch = batchHelper.getOrCreateMarineLitterRootBatch(
- catchBatch,
- horsVracBatch,
- null
- );
- }
-
- target.setParentBatch(parentBatch);
- target.setRootBatch(catchBatch);
- }
-
- protected SortingBatch getMarineLitterParentBatch(CatchBatch catchBatch) {
- SortingBatch parentBatch = batchHelper.getSortingBatch(
- catchBatch,
- "Hors Vrac > Marine Litter",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
- return parentBatch;
- }
+// public void setMarineLitterBatchParents(SortingBatch target, CatchBatch catchBatch) {
+//
+// Preconditions.checkNotNull(target);
+//
+// SortingBatch parentBatch = batchTreeHelper.getMarineLitterRootBatch(catchBatch);
+//
+// if (parentBatch == null) {
+//
+// SortingBatch horsVracBatch = batchHelper.getOrCreateHorsVracBatch(catchBatch);
+//
+// parentBatch = batchHelper.getOrCreateMarineLitterRootBatch(catchBatch, horsVracBatch, null);
+// }
+//
+// target.setParentBatch(parentBatch);
+// target.setRootBatch(catchBatch);
+// }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MeasurementPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MeasurementPersistenceHelper.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MeasurementPersistenceHelper.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -24,13 +24,20 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import fr.ifremer.adagio.core.dao.data.batch.Batch;
+import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
+import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
import fr.ifremer.adagio.core.dao.data.measure.Measurement;
+import fr.ifremer.adagio.core.dao.data.measure.QuantificationMeasurement;
+import fr.ifremer.adagio.core.dao.data.measure.SortingMeasurement;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValue;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueImpl;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
import java.io.Serializable;
/**
@@ -42,6 +49,12 @@
@Component("measurementPersistenceHelper")
public class MeasurementPersistenceHelper extends AbstractPersistenceService {
+ @Resource(name = "referentialPersistenceService")
+ protected ReferentialPersistenceService referentialService;
+
+ @Resource(name = "catchBatchDao")
+ protected CatchBatchExtendDao catchBatchDao;
+
public void setMeasurement(Measurement measurement,
Caracteristic caracteristic,
Serializable value) {
@@ -68,4 +81,38 @@
break;
}
}
+
+ public SortingMeasurement setSortingMeasurement(
+ SortingBatch sortingBatch,
+ Integer pmfmId,
+ Serializable value) {
+ Preconditions.checkNotNull(pmfmId);
+ Preconditions.checkNotNull(value);
+
+ Caracteristic caracteristic = referentialService.getCaracteristic(pmfmId);
+ SortingMeasurement sortingMeasurement = catchBatchDao.getSortingMeasurement(
+ sortingBatch, pmfmId, getRecorderDepartmentId(), true);
+ setMeasurement(sortingMeasurement,
+ caracteristic,
+ value);
+ return sortingMeasurement;
+ }
+
+ public QuantificationMeasurement setWeightMeasurementQuantificationMeasurement(Batch batch, Float weightValue) {
+ return catchBatchDao.setQuantificationMeasurement(batch, enumeration.PMFM_ID_WEIGHT_MEASURED, getRecorderDepartmentId(), weightValue, true);
+ }
+
+ public QuantificationMeasurement getWeightMeasurementQuantificationMeasurement(Batch batch) {
+ QuantificationMeasurement quantificationMeasurement = catchBatchDao.getQuantificationMeasurement(batch, enumeration.PMFM_ID_WEIGHT_MEASURED, getRecorderDepartmentId(), false);
+ return quantificationMeasurement;
+ }
+
+ public SortingMeasurement getInheritedSortingMeasurement(SortingBatch sortingBatch) {
+ return catchBatchDao.getInheritedSortingMeasurement(sortingBatch, enumeration.PMFM_ID_SORTED_UNSORTED);
+ }
+
+ protected Integer getRecorderDepartmentId() {
+ // TODO BL : voir si on peut récupérer le departement (du 1er saisisseur ?)
+ return enumeration.DEPARTMENT_ID_UNKNOWN_RECORDER_DEPARTMENT;
+ }
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -39,7 +39,6 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Service;
@@ -59,7 +58,7 @@
private static final Log log =
LogFactory.getLog(ProgramPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "programDao")
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -24,10 +24,12 @@
* #L%
*/
+import com.google.common.base.Predicate;
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
@@ -266,6 +268,10 @@
@Cacheable(value = "pmfmById", key = "#pmfmId")
Caracteristic getCaracteristic(Integer pmfmId);
+ Predicate<SpeciesAbleBatch> getVracBatchPredicate();
+
+ boolean isVracBatch(SpeciesAbleBatch speciesBatch);
+
@Cacheable(value = "objectTypeByCode", key = "#objectTypeCode")
ObjectType getObjectType(String objectTypeCode);
@@ -309,5 +315,5 @@
@CacheEvict(value = "gears", allEntries = true)
List<Gear> importTemporaryGear(List<Gear> gears);
- TuttiEnumerationFile getEnumerationFile();
+// TuttiEnumerationFile getEnumerationFile();
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,6 +25,7 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import fr.ifremer.adagio.core.dao.administration.user.PersonExtendDao;
@@ -37,6 +38,7 @@
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonRefVO;
import fr.ifremer.adagio.core.service.technical.CacheService;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValues;
@@ -114,6 +116,17 @@
@Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService thisService;
+ protected Predicate<SpeciesAbleBatch> batchVracPredicate;
+
+ @Override
+ public void init() {
+ super.init();
+
+ batchVracPredicate = TuttiEntities.newSpeciesAbleBatchCategoryPredicate(
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID);
+ }
+
//------------------------------------------------------------------------//
//-- ReferentialPersistenceService implentation --//
//------------------------------------------------------------------------//
@@ -353,7 +366,7 @@
"projectMemberProfilId", IntegerType.INSTANCE, enumeration.USER_PROFIL_ID_PROJECT_MEMBER,
"userProfilId", IntegerType.INSTANCE, enumeration.USER_PROFIL_ID_USER,
"departementPrefixCode", StringType.INSTANCE, enumeration.USER_PROFIL_ID_DEPARTEMENT_PREFIX
- );
+ );
List<Person> result = Lists.newArrayList();
while (list.hasNext()) {
@@ -667,6 +680,16 @@
}
@Override
+ public boolean isVracBatch(SpeciesAbleBatch speciesBatch) {
+ return batchVracPredicate.apply(speciesBatch);
+ }
+
+ @Override
+ public Predicate<SpeciesAbleBatch> getVracBatchPredicate() {
+ return batchVracPredicate;
+ }
+
+ @Override
public List<Species> importTemporarySpecies(List<Species> species) {
List<Species> result = Lists.newArrayList();
for (Species source : species) {
@@ -723,10 +746,10 @@
return Collections.unmodifiableList(result);
}
- @Override
- public TuttiEnumerationFile getEnumerationFile() {
- return enumeration;
- }
+// @Override
+// public TuttiEnumerationFile getEnumerationFile() {
+// return enumeration;
+// }
//------------------------------------------------------------------------//
//-- Internal methods --//
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SamplePersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SamplePersistenceHelper.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SamplePersistenceHelper.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -35,7 +35,6 @@
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import org.hibernate.type.IntegerType;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -52,13 +51,13 @@
@Component("samplePersistenceHelper")
public class SamplePersistenceHelper extends AbstractPersistenceService {
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
- @Autowired
+ @Resource(name = "measurementPersistenceHelper")
protected MeasurementPersistenceHelper measurementPersistenceHelper;
- @Autowired
+ @Resource(name = "attachmentPersistenceService")
protected AttachmentPersistenceService attachmentPersistenceService;
@Resource(name = "sampleDao")
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -24,6 +24,7 @@
* #L%
*/
+import com.google.common.collect.Multimap;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -99,6 +100,15 @@
List<SpeciesBatchFrequency> getAllSpeciesBatchFrequency(String speciesBatchId);
/**
+ * Get all frequencies for the given root species batch container.
+ *
+ * @param batchContainer the root batch containter
+ * @return the list of species frequencies indexed by their species
+ * @since 3.3
+ */
+ Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer);
+
+ /**
* Save all given {@link SpeciesBatchFrequency} into the given
* {@code speciesBatchId}. If some are not existing then creates them.
* <p/>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,7 +25,9 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
@@ -46,10 +48,10 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
+import fr.ifremer.tutti.persistence.service.batch.BatchTreeHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
@@ -76,12 +78,18 @@
private static final Log log =
LogFactory.getLog(SpeciesBatchPersistenceServiceImpl.class);
- @Autowired
+ @Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
+
+ @Resource(name = "measurementPersistenceHelper")
+ protected MeasurementPersistenceHelper measurementPersistenceHelper;
+
protected SampleCategoryModel sampleCategoryModel;
@Override
@@ -103,13 +111,14 @@
CatchBatch catchBatch = batchHelper.getRootCatchBatchByFishingOperationId(fishingOperationId, false);
// Vrac / Species
- SortingBatch vracSpeciesBatch = batchHelper.getSortingBatch(
- catchBatch,
- "Vrac > Species > Alive Itemized",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
- enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
- );
+ SortingBatch vracSpeciesBatch = batchTreeHelper.getSpeciesVracAliveItemizedRootBatch(catchBatch);
+// SortingBatch vracSpeciesBatch = batchHelper.getSortingBatch(
+// catchBatch,
+// "Vrac > Species > Alive Itemized",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+// enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+// );
// container of speciesBatch is arbitraty put on vrac type (there is
// no common ancestor for all species batch).
@@ -142,11 +151,12 @@
}
// Hors-Vrac / Species
- SortingBatch horsVracSpeciesBatch = batchHelper.getSortingBatch(
- catchBatch,
- "Hors Vrac > Species",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch horsVracSpeciesBatch = batchTreeHelper.getSpeciesHorsVracRootBatch(catchBatch);
+// SortingBatch horsVracSpeciesBatch = batchHelper.getSortingBatch(
+// catchBatch,
+// "Hors Vrac > Species",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (horsVracSpeciesBatch != null) {
for (Batch batch : horsVracSpeciesBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch;
@@ -286,6 +296,28 @@
}
@Override
+ public Multimap<Species, SpeciesBatchFrequency> getAllSpeciesBatchFrequencyForBatch(BatchContainer<SpeciesBatch> batchContainer) {
+ Multimap<Species, SpeciesBatchFrequency> result = ArrayListMultimap.create();
+ for (SpeciesBatch speciesBatch : batchContainer.getChildren()) {
+ getAllSpeciesBatchFrequencyForBatch(speciesBatch, result);
+ }
+ return result;
+ }
+
+ protected void getAllSpeciesBatchFrequencyForBatch(SpeciesBatch batch,
+ Multimap<Species, SpeciesBatchFrequency> result) {
+
+ List<SpeciesBatchFrequency> speciesBatchFrequency = getAllSpeciesBatchFrequency(batch.getId());
+ result.putAll(batch.getSpecies(), speciesBatchFrequency);
+
+ if (!batch.isChildBatchsEmpty()) {
+ for (SpeciesBatch child : batch.getChildBatchs()) {
+ getAllSpeciesBatchFrequencyForBatch(child, result);
+ }
+ }
+ }
+
+ @Override
public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(
String speciesBatchId,
List<SpeciesBatchFrequency> frequencies) {
@@ -423,7 +455,7 @@
if (source.getSortingMeasurements().size() == 1) {
sm = source.getSortingMeasurements().iterator().next();
} else if (source.getReferenceTaxon() != null && source.getReferenceTaxon().getId() != null) {
- sm = batchHelper.getInheritedSortingMeasurement(source);
+ sm = measurementPersistenceHelper.getInheritedSortingMeasurement(source);
}
if (sm != null) {
@@ -562,12 +594,12 @@
// Weight or SampleCategoryWeight
if (source.getSampleCategoryWeight() != null && source.getWeight() == null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getSampleCategoryWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
} else if (source.getWeight() != null && source.getSampleCategoryWeight() == null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -582,7 +614,7 @@
samplingRatioText = samplingRatioText.replaceAll(",", ".");
target.setSamplingRatioText(samplingRatioText);
target.setSamplingRatio(source.getWeight() / source.getSampleCategoryWeight());
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -593,7 +625,7 @@
Integer pmfmId = source.getSampleCategoryId();
// Do not store sorting measurement if pmfm = SORTED (already store in an ancestor batch)
if (!pmfmId.equals(enumeration.PMFM_ID_SORTED_UNSORTED)) {
- SortingMeasurement sortingMeasurement = batchHelper.setSortingMeasurement(
+ SortingMeasurement sortingMeasurement = measurementPersistenceHelper.setSortingMeasurement(
target,
pmfmId,
source.getSampleCategoryValue());
@@ -671,7 +703,7 @@
// Weight or SampleCategoryWeight
if (source.getWeight() != null) {
- QuantificationMeasurement quantificationMeasurement = batchHelper.setWeightMeasurementQuantificationMeasurement(
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
target,
source.getWeight());
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
@@ -680,8 +712,8 @@
// Sorting measurement
if ((source.getLengthStepCaracteristic() != null && source.getLengthStep() != null)) {
Integer pmfmId = source.getLengthStepCaracteristic().getIdAsInt();
- SortingMeasurement sortingMeasurement = batchHelper.setSortingMeasurement(target, pmfmId,
- source.getLengthStep());
+ SortingMeasurement sortingMeasurement = measurementPersistenceHelper.setSortingMeasurement(target, pmfmId,
+ source.getLengthStep());
notChangedSortingMeasurements.remove(sortingMeasurement);
}
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -0,0 +1,54 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
+import org.nuiton.util.Version;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Contains some technical services.
+ * <p/>
+ * Created on 4/20/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.5
+ */
+@Transactional(readOnly = true)
+public interface TechnicalPersistenceService extends TuttiPersistenceServiceImplementor {
+
+ /**
+ * @return the enumeration file (where all constant mapping are defined).
+ * @since 2.4
+ */
+ TuttiEnumerationFile getEnumerationFile();
+
+ /**
+ * To clear all caches.
+ *
+ * @since 1.0.1
+ */
+ void clearAllCaches();
+
+ /**
+ * To invoke the given call code.
+ * <p/>
+ * <strong>Note:</strong> this is mainly to execute a code in a single
+ * transaction.
+ *
+ * @param call call to invoke
+ * @param <V> return type
+ * @return the return of the call
+ * @since 2.4
+ */
+ @Transactional(readOnly = false)
+ <V> V invoke(Callable<V> call);
+
+ Version getDbVersion();
+
+ Version getApplicationVersion();
+
+ void updateSchema();
+
+ void sanityDb();
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -0,0 +1,100 @@
+package fr.ifremer.tutti.persistence.service;
+
+import fr.ifremer.adagio.core.dao.technical.DatabaseSchemaDao;
+import fr.ifremer.adagio.core.dao.technical.DatabaseSchemaUpdateException;
+import fr.ifremer.adagio.core.dao.technical.VersionNotFoundException;
+import fr.ifremer.adagio.core.service.technical.CacheService;
+import fr.ifremer.adagio.core.service.technical.sanity.DatabaseSanityService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.jaxx.application.ApplicationTechnicalException;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.concurrent.Callable;
+
+/**
+ * Created on 4/20/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.5
+ */
+@Service("technicalPersistenceService")
+public class TechnicalPersistenceServiceImpl extends AbstractPersistenceService implements TechnicalPersistenceService {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(TechnicalPersistenceServiceImpl.class);
+
+ @Resource(name = "databaseSanityService")
+ protected DatabaseSanityService databaseSanityService;
+
+ @Resource(name = "cacheService")
+ protected CacheService cacheService;
+
+ @Resource(name = "databaseSchemaDao")
+ protected DatabaseSchemaDao databaseSchemaDao;
+
+ @Override
+ public TuttiEnumerationFile getEnumerationFile() {
+ return enumeration;
+ }
+
+ @Override
+ public <V> V invoke(Callable<V> call) {
+
+ try {
+ V result = call.call();
+ return result;
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ApplicationTechnicalException(e);
+ }
+ }
+
+ @Override
+ public Version getDbVersion() {
+ Version version = getDbVersion0();
+ return version;
+ }
+
+ private Version getDbVersion0() {
+ fr.ifremer.adagio.core.dao.technical.Version version;
+ try {
+ version = databaseSchemaDao.getSchemaVersion();
+ } catch (VersionNotFoundException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not find db version", e);
+ }
+ version = null;
+ }
+ return version == null ? null : VersionUtil.valueOf(version.toString());
+ }
+
+ @Override
+ public Version getApplicationVersion() {
+ fr.ifremer.adagio.core.dao.technical.Version version = databaseSchemaDao.getSchemaVersionIfUpdate();
+ return VersionUtil.valueOf(version.toString());
+ }
+
+ @Override
+ public void updateSchema() {
+ try {
+ databaseSchemaDao.updateSchema();
+ } catch (DatabaseSchemaUpdateException e) {
+ throw new ApplicationTechnicalException(e.getCause());
+ }
+ }
+
+ @Override
+ public void sanityDb() {
+ databaseSanityService.sanity();
+ }
+
+ @Override
+ public void clearAllCaches() {
+ cacheService.clearAllCaches();
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TechnicalPersistenceServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiPersistenceServiceLocator.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -61,6 +61,11 @@
TuttiPersistence.class);
}
+ public static TechnicalPersistenceService getTechnicalPersistenceService() {
+ return instance().getService("technicalPersistenceService",
+ TechnicalPersistenceService.class);
+ }
+
public static ReferentialPersistenceService getReferentialPersistenceService() {
return instance().getService("referentialPersistenceService",
ReferentialPersistenceService.class);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -27,7 +27,6 @@
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
@@ -35,9 +34,7 @@
import fr.ifremer.adagio.core.dao.data.batch.SortingBatchDao;
import fr.ifremer.adagio.core.dao.data.batch.validator.CatchBatchValidationError;
import fr.ifremer.adagio.core.dao.data.batch.validator.CatchBatchValidationException;
-import fr.ifremer.adagio.core.dao.data.measure.QuantificationMeasurement;
import fr.ifremer.adagio.core.dao.data.measure.SortingMeasurement;
-import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
import fr.ifremer.adagio.core.dao.referential.pmfm.Pmfm;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
import fr.ifremer.tutti.persistence.entities.TuttiEntity;
@@ -52,12 +49,8 @@
import fr.ifremer.tutti.persistence.service.AbstractPersistenceService;
import fr.ifremer.tutti.persistence.service.AttachmentPersistenceService;
import fr.ifremer.tutti.persistence.service.IndividualObservationBatchPersistenceService;
-import fr.ifremer.tutti.persistence.service.MeasurementPersistenceHelper;
import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.stereotype.Component;
@@ -65,9 +58,7 @@
import javax.annotation.Resource;
import java.io.Serializable;
import java.text.MessageFormat;
-import java.util.Collection;
import java.util.List;
-import java.util.Set;
import static org.nuiton.i18n.I18n.t;
@@ -80,9 +71,9 @@
@Component("batchPersistenceHelper")
public class BatchPersistenceHelper extends AbstractPersistenceService {
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(BatchPersistenceHelper.class);
+// /** Logger. */
+// private static final Log log =
+// LogFactory.getLog(BatchPersistenceHelper.class);
@Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@@ -102,9 +93,12 @@
@Resource(name = "scientificCruiseCatchBatchValidator")
protected TuttiCatchBatchValidator catchBatchValidator;
- @Autowired
- protected MeasurementPersistenceHelper measurementPersistenceHelper;
+// @Resource(name = "measurementPersistenceHelper")
+// protected MeasurementPersistenceHelper measurementPersistenceHelper;
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
+
@Override
public void init() {
super.init();
@@ -225,13 +219,13 @@
catchBatchDao.updateSortingBatch(sortingBatch, parentCatchBatch);
}
- public SortingMeasurement getInheritedSortingMeasurement(SortingBatch sortingBatch) {
- return catchBatchDao.getInheritedSortingMeasurement(sortingBatch, enumeration.PMFM_ID_SORTED_UNSORTED);
- }
+// public SortingMeasurement getInheritedSortingMeasurement(SortingBatch sortingBatch) {
+// return catchBatchDao.getInheritedSortingMeasurement(sortingBatch, enumeration.PMFM_ID_SORTED_UNSORTED);
+// }
- public QuantificationMeasurement setWeightMeasurementQuantificationMeasurement(Batch batch, Float weightValue) {
- return catchBatchDao.setQuantificationMeasurement(batch, enumeration.PMFM_ID_WEIGHT_MEASURED, getRecorderDepartmentId(), weightValue, true);
- }
+// public QuantificationMeasurement setWeightMeasurementQuantificationMeasurement(Batch batch, Float weightValue) {
+// return catchBatchDao.setQuantificationMeasurement(batch, enumeration.PMFM_ID_WEIGHT_MEASURED, getRecorderDepartmentId(), weightValue, true);
+// }
public List<SortingBatch> getFrequencyChilds(SampleCategoryModel sampleCategoryModel,
SortingBatch sortingBatch) {
@@ -338,62 +332,66 @@
if (enumeration.QUALITATIVE_VRAC_ID.equals(qualitativeValueId)) {
// get vrac / Species / Alive itemized batch
- parentBatch = getSortingBatch(
- catchBatch,
- "Vrac > Species > Alive Itemized",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
- enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ parentBatch = batchTreeHelper.getSpeciesVracAliveItemizedRootBatch(catchBatch);
+// parentBatch = getSortingBatch(
+// catchBatch,
+// "Vrac > Species > Alive Itemized",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+// enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
if (parentBatch == null) {
// get vrac batch
- SortingBatch vracBatch = getSortingBatch(
- catchBatch,
- "Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = batchTreeHelper.getVracBatch(catchBatch);
+// SortingBatch vracBatch = getSortingBatch(
+// catchBatch,
+// "Vrac",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
if (vracBatch == null) {
// create vrac batch
- vracBatch = getOrCreateVracBatch(catchBatch, null, null);
+ vracBatch = batchTreeHelper.getOrCreateVracBatch(catchBatch, null, null);
}
// get vrac > species batch
- SortingBatch vracSpeciesBatch = getSortingBatch(
- vracBatch,
- "Vrac > Species",
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch vracSpeciesBatch = batchTreeHelper.getSpeciesVracRootBatch(vracBatch);
+// SortingBatch vracSpeciesBatch = getSortingBatch(
+// vracBatch,
+// "Vrac > Species",
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (vracSpeciesBatch == null) {
// create vrac > species batch
- vracSpeciesBatch = getOrCreateSpeciesVracRootBatch(catchBatch, vracBatch, null);
+ vracSpeciesBatch = batchTreeHelper.getOrCreateSpeciesVracRootBatch(catchBatch, vracBatch, null);
}
// create vrac > species > Alive itemized batch
- parentBatch = getOrCreateSpeciesVracAliveItemizeRootBatch(catchBatch, vracSpeciesBatch);
+ parentBatch = batchTreeHelper.getOrCreateSpeciesVracAliveItemizedRootBatch(catchBatch, vracSpeciesBatch);
}
} else if (enumeration.QUALITATIVE_HORS_VRAC_ID.equals(qualitativeValueId)) {
// get hors vrac > Species batch
- parentBatch = getSortingBatch(
- catchBatch,
- "Hors vrac > Species",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ parentBatch = batchTreeHelper.getSpeciesHorsVracRootBatch(catchBatch);
+// parentBatch = getSortingBatch(
+// catchBatch,
+// "Hors vrac > Species",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (parentBatch == null) {
// get (or create) hors vrac batch
- SortingBatch horsVracBatch = getOrCreateHorsVracBatch(catchBatch);
+ SortingBatch horsVracBatch = batchTreeHelper.getOrCreateHorsVracBatch(catchBatch);
// create hors vrac > species batch
- parentBatch = getOrCreateSpeciesHorsVracRootBatch(
+ parentBatch = batchTreeHelper.getOrCreateSpeciesHorsVracRootBatch(
catchBatch,
horsVracBatch);
}
@@ -441,63 +439,67 @@
if (enumeration.QUALITATIVE_VRAC_ID.equals(qualitativeValueId)) {
// Vrac > Benthos > Alive Itemized
- parentBatch = getSortingBatch(
- catchBatch,
- "Vrac > Species > Alive Itemized",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
- enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ parentBatch = batchTreeHelper.getBenthosVracAliveItemizedRootBatch(catchBatch);
+// parentBatch = getSortingBatch(
+// catchBatch,
+// "Vrac > Species > Alive Itemized",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+// enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
if (parentBatch == null) {
// get vrac batch
- SortingBatch vracBatch = getSortingBatch(
- catchBatch,
- "Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = batchTreeHelper.getVracBatch(catchBatch);
+// SortingBatch vracBatch = getSortingBatch(
+// catchBatch,
+// "Vrac",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
if (vracBatch == null) {
// create vrac batch
- vracBatch = getOrCreateVracBatch(catchBatch, null, null);
+ vracBatch = batchTreeHelper.getOrCreateVracBatch(catchBatch, null, null);
}
// get vrac > Benthos batch
- SortingBatch vracBenthosBatch = getSortingBatch(
- vracBatch,
- "Vrac > Benthos",
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch vracBenthosBatch = batchTreeHelper.getBenthosVracRootBatch(vracBatch);
+// SortingBatch vracBenthosBatch = getSortingBatch(
+// vracBatch,
+// "Vrac > Benthos",
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (vracBenthosBatch == null) {
// create vrac > Benthos batch
- vracBenthosBatch = getOrCreateBenthosVracRootBatch(catchBatch, vracBatch, null);
+ vracBenthosBatch = batchTreeHelper.getOrCreateBenthosVracRootBatch(catchBatch, vracBatch, null);
}
// create vrac > Benthos > Alive itemized batch
- parentBatch = getOrCreateBenthosVracAliveItemizeRootBatch(catchBatch, vracBenthosBatch);
+ parentBatch = batchTreeHelper.getOrCreateBenthosVracAliveItemizedRootBatch(catchBatch, vracBenthosBatch);
}
} else if (enumeration.QUALITATIVE_HORS_VRAC_ID.equals(qualitativeValueId)) {
// get hors-vrac > Benthos batch
- parentBatch = getSortingBatch(
- catchBatch,
- "Hors vrac > Benthos",
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ parentBatch = batchTreeHelper.getBenthosHorsVracRootBatch(catchBatch);
+// parentBatch = getSortingBatch(
+// catchBatch,
+// "Hors vrac > Benthos",
+// enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+// enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (parentBatch == null) {
// get (or create) hors vrac batch
- SortingBatch horsVracBatch = getOrCreateHorsVracBatch(catchBatch);
+ SortingBatch horsVracBatch = batchTreeHelper.getOrCreateHorsVracBatch(catchBatch);
// create hors vrac > Benthos batch
- parentBatch = getOrCreateBenthosHorsVracRootBatch(
+ parentBatch = batchTreeHelper.getOrCreateBenthosHorsVracRootBatch(
catchBatch,
horsVracBatch);
}
@@ -512,6 +514,23 @@
target.setParentBatch(parentBatch);
}
+ public void setMarineLitterBatchParents(SortingBatch target, CatchBatch catchBatch) {
+
+ Preconditions.checkNotNull(target);
+
+ SortingBatch parentBatch = batchTreeHelper.getMarineLitterRootBatch(catchBatch);
+
+ if (parentBatch == null) {
+
+ SortingBatch horsVracBatch = batchTreeHelper.getOrCreateHorsVracBatch(catchBatch);
+
+ parentBatch = batchTreeHelper.getOrCreateMarineLitterRootBatch(catchBatch, horsVracBatch, null);
+ }
+
+ target.setParentBatch(parentBatch);
+ target.setRootBatch(catchBatch);
+ }
+
public Integer convertSampleCategoryValueIntoQualitativeId(Serializable value) {
if (value == null) {
return null;
@@ -526,343 +545,342 @@
return qualitativeValueId;
}
- public SortingBatch getSortingBatch(Batch source,
- String debugMessage,
- Integer... ids) {
+// public SortingBatch getSortingBatch(Batch source,
+// String debugMessage,
+// Integer... ids) {
+//
+// return getSortingBatch(source.getChildBatchs(), debugMessage, ids);
+// }
- return getSortingBatch(source.getChildBatchs(), debugMessage, ids);
- }
+// public SortingBatch getSortingBatch(Collection<Batch> childs,
+// String debugMessage,
+// Integer... ids) {
+//
+// int nbParams = ids.length / 2;
+//
+// Object[] params = new Object[nbParams * 3];
+// for (int i = 0; i < nbParams; i++) {
+// Integer sortingPmfmId = ids[2 * i];
+// Integer sortingQualitativeValueId = ids[2 * i + 1];
+// params[3 * i] = CatchBatchExtendDao.PMFM_ID;
+// params[3 * i + 1] = sortingPmfmId;
+// params[3 * i + 2] = sortingQualitativeValueId;
+// }
+// SortingBatch result = catchBatchDao.getSortingBatch(childs, params);
+// if (result != null && debugMessage != null && log.isDebugEnabled()) {
+// log.debug("Loaded " + debugMessage + ": " + result.getId());
+// }
+// return result;
+// }
- public SortingBatch getSortingBatch(Collection<Batch> childs,
- String debugMessage,
- Integer... ids) {
+// public SortingBatch getVracBatch(CatchBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_VRAC_ID
+// );
+// }
- int nbParams = ids.length / 2;
+// public SortingBatch getOrCreateVracBatch(CatchBatch batch,
+// Float weight,
+// Float weightBeforeSampling) {
+// return getOrCreate(
+// batch,
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_VRAC_ID,
+// weight,
+// weightBeforeSampling,
+// (short) 1
+// );
+// }
- Object[] params = new Object[nbParams * 3];
- for (int i = 0; i < nbParams; i++) {
- Integer sortingPmfmId = ids[2 * i];
- Integer sortingQualitativeValueId = ids[2 * i + 1];
- params[3 * i] = CatchBatchExtendDao.PMFM_ID;
- params[3 * i + 1] = sortingPmfmId;
- params[3 * i + 2] = sortingQualitativeValueId;
- }
- SortingBatch result = catchBatchDao.getSortingBatch(childs, params);
- if (result != null && debugMessage != null && log.isDebugEnabled()) {
- log.debug("Loaded " + debugMessage + ": " + result.getId());
- }
- return result;
- }
+// public SortingBatch getSpeciesVracRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+// );
+// }
- public SortingBatch getVracBatch(CatchBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_VRAC_ID
- );
- }
+// public SortingBatch getOrCreateSpeciesVracRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+// totalWeight,
+// (short) 1
+// );
+// }
- public SortingBatch getOrCreateVracBatch(CatchBatch batch,
- Float weight,
- Float weightBeforeSampling) {
- return getOrCreate(
- batch,
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_VRAC_ID,
- weight,
- weightBeforeSampling,
- (short) 1
- );
- }
+// public SortingBatch getSpeciesVracAliveNotItemizedRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+// );
+// }
- public SortingBatch getSpeciesVracRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
- );
- }
+// public SortingBatch getOrCreateSpeciesVracAliveNotItemizedRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+// totalWeight,
+// (short) 1
+// );
+// }
- public SortingBatch getOrCreateSpeciesVracRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
- totalWeight,
- (short) 1
- );
- }
+// public SortingBatch getSpeciesVracInertRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+// );
+// }
- public SortingBatch getSpeciesVracAliveNotItemizeRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
- );
- }
+// public SortingBatch getOrCreateSpeciesVracInertRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+// totalWeight,
+// (short) 2
+// );
+// }
- public SortingBatch getOrCreateSpeciesVracAliveNotItemizeRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
- totalWeight,
- (short) 1
- );
- }
+// public SortingBatch getSpeciesVracAliveItemizeRootBatch(
+// SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+// );
+// }
- public SortingBatch getSpeciesVracInertRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
- );
- }
+// public SortingBatch getOrCreateSpeciesVracAliveItemizedRootBatch(CatchBatch target,
+// SortingBatch batch) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+// null,
+// (short) 3
+// );
+// }
- public SortingBatch getOrCreateSpeciesVracInertRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
- totalWeight,
- (short) 2
- );
- }
+// public SortingBatch getBenthosVracRootBatch(
+// SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+// );
+// }
- public SortingBatch getSpeciesVracAliveItemizeRootBatch(
- SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
- );
- }
+// public SortingBatch getOrCreateBenthosVracRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+// totalWeight,
+// (short) 2
+// );
+// }
- public SortingBatch getOrCreateSpeciesVracAliveItemizeRootBatch(CatchBatch target,
- SortingBatch batch) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
- null,
- (short) 3
- );
- }
+// public SortingBatch getBenthosVracAliveNotItemizedRootBatch(
+// SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+// );
+// }
- public SortingBatch getBenthosVracRootBatch(
- SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
- );
- }
+// public SortingBatch getOrCreateBenthosVracAliveNotItemizedRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+// totalWeight,
+// (short) 1
+// );
+// }
- public SortingBatch getOrCreateBenthosVracRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
- totalWeight,
- (short) 2
- );
- }
+// public SortingBatch getBenthosVracInertRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+// );
+// }
- public SortingBatch getBenthosVracAliveNotItemizeRootBatch(
- SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
- );
- }
+// public SortingBatch getOrCreateBenthosVracInertRootBatch(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+// totalWeight,
+// (short) 2
+// );
+// }
- public SortingBatch getOrCreateBenthosVracAliveNotItemizeRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
- totalWeight,
- (short) 1
- );
- }
+// public SortingBatch getBenthosVracAliveItemizeRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+// );
+// }
- public SortingBatch getBenthosVracInertRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
- );
- }
+// public SortingBatch getOrCreateBenthosVracAliveItemizedRootBatch(CatchBatch target,
+// SortingBatch batch) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE_2,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+// null,
+// (short) 3
+// );
+// }
- public SortingBatch getOrCreateBenthosVracInertRootBatch(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
- totalWeight,
- (short) 2
- );
- }
+// public SortingBatch getHorsVracBatch(CatchBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_HORS_VRAC_ID
+// );
+// }
- public SortingBatch getBenthosVracAliveItemizeRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
- );
- }
+// public SortingBatch getOrCreateHorsVracBatch(CatchBatch batch) {
+// return getOrCreate(
+// batch,
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_HORS_VRAC_ID,
+// null,
+// (short) 2
+// );
+// }
- public SortingBatch getOrCreateBenthosVracAliveItemizeRootBatch(CatchBatch target,
- SortingBatch batch) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
- null,
- (short) 3
- );
- }
+// public SortingBatch getSpeciesHorsVracRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+// );
+// }
- public SortingBatch getHorsVracBatch(CatchBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID
- );
- }
+// public SortingBatch getOrCreateSpeciesHorsVracRootBatch(CatchBatch target,
+// SortingBatch batch) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+// null,
+// (short) 1
+// );
+// }
- public SortingBatch getOrCreateHorsVracBatch(CatchBatch batch) {
- return getOrCreate(
- batch,
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID,
- null,
- (short) 2
- );
- }
+// public SortingBatch getBenthosHorsVracRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+// );
+// }
- public SortingBatch getSpeciesHorsVracRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
- );
- }
+// public SortingBatch getOrCreateBenthosHorsVracRootBatch(CatchBatch target,
+// SortingBatch batch) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+// null,
+// (short) 2
+// );
+// }
- public SortingBatch getOrCreateSpeciesHorsVracRootBatch(CatchBatch target,
- SortingBatch batch) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
- null,
- (short) 1
- );
- }
+// public SortingBatch getMarineLitterRootBatch(SortingBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER
+// );
+// }
- public SortingBatch getBenthosHorsVracRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
- );
- }
+// public SortingBatch getOrCreateMarineLitterRootBatch(CatchBatch target,
+// SortingBatch batch,
+// Float totalWeight) {
+// return getOrCreate(
+// target,
+// batch,
+// enumeration.PMFM_ID_SORTING_TYPE,
+// enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER,
+// totalWeight,
+// (short) 3
+// );
+// }
- public SortingBatch getOrCreateBenthosHorsVracRootBatch(CatchBatch target,
- SortingBatch batch) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
- null,
- (short) 2
- );
- }
+// public SortingBatch getRejectedBatch(CatchBatch batch) {
+// return get(
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_UNSORTED_ID
+// );
+// }
- public SortingBatch getMarineLitterRootBatch(SortingBatch batch) {
- return get(
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER
- );
- }
+// public SortingBatch getOrCreateRejectedBatch(CatchBatch batch,
+// Float weight) {
+//
+// return getOrCreate(
+// batch,
+// batch,
+// enumeration.PMFM_ID_SORTED_UNSORTED,
+// enumeration.QUALITATIVE_UNSORTED_ID,
+// weight,
+// (short) 3
+// );
+// }
- public SortingBatch getOrCreateMarineLitterRootBatch(CatchBatch target,
- SortingBatch batch,
- Float totalWeight) {
- return getOrCreate(
- target,
- batch,
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER,
- totalWeight,
- (short) 3
- );
- }
+// public SortingMeasurement setSortingMeasurement(
+// SortingBatch sortingBatch,
+// Integer pmfmId,
+// Serializable value) {
+// Preconditions.checkNotNull(pmfmId);
+// Preconditions.checkNotNull(value);
+//
+// Caracteristic caracteristic = referentialService.getCaracteristic(pmfmId);
+// SortingMeasurement sortingMeasurement = catchBatchDao.getSortingMeasurement(
+// sortingBatch, pmfmId, getRecorderDepartmentId(), true);
+// measurementPersistenceHelper.setMeasurement(sortingMeasurement,
+// caracteristic,
+// value);
+// return sortingMeasurement;
+// }
- public SortingBatch getRejectedBatch(CatchBatch batch) {
-
- return get(
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_UNSORTED_ID
- );
- }
-
- public SortingBatch getOrCreateRejectedBatch(CatchBatch batch,
- Float weight) {
-
- return getOrCreate(
- batch,
- batch,
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_UNSORTED_ID,
- weight,
- (short) 3
- );
- }
-
- public SortingMeasurement setSortingMeasurement(
- SortingBatch sortingBatch,
- Integer pmfmId,
- Serializable value) {
- Preconditions.checkNotNull(pmfmId);
- Preconditions.checkNotNull(value);
-
- Caracteristic caracteristic = referentialService.getCaracteristic(pmfmId);
- SortingMeasurement sortingMeasurement = catchBatchDao.getSortingMeasurement(
- sortingBatch, pmfmId, getRecorderDepartmentId(), true);
- measurementPersistenceHelper.setMeasurement(sortingMeasurement,
- caracteristic,
- value);
- return sortingMeasurement;
- }
-
public Serializable getSampleCategoryQualitative(Integer pmfmId,
Float numericalvalue,
String alphanumericalValue,
@@ -927,124 +945,124 @@
return result;
}
- protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
- Batch batch,
- Integer pmfmId,
- Integer pmfmValue,
- Float totalWeight,
- short rankOrder) {
- return getOrCreate(
- target,
- batch,
- pmfmId,
- pmfmValue,
- totalWeight,
- null,
- rankOrder
- );
- }
+// protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
+// Batch batch,
+// Integer pmfmId,
+// Integer pmfmValue,
+// Float totalWeight,
+// short rankOrder) {
+// return getOrCreate(
+// target,
+// batch,
+// pmfmId,
+// pmfmValue,
+// totalWeight,
+// null,
+// rankOrder
+// );
+// }
- protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
- Batch parentBatch,
- Integer sortingPmfmId,
- Integer sortingQualitativeValueId,
- Float weight,
- Float weightBeforeSampling,
- short rankOrder) {
- SortingBatch result = get(
- parentBatch,
- sortingPmfmId,
- sortingQualitativeValueId);
+// protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
+// Batch parentBatch,
+// Integer sortingPmfmId,
+// Integer sortingQualitativeValueId,
+// Float weight,
+// Float weightBeforeSampling,
+// short rankOrder) {
+// SortingBatch result = batchTreeHelper.get(
+// parentBatch,
+// sortingPmfmId,
+// sortingQualitativeValueId);
+//
+// if (result == null) {
+//
+// result = SortingBatch.Factory.newInstance();
+// if (parentBatch.getChildBatchs() == null) {
+// parentBatch.setChildBatchs(Sets.<Batch>newHashSet());
+// }
+// parentBatch.getChildBatchs().add(result);
+//
+// Collection<SortingMeasurement> sortingMeasurements = result.getSortingMeasurements();
+//
+// // Create lists to store all updates, then remove not updated items
+// Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
+// if (sortingMeasurements != null) {
+// notChangedSortingMeasurements.addAll(sortingMeasurements);
+// }
+//
+// // Some mandatory properties :
+// QualityFlagImpl qualityFlag = load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED);
+// result.setQualityFlag(qualityFlag);
+// result.setRootBatch(rootBatch);
+// result.setParentBatch(parentBatch);
+// result.setExhaustiveInventory(true);
+//
+// // No taxon or taxon group
+// result.setReferenceTaxon(null);
+// result.setTaxonGroup(null);
+//
+// result.setRankOrder(rankOrder);
+//
+// // Sorting measurement
+// if (sortingPmfmId != null && sortingQualitativeValueId != null) {
+// SortingMeasurement sm = setSortingMeasurement(
+// result,
+// sortingPmfmId,
+// sortingQualitativeValueId);
+// notChangedSortingMeasurements.remove(sm);
+// }
+// // Removed not changed sorting measurements
+// if (sortingMeasurements != null) {
+// sortingMeasurements.removeAll(notChangedSortingMeasurements);
+// }
+//
+// catchBatchDao.createSortingBatch(result, rootBatch);
+// }
+//
+// Collection<QuantificationMeasurement> quantificationMeasurements = result.getQuantificationMeasurements();
+// Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
+// if (quantificationMeasurements != null) {
+// notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
+// }
+//
+// // Sampling Ratio
+// if (weightBeforeSampling == null || weight == null) {
+// result.setSamplingRatio(null);
+// result.setSamplingRatioText(null);
+// } else {
+// String samplingRatioText = weight + "/" + weightBeforeSampling;
+// samplingRatioText = samplingRatioText.replaceAll(",", ".");
+// result.setSamplingRatioText(samplingRatioText);
+// result.setSamplingRatio(weight / weightBeforeSampling);
+// }
+//
+// // Weight
+// if (weightBeforeSampling != null || weight != null) {
+// Float batchReferenceWeight = weight;
+// if (batchReferenceWeight == null) {
+// batchReferenceWeight = weightBeforeSampling;
+// }
+// QuantificationMeasurement quantificationMeasurement = setWeightMeasurementQuantificationMeasurement(
+// result,
+// batchReferenceWeight);
+// notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+// }
+// // Removed not changed quantification measurements
+// if (quantificationMeasurements != null) {
+// quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
+// }
+//
+// return result;
+// }
- if (result == null) {
-
- result = SortingBatch.Factory.newInstance();
- if (parentBatch.getChildBatchs() == null) {
- parentBatch.setChildBatchs(Sets.<Batch>newHashSet());
- }
- parentBatch.getChildBatchs().add(result);
-
- Collection<SortingMeasurement> sortingMeasurements = result.getSortingMeasurements();
-
- // Create lists to store all updates, then remove not updated items
- Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
- if (sortingMeasurements != null) {
- notChangedSortingMeasurements.addAll(sortingMeasurements);
- }
-
- // Some mandatory properties :
- QualityFlagImpl qualityFlag = load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED);
- result.setQualityFlag(qualityFlag);
- result.setRootBatch(rootBatch);
- result.setParentBatch(parentBatch);
- result.setExhaustiveInventory(true);
-
- // No taxon or taxon group
- result.setReferenceTaxon(null);
- result.setTaxonGroup(null);
-
- result.setRankOrder(rankOrder);
-
- // Sorting measurement
- if (sortingPmfmId != null && sortingQualitativeValueId != null) {
- SortingMeasurement sm = setSortingMeasurement(
- result,
- sortingPmfmId,
- sortingQualitativeValueId);
- notChangedSortingMeasurements.remove(sm);
- }
- // Removed not changed sorting measurements
- if (sortingMeasurements != null) {
- sortingMeasurements.removeAll(notChangedSortingMeasurements);
- }
-
- catchBatchDao.createSortingBatch(result, rootBatch);
- }
-
- Collection<QuantificationMeasurement> quantificationMeasurements = result.getQuantificationMeasurements();
- Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
- if (quantificationMeasurements != null) {
- notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
- }
-
- // Sampling Ratio
- if (weightBeforeSampling == null || weight == null) {
- result.setSamplingRatio(null);
- result.setSamplingRatioText(null);
- } else {
- String samplingRatioText = weight + "/" + weightBeforeSampling;
- samplingRatioText = samplingRatioText.replaceAll(",", ".");
- result.setSamplingRatioText(samplingRatioText);
- result.setSamplingRatio(weight / weightBeforeSampling);
- }
-
- // Weight
- if (weightBeforeSampling != null || weight != null) {
- Float batchReferenceWeight = weight;
- if (batchReferenceWeight == null) {
- batchReferenceWeight = weightBeforeSampling;
- }
- QuantificationMeasurement quantificationMeasurement = setWeightMeasurementQuantificationMeasurement(
- result,
- batchReferenceWeight);
- notChangedQuantificationMeasurements.remove(quantificationMeasurement);
- }
- // Removed not changed quantification measurements
- if (quantificationMeasurements != null) {
- quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
- }
-
- return result;
- }
-
- protected SortingBatch get(Batch parentBatch,
- Integer sortingPmfmId,
- Integer sortingQualitativeValueId) {
- SortingBatch result = getSortingBatch(
- parentBatch,
- null,
- sortingPmfmId,
- sortingQualitativeValueId);
- return result;
- }
+// protected SortingBatch get(Batch parentBatch,
+// Integer sortingPmfmId,
+// Integer sortingQualitativeValueId) {
+// SortingBatch result = getSortingBatch(
+// parentBatch,
+// null,
+// sortingPmfmId,
+// sortingQualitativeValueId);
+// return result;
+// }
}
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchTreeHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchTreeHelper.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchTreeHelper.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -0,0 +1,693 @@
+package fr.ifremer.tutti.persistence.service.batch;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Sets;
+import fr.ifremer.adagio.core.dao.data.batch.Batch;
+import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
+import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
+import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
+import fr.ifremer.adagio.core.dao.data.measure.QuantificationMeasurement;
+import fr.ifremer.adagio.core.dao.data.measure.SortingMeasurement;
+import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
+import fr.ifremer.adagio.core.dao.referential.pmfm.Pmfm;
+import fr.ifremer.adagio.core.dao.referential.taxon.ReferenceTaxon;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValues;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.service.AbstractPersistenceService;
+import fr.ifremer.tutti.persistence.service.MeasurementPersistenceHelper;
+import fr.ifremer.tutti.persistence.service.ReferentialPersistenceService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Helper to build or navigauet into the batch tree.
+ * <p/>
+ * Created on 4/20/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 3.5
+ */
+@Component("batchTreeHelper")
+public class BatchTreeHelper extends AbstractPersistenceService {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(BatchTreeHelper.class);
+
+ @Resource(name = "referentialPersistenceService")
+ protected ReferentialPersistenceService referentialService;
+
+ @Resource(name = "measurementPersistenceHelper")
+ protected MeasurementPersistenceHelper measurementPersistenceHelper;
+
+ @Resource(name = "catchBatchDao")
+ protected CatchBatchExtendDao catchBatchDao;
+
+ //------------------------------------------------------------------------//
+ //-- Get CatchBatch navigation methods --//
+ //------------------------------------------------------------------------//
+
+ public SortingBatch getSpeciesVracAliveItemizedRootBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Species > Alive Itemized",
+ enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+ enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
+ public SortingBatch getBenthosVracAliveItemizedRootBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Benthos > Alive itemized",
+ enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
+ enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
+ public SortingBatch getSpeciesHorsVracRootBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > Species",
+ enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+ enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+ );
+ }
+
+ public SortingBatch getBenthosHorsVracRootBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > Benthos",
+ enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+ enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+ );
+ }
+
+ public SortingBatch getMarineLitterRootBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > Marine Litter",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER
+ );
+ }
+
+ public SortingBatch getVracBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID
+ );
+ }
+
+ public SortingBatch getHorsVracBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID
+ );
+ }
+
+ public SortingBatch getRejectedBatch(CatchBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Unsorted",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Get SortingBatch navigation methods --//
+ //------------------------------------------------------------------------//
+
+ public SortingBatch getSpeciesVracRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Species",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+ );
+ }
+
+ public SortingBatch getBenthosVracRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Benthos",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+ );
+ }
+
+ public SortingBatch getSpeciesVracAliveNotItemizedRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Species" + " > Alive not itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+ );
+ }
+
+ public SortingBatch getBenthosVracAliveNotItemizedRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Benthos" + " > Alive not itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED
+ );
+ }
+
+ public SortingBatch getSpeciesVracInertRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Species" + " > Inert (not alive)",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+ );
+ }
+
+ public SortingBatch getBenthosVracInertRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Benthos" + " > Inert (not alive)",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT
+ );
+ }
+
+ public SortingBatch getSpeciesVracAliveItemizedRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Species" + " > Alive itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
+ public SortingBatch getBenthosVracAliveItemizedRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Vrac > Benthos" + " > Alive itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
+ }
+
+ public SortingBatch getSpeciesHorsVracRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > Species",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES
+ );
+ }
+
+ public SortingBatch getBenthosHorsVracRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > Benthos",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS
+ );
+ }
+
+ public SortingBatch getMarineLitterRootBatch(SortingBatch batch) {
+ return getSortingBatch(
+ batch,
+ "Hors Vrac > MarineLitter",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- getOrCreate methods --//
+ //------------------------------------------------------------------------//
+
+ public SortingBatch getOrCreateVracBatch(CatchBatch batch,
+ Float weight,
+ Float weightBeforeSampling) {
+ return getOrCreate(
+ batch,
+ batch,
+ "Vrac",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID,
+ weight,
+ weightBeforeSampling,
+ (short) 1
+ );
+ }
+
+ public SortingBatch getOrCreateSpeciesVracRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Species",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ totalWeight,
+ (short) 1
+ );
+ }
+
+ public SortingBatch getOrCreateSpeciesVracAliveNotItemizedRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Species > Alive Not Itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+ totalWeight,
+ (short) 1
+ );
+ }
+
+ public SortingBatch getOrCreateSpeciesVracInertRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Species > Inert",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+ totalWeight,
+ (short) 2
+ );
+ }
+
+ public SortingBatch getOrCreateSpeciesVracAliveItemizedRootBatch(CatchBatch target,
+ SortingBatch batch) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Benthos > Alive Itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+ null,
+ (short) 3
+ );
+ }
+
+ public SortingBatch getOrCreateBenthosVracRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Benthos",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ totalWeight,
+ (short) 2
+ );
+ }
+
+ public SortingBatch getOrCreateBenthosVracAliveNotItemizedRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Benthos > Alive Not itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+ totalWeight,
+ (short) 1
+ );
+ }
+
+ public SortingBatch getOrCreateBenthosVracInertRootBatch(fr.ifremer.adagio.core.dao.data.batch.CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Benthos > Inert",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+ totalWeight,
+ (short) 2
+ );
+ }
+
+ public SortingBatch getOrCreateBenthosVracAliveItemizedRootBatch(CatchBatch target,
+ SortingBatch batch) {
+ return getOrCreate(
+ target,
+ batch,
+ "Vrac > Benthos > Alive Itemized",
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+ null,
+ (short) 3
+ );
+ }
+
+ public SortingBatch getOrCreateHorsVracBatch(CatchBatch batch) {
+ return getOrCreate(
+ batch,
+ batch,
+ "Hors Vrac",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID,
+ null,
+ (short) 2
+ );
+ }
+
+ public SortingBatch getOrCreateSpeciesHorsVracRootBatch(CatchBatch target,
+ SortingBatch batch) {
+ return getOrCreate(
+ target,
+ batch,
+ "Hors Vrac > Species",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ null,
+ (short) 1
+ );
+ }
+
+ public SortingBatch getOrCreateBenthosHorsVracRootBatch(CatchBatch target,
+ SortingBatch batch) {
+ return getOrCreate(
+ target,
+ batch,
+ "Hors Vrac > Benthos",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ null,
+ (short) 2
+ );
+ }
+
+ public SortingBatch getOrCreateMarineLitterRootBatch(CatchBatch target,
+ SortingBatch batch,
+ Float totalWeight) {
+ return getOrCreate(
+ target,
+ batch,
+ "Hors Vrac > Marine Litter",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER,
+ totalWeight,
+ (short) 3
+ );
+ }
+
+ public SortingBatch getOrCreateRejectedBatch(CatchBatch batch,
+ Float weight) {
+
+ return getOrCreate(
+ batch,
+ batch,
+ "Unsorted",
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID,
+ weight,
+ (short) 3
+ );
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Internal methods --//
+ //------------------------------------------------------------------------//
+
+ protected SortingBatch get(Batch parentBatch,
+ Integer sortingPmfmId,
+ Integer sortingQualitativeValueId) {
+ SortingBatch result = getSortingBatch(
+ parentBatch,
+ null,
+ sortingPmfmId,
+ sortingQualitativeValueId);
+ return result;
+ }
+
+ protected SortingBatch getSortingBatch(Batch source,
+ String debugMessage,
+ Integer... ids) {
+
+ return getSortingBatch(source.getChildBatchs(), debugMessage, ids);
+ }
+
+ protected SortingBatch getSortingBatch(Collection<Batch> childs,
+ String debugMessage,
+ Integer... ids) {
+
+ int nbParams = ids.length / 2;
+
+ Object[] params = new Object[nbParams * 3];
+ for (int i = 0; i < nbParams; i++) {
+ Integer sortingPmfmId = ids[2 * i];
+ Integer sortingQualitativeValueId = ids[2 * i + 1];
+ params[3 * i] = CatchBatchExtendDao.PMFM_ID;
+ params[3 * i + 1] = sortingPmfmId;
+ params[3 * i + 2] = sortingQualitativeValueId;
+ }
+ SortingBatch result = catchBatchDao.getSortingBatch(childs, params);
+ if (result != null && debugMessage != null && log.isDebugEnabled()) {
+ log.debug("Loaded " + debugMessage + ": " + result.getId());
+ }
+ return result;
+ }
+
+ protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
+ Batch batch,
+ String debugMessage,
+ Integer sortingPmfmId,
+ Integer sortingQualitativeValueId,
+ Float totalWeight,
+ short rankOrder) {
+ return getOrCreate(
+ rootBatch,
+ batch,
+ debugMessage,
+ sortingPmfmId,
+ sortingQualitativeValueId,
+ totalWeight,
+ null,
+ rankOrder
+ );
+ }
+
+ protected SortingBatch getOrCreate(fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
+ Batch batch,
+ String debugMessage,
+ Integer sortingPmfmId,
+ Integer sortingQualitativeValueId,
+ Float weight,
+ Float weightBeforeSampling,
+ short rankOrder) {
+ SortingBatch result = getSortingBatch(
+ batch,
+ debugMessage,
+ sortingPmfmId,
+ sortingQualitativeValueId);
+
+ if (result == null) {
+
+ result = SortingBatch.Factory.newInstance();
+ if (batch.getChildBatchs() == null) {
+ batch.setChildBatchs(Sets.<Batch>newHashSet());
+ }
+ batch.getChildBatchs().add(result);
+
+ Collection<SortingMeasurement> sortingMeasurements = result.getSortingMeasurements();
+
+ // Create lists to store all updates, then remove not updated items
+ Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
+ if (sortingMeasurements != null) {
+ notChangedSortingMeasurements.addAll(sortingMeasurements);
+ }
+
+ // Some mandatory properties :
+ QualityFlagImpl qualityFlag = load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED);
+ result.setQualityFlag(qualityFlag);
+ result.setRootBatch(rootBatch);
+ result.setParentBatch(batch);
+ result.setExhaustiveInventory(true);
+
+ // No taxon or taxon group
+ result.setReferenceTaxon(null);
+ result.setTaxonGroup(null);
+
+ result.setRankOrder(rankOrder);
+
+ // Sorting measurement
+ if (sortingPmfmId != null && sortingQualitativeValueId != null) {
+ SortingMeasurement sm = measurementPersistenceHelper.setSortingMeasurement(
+ result,
+ sortingPmfmId,
+ sortingQualitativeValueId);
+ notChangedSortingMeasurements.remove(sm);
+ }
+ // Removed not changed sorting measurements
+ if (sortingMeasurements != null) {
+ sortingMeasurements.removeAll(notChangedSortingMeasurements);
+ }
+
+ catchBatchDao.createSortingBatch(result, rootBatch);
+ }
+
+ Collection<QuantificationMeasurement> quantificationMeasurements = result.getQuantificationMeasurements();
+ Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
+ if (quantificationMeasurements != null) {
+ notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
+ }
+
+ // Sampling Ratio
+ if (weightBeforeSampling == null || weight == null) {
+ result.setSamplingRatio(null);
+ result.setSamplingRatioText(null);
+ } else {
+ String samplingRatioText = weight + "/" + weightBeforeSampling;
+ samplingRatioText = samplingRatioText.replaceAll(",", ".");
+ result.setSamplingRatioText(samplingRatioText);
+ result.setSamplingRatio(weight / weightBeforeSampling);
+ }
+
+ // Weight
+ if (weightBeforeSampling != null || weight != null) {
+ Float batchReferenceWeight = weight;
+ if (batchReferenceWeight == null) {
+ batchReferenceWeight = weightBeforeSampling;
+ }
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.setWeightMeasurementQuantificationMeasurement(
+ result,
+ batchReferenceWeight);
+ notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+ }
+ // Removed not changed quantification measurements
+ if (quantificationMeasurements != null) {
+ quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
+ }
+
+ return result;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Debug methods --//
+ //------------------------------------------------------------------------//
+
+ public void displayCatchBatch(CatchBatch result) {
+ StringBuilder sb = new StringBuilder();
+ displayBatch(result, 0, sb);
+ if (log.isDebugEnabled()) {
+ log.debug(sb.toString());
+ }
+ }
+
+ final Comparator<Batch> batchComparator = new Comparator<Batch>() {
+ @Override
+ public int compare(Batch b1, Batch b2) {
+ return (b1.getRankOrder() == null) ? 0 : b1.getRankOrder().compareTo(b2.getRankOrder());
+ }
+ };
+
+ private void displayBatch(Batch batch, int level, StringBuilder sb) {
+
+ ToStringBuilder builder = new ToStringBuilder(batch, ToStringStyle.MULTI_LINE_STYLE);
+ builder.append("id", batch.getId());
+ if (batch.getParentBatch() != null) {
+ builder.append("parentId", batch.getParentBatch().getId());
+ }
+ builder.append("rankOrder", batch.getRankOrder());
+ builder.append("level", level);
+ if (batch.getWeight() != null) {
+ builder.append("weight", batch.getWeight());
+ }
+ if (batch.getWeightBeforeSampling() != null) {
+ builder.append("weightBeforeSampling", batch.getWeightBeforeSampling());
+ }
+// builder.append("qualityFlag", batch.getQualityFlag().getName());
+ if (batch instanceof SortingBatch) {
+ SortingBatch sortingBatch = (SortingBatch) batch;
+ if (sortingBatch.getSamplingRatio() != null) {
+ builder.append("samplingRatio", sortingBatch.getSamplingRatio());
+ }
+ if (sortingBatch.getSamplingRatioText() != null) {
+ builder.append("samplingRatioText", sortingBatch.getSamplingRatioText());
+ }
+ if (sortingBatch.getReferenceTaxon() != null) {
+ ReferenceTaxon referenceTaxon = sortingBatch.getReferenceTaxon();
+ Species speciesByReferenceTaxonId = referentialService.getSpeciesByReferenceTaxonId(referenceTaxon.getId());
+ builder.append("referenceTaxon", speciesByReferenceTaxonId.getName());
+ }
+ if (sortingBatch.getSortingMeasurements() != null) {
+ for (SortingMeasurement sortingMeasurement : sortingBatch.getSortingMeasurements()) {
+ Caracteristic sortingMeasurementPmfm = getPmfm(sortingMeasurement.getPmfm());
+ builder.append("sortingMeasurement.pmfm", sortingMeasurementPmfm.getParameterName() + " (" + sortingMeasurementPmfm.getId() + ")");
+ if (sortingMeasurement.getQualitativeValue() != null) {
+ CaracteristicQualitativeValue caracteristicQualitativeValue = CaracteristicQualitativeValues.getCaracteristicQualitativeValue(sortingMeasurementPmfm, sortingMeasurement.getQualitativeValue().getId());
+ if (caracteristicQualitativeValue == null && sortingMeasurement.getQualitativeValue().getId() == 2146) {
+ builder.append("sortingMeasurement.qualitativeValue", "Unsorted");
+ } else {
+ builder.append("sortingMeasurement.qualitativeValue", caracteristicQualitativeValue.getName() + " (" + caracteristicQualitativeValue.getId() + ")");
+ }
+ }
+ if (sortingMeasurement.getNumericalValue() != null) {
+ builder.append("sortingMeasurement.numericalValue", sortingMeasurement.getNumericalValue());
+ }
+ }
+ }
+ }
+ QuantificationMeasurement quantificationMeasurement = measurementPersistenceHelper.getWeightMeasurementQuantificationMeasurement(batch);
+ if (quantificationMeasurement != null) {
+
+ builder.append("quantificationMeasurement.isReferenceQuantification", quantificationMeasurement.getIsReferenceQuantification());
+
+ Caracteristic quantificationMeasurementPmfm = getPmfm(quantificationMeasurement.getPmfm());
+ builder.append("quantificationMeasurement.pmfm", quantificationMeasurementPmfm.getParameterName() + " (" + quantificationMeasurementPmfm.getId() + ")");
+
+ if (quantificationMeasurement.getQualitativeValue() != null) {
+ CaracteristicQualitativeValue caracteristicQualitativeValue = CaracteristicQualitativeValues.getCaracteristicQualitativeValue(quantificationMeasurementPmfm, quantificationMeasurement.getQualitativeValue().getId());
+ builder.append("quantificationMeasurement.qualitativeValue", caracteristicQualitativeValue.getName() + " (" + caracteristicQualitativeValue.getId() + ")");
+ }
+ if (quantificationMeasurement.getNumericalValue() != null) {
+ builder.append("quantificationMeasurement.numericalValue", quantificationMeasurement.getNumericalValue());
+ }
+ }
+ String prefix = "\n" + StringUtils.leftPad("", 2 * level);
+ String batchStr = Joiner.on(prefix).join(builder.build().split("\n"));
+ sb.append(prefix).append(batchStr);
+ Collection<Batch> childBatchs = batch.getChildBatchs();
+ if (childBatchs != null) {
+ List<Batch> childBatchList = new ArrayList<>(childBatchs);
+ Collections.sort(childBatchList, batchComparator);
+ for (Batch childBatch : childBatchList) {
+ displayBatch(childBatch, level + 1, sb);
+ }
+ }
+ }
+
+ protected Caracteristic getPmfm(Pmfm pmfm) {
+ Caracteristic caracteristic = referentialService.getCaracteristic(pmfm.getId());
+ return caracteristic;
+ }
+}
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchTreeHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,9 +25,7 @@
*/
import com.google.common.collect.Lists;
-import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
-import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
import fr.ifremer.adagio.core.dao.data.batch.validator.CatchBatchValidationError;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -36,19 +34,16 @@
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.service.CatchBatchPersistenceService;
-import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import java.util.Collection;
+import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
-import static org.nuiton.i18n.I18n.t;
import static org.nuiton.i18n.I18n.n;
+import static org.nuiton.i18n.I18n.t;
@Component(value = "scientificCruiseCatchBatchValidator")
public class ScientificCruiseCatchBatchValidator implements TuttiCatchBatchValidator {
@@ -57,18 +52,9 @@
private static final Log log =
LogFactory.getLog(ScientificCruiseCatchBatchValidator.class);
- @Autowired
- protected CatchBatchPersistenceService batchService;
+ @Resource(name = "batchTreeHelper")
+ protected BatchTreeHelper batchTreeHelper;
- @Autowired
- protected CatchBatchExtendDao catchBatchDao;
-
- @Autowired
- protected TuttiEnumerationFile enumeration;
-
- @Autowired
- protected BatchPersistenceHelper batchHelper;
-
// -----------------------------------------------------------------------//
// -- CatchBatchValidator methods --//
// -----------------------------------------------------------------------//
@@ -82,7 +68,7 @@
@Override
public List<CatchBatchValidationError> validate(CatchBatch catchBatch) {
List<CatchBatchValidationError> errors = Lists.newArrayList();
- validateCatchBatch(catchBatch.getChildBatchs(), errors);
+ validateCatchBatch(catchBatch, errors);
return errors;
}
@@ -161,15 +147,11 @@
// -- Internal methods --//
// -----------------------------------------------------------------------//
- protected void validateCatchBatch(Collection<Batch> batchs,
+ protected void validateCatchBatch(CatchBatch batch,
List<CatchBatchValidationError> errors) {
// Vrac
- SortingBatch vracBatch = batchHelper.getSortingBatch(
- batchs,
- "Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = batchTreeHelper.getVracBatch(batch);
if (log.isDebugEnabled()) {
log.debug("Try to validate Vrac batch model " + vracBatch);
@@ -179,18 +161,10 @@
addError(errors, n("tutti.persistence.batch.validation.vracNotFound"));
} else {
// Vrac > Species
- SortingBatch speciesBatch = batchHelper.getSortingBatch(
- vracBatch,
- "Vrac > Species",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = batchTreeHelper.getSpeciesVracRootBatch(vracBatch);
// Vrac > Benthos
- SortingBatch benthosBatch = batchHelper.getSortingBatch(
- vracBatch,
- "Vrac > Benthos",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = batchTreeHelper.getBenthosVracRootBatch(vracBatch);
if (speciesBatch == null) {
@@ -201,31 +175,19 @@
}
} else {
// Vrac > Species > Alive not itemized
- SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
- speciesBatch,
- "Vrac > Species > Alive not itemized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ SortingBatch livingNotItemizedBatch = batchTreeHelper.getSpeciesVracAliveNotItemizedRootBatch(speciesBatch);
if (livingNotItemizedBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracSpeciesLifeNotFound"));
}
// Vrac > Species > Inert
- SortingBatch inertBatch = batchHelper.getSortingBatch(
- speciesBatch,
- "Vrac > Species > Inert",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
+ SortingBatch inertBatch = batchTreeHelper.getSpeciesVracInertRootBatch(speciesBatch);
if (inertBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracSpeciesInertNotFound"));
}
// Vrac > Species > Alive itemized
- SortingBatch aliveItemizedBatch = batchHelper.getSortingBatch(
- speciesBatch,
- "Vrac > Species > Alive itemized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ SortingBatch aliveItemizedBatch = batchTreeHelper.getSpeciesVracAliveItemizedRootBatch(speciesBatch);
if (aliveItemizedBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracSpeciesAliveItemizedNotFound"));
}
@@ -242,31 +204,19 @@
} else {
// Vrac > Benthos > Alive not itemized
- SortingBatch livingNotItemizedBatch = batchHelper.getSortingBatch(
- benthosBatch,
- "Vrac > Benthos > Alive not itemized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ SortingBatch livingNotItemizedBatch = batchTreeHelper.getBenthosVracAliveNotItemizedRootBatch(benthosBatch);
if (livingNotItemizedBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracBenthosLifeNotFound"));
}
// Vrac > Benthos > Inert
- SortingBatch inertBatch = batchHelper.getSortingBatch(
- benthosBatch,
- "Vrac > Benthos > Inert",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
+ SortingBatch inertBatch = batchTreeHelper.getBenthosVracInertRootBatch(benthosBatch);
if (inertBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracBenthosInertNotFound"));
}
// Vrac > Benthos > Alive itemized
- SortingBatch aliveItemizedBatch = batchHelper.getSortingBatch(
- benthosBatch,
- "Vrac > Benthos > Alive itermized",
- enumeration.PMFM_ID_SORTING_TYPE_2,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ SortingBatch aliveItemizedBatch = batchTreeHelper.getBenthosVracAliveItemizedRootBatch(benthosBatch);
if (aliveItemizedBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.vracBenthosAliveItemizedNotFound"));
}
@@ -274,39 +224,23 @@
}
// Hors Vrac
- SortingBatch horsVracBatch = batchHelper.getSortingBatch(
- batchs,
- "Hors Vrac",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID);
+ SortingBatch horsVracBatch = batchTreeHelper.getHorsVracBatch(batch);
if (horsVracBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.horsVracNotFound"));
} else {
// Hors Vrac > Species
- SortingBatch speciesBatch = batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > Species",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = batchTreeHelper.getSpeciesHorsVracRootBatch(horsVracBatch);
if (speciesBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.horsVracSpeciesNotFound"));
}
// Hors Vrac > Benthos
- SortingBatch benthosBatch = batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > Benthos",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = batchTreeHelper.getBenthosHorsVracRootBatch(horsVracBatch);
if (benthosBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.horsVracBenthosNotFound"));
}
// Hors Vrac > Marine Litter
- SortingBatch marineLitterBatch = batchHelper.getSortingBatch(
- horsVracBatch,
- "Hors Vrac > Marine Litter",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ SortingBatch marineLitterBatch = batchTreeHelper.getMarineLitterRootBatch(horsVracBatch);
if (marineLitterBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.horsVracMarineLitterNotFound"));
@@ -314,11 +248,7 @@
}
// Unsorted
- SortingBatch unsortedBatch = batchHelper.getSortingBatch(
- batchs,
- "Unsorted",
- enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_UNSORTED_ID);
+ SortingBatch unsortedBatch = batchTreeHelper.getRejectedBatch(batch);
if (unsortedBatch == null) {
addWarning(errors, n("tutti.persistence.batch.validation.unsortedNotFound"));
}
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -67,7 +67,7 @@
@Before
public void setUp() throws Exception {
- enumerationFile = TuttiPersistenceServiceLocator.getReferentialPersistenceService().getEnumerationFile();
+ enumerationFile = TuttiPersistenceServiceLocator.getTechnicalPersistenceService().getEnumerationFile();
service = TuttiPersistenceServiceLocator.getBenthosBatchPersistenceService();
fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -124,7 +124,7 @@
catchBatchService = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService();
fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
- enumerationFile = referentialService.getEnumerationFile();
+ enumerationFile = TuttiPersistenceServiceLocator.getTechnicalPersistenceService().getEnumerationFile();
species = referentialService.getAllSpecies();
assertNotNull(species);
@@ -443,7 +443,8 @@
if (expectedBatch.getSampleCategoryValue() != null && expectedBatch.getSampleCategoryValue() instanceof CaracteristicQualitativeValue) {
assertNotNull("Bad sampleCategoryValue : expected <" + ((CaracteristicQualitativeValue) expectedBatch.getSampleCategoryValue()).getId()
+ "> but was <null>",
- actualBatch.getSampleCategoryValue());
+ actualBatch.getSampleCategoryValue()
+ );
assertEquals(
((CaracteristicQualitativeValue) expectedBatch.getSampleCategoryValue()).getId(),
((CaracteristicQualitativeValue) actualBatch.getSampleCategoryValue()).getId());
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -66,7 +66,7 @@
@Before
public void setUp() throws Exception {
- enumerationFile = TuttiPersistenceServiceLocator.getReferentialPersistenceService().getEnumerationFile();
+ enumerationFile = TuttiPersistenceServiceLocator.getTechnicalPersistenceService().getEnumerationFile();
service = TuttiPersistenceServiceLocator.getSpeciesBatchPersistenceService();
fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -116,7 +116,7 @@
CatchBatchPersistenceService catchBatchService = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService();
FishingOperationPersistenceService fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
ReferentialPersistenceService referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
- enumerationFile = referentialService.getEnumerationFile();
+ enumerationFile = TuttiPersistenceServiceLocator.getTechnicalPersistenceService().getEnumerationFile();
species = referentialService.getAllSpecies();
assertNotNull(species);
@@ -436,7 +436,8 @@
if (expectedBatch.getSampleCategoryValue() != null && expectedBatch.getSampleCategoryValue() instanceof CaracteristicQualitativeValue) {
assertNotNull("Bad sampleCategoryValue : expected <" + ((CaracteristicQualitativeValue) expectedBatch.getSampleCategoryValue()).getId()
+ "> but was <null>",
- actualBatch.getSampleCategoryValue());
+ actualBatch.getSampleCategoryValue()
+ );
assertEquals(
((CaracteristicQualitativeValue) expectedBatch.getSampleCategoryValue()).getId(),
((CaracteristicQualitativeValue) actualBatch.getSampleCategoryValue()).getId());
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -732,6 +732,11 @@
}
@Override
+ public Species getSpeciesByReferenceTaxonId(Integer referenceTaxonId) {
+ return driver.getSpeciesByReferenceTaxonId(referenceTaxonId);
+ }
+
+ @Override
public Species getSpeciesByReferenceTaxonIdWithVernacularCode(Integer referenceTaxonId) {
return driver.getSpeciesByReferenceTaxonIdWithVernacularCode(referenceTaxonId);
}
@@ -772,6 +777,11 @@
}
@Override
+ public TuttiLocation getLocation(String id) {
+ return driver.getLocation(id);
+ }
+
+ @Override
public List<Gear> getAllScientificGear() {
return driver.getAllScientificGear();
}
@@ -961,6 +971,11 @@
driver.deleteAttachment(attachmentId);
}
+ @Override
+ public void deleteAllAttachment(AttachementObjectTypeEnum objectType, Integer... objectIds) {
+ driver.deleteAllAttachment(objectType, objectIds);
+ }
+
//------------------------------------------------------------------------//
//-- Program methods --//
//------------------------------------------------------------------------//
@@ -1055,6 +1070,11 @@
}
@Override
+ public List<String> getAllProtocolId() {
+ return driver.getAllProtocolId();
+ }
+
+ @Override
public TuttiProtocol getProtocol(String id) {
return driver.getProtocol(id);
}
@@ -1078,7 +1098,6 @@
//-- FishingOperation methods --//
//------------------------------------------------------------------------//
-
@Override
public int getFishingOperationCount(String cruiseId) {
return driver.getFishingOperationCount(cruiseId);
@@ -1130,6 +1149,11 @@
}
@Override
+ public Collection<FishingOperation> saveFishingOperations(Collection<FishingOperation> beans) {
+ return driver.saveFishingOperations(beans);
+ }
+
+ @Override
public void deleteFishingOperation(String id) {
driver.deleteFishingOperation(id);
}
@@ -1159,6 +1183,11 @@
return driver.saveCatchBatch(bean);
}
+ @Override
+ public void deleteCatchBatch(String fishingOperationId) {
+ driver.deleteCatchBatch(fishingOperationId);
+ }
+
//------------------------------------------------------------------------//
//-- Species Batch methods --//
//------------------------------------------------------------------------//
@@ -1263,7 +1292,7 @@
}
//------------------------------------------------------------------------//
- //-- Macrodechet Batch methods --//
+ //-- MarineLitter Batch methods --//
//------------------------------------------------------------------------//
@Override
@@ -1310,6 +1339,11 @@
driver.deleteAccidentalBatch(id);
}
+ @Override
+ public void deleteAccidentalBatchForFishingOperation(String fishingOperationId) {
+ driver.deleteAccidentalBatchForFishingOperation(fishingOperationId);
+ }
+
//------------------------------------------------------------------------//
//-- IndividualObservation Batch methods --//
//------------------------------------------------------------------------//
@@ -1333,4 +1367,9 @@
public void deleteIndividualObservationBatch(String id) {
driver.deleteIndividualObservationBatch(id);
}
+
+ @Override
+ public void deleteIndividualObservationBatchForFishingOperation(String fishingOperationId) {
+ driver.deleteIndividualObservationBatchForFishingOperation(fishingOperationId);
+ }
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -26,6 +26,7 @@
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/UpdateSchemaTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/UpdateSchemaTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/UpdateSchemaTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -30,7 +30,6 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Test;
import org.nuiton.util.Version;
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -25,7 +25,6 @@
*/
import com.google.common.io.Files;
-import org.nuiton.jaxx.application.ApplicationBusinessException;
import fr.ifremer.tutti.persistence.ProgressionModel;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.ServiceDbResource;
@@ -35,6 +34,7 @@
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
+import org.nuiton.jaxx.application.ApplicationBusinessException;
import java.io.File;
import java.net.URL;
@@ -196,8 +196,8 @@
"2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;5.8333335;1.0\n" +
"2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Femelle 40.0;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;40.0;8.75;1.0\n" +
"2013;test elevation;1;OTB 20/28.10;B;2;1;1938;;Agonus cataphractus;Trait B-2-1 AGONCAT-horsvrac 20;Hors Vrac;1;20.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;20.0;1.0;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;4622;;Abietinaria abietina;Trait B-2-1 Benthos ABIEABI Vrac 30@@@@avec @@@@commentaire...;Vrac;1;30.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;30.0;7.0;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;380;;Acanthocardia echinata;Trait B-2-1 Benthos ACANECH Vrac 18@@@@avec @@@@commentaire...;Vrac;2;18.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;18.0;7.0;1.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;4622;;Abietinaria abietina;Trait B-2-1 Benthos ABIEABI Vrac 30@@@@avec @@@@commentaire...;Vrac;101;30.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;30.0;7.0;1.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;380;;Acanthocardia echinata;Trait B-2-1 Benthos ACANECH Vrac 18@@@@avec @@@@commentaire...;Vrac;102;18.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;18.0;7.0;1.0\n" +
"2013;test elevation;1;OTB 20/28.10;A;1;1;1938;;Agonus cataphractus;AGONCAT-vrac-80;Vrac;1;80.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;80.0;5.4444447;1.0\n" +
"2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;9.074075;1.0\n" +
"2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-femelle 40;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;5.0;1;0.6;cm;1.0;4;0.6;907.4074;1.0\n" +
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2014-04-21 05:40:03 UTC (rev 1717)
@@ -112,35 +112,35 @@
public static final String CATCH_CONTENT_2 =
"Annee;Serie;Serie_Partielle;Engin;Code_station;Id_Operation;Poche;Code_Taxon;Code_Espece_Campagne;Nom_scientifique;Commentaire;V_HV;Num_Ordre_V_HV_H2;Tot_V_HV;Ech_V_HV;Type_Volume_Poids_V_HV;Unite_Volume_Poids_V_HV;Class_Tri;Num_Ordre_Class_Tri_H2;Tot_Class_Tri;Ech_Class_Tri;Type_Volume_Poids_Class_Tri;Unite_Volume_Poids_Class_Tri;Sexe;Num_Ordre_Sexe_H2;Tot_Sexe;Ech_Sexe;Type_Volume_Poids_Sexe;Unite_Volume_Poids_Sexe;Maturite;Num_Ordre_Maturite_H2;Tot_Maturite;Ech_Maturite;Type_Volume_Poids_Maturite;Unite_Volume_Poids_Maturite;Age;Num_Ordre_Age_H2;Tot_Age;Ech_Age;Type_Volume_Poids_Age;Unite_Volume_Poids_Age;Code_Longueur;Libelle_Longueur;Taille;NumOrdre_Taille_H2;Poids_Classe_Taille;Unite_Taille;Precision_Mesure;Nbr;Poids_Reference;Coef_Elev_Espece_Capture;Coef_Final_Elevation\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;365;;Aequipecten opercularis;taxon;Vrac;1;0.005;0.005;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.005;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;491;ALLOSPP;Alloteuthis;taxon;Vrac;2;0.004;0.004;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.004;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;300;;Buccinum undatum;taxon;Vrac;3;0.015;0.015;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.015;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1811;CALMLYR;Callionymus lyra;taxon;Vrac;4;0.07;0.07;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.07;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1644;DICELAB;Dicentrarchus labrax;taxon;Vrac;5;1.06;1.06;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;36.0;1;;cm;1.0;1;1.06;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1644;DICELAB;Dicentrarchus labrax;taxon;Vrac;5;1.06;1.06;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;38.0;2;;cm;1.0;1;1.06;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;1;;cm;0.5;2;0.038;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;12.5;2;;cm;0.5;1;0.038;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;13.0;3;;cm;0.5;1;0.038;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;25.0;1;;cm;1.0;1;0.66;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;28.0;2;;cm;1.0;1;0.66;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;30.0;3;;cm;1.0;1;0.66;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;9.0;1;;cm;1.0;1;0.28;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;10.0;2;;cm;1.0;3;0.28;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;11.0;3;;cm;1.0;2;0.28;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1988;;Microstomus kitt;taxon;Vrac;9;0.152;0.152;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;15.0;1;;cm;1.0;1;0.152;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1988;;Microstomus kitt;taxon;Vrac;9;0.152;0.152;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;18.0;2;;cm;1.0;1;0.152;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1690;MULLSUR;Mullus surmuletus;taxon;Vrac;10;0.036;0.036;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;11.0;1;;cm;1.0;1;0.036;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1978;;Pleuronectes platessa;taxon;Vrac;11;0.852;0.852;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;26.0;1;;cm;1.0;1;0.852;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1978;;Pleuronectes platessa;taxon;Vrac;11;0.852;0.852;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;30.0;2;;cm;1.0;1;0.852;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1351;SARDPIL;Sardina pilchardus;taxon;Vrac;12;0.022;0.022;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;1;;cm;0.5;1;0.022;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1772;SCOMSCO;Scomber scombrus;taxon;Vrac;13;0.18;0.18;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;27.0;1;;cm;1.0;1;0.18;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1242;SCYOCAN;Scyliorhinus canicula;taxon|categorie_individu;Vrac;14;;;Poids;kg;NA;;;;;kg;Femelle;1;1.0;1.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;51.0;1;;cm;1.0;1;1.0;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1242;SCYOCAN;Scyliorhinus canicula;taxon|categorie_individu;Vrac;14;;;Poids;kg;NA;;;;;kg;Femelle;1;1.0;1.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;55.0;2;;cm;1.0;1;1.0;1.0001919;1.0\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;8.0;1;;cm;1.0;1;0.96;136.69289;136.58333\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;9.0;2;;cm;1.0;20;0.96;136.69289;136.58333\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;10.0;3;;cm;1.0;89;0.96;136.69289;136.58333\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;11.0;4;;cm;1.0;5;0.96;136.69289;136.58333\n" +
- "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;G - Gros;2;0.13;0.13;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;23.0;1;;cm;1.0;1;0.13;1009.42444;1.0";
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;365;;Aequipecten opercularis;taxon;Vrac;1;0.005;0.005;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.005;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;491;ALLOSPP;Alloteuthis;taxon;Vrac;2;0.004;0.004;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.004;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;300;;Buccinum undatum;taxon;Vrac;3;0.015;0.015;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.015;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1811;CALMLYR;Callionymus lyra;taxon;Vrac;4;0.07;0.07;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;1;0.07;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1644;DICELAB;Dicentrarchus labrax;taxon;Vrac;5;1.06;1.06;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;36.0;1;;cm;1.0;1;1.06;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1644;DICELAB;Dicentrarchus labrax;taxon;Vrac;5;1.06;1.06;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;38.0;2;;cm;1.0;1;1.06;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;1;;cm;0.5;2;0.038;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;12.5;2;;cm;0.5;1;0.038;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1362;ENGRENC;Engraulis encrasicolus;taxon;Vrac;6;0.038;0.038;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;13.0;3;;cm;0.5;1;0.038;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;25.0;1;;cm;1.0;1;0.66;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;28.0;2;;cm;1.0;1;0.66;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1986;;Limanda limanda;taxon;Vrac;7;0.66;0.66;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;30.0;3;;cm;1.0;1;0.66;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;9.0;1;;cm;1.0;1;0.28;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;10.0;2;;cm;1.0;3;0.28;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;489;LOLIVUL;Loligo vulgaris;taxon;Vrac;8;0.28;0.28;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;302;Longueur du manteau (LM) - individu - manteau - Mesure au cm par un observateur;11.0;3;;cm;1.0;2;0.28;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1988;;Microstomus kitt;taxon;Vrac;9;0.152;0.152;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;15.0;1;;cm;1.0;1;0.152;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1988;;Microstomus kitt;taxon;Vrac;9;0.152;0.152;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;18.0;2;;cm;1.0;1;0.152;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1690;MULLSUR;Mullus surmuletus;taxon;Vrac;10;0.036;0.036;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;11.0;1;;cm;1.0;1;0.036;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1978;;Pleuronectes platessa;taxon;Vrac;11;0.852;0.852;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;26.0;1;;cm;1.0;1;0.852;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1978;;Pleuronectes platessa;taxon;Vrac;11;0.852;0.852;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;30.0;2;;cm;1.0;1;0.852;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1351;SARDPIL;Sardina pilchardus;taxon;Vrac;12;0.022;0.022;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;1;;cm;0.5;1;0.022;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1772;SCOMSCO;Scomber scombrus;taxon;Vrac;13;0.18;0.18;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;27.0;1;;cm;1.0;1;0.18;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1242;SCYOCAN;Scyliorhinus canicula;taxon|categorie_individu;Vrac;14;;;Poids;kg;NA;;;;;kg;Femelle;1;1.0;1.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;51.0;1;;cm;1.0;1;1.0;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1242;SCYOCAN;Scyliorhinus canicula;taxon|categorie_individu;Vrac;14;;;Poids;kg;NA;;;;;kg;Femelle;1;1.0;1.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;55.0;2;;cm;1.0;1;1.0;1.0;1.0\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;8.0;1;;cm;1.0;1;0.96;136.71875;136.58333\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;9.0;2;;cm;1.0;20;0.96;136.71875;136.58333\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;10.0;3;;cm;1.0;89;0.96;136.71875;136.58333\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;P - Petit;1;131.12;0.96;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;11.0;4;;cm;1.0;5;0.96;136.71875;136.58333\n" +
+ "2010;Campagne CGFS;;GOV 19.7/25.9;20;20;1;1662;TRACTRA;Trachurus trachurus;taxon|categorie_individu;Vrac;15;;;Poids;kg;G - Gros;2;0.13;0.13;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;23.0;1;;cm;1.0;1;0.13;1009.6154;1.0";
public static final String MARINE_LITTER_CONTENT =
"Annee;Serie;Serie_Partielle;Engin;Code_station;Id_Operation;Poche;MarineLitterCategory;MarineLitterSizeCategory;Number;Weight;Commentaire\n" +
@@ -380,6 +380,8 @@
@Test
public void exportCatchesAndSpecies() throws Exception {
+// persistenceService.clearAllCaches();
+
File protocolFile = new File("src/test/resources/tuttiProtocol.tuttiProtocol");
TuttiProtocol protocol = dbResource.loadProtocol(protocolFile);
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/log4j.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/log4j.properties 2014-04-21 04:44:42 UTC (rev 1716)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/log4j.properties 2014-04-21 05:40:03 UTC (rev 1717)
@@ -31,6 +31,7 @@
# tutti levels
log4j.logger.fr.ifremer=INFO
+log4j.logger.fr.ifremer.tutti.persistence.service.batch.BatchTreeHelper=DEBUG
#See https://forum.hibernate.org/viewtopic.php?p=2404391
log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR
1
0
r1716 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create
by tchemit@users.forge.codelutin.com 21 Apr '14
by tchemit@users.forge.codelutin.com 21 Apr '14
21 Apr '14
Author: tchemit
Date: 2014-04-21 06:44:42 +0200 (Mon, 21 Apr 2014)
New Revision: 1716
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1716
Log:
fixes #4978
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java 2014-04-20 14:44:51 UTC (rev 1715)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/create/CreateMarineLitterBatchUIModel.java 2014-04-21 04:44:42 UTC (rev 1716)
@@ -129,5 +129,6 @@
setMarineLitterCategory(null);
setMarineLitterSizeCategory(null);
setNumber(null);
+ setWeight(null);
}
}
\ No newline at end of file
1
0
r1715 - trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport
by tchemit@users.forge.codelutin.com 20 Apr '14
by tchemit@users.forge.codelutin.com 20 Apr '14
20 Apr '14
Author: tchemit
Date: 2014-04-20 16:44:51 +0200 (Sun, 20 Apr 2014)
New Revision: 1715
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1715
Log:
change log level
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java 2014-04-20 14:38:15 UTC (rev 1714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java 2014-04-20 14:44:51 UTC (rev 1715)
@@ -107,8 +107,8 @@
// new batch
batchsByCategory.put(cacheCode, batchModel);
- if (log.isInfoEnabled()) {
- log.info("Added " + batchModel);
+ if (log.isDebugEnabled()) {
+ log.debug("Added " + batchModel);
}
} else {
@@ -122,8 +122,8 @@
int number = entry.getValue().intValue();
mergeBatch.addFrequency(stepClass, number);
}
- if (log.isInfoEnabled()) {
- log.info("Merged " + batchModel + " to " + mergeBatch);
+ if (log.isDebugEnabled()) {
+ log.debug("Merged " + batchModel + " to " + mergeBatch);
}
}
}
1
0
r1714 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 20 Apr '14
by tchemit@users.forge.codelutin.com 20 Apr '14
20 Apr '14
Author: tchemit
Date: 2014-04-20 16:38:15 +0200 (Sun, 20 Apr 2014)
New Revision: 1714
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1714
Log:
add javadoc
evict species cache as soon as the protocol is changed
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2014-04-20 14:25:12 UTC (rev 1713)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceService.java 2014-04-20 14:38:15 UTC (rev 1714)
@@ -26,6 +26,7 @@
import fr.ifremer.tutti.persistence.TuttiPersistenceServiceImplementor;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import org.springframework.cache.annotation.CacheEvict;
import java.util.List;
@@ -37,8 +38,23 @@
*/
public interface ProtocolPersistenceService extends TuttiPersistenceServiceImplementor {
+ /**
+ * The protocol used by the persistence lay (used to consolidate entites).
+ *
+ * @return The protocol used by the persistence layer
+ * @see #setProtocol(TuttiProtocol)
+ * @since 2.6
+ */
TuttiProtocol getProtocol();
+ /**
+ * Set the protocol to use by the persistence layer.
+ *
+ * @param protocol the new protocol to use (can be null)
+ * @see #getProtocol()
+ * @since 2.6
+ */
+ @CacheEvict(value = {"species", "referentSpecies", "referentSpeciesById", "referentSpeciesByIdVernacular"}, allEntries = true)
void setProtocol(TuttiProtocol protocol);
boolean isProtocolExist(String id);
@@ -51,13 +67,10 @@
TuttiProtocol getProtocol(String id);
- // @Transactional(readOnly = false)
TuttiProtocol createProtocol(TuttiProtocol bean);
- // @Transactional(readOnly = false)
TuttiProtocol saveProtocol(TuttiProtocol bean);
- // @Transactional(readOnly = false)
void deleteProtocol(String protocolId);
}
1
0
r1713 - trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra
by tchemit@users.forge.codelutin.com 20 Apr '14
by tchemit@users.forge.codelutin.com 20 Apr '14
20 Apr '14
Author: tchemit
Date: 2014-04-20 16:25:12 +0200 (Sun, 20 Apr 2014)
New Revision: 1713
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1713
Log:
fix sumatra v2 export test
Modified:
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-04-19 13:33:59 UTC (rev 1712)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-04-20 14:25:12 UTC (rev 1713)
@@ -64,7 +64,7 @@
"Année;Station;Poche;Espèce;Signe;Tri;Total;PoidsMoy;LongueurMoy;NbIndividus;Moule\n" +
"2013;A;1;CHAMMAG;;100.0;100.0;2.5;NA;40;0.4\n" +
"2013;A;1;ECHIGAM;;100.0;100.0;0.23980816;NA;417;4.17\n" +
- "2013;A;1;BRISATLAN;;100.0;100.0;1.0638298;NA;94;0.94";
+ "2013;A;1;BRISATLAN;;100.0;100.0;1.0638298;10.571428;94;0.94";
protected CatchesSumatraExportServiceV2 service;
1
0
r1712 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 19 Apr '14
by tchemit@users.forge.codelutin.com 19 Apr '14
19 Apr '14
Author: tchemit
Date: 2014-04-19 15:33:59 +0200 (Sat, 19 Apr 2014)
New Revision: 1712
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1712
Log:
fixes #4960
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/VesselPersonFeaturesPersistenceHelper.java
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/VesselPersonFeaturesPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/VesselPersonFeaturesPersistenceHelper.java 2014-04-19 13:25:21 UTC (rev 1711)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/VesselPersonFeaturesPersistenceHelper.java 2014-04-19 13:33:59 UTC (rev 1712)
@@ -118,6 +118,7 @@
vesselPersonFeatures = VesselPersonFeatures.Factory.newInstance();
vesselPersonFeaturesPerPerson.put(personId, vesselPersonFeatures);
vesselPersonFeatures.setOperation(fishingOperation);
+ vesselPersonFeatures.setFishingTrip(fishingOperation.getFishingTrip());
vesselPersonFeatures.setPerson(person);
vesselPersonFeatures.setStartDate(fishingOperation.getStartDateTime());
vesselPersonFeatures.setEndDate(fishingOperation.getEndDateTime());
1
0