Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
package gov.va.med.ewv.util;
import java.util.List;
import java.util.Set;
import gov.va.med.domain.ewv.EwvAmbulanceInfo5010;
import gov.va.med.domain.ewv.EwvClaimOhis;
import gov.va.med.domain.ewv.EwvClaims;
import gov.va.med.domain.ewv.EwvServiceLineOhiAdjtmts;
import gov.va.med.domain.ewv.EwvServiceLineOhis;
import gov.va.med.domain.ewv.EwvServiceLines;
import gov.va.med.domain.ewv.EwvServiceLinesDrugs;
import gov.va.med.domain.ewv.EwvSlProvider;
import gov.va.med.domain.ewv.EwvSvcLineDme;
import gov.va.med.domain.ewv.EwvSvcLineTeeth;
import static gov.va.med.ewv.util.SetToSortedList.*; // where overloaded EwvNullsLastComparator::compare are from
// Compare to EwvNullsLastSortedList using generic function:
// public static <T, R> List<R> sortedList(T obj, Function<T, Set<R>> getSet, Comparator<R> compare)
//
// Here we have explicit "boilerplate" code such as
// Set<EwvServiceLines> set = obj != null ? obj.getEwvServiceLineses() : null;
// to do the set extraction.
//
public class EwvSetToNullsLastList {
// Extract partially sorted lists (sorted good enough for highlighting)
// Returns an empty list in case of null obj or set
// Each function performs a unique extraction from its base type
// Since there are more than one, they cannot be overloaded on the parameter obj.
// From EwvClaims
public static List<EwvServiceLines> getEwvServiceLinesList(EwvClaims obj) {
Set<EwvServiceLines> set = obj != null ? obj.getEwvServiceLineses() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvClaimOhis> getEwvClaimOhisList(EwvClaims obj) {
Set<EwvClaimOhis> set = obj != null ? obj.getEwvClaimOhises() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
// From EwvServiceLines
public static List<EwvSvcLineDme> getEwvSvcLineDmeList(EwvServiceLines obj) {
Set<EwvSvcLineDme> set = obj != null ? obj.getEwvSvcLineDmes() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvSlProvider> getEwvSlProviderList(EwvServiceLines obj) {
Set<EwvSlProvider> set = obj != null ? obj.getEwvSlProviders() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvServiceLineOhis> getEwvServiceLineOhisList(EwvServiceLines obj) {
Set<EwvServiceLineOhis> set = obj != null ? obj.getEwvServiceLineOhises() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvSvcLineTeeth> getEwvSvcLineTeethList(EwvServiceLines obj) {
Set<EwvSvcLineTeeth> set = obj != null ? obj.getEwvSvcLineTeeths() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvAmbulanceInfo5010> getEwvAmbulanceInfo5010List(EwvServiceLines obj) {
Set<EwvAmbulanceInfo5010> set = obj != null ? obj.getEwvAmbulanceInfo5010s() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
public static List<EwvServiceLinesDrugs> getEwvServiceLinesDrugsList(EwvServiceLines obj) {
Set<EwvServiceLinesDrugs> set = obj != null ? obj.getEwvServiceLinesDrugses() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
// From EwvServiceLineOhis
public static List<EwvServiceLineOhiAdjtmts> getEwvServiceLineOhiAdjtmtsList(EwvServiceLineOhis obj) {
Set<EwvServiceLineOhiAdjtmts> set = obj != null ? obj.getEwvServiceLineOhiAdjtmtses() : null;
return toSortedList(set, EwvNullsLastComparator::compare);
}
}