* <code>null</code> if the filtering yields no needed aux data.
*/
public static AuxDataRequest filterRequest(AuxDataRequest adr) {
if(adr == null) return null;
final AuxDataCache adc = AuxDataCache.get();
final AuxDataRequest sadr = new AuxDataRequest();
// ref data
final Iterator<RefDataType> rdi = adr.getRefDataRequests();
if(rdi != null) {
while(rdi.hasNext()) {
final RefDataType rdt = rdi.next();
if(!adc.isCached(AuxDataType.REFDATA, rdt)) {
sadr.requestAppRefData(rdt);
}
}
}
// entities
Iterator<IEntityType> ets = adr.getEntityRequests();
if(ets != null) {
while(ets.hasNext()) {
final IEntityType et = ets.next();
if(!adc.isCached(AuxDataType.ENTITY, et)) {
sadr.requestEntityList(et);
}
}
}
// entity prototypes
ets = adr.getEntityPrototypeRequests();
if(ets != null) {
while(ets.hasNext()) {
final IEntityType et = ets.next();
if(!adc.isCached(AuxDataType.ENTITY_PROTOTYPE, et)) {
sadr.requestEntityPrototype(et);
}
}
}
return sadr.size() > 0 ? sadr : null;
}