commit for any latent changes.

This commit is contained in:
Admin
2015-08-25 10:19:02 -05:00
parent 7746938c62
commit 3ea7f2903f
4 changed files with 11 additions and 7 deletions

View File

@@ -76,6 +76,7 @@ public class DeviceRepository {
JsonTransformer aRenderer = new JsonTransformer();
String jsonValue = aRenderer.render(findAll());
repositoryWriter(jsonValue, repositoryPath);
log.debug("Save device: " + aDescriptor.getName());
}
public String delete(DeviceDescriptor aDescriptor) {

View File

@@ -56,22 +56,24 @@ public class DeviceResource {
log.debug("Create a Device - device json off URL:" + deviceEntry.getOffUrl());
deviceRepository.save(deviceEntry);
log.debug("Created a Device");
log.debug("Created a Device: " + request.body());
response.status(201);
return deviceEntry;
}, new JsonTransformer());
put (API_CONTEXT + "/:id", "application/json", (request, response) -> {
log.debug("Saved a Device");
DeviceDescriptor device = new Gson().fromJson(request.body(), DeviceDescriptor.class);
DeviceDescriptor deviceEntry = deviceRepository.findOne(request.params(":id"));
if(deviceEntry == null){
log.debug("Could not save an edited Device Id: " + request.params(":id"));
return null;
}
log.debug("Saving an edited Device: " + deviceEntry.getName());
deviceEntry.setName(device.getName());
deviceEntry.setDeviceType(device.getDeviceType());
if(device.getDeviceType() != null)
deviceEntry.setDeviceType(device.getDeviceType());
deviceEntry.setOnUrl(device.getOnUrl());
deviceEntry.setOffUrl(device.getOffUrl());

View File

@@ -129,14 +129,13 @@ public class HueMulator {
*/
String userId = request.params(":userid");
String lightId = request.params(":id");
log.info("hue state change requested: " + userId + " from " + request.ip());
log.info("hue stage change body: " + request.body() );
log.info("hue state change requested: " + userId + " from " + request.ip() + " body: " + request.body());
DeviceState state = null;
try {
state = mapper.readValue(request.body(), DeviceState.class);
} catch (IOException e) {
log.info("object mapper barfed on input", e);
log.error("Object mapper barfed on input of body.", e);
response.status(400);
return null;
}
@@ -144,6 +143,7 @@ public class HueMulator {
DeviceDescriptor device = repository.findOne(lightId);
if (device == null) {
response.status(404);
log.error("Could not find devcie: " + lightId);
return null;
}
@@ -178,6 +178,7 @@ public class HueMulator {
//make call
if(!doHttpGETRequest(url)){
response.status(503);
log.error("Error on calling url to change device state: " + url);
return null;
}

View File

@@ -41,7 +41,7 @@
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a href="http://www.bwssystems.com" target="_blank">Developed by BWS Systems</a></li>
<li><a href="http://www.amazon.com/echo" target="_blank">Amazon Echo</a></li>
<li><a href="#">HA Bridge Version 0.3.0</a></li>
<li><a href="#">HA Bridge Version 0.3.1</a></li>
</ul>
</li>
</ul>