Created
February 6, 2015 13:08
-
-
Save stephen-masters/cff5e162df0f465d3a6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class BusPassService { | |
private final KieContainer kieContainer; | |
@Autowired | |
public BusPassService(KieContainer kieContainer) { | |
log.info("Initialising a new bus pass session."); | |
this.kieContainer = kieContainer; | |
} | |
/** | |
* Create a new session, insert a person's details and fire rules to | |
* determine what kind of bus pass is to be issued. | |
*/ | |
public BusPass getBusPass(Person person) { | |
KieSession kieSession = kieContainer.newKieSession("BusPassSession"); | |
kieSession.insert(person); | |
kieSession.fireAllRules(); | |
BusPass busPass = findBusPass(kieSession); | |
kieSession.dispose(); | |
return busPass; | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment