Map<String, String> row = new HashMap<String, String>();
for (int i = 0; i < line.size(); i++) {
row.put(header[i], line.get(i));
}
Meeting meeting = new Meeting();
try {
String id = row.get(getText("entity.id.label"));
if (!CommonUtil.isNullOrEmpty(id)) {
meeting.setId(Integer.parseInt(id));
}
meeting.setSubject(CommonUtil.fromNullToEmpty(row
.get(getText("entity.subject.label"))));
String statusID = row
.get(getText("entity.status_id.label"));
if (CommonUtil.isNullOrEmpty(statusID)) {
meeting.setStatus(null);
} else {
MeetingStatus status = meetingStatusService
.getEntityById(MeetingStatus.class,
Integer.parseInt(statusID));
meeting.setStatus(status);
}
SimpleDateFormat dateFormat = new SimpleDateFormat(
Constant.DATE_TIME_FORMAT);
String startDateS = row
.get(getText("entity.start_date.label"));
if (startDateS != null) {
Date startDate = dateFormat.parse(startDateS);
meeting.setStart_date(startDate);
} else {
meeting.setStart_date(null);
}
String endDateS = row.get(getText("entity.end_date.label"));
if (endDateS != null) {
Date endDate = dateFormat.parse(endDateS);
meeting.setEnd_date(endDate);
} else {
meeting.setEnd_date(null);
}
meeting.setRelated_object(CommonUtil.fromNullToEmpty(row
.get(getText("entity.related_object.label"))));
String relatedRecord = row
.get(getText("entity.related_record_id.label"));
if (CommonUtil.isNullOrEmpty(relatedRecord)) {
meeting.setRelated_record(0);
} else {
meeting.setRelated_record(Integer
.parseInt(relatedRecord));
}
meeting.setLocation(CommonUtil.fromNullToEmpty(row
.get(getText("meeting.location.label"))));
String reminderWayEmail = row
.get(getText("entity.reminder_email.label"));
if (CommonUtil.isNullOrEmpty(reminderWayEmail)) {
meeting.setReminder_email(false);
} else {
meeting.setReminder_email(Boolean
.parseBoolean(reminderWayEmail));
}
String reminderOptionEmailID = row
.get(getText("entity.reminder_option_email_id.label"));
if (CommonUtil.isNullOrEmpty(reminderOptionEmailID)) {
meeting.setReminder_option_email(null);
} else {
ReminderOption reminderOption = reminderOptionService
.getEntityById(ReminderOption.class,
Integer.parseInt(reminderOptionEmailID));
meeting.setReminder_option_email(reminderOption);
}
meeting.setNotes(CommonUtil.fromNullToEmpty(row
.get(getText("entity.notes.label"))));
String assignedToID = row
.get(getText("entity.assigned_to_id.label"));
if (CommonUtil.isNullOrEmpty(assignedToID)) {
meeting.setAssigned_to(null);
} else {
User assignedTo = userService.getEntityById(User.class,
Integer.parseInt(assignedToID));
meeting.setAssigned_to(assignedTo);
}
baseService.makePersistent(meeting);
successfulNum++;
} catch (Exception e) {
failedNum++;
failedMsg.put(meeting.getSubject(), e.getMessage());
}
}
this.setFailedMsg(failedMsg);