Package eu.planets_project.pp.plato.model.tree

Examples of eu.planets_project.pp.plato.model.tree.TemplateTree


         * store all templates
         */
        for (TemplateTree template : templates) {
           
            // we get the template tree ("Public Templates") from the database
            TemplateTree tdb;
            try {
                tdb = (TemplateTree) em.createQuery("select n from TemplateTree n where name = :name")
                    .setParameter("name", template.getName())
                    .getSingleResult();
            } catch(NoResultException e) {
                tdb = new TemplateTree(template.getName(), null);
            }
           
            if (tdb != null) {
           
                // we get the templates and add them to the tree
                // and store them
                for (TreeNode n : template.getRoot().getChildren()) {
                    tdb.getRoot().addChild(n);
                    em.persist(n);
                }

                em.persist(em.merge(tdb));
                em.flush();
View Full Code Here


     * 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();
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.tree.TemplateTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.