Convert the value according the type of DeviceData.

@param shortValues
the value to insert on DeviceData
@param deviceDataArgin
the DeviceData attribute to write
@param dataType
the type of inserted data
@throws DevFailed
12908
public static void insertFromShortArray(final short[] shortValues,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {
	// by default for xdim = 1, send the sum.
	Double doubleSum = new Double(0);
	for (final short shortValue : shortValues) {
	    doubleSum = doubleSum + shortValue;
	}

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceDataArgin.insert_us(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceDataArgin.insert(doubleSum.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceDataArgin.insert_u64(doubleSum.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceDataArgin.insert(doubleSum.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceDataArgin.insert(doubleSum.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceDataArgin.insert(doubleSum.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(doubleSum.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (doubleSum.doubleValue() == 1) {
		deviceDataArgin.insert(true);
	    } else {
		deviceDataArgin.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    DevState devStateValue = DevState.UNKNOWN;
	    if (shortValues.length > 0) {
		try {
		    devStateValue = DevState.from_int(Short.valueOf(shortValues[0]).intValue());
		} catch (final org.omg.CORBA.BAD_PARAM badParam) {
		    devStateValue = DevState.UNKNOWN;
		}
	    }
	    deviceDataArgin.insert(devStateValue);
	    break;

	// Array input type
	case TangoConst.Tango_DEVVAR_SHORTARRAY:
	    deviceDataArgin.insert(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_USHORTARRAY:
	    deviceDataArgin.insert_us(shortValues);
	    break;
	case TangoConst.Tango_DEVVAR_CHARARRAY:
	    final byte[] byteValues = new byte[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		byteValues[i] = Short.valueOf(shortValues[i]).byteValue();
	    }
	    deviceDataArgin.insert(byteValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONGARRAY:
	    final int[] longValues = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		longValues[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(longValues);
	    break;
	case TangoConst.Tango_DEVVAR_ULONGARRAY:
	    final long[] ulongValues = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		ulongValues[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_ul(ulongValues);
	    break;
	case TangoConst.Tango_DEVVAR_LONG64ARRAY:
	    final int[] long64Values = new int[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		long64Values[i] = Short.valueOf(shortValues[i]).intValue();
	    }
	    deviceDataArgin.insert(long64Values);
	    break;
	case TangoConst.Tango_DEVVAR_ULONG64ARRAY:
	    final long[] uLong64Values = new long[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		uLong64Values[i] = Short.valueOf(shortValues[i]).longValue();
	    }
	    deviceDataArgin.insert_u64(uLong64Values);
	    break;
	case TangoConst.Tango_DEVVAR_FLOATARRAY:
	    final float[] floatValues = new float[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		floatValues[i] = Short.valueOf(shortValues[i]).floatValue();
	    }
	    deviceDataArgin.insert(floatValues);
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLEARRAY:
	    final double[] doubleValues = new double[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		doubleValues[i] = Short.valueOf(shortValues[i]).doubleValue();
	    }
	    deviceDataArgin.insert(doubleValues);
	    break;
	case TangoConst.Tango_DEVVAR_STRINGARRAY:
	    final String[] stringValues = new String[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		stringValues[i] = Short.valueOf(shortValues[i]).toString();
	    }
	    deviceDataArgin.insert(stringValues);
	    break;

	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromShortArray(short[] values,deviceDataArgin)");
	    break;
	}
    }
230068
public static void insertFromInteger(final Integer integerValue,
	    final DeviceData deviceDataArgin, final int dataType) throws DevFailed {

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceDataArgin.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceDataArgin.insert_us(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceDataArgin.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceDataArgin.insert_u64(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceDataArgin.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceDataArgin.insert(integerValue.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceDataArgin.insert(integerValue.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(integerValue.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (integerValue.doubleValue() == 1) {
		deviceDataArgin.insert(true);
	    } else {
		deviceDataArgin.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    try {
		deviceDataArgin.insert(DevState.from_int(integerValue.intValue()));
	    } catch (final org.omg.CORBA.BAD_PARAM badParam) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "Cannot sent"
			+ integerValue.intValue() + "for input Tango_DEV_STATE type",
			"CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    }
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromInteger(Integer value,deviceDataArgin)");
	    break;
	}
    }
75263
public static Integer extractToInteger(final DeviceAttribute deviceAttributeRead)
	    throws DevFailed {
	final Object value = AttributeHelper.extract(deviceAttributeRead);
	Integer argout = null;
	if (value instanceof Short) {
	    argout = Integer.valueOf(((Short) value).intValue());
	} else if (value instanceof String) {
	    try {
		argout = Integer.valueOf((String) value);
	    } catch (final Exception e) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
			+ " is not a numerical",
			"AttributeHelper.extractToInteger(deviceAttributeWritten)");
	    }
	} else if (value instanceof Integer) {
	    argout = (Integer) value;
	} else if (value instanceof Long) {
	    argout = Integer.valueOf(((Long) value).intValue());
	} else if (value instanceof Float) {
	    argout = Integer.valueOf(((Float) value).intValue());
	} else if (value instanceof Boolean) {
	    if (((Boolean) value).booleanValue()) {
		argout = Integer.valueOf(1);
	    } else {
		argout = Integer.valueOf(0);
	    }
	} else if (value instanceof Double) {
	    argout = Integer.valueOf(((Double) value).intValue());
	} else if (value instanceof DevState) {
	    argout = Integer.valueOf(((DevState) value).value());
	} else {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
		    + " not supported",
		    "AttributeHelper.extractToInteger(Object value,deviceAttributeWritten)");
	}

	return argout;
    }
600411
public void insert_us(final short[] argIn) {
		attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
		attributeValue_5.w_dim.dim_x = argIn.length;
		attributeValue_5.w_dim.dim_y = 0;
		if (use_union) {
	    	attributeValue_5.value.ushort_att_value(argIn);
		} else {
	    	deviceAttribute_3.insert_us(argIn);
		}
    }
488386
public void insert(final Object value) throws DevFailed {
        logger.debug(LOG_INSERTING, this);
        attributeImpl.insert(value);
    }
572855
public static String[] extractToStringArray(final DeviceData deviceDataArgout) throws DevFailed {
	final Object[] values = CommandHelper.extractArray(deviceDataArgout);
	if (values == null) {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output is empty ",
		    "CommandHelper.extractToStringArray(deviceDataArgin)");
	}
	final String[] argout = new String[values.length];

	if (values.length > 0) {
	    if (values[0] instanceof Short) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Short) values[i]).toString();
		}
	    } else if (values[0] instanceof String) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = (String) values[i];
		}

	    } else if (values[0] instanceof Integer) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Integer) values[i]).toString();
		}
	    } else if (values[0] instanceof Long) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Long) values[i]).toString();
		}
	    } else if (values[0] instanceof Float) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Float) values[i]).toString();
		}
	    } else if (values[0] instanceof Boolean) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Boolean) values[i]).toString();
		}
	    } else if (values[0] instanceof Double) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Double) values[i]).toString();
		}
	    } else if (values[0] instanceof Byte) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = ((Byte) values[i]).toString();
		}
	    } else if (values[0] instanceof DevState) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = StateUtilities.getNameForState((DevState) values[0]);
		}
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type "
			+ values[0].getClass() + " not supported",
			"CommandHelper.extractToStringArray(Object value,deviceDataArgin)");
	    }
	}
	return argout;
    }
798995
public static DevState[] extractToDevStateArray(final DeviceData deviceDataArgout)
	    throws DevFailed {
	final Object[] values = CommandHelper.extractArray(deviceDataArgout);
	if (values == null) {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output is empty ",
		    "CommandHelper.extractToFloatArray(deviceDataArgin)");
	}
	final DevState[] argout = new DevState[values.length];

	if (values.length > 0) {
	    if (values[0] instanceof Short) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Short) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof String) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = StateUtilities.getStateForName((String) values[i]);
		}
	    } else if (values[0] instanceof Integer) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Integer) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof Long) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Long) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof Float) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Float) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof Boolean) {
		for (int i = 0; i < values.length; i++) {
		    try {
			if (((Boolean) values[i]).booleanValue()) {
			    argout[i] = DevState.from_int(1);
			} else {
			    argout[i] = DevState.from_int(0);
			}
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof Double) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Double) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof Byte) {
		for (int i = 0; i < values.length; i++) {
		    try {
			argout[i] = DevState.from_int(((Byte) values[i]).intValue());
		    } catch (final Exception e) {
			argout[i] = DevState.UNKNOWN;
		    }
		}
	    } else if (values[0] instanceof DevState) {
		for (int i = 0; i < values.length; i++) {
		    argout[i] = (DevState) values[i];
		}
	    } else {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type "
			+ values[0].getClass() + " not supported",
			"CommandHelper.extractToFloatArray(Object value,deviceDataArgin)");
	    }
	}
	return argout;
    }
1122113
public void insert(final DeviceData deviceData, final DevVarLongStringArray argin) {
        DevVarLongStringArrayHelper.insert(deviceData.getAny(), argin);
    }
308971
public void pushAttributeErrorEvent(final String deviceName, final String attributeName, final DevFailed devFailed)
            throws DevFailed {
        xlogger.entry();
        for (final EventType eventType : EventType.values()) {
            final String fullName = EventUtilities.buildEventName(deviceName, attributeName, eventType);
            final EventImpl eventImpl = getEventImpl(fullName);
            if (eventImpl != null) {
                for (ZMQ.Socket eventSocket : eventEndpoints.values()) {
                    eventImpl.pushDevFailedEvent(devFailed, eventSocket);
                }
            }
        }
        xlogger.exit();
    }
579132
@Override
    public void exportDevice(final DeviceExportInfo info) throws DevFailed {
        final String[] array = info.toStringArray();
        final DeviceData argin = new DeviceData();
        argin.insert(array);
        database.command_inout("DbExportDevice", argin);
    }
823898
public AttributeValue getAttributeValueObject_2() throws DevFailed {
		// Build a DeviceAttribute_3 from this
		final DeviceAttribute_3DAODefaultImpl att = new DeviceAttribute_3DAODefaultImpl();
		att.setAttributeValue(this);
		return att.getAttributeValueObject_2();
    }
285515
public JaversBuilder registerValueGsonTypeAdapter(Class valueType, TypeAdapter nativeAdapter) {
        registerValue(valueType);
        jsonConverterBuilder().registerNativeTypeAdapter(valueType, nativeAdapter);
        return this;
    }
74201
public static void insertFromDevState(final DevState devStateValue,
	    final DeviceAttribute deviceAttributeWritten) throws DevFailed {

	final Integer integerValue = Integer.valueOf(devStateValue.value());
	switch (deviceAttributeWritten.getType()) {
	case TangoConst.Tango_DEV_SHORT:
	    deviceAttributeWritten.insert(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    deviceAttributeWritten.insert_us(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    deviceAttributeWritten.insert_uc(integerValue.shortValue());
	    break;
	case TangoConst.Tango_DEV_LONG:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceAttributeWritten.insert_ul(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_LONG64 not supported",
		    "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)");
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    deviceAttributeWritten.insert_u64(integerValue.longValue());
	    break;
	case TangoConst.Tango_DEV_INT:
	    deviceAttributeWritten.insert(integerValue.intValue());
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    deviceAttributeWritten.insert(integerValue.floatValue());
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    deviceAttributeWritten.insert(integerValue.doubleValue());
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceAttributeWritten.insert(integerValue.toString());
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (integerValue.doubleValue() == 1) {
		deviceAttributeWritten.insert(true);
	    } else {
		deviceAttributeWritten.insert(false);
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    deviceAttributeWritten.insert(devStateValue);
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceAttributeWritten.getType() + " not supported",
		    "AttributeHelper.insertFromDevState(DevState value,deviceAttributeWritten)");
	    break;
	}
    }
19811
public void insert_us(final int[] argIn) {
		attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
		final short[] values = new short[argIn.length];
		for (int i = 0; i < argIn.length; i++) {
	    	values[i] = (short) (argIn[i] & 0xFFFF);
		}
		attributeValue_5.w_dim.dim_x = argIn.length;
		attributeValue_5.w_dim.dim_y = 0;
		if (use_union) {
	    	attributeValue_5.value.ushort_att_value(values);
		} else {
	    	deviceAttribute_3.insert_us(argIn);
		}
    }
832974
@Deprecated
    public void insert_u(final DeviceData deviceData, final short argin) {
        DevUShortHelper.insert(deviceData.getAny(), argin);
    }
425594
public void insert_uc(final short[] argIn) {
		attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
		final byte[] values = new byte[argIn.length];
		for (int i = 0; i < argIn.length; i++) {
	    	values[i] = (byte) (argIn[i] & 0xFF);
		}
		attributeValue_5.w_dim.dim_x = argIn.length;
		attributeValue_5.w_dim.dim_y = 0;
		if (use_union) {
	    	attributeValue_5.value.uchar_att_value(values);
		} else {
	    	deviceAttribute_3.insert_uc(argIn);
		}
    }
586962
public void insert(final DeviceData deviceData, final DevVarDoubleStringArray argin) {
        DevVarDoubleStringArrayHelper.insert(deviceData.getAny(), argin);
    }