public void uploadDoctorAction() throws IOException, ClipsException {
DirectoryDoctorAction dirAction =
(DirectoryDoctorAction) DirectoryLocator.getDirectory(DirectoryDoctorAction.class, false);
DirectoryDoctorActionItem parent = null;
DirectoryDoctorActionItem current = null;
DirectoryDoctorActionItem item = null;
String line = input.readLine();
while (line != null) {
if (!line.trim().isEmpty()) {
int pos = line.indexOf('|');
if (pos > -1) {
String code = line.substring(0, pos);
String title = line.substring(pos + 1);
if (code.length() == 2) {
DoctorActionDetails details = new DoctorActionDetails();
details.parentItem = 0;
details.title = title;
details.code = code;
parent = new DirectoryDoctorActionItem(details);
dirAction.getItems().append(parent);
System.out.println(code + " " + title);
}
else if (code.length() == 5) {
code = code.substring(3, 5);
DoctorActionDetails details = new DoctorActionDetails();
details.parentItem = parent.getID();
details.title = title;
details.code = code;
current = new DirectoryDoctorActionItem(details);
dirAction.getItems().append(current);
System.out.println(" " +code + " " + title);
}
else if (code.length() == 9) {
code = code.substring(6);
DoctorActionDetails details = new DoctorActionDetails();
details.parentItem = current.getID();
details.title = title;
details.code = code;
item = new DirectoryDoctorActionItem(details);
dirAction.getItems().append(item);
System.out.println(" " +code + " " + title);
}
}