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

Examples of org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource


    public void addConfiguration(String key, String value, Date expire) throws RegistryException{
        if (configurationRegistry != null){
            configurationRegistry.addConfiguration(key, value, expire);
        } else {
            ConfigurationResource config = ResourceUtils.createConfiguration(key);
            config.setConfigVal(value);
            config.setExpireDate(new Timestamp(expire.getTime()));
            config.save();
        }


    }
View Full Code Here


        generator.setParameter(AbstractResource.ConfigurationConstants.CONFIG_KEY, configKey);
        Query q = generator.selectQuery(em);
        List<?> resultList = q.getResultList();
        if (resultList.size() != 0) {
            for (Object result : resultList) {
                ConfigurationResource configurationResource = createConfigurationResourceObject(result);
                list.add(configurationResource);
            }
        }
        em.getTransaction().commit();
        em.close();
View Full Code Here

    /**
     * @param configKey
     * @return
     */
    public static ConfigurationResource createConfiguration(String configKey) {
        ConfigurationResource config = new ConfigurationResource();
        config.setConfigKey(configKey);
        return config;
    }
View Full Code Here

     * @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 void setUp() throws Exception {
        super.setUp();
    }

    public void testSave() throws Exception {
        ConfigurationResource configuration = ResourceUtils.createConfiguration("testConfigKey");
        configuration.setConfigVal("testConfigValue");
        Calendar calender = Calendar.getInstance();
        java.util.Date d = calender.getTime();
        Timestamp currentTime = new Timestamp(d.getTime());
        configuration.setExpireDate(currentTime);
        configuration.setCategoryID("SYSTEM");
        configuration.save();

        assertTrue("Configuration Save succuessful", ResourceUtils.isConfigurationExist("testConfigKey"));
        //remove test configuration
        ResourceUtils.removeConfiguration("testConfigKey");
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource

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.