use of org.apache.cayenne.util.ObjectDetachOperation in project cayenne by apache.
the class ClientServerChannelQueryAction method singleObjectConversion.
private List<?> singleObjectConversion(List<?> serverObjects) {
// must clone the list to ensure we do not mess up the server list that can be
// used elsewhere (e.g. it can be cached).
List<Object> clientObjects = new ArrayList<>(serverObjects.size());
ObjectDetachOperation op = new ObjectDetachOperation(serverResolver.getClientEntityResolver());
PrefetchTreeNode prefetchTree = serverMetadata.getPrefetchTree();
for (Object serverObject : serverObjects) {
clientObjects.add(convertSingleObject(prefetchTree, op, serverObject));
}
return clientObjects;
}
use of org.apache.cayenne.util.ObjectDetachOperation in project cayenne by apache.
the class ClientServerChannelQueryAction method processMixedResult.
private List<Object[]> processMixedResult(List<Object[]> serverObjects, List<Object> rsMapping) {
// must clone the list to ensure we do not mess up the server list that can be
// used elsewhere (e.g. it can be cached).
List<Object[]> clientObjects = new ArrayList<>(serverObjects.size());
ObjectDetachOperation op = new ObjectDetachOperation(serverResolver.getClientEntityResolver());
int width = rsMapping.size();
for (Object[] serverObject : serverObjects) {
Object[] clientObject = new Object[width];
for (int i = 0; i < width; i++) {
if (rsMapping.get(i) instanceof EntityResultSegment) {
clientObject[i] = convertSingleObject(serverMetadata.getPrefetchTree(), op, serverObject[i]);
} else {
clientObject[i] = serverObject[i];
}
}
clientObjects.add(clientObject);
}
return clientObjects;
}
Aggregations