Is it possible with the Decision Center API to get the name of the current branch? I would like to implement a dynamic domain plugin that updates domains by querying from a database. But I want to be able to specify local, test, stage and prod database connection details. Because we are sharing a single decision center instance for test, stage and prod, the project branch seems like the best option for targeting the database. Is it possible to determine what branch I am in when I trigger the DomainValueProvider?
You can get determine the current branch by calling the getWorkingBaseline method on IlrSession:
private String determineBranch(IlrSession ilrSession) {
IlrBaseline currentBranch = ilrSession.getWorkingBaseline();
String branch = currentBranch.getName();
log.info( "currentBranch is " + branch);
return branch;
}
If you are implementing an IlrDefaultSessionController, IlrSession will be provided if you override the setSession(IlrSession session) method. From elsewhere, you can get the session from ManagerBean:
protected IlrSession getIlrSession() {
ManagerBean bean = ManagerBean.getInstance();
return bean.getSession();
}
Good luck!