Author: fdesbois Date: 2010-01-17 19:49:21 +0000 (Sun, 17 Jan 2010) New Revision: 222 Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceNewsImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java Log: update license headers Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,18 +1,21 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin +/* *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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. + * GNU General Lesser 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/>. ##%*/ + * 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>. + * ##%*/ package fr.ifremer.suiviobsmer; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.entity; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceNewsImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceNewsImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceNewsImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.impl; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/impl/ServiceSynthesisImpl.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.impl; Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java 2010-01-17 19:49:21 UTC (rev 222) @@ -146,4 +146,4 @@ System.out.println("logTimeAndMemory"); } -} \ No newline at end of file +} Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.base; Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,18 +1,21 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin +/* *##% + * SuiviObsmer :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * 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. + * GNU General Lesser 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/>. ##%*/ + * 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>. + * ##%*/ package fr.ifremer.suiviobsmer.ui.components; @@ -131,4 +134,4 @@ } }; } -} \ No newline at end of file +} Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,3 +1,23 @@ +/* + * *##% + * SuiviObsmer :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.mixins; @@ -86,4 +106,4 @@ } -} \ No newline at end of file +} Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java 2010-01-17 19:49:21 UTC (rev 222) @@ -18,67 +18,67 @@ * <http://www.gnu.org/licenses/gpl-3.0.html>. * ##%* */ - -package fr.ifremer.suiviobsmer.ui.pages; - -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; -import fr.ifremer.suiviobsmer.ui.components.Layout; -import org.apache.tapestry5.annotations.InjectComponent; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.ioc.annotations.Inject; -import org.apache.tapestry5.runtime.ComponentEventException; -import org.apache.tapestry5.services.ExceptionReporter; -import org.slf4j.Logger; - -/** - * ExceptionReport - * - * Created: 5 janv. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class ExceptionReport implements ExceptionReporter, SuiviObsmerPage { - - @InjectComponent - private Layout layout; - - @Inject - private Logger log; - - @Property - private Throwable exception; - - @Override - public void reportException(Throwable eee) { - this.exception = getSuiviObsmerException(eee); - if (exception != null) { - layout.getFeedBack().addError(exception.getMessage()); - this.exception = exception.getCause(); - } else { - this.exception = eee; - log.error("Unexpected exception", eee); - } - layout.getFeedBack().addError("Erreur : " + this.exception.getClass().getSimpleName() + " : " + this.exception.getMessage()); - } - - protected Throwable getSuiviObsmerException(Throwable eee) { - if (eee == null) { - return eee; - } - if (eee instanceof SuiviObsmerException) { - return eee; - } - return getSuiviObsmerException(eee.getCause()); - } - - @Override - public boolean isOnlyForAdmin() { - return false; - } - -} + +package fr.ifremer.suiviobsmer.ui.pages; + +import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.components.Layout; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.runtime.ComponentEventException; +import org.apache.tapestry5.services.ExceptionReporter; +import org.slf4j.Logger; + +/** + * ExceptionReport + * + * Created: 5 janv. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class ExceptionReport implements ExceptionReporter, SuiviObsmerPage { + + @InjectComponent + private Layout layout; + + @Inject + private Logger log; + + @Property + private Throwable exception; + + @Override + public void reportException(Throwable eee) { + this.exception = getSuiviObsmerException(eee); + if (exception != null) { + layout.getFeedBack().addError(exception.getMessage()); + this.exception = exception.getCause(); + } else { + this.exception = eee; + log.error("Unexpected exception", eee); + } + layout.getFeedBack().addError("Erreur : " + this.exception.getClass().getSimpleName() + " : " + this.exception.getMessage()); + } + + protected Throwable getSuiviObsmerException(Throwable eee) { + if (eee == null) { + return eee; + } + if (eee instanceof SuiviObsmerException) { + return eee; + } + return getSuiviObsmerException(eee.getCause()); + } + + @Override + public boolean isOnlyForAdmin() { + return false; + } + +} Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java 2010-01-17 19:38:22 UTC (rev 221) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java 2010-01-17 19:49:21 UTC (rev 222) @@ -1,88 +1,108 @@ - -package fr.ifremer.suiviobsmer.ui.pages; - -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.entity.SampleRow; -import fr.ifremer.suiviobsmer.entity.SampleRowLog; -import fr.ifremer.suiviobsmer.services.ServiceSampling; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Locale; -import org.apache.tapestry5.annotations.IncludeStylesheet; -import org.apache.tapestry5.annotations.Persist; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.ioc.annotations.Inject; -import org.slf4j.Logger; - -/** - * SampleRowHistoric - * - * Created: 12 janv. 2010 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ - at IncludeStylesheet("context:css/sampling.css") -public class SampleRowHistoric implements SuiviObsmerPage { - - @Override - public boolean isOnlyForAdmin() { - return true; - } - - @Inject - private Logger log; - - @Inject - private ServiceSampling serviceSampling; - - private String sampleRowId; - - @Persist - private SampleRow sampleRow; - - @Property - private SampleRowLog sampleRowLog; - - void onActivate(String id) { - sampleRowId = id; - } - - String onPassivate() { - return sampleRowId; - } - - void setupRender() throws SuiviObsmerException { - sampleRow = null; - getSampleRow(); - } - - public SampleRow getSampleRow() throws SuiviObsmerException { - if (sampleRow == null) { - if (log.isInfoEnabled()) { - log.info("BUSINESS REQUEST [getSampleRow]"); - } - sampleRow = serviceSampling.getSampleRow(sampleRowId); - } - return sampleRow; - } - - public DateFormat getDateFormat() { - return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.FRENCH); - } - - public String getContent() { - String content = sampleRowLog.getLogText(); - if (content == null) { - content = "Aucun changement enregistré."; - } else { - content = content.replaceAll("\\n", "<br />"); - } - return content; - } - -} +/* + * *##% + * SuiviObsmer :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser 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>. + * ##%* + */ + +package fr.ifremer.suiviobsmer.ui.pages; + +import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.entity.SampleRow; +import fr.ifremer.suiviobsmer.entity.SampleRowLog; +import fr.ifremer.suiviobsmer.services.ServiceSampling; +import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Locale; +import org.apache.tapestry5.annotations.IncludeStylesheet; +import org.apache.tapestry5.annotations.Persist; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.slf4j.Logger; + +/** + * SampleRowHistoric + * + * Created: 12 janv. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ + at IncludeStylesheet("context:css/sampling.css") +public class SampleRowHistoric implements SuiviObsmerPage { + + @Override + public boolean isOnlyForAdmin() { + return true; + } + + @Inject + private Logger log; + + @Inject + private ServiceSampling serviceSampling; + + private String sampleRowId; + + @Persist + private SampleRow sampleRow; + + @Property + private SampleRowLog sampleRowLog; + + void onActivate(String id) { + sampleRowId = id; + } + + String onPassivate() { + return sampleRowId; + } + + void setupRender() throws SuiviObsmerException { + sampleRow = null; + getSampleRow(); + } + + public SampleRow getSampleRow() throws SuiviObsmerException { + if (sampleRow == null) { + if (log.isInfoEnabled()) { + log.info("BUSINESS REQUEST [getSampleRow]"); + } + sampleRow = serviceSampling.getSampleRow(sampleRowId); + } + return sampleRow; + } + + public DateFormat getDateFormat() { + return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.FRENCH); + } + + public String getContent() { + String content = sampleRowLog.getLogText(); + if (content == null) { + content = "Aucun changement enregistré."; + } else { + content = content.replaceAll("\\n", "<br />"); + } + return content; + } + +}