StringBuilder jsonBuilder = new StringBuilder("");
jsonBuilder
.append(getJsonHeader(totalRecords, searchCondition, isList));
while (emailTemplates.hasNext()) {
EmailTemplate instance = emailTemplates.next();
int id = instance.getId();
String name = CommonUtil.fromNullToEmpty(instance.getName());
String type = CommonUtil.fromNullToEmpty(instance.getType());
// Get type label
String typeLabel = "";
if ("meetingInvite".equals(type)) {
typeLabel = getText("emailTemplate.meetingInvite.label");
} else if ("meetingRemind".equals(type)) {
typeLabel = getText("emailTemplate.meetingRemind.label");
} else if ("callInvite".equals(type)) {
typeLabel = getText("emailTemplate.callInvite.label");
} else if ("callRemind".equals(type)) {
typeLabel = getText("emailTemplate.callRemind.label");
} else if ("campaignInvite".equals(type)) {
typeLabel = getText("emailTemplate.campaignInvite.label");
}
String description = CommonUtil.fromNullToEmpty(instance
.getDescription());
if (isList) {
User createdBy = instance.getCreated_by();
String createdByName = "";
if (createdBy != null) {
createdByName = CommonUtil.fromNullToEmpty(createdBy
.getName());
}
User updatedBy = instance.getUpdated_by();
String updatedByName = "";
if (updatedBy != null) {
updatedByName = CommonUtil.fromNullToEmpty(updatedBy
.getName());
}
SimpleDateFormat dateFormat = new SimpleDateFormat(
Constant.DATE_TIME_FORMAT);
Date createdOn = instance.getCreated_on();
String createdOnName = "";
if (createdOn != null) {
createdOnName = dateFormat.format(createdOn);
}
Date updatedOn = instance.getUpdated_on();
String updatedOnName = "";
if (updatedOn != null) {
updatedOnName = dateFormat.format(updatedOn);
}
jsonBuilder.append("{\"cell\":[\"").append(id).append("\",\"")