public class LPFile extends _LPFile {
....
....
public synchronized void setFileData(NSData fileData) throws IOException {
// Update forms by deleting existing ones, then adding new ones
for (int i=lpFileForms().count()-1; i>=0; i--) {
final LPFileForm lpFileForm = (LPFileForm) lpFileForms().objectAtIndex(i);
this.removeFromLpFileForms(lpFileForm);
editingContext().deleteObject(lpFileForm);
}
// Get new form list via SOAP call
Element docInfoElm = LPServer.threadLocal().exportDocumentInfo(this);
List formElms = formsElm.getChildren("form");
for (int i = 0; i < formElms.size(); i++) {
Element formElm = (Element) formElms.get(i);
LPFileForm lpFileForm = new LPFileForm();
// extract data from xml, put into lpFileForm
// Setup relationships to lpForm and lpFile
lpFileForm.setLpForm(lpForm);
lpFileForm.setLpFormID(lpForm.id());
lpFileForm.setLpFile(this);
lpFileForm.setLpFileID(this.fileID());
this.addToLpFileForms(lpFileForm);
editingContext().insertObject(lpFileForm);
}
editingContext().saveChanges();
}
....
....
}