Author: bleny Date: 2011-04-22 09:18:17 +0000 (Fri, 22 Apr 2011) New Revision: 1229 Log: make state 'observation not done' unavailable for ObsMer Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java 2011-04-22 09:17:35 UTC (rev 1228) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ContactState.java 2011-04-22 09:18:17 UTC (rev 1229) @@ -52,23 +52,26 @@ public enum ContactState { /** Usually, the first step, observer just contacted someone */ - CONTACT_START(n_("ContactState.CONTACT_START"), false, false, false), + CONTACT_START(n_("ContactState.CONTACT_START"), false, false, false, false), /** Observer has now someone to meet */ - OBSERVATION_EXPECTED(n_("ContactState.OBSERVATION_EXPECTED"), false, false, true), + OBSERVATION_EXPECTED(n_("ContactState.OBSERVATION_EXPECTED"), false, false, true, false), /** Observation was done, all data have been collected. Everything is fine */ - OBSERVATION_DONE(n_("ContactState.OBSERVATION_DONE"), true, false, true), + OBSERVATION_DONE(n_("ContactState.OBSERVATION_DONE"), true, false, true, true), /** Observer failed to collect data, weather or any other circumstances made data collection impossible */ - OBSERVATION_CANCELLED(n_("ContactState.OBSERVATION_CANCELLED"), true, true, true), + OBSERVATION_CANCELLED(n_("ContactState.OBSERVATION_CANCELLED"), true, true, true, false), /** After a contact start, people contacted refused the observation. Observer may try later. */ - CONTACT_REFUSED(n_("ContactState.CONTACT_REFUSED"), true ,true, false), + CONTACT_REFUSED(n_("ContactState.CONTACT_REFUSED"), true ,true, false, true), /** After a contact refused, people contacted still refuse the observation. Observer may not try later. */ - CONTACT_DEFINITELY_REFUSED(n_("ContactState.CONTACT_DEFINITELY_REFUSED"), true, true, false); + CONTACT_DEFINITELY_REFUSED(n_("ContactState.CONTACT_DEFINITELY_REFUSED"), true, true, false, true), + /** On the work field, observer choose not to get in touch with the people from the boat */ + OBSERVATION_NOT_DONE(n_("ContactState.OBSERVATION_NOT_DONE"), true, false, false, true); + private String i18nKey; /** if true, the state may not be changed. */ @@ -80,13 +83,18 @@ /** true if this value can be used for a contact of program {@link fr.ifremer.wao.bean.ObsProgram#OBSVENTE} */ protected boolean allowedForObsVente; + /** true if this value can be used for a contact of program {@link fr.ifremer.wao.bean.ObsProgram#OBSDEB} */ + protected boolean allowedForObsDeb; + /** @deprecated I18N should be done properly by tapestry */ @Deprecated - ContactState(String i18nKey, boolean finalState, boolean unfinishedState, boolean allowedForObsVente) { + ContactState(String i18nKey, boolean finalState, boolean unfinishedState, + boolean allowedForObsVente, boolean allowedForObsDeb) { this.i18nKey = i18nKey; this.finalState = finalState; this.unfinishedState = unfinishedState; this.allowedForObsVente = allowedForObsVente; + this.allowedForObsDeb = allowedForObsDeb; } public boolean isFinalState() { @@ -115,11 +123,11 @@ public boolean isAllowed(ObsProgram obsProgram) { boolean allowed; if (obsProgram == ObsProgram.OBSMER) { - allowed = true; + allowed = this != OBSERVATION_NOT_DONE; } else if (obsProgram == ObsProgram.OBSVENTE) { allowed = allowedForObsVente; } else { - allowed = this == OBSERVATION_DONE; + allowed = allowedForObsDeb; } return allowed; }