Updated Hue description response emulation. Updated the management of

devices in the map. Updated logging information to be less in normal
mode.
This commit is contained in:
Admin
2015-08-26 11:26:49 -05:00
parent fa15cf3952
commit 41f68f58b0
6 changed files with 19 additions and 19 deletions

View File

@@ -43,7 +43,7 @@ public class DeviceRepository {
DeviceDescriptor theDevice = null;
while (theIterator.hasNext()) {
theDevice = theIterator.next();
put(Integer.parseInt(theDevice.getId()), theDevice);
put(theDevice.getId(), theDevice);
}
}
}
@@ -62,17 +62,16 @@ public class DeviceRepository {
return devices.get(id);
}
private void put(int id, DeviceDescriptor aDescriptor) {
devices.put(String.valueOf(id), aDescriptor);
private void put(String id, DeviceDescriptor aDescriptor) {
devices.put(id, aDescriptor);
}
public void save(DeviceDescriptor aDescriptor) {
int id = random.nextInt(Integer.MAX_VALUE);
if(aDescriptor.getId() != null)
devices.remove(aDescriptor.getId());
else
aDescriptor.setId(String.valueOf(id));
put(id, aDescriptor);
aDescriptor.setId(String.valueOf(random.nextInt(Integer.MAX_VALUE)));
put(aDescriptor.getId(), aDescriptor);
JsonTransformer aRenderer = new JsonTransformer();
String jsonValue = aRenderer.render(findAll());
repositoryWriter(jsonValue, repositoryPath);