[OLINGO-964] fix proposal for cast type not taken into account while expanding a collection

Signed-off-by: Christian Amend <christian.amend@sap.com>
This commit is contained in:
Jacek Milaczewski 2016-05-30 09:46:38 +02:00 committed by Christian Amend
parent ebf4eb9280
commit 8a10f47b89
1 changed files with 4 additions and 3 deletions

View File

@ -136,13 +136,13 @@ public class ExpandParser {
UriResourcePartTyped lastPart = (UriResourcePartTyped) resource.getLastResourcePart(); UriResourcePartTyped lastPart = (UriResourcePartTyped) resource.getLastResourcePart();
boolean hasSlash = false; boolean hasSlash = false;
EdmStructuredType typeCastSuffix = null;
if (tokenizer.next(TokenKind.SLASH)) { if (tokenizer.next(TokenKind.SLASH)) {
hasSlash = true; hasSlash = true;
if (lastPart instanceof UriResourceNavigation) { if (lastPart instanceof UriResourceNavigation) {
UriResourceNavigationPropertyImpl navigationResource = (UriResourceNavigationPropertyImpl) lastPart; UriResourceNavigationPropertyImpl navigationResource = (UriResourceNavigationPropertyImpl) lastPart;
final EdmNavigationProperty navigationProperty = navigationResource.getProperty(); final EdmNavigationProperty navigationProperty = navigationResource.getProperty();
final EdmStructuredType typeCastSuffix = ParserHelper.parseTypeCast(tokenizer, edm, typeCastSuffix = ParserHelper.parseTypeCast(tokenizer, edm, navigationProperty.getType());
navigationProperty.getType());
if (typeCastSuffix != null) { if (typeCastSuffix != null) {
if (navigationProperty.isCollection()) { if (navigationProperty.isCollection()) {
navigationResource.setCollectionTypeFilter(typeCastSuffix); navigationResource.setCollectionTypeFilter(typeCastSuffix);
@ -154,7 +154,8 @@ public class ExpandParser {
} }
} }
final EdmStructuredType newReferencedType = (EdmStructuredType) lastPart.getType(); final EdmStructuredType newReferencedType = typeCastSuffix != null ? typeCastSuffix
: (EdmStructuredType) lastPart.getType();
final boolean newReferencedIsCollection = lastPart.isCollection(); final boolean newReferencedIsCollection = lastPart.isCollection();
if (hasSlash || tokenizer.next(TokenKind.SLASH)) { if (hasSlash || tokenizer.next(TokenKind.SLASH)) {
if (tokenizer.next(TokenKind.REF)) { if (tokenizer.next(TokenKind.REF)) {