@Extension(bizId = Constants.BIZ_1) publicclassAddCustomerBizOneValidatorimplementsAddCustomerValidatorExtPt { publicvoidvalidate(AddCustomerCmd addCustomerCmd) { //For BIZ TWO CustomerTYpe could not be VIP if(CustomerType.VIP == addCustomerCmd.getCustomerDTO().getCustomerType()) thrownewBizException("Customer Type could not be VIP for Biz One"); } }
1 2 3 4 5 6 7 8
@Extension(bizId = Constants.BIZ_2) publicclassAddCustomerBizTwoValidatorimplementsAddCustomerValidatorExtPt { publicvoidvalidate(AddCustomerCmd addCustomerCmd) { //For BIZ TWO CustomerTYpe could not be null if (addCustomerCmd.getCustomerDTO().getCustomerType() == null) thrownewBizException("CustomerType could not be null"); } }
// Convert CO to Entity CustomerEntitycustomerEntity= extensionExecutor.execute(CustomerConvertorExtPt.class, cmd.getBizScenario(), extension -> extension.clientToEntity(cmd)); // Call Domain Entity for business logic processing logger.info("Call Domain Entity for business logic processing..."+customerEntity); customerEntity.addNewCustomer();