public void setAttributePropertyInDB ( final String attributeName , final String propertyName , final String value ) throws DevFailed { xlogger . entry ( propertyName ) ; // insert value in db only if input value is different and not a // default value // if (checkCurrentValue) { // final String presentValue = getAttributePropertyFromDB(attributeName, propertyName); // final boolean isADefaultValue = presentValue.isEmpty() // && (value.equalsIgnoreCase(AttributePropertiesImpl.NOT_SPECIFIED) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_DIPLAY_UNIT) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_UNIT) || value // .equalsIgnoreCase(AttributePropertiesImpl.NO_STD_UNIT)); // if (!isADefaultValue && !presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) { // LOGGER.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value }); // final Map<String, String[]> propInsert = new HashMap<String, String[]>(); // propInsert.put(propertyName, new String[] { value }); // DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert); // } // } else { logger . debug ( "update in DB {}, property {}= {}" , new Object [ ] { attributeName , propertyName , value } ) ; final Map < String , String [ ] > propInsert = new HashMap < String , String [ ] > ( ) ; propInsert . put ( propertyName , new String [ ] { value } ) ; DatabaseFactory . getDatabase ( ) . setAttributeProperties ( deviceName , attributeName , propInsert ) ; // } xlogger . exit ( ) ; }
Set attribute property in tango db