Created
February 27, 2018 12:07
-
-
Save ilmoeuro/6d79dc9ed635a56ff957719c806958c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Device deviceFromEntity(DeviceEntity entity) { | |
Device result = new Device(); | |
result.setId(entity.getId()); | |
result.setName(entity.getName()); | |
return result; | |
} | |
@Override | |
public Response listDevices( | |
Long userId, | |
Integer firstResult, | |
Integer maxResults) throws Exception { | |
// TODO error handling | |
List<DeviceEntity> entities = deviceDAO.listAll(firstResult, maxResults); | |
List<Device> devices = entities.stream() | |
.map(this::deviceFromEntity) | |
.collect(Collectors.toList()); | |
return Response.ok(devices).build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment