Author: bleny Date: 2011-04-20 13:54:23 +0000 (Wed, 20 Apr 2011) New Revision: 1223 Log: add pre-filled values for obsdeb Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-04-20 13:35:32 UTC (rev 1222) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-04-20 13:54:23 UTC (rev 1223) @@ -473,20 +473,23 @@ newContact.setEmailSent(true); } - // In the case of ObsVente, we may have a user who wants to create + if (newContact.getObsProgram() == ObsProgram.OBSVENTE) { + // we hope in this contact, user used expected sampling strategy + newContact.setSamplingStrategy(row.getSamplingStrategy()); + } + + // In the case of ObsVente and ObsDeb, we may have a user who wants to create // multiple contact for a same day. Here we try, to ease the input // of data by trying to pre-fill some field using data given // in a previous entered contact - if (newContact.getObsProgram() == ObsProgram.OBSVENTE) { + if (newContact.getObsProgram() == ObsProgram.OBSVENTE || + newContact.getObsProgram() == ObsProgram.OBSDEB) { // try to pre-fill some field for user-experience - // we hope in this contact, user used expected sampling strategy - newContact.setSamplingStrategy(row.getSamplingStrategy()); - // let's try to find a recent similar contact Map<String, Object> properties = new HashMap<String, Object>(); - properties.put(Contact.PROPERTY_OBS_PROGRAM_ORDINAL, ObsProgram.OBSVENTE.ordinal()); + properties.put(Contact.PROPERTY_OBS_PROGRAM_ORDINAL, newContact.getObsProgram().ordinal()); properties.put(Contact.PROPERTY_SAMPLE_ROW, row); properties.put(Contact.PROPERTY_MAIN_OBSERVER, user);