use of org.summerb.easycrud.api.relations.EasyCrudM2mService in project summerb by skarpushin.
the class DataSetLoaderImpl method loadManyToManyReferences.
private ManyToManyRefToReferenceesMap loadManyToManyReferences(Map<Ref, Set<Object>> manyToManyReferences) {
// NOTE: Queries to same types of referencees are not grouped. Should we
// impl this like we did for one2many?
ManyToManyRefToReferenceesMap ret = new ManyToManyRefToReferenceesMap();
for (Entry<Ref, Set<Object>> refToReferencersEntry : manyToManyReferences.entrySet()) {
EasyCrudService m2mServiceTmp = easyCrudServiceResolver.resolveByEntityType(refToReferencersEntry.getKey().getM2mEntity());
Preconditions.checkState(m2mServiceTmp instanceof EasyCrudM2mService);
EasyCrudM2mService m2mService = (EasyCrudM2mService) m2mServiceTmp;
Map<Object, List<HasId>> referenceeMap = m2mService.findReferenceeByReferencers(refToReferencersEntry.getValue());
ret.put(refToReferencersEntry.getKey(), referenceeMap);
}
return ret;
}
Aggregations