Ayyoob Hamza 8 years ago committed by GitHub
commit 91e0e3978c

@ -436,6 +436,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
} }
deviceList.setList(devices); deviceList.setList(devices);
deviceList.setCount(devices.size());
return Response.status(Response.Status.OK).entity(deviceList).build(); return Response.status(Response.Status.OK).entity(deviceList).build();
} }

@ -165,7 +165,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
stmt.setInt(paramIdx, tenantId); stmt.setInt(paramIdx, tenantId);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
device = DeviceManagementDAOUtil.loadMatchingDevice(rs, true); device = DeviceManagementDAOUtil.loadMatchingDevice(rs, false);
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while listing device for type " + throw new DeviceManagementDAOException("Error occurred while listing device for type " +

@ -145,10 +145,10 @@ public class QueryBuilderImpl implements QueryBuilder {
ValueType type = new ValueType(); ValueType type = new ValueType();
if (Utils.checkColumnType(con.getKey())) { if (Utils.checkColumnType(con.getKey())) {
type.setColumnType(ValueType.columnType.STRING); type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(Utils.getConvertedValue(con.getKey(), con.getValue())); type.setStringValue(con.getValue());
} else { } else {
type.setColumnType(ValueType.columnType.INTEGER); type.setColumnType(ValueType.columnType.INTEGER);
type.setIntValue(Integer.parseInt(Utils.getConvertedValue(con.getKey(), con.getValue()))); type.setIntValue(Integer.parseInt(con.getValue()));
} }
valueType[x] = type; valueType[x] = type;
x++; x++;
@ -193,10 +193,10 @@ public class QueryBuilderImpl implements QueryBuilder {
ValueType type = new ValueType(); ValueType type = new ValueType();
if (Utils.checkColumnType(con.getKey())) { if (Utils.checkColumnType(con.getKey())) {
type.setColumnType(ValueType.columnType.STRING); type.setColumnType(ValueType.columnType.STRING);
type.setStringValue(Utils.getConvertedValue(con.getKey(), con.getValue())); type.setStringValue(con.getValue());
} else { } else {
type.setColumnType(ValueType.columnType.INTEGER); type.setColumnType(ValueType.columnType.INTEGER);
type.setIntValue(Integer.parseInt(Utils.getConvertedValue(con.getKey(), con.getValue()))); type.setIntValue(Integer.parseInt(con.getValue()));
} }
valueType[x] = type; valueType[x] = type;
x++; x++;

@ -103,14 +103,6 @@ public class Utils {
return bool; return bool;
} }
public static String getConvertedValue(String column, String value) {
if (checkColumnType(column)) {
return "\'" + value + "\'";
} else return value;
}
public static Map<String, String> getDeviceDetailsColumnNames() { public static Map<String, String> getDeviceDetailsColumnNames() {
return genericColumnsMap; return genericColumnsMap;
} }

Loading…
Cancel
Save