Convert the value according the type of DeviceData.

@param deviceDataArgout
the DeviceData attribute to read
@return DevState, the result in Short format
@throws DevFailed
198362
public static DevState extractToDevState(final DeviceData deviceDataArgout) throws DevFailed {
	final Object value = CommandHelper.extract(deviceDataArgout);
	DevState argout = null;
	if (value instanceof Short) {
	    try {
		argout = DevState.from_int(((Short) value).intValue());
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof String) {
	    argout = StateUtilities.getStateForName((String) value);
	} else if (value instanceof Integer) {
	    try {
		argout = DevState.from_int(((Integer) value).intValue());
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof Long) {
	    try {
		argout = DevState.from_int(((Long) value).intValue());
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof Float) {
	    try {
		argout = DevState.from_int(((Float) value).intValue());
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof Boolean) {
	    try {
		if (((Boolean) value).booleanValue()) {
		    argout = DevState.from_int(1);
		} else {
		    argout = DevState.from_int(0);
		}
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof Double) {
	    try {
		argout = DevState.from_int(((Double) value).intValue());
	    } catch (final Exception e) {
		argout = DevState.UNKNOWN;
	    }
	} else if (value instanceof DevState) {
	    argout = (DevState) value;
	} else {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
		    + " not supported",
		    "CommandHelper.extractToDevState(Object value,deviceDataArgin)");
	}

	return argout;
    }
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;
	}
    }
529454
public DbAttribute get_device_attribute_property(String devname, String attname) throws DevFailed {
		return databaseDAO.get_device_attribute_property(this, devname, attname);
	}
93600
public void setAttributeValue(final IDeviceAttributeDAO devatt)
	    throws DevFailed {

	attrval.name = devatt.getName();
	attrval.quality = devatt.getQuality();
	attrval.time = devatt.getTimeVal();
	attrval.r_dim = devatt.getReadAttributeDim();
	attrval.w_dim = devatt.getWriteAttributeDim();
	attrval.r_dim.dim_x = devatt.getReadAttributeDim().dim_x;
	attrval.r_dim.dim_y = devatt.getReadAttributeDim().dim_y;

	if (devatt.getWriteAttributeDim() != null) {
	    attrval.w_dim.dim_x = devatt.getWriteAttributeDim().dim_x;
	    attrval.w_dim.dim_y = devatt.getWriteAttributeDim().dim_y;
	} else {
	    attrval.w_dim = devatt.getReadAttributeDim();// write as read
	}

	attrval.err_list = null;
	// Get the value from Union object
	attrval.value = ApiUtil.get_orb().create_any();
	// GA
	// devatt.setValueAsAny(this);
	((DeviceAttributeDAODefaultImpl) devatt).setValueAsAny(this);
    }
329846
public static void insertFromInteger(final Integer integerValue,
	    final DeviceAttribute deviceAttributeWritten) throws DevFailed {

	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.insertFromInteger(Integer 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.insertFromInteger(Integer 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:
	    try {
		deviceAttributeWritten.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",
			"AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    }
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceAttributeWritten.getType() + " not supported",
		    "AttributeHelper.insertFromInteger(Integer value,deviceAttributeWritten)");
	    break;
	}
    }
208482
void setValueAsAny(final DeviceAttribute_3DAODefaultImpl att_3) 
	 throws DevFailed {
		switch (getType()) {
			case TangoConst.Tango_DEV_BOOLEAN:
	    		att_3.insert(extractBooleanArray());
	    		break;
			case TangoConst.Tango_DEV_SHORT:
	    		att_3.insert(extractShortArray());
	    		break;
			case TangoConst.Tango_DEV_LONG:
	    		att_3.insert(extractLongArray());
	    		break;
			case TangoConst.Tango_DEV_LONG64:
	    		att_3.insert(extractLong64Array());
	    		break;
			case TangoConst.Tango_DEV_FLOAT:
	    		att_3.insert(extractFloatArray());
	    		break;
			case TangoConst.Tango_DEV_DOUBLE:
	    		att_3.insert(extractDoubleArray());
	    		break;
			case TangoConst.Tango_DEV_UCHAR:
	    		att_3.insert_uc(extractUCharArray());
	    		break;
			case TangoConst.Tango_DEV_USHORT:
	    		att_3.insert_us(extractUShortArray());
	    		break;
			case TangoConst.Tango_DEV_ULONG:
	    		att_3.insert_ul(extractULongArray());
	    		break;
			case TangoConst.Tango_DEV_ULONG64:
	    		att_3.insert_u64(extractULong64Array());
	    		break;
			case TangoConst.Tango_DEV_STRING:
	    		att_3.insert(extractStringArray());
	    		break;
			case TangoConst.Tango_DEV_STATE:
	    		att_3.insert(extractDevStateArray());
	    		break;
		}
   	}
483508
public int read_attribute_asynch(final DeviceProxy deviceProxy, final String attname)
            throws DevFailed {
        final String[] attnames = new String[1];
        attnames[0] = attname;
        return read_attribute_asynch(deviceProxy, attnames);
    }
1291478
public DeviceData command_inout(final Connection connection, final String command)
	    	throws DevFailed {
		final DeviceData argin = new DeviceData();
		return command_inout(connection, command, argin);
    }
712182
public static void insertFromString(final String stringValue, final DeviceData deviceDataArgin,
	    final int dataType) throws DevFailed {

	Double doubleValue = Double.NaN;
	try {
	    doubleValue = Double.valueOf(stringValue);
	} catch (final NumberFormatException e) {
	    doubleValue = Double.NaN;
	}

	if (doubleValue.isNaN() && dataType != TangoConst.Tango_DEV_STRING) {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "Cannot insert " + stringValue
		    + " as a numerical value.",
		    "CommandHelper.insertFromString(String value,deviceDataArgin)");
	}

	switch (dataType) {
	case TangoConst.Tango_DEV_SHORT:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.shortValue());
	    }
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert_us(doubleValue.shortValue());
	    }
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR",
		    "input type Tango_DEV_CHAR not supported",
		    "CommandHelper.insertFromString(String value,deviceDataArgin)");
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.shortValue());
	    }
	    break;
	case TangoConst.Tango_DEV_LONG:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.intValue());
	    }
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    deviceDataArgin.insert_ul(doubleValue.longValue());
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    deviceDataArgin.insert(doubleValue.intValue());
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert_u64(doubleValue.longValue());
	    }
	    break;
	case TangoConst.Tango_DEV_INT:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.intValue());
	    }
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.floatValue());
	    }
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    if (!doubleValue.isNaN()) {
		deviceDataArgin.insert(doubleValue.doubleValue());
	    }
	    break;
	case TangoConst.Tango_DEV_STRING:
	    deviceDataArgin.insert(stringValue);
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    if (!doubleValue.isNaN()) {
		if (doubleValue.doubleValue() == 1) {
		    deviceDataArgin.insert(true);
		} else {
		    deviceDataArgin.insert(false);
		}
	    }
	    break;
	case TangoConst.Tango_DEV_STATE:
	    if (!doubleValue.isNaN()) {
		final DevState tmpDevState = StateUtilities.getStateForName(stringValue);
		deviceDataArgin.insert(tmpDevState);
	    }
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "input type "
		    + deviceDataArgin.getType() + " not supported",
		    "CommandHelper.insertFromString(String value,deviceDataArgin)");
	    break;
	}
    }
172089
public DbAttribute get_device_attribute_property(Database database, String deviceName, String attname)
            throws DevFailed {
        String[] attnames = new String[1];
        attnames[0] = attname;
        return get_device_attribute_property(database, deviceName, attnames)[0];
    }
1297153
public static Object extractRead(final DeviceAttribute da, final AttrDataFormat format) throws DevFailed {
	if (da == null) {
		throw DevFailedUtils.newDevFailed(ERROR_MSG_DA);
	}
	return InsertExtractFactory.getAttributeExtractor(da.getType()).extractRead(da, format);
    }
880143
public DevState state(final DeviceProxy deviceProxy, final boolean src) throws DevFailed {

        build_connection(deviceProxy);

        if (deviceProxy.url.protocol == TANGO) {
            DevState state = DevState.UNKNOWN;
            final int retries = deviceProxy.transparent_reconnection ? 2 : 1;
            boolean done = false;
            for (int i = 0; i < retries && !done; i++) {
                try {
                    //noinspection PointlessBooleanExpression
                    if (src == ApiDefs.FROM_ATTR) {
                        state = deviceProxy.device.state();
                    } else {
                    final DeviceData argout = deviceProxy.command_inout("State");
                    state = argout.extractDevState();
                    }
                    done = true;
                } catch (final Exception e) {
                    manageExceptionReconnection(deviceProxy,
                            retries, i, e, this.getClass() + ".state");
                }
            }
            return state;
        } else {
            final DeviceData argout = command_inout(deviceProxy, "DevState");
            final short state = argout.extractShort();
            return T2Ttypes.tangoState(state);
        }
    }
758809
public Object[] readExtract() throws DevFailed {
        final DeviceAttribute[] da = read();
        final Object[] results = extract(da);
        return results;
    }
142269
public static Object[] extractArray(final DeviceData deviceDataArgout) throws DevFailed {
	Object[] argout = null;
	switch (deviceDataArgout.getType()) {
	case TangoConst.Tango_DEV_SHORT:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_USHORT:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_CHAR:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_UCHAR:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_LONG:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_ULONG:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_LONG64:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_ULONG64:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_INT:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_FLOAT:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_DOUBLE:
	    argout = new Object[] { Double.valueOf(deviceDataArgout.extractDouble()) };
	    break;
	case TangoConst.Tango_DEV_STRING:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_BOOLEAN:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEV_STATE:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;

	// Array input type
	case TangoConst.Tango_DEVVAR_SHORTARRAY:
	    final short[] shortValues = deviceDataArgout.extractShortArray();
	    argout = new Object[shortValues.length];
	    for (int i = 0; i < shortValues.length; i++) {
		argout[i] = Short.valueOf(shortValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_USHORTARRAY:
	    final int[] ushortValues = deviceDataArgout.extractUShortArray();
	    argout = new Object[ushortValues.length];
	    for (int i = 0; i < ushortValues.length; i++) {
		argout[i] = Integer.valueOf(ushortValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_CHARARRAY:
	    final byte[] charValues = deviceDataArgout.extractByteArray();
	    argout = new Object[charValues.length];
	    for (int i = 0; i < charValues.length; i++) {
		argout[i] = Byte.valueOf(charValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_LONGARRAY:
	    final int[] longValues = deviceDataArgout.extractLongArray();
	    argout = new Object[longValues.length];
	    for (int i = 0; i < longValues.length; i++) {
		argout[i] = Integer.valueOf(longValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_ULONGARRAY:
	    final long[] ulongValues = deviceDataArgout.extractULongArray();
	    argout = new Object[ulongValues.length];
	    for (int i = 0; i < ulongValues.length; i++) {
		argout[i] = Long.valueOf(ulongValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_LONG64ARRAY:
	    final long[] long64Values = deviceDataArgout.extractLong64Array();
	    argout = new Object[long64Values.length];
	    for (int i = 0; i < long64Values.length; i++) {
		argout[i] = Long.valueOf(long64Values[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_ULONG64ARRAY:
	    final long[] ulong64Values = deviceDataArgout.extractULong64Array();
	    argout = new Object[ulong64Values.length];
	    for (int i = 0; i < ulong64Values.length; i++) {
		argout[i] = Long.valueOf(ulong64Values[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_FLOATARRAY:
	    final float[] floatValues = deviceDataArgout.extractFloatArray();
	    argout = new Object[floatValues.length];
	    for (int i = 0; i < floatValues.length; i++) {
		argout[i] = Float.valueOf(floatValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLEARRAY:
	    final double[] doubleValues = deviceDataArgout.extractDoubleArray();
	    argout = new Object[doubleValues.length];
	    for (int i = 0; i < doubleValues.length; i++) {
		argout[i] = Double.valueOf(doubleValues[i]);
	    }
	    break;
	case TangoConst.Tango_DEVVAR_STRINGARRAY:
	    final String[] stringValues = deviceDataArgout.extractStringArray();
	    argout = new Object[stringValues.length];
	    for (int i = 0; i < stringValues.length; i++) {
		argout[i] = stringValues[i];
	    }
	    break;

	case TangoConst.Tango_DEVVAR_LONGSTRINGARRAY:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	case TangoConst.Tango_DEVVAR_DOUBLESTRINGARRAY:
	    argout = new Object[] { CommandHelper.extract(deviceDataArgout) };
	    break;
	default:
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type "
		    + deviceDataArgout.getType() + " not supported",
		    "CommandHelper.insertFromShort(Short value,deviceDataArgin)");
	    break;
	}

	return argout;
    }
205107
public DevState extractDevState() throws DevFailed {
		manageExceptions("extractDevState");
		if (use_union) {
	    	// Check if saclar (State attribute itself !)
	    	if (attributeValue_5.value.discriminator().value() == AttributeDataType._DEVICE_STATE) {
			    return attributeValue_5.value.dev_state_att();
	    	} else {
			    return attributeValue_5.value.state_att_value()[0];
	    	}
		} else {
	    	return deviceAttribute_3.extractDevState();
		}
    }
1149977
public static Boolean extractToBoolean(final DeviceAttribute deviceAttributeRead)
	    throws DevFailed {
	final Object value = AttributeHelper.extract(deviceAttributeRead);
	int boolValue = 0;
	Boolean argout = Boolean.FALSE;
	;

	if (value instanceof Short) {
	    boolValue = ((Short) value).intValue();
	} else if (value instanceof String) {
	    try {
		if (Boolean.getBoolean((String) value)) {
		    boolValue = 1;
		}
	    } catch (final Exception e) {
		Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
			+ " is not a boolean",
			"AttributeHelper.extractToBoolean(deviceAttributeWritten)");
	    }
	} else if (value instanceof Integer) {
	    boolValue = ((Integer) value).intValue();
	} else if (value instanceof Long) {
	    boolValue = ((Long) value).intValue();
	} else if (value instanceof Float) {
	    boolValue = ((Float) value).intValue();
	} else if (value instanceof Boolean) {
	    if (((Boolean) value).booleanValue()) {
		boolValue = 1;
	    }
	} else if (value instanceof Double) {
	    boolValue = ((Double) value).intValue();
	} else if (value instanceof DevState) {
	    boolValue = ((DevState) value).value();
	} else {
	    Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
		    + " not supported",
		    "AttributeHelper.extractToBoolean(Object value,deviceAttributeWritten)");
	}

	if (boolValue == 1) {
	    argout = Boolean.TRUE;
	}

	return argout;
    }
9747
public String updateStatus(final DeviceState state) throws DevFailed {
        xlogger.entry();
        if (getStatusMethod != null) {
            try {
                status = (String) getStatusMethod.invoke(businessObject);
            } catch (final IllegalArgumentException e) {
                throw DevFailedUtils.newDevFailed(e);
            } catch (final IllegalAccessException e) {
                throw DevFailedUtils.newDevFailed(e);
            } catch (final InvocationTargetException e) {
                if (e.getCause() instanceof DevFailed) {
                    throw (DevFailed) e.getCause();
                } else {
                    throw DevFailedUtils.newDevFailed("INVOCATION_ERROR", ExceptionUtils.getStackTrace(e.getCause())
                            + " InvocationTargetException");
                }
            }
        } else {
            if (status.isEmpty()) {
                status = "The device is in " + state + " state.";
            }
        }
        StringBuilder statusAlarm = new StringBuilder();
        for (final String string : attributeAlarm.values()) {
            statusAlarm = statusAlarm.append(string);
        }

        return status + statusAlarm;
    }