Package com.enioka.jqm.jpamodel

Examples of com.enioka.jqm.jpamodel.GlobalParameter


     */
    static String getParameter(String key, String defaultValue, EntityManager em)
    {
        try
        {
            GlobalParameter gp = em.createQuery("SELECT n from GlobalParameter n WHERE n.key = :key", GlobalParameter.class)
                    .setParameter("key", key).getSingleResult();
            return gp.getValue();
        }
        catch (NoResultException e)
        {
            return defaultValue;
        }
View Full Code Here


                    .getSingleResult();
            return;
        }
        catch (NoResultException e)
        {
            GlobalParameter gp = new GlobalParameter();
            gp.setKey(key);
            gp.setValue(initValue);
            em.persist(gp);
        }
        catch (NonUniqueResultException e)
        {
            // It exists! Nothing to do...
View Full Code Here

        {
            jqmlogger.warn("Log level could not be set", e);
        }

        // Log multicasting (& log4j stdout redirect)
        GlobalParameter gp1 = em.createQuery("SELECT g FROM GlobalParameter g WHERE g.key = :k", GlobalParameter.class)
                .setParameter("k", "logFilePerLaunch").getSingleResult();
        if ("true".equals(gp1.getValue()))
        {
            RollingFileAppender a = (RollingFileAppender) Logger.getRootLogger().getAppender("rollingfile");
            MulticastPrintStream s = new MulticastPrintStream(System.out, FilenameUtils.getFullPath(a.getFile()));
            System.setOut(s);
            ((ConsoleAppender) Logger.getRootLogger().getAppender("consoleAppender")).setWriter(new OutputStreamWriter(s));
View Full Code Here

    // ------------------ GLOBALPARAMETER ------------------------

    public static GlobalParameter createGlobalParameter(String key, String value, EntityManager em)
    {
        GlobalParameter gp = new GlobalParameter();
        EntityTransaction transac = em.getTransaction();
        transac.begin();

        gp.setKey(key);
        gp.setValue(value);

        em.persist(gp);
        transac.commit();
        return gp;
    }
View Full Code Here

TOP

Related Classes of com.enioka.jqm.jpamodel.GlobalParameter

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.