r1718 - in trunk: . tutti-persistence/src/main/java/fr/ifremer tutti-persistence/src/main/java/fr/ifremer/tutti tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/test tutti-persistence/src/main/resources tutti-persistence/src/main/resources/i18n tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service tutti-persistence/src/test/resources tut
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/re... $ + %% + 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@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"))
participants (1)
-
tchemit@users.forge.codelutin.com