Commit e755b5d6 authored by PECQUOT's avatar PECQUOT
Browse files

[fix] Fix synchronization problem with PMFMU (Mantis #46165)

git-svn-id: https://scmforge.ifremer.fr/authscm/lp1ee9d/svn/reefdb/trunk@2381 cd918a83-917d-4a2a-92d7-bc1d03929fc5
parent 812a5dd1
......@@ -182,7 +182,7 @@
<maven.compiler.debug>true</maven.compiler.debug>
<!-- Quadrige3 Core version -->
<quadrige3-core.version>3.2.2</quadrige3-core.version>
<quadrige3-core.version>3.2.3</quadrige3-core.version>
<!-- Last ReefDb launcher version -->
<launcherVersion>3.0.3</launcherVersion>
......@@ -223,7 +223,6 @@
<jmock.version>2.8.2</jmock.version>
<dbunit.version>2.5.3</dbunit.version>
<junit.version>4.12</junit.version>
<joda-time.version>2.7</joda-time.version>
<!-- release config -->
<autoVersionSubmodules>true</autoVersionSubmodules>
......@@ -353,13 +352,6 @@
<version>${jdbc.ojdbc7.version}</version>
</dependency>
<!-- Joda time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time.version}</version>
</dependency>
<!-- Unit testing -->
<dependency>
<groupId>junit</groupId>
......
......@@ -24,12 +24,6 @@
<dependencies>
<!-- Joda time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<!--quadrige3 -->
<dependency>
<groupId>fr.ifremer.quadrige3</groupId>
......
......@@ -301,7 +301,7 @@ public class ReefDbSamplingOperationDaoImpl extends SamplingOperationDaoImpl imp
result.setId((Integer) it.next());
result.setName((String) it.next());
result.setTime((Double) it.next());
result.setTime(Daos.convertToInteger((Number) it.next()));
result.setComment((String) it.next());
result.setControlDate(Daos.convertToDate(it.next()));
result.setSamplingEquipment(samplingEquipmentDao.getSamplingEquipmentById((int) it.next()));
......@@ -346,7 +346,7 @@ public class ReefDbSamplingOperationDaoImpl extends SamplingOperationDaoImpl imp
private void beanToEntity(SamplingOperationDTO bean, SamplingOperation entity, Survey survey) {
entity.setSamplingOperLb(bean.getName());
entity.setSamplingOperTime(bean.getTime());
entity.setSamplingOperTime(bean.getTime() != null ? Double.valueOf(bean.getTime()) : null);
entity.setSamplingOperUtFormat(survey.getSurveyUtFormat());
entity.setSamplingOperCm(bean.getComment());
entity.setSamplingOperControlDt(bean.getControlDate());
......
......@@ -582,7 +582,7 @@ public class ReefDbSurveyDaoImpl extends SurveyDaoImpl implements ReefDbSurveyDa
// Apply DB timezone to survey date (Mantis #41597)
result.setDate(Dates.convertToLocalDate(Daos.convertToDate(source.next()), config.getDbTimezone()));
result.setTime((Double) source.next());
result.setTime(Daos.convertToInteger((Number) source.next()));
result.setName((String) source.next());
result.setComment((String) source.next());
result.setControlDate(Daos.convertToDate(source.next()));
......@@ -703,7 +703,7 @@ public class ReefDbSurveyDaoImpl extends SurveyDaoImpl implements ReefDbSurveyDa
}
// optional attributes
entity.setSurveyTime(bean.getTime());
entity.setSurveyTime(bean.getTime() != null ? Double.valueOf(bean.getTime()) : null);
entity.setSurveyLb(bean.getName());
entity.setSurveyCm(bean.getComment());
......
......@@ -12,12 +12,12 @@ package fr.ifremer.reefdb.dao.technical;
* it under the terms of the GNU Affero 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
......@@ -173,33 +173,6 @@ public class Daos extends fr.ifremer.quadrige3.core.dao.technical.Daos {
return withStatus(query, statusCodes).iterate();
}
/**
* <p>convertToInteger.</p>
*
* @param numericalValue a {@link java.lang.Float} object.
* @return a {@link java.lang.Integer} object.
*/
public static Integer convertToInteger(Number numericalValue) {
if (numericalValue == null) {
return null;
}
return numericalValue.intValue();
}
/**
* <p>convertToInteger.</p>
*
* @param numericalValue a {@link java.lang.Double} object.
* @return a {@link java.lang.Integer} object.
*/
/* public static Integer convertToInteger(Double numericalValue) {
if (numericalValue == null) {
return null;
}
return numericalValue.intValue();
}
*/
/**
* <p>convertDateOnlyToSQLString.</p>
*
......
......@@ -436,14 +436,14 @@ public class DecoratorServiceImpl extends fr.ifremer.quadrige3.core.service.deco
/**
* Time decoration.
*/
private class TimeDecorator extends Decorator<Double> {
private class TimeDecorator extends Decorator<Integer> {
TimeDecorator() {
super(Double.class, "${time}$s", "", "", false, null);
super(Integer.class, "${time}$s", "", "", false, null);
}
@Override
protected Object getValue(final Double bean, final String token) {
protected Object getValue(final Integer bean, final String token) {
return Times.secondsToString(bean);
}
}
......
......@@ -261,7 +261,7 @@ public class ControlRuleServiceImpl implements ControlRuleService {
validDate(survey.getValidationDate(), rule, messages, error, SurveyDTO.PROPERTY_VALIDATION_DATE);
break;
case TIME:
validDouble(survey.getTime(), rule, messages, error, SurveyDTO.PROPERTY_TIME);
validInteger(survey.getTime(), rule, messages, error, SurveyDTO.PROPERTY_TIME);
break;
case COMMENT:
validString(survey.getComment(), rule, messages, error, SurveyDTO.PROPERTY_COMMENT);
......@@ -363,7 +363,7 @@ public class ControlRuleServiceImpl implements ControlRuleService {
// Test all features
switch (enumValue) {
case TIME:
validDouble(samplingOperation.getTime(), rule, messages, error, SamplingOperationDTO.PROPERTY_TIME);
validInteger(samplingOperation.getTime(), rule, messages, error, SamplingOperationDTO.PROPERTY_TIME);
break;
case COMMENT:
validString(samplingOperation.getComment(), rule, messages, error, SamplingOperationDTO.PROPERTY_COMMENT);
......
......@@ -94,7 +94,7 @@ public class SamplingOperationDaoWriteTest extends AbstractDaoTest {
// create one
SamplingOperationDTO samplingOperation = ReefDbBeanFactory.newSamplingOperationDTO();
samplingOperation.setName("1");
samplingOperation.setTime(1200d);
samplingOperation.setTime(1200);
samplingOperation.setSize(10d);
samplingOperation.setSizeUnit(unitDao.getUnitById(12));
samplingOperation.setComment("comment 1");
......@@ -144,7 +144,7 @@ public class SamplingOperationDaoWriteTest extends AbstractDaoTest {
// create another one
SamplingOperationDTO samplingOperation2 = ReefDbBeanFactory.newSamplingOperationDTO();
samplingOperation2.setName("2");
samplingOperation2.setTime(260d);
samplingOperation2.setTime(260);
samplingOperation2.setSize(0.5);
samplingOperation2.setSizeUnit(unitDao.getUnitById(13));
samplingOperation2.setComment("comment 2");
......
......@@ -87,7 +87,7 @@ public class SurveyDaoWriteTest extends AbstractDaoTest {
survey.setName("test survey");
survey.setComment("test survey comment");
survey.setDate(LocalDate.of(2015,2, 5));
survey.setTime(1252d);
survey.setTime(1252);
survey.setPreciseDepth(15.2);
// survey.setControlDate(Date.valueOf("2015-02-06"));
// survey.setValidationDate(Date.valueOf("2015-02-07"));
......@@ -128,7 +128,7 @@ public class SurveyDaoWriteTest extends AbstractDaoTest {
survey.setName("test survey 2");
survey.setComment("test survey comment 2");
survey.setDate(LocalDate.of(2015,1,1));
survey.setTime(1252d);
survey.setTime(1252);
survey.setPreciseDepth(15.2);
// survey.setControlDate(Date.valueOf("2015-03-08"));
// survey.setValidationDate(Date.valueOf("2015-04-16"));
......@@ -210,7 +210,7 @@ public class SurveyDaoWriteTest extends AbstractDaoTest {
surveyDetail.setName("test survey 3");
surveyDetail.setComment("test survey comment 3");
surveyDetail.setDate(LocalDate.of(2015,4,7));
surveyDetail.setTime(1953d);
surveyDetail.setTime(1953);
surveyDetail.setPreciseDepth(12.90);
// surveyDetail.setControlDate(Date.valueOf("2015-05-20"));
// surveyDetail.setValidationDate(Date.valueOf("2015-05-21"));
......
......@@ -65,7 +65,7 @@ public class OperationsTableModel extends AbstractReefDbTableModel<OperationsTab
OperationsTableRowModel.PROPERTY_TIME,
n("reefdb.property.time"),
n("reefdb.property.time"),
Double.class);
Integer.class);
/**
* Identifiant pour la colonne taille.
*/
......
......@@ -186,13 +186,13 @@ public class OperationsTableRowModel extends AbstractReefDbRowUIModel<SamplingOp
/** {@inheritDoc} */
@Override
public Double getTime() {
public Integer getTime() {
return delegateObject.getTime();
}
/** {@inheritDoc} */
@Override
public void setTime(Double time) {
public void setTime(Integer time) {
delegateObject.setTime(time);
}
......
......@@ -28,7 +28,7 @@ import fr.ifremer.quadrige3.ui.swing.common.action.ActionFactory;
import fr.ifremer.quadrige3.ui.swing.common.component.coordinate.CoordinateEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.SwingTableColumnModel;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.ExtendedComboBoxCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.TimeCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.LocalTimeCellEditor;
import fr.ifremer.reefdb.decorator.DecoratorService;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.ReefDbBeans;
......@@ -312,8 +312,8 @@ public class OperationsTableUIHandler extends AbstractReefDbTableUIHandler<Opera
// Colonne Heure
final TableColumnExt colTime = addColumn(
columnModel,
new TimeCellEditor(),
newTableCellRender(Double.class, DecoratorService.TIME_IN_HOURS_MINUTES),
new LocalTimeCellEditor(),
newTableCellRender(Integer.class, DecoratorService.TIME_IN_HOURS_MINUTES),
OperationsTableModel.TIME);
colTime.setSortable(true);
colTime.setMinWidth(50);
......
......@@ -27,7 +27,7 @@ import fr.ifremer.quadrige3.core.dao.technical.StringIterator;
import fr.ifremer.quadrige3.ui.swing.common.component.coordinate.CoordinateEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.SwingTableColumnModel;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.ExtendedComboBoxCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.TimeCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.LocalTimeCellEditor;
import fr.ifremer.reefdb.decorator.DecoratorService;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.dto.data.sampling.SamplingOperationDTO;
......@@ -188,8 +188,8 @@ public class AddOperationTableUIHandler extends AbstractReefDbTableUIHandler<Ope
// Colonne Heure
final TableColumnExt colTime = addColumn(
columnModel,
new TimeCellEditor(),
newTableCellRender(Double.class, DecoratorService.TIME_IN_HOURS_MINUTES),
new LocalTimeCellEditor(),
newTableCellRender(Integer.class, DecoratorService.TIME_IN_HOURS_MINUTES),
OperationsTableModel.TIME);
colTime.setSortable(true);
colTime.setMinWidth(50);
......
......@@ -157,7 +157,7 @@ public class SurveysTableModel extends AbstractReefDbTableModel<SurveysTableRowM
SurveysTableRowModel.PROPERTY_TIME,
n("reefdb.property.survey.time"),
n("reefdb.property.survey.time"),
Double.class);
Integer.class);
/** Constant <code>UPDATE_DATE</code> */
public static final ColumnIdentifier<SurveysTableRowModel> UPDATE_DATE = ColumnIdentifier.newId(
......
......@@ -142,13 +142,13 @@ public class SurveysTableRowModel extends AbstractReefDbRowUIModel<SurveyDTO, Su
/** {@inheritDoc} */
@Override
public Double getTime() {
public Integer getTime() {
return delegateObject.getTime();
}
/** {@inheritDoc} */
@Override
public void setTime(Double time) {
public void setTime(Integer time) {
delegateObject.setTime(time);
}
......
......@@ -26,7 +26,7 @@ package fr.ifremer.reefdb.ui.swing.content.home.survey;
import fr.ifremer.quadrige3.ui.swing.common.component.coordinate.CoordinateEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.SwingTableColumnModel;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.ExtendedComboBoxCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.TimeCellEditor;
import fr.ifremer.quadrige3.ui.swing.common.table.editor.LocalTimeCellEditor;
import fr.ifremer.reefdb.decorator.DecoratorService;
import fr.ifremer.reefdb.dto.ReefDbBeans;
import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
......@@ -288,8 +288,8 @@ public class SurveysTableUIHandler extends
// Colonne Heure
final TableColumnExt heureDuPassageCol = addColumn(
columnModel,
new TimeCellEditor(),
newTableCellRender(Double.class, DecoratorService.TIME_IN_HOURS_MINUTES),
new LocalTimeCellEditor(),
newTableCellRender(Integer.class, DecoratorService.TIME_IN_HOURS_MINUTES),
SurveysTableModel.TIME);
heureDuPassageCol.setMaxWidth(100);
heureDuPassageCol.setWidth(100);
......
......@@ -81,14 +81,12 @@ public class ObservationUIHandler extends AbstractReefDbTabContainerUIHandler<Ob
// Affect models
getModel().setSurveyDetailsTabUIModel(getUI().getSurveyDetailsTabUI().getModel());
getModel().setSurveyMeasurementsTabUIModel(getUI().getSurveyMeasurementsTabUI().getModel());
// getModel().setPrelevementsGeneralUIModel(getUI().getPrelevementGeneralTabUI().getModel());
getModel().setOperationMeasurementsTabUIModel(getUI().getOperationMeasurementsTabUI().getModel());
getModel().setPhotosTabUIModel(getUI().getPhotosTabUI().getModel());
// Ajout des onglets
setCustomTab(ReefDbTabIndexes.ONGLET_OBSERVATION_GENERAL, getModel().getSurveyDetailsTabUIModel());
setCustomTab(ReefDbTabIndexes.ONGLET_OBSERVATION_MESURES, getModel().getSurveyMeasurementsTabUIModel());
// setCustomTab(ReefDbTabIndexes.ONGLET_PRELEVEMENTS_GENERAL, getModel().getPrelevementsGeneralUIModel());
setCustomTab(ReefDbTabIndexes.ONGLET_PRELEVEMENTS_MESURES, getModel().getOperationMeasurementsTabUIModel());
setCustomTab(ReefDbTabIndexes.ONGLET_PHOTOS, getModel().getPhotosTabUIModel());
......@@ -121,14 +119,12 @@ public class ObservationUIHandler extends AbstractReefDbTabContainerUIHandler<Ob
// Listen modify
listenModelModify(getModel().getSurveyDetailsTabUIModel());
listenModelModify(getModel().getSurveyMeasurementsTabUIModel());
// listenModelModify(getModel().getPrelevementsGeneralUIModel());
listenModelModify(getModel().getOperationMeasurementsTabUIModel());
listenModelModify(getModel().getPhotosTabUIModel());
// Listen valid
listenModelValid(getModel().getSurveyDetailsTabUIModel());
listenModelValid(getModel().getSurveyMeasurementsTabUIModel());
// listenModelValid(getModel().getPrelevementsGeneralUIModel());
listenModelValid(getModel().getOperationMeasurementsTabUIModel());
listenModelValid(getModel().getPhotosTabUIModel());
......@@ -136,7 +132,6 @@ public class ObservationUIHandler extends AbstractReefDbTabContainerUIHandler<Ob
registerValidators(
getUI().getSurveyDetailsTabUI().getValidator(),
getUI().getSurveyMeasurementsTabUI().getValidator(),
// getUI().getPrelevementGeneralTabUI().getValidator(),
getUI().getOperationMeasurementsTabUI().getValidator(),
getUI().getPhotosTabUI().getValidator());
......
......@@ -274,7 +274,6 @@ public class ObservationUIModel extends AbstractReefDbBeanUIModel<SurveyDTO, Obs
if (!modify) {
surveyDetailsTabUIModel.setModify(false);
surveyMeasurementsTabUIModel.setModify(false);
// prelevementsGeneralUIModel.setModify(false);
operationMeasurementsTabUIModel.setModify(false);
photosTabUIModel.setModify(false);
}
......@@ -323,13 +322,13 @@ public class ObservationUIModel extends AbstractReefDbBeanUIModel<SurveyDTO, Obs
/** {@inheritDoc} */
@Override
public Double getTime() {
public Integer getTime() {
return delegateObject.getTime();
}
/** {@inheritDoc} */
@Override
public void setTime(Double time) {
public void setTime(Integer time) {
delegateObject.setTime(time);
}
......
......@@ -214,7 +214,7 @@ public class OperationMeasurementsUngroupedRowModel extends AbstractReefDbRowUIM
* {@inheritDoc}
*/
@Override
public Double getTime() {
public Integer getTime() {
return delegateObject.getTime();
}
......@@ -222,7 +222,7 @@ public class OperationMeasurementsUngroupedRowModel extends AbstractReefDbRowUIM
* {@inheritDoc}
*/
@Override
public void setTime(Double time) {
public void setTime(Integer time) {
delegateObject.setTime(time);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment