writer.writeHeader(header);
if (!isTemplate) {
String[] ids = seleteIDs.split(",");
for (int i = 0; i < ids.length; i++) {
String id = ids[i];
Call call = baseService.getEntityById(Call.class,
Integer.parseInt(id));
final HashMap<String, ? super Object> data1 = new HashMap<String, Object>();
data1.put(header[0], call.getId());
data1.put(header[1],
CommonUtil.fromNullToEmpty(call.getSubject()));
CallDirection callDirection = call.getDirection();
if (callDirection != null) {
data1.put(header[2], callDirection.getId());
} else {
data1.put(header[2], "");
}
data1.put(header[3],
CommonUtil.getOptionLabel(callDirection));
CallStatus callStatus = call.getStatus();
if (call.getStatus() != null) {
data1.put(header[4], callStatus.getId());
} else {
data1.put(header[4], "");
}
data1.put(header[5], CommonUtil.getOptionLabel(callStatus));
SimpleDateFormat dateFormat = new SimpleDateFormat(
Constant.DATE_TIME_FORMAT);
Date startDate = call.getStart_date();
if (startDate != null) {
data1.put(header[6], dateFormat.format(startDate));
} else {
data1.put(header[6], "");
}
data1.put(header[7], call.isReminder_email());
ReminderOption reminderOptionEmail = call
.getReminder_option_email();
if (reminderOptionEmail != null) {
data1.put(header[8], reminderOptionEmail.getId());
} else {
data1.put(header[8], "");
}
data1.put(header[9],
CommonUtil.getOptionLabel(reminderOptionEmail));
data1.put(header[10],
CommonUtil.fromNullToEmpty(call.getNotes()));
if (call.getAssigned_to() != null) {
data1.put(header[11], call.getAssigned_to().getId());
data1.put(header[12], call.getAssigned_to().getName());
} else {
data1.put(header[11], "");
data1.put(header[12], "");
}
writer.write(data1, header);