@Override
public void doSave() throws EJbsObject {
logger.debug("Saving data...");
try {
DunningsRemote dunnings = (DunningsRemote)ClientTools.getRemoteBean(DunningsRemote.class);
super.doSave();
if (this.getDlgState() == DlgState.dsInsert) {
logger.debug("Adding new entity " + this.getDunning().getId() + ".");
dunnings.createDataset(this.getDunning(), ClientGlobals.getUser(), ClientGlobals.getCompany());
} else if (this.getDlgState() == DlgState.dsEdit) {
logger.debug("Saving existing entity " + this.getDunning().getId() + ".");
dunnings.updateDataset(this.getDunning(), ClientGlobals.getUser());
}
logger.debug("Entity saved.");
} catch (NamingException e) {
logger.error("Error saving payment-term.", e);
}