use of org.apache.cayenne.util.DeepMergeOperation in project cayenne by apache.
the class ClientChannel method onQuery.
@SuppressWarnings("unchecked")
public QueryResponse onQuery(ObjectContext context, Query query) {
QueryResponse response = send(new QueryMessage(query), QueryResponse.class);
if (context != null) {
EntityResolver resolver = context.getEntityResolver();
QueryMetadata info = query.getMetaData(resolver);
if (!info.isFetchingDataRows()) {
response.reset();
while (response.next()) {
if (response.isList()) {
List objects = response.currentList();
if (!objects.isEmpty()) {
DeepMergeOperation merger = new DeepMergeOperation(context);
List<Object> rsMapping = info.getResultSetMapping();
if (rsMapping == null) {
convertSingleObjects(objects, merger);
} else {
if (rsMapping.size() == 1) {
if (rsMapping.get(0) instanceof EntityResultSegment) {
convertSingleObjects(objects, merger);
}
} else {
processMixedResult(objects, merger, rsMapping);
}
}
}
}
}
}
}
return response;
}
Aggregations