}
if(hasErrors()){
return SUCCESS;
}
BusinessPartner businessPartner;
if(getBusinessPartner().getId() == null || "".equalsIgnoreCase(getBusinessPartner().getId())){
businessPartner = new BusinessPartner();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
businessPartner = (BusinessPartner) manager.getById(BusinessPartner.class, getBusinessPartner().getId());
logInfo = businessPartner.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
businessPartner.setSearchKey(getBusinessPartner().getSearchKey());
businessPartner.setGreeting(getGreeting());
businessPartner.setName1(getBusinessPartner().getName1());
businessPartner.setName2(getBusinessPartner().getName2());
businessPartner.setDescription(getBusinessPartner().getDescription());
businessPartner.setSummaryLevel(getBusinessPartner().getSummaryLevel());
businessPartner.setCreditStatus(getBusinessPartner().getCreditStatus());
businessPartner.setOpenBalance(getBusinessPartner().getOpenBalance());
businessPartner.setTaxId(getBusinessPartner().getTaxId());
businessPartner.setTaxGroup(getTaxGroup());
businessPartner.setTaxExempt(getBusinessPartner().getTaxExempt());
businessPartner.setDUNS(getBusinessPartner().getDUNS());
businessPartner.setReferenceNo(getBusinessPartner().getReferenceNo());
businessPartner.setNAICS_SIC(getBusinessPartner().getNAICS_SIC());
businessPartner.setRating(getBusinessPartner().getRating());
businessPartner.setBusinessPartnerGroup(getBusinessPartnerGroup());
businessPartner.setProspect(getBusinessPartner().getProspect());
businessPartner.setPotentialLifeTimeValue(getBusinessPartner().getPotentialLifeTimeValue());
businessPartner.setActualLifeTimeValue(getBusinessPartner().getActualLifeTimeValue());
businessPartner.setAcquisitionCost(getBusinessPartner().getAcquisitionCost());
businessPartner.setEmployes(getBusinessPartner().getEmployes());
businessPartner.setShare(getBusinessPartner().getShare());
businessPartner.setSaleVolumeIn1000(getBusinessPartner().getSaleVolumeIn1000());
businessPartner.setFirstSale(getBusinessPartner().getFirstSale());
manager.save(businessPartner);
setBusinessPartner(businessPartner);
return SUCCESS;
}