Package org.apache.airavata.persistance.registry.jpa.model

Examples of org.apache.airavata.persistance.registry.jpa.model.Configuration


        queryGenerator.setParameter(ConfigurationConstants.CONFIG_KEY, keys[0]);
        Query q = queryGenerator.selectQuery(em);
        List resultList = q.getResultList();
        if (resultList.size() != 0) {
            for (Object result : resultList) {
                Configuration configuration = (Configuration) result;
                ConfigurationResource configurationResource =
                        (ConfigurationResource)Utils.getResource(ResourceType.CONFIGURATION, configuration);
                list.add(configurationResource);
            }
        }
View Full Code Here


        Lock lock = ResourceUtils.getLock();
        lock.lock();
        try {
            EntityManager em = ResourceUtils.getEntityManager();
            //whether existing
            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
            em.close();

            em = ResourceUtils.getEntityManager();
            em.getTransaction().begin();
            Configuration configuration = new Configuration();
            configuration.setConfig_key(configKey);
            configuration.setConfig_val(configVal);
            configuration.setExpire_date(expireDate);
            configuration.setCategory_id(categoryID);
            if (existing != null) {
                existing.setExpire_date(expireDate);
                existing.setCategory_id(categoryID);
                configuration = em.merge(existing);
            } else {
View Full Code Here

        queryGenerator.setParameter(ConfigurationConstants.CONFIG_KEY, keys[0]);
        Query q = queryGenerator.selectQuery(em);
        List resultList = q.getResultList();
        if (resultList.size() != 0) {
            for (Object result : resultList) {
                Configuration configuration = (Configuration) result;
                ConfigurationResource configurationResource =
                        (ConfigurationResource)Utils.getResource(ResourceType.CONFIGURATION, configuration);
                list.add(configurationResource);
            }
        }
View Full Code Here

        Lock lock = ResourceUtils.getLock();
        lock.lock();
        try {
            EntityManager em = ResourceUtils.getEntityManager();
            //whether existing
            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal));
            em.close();

            em = ResourceUtils.getEntityManager();
            em.getTransaction().begin();
            Configuration configuration = new Configuration();
            configuration.setConfig_key(configKey);
            configuration.setConfig_val(configVal);
            configuration.setExpire_date(expireDate);
            if (existing != null) {
                existing.setExpire_date(expireDate);
                configuration = em.merge(existing);
            } else {
                em.merge(configuration);
View Full Code Here

    public synchronized void save() throws RegistryException {
        EntityManager em = null;
        try {
            em = ResourceUtils.getEntityManager();
            //whether existing
            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, categoryID));
            em.close();
            em = ResourceUtils.getEntityManager();
            em.getTransaction().begin();
            Configuration configuration = new Configuration();
            configuration.setConfig_key(configKey);
            configuration.setConfig_val(configVal);
            configuration.setExpire_date(expireDate);
            configuration.setCategory_id(categoryID);
            if (existing != null) {
                existing.setExpire_date(expireDate);
                existing.setCategory_id(categoryID);
                configuration = em.merge(existing);
            } else {
View Full Code Here

     * @param result
     * @return
     */
    private static ConfigurationResource createConfigurationResourceObject(
            Object result) {
        Configuration configuration = (Configuration) result;
        ConfigurationResource configurationResource = new ConfigurationResource(configuration.getConfig_key(), configuration.getConfig_val());
        configurationResource.setExpireDate(configuration.getExpire_date());
        return configurationResource;
    }
View Full Code Here

    public static boolean isConfigurationExists(String configKey, String configVal){
        try{
            //Currently categoryID is hardcoded value
            EntityManager em = ResourceUtils.getEntityManager();
            Configuration existing = em.find(Configuration.class, new Configuration_PK(configKey, configVal, AbstractResource.ConfigurationConstants.CATEGORY_ID_DEFAULT_VALUE));
            em.close();
            return existing!= null;
        } catch (Exception e){
            logger.error(e.getMessage(), e);
            throw new EntityNotFoundException();
View Full Code Here

TOP

Related Classes of org.apache.airavata.persistance.registry.jpa.model.Configuration

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.