Merge branch 'OLINGO-687'

This commit is contained in:
Ramesh Reddy 2015-06-08 14:18:50 -05:00
commit 36e09cf190
4 changed files with 107 additions and 2 deletions

View File

@ -20,6 +20,16 @@ package org.apache.olingo.server.api.uri;
import java.util.List;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
import org.apache.olingo.server.api.uri.queryoption.FilterOption;
import org.apache.olingo.server.api.uri.queryoption.FormatOption;
import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
import org.apache.olingo.server.api.uri.queryoption.SelectOption;
import org.apache.olingo.server.api.uri.queryoption.SkipOption;
import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
import org.apache.olingo.server.api.uri.queryoption.TopOption;
/**
* Used for URI info kind {@link UriInfoKind#crossjoin} to describe URIs like
* http://.../serviceroot/$crossjoin(...)
@ -30,5 +40,49 @@ public interface UriInfoCrossjoin {
* @return List of entity set names
*/
List<String> getEntitySetNames();
/**
* @return Object containing information of the $expand option
*/
ExpandOption getExpandOption();
/**
* @return Object containing information of the $filter option
*/
FilterOption getFilterOption();
/**
* @return Object containing information of the $format option
*/
FormatOption getFormatOption();
/**
* @return Object containing information of the $count option
*/
CountOption getCountOption();
/**
* @return Object containing information of the $orderby option
*/
OrderByOption getOrderByOption();
/**
* @return Object containing information of the $select option
*/
SelectOption getSelectOption();
/**
* @return Object containing information of the $skip option
*/
SkipOption getSkipOption();
/**
* @return Object containing information of the $skiptoken option
*/
SkipTokenOption getSkipTokenOption();
/**
* @return Object containing information of the $top option
*/
TopOption getTopOption();
}

View File

@ -110,6 +110,41 @@ public class RequestURLHierarchyVisitor implements RequestURLVisitor {
@Override
public void visit(UriInfoCrossjoin info) {
if (info.getFilterOption() != null) {
visit(info.getFilterOption());
}
if (info.getCountOption() != null) {
visit(info.getCountOption());
}
if(info.getOrderByOption() != null) {
visit(info.getOrderByOption());
}
if (info.getSkipOption() != null) {
visit(info.getSkipOption());
}
if (info.getTopOption() != null) {
visit(info.getTopOption());
}
if (info.getExpandOption() != null) {
visit(info.getExpandOption());
}
if(info.getSelectOption() != null) {
visit(info.getSelectOption());
}
if (info.getFormatOption() != null) {
visit(info.getFormatOption());
}
if (info.getSkipTokenOption() != null) {
visit(info.getSkipTokenOption());
}
}
@Override

View File

@ -728,7 +728,8 @@ public class TripPinServiceTest {
@Test
public void testCrossJoin() throws Exception {
String editUrl = baseURL + "/$crossjoin(People,Airlines)";
String editUrl = baseURL + "/$crossjoin(People,Airlines)?$filter="+
Encoder.encode("People/UserName eq Airlines/AirlineCode");
HttpResponse response = httpGET(editUrl, 200);
EntityUtils.consumeQuietly(response.getEntity());
}

View File

@ -1063,7 +1063,22 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.crossjoin);
for (OdataIdentifierContext obj : ctx.vlODI) {
crossJoin.addEntitySetName(obj.getText());
String odi = obj.getText();
crossJoin.addEntitySetName(odi);
EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
if (edmEntitySet == null) {
throw wrap(new UriParserSemanticException("Expected EntityTypeName",
UriParserSemanticException.MessageKeys.UNKNOWN_PART, odi));
}
EdmEntityType type = edmEntitySet.getEntityType();
if (type == null) {
throw wrap(new UriParserSemanticException("Expected EntityTypeName",
UriParserSemanticException.MessageKeys.UNKNOWN_ENTITY_TYPE, odi));
}
// contextUriInfo = uriInfo;
context.contextTypes.push(new TypeInformation(type, true));
}
context.contextUriInfo = crossJoin;