fixed commit issues

revert-70aa11f8
ayyoob 8 years ago
parent 536d100fd6
commit d70cea2e46

@ -82,7 +82,7 @@ public class DeviceTypeManagementAdminServiceImpl implements DeviceTypeManagemen
DeviceMgtAPIUtils.getDeviceManagementService().registerDeviceType(httpDeviceTypeManagerService);
return Response.status(Response.Status.OK).build();
} else {
return Response.status(Response.Status.BAD_REQUEST).entity("device type name does not match the pattern "
return Response.status(Response.Status.BAD_REQUEST).entity("Device type name does not match the pattern "
+ DEVICETYPE_REGEX_PATTERN).build();
}
} catch (DeviceManagementException e) {

@ -538,7 +538,7 @@ public class DeviceMgtAPIUtils {
Header httpHeader = new Header();
httpHeader.setName(AUTHORIZATION_HEADER);
httpHeader.setValue(authValue);
list.add(httpHeader);//"https"
list.add(httpHeader);
eventReciverOptions.setProperty(HTTPConstants.HTTP_HEADERS, list);
eventReciverOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER
@ -570,7 +570,7 @@ public class DeviceMgtAPIUtils {
Header httpHeader = new Header();
httpHeader.setName(AUTHORIZATION_HEADER);
httpHeader.setValue(authValue);
list.add(httpHeader);//"https"
list.add(httpHeader);
eventReciverOptions.setProperty(HTTPConstants.HTTP_HEADERS, list);
eventReciverOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER
@ -602,7 +602,7 @@ public class DeviceMgtAPIUtils {
Header httpHeader = new Header();
httpHeader.setName(AUTHORIZATION_HEADER);
httpHeader.setValue(authValue);
list.add(httpHeader);//"https"
list.add(httpHeader);
eventReciverOptions.setProperty(HTTPConstants.HTTP_HEADERS, list);
eventReciverOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER

@ -87,7 +87,7 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple
if (feature.getMetadataEntries() != null && feature.getMetadataEntries().size() > 0) {
List<String> metaValues = new ArrayList<>();
for (Feature.MetadataEntry metadataEntry : feature.getMetadataEntries()) {
metadataEntry.getValue();
metaValues.add(metadataEntry.getValue().toString());
}
configFeature.setMetaData(metaValues);
}

@ -135,36 +135,19 @@ public class PropertyBasedPluginDAOImpl implements PluginDAO {
"UPDATE DM_DEVICE_PROPERTIES SET PROPERTY_VALUE = ? WHERE DEVICE_TYPE_NAME = ? AND " +
"DEVICE_IDENTIFICATION = ? AND PROPERTY_NAME = ? AND TENANT_ID= ?");
Device.Property[] properties = new Device.Property[device.getProperties().size()];
int i =0;
for (Device.Property property : device.getProperties()) {
properties[i] = property;
i++;
stmt.setString(1, getPropertyValue(device.getProperties(), property.getValue()));
if (!deviceProps.contains(property.getName())) {
continue;
}
stmt.setString(1, property.getValue());
stmt.setString(1, deviceType);
stmt.setString(2, device.getDeviceIdentifier());
stmt.setString(3, property.getName());
stmt.setInt(4, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true));
stmt.addBatch();
}
int[] updates = stmt.executeBatch();
if (updates.length > 0) {
for (int j = 0; j < updates.length; j++) {
if (updates[j] < 0) {
stmt = conn.prepareStatement(
"INSERT INTO DM_DEVICE_PROPERTIES(DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, " +
"PROPERTY_VALUE, TENANT_ID) VALUES (?, ?, ?, ?, ?)");
stmt.setString(1, deviceType);
stmt.setString(2, device.getDeviceIdentifier());
stmt.setString(3, properties[j].getName());
stmt.setString(4, getPropertyValue(device.getProperties(), properties[j].getValue()));
stmt.setInt(5, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true));
stmt.addBatch();
}
}
stmt.executeBatch();
status = true;
}
return true;
} catch (SQLException e) {
String msg = "Error occurred while modifying the device '" +
device.getDeviceIdentifier() + "' data on" + deviceType;
@ -173,7 +156,6 @@ public class PropertyBasedPluginDAOImpl implements PluginDAO {
} finally {
DeviceTypeUtils.cleanupResources(stmt, null);
}
return status;
}
public boolean deleteDevice(String deviceId) throws DeviceTypeMgtPluginException {

@ -100,6 +100,7 @@ IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[D
CREATE TABLE DM_CONFIG_OPERATION (
OPERATION_ID INTEGER NOT NULL,
OPERATION_CONFIG VARBINARY(MAX) DEFAULT NULL,
ENABLED BIT NOT NULL DEFAULT 0,
PRIMARY KEY (OPERATION_ID),
CONSTRAINT FK_DM_OPERATION_CONFIG FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION

@ -86,6 +86,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
OPERATION_ID INTEGER NOT NULL,
OPERATION_CONFIG BLOB DEFAULT NULL,
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (OPERATION_ID),
CONSTRAINT FK_DM_OPERATION_CONFIG FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION

@ -165,6 +165,7 @@ WHEN (NEW.ID IS NULL)
CREATE TABLE DM_CONFIG_OPERATION (
OPERATION_ID NUMBER(10) NOT NULL,
OPERATION_CONFIG BLOB DEFAULT NULL,
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
CONSTRAINT PK_DM_CONFIG_OPERATION PRIMARY KEY (OPERATION_ID),
CONSTRAINT FK_DM_OPERATION_CONFIG FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID)

@ -72,6 +72,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
OPERATION_ID INTEGER NOT NULL,
OPERATION_CONFIG BYTEA DEFAULT NULL,
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (OPERATION_ID),
CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION

Loading…
Cancel
Save