@Override
public void doSave() throws EJbsObject {
logger.debug("Saving data...");
try {
CreditNotesRemote creditNotes = (CreditNotesRemote) ClientTools.getRemoteBean(CreditNotesRemote.class);
super.doSave();
if ((this.getDlgState() == DlgState.dsInsert) || (this.getDlgState() == DlgState.dsCopy)) {
creditNotes.createDataset(this.getCreditNote(), ClientGlobals.getUser(), ClientGlobals.getCompany());
} else if (this.getDlgState() == DlgState.dsEdit) {
logger.debug("Saving existing entity " + this.getCreditNote().getId() + ".");
creditNotes.updateDataset(this.getCreditNote(), ClientGlobals.getUser());
}
logger.debug("Entity saved.");
} catch (NamingException e) {
logger.error("Error saving credit-note..", e);
}