Author: echatellier Date: 2015-06-17 13:53:01 +0000 (Wed, 17 Jun 2015) New Revision: 4271 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/4271 Log: refs #7210: Add result storage to manage resultat as script files Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultInfoStorage.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/AbstractResultInfo.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfo.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfoHelper.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/package-info.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultInfoNameListRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/RendererHelper.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ResultInfoHelperTest.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixAbundance.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomass.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomassBeginMonth.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZoneMet.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZonePop.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep1.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep2.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep3.java Removed: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/TooltipHelper.java Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisConfig.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisFish.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/ResultManager.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/common/ScriptParametersTableCellRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/ObjectiveComboRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/OptimizationComboRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityanalysis/SensitivityAnalysisComboRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/simulationplan/SimulationPlanComboRenderer.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/FileSelectionTableModel.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptHandler.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceHandler.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/DependencyUtil.java branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_en_GB.properties branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_fr_FR.properties branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/export.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/exportStep.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/objective.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/optimization.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/rule.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/sensitivityexport.ftl branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/simulationplan.ftl branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/DataStorageTestHelper.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/RuleStorageTest.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/ScriptStorageTest.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/SimulationPlanStorageTest.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/util/DependencyUtilTest.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/rules/Cantonnement.java branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/scripts/ResultName.java Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisConfig.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisConfig.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -1112,7 +1112,7 @@ public static enum Option implements ConfigOptionDef { CONFIG_FILE(CONFIG_FILE_NAME, n("isisfish.config.main.configFileName.description"), "isis-config-" + ISIS_FISH_MAJOR_VERSION), - ISIS_HOME_DIRECTORY("isis.home.directory", n("isisfish.config.main.compileDirectory.description"), getUserHome() + File.separator + "isis-fish-" + ISIS_FISH_MAJOR_VERSION + "-rc"), + ISIS_HOME_DIRECTORY("isis.home.directory", n("isisfish.config.main.compileDirectory.description"), getUserHome() + File.separator + "isis-fish-" + ISIS_FISH_MAJOR_VERSION), COMPILATION_DIRECTORY("compilation.directory", n("isisfish.config.main.compileDirectory.description"), "${isis.home.directory}" + File.separator + "isis-build"), MONITORING_DIRECTORY("monitoring.directory", n("isisfish.config.main.monitoringDirectory.description"), "${isis.home.directory}" + File.separator + "isis-monitoring"), JAVADOC_DIRECTORY("javadoc.directory", n("isisfish.config.main.javadocDirectory.description"), "${isis.home.directory}" + File.separator + "isis-docs"), Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisFish.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisFish.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/IsisFish.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,6 +37,7 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.Collection; +import java.util.Date; import java.util.List; import javax.imageio.ImageIO; @@ -69,6 +70,7 @@ import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.datastore.OptimizationStorage; import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.ScriptStorage; import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; @@ -403,6 +405,7 @@ ObjectiveStorage.checkout(); OptimizationStorage.checkout(); RuleStorage.checkout(); + ResultInfoStorage.checkout(); ScriptStorage.checkout(); SensitivityAnalysisStorage.checkout(); SensitivityExportStorage.checkout(); @@ -442,7 +445,7 @@ List<File> filesInClonflict; // si on est sur une branche, on est en developpement, on ne fait donc rien - if (vcs.getTag().startsWith("branches")) { + if (vcs.getTag().startsWith("/branches")) { log.info(t("Use branches, switch not needed")); } else { // Si on utilise pas le bon tag on change de tag @@ -514,7 +517,7 @@ if (ask(t("isisfish.vcs.init.wrongprotocol", local))) { File localBackup = new File(local.getParentFile(), local.getName() + "-" + - new SimpleDateFormat("yyyy-mm-dd-HH-mm-ss").format(new java.util.Date())); + new SimpleDateFormat("yyyy-mm-dd-HH-mm-ss").format(new Date())); if (log.isInfoEnabled()) { log.info(t("Rename data directory to %s", localBackup)); } Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultInfoStorage.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultInfoStorage.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultInfoStorage.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,205 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ + +package fr.ifremer.isisfish.datastore; + +import static org.nuiton.i18n.I18n.t; + +import java.io.File; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections4.map.ReferenceMap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.result.ResultInfo; +import fr.ifremer.isisfish.util.Doc; +import fr.ifremer.isisfish.vcs.VCSException; + +/** + * This class define a result name. + * + * @author Eric Chatellier + * @since 4.4 + */ +public class ResultInfoStorage extends JavaSourceStorage { // ResultInfoStorage + + /** to use log facility, just put in your code: log.info(\"...\"); */ + private static Log log = LogFactory.getLog(ResultInfoStorage.class); + + public static final String RESULT_INFO_PATH = "resultinfos"; + + /** Template freemarker pour les noms de resultats. */ + public static final String RESULT_NAME_TEMPLATE = "templates/script/resultInfo.ftl"; + + /** Instance cache. */ + protected static Map<String, ResultInfoStorage> resultInfosCache = new ReferenceMap<String, ResultInfoStorage>(); + + /** + * Contruit un nouveau resultInfo storage + * + * @param rootSrc La region auquelle est attaché le resultats + * @param directory le repertoire ou devrait se trouver le resultat + * @param name le nom du resultat + */ + protected ResultInfoStorage(File rootSrc, File directory, String name) { + super(rootSrc, directory, name); + } + + /** + * Get context (official VCS) resultInfo directory. + * + * @return context resultInfo directory + */ + static public File getResultInfoDirectory() { + File result = new File(getContextDatabaseDirectory(), RESULT_INFO_PATH); + result.mkdirs(); + return result; + } + + /** + * Get community VCS resultInfo directory. + * + * @return community resultInfo directory + */ + public static File getCommunityResultInfoDirectory() { + File result = new File(getCommunityDatabaseDirectory(), RESULT_INFO_PATH); + result.mkdirs(); + return result; + } + + /** + * Retourne le nom de toutes les resultats existants pour cette region + * + * @return all result names found in local user database + */ + static public List<String> getResultInfoNames() { + List<String> rules = getStorageNames(getResultInfoDirectory()); + rules.addAll(getStorageNames(getCommunityResultInfoDirectory())); + return rules; + } + + /** + * Retourne le storage pour le resultat demandé + * + * @param name le nom du resultat souhaité + * @param location location to open storage file + * @return Le storage pour le resultat + */ + static public ResultInfoStorage getResultInfo(String name, Location... location) { + ResultInfoStorage result = resultInfosCache.get(name); + if (result == null) { + Location[] locs = nonEmptyLocation(location); + for (int i = 0; i < locs.length && result == null; i++) { + Location loc = locs[i]; + for (File dir : loc.getDirectories()) { + ResultInfoStorage storage = new ResultInfoStorage(dir, new File(dir, RESULT_INFO_PATH), name); + File sFile = storage.getFile(); + if (sFile.isFile()) { + result = storage; + resultInfosCache.put(name, result); + } + } + } + } + return result; + } + + /** + * Create new result name. + * + * @param name new result name to create + * @param location location to result name storage file + * @return new rule storage + */ + public static ResultInfoStorage createResultInfo(String name, Location location) { + File dir = location.getDirectories()[0]; + ResultInfoStorage storage = new ResultInfoStorage(dir, new File(dir, RESULT_INFO_PATH), name); + return storage; + } + + static public void checkout() throws VCSException { + checkout(IsisFish.config.getDatabaseDirectory(), RESULT_INFO_PATH); + } + + /** + * Retourne la liste des noms de toutes les resultats disponibles en local qui + * ne sont pas encore sur le serveur VCS + * + * @return liste de noms de resultats + */ + static public List<String> getNewResultInfoNames() { + List<String> result = getResultInfoNames(); + result.removeAll(getRemoteResultInfoNames()); + return result; + } + + /** + * Retourne la liste des noms de toutes les régions disponible sur le + * serveur VCS + * + * @return la liste des noms de toutes les régions disponible sur le serveur + * VCS. Si le serveur n'est pas disponible la liste retournée est + * vide. + */ + static public List<String> getRemoteResultInfoNames() { + File dir = getResultInfoDirectory(); + return getRemoteStorageNames(dir); + } + + /** + * Retourne la liste des noms de toutes les régions disponible sur le + * serveur VCS qui ne sont pas encore en local + * + * @return liste de noms de regions + */ + static public List<String> getNewRemoteResultInfoNames() { + List<String> result = getRemoteResultInfoNames(); + result.removeAll(getResultInfoNames()); + return result; + } + + /** + * <b>Be ware this method require to instanciate a resultInfo, so + * it would be better to call as often as possible.</b> + * + * @return the description of the instanciate Rule + * @see Doc + */ + public String getDescription() { + String result = null; + try { + ResultInfo resultInfo = getNewInstance(); + result = resultInfo == null ? null : resultInfo.getDescription(); + } catch (Exception e) { + log.warn(t("isisfish.error.not.found.description",this)); + } + return result; + } + +} // ResultInfoStorage + Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultInfoStorage.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -55,6 +55,7 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.export.ExportInfo; import fr.ifremer.isisfish.export.SensitivityExport; +import fr.ifremer.isisfish.result.ResultInfoHelper; import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.simulator.Objective; import fr.ifremer.isisfish.simulator.Optimization; @@ -380,11 +381,8 @@ public boolean isEnabled(String name) { name = name.trim(); if (enabledResult == null && simulation.getSimulationParametersFile().exists()) { - enabledResult = new HashSet<String>(); - Collection<String> resultEnabled = simulation.getParameter() - .getResultEnabled(); - enabledResult.addAll(resultEnabled); + Set<String> requestedResult = ResultInfoHelper.cleanResultNames(simulation.getParameter().getResultEnabled()); // test on export List<String> exportNames = simulation.getParameter().getExportNames(); @@ -408,7 +406,7 @@ .getParameter().getSensitivityExport(); if (sensitivityExports != null) { for (SensitivityExport sensitivityExport : sensitivityExports) { - Collections.addAll(enabledResult, sensitivityExport.getNecessaryResult()); + Collections.addAll(requestedResult, sensitivityExport.getNecessaryResult()); } } @@ -416,7 +414,7 @@ List<Rule> rules = simulation.getParameter().getRules(); if (rules != null) { for (Rule rule : rules) { - Collections.addAll(enabledResult, rule.getNecessaryResult()); + Collections.addAll(requestedResult, rule.getNecessaryResult()); } } @@ -424,21 +422,24 @@ List<SimulationPlan> plans = simulation.getParameter().getSimulationPlans(); if (plans != null) { for (SimulationPlan plan : plans) { - Collections.addAll(enabledResult, plan.getNecessaryResult()); + Collections.addAll(requestedResult, plan.getNecessaryResult()); } } // on objective and optimization Objective objective = simulation.getParameter().getObjective(); if (objective != null) { - Collections.addAll(enabledResult, objective.getNecessaryResult()); + Collections.addAll(requestedResult, objective.getNecessaryResult()); } Optimization optimization = simulation.getParameter().getOptimization(); if (optimization != null) { - Collections.addAll(enabledResult, optimization.getNecessaryResult()); + Collections.addAll(requestedResult, optimization.getNecessaryResult()); } + // recursive result extraction + enabledResult = ResultInfoHelper.extractAllNecessaryResults(requestedResult); + log.info("Enabled result: " + enabledResult); } // par defaut on dit qu'on conserve le resultat Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/AbstractResultInfo.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/AbstractResultInfo.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/AbstractResultInfo.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,41 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.result; + +/** + * Abstract class to extends to skip necessary result definition. As of not all result depends + * on other results. + * + * @author Eric Chatellier + * @since 4.4 + */ +public abstract class AbstractResultInfo implements ResultInfo { + + @Override + public String[] getNecessaryResult() { + return null; + } + +} Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/AbstractResultInfo.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfo.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfo.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfo.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,52 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.result; + +/** + * Interface that a ResultInfo must implements. + * + * This mechanism what previously known as "ResultName.java" using String constants. + * + * @author Eric Chatellier + * @since 4.4 + */ +public interface ResultInfo { + + /** + * Return necessary results info name for result to be calculated. + * + * @return the necessaryResult name + */ + public String[] getNecessaryResult(); + + /** + * Permet d'afficher a l'utilisateur une aide sur le resultat. + * + * @return L'aide ou la description du resultat + * @throws Exception + */ + public String getDescription() throws Exception; + +} Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfo.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfoHelper.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfoHelper.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfoHelper.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,109 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.result; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.IsisFishException; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; + +public class ResultInfoHelper { + + /** Class logger. */ + private static Log log = LogFactory.getLog(ResultInfoHelper.class); + + /** + * Clean result set to remove ending ".java" if present. + * + * @param results + * @return set with clean result name + */ + public static Set<String> cleanResultNames(Collection<String> results) { + Set<String> returnSet = new HashSet<>(); + for (String result : results) { + String cleanResult = StringUtils.removeEndIgnoreCase(result, ".java"); + returnSet.add(cleanResult); + } + return returnSet; + } + + /** + * Extract all necessary result from currentResult Set by adding all result's necessaryResults. + * + * This class can cause Result class compilation. + * + * @param currentResult input result set + * @return output result set + */ + public static Set<String> extractAllNecessaryResults(Set<String> currentResult) { + Set<String> destResult = new HashSet<>(); + Set<String> inputResult = new HashSet<>(currentResult); // copy for local modification + extractRecursiveResults(inputResult, destResult); + return destResult; + } + + /** + * Extract all necessary result into destResult from initial currentResult Set. + * + * @param inputResult src result list + * @param destResult dest result list + */ + protected static void extractRecursiveResults(Set<String> inputResult, Set<String> destResult) { + Collection<String> unexplored = CollectionUtils.subtract(inputResult, destResult); + + for (String result : unexplored) { + + // mark as done + // this way can handle infinite recursion defined by user scripts + destResult.add(result); + + try { + // add new + ResultInfoStorage storage = ResultInfoStorage.getResultInfo(result); + ResultInfo resultInfo = storage.getNewInstance(); + + if (resultInfo.getNecessaryResult() != null) { + Collections.addAll(inputResult, resultInfo.getNecessaryResult()); + } + } catch (IsisFishException ex) { + if (log.isErrorEnabled()) { + log.error("Result class can't be compiled", ex); + } + } + } + + if (!unexplored.isEmpty()) { // recursion condition + extractRecursiveResults(inputResult, destResult); + } + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/ResultInfoHelper.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/package-info.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/package-info.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/package-info.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,29 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ +/** + * Result info. + */ +package fr.ifremer.isisfish.result; + Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/result/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/ResultManager.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/ResultManager.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/ResultManager.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -44,6 +44,7 @@ import fr.ifremer.isisfish.entities.Population; import fr.ifremer.isisfish.export.ExportInfo; import fr.ifremer.isisfish.export.SensitivityExport; +import fr.ifremer.isisfish.result.ResultInfoHelper; import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.types.TimeStep; @@ -114,206 +115,212 @@ * sauvé ou non. */ public boolean isEnabled(String name) { - name = name.trim(); - if (enabledResult == null) { - SimulationParameter param = context.getSimulationStorage().getParameter(); - enabledResult = new HashSet<String>(); - - Collection<String> resultEnabled = param.getResultEnabled(); - enabledResult.addAll(resultEnabled); - List<String> exportNames = param.getExportNames(); - if (exportNames != null) { - for (String exportName : exportNames) { - ExportStorage storage = ExportStorage.getExport(exportName); - try { - ExportInfo export = storage.getNewInstance(); - for (String resultName : export.getNecessaryResult()) { - enabledResult.add(resultName); - } - } catch (IsisFishException eee) { - if (log.isWarnEnabled()) { - log.warn(t("Can't instanciate export %1$s", exportName), eee); - } - } - } - } - List<SensitivityExport> sensitivityExports = param.getSensitivityExport(); - if (sensitivityExports != null) { - for (SensitivityExport sensitivityExport : sensitivityExports) { - for (String resultName : sensitivityExport.getNecessaryResult()) { - enabledResult.add(resultName); - } - } - } - List<Rule> rules = param.getRules(); - if (rules != null) { - for (Rule rule : rules) { - for (String resultName : rule.getNecessaryResult()) { - enabledResult.add(resultName); - } - } - } - List<SimulationPlan> plans = param.getSimulationPlans(); - if (plans != null) { - for (SimulationPlan plan : plans) { - for (String resultName : plan.getNecessaryResult()) { - enabledResult.add(resultName); - } - } - } + name = name.trim(); + if (enabledResult == null) { + SimulationParameter param = context.getSimulationStorage().getParameter(); + + Set<String> requestedResult = ResultInfoHelper.cleanResultNames(param.getResultEnabled()); + + List<String> exportNames = param.getExportNames(); + if (exportNames != null) { + for (String exportName : exportNames) { + ExportStorage storage = ExportStorage.getExport(exportName); + try { + ExportInfo export = storage.getNewInstance(); + for (String resultName : export.getNecessaryResult()) { + requestedResult.add(resultName); + } + } catch (IsisFishException eee) { + if (log.isWarnEnabled()) { + log.warn(t("Can't instanciate export %1$s", exportName), eee); + } + } + } + } + List<SensitivityExport> sensitivityExports = param.getSensitivityExport(); + if (sensitivityExports != null) { + for (SensitivityExport sensitivityExport : sensitivityExports) { + for (String resultName : sensitivityExport.getNecessaryResult()) { + requestedResult.add(resultName); + } + } + } + List<Rule> rules = param.getRules(); + if (rules != null) { + for (Rule rule : rules) { + for (String resultName : rule.getNecessaryResult()) { + requestedResult.add(resultName); + } + } + } + List<SimulationPlan> plans = param.getSimulationPlans(); + if (plans != null) { + for (SimulationPlan plan : plans) { + for (String resultName : plan.getNecessaryResult()) { + requestedResult.add(resultName); + } + } + } + // on objective and optimization Objective objective = param.getObjective(); if (objective != null) { for (String resultName : objective.getNecessaryResult()) { - enabledResult.add(resultName); + requestedResult.add(resultName); } } - + Optimization optimization = param.getOptimization(); if (optimization != null) { for (String resultName : optimization.getNecessaryResult()) { - enabledResult.add(resultName); + requestedResult.add(resultName); } } - + // optimization export Map<ExportInfo, Observation> optimizationExportsObservations = param.getOptimizationExportsObservations(); if (optimizationExportsObservations != null) { for (ExportInfo export : optimizationExportsObservations.keySet()) { for (String resultName : export.getNecessaryResult()) { - enabledResult.add(resultName); + requestedResult.add(resultName); } } } - log.info("Enabled result: " + enabledResult); - } - boolean result = enabledResult.contains(name); - return result; - } - public void addActiveRule(TimeStep step, Rule rule) throws IsisFishException { - log.warn("addActiveRule not implemented"); - // FIXME: addActiveRule not implemented - } - - public void addResult(TimeStep step, MatrixND mat) throws IsisFishException{ - addResult(false, step, mat.getName(), mat); - } + // recursive result extraction + enabledResult = ResultInfoHelper.extractAllNecessaryResults(requestedResult); + + if (log.isInfoEnabled()) { + log.info("Enabled result: " + enabledResult); + } + } + + boolean result = enabledResult.contains(name); + return result; + } - public void addResult(TimeStep step, Population pop, MatrixND mat) throws IsisFishException{ - addResult(false, step, mat.getName(), pop, mat); - } + public void addActiveRule(TimeStep step, Rule rule) throws IsisFishException { + log.warn("addActiveRule not implemented"); + // FIXME: addActiveRule not implemented + } + + public void addResult(TimeStep step, MatrixND mat) throws IsisFishException{ + addResult(false, step, mat.getName(), mat); + } - public void addResult(boolean force, TimeStep step, MatrixND mat) throws IsisFishException{ - addResult(force, step, mat.getName(), mat); - } + public void addResult(TimeStep step, Population pop, MatrixND mat) throws IsisFishException{ + addResult(false, step, mat.getName(), pop, mat); + } - public void addResult(boolean force, TimeStep step, Population pop, MatrixND mat) throws IsisFishException{ - addResult(force, step, mat.getName(), pop, mat); - } + public void addResult(boolean force, TimeStep step, MatrixND mat) throws IsisFishException{ + addResult(force, step, mat.getName(), mat); + } - public void addResult(TimeStep step, String name, Population pop, MatrixND mat) throws IsisFishException{ - addResult(false, step, name, pop, mat); - } + public void addResult(boolean force, TimeStep step, Population pop, MatrixND mat) throws IsisFishException{ + addResult(force, step, mat.getName(), pop, mat); + } - public void addResult(TimeStep step, String name, MatrixND mat) throws IsisFishException{ - addResult(false, step, name, mat); - } + public void addResult(TimeStep step, String name, Population pop, MatrixND mat) throws IsisFishException{ + addResult(false, step, name, pop, mat); + } + + public void addResult(TimeStep step, String name, MatrixND mat) throws IsisFishException{ + addResult(false, step, name, mat); + } - public void addResult(boolean force, TimeStep step, String name, Population pop, MatrixND mat) throws IsisFishException{ - // don't call generic addResult, because pop name is added - if (force || isEnabled(name)) { - for (SimulationResultListener l : listeners) { - l.addResult(context, step, name + " " + pop, mat); - } - } - } + public void addResult(boolean force, TimeStep step, String name, Population pop, MatrixND mat) throws IsisFishException{ + // don't call generic addResult, because pop name is added + if (force || isEnabled(name)) { + for (SimulationResultListener l : listeners) { + l.addResult(context, step, name + " " + pop, mat); + } + } + } - public void addResult(boolean force, TimeStep step, String name, MatrixND mat) throws IsisFishException{ - if (force || isEnabled(name)) { - for (SimulationResultListener l : listeners) { - l.addResult(context, step, name, mat); - } - } - } + public void addResult(boolean force, TimeStep step, String name, MatrixND mat) throws IsisFishException{ + if (force || isEnabled(name)) { + for (SimulationResultListener l : listeners) { + l.addResult(context, step, name, mat); + } + } + } - /** - * Retourne la matrice stocke pour un pas de temps - * @param step le pas de temps que l'on souhaite - * @param pop la population pour lequelle on souhaite le resultat - * @param name le nom des resultats dont on veut la matrice - * @return La matrice demandée ou null si aucune matrice ne correspond a - * la demande. - */ - public MatrixND getMatrix(TimeStep step, Population pop, String name){ - name += " " + pop; - return getMatrix(step, name); - } + /** + * Retourne la matrice stocke pour un pas de temps + * @param step le pas de temps que l'on souhaite + * @param pop la population pour lequelle on souhaite le resultat + * @param name le nom des resultats dont on veut la matrice + * @return La matrice demandée ou null si aucune matrice ne correspond a + * la demande. + */ + public MatrixND getMatrix(TimeStep step, Population pop, String name){ + name += " " + pop; + return getMatrix(step, name); + } - /** - * Retourne la matrice stocke pour un pas de temps - * @param step le pas de temps que l'on souhaite - * @param name le nom des resultats dont on veut la matrice - * @return La matrice demandée ou null si aucune matrice ne correspond a - * la demande. - */ - public MatrixND getMatrix(TimeStep step, String name){ - MatrixND result = null; - if (getter != null) { - result = getter.getMatrix(context, step, name); - } - return result; - } + /** + * Retourne la matrice stocke pour un pas de temps + * @param step le pas de temps que l'on souhaite + * @param name le nom des resultats dont on veut la matrice + * @return La matrice demandée ou null si aucune matrice ne correspond a + * la demande. + */ + public MatrixND getMatrix(TimeStep step, String name){ + MatrixND result = null; + if (getter != null) { + result = getter.getMatrix(context, step, name); + } + return result; + } - /** - * Retourne la matrice stocke pour des pas de temps - * @param steps les pas de temps que l'on souhaite - * @param pop la population pour lequelle on souhaite le resultat - * @param name le nom des resultats dont on veut la matrice - * @return La matrice demandée ou null si aucune matrice ne correspond a - * la demande. - */ - public MatrixND getMatrix(List<TimeStep> steps, Population pop, String name){ - name += " " + pop; - return getMatrix(steps, name); - } + /** + * Retourne la matrice stocke pour des pas de temps + * @param steps les pas de temps que l'on souhaite + * @param pop la population pour lequelle on souhaite le resultat + * @param name le nom des resultats dont on veut la matrice + * @return La matrice demandée ou null si aucune matrice ne correspond a + * la demande. + */ + public MatrixND getMatrix(List<TimeStep> steps, Population pop, String name){ + name += " " + pop; + return getMatrix(steps, name); + } - /** - * Retourne la matrice stocke pour des pas de temps - * @param steps les pas de temps que l'on souhaite - * @param name le nom des resultats dont on veut la matrice - * @return La matrice demandée ou null si aucune matrice ne correspond a - * la demande. - */ - public MatrixND getMatrix(List<TimeStep> steps, String name){ - MatrixND result = null; - if (getter != null) { - result = getter.getMatrix(context, steps, name); - } - return result; - } + /** + * Retourne la matrice stocke pour des pas de temps + * @param steps les pas de temps que l'on souhaite + * @param name le nom des resultats dont on veut la matrice + * @return La matrice demandée ou null si aucune matrice ne correspond a + * la demande. + */ + public MatrixND getMatrix(List<TimeStep> steps, String name){ + MatrixND result = null; + if (getter != null) { + result = getter.getMatrix(context, steps, name); + } + return result; + } - /** - * Retourne une matrice contenant tous les pas de temps. - * @param pop la population pour lequel on souhaite la matrice - * @param name le nom des resultats dont on veut une matrice globale. - */ - public MatrixND getMatrix(Population pop, String name){ - name += " " + pop; - return getMatrix(name); - } + /** + * Retourne une matrice contenant tous les pas de temps. + * @param pop la population pour lequel on souhaite la matrice + * @param name le nom des resultats dont on veut une matrice globale. + */ + public MatrixND getMatrix(Population pop, String name){ + name += " " + pop; + return getMatrix(name); + } - /** - * Retourne une matrice contenant tous les pas de temps. - * @param name le nom des resultats dont on veut une matrice globale. - */ - public MatrixND getMatrix(String name){ - MatrixND result = null; - if (getter != null) { - result = getter.getMatrix(context, name); - } - return result; - } - + /** + * Retourne une matrice contenant tous les pas de temps. + * @param name le nom des resultats dont on veut une matrice globale. + */ + public MatrixND getMatrix(String name){ + MatrixND result = null; + if (getter != null) { + result = getter.getMatrix(context, name); + } + return result; + } } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/SimulationParameterImpl.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -1357,12 +1357,22 @@ if (resultEnabled == null) { - resultEnabled = new LinkedList<String>(); + resultEnabled = new LinkedList<>(); if (propertiesParameters != null) { String[] resultList = SimulationParameterPropertiesHelper.getResultNames(propertiesParameters); - Collections.addAll(resultEnabled, resultList); + + // en version < 4.4, les noms de resultats commencait par une minuscule + // il doivent etre capitalized pour matcher la classe correspondante + if (VersionUtil.smallerThan(getIsisFishVersion(), "4.4.0.0")) { + for (String result : resultList) { + String migrated = StringUtils.capitalize(result); + resultEnabled.add(migrated); + } + } else { + Collections.addAll(resultEnabled, resultList); + } } } return resultEnabled; Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/simulator/launcher/SimulationService.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -65,11 +65,13 @@ import fr.ifremer.isisfish.IsisConfig; import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.IsisFishException; import fr.ifremer.isisfish.IsisFishRuntimeException; import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.datastore.OptimizationStorage; import fr.ifremer.isisfish.datastore.RegionStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.ScriptStorage; import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; @@ -77,9 +79,12 @@ import fr.ifremer.isisfish.datastore.SimulationPlanStorage; import fr.ifremer.isisfish.datastore.SimulationStorage; import fr.ifremer.isisfish.datastore.SimulatorStorage; +import fr.ifremer.isisfish.export.Export; import fr.ifremer.isisfish.export.ExportInfo; import fr.ifremer.isisfish.export.SensitivityExport; import fr.ifremer.isisfish.mexico.MexicoHelper; +import fr.ifremer.isisfish.result.ResultInfo; +import fr.ifremer.isisfish.result.ResultInfoHelper; import fr.ifremer.isisfish.rule.Rule; import fr.ifremer.isisfish.simulator.Objective; import fr.ifremer.isisfish.simulator.Optimization; @@ -691,6 +696,7 @@ * <ul> * <li> scripts</li> * <li> rules</li> + * <li> resultinfos</li> * <li> exports</li> * <li> simulators</li> * <li> optimisations</li> @@ -709,8 +715,10 @@ * @param param les parametre de la simulation * @param xmlDesignPlan contenu xml des design plan * @param sensitivityScenarios used to add some extra files (such as rules) + * * @return un zip de simulation pour une simulation pret a être faite - * @throws SimulationException pour tout problème rencontré (IO,Topia...) + * + * @throws SimulationException pour tout problème rencontré (IO,Topia,Script compilation...) */ protected File prepareSimulationZipFile(SimulationControl control, SimulationParameter param, String xmlDesignPlan, SensitivityScenarios sensitivityScenarios) @@ -736,6 +744,9 @@ tc.closeContext(); control.setText(t("isisfish.message.backup.database.finished")); + // result are in various scripts + Set<String> necessaryResults = new HashSet<>(); + // extract Rules defined in factors List<Rule> rules = param.getRules(); if (sensitivityScenarios != null) { @@ -757,19 +768,33 @@ } FileUtils.copyFile(ruleFile, new File(tmpDirectory, RuleStorage.RULE_PATH + File.separator + name + ".java")); + + // results + if (rule.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, rule.getNecessaryResult()); + } } // copie des regles reclamées par les plans de simulation for (String name : param.getExtraRules()) { + RuleStorage ruleStorage = RuleStorage.getRule(name); + Rule rule = ruleStorage.getNewInstance(); + + // copy File ruleFile = new File(RuleStorage.getRuleDirectory(), name + ".java"); if (!ruleFile.isFile()) { ruleFile = new File(RuleStorage.getCommunityRuleDirectory(), name + ".java"); } FileUtils.copyFile(ruleFile, new File(tmpDirectory, RuleStorage.RULE_PATH + File.separator + name + ".java")); + + // results + if (rule.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, rule.getNecessaryResult()); + } } - // copie de toutes regles a utiliser + // copie de tous les plans a utiliser List<SimulationPlan> plans = param.getSimulationPlans(); for (SimulationPlan plan : plans) { String name = SimulationPlanStorage.getName(plan); @@ -779,10 +804,20 @@ } FileUtils.copyFile(planFile, new File(tmpDirectory, SimulationPlanStorage.SIMULATION_PLAN_PATH + File.separator + name + ".java")); + + // results + if (plan.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, plan.getNecessaryResult()); + } } // copie de tous les exports a utiliser for (String name : param.getExportNames()) { + // new instance + ExportStorage exportStorage = ExportStorage.getExport(name); + Export export = exportStorage.getNewInstance(); + + // copy name = name.endsWith(".java") ? name : name + ".java"; File exportFile = new File(ExportStorage.getExportDirectory(), name); if (!exportFile.isFile()) { @@ -791,6 +826,11 @@ FileUtils.copyFile(exportFile, new File(tmpDirectory, ExportStorage.EXPORT_PATH + File.separator + name)); + + // results + if (export.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, export.getNecessaryResult()); + } } // copie de tous les exports de sensitivity a utiliser @@ -804,6 +844,11 @@ FileUtils.copyFile(sensitivityFile, new File(tmpDirectory, SensitivityExportStorage.SENSITIVITY_EXPORT_PATH + File.separator + name)); + + // results + if (sensitivity.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, sensitivity.getNecessaryResult()); + } } // copie de la fonction d'objectif @@ -816,6 +861,11 @@ } FileUtils.copyFile(objectiveFile, new File(tmpDirectory, ObjectiveStorage.OBJECTIVE_PATH + File.separator + name + ".java")); + + // results + if (objective.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, objective.getNecessaryResult()); + } } // copie du script d'optipmisation @@ -828,6 +878,11 @@ } FileUtils.copyFile(optimizationFile, new File(tmpDirectory, OptimizationStorage.OPTIMIZATION_PATH + File.separator + name + ".java")); + + // results + if (optimization.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, optimization.getNecessaryResult()); + } } // copie des export d'optimisation @@ -843,6 +898,11 @@ FileUtils.copyFile(exportFile, new File(tmpDirectory, ExportStorage.EXPORT_PATH + File.separator + name)); + + // results + if (export.getNecessaryResult() != null) { + Collections.addAll(necessaryResults, export.getNecessaryResult()); + } } } @@ -855,7 +915,22 @@ SimulatorStorage.SIMULATOR_PATH + File.separator + param.getSimulatorName())); + // copie de tous les résultats + Set<String> allNecessaryResults = ResultInfoHelper.extractAllNecessaryResults(necessaryResults); + for (String result : allNecessaryResults) { + String filename = result.endsWith(".java") ? result : result + ".java"; + // copy + File resultFile = new File(ResultInfoStorage.getResultInfoDirectory(), filename); + if (!resultFile.isFile()) { + resultFile = new File(ResultInfoStorage.getCommunityResultInfoDirectory(), filename); + } + FileUtils.copyFile(resultFile, + new File(tmpDirectory, ResultInfoStorage.RESULT_INFO_PATH + + File.separator + result)); + } + // compile and add dependencies + // used results will be added here compileAllFile(control, tmpDirectory); // sauvegarde du design plan en XML @@ -875,14 +950,10 @@ } return result; - } catch (IOException eee) { + } catch (IOException|IsisFishException|TopiaException eee) { throw new SimulationException( t("isisfish.error.prepare.information.simulation"), eee); - } catch (TopiaException eee) { - throw new SimulationException( - t("isisfish.error.prepare.information.simulation"), eee); } - } /** @@ -910,7 +981,7 @@ List<File> fileToCompile = new ArrayList<>(); // *.java List<File> fileToInpect = new ArrayList<>(); // *.class - Set<String> dependencies = new HashSet<String>(); // packages + Set<String> dependencies = new HashSet<>(); // packages String[] modules = { ExportStorage.EXPORT_PATH, Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/common/ScriptParametersTableCellRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/common/ScriptParametersTableCellRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/common/ScriptParametersTableCellRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -32,7 +32,7 @@ import javax.swing.table.DefaultTableCellRenderer; import fr.ifremer.isisfish.datastore.JavaSourceStorage; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; import fr.ifremer.isisfish.util.Doc; /** @@ -69,7 +69,7 @@ c.setText(parameterName); Doc doc = JavaSourceStorage.getParameterDoc(script, parameterName); - String documentation = TooltipHelper.docToString(doc); + String documentation = RendererHelper.docToString(doc); c.setToolTipText(documentation); return c; Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/export/ExportNameListRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.ExportStorage; import fr.ifremer.isisfish.export.ExportInfo; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des noms d'export. @@ -90,7 +90,7 @@ c.setToolTipText(export.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", exportName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", exportName)); c.setToolTipText(errorTooltip); } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/ObjectiveComboRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/ObjectiveComboRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/ObjectiveComboRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.simulator.Objective; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des script d'optimisation. @@ -91,7 +91,7 @@ c.setToolTipText(objective.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", objectiveName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", objectiveName)); c.setToolTipText(errorTooltip); } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/OptimizationComboRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/OptimizationComboRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/optimization/OptimizationComboRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.OptimizationStorage; import fr.ifremer.isisfish.simulator.Optimization; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des script d'optimisation. @@ -91,7 +91,7 @@ c.setToolTipText(optim.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", optimizationName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", optimizationName)); c.setToolTipText(errorTooltip); } Added: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultInfoNameListRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultInfoNameListRenderer.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultInfoNameListRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,103 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ + +package fr.ifremer.isisfish.ui.models.result; + +import java.awt.Component; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.DefaultListCellRenderer; +import javax.swing.JLabel; +import javax.swing.JList; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import fr.ifremer.isisfish.datastore.ResultInfoStorage; +import fr.ifremer.isisfish.result.ResultInfo; +import fr.ifremer.isisfish.ui.util.RendererHelper; + +/** + * Renderer pour les listes des noms de resultats. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ResultInfoNameListRenderer extends DefaultListCellRenderer { + + /** Class logger. */ + private static final Log log = LogFactory.getLog(ResultInfoNameListRenderer.class); + + /** serialVersionUID. */ + private static final long serialVersionUID = -4070846632975105788L; + + /** Rule cache. */ + protected Map<String, ResultInfo> resultNameCache; + + /** + * Empty constructor. + */ + public ResultInfoNameListRenderer() { + resultNameCache = new HashMap<>(); + } + + /* + * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) + */ + @Override + public Component getListCellRendererComponent(JList<?> list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + + // this must be used to have alterned highlight rows and default + // selection color + JLabel c = (JLabel)super.getListCellRendererComponent(list,value,index, isSelected, cellHasFocus); + + String resultNameName = (String)value; + String text = null; + try { + ResultInfo resultInfo = resultNameCache.get(resultNameName); + if (resultInfo == null) { + ResultInfoStorage storage = ResultInfoStorage.getResultInfo(resultNameName); + resultInfo = storage.getNewInstance(); + resultNameCache.put(resultNameName, resultInfo); + } + + text = RendererHelper.getNameAndDocString(resultNameName, resultInfo.getDescription()); + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("eee", ex); + } + text = RendererHelper.getNameAndCompilationString(resultNameName); + } + + c.setText(text); + + return c; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultInfoNameListRenderer.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/result/ResultListRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -1,105 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, Code Lutin - * %% - * 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% - */ - -package fr.ifremer.isisfish.ui.models.result; - -import static org.nuiton.i18n.I18n.t; - -import java.awt.Component; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.DefaultListCellRenderer; -import javax.swing.JLabel; -import javax.swing.JList; - -import fr.ifremer.isisfish.datastore.ScriptStorage; -import fr.ifremer.isisfish.ui.util.TooltipHelper; -import fr.ifremer.isisfish.util.Doc; - -/** - * Renderer pour la combo des noms de regles. - * - * TODO don't work for now, worg with field name, not field values !!! - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class ResultListRenderer extends DefaultListCellRenderer { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4070846632975105788L; - - /** Cache map for doc corresponding to value. */ - protected Map<String, String> docForValue; - - public ResultListRenderer() { - docForValue = new HashMap<String, String>(); - } - - /* - * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) - */ - @Override - public Component getListCellRendererComponent(JList<?> list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - // this must be used to have alterned highlight rows and default - // selection color - JLabel c = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - String resultName = (String)value; - c.setText(resultName); - - String tooltip = docForValue.get(resultName); - if (tooltip == null) { - // c'est tres couteux d'avoir la doc en fonction - // de la valeur d'un des attributs - try { - ScriptStorage storage = ScriptStorage.getScript("ResultName.java"); - Class<?> resultNameClass = storage.getCodeClass(); - Field[] fields = resultNameClass.getFields(); - for (Field f : fields) { - String fieldValue = (String) f.get(null); - if (fieldValue != null && fieldValue.equals(resultName)) { - Doc doc = f.getAnnotation(Doc.class); - tooltip = TooltipHelper.docToString(doc); - } - } - } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", "ResultName.java")); - c.setToolTipText(errorTooltip); - } - } - - setToolTipText(tooltip); - - return c; - } -} Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/rule/RuleNamesListRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -25,9 +25,6 @@ package fr.ifremer.isisfish.ui.models.rule; -import static org.nuiton.i18n.I18n.t; - -import java.awt.Color; import java.awt.Component; import java.util.HashMap; import java.util.Map; @@ -38,7 +35,7 @@ import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.rule.Rule; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour les listes des noms de regles. @@ -74,10 +71,11 @@ // this must be used to have alterned highlight rows and default // selection color JLabel c = (JLabel)super.getListCellRendererComponent(list,value,index, isSelected, cellHasFocus); - - String ruleName = (String)value; - c.setText(ruleName); + /*String ruleName = (String)value; + String TEMPLATE = "<html><b>%s</b><br /><font color='gray'>%s</font></html>"; + c.setText(String.format(TEMPLATE, ruleName, "test")); + // c'est tres couteux d'avoir une instance // on les met en cache try { @@ -91,10 +89,26 @@ c.setToolTipText(rule.getDescription()); c.setForeground(null); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", ruleName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", ruleName)); c.setToolTipText(errorTooltip); c.setForeground(Color.RED); + }*/ + + String ruleName = (String)value; + String text = null; + try { + Rule rule = ruleCache.get(ruleName); + if (rule == null) { + RuleStorage storage = RuleStorage.getRule(ruleName); + rule = storage.getNewInstance(); + ruleCache.put(ruleName, rule); + } + + text = RendererHelper.getNameAndDocString(ruleName, rule.getDescription()); + } catch (Exception ex) { + text = RendererHelper.getNameAndCompilationString(ruleName); } + c.setText(text); return c; } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityanalysis/SensitivityAnalysisComboRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityanalysis/SensitivityAnalysisComboRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityanalysis/SensitivityAnalysisComboRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; import fr.ifremer.isisfish.simulator.sensitivity.SensitivityAnalysis; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des calculateurs de sensibilités. @@ -91,7 +91,7 @@ c.setToolTipText(plan.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", sensitivityName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", sensitivityName)); c.setToolTipText(errorTooltip); } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/sensitivityexport/SensitivityExportNameListRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.SensitivityExportStorage; import fr.ifremer.isisfish.export.SensitivityExport; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des noms d'export. @@ -90,7 +90,7 @@ c.setToolTipText(export.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", exportName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", exportName)); c.setToolTipText(errorTooltip); } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/simulationplan/SimulationPlanComboRenderer.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/simulationplan/SimulationPlanComboRenderer.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/models/simulationplan/SimulationPlanComboRenderer.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -37,7 +37,7 @@ import fr.ifremer.isisfish.datastore.SimulationPlanStorage; import fr.ifremer.isisfish.simulator.SimulationPlan; -import fr.ifremer.isisfish.ui.util.TooltipHelper; +import fr.ifremer.isisfish.ui.util.RendererHelper; /** * Renderer pour la combo des plans de simulation. @@ -91,7 +91,7 @@ c.setToolTipText(plan.getDescription()); } catch (Exception e) { - String errorTooltip = TooltipHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", simulationPlanName)); + String errorTooltip = RendererHelper.getErrorTooltip(t("isisfish.error.compile.fileerror", simulationPlanName)); c.setToolTipText(errorTooltip); } Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/FileSelectionTableModel.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/FileSelectionTableModel.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/FileSelectionTableModel.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -181,8 +181,7 @@ public void setAllChecked(boolean selection) { if (selection) { selectedFiles.addAll(availableFiles); - } - else { + } else { selectedFiles.clear(); } fireTableDataChanged(); Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptHandler.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptHandler.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptHandler.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -77,6 +77,7 @@ import fr.ifremer.isisfish.datastore.JavaSourceStorage; import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.datastore.OptimizationStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.ScriptStorage; import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; @@ -336,6 +337,9 @@ case CommunityObjective: script = ObjectiveStorage.createObjective(fileName, Location.COMMUNITY); break; + case CommunityResultInfo: + script = ResultInfoStorage.createResultInfo(fileName, Location.COMMUNITY); + break; case CommunityOptimization: script = OptimizationStorage.createOptimization(fileName, Location.COMMUNITY); break; @@ -472,6 +476,9 @@ case Rule: script = RuleStorage.getRule(file.getName(), Location.OFFICIAL); break; + case ResultInfo: + script = ResultInfoStorage.getResultInfo(file.getName(), Location.OFFICIAL); + break; case Objective: script = ObjectiveStorage.getObjective(file.getName(), Location.OFFICIAL); break; @@ -506,6 +513,9 @@ case CommunityRule: script = RuleStorage.getRule(file.getName(), Location.COMMUNITY); break; + case CommunityResultInfo: + script = ResultInfoStorage.getResultInfo(file.getName(), Location.COMMUNITY); + break; case CommunitySimulationPlan: script = SimulationPlanStorage.getSimulationPlan(file.getName(), Location.COMMUNITY); break; @@ -963,6 +973,9 @@ Rule( RuleStorage.getRuleDirectory(), RuleStorage.RULE_TEMPLATE, true), + ResultInfo( + ResultInfoStorage.getResultInfoDirectory(), + ResultInfoStorage.RESULT_NAME_TEMPLATE, true), Objective( ObjectiveStorage.getObjectiveDirectory(), ObjectiveStorage.OBJECTIVE_TEMPLATE, true), @@ -996,13 +1009,16 @@ ExportStorage.EXPORT_STEP_TEMPLATE), CommunityObjective( ObjectiveStorage.getCommunityObjectiveDirectory(), - ObjectiveStorage.OBJECTIVE_TEMPLATE, true), + ObjectiveStorage.OBJECTIVE_TEMPLATE), CommunityOptimization( OptimizationStorage.getCommunityOptimizationDirectory(), - OptimizationStorage.OPTIMIZATION_TEMPLATE, true), + OptimizationStorage.OPTIMIZATION_TEMPLATE), CommunityRule( RuleStorage.getCommunityRuleDirectory(), RuleStorage.RULE_TEMPLATE), + CommunityResultInfo( + ResultInfoStorage.getCommunityResultInfoDirectory(), + ResultInfoStorage.RESULT_NAME_TEMPLATE), CommunityScript( ScriptStorage.getCommunityScriptDirectory(), ScriptStorage.SCRIPT_TEMPLATE), Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/ScriptUI.jaxx 2015-06-17 13:53:01 UTC (rev 4271) @@ -55,6 +55,8 @@ onActionPerformed='handler.newScript(ScriptHandler.ScriptMapping.CommunityExportStep)' icon="script/script.png" /> <JMenuItem id="miNewRule" text="isisfish.script.menu.txtNewRule" onActionPerformed='handler.newScript(ScriptHandler.ScriptMapping.CommunityRule)' icon="script/script.png" /> + <JMenuItem id="miNewResultInfo" text="isisfish.script.menu.txtNewResultInfo" + onActionPerformed='handler.newScript(ScriptHandler.ScriptMapping.CommunityResultInfo)' icon="script/script.png" /> <JMenuItem id="miNewSImulationPlan" text="isisfish.script.menu.txtNewSimulationPlan" onActionPerformed='handler.newScript(ScriptHandler.ScriptMapping.CommunitySimulationPlan)' icon="script/script.png" /> <JMenuItem id="miNewSensitivity" text="isisfish.script.menu.txtNewSensitivity" Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/script/model/ScriptTreeModel.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -41,15 +41,16 @@ import org.jdesktop.swingx.tree.TreeModelSupport; import fr.ifremer.isisfish.IsisFish; +import fr.ifremer.isisfish.datastore.ExportStorage; +import fr.ifremer.isisfish.datastore.FormuleStorage; import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.datastore.OptimizationStorage; -import fr.ifremer.isisfish.datastore.SimulationPlanStorage; -import fr.ifremer.isisfish.datastore.ExportStorage; -import fr.ifremer.isisfish.datastore.FormuleStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.ScriptStorage; +import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; import fr.ifremer.isisfish.datastore.SensitivityExportStorage; -import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; +import fr.ifremer.isisfish.datastore.SimulationPlanStorage; import fr.ifremer.isisfish.datastore.SimulatorStorage; import fr.ifremer.isisfish.vcs.VCS; @@ -78,7 +79,7 @@ protected TreeModelSupport modelSupport; /** VCS list. */ - protected List<VCS> vcsList = new ArrayList<VCS>(); + protected List<VCS> vcsList = new ArrayList<>(); /** Categories files for VCS. */ protected Map<VCS, List<File>> rootFiles; @@ -93,28 +94,30 @@ public ScriptTreeModel() { modelSupport = new TreeModelSupport(this); - rootFiles = new HashMap<VCS, List<File>>(); + rootFiles = new HashMap<>(); List<File> offFiles = new ArrayList<File>(); offFiles.add(ExportStorage.getExportDirectory()); offFiles.add(FormuleStorage.getFormuleDirectory()); offFiles.add(ObjectiveStorage.getObjectiveDirectory()); offFiles.add(OptimizationStorage.getOptimizationDirectory()); + offFiles.add(ResultInfoStorage.getResultInfoDirectory()); offFiles.add(RuleStorage.getRuleDirectory()); offFiles.add(ScriptStorage.getScriptDirectory()); + offFiles.add(SensitivityAnalysisStorage.getSensitivityAnalysisDirectory()); offFiles.add(SensitivityExportStorage.getSensitivityExportDirectory()); - offFiles.add(SensitivityAnalysisStorage.getSensitivityAnalysisDirectory()); offFiles.add(SimulationPlanStorage.getSimulationPlanDirectory()); offFiles.add(SimulatorStorage.getSimulatorDirectory()); - List<File> comFiles = new ArrayList<File>(); + List<File> comFiles = new ArrayList<>(); comFiles.add(ExportStorage.getCommunityExportDirectory()); comFiles.add(FormuleStorage.getCommunityFormuleDirectory()); comFiles.add(ObjectiveStorage.getCommunityObjectiveDirectory()); comFiles.add(OptimizationStorage.getCommunityOptimizationDirectory()); + comFiles.add(ResultInfoStorage.getCommunityResultInfoDirectory()); comFiles.add(RuleStorage.getCommunityRuleDirectory()); comFiles.add(ScriptStorage.getCommunityScriptDirectory()); + comFiles.add(SensitivityAnalysisStorage.getCommunitySensitivityAnalysisDirectory()); comFiles.add(SensitivityExportStorage.getCommunitySensitivityExportDirectory()); - comFiles.add(SensitivityAnalysisStorage.getCommunitySensitivityAnalysisDirectory()); comFiles.add(SimulationPlanStorage.getCommunitySimulationPlanDirectory()); comFiles.add(SimulatorStorage.getCommunitySimulatorDirectory()); Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceHandler.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceHandler.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceHandler.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -24,7 +24,6 @@ import static org.nuiton.i18n.I18n.t; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; @@ -34,10 +33,9 @@ import org.apache.commons.logging.LogFactory; import fr.ifremer.isisfish.IsisFish; -import fr.ifremer.isisfish.datastore.ScriptStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.ui.WelcomePanelUI; import fr.ifremer.isisfish.ui.models.common.GenericListModel; -import fr.ifremer.isisfish.ui.util.ErrorHelper; /** * Result choice UI handler. @@ -60,51 +58,17 @@ } public void refresh() { - - // FIXME listen for result name modification - - setListSimulResultChooseModel(); + setResultNameModel(); } - - /** - * Looking for ResultName.java script and read all fields and fill - * list of field value and doc - * @return the list of result names found in ResultName script - */ - protected List<String> getResultNames() { - List<String> result = new ArrayList<String>(); - try { - ScriptStorage storage = ScriptStorage.getScript("ResultName.java"); - Class<?> resultNameClass = storage.getCodeClass(); - // TODO: if we can't find class, perhaps try to parser Java source ? - Field[] fields = resultNameClass.getFields(); - for (Field f : fields) { - String fieldName = (String) f.get(null); - result.add(fieldName); - } - } catch (Exception eee) { - if (log.isWarnEnabled()) { - log.warn("Can't find result name script", eee); - } - ErrorHelper.showErrorDialog(t("isisfish.error.simulation.getresultname"), eee); - } - return result; - } - - public List<String> getDefaultResultNames() { - return IsisFish.config.getDefaultResultNamesAsList(); - } - - protected void setListSimulResultChooseModel() { - - List<String> availableResults = getResultNames(); - List<String> userResults = getDefaultResultNames(); - // userResults = intersection(userResults,availableResult) - userResults.retainAll(availableResults); - + + protected void setResultNameModel() { + // get full list + List<String> availableResults = ResultInfoStorage.getResultInfoNames(); GenericListModel<String> resultModel = new GenericListModel<>(availableResults); tabUI.listResultNames.setModel(resultModel); - + + // restore previous selection + List<String> userResults = IsisFish.config.getDefaultResultNamesAsList(); for (String userResult : userResults) { int index = availableResults.indexOf(userResult); tabUI.listResultNames.addSelectionInterval(index, index); Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/simulator/ResultChoiceUI.jaxx 2015-06-17 13:53:01 UTC (rev 4271) @@ -36,7 +36,7 @@ <JScrollPane constraints='BorderLayout.CENTER'> <JList id="listResultNames" selectionMode="{javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}" genericType="String" - cellRenderer='{new fr.ifremer.isisfish.ui.models.result.ResultListRenderer()}' + cellRenderer='{new fr.ifremer.isisfish.ui.models.result.ResultInfoNameListRenderer()}' onValueChanged='handler.saveParametersResultNames(event)' /> </JScrollPane> <JButton constraints='BorderLayout.SOUTH' text="isisfish.common.saveNextSimulation" onActionPerformed='handler.saveConfigResultNames()'/> Copied: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/RendererHelper.java (from rev 4267, branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/TooltipHelper.java) =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/RendererHelper.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/RendererHelper.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,117 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * %% + * 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% + */ + +package fr.ifremer.isisfish.ui.util; + +import static org.nuiton.i18n.I18n.t; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; + +import fr.ifremer.isisfish.util.Doc; + +/** + * Common format utils methods mostly used in renderers. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class RendererHelper { + + protected static final String DOCUMENTATION_SUBTITLE = "<html><b>%s</b><br /><font color='gray'>%s</font></html>"; + protected static final String COMPILATION_SUBTITLE = "<html><b>%s</b><br /><font color='red'>%s</font></html>"; + + /** + * Return HTML formatted tooltip. + * + * Use optional documentation (if any) or use @Doc's class doc. + * + * @param doc the doc to use + * @param optionalDocumentations optional documentation + * @return a string nicely print version + */ + public static String docToString(Doc doc, String... optionalDocumentations) { + + String tooltip = null; + + if (doc != null) { + StringBuilder sb = new StringBuilder(); + sb.append("<html>"); + if (!ArrayUtils.isEmpty(optionalDocumentations)) { + for (String optionalDocumentation : optionalDocumentations) { + sb.append("<p>" + optionalDocumentation + "</p>"); + } + } else { + sb.append("<p>" + doc.value() + "</p>"); + } + if (!StringUtils.isEmpty(doc.author())) { + sb.append("<p><b>author: </b>" + doc.author() + "</p>"); + } + if (!StringUtils.isEmpty(doc.date())) { + sb.append("<p><b>date: </b>" + doc.date() + "</p>"); + } + if (!StringUtils.isEmpty(doc.version())) { + sb.append("<p><b>version: </b>" + doc.version() + "</p>"); + } + sb.append("</html>"); + tooltip = sb.toString(); + + // replace all \n by <br/> + tooltip = tooltip.replace("\n", "<br/>"); + } + return tooltip; + } + + /** + * Format error as tootip error messsage. + * + * @param errorMessage error message + * @return html formated string + * @deprecated since 4.4, should be replaced by renderer with description + */ + @Deprecated + public static String getErrorTooltip(String errorMessage) { + StringBuilder sb = new StringBuilder(); + sb.append("<html>"); + sb.append("<font color='red'><b>"); + sb.append(errorMessage); + sb.append("</b></font>"); + sb.append("</html>"); + return sb.toString(); + } + + public static String getNameAndDocString(String name, String documentation) { + String result = String.format(DOCUMENTATION_SUBTITLE, name, documentation); + return result; + } + + public static String getNameAndCompilationString(String name) { + String result = String.format(COMPILATION_SUBTITLE, name, t("isisfish.error.compile.documentationerror")); + return result; + } +} Deleted: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/TooltipHelper.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/TooltipHelper.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/ui/util/TooltipHelper.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -1,100 +0,0 @@ -/* - * #%L - * IsisFish - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin - * %% - * 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% - */ - -package fr.ifremer.isisfish.ui.util; - -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; - -import fr.ifremer.isisfish.util.Doc; - -/** - * Tooltip common utils methods. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class TooltipHelper { - - /** - * Return HTML formatted tooltip. - * - * Use optional documentation (if any) or use @Doc's class doc. - * - * @param doc the doc to use - * @param optionalDocumentations optional documentation - * @return a string nicely print version - */ - public static String docToString(Doc doc, String... optionalDocumentations) { - - String tooltip = null; - - if (doc != null) { - StringBuilder sb = new StringBuilder(); - sb.append("<html>"); - if (!ArrayUtils.isEmpty(optionalDocumentations)) { - for (String optionalDocumentation : optionalDocumentations) { - sb.append("<p>" + optionalDocumentation + "</p>"); - } - } else { - sb.append("<p>" + doc.value() + "</p>"); - } - if (!StringUtils.isEmpty(doc.author())) { - sb.append("<p><b>author: </b>" + doc.author() + "</p>"); - } - if (!StringUtils.isEmpty(doc.date())) { - sb.append("<p><b>date: </b>" + doc.date() + "</p>"); - } - if (!StringUtils.isEmpty(doc.version())) { - sb.append("<p><b>version: </b>" + doc.version() + "</p>"); - } - sb.append("</html>"); - tooltip = sb.toString(); - - // replace all \n by <br/> - tooltip = tooltip.replace("\n", "<br/>"); - } - return tooltip; - } - - /** - * Format error as tootip error messsage. - * - * @param errorMessage error message - * @return html formated string - */ - public static String getErrorTooltip(String errorMessage) { - StringBuilder sb = new StringBuilder(); - sb.append("<html>"); - sb.append("<font color='red'><b>"); - sb.append(errorMessage); - sb.append("</b></font>"); - sb.append("</html>"); - return sb.toString(); - } -} Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/DependencyUtil.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/DependencyUtil.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/DependencyUtil.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -54,6 +54,7 @@ import fr.ifremer.isisfish.datastore.FormuleStorage; import fr.ifremer.isisfish.datastore.ObjectiveStorage; import fr.ifremer.isisfish.datastore.OptimizationStorage; +import fr.ifremer.isisfish.datastore.ResultInfoStorage; import fr.ifremer.isisfish.datastore.RuleStorage; import fr.ifremer.isisfish.datastore.ScriptStorage; import fr.ifremer.isisfish.datastore.SensitivityAnalysisStorage; @@ -249,12 +250,13 @@ ObjectiveStorage.OBJECTIVE_PATH, OptimizationStorage.OPTIMIZATION_PATH, RuleStorage.RULE_PATH, + ResultInfoStorage.RESULT_INFO_PATH, ScriptStorage.SCRIPT_PATH, SensitivityAnalysisStorage.SENSITIVITY_ANALYSIS_PATH, SensitivityExportStorage.SENSITIVITY_EXPORT_PATH, SimulationPlanStorage.SIMULATION_PLAN_PATH, SimulatorStorage.SIMULATOR_PATH)) { - + // exclude inner types if (!type.contains("$")) { String dotType = type.replace('/', '.'); Modified: branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/java/fr/ifremer/isisfish/util/ScriptUtil.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -26,6 +26,7 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import org.apache.commons.io.FileUtils; @@ -47,7 +48,7 @@ * @since 4.3.0 */ public static String readAsString(File file) throws IOException { - return FileUtils.readFileToString(file, "utf-8"); + return FileUtils.readFileToString(file, StandardCharsets.UTF_8); } /** @@ -58,6 +59,6 @@ * @since 4.3.0 */ public static void writeString(File file, String content) throws IOException { - FileUtils.writeStringToFile(file, content, "utf-8"); + FileUtils.writeStringToFile(file, content, StandardCharsets.UTF_8); } } Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_en_GB.properties =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_en_GB.properties 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_en_GB.properties 2015-06-17 13:53:01 UTC (rev 4271) @@ -283,6 +283,7 @@ isisfish.error.add.tray=Can't add system tray icon isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s isisfish.error.change.equation=Can't change equation +isisfish.error.compile.documentationerror=This script contains compile errors \! isisfish.error.compile.fileerror=File %s can't be compiled \! isisfish.error.compile.script=Can't compile script\: %1$s isisfish.error.compiled.parameter=Can't get rule parameter from compiled class @@ -814,6 +815,7 @@ isisfish.script.menu.txtNewExportStep=New export per Step isisfish.script.menu.txtNewObjective=New objective function isisfish.script.menu.txtNewOptimization=New optimization script +isisfish.script.menu.txtNewResultInfo=New result isisfish.script.menu.txtNewRule=New rule isisfish.script.menu.txtNewScript=New script isisfish.script.menu.txtNewSensitivity=New sensitivity calculator Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_fr_FR.properties =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_fr_FR.properties 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/i18n/isis-fish_fr_FR.properties 2015-06-17 13:53:01 UTC (rev 4271) @@ -283,6 +283,7 @@ isisfish.error.add.tray=Impossible d'ajouter une icone de notification isisfish.error.change.classloader=Can't change classloader because can't create URL from file %1$s isisfish.error.change.equation=Can't change equation +isisfish.error.compile.documentationerror=Ce script contient des erreurs de compilation \! isisfish.error.compile.fileerror=Le fichier %s contient des erreurs \! isisfish.error.compile.script=Impossible de compiler le script \: %s isisfish.error.compiled.parameter=Can't get rule parameter from compiled class @@ -814,6 +815,7 @@ isisfish.script.menu.txtNewExportStep=Nouveau script d'export par pas de temps isisfish.script.menu.txtNewObjective=Nouvelle fonction d'objectif isisfish.script.menu.txtNewOptimization=Nouveau script d'optimisation +isisfish.script.menu.txtNewResultInfo=Nouveau résultat isisfish.script.menu.txtNewRule=Nouvelle règle isisfish.script.menu.txtNewScript=Nouveau script isisfish.script.menu.txtNewSensitivity=Nouveau calculateur de sensibilité Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/export.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/export.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/export.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -49,7 +49,7 @@ import org.nuiton.math.matrix.*; -import scripts.ResultName; +import resultinfos.*; import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.entities.*; @@ -76,8 +76,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; public String[] getNecessaryResult() { Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/exportStep.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/exportStep.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/exportStep.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -44,18 +44,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import java.io.Writer; import org.nuiton.math.matrix.*; +import resultinfos.*; -import scripts.ResultName; - import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.entities.*; import fr.ifremer.isisfish.export.ExportStep; import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.simulator.ResultManager; import fr.ifremer.isisfish.types.TimeStep; /** @@ -77,8 +75,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_EFFORT_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; /** @@ -143,7 +141,7 @@ // example: // MatrixND mat = simulation.getResultStorage().getMatrix(step, - // ResultName.MATRIX_EFFORT_PER_STRATEGY_MET); + // MatrixBiomass.class.getSimpleName()); // if (mat != null) { // can be null if no result for this step // for (MatrixIterator i = mat.iterator(); i.hasNext();) { // i.next(); Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/objective.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/objective.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/objective.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -44,10 +44,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import java.util.List; import org.nuiton.math.matrix.*; +import resultinfos.*; import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.simulator.SimulationContext; @@ -76,8 +76,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; @Override Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/optimization.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/optimization.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/optimization.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -48,6 +48,7 @@ import java.util.List; import org.nuiton.math.matrix.*; +import resultinfos.*; import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.simulator.SimulationContext; @@ -76,8 +77,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; @Override Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/rule.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/rule.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/rule.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -44,12 +44,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -import scripts.ResultName; - import java.io.Writer; import org.nuiton.math.matrix.*; +import resultinfos.*; import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.simulator.SimulationContext; @@ -77,8 +75,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; public String[] getNecessaryResult() { Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/sensitivityexport.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/sensitivityexport.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/sensitivityexport.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -44,13 +44,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - import java.io.Writer; import org.nuiton.math.matrix.*; +import resultinfos.*; -import scripts.ResultName; - import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.entities.*; import fr.ifremer.isisfish.export.SensitivityExport; @@ -76,8 +74,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; public String[] getNecessaryResult() { Modified: branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/simulationplan.ftl =================================================================== --- branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/simulationplan.ftl 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/main/resources/templates/script/simulationplan.ftl 2015-06-17 13:53:01 UTC (rev 4271) @@ -45,12 +45,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import scripts.ResultName; - import java.io.Writer; import org.nuiton.math.matrix.*; import org.nuiton.util.*; import org.nuiton.topia.*; +import resultinfos.*; import fr.ifremer.isisfish.util.Doc; import fr.ifremer.isisfish.*; @@ -61,7 +60,7 @@ import fr.ifremer.isisfish.simulator.SimulationPlanContext; import fr.ifremer.isisfish.simulator.SimulationParameter; import fr.ifremer.isisfish.datastore.SimulationStorage; -import fr.ifremer.isisfish.datastore.ResultStorage; +import fr.ifremer.isisfish.simulator.ResultManager; /** * ${name}.java @@ -81,8 +80,8 @@ protected String[] necessaryResult = { // put here all necessary result for this rule // example: - // ResultName.MATRIX_BIOMASS, - // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, + // MatrixBiomass.class.getSimpleName(), + // MatrixNetValueOfLandingsPerStrategyMet.class.getSimpleName(), }; @Override Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/DataStorageTestHelper.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/DataStorageTestHelper.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/DataStorageTestHelper.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -5,7 +5,7 @@ * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Ifremer, CodeLutin + * Copyright (C) 2009 - 2015 Ifremer, CodeLutin, Chatellier Eric * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -25,8 +25,6 @@ package fr.ifremer.isisfish.datastore; -import org.junit.Ignore; - /** * Helper to acces protected static cache objects. * @@ -36,7 +34,6 @@ * Last update : $Date$ * By : $Author$ */ -@Ignore public class DataStorageTestHelper { /** @@ -49,6 +46,7 @@ OptimizationStorage.objectiveCache.clear(); RegionStorage.regions.clear(); RuleStorage.rulesCache.clear(); + ResultInfoStorage.resultInfosCache.clear(); ScriptStorage.scriptsCache.clear(); SensitivityAnalysisStorage.sensitivityCache.clear(); SimulationPlanStorage.plansCache.clear(); Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/RuleStorageTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/RuleStorageTest.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/RuleStorageTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -87,10 +87,6 @@ out.flush(); String content = out.toString(); - // remove it to compile, it's in isis fish data project - Assert.assertTrue(content.indexOf("import scripts.ResultName;") > 0); - content = content.replaceFirst("import scripts.ResultName;", ""); - ruleStorage.setContent(content); // 0 = compile success Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/ScriptStorageTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/ScriptStorageTest.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/ScriptStorageTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -119,10 +119,6 @@ out.flush(); String content = out.toString(); - // remove it to compile, it's in isis fish data project - Assert.assertTrue(content.indexOf("import scripts.ResultName;") > 0); - content = content.replaceFirst("import scripts.ResultName;", ""); - scriptStorage.setContent(content); // 0 = compile success Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/SimulationPlanStorageTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/SimulationPlanStorageTest.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/datastore/SimulationPlanStorageTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -88,10 +88,6 @@ out.flush(); String content = out.toString(); - // remove it to compile, it's in isis fish data project - Assert.assertTrue(content.indexOf("import scripts.ResultName;") > 0); - content = content.replaceFirst("import scripts.ResultName;", ""); - simulationPlanStorage.setContent(content); // 0 = compile success Added: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ResultInfoHelperTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ResultInfoHelperTest.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ResultInfoHelperTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,52 @@ +/* + * #%L + * IsisFish + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2015 Ifremer, CodeLutin, Chatellier Eric + * %% + * 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% + */ +package fr.ifremer.isisfish.result; + +import java.util.Collections; +import java.util.Set; + +import org.junit.Assert; +import org.junit.Test; + +import fr.ifremer.isisfish.AbstractIsisFishTest; +import fr.ifremer.isisfish.IsisFishException; + +public class ResultInfoHelperTest extends AbstractIsisFishTest { + + /** + * Test qu'à partir d'un result, on arrive bien recursivement à en extraire les resultats + * dépendant et sans boucle infinie. + * + * @throws IsisFishException + */ + @Test + public void testResultRecursiveExtract() throws IsisFishException { + Set<String> necessaryResults = Collections.singleton("MatrixTestDep1"); + Set<String> allNecessaryResult = ResultInfoHelper.extractAllNecessaryResults(necessaryResults); + + Assert.assertEquals(3, allNecessaryResult.size()); //MatrixTestDep1, MatrixTestDep2, MatrixTestDep3 + } + +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/result/ResultInfoHelperTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/simulator/launcher/SimulationServiceTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -27,12 +27,14 @@ import java.io.File; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Properties; +import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; -import fr.ifremer.isisfish.types.Month; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; @@ -74,6 +76,7 @@ import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationDiscreteDomain; import fr.ifremer.isisfish.simulator.sensitivity.domain.RuleDiscreteDomain; +import fr.ifremer.isisfish.types.Month; /** * Test for {@link SimulationService}. @@ -119,6 +122,8 @@ params.setStrategies(strats); // number of year params.setNumberOfYear(1); + // add first result only (cicular deps only) + params.setResultEnabled(Collections.singletonList("MatrixTestDep1")); // run simulation SimulationService service = SimulationService.getService(); Modified: branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/util/DependencyUtilTest.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/util/DependencyUtilTest.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/java/fr/ifremer/isisfish/util/DependencyUtilTest.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -172,4 +172,20 @@ Set<String> deps = extractDependencies(script); Assert.assertFalse(deps.contains("rules.GraviteVPUE1$1")); } + + /** + * Test que les classes de résultats sont bien extraites en incluant les dépendances + * récursives entre les résultats. + * + * @throws IsisFishException + * @throws IOException + */ + @Test + public void testExtractDependencies8() throws IsisFishException, IOException { + RuleStorage script = RuleStorage.getRule("Cantonnement"); + Set<String> deps = extractDependencies(script); + Assert.assertTrue(deps.contains("resultinfos.MatrixTestDep1")); + Assert.assertTrue(deps.contains("resultinfos.MatrixTestDep2")); + Assert.assertTrue(deps.contains("resultinfos.MatrixTestDep3")); + } } Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixAbundance.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixAbundance.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixAbundance.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,38 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +/** + * Matrix with three dimensions + * Dimension 1 : TimeStep + * Dimension 2 : Group (semantics : Dimension 1) + * Dimension 3 : Zone (semantics : Dimension 2) + */ +public class MatrixAbundance extends AbstractResultInfo { + + @Override + public String getDescription() { + return "do the doc of Result MatrixAbundance"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixAbundance.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomass.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomass.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomass.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,38 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +/** + * Matrix with three dimensions + * Dimension 1 : TimeStep + * Dimension 2 : Group + * Dimension 3 : Zone + */ +public class MatrixBiomass extends AbstractResultInfo { + + @Override + public String getDescription() { + return "do the doc of Result MatrixBiomass"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomass.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomassBeginMonth.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomassBeginMonth.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomassBeginMonth.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,38 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +/** + * Matrix with three dimensions + * Dimension 1 : TimeStep + * Dimension 2 : Group + * Dimension 3 : Zone + */ +public class MatrixBiomassBeginMonth extends AbstractResultInfo { + + @Override + public String getDescription() { + return "do the doc of Result MatrixBiomassBeginMonth"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixBiomassBeginMonth.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZoneMet.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZoneMet.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZoneMet.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,43 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +/** + * Matrix with five dimensions + * Dimension 1 : TimeStep + * Dimension 2 : Strategy + * Dimension 3 : Metier + * Dimension 4 : Group + * Dimension 5 : Zone + * + * N'est calcule que si l'effort est calcule par cellule et non par zone. + * @see simulators.SimulatorEffortByCell + */ +public class MatrixCatchPerStrategyMetPerZoneMet extends AbstractResultInfo { + + @Override + public String getDescription() { + return "do the doc of Result MatrixCatchPerStrategyMetPerZoneMet"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZoneMet.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZonePop.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZonePop.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZonePop.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,40 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +/** + * Matrix with five dimensions + * Dimension 1 : TimeStep + * Dimension 2 : Strategy + * Dimension 3 : Metier + * Dimension 4 : Group + * Dimension 5 : Zone + */ +public class MatrixCatchPerStrategyMetPerZonePop extends AbstractResultInfo { + + @Override + public String getDescription() { + return "do the doc of Result MatrixCatchPerStrategyMetPerZonePop"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixCatchPerStrategyMetPerZonePop.java ___________________________________________________________________ Added: svn:eol-style + native Added: svn:keywords + Author Date Id Revision HeadURL Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep1.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep1.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep1.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,37 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +public class MatrixTestDep1 extends AbstractResultInfo { + + @Override + public String[] getNecessaryResult() { + return new String[]{MatrixTestDep2.class.getSimpleName()}; + } + + @Override + public String getDescription() { + return "do the doc of Result MatrixTestDep1"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep1.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep2.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep2.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep2.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,37 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +public class MatrixTestDep2 extends AbstractResultInfo { + + @Override + public String[] getNecessaryResult() { + return new String[]{MatrixTestDep3.class.getSimpleName()}; + } + + @Override + public String getDescription() { + return "do the doc of Result MatrixTestDep2"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep2.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep3.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep3.java (rev 0) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep3.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -0,0 +1,37 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric + * %% + * 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% + */ +package resultinfos; + +import fr.ifremer.isisfish.result.AbstractResultInfo; + +public class MatrixTestDep3 extends AbstractResultInfo { + + @Override + public String[] getNecessaryResult() { + return new String[]{MatrixTestDep1.class.getSimpleName()}; // include circular deps + } + + @Override + public String getDescription() { + return "do the doc of Result MatrixTestDep3"; + } +} Property changes on: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/resultinfos/MatrixTestDep3.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/rules/Cantonnement.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/rules/Cantonnement.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/rules/Cantonnement.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -26,6 +26,7 @@ import scripts.ResultName; import scripts.SiMatrix; +import resultinfos.*; import java.util.ArrayList; import java.util.Collection; @@ -82,6 +83,7 @@ // ResultName.MATRIX_BIOMASS, // ResultName.MATRIX_NET_VALUE_OF_LANDINGS_PER_STRATEGY_MET, ResultName.MATRIX_NO_ACTIVITY, + MatrixTestDep1.class.getSimpleName() }; @Override Modified: branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/scripts/ResultName.java =================================================================== --- branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/scripts/ResultName.java 2015-06-11 09:45:24 UTC (rev 4270) +++ branches/isis-fish-4.4.0-resultname/src/test/resources/test-database/scripts/ResultName.java 2015-06-17 13:53:01 UTC (rev 4271) @@ -25,6 +25,7 @@ import static org.nuiton.i18n.I18n.n; import fr.ifremer.isisfish.util.Doc; // pour pouvoir afficher une aide contextuelle (BUG#1605) +import resultinfos.*; /** * Contient l'ensemble des noms des differents resultats. Le mieux lorsque l'on @@ -187,7 +188,7 @@ * Dimension 3 : Zone (semantics : Dimension 2) */ @Doc(value = "do the doc of Result matrixAbundance") - static final public String MATRIX_ABUNDANCE = n("matrixAbundance"); + static final public String MATRIX_ABUNDANCE = MatrixAbundance.class.getSimpleName(); /** * Matrix with three dimensions