Configure an attribute's properties

@param attributeName the attribute name
@param properties    its properties
@throws DevFailed
979872
public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties)
            throws DevFailed {
        final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList());
        attr.setProperties(properties);
    }
63449
public DbAttribute get_class_attribute_property(String classname, String attname) throws DevFailed {
		return databaseDAO.get_class_attribute_property(this, classname, attname);
	}
838348
@Override
    public void setClassProperties(final String name, final Map<String, String[]> properties) throws DevFailed {
        final List<String> args = getArray(properties, name);
        final DeviceData argin = new DeviceData();
        argin.insert(args.toArray(new String[args.size()]));
        database.command_inout("DbPutClassProperty", argin);
    }
433343
public void addAttribute(final IAttributeBehavior behavior) throws DevFailed {
        final AttributeConfiguration configuration = behavior.getConfiguration();
        final String attributeName = configuration.getName();
        xlogger.entry("adding dynamic attribute {}", attributeName);
        if (behavior instanceof ForwardedAttribute) {
            // init attribute with either the attribute property value, or the value defined in its constructor
            final ForwardedAttribute att = (ForwardedAttribute) behavior;
            final String deviceName = deviceImpl.getName();
            final String rootAttributeName = behavior.getConfiguration().getAttributeProperties()
                    .loadAttributeRootName(deviceName, attributeName);
            if (rootAttributeName == null || rootAttributeName.isEmpty()
                    || rootAttributeName.equalsIgnoreCase(Constants.NOT_SPECIFIED)) {
                att.init(deviceName);
                // persist root attribute name in tango db
                behavior.getConfiguration().getAttributeProperties()
                        .persistAttributeRootName(deviceName, attributeName);
            } else {
                // use attribute property
                att.init(deviceName, rootAttributeName);
            }
            // check if this attribute is already created
            final String lower = att.getRootName().toLowerCase(Locale.ENGLISH);
            if (forwardedAttributes.contains(lower)) {
                throw DevFailedUtils.newDevFailed(ExceptionMessages.FWD_DOUBLE_USED,
                        "root attribute already used in this device");
            } else {
                forwardedAttributes.add(lower);
            }
        } else {
            // set default properties
            final AttributePropertiesImpl prop = configuration.getAttributeProperties();
            if (prop.getLabel().isEmpty()) {
                prop.setLabel(configuration.getName());
            }
            if (prop.getFormat().equals(Constants.NOT_SPECIFIED)) {
                prop.setDefaultFormat(configuration.getScalarType());
            }
        }
        final AttributeImpl attrImpl = new AttributeImpl(behavior, deviceImpl.getName());
        attrImpl.setStateMachine(behavior.getStateMachine());
        deviceImpl.addAttribute(attrImpl);
        dynamicAttributes.put(attributeName.toLowerCase(Locale.ENGLISH), attrImpl);
        deviceImpl.pushInterfaceChangeEvent(false);
        if (configuration.isPolled() && configuration.getPollingPeriod() > 0) {
            deviceImpl.addAttributePolling(attributeName, configuration.getPollingPeriod());
        }
        xlogger.exit();
    }
1087823
public void delete_attribute_property(String attname, String propname) throws DevFailed {
        deviceProxyDAO.delete_attribute_property(this, attname, propname);
    }
288971
public void delete_attribute_property(String attributeName, String propertyName) throws DevFailed {
        database.delete_class_attribute_property(className, attributeName, propertyName);
    }
1106988
public void delete_device_attribute_property(Database database, String deviceName, String attname, String propname)
            throws DevFailed {
        String[] array = new String[1];
        array[0] = propname;
        delete_device_attribute_property(database, deviceName, attname, array);
    }
1111372
public void delete_class_attribute_property(Database database, String name, String attname, String[] propnames)
            throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        String[] array = new String[2 + propnames.length];
        array[0] = name;
        array[1] = attname;
        System.arraycopy(propnames, 0, array, 2, propnames.length);

        DeviceData argIn = new DeviceData();
        argIn.insert(array);
        command_inout(database, "DbDeleteClassAttributeProperty", argIn);
    }
702755
public void setAttribute(final String attributeName, final String attributeValue) {
        uiObject.getElement().setAttribute(attributeName, attributeValue);
    }
152162
public static void set_value(final Object value, final Attribute attribute) throws DevFailed {
	try {

	    if (value instanceof Short) {
		attribute.set_value(((Short) value).shortValue());
	    } else if (value instanceof Byte) {
		attribute.set_value(((Byte) value).shortValue());
	    } else if (value instanceof String) {
		attribute.set_value((String) value);
	    } else if (value instanceof Integer) {
		attribute.set_value(((Integer) value).intValue());
	    } else if (value instanceof Long) {
		attribute.set_value(((Long) value).longValue());
	    } else if (value instanceof Float) {
		attribute.set_value(((Float) value).doubleValue());
	    } else if (value instanceof Boolean) {
		attribute.set_value(((Boolean) value).booleanValue());
	    } else if (value instanceof Double) {
		attribute.set_value(((Double) value).doubleValue());
	    } else if (value instanceof DevState) {
		attribute.set_value((DevState) value);
	    } else {
		// System.out.println(value.getClass().getName());
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type " + value.getClass()
			+ " not supported",
			"AttributeHelper.insert(Object value,deviceAttributeWritten)");
	    }
	} catch (final Exception e) {
	    e.printStackTrace();
	}
    }
629702
public void delete_attribute_property(String attname, String propname) throws DevFailed {
        database.delete_device_attribute_property(deviceName, attname, propname);
    }
312449
public DbHistory[] get_class_attribute_property_history(String classname, String attname, String propname) throws DevFailed {
		return databaseDAO.get_class_attribute_property_history(this, classname, attname, propname);
	}
1005321
public void setAttributePropertiesInDB(final String attributeName, final Map<String, String[]> properties)
            throws DevFailed {
        xlogger.entry(properties);

        final Map<String, String> currentValues = getAttributePropertiesFromDBSingle(attributeName);
        final Map<String, String[]> propInsert = new HashMap<String, String[]>();
        for (final Entry<String, String[]> entry : properties.entrySet()) {
            final String propertyName = entry.getKey();
            final String[] valueArray = entry.getValue();
            // insert value in db only if input value is different and not a
            // default value
            if (valueArray.length == 1) {
                final String value = valueArray[0];
                final String presentValue = currentValues.get(propertyName);
                boolean isADefaultValue = false;
                if (presentValue != null) {
                    isADefaultValue = presentValue.isEmpty()
                            && (value.equalsIgnoreCase(Constants.NOT_SPECIFIED)
                                    || value.equalsIgnoreCase(Constants.NO_DIPLAY_UNIT)
                                    || value.equalsIgnoreCase(Constants.NO_UNIT) || value
                                        .equalsIgnoreCase(Constants.NO_STD_UNIT));
                }
                if (!isADefaultValue) {
                    if (presentValue == null) {
                        propInsert.put(propertyName, valueArray);
                    } else if (!presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) {
                        propInsert.put(propertyName, valueArray);
                    }
                }
            } else {
                // do not check if not a single value
                propInsert.put(propertyName, valueArray);
            }
        }
        logger.debug("update attribute {} properties {} in DB ", attributeName, properties.keySet());
        DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert);
        xlogger.exit();
    }
1223105
public void set_attribute_info(final DeviceProxy deviceProxy, final AttributeInfoEx[] attr)
	    throws DevFailed {
	checkIfTango(deviceProxy, "set_attribute_config");

	build_connection(deviceProxy);

        if (deviceProxy.access == TangoConst.ACCESS_READ) {
            throwNotAuthorizedException(deviceProxy.devname +
                    ".set_attribute_info()", "DeviceProxy.set_attribute_info()");
        }
        try {
            if (deviceProxy.device_5 != null) {
                final AttributeConfig_5[] config = new AttributeConfig_5[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_5();
                }
                deviceProxy.device_5.set_attribute_config_5(config,
                        DevLockManager.getInstance().getClntIdent());
            }
            else if (deviceProxy.device_4 != null) {
                final AttributeConfig_3[] config = new AttributeConfig_3[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_3();
                }
                deviceProxy.device_4.set_attribute_config_4(config,
                        DevLockManager.getInstance().getClntIdent());
            }
            else if (deviceProxy.device_3 != null) {
                final AttributeConfig_3[] config = new AttributeConfig_3[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj_3();
                }
                deviceProxy.device_3.set_attribute_config_3(config);
            }
            else {
                final AttributeConfig[] config = new AttributeConfig[attr.length];
                for (int i = 0; i < attr.length; i++) {
                    config[i] = attr[i].get_attribute_config_obj();
                }
                deviceProxy.device.set_attribute_config(config);
            }
        } catch (final DevFailed e) {
            throw e;
        } catch (final Exception e) {
            ApiUtilDAODefaultImpl.removePendingRepliesOfDevice(deviceProxy);
            throw_dev_failed(deviceProxy, e, "set_attribute_info", true);
        }
    }
657473
@Override
    public Map<String, String[]> getDeviceProperties(final String name, final String... propertyNames) throws DevFailed {
        Map<String, String[]> map;
        if (propertyNames.length == 0) {
            map = getProperties(PropertyType.Device, name);
        } else {
            map = getProperty(PropertyType.Device, name, propertyNames);
        }
        return map;
    }
874828
@Override
    public Map<String, String[]> getAttributeProperties(final String deviceName, final String attributeName)
            throws DevFailed {
        return cache.getAttributeProperties(deviceName, attributeName);

    }
1349062
public void removeAttribute(final String attributeName, final boolean clearAttributeProperties) throws DevFailed {
        removeAttribute(attributeName);
        if (clearAttributeProperties) {
            new AttributePropertiesManager(deviceImpl.getName()).removeAttributeProperties(attributeName);
        }
    }