local.setDataSource(this.dataSource);
float opportunityTotal = local.updateTotalAmount(opportunityID);
local.updateForcastAmount(opportunityTotal, opportunityID);
// do the update
}
CvFileFacade cvf = new CvFileFacade();
// while updating for attached file ids, only commiting them as
// isTemporary=NO is to be done.
// deleting records for 'whatever user has removed from previous list'
// files from CVFILE table and DISK
// and Adding new records for 'whatever user has adde into list' Will be
// Done at attachmentHandler and removeHandler
// So when control comes here, only 'files to be kept' list will be ther
// in array as well as in CVFILE records as well as on DISK
dl.setSqlQuery("delete from proposallink where proposalid = "
+ proposalForm.getProposalid());
dl.executeUpdate();
String[] values = proposalForm.getAttachFileIds();
if (values != null) {
// 33 is RecordTypeId for CVFile table and it is hardcoded.
// Later it may be taken from 'CVTable' table.
for (int i = 0; i < values.length; i++) {
StringTokenizer stk = new StringTokenizer(values[i], "#");
String fileIDStr = stk.nextToken();
if (fileIDStr != null) {
cvf.commitEmailAttachment(userId, Integer.parseInt(fileIDStr), this.dataSource);
dl.setSqlQuery("insert into proposallink(proposalid,recordtypeid,recordid) values ("
+ proposalForm.getProposalid() + ",33," + fileIDStr + ")");
dl.executeUpdate();
}
}