* which is determined by {@link #selectedTemplateLibrary}
*
* Invoked when the drowndown-box is manipulated.
*/
private TemplateTree getLibrary(String selectedTemplateLibrary) {
TemplateTree tt = null;
//log.debug("Getting template tree " + selectedTemplateLibrary + " for user " + user.getUsername());
try {
tt = (TemplateTree) em.createQuery("select n from TemplateTree n where name = ?").setParameter(1, selectedTemplateLibrary).getSingleResult();
if (tt == null || tt.getRoot() == null || tt.getRoot().getChildren().size() == 0) {
testDataLoader.insertTemplateTree();
tt = (TemplateTree) em.createQuery("select n from TemplateTree n where name = ?").setParameter(1, selectedTemplateLibrary).getSingleResult();
}
} catch (NoResultException e) {
testDataLoader.insertTemplateTree();