}
}
private ActionForward doUpdateTimeAction(Session session, TimeEditorForm form,
HttpServletRequest request, ActionMapping actionMapping) throws Exception {
DecimalFormat decimalParser = new DecimalFormat(request);
SimpleDateFormat dateTimeFormat = getDateTimeFormat(request);
SimpleDateFormat dateFormat = getDateFormat(request);
try {
List timeEntries = session.find("from timeEntry in class org.nxplanner.domain.TimeEntry " +
"where timeEntry.taskId = ? order by timeEntry.reportDate",
form.getOid(), Hibernate.STRING);
double hoursWorked = 0;
boolean rowDeleted = false;
for (int i = 0; i < form.getRowcount(); i++) {
int id = 0;
if (isPresent(form.getEntryId(i))) {
id = Integer.parseInt(form.getEntryId(i));
}
if (form.getDeleted(i) != null && form.getDeleted(i).equals("true")) {
TimeEntry entry = getEntry(timeEntries, id);
session.delete(entry);
rowDeleted = true;
continue;
}
Date startTime = null;
if (isPresent(form.getStartTime(i))) {
startTime = dateTimeFormat.parse(form.getStartTime(i));
}
Date endTime = null;
if (isPresent(form.getEndTime(i))) {
endTime = dateTimeFormat.parse(form.getEndTime(i));
}
int person1Id = 0;
if (isPresent(form.getPerson1Id(i))) {
person1Id = Integer.parseInt(form.getPerson1Id(i));
}
int person2Id = 0;
if (isPresent(form.getPerson2Id(i))) {
person2Id = Integer.parseInt(form.getPerson2Id(i));
}
double duration = 0;
if (isPresent(form.getDuration(i))) {
duration = decimalParser.parse(form.getDuration(i));
}
Date reportDate = null;
if (isPresent(form.getReportDate(i))) {
reportDate = dateFormat.parse(form.getReportDate(i));