* @throws Exception
*/
public static String generateColumnHeadersFromHtmlForm(HtmlForm form, List<String> extraCols, StringBuffer sb, List<PatientIdentifierType> pitList) throws Exception {
FormEntrySession session = new FormEntrySession(HtmlFormEntryUtil.getFakePerson(), form, null); // session gets a null HttpSession
session.getHtmlToDisplay();
HtmlFormSchema hfs = session.getContext().getSchema();
sb.
append(DEFAULT_QUOTE).append("ENCOUNTER_ID").append(DEFAULT_QUOTE).append(DEFAULT_COLUMN_SEPARATOR).
append(DEFAULT_QUOTE).append("ENCOUNTER_DATE").append(DEFAULT_QUOTE).append(DEFAULT_COLUMN_SEPARATOR).
append(DEFAULT_QUOTE).append("ENCOUNTER_LOCATION").append(DEFAULT_QUOTE).append(DEFAULT_COLUMN_SEPARATOR).
append(DEFAULT_QUOTE).append("ENCOUNTER_PROVIDER").append(DEFAULT_QUOTE).append(DEFAULT_COLUMN_SEPARATOR).
append(DEFAULT_QUOTE).append("INTERNAL_PATIENT_ID").append(DEFAULT_QUOTE).append(DEFAULT_COLUMN_SEPARATOR);
int index = 1;
for (PatientIdentifierType pit : pitList){
sb.append(DEFAULT_QUOTE).append(pit.getName()).append(DEFAULT_QUOTE);
if (index < pitList.size())
sb.append(DEFAULT_COLUMN_SEPARATOR);
index ++;
}
for (HtmlFormField hfsec : hfs.getAllFields())
sb = generateColumnHeadersFromHtmlFormHelper(hfsec, extraCols, sb);
session = null;
sb.append(DEFAULT_LINE_SEPARATOR);
return sb.toString();