OLINGO-911: small correction to show the count based requests with functions/actions

This commit is contained in:
Ramesh Reddy 2016-03-25 17:33:45 -05:00
parent 0d37336eba
commit 300316db8d
2 changed files with 18 additions and 2 deletions

View File

@ -57,6 +57,7 @@ import org.apache.olingo.server.core.requests.DataRequest;
import org.apache.olingo.server.core.requests.FunctionRequest;
import org.apache.olingo.server.core.requests.MediaRequest;
import org.apache.olingo.server.core.requests.MetadataRequest;
import org.apache.olingo.server.core.requests.OperationRequest;
import org.apache.olingo.server.core.requests.ServiceDocumentRequest;
import org.apache.olingo.server.core.uri.parser.Parser;
import org.apache.olingo.server.core.uri.validator.UriValidator;
@ -178,8 +179,13 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
@Override
public void visit(UriResourceCount option) {
DataRequest dataRequest = (DataRequest) this.request;
dataRequest.setCountRequest(option != null);
if (this.request instanceof DataRequest) {
DataRequest dataRequest = (DataRequest) this.request;
dataRequest.setCountRequest(option != null);
} else if (this.request instanceof OperationRequest) {
OperationRequest opRequest = (OperationRequest) this.request;
opRequest.setCountRequest(option != null);
}
}
@Override

View File

@ -33,6 +33,8 @@ import org.apache.olingo.server.core.ServiceRequest;
public abstract class OperationRequest extends ServiceRequest {
private boolean countRequest;
public OperationRequest(OData odata, ServiceMetadata serviceMetadata) {
super(odata, serviceMetadata);
}
@ -114,4 +116,12 @@ public abstract class OperationRequest extends ServiceRequest {
public boolean isReturnTypeComplex() {
return getReturnType().getType().getKind() == EdmTypeKind.COMPLEX;
}
public boolean isCountRequest() {
return countRequest;
}
public void setCountRequest(boolean countRequest) {
this.countRequest = countRequest;
}
}