Author: bleny Date: 2010-10-21 10:21:30 +0000 (Thu, 21 Oct 2010) New Revision: 700 Log: include default values for the coefficient in migration Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-10-20 15:04:23 UTC (rev 699) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-10-21 10:21:30 UTC (rev 700) @@ -330,19 +330,24 @@ String insertIntoIndicator = "INSERT INTO Indicator (topiaId, topiaVersion, topiaCreateDate, indicatorId, coefficient) " + "VALUES ('%s', %s, %s, %s, %s);"; - SynthesisId[] synthesisIds = { SynthesisId.GRAPH_SAMPLING, - SynthesisId.IND_COMPLIANCE_BOARDING, - SynthesisId.GRAPH_BOARDING, - SynthesisId.IND_ALLEGRO_REACTIVITY, - SynthesisId.IND_DATA_RELIABILITY }; + // all the criterias for global synthesis + default coefficient values + Map<SynthesisId, Double> synthesisIds = new HashMap<SynthesisId, Double>(); + synthesisIds.put(SynthesisId.GRAPH_SAMPLING, 0.35); + synthesisIds.put(SynthesisId.IND_COMPLIANCE_BOARDING, 0.1); + synthesisIds.put(SynthesisId.GRAPH_BOARDING, 0.2); + synthesisIds.put(SynthesisId.IND_ALLEGRO_REACTIVITY, 0.15); + synthesisIds.put(SynthesisId.IND_DATA_RELIABILITY, 0.2); - double coefficientValue = 1.0; - Map <SynthesisId, String> indicatorsTopiaIds = new HashMap<SynthesisId, String>(); - for (SynthesisId synthesisId : synthesisIds) { - String topiaId = topiaIndicatorIdPrefix + synthesisId.ordinal(); + for (Map.Entry<SynthesisId, Double> indicatorAndCoeff : synthesisIds.entrySet()) { + + SynthesisId synthesisId = indicatorAndCoeff.getKey(); + Double coefficientValue = indicatorAndCoeff.getValue(); + + String topiaId = topiaIndicatorIdPrefix + indicatorAndCoeff.getKey().ordinal(); indicatorsTopiaIds.put(synthesisId, topiaId); + queries.add(String.format(insertIntoIndicator, topiaId, topiaVersion, topiaCreateDateValue,