Refactor PlatformResources Controller#283
Conversation
|
References getAll method may require new OpenDCS DAI method to support filtering by transport media type |
| ApiPlatformRef ref = new ApiPlatformRef(); | ||
| Platform plat = platform.next(); | ||
| ref.setName(plat.getDisplayName()); |
There was a problem hiding this comment.
Can this call the single object map() method?
There was a problem hiding this comment.
Since the ApiPlatformRef has a different structure to ApiPlatform, the map can't be reused.
| public Response getPlatformRefs(@QueryParam("tmtype") String tmtype) | ||
| throws DbException | ||
| { | ||
| HashMap<String, ApiPlatformRef> ret = new HashMap<>(); |
There was a problem hiding this comment.
HashMap vs Map ? Is this driven by DTO? I'm always suspicious of HashMap. IMO the extra cost of LinkedHashMap is always worth it to maintain insertion order, even if its just to make debugging consistent.
There was a problem hiding this comment.
I've swapped HashMap for Map and the implementation for LinkedHashMap. I've also replaced ArraList with List where possible/appropriate.
| assertEquals(status.getLastRoutingSpecName(), apiStat.getRoutingSpecName()); | ||
| } | ||
|
|
||
| private static int iterSize(Iterator<?> it) |
There was a problem hiding this comment.
interesting.
+1 b/c its clear what this is doing but -1 b/c its weird to have to do this.
There was a problem hiding this comment.
Yeah, if the implementation gave us more than just the iterator this wouldn't be needed.
There was a problem hiding this comment.
These will be migrated to a more standard DAO style, but platforms is not first on the list (Enum is in the works, routingspecs/schedule entries are probably next) so for now you're stuck with doing this.
…rayList for List where possible
|
|
Closing due to newer PR with same changes: #312 |



Problem Description
Fixes #228.
Solution
Replaces DAO usage with OpenDCS DAI implementations.
how you tested the change
Unit tests of data mapping included.
Where the following done:
(Formerly called regression tests.)
If you aren't sure leave unchecked and we will help guide you to want needs changing where.