// entity collection
Iterator<IEntityType> etitr = auxDataRequest.getEntityRequests();
if(etitr != null) {
while(etitr.hasNext()) {
final IEntityType et = etitr.next();
final Class<? extends IEntity> entityClass =
(Class<? extends IEntity>) context.getEntityTypeResolver().resolveEntityClass(et);
final IEntityService<? extends IEntity> svc =
context.getEntityServiceFactory().instanceByEntityType(entityClass);
final List<? extends IEntity> list = svc.loadAll();
if(list == null || list.size() < 1) {
payload.getStatus().addMsg("Unable to obtain " + et.descriptor() + " entities for aux data.",
MsgLevel.ERROR, MsgAttr.STATUS.flag);
}
else {
final MarshalOptions mo = getMarshalOptions(context, et, MarshalOptions.NO_REFERENCES);
final List<Model> elist = new ArrayList<Model>(list.size());
for(final IEntity e : list) {
final Model group = context.getMarshaler().marshalEntity(e, mo);
elist.add(group);
}
if(entityMap == null) {
entityMap = new HashMap<IEntityType, List<Model>>();
}
entityMap.put(et, elist);
}
}
}
// entity prototypes
etitr = auxDataRequest.getEntityPrototypeRequests();
while(etitr != null && etitr.hasNext()) {
final IEntityType et = etitr.next();
final IEntity e =
context.getEntityAssembler().assembleEntity(
(Class<IEntity>) context.getEntityTypeResolver().resolveEntityClass(et), null, false);
final MarshalOptions mo = getMarshalOptions(context, et, MarshalOptions.NO_REFERENCES);
final Model model = context.getMarshaler().marshalEntity(e, mo);