/** * Used to get a property from the data source with the incoming key. If the key can not be * resolved, the value passed into the method in the <code>defaultValue</code> field will be used. * * @param key Name of the property requested. * @param value Default value that should be displayed if not found in the database. * @return {@link Object} value found in database. Will use the default value if not found. */ public synchronized void setProperty(String key, String value) { Global property = restEasyGlobalsDao.findOne(key); if (property == null) { // Create a new one and then save to the application data source. property = new Global(); property.setKey(key); property.setValue(value); restEasyGlobalsDao.save(property); } else { // Set the value of the old property. property.setValue(value); // Update the property in the data source. restEasyGlobalsDao.delete(key); restEasyGlobalsDao.save(property); } }