tim-connector: Use LocalDate API

It makes code simpler than using Calendar API, and it's the common way to manage
dates into LibrePlan.

FEA: ItEr77S16JiraAndTimConnectorContributionIntegration
This commit is contained in:
Manuel Rego Casasnovas 2013-02-11 13:52:08 +01:00
parent dc15df3d2e
commit df53c2dd97

View file

@ -20,7 +20,6 @@
package org.libreplan.importers;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -28,6 +27,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.LocalDate;
import org.libreplan.business.common.IAdHocTransactionService;
import org.libreplan.business.common.IOnTransaction;
import org.libreplan.business.common.daos.IAppPropertiesDAO;
@ -150,11 +150,12 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim {
int nrDaysTimesheetToTim = Integer.parseInt(appProperties
.get("NrDaysTimesheetToTim"));
Calendar dateNrOfDaysBack = Calendar.getInstance();
dateNrOfDaysBack.add(Calendar.DAY_OF_MONTH, -nrDaysTimesheetToTim);
LocalDate dateNrOfDaysBack = new LocalDate()
.minusDays(nrDaysTimesheetToTim);
List<WorkReportLine> workReportLines = order.getWorkReportLines(
new Date(dateNrOfDaysBack.getTimeInMillis()), new Date(), true);
dateNrOfDaysBack.toDateTimeAtStartOfDay().toDate(), new Date(),
true);
if (workReportLines == null || workReportLines.isEmpty()) {
LOG.warn("No work reportlines are found");
return false;