fixing property string mapper issue

4.x.x
Hasunie 8 years ago
parent 1b5bae3e46
commit 529bde822c

@ -69,7 +69,7 @@ public class DeviceTypePluginDAO {
device = new Device(); device = new Device();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(deviceId + " data has been fetched from " + deviceDAODefinition.getDeviceTableName() + log.debug(deviceId + " data has been fetched from " + deviceDAODefinition.getDeviceTableName() +
" database."); " database.");
} }
List<Device.Property> properties = new ArrayList<>(); List<Device.Property> properties = new ArrayList<>();
for (String columnName : deviceDAODefinition.getColumnNames()) { for (String columnName : deviceDAODefinition.getColumnNames()) {
@ -112,7 +112,7 @@ public class DeviceTypePluginDAO {
status = true; status = true;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("device " + device.getDeviceIdentifier() + " data has been" + log.debug("device " + device.getDeviceIdentifier() + " data has been" +
" added to the " + deviceDAODefinition.getDeviceTableName() + " database."); " added to the " + deviceDAODefinition.getDeviceTableName() + " database.");
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -170,7 +170,7 @@ public class DeviceTypePluginDAO {
status = true; status = true;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("device " + deviceId + " data has deleted from the " + log.debug("device " + deviceId + " data has deleted from the " +
deviceDAODefinition.getDeviceTableName() + " table."); deviceDAODefinition.getDeviceTableName() + " table.");
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -241,7 +241,7 @@ public class DeviceTypePluginDAO {
private String getPropertString(List<Device.Property> properties, String propertyName) { private String getPropertString(List<Device.Property> properties, String propertyName) {
for (Device.Property property : properties) { for (Device.Property property : properties) {
if (property.getName().equals(propertyName)) { if (property.getName() != null && property.getName().equals(propertyName)) {
return property.getValue(); return property.getValue();
} }
} }
@ -257,7 +257,7 @@ public class DeviceTypePluginDAO {
+ getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")"; + getPreparedInputString(deviceDAODefinition.getColumnNames().size() + 1) + ")";
updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET " updateDBQueryForUpdateDevice = "UPDATE " + deviceDAODefinition.getDeviceTableName() + " SET "
+ getDeviceTableColumnNamesForUpdateQuery()+ " WHERE " + deviceDAODefinition.getPrimaryKey() + getDeviceTableColumnNamesForUpdateQuery() + " WHERE " + deviceDAODefinition.getPrimaryKey()
+ " = ?"; + " = ?";
deleteDBQueryToRemoveDevicd = "DELETE FROM " + deviceDAODefinition.getDeviceTableName() deleteDBQueryToRemoveDevicd = "DELETE FROM " + deviceDAODefinition.getDeviceTableName()

Loading…
Cancel
Save