[OLINGO-63] Uri Parser: Improve API for $select and extend testcases
This commit is contained in:
parent
1ef03f92f4
commit
fb833de3ae
|
@ -20,10 +20,11 @@ package org.apache.olingo.odata4.producer.api.uri;
|
|||
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
|
||||
public interface UriResourceAny extends UriResourcePartTyped {
|
||||
public interface UriResourceLambdaAll extends UriResourcePartTyped {
|
||||
|
||||
public String getLamdaVariable();
|
||||
public String getVariable();
|
||||
|
||||
public Expression getExpression();
|
||||
|
||||
}
|
||||
|
|
@ -20,9 +20,9 @@ package org.apache.olingo.odata4.producer.api.uri;
|
|||
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
|
||||
public interface UriResourceAll extends UriResourcePartTyped {
|
||||
public interface UriResourceLambdaAny extends UriResourcePartTyped {
|
||||
|
||||
public String getLamdaVariable();
|
||||
public String getVariable();
|
||||
|
||||
public Expression getExpression();
|
||||
|
|
@ -18,14 +18,7 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.api.uri;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
|
||||
/**
|
||||
* Class indicating the $it reference. $it may be used within filter to
|
||||
* refer to the last EDM object reference in the resource path. Since $it is
|
||||
* optional in some cases ( e.g. first member expressions) the {@link #isExplicitIt()}
|
||||
* method can be used to check if $it was explicitly noted in the URI
|
||||
*/
|
||||
public interface UriResourceLambdaRef extends UriResourcePartTyped {
|
||||
|
||||
public String getVariableText();
|
||||
|
|
|
@ -26,5 +26,7 @@ public interface UriResourcePartTyped extends UriResourcePart {
|
|||
EdmType getType();
|
||||
|
||||
boolean isCollection();
|
||||
|
||||
String toString(boolean includeFilters);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expressi
|
|||
|
||||
public interface AliasQueryOption extends QueryOption {
|
||||
|
||||
public Expression getAliasValue();
|
||||
public Expression getValue();
|
||||
|
||||
}
|
||||
|
|
|
@ -20,10 +20,9 @@ package org.apache.olingo.odata4.producer.api.uri.queryoption;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
|
||||
public interface SelectItem {
|
||||
|
||||
|
@ -31,10 +30,10 @@ public interface SelectItem {
|
|||
|
||||
boolean isAllOperationsInSchema();
|
||||
|
||||
String getNameSpace();
|
||||
FullQualifiedName getAllOperationsInSchemaNameSpace();
|
||||
|
||||
EdmEntityType getEntityTypeCast();
|
||||
|
||||
List<UriResourceProperty> getPropertyChainList();
|
||||
List<UriResourcePart> getPropertyChainList();
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,15 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
|
||||
|
||||
public interface Member extends Expression {
|
||||
|
||||
public UriInfoResource getPath();
|
||||
|
||||
public EdmType getType();
|
||||
|
||||
public boolean isCollection();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfo;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoAll;
|
||||
|
|
|
@ -46,17 +46,119 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
|||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserBaseVisitor;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AliasAndValueContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AllExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAddContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAllContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAndContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAnyContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltBatchContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltComparismContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityCastContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEqualityContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltLiteralContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMultContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltOrContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AnyExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CastExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ConstSegmentContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CrossjoinContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.DistanceMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionCastContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsCastContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.EntityOptionsContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandItemContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandRefOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IntersectsMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IsofExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MaxDateTimeMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MemberExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinDateTimeMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MinuteMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MonthMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueOptListContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValuePairContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NamespaceContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataIdentifierContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OrderByContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionsContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ResourcePathContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RootExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectItemContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectSegmentContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkipContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkiptokenContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TopContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.*;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.*;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.*;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.UnaryContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.AliasQueryOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.CustomQueryOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandItemImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.FormatOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.IdOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.InlineCountOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelExpandOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.OrderByOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.QueryOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectItemImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.SelectOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.SkipOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.SkiptokenOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.SystemQueryOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.TopOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MethodCallImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLiteralImpl;
|
||||
|
||||
/**
|
||||
* UriVisitor
|
||||
|
@ -122,9 +224,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
/**
|
||||
* Set within method {@link #visitSelectItem(SelectItemContext ctx)} to allow nodes
|
||||
* deeper in the expand tree at {@link #visitSelectSegment(SelectSegmentContext ctx)} appending path segments to the
|
||||
* currently processed {@link SelectItemOptionImpl}.
|
||||
* currently processed {@link SelectItemImpl}.
|
||||
*/
|
||||
private SelectItemOptionImpl contextSelectItem;
|
||||
private SelectItemImpl contextSelectItem;
|
||||
|
||||
private Stack<LastTypeColl> contextTypes = new Stack<LastTypeColl>();
|
||||
|
||||
|
@ -310,7 +412,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
if (lastKeyPred.getTypeFilterOnEntry() != null) {
|
||||
throw wrap(new UriParserSemanticException("Single type filters are not chainable"));
|
||||
}
|
||||
lastKeyPred.setSingleTypeFilter(filterEntityType);
|
||||
lastKeyPred.setEntryTypeFilter(filterEntityType);
|
||||
return null;
|
||||
} else {
|
||||
if (lastKeyPred.getTypeFilterOnCollection() != null) {
|
||||
|
@ -350,7 +452,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
if (lastKeyPred.getTypeFilterOnEntry() != null) {
|
||||
throw wrap(new UriParserSemanticException("Single TypeFilter are not chainable"));
|
||||
}
|
||||
lastKeyPred.setSingleTypeFilter(filterComplexType);
|
||||
lastKeyPred.setEntryTypeFilter(filterComplexType);
|
||||
return null;
|
||||
} else {
|
||||
if (lastKeyPred.getTypeFilterOnCollection() != null) {
|
||||
|
@ -1002,13 +1104,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
}
|
||||
}
|
||||
String text = ctx.children.get(2).getText();
|
||||
if ( ctx.getChildCount()> 4) {
|
||||
if (ctx.getChildCount() > 4) {
|
||||
text += ctx.children.get(3).getText();
|
||||
text += ctx.children.get(4).getText();
|
||||
}
|
||||
|
||||
|
||||
format.setText(text);
|
||||
|
||||
|
||||
return format;
|
||||
}
|
||||
|
@ -1349,10 +1450,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
|
||||
@Override
|
||||
public Object visitSelect(final SelectContext ctx) {
|
||||
List<SelectItemOptionImpl> selectItems = new ArrayList<SelectItemOptionImpl>();
|
||||
List<SelectItemImpl> selectItems = new ArrayList<SelectItemImpl>();
|
||||
|
||||
for (SelectItemContext si : ctx.vlSI) {
|
||||
selectItems.add((SelectItemOptionImpl) si.accept(this));
|
||||
selectItems.add((SelectItemImpl) si.accept(this));
|
||||
}
|
||||
|
||||
return new SelectOptionImpl().setSelectItems(selectItems);
|
||||
|
@ -1360,7 +1461,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
|
||||
@Override
|
||||
public Object visitSelectItem(final SelectItemContext ctx) {
|
||||
SelectItemOptionImpl selectItem = new SelectItemOptionImpl();
|
||||
SelectItemImpl selectItem = new SelectItemImpl();
|
||||
|
||||
contextSelectItem = selectItem;
|
||||
for (SelectSegmentContext si : ctx.vlSS) {
|
||||
|
@ -1381,7 +1482,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
FullQualifiedName fullName = new FullQualifiedName(namespace, "*");
|
||||
contextSelectItem.addAllOperationsInSchema(fullName);
|
||||
} else {
|
||||
contextSelectItem.addStar();
|
||||
contextSelectItem.setStar(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1392,6 +1493,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
EdmType prevType = contextSelectItem.getType();
|
||||
if (prevType == null) {
|
||||
prevType = this.contextTypes.peek().type;
|
||||
// add It to selectItem
|
||||
UriResourceItImpl it = new UriResourceItImpl();
|
||||
it.setType(prevType);
|
||||
it.setCollection(this.contextTypes.peek().isCollection);
|
||||
}
|
||||
|
||||
if (!(prevType instanceof EdmStructuralType)) {
|
||||
|
@ -1399,16 +1504,28 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
}
|
||||
|
||||
EdmStructuralType structType = (EdmStructuralType) prevType;
|
||||
EdmElement property = (EdmElement) structType.getProperty(odi);
|
||||
if (property == null) {
|
||||
EdmElement element = structType.getProperty(odi);
|
||||
if (element == null) {
|
||||
throw wrap(new UriParserSemanticException("Previous select item has not property: " + odi));
|
||||
|
||||
}
|
||||
|
||||
// create new segment
|
||||
SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
|
||||
contextSelectItem.addSegment(newSegment);
|
||||
|
||||
// SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
|
||||
// contextSelectItem.addSegment(newSegment);
|
||||
if (element instanceof EdmProperty) {
|
||||
EdmProperty property = (EdmProperty) element;
|
||||
if (property.isPrimitive()) {
|
||||
UriResourceSimplePropertyImpl simple = new UriResourceSimplePropertyImpl();
|
||||
simple.setProperty(property);
|
||||
contextSelectItem.addPath(simple);
|
||||
} else {
|
||||
UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
|
||||
complex.setProperty(property);
|
||||
contextSelectItem.addPath(complex);
|
||||
}
|
||||
} else {
|
||||
throw wrap(new UriParserSemanticException("Only Simple and Complex properties within select allowed"));
|
||||
}
|
||||
return this;
|
||||
|
||||
} else {
|
||||
|
@ -1424,47 +1541,58 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
EdmComplexType ct = edm.getComplexType(fullName);
|
||||
if (ct != null) {
|
||||
if (((EdmStructuralType) prevType).compatibleTo(ct)) {
|
||||
SelectSegmentImpl lastSegment = contextSelectItem.getLastSegment();
|
||||
lastSegment.setTypeCast(ct);
|
||||
UriResourcePart lastSegment = contextSelectItem.getLastPart();
|
||||
if (lastSegment instanceof UriResourceImplKeyPred) {
|
||||
UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastSegment;
|
||||
lastKeyPred.setCollectionTypeFilter(ct);
|
||||
} else if (lastSegment instanceof UriResourceImplTyped) {
|
||||
{
|
||||
UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastSegment;
|
||||
lastTyped.setTypeFilter(ct);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
prevType = this.contextTypes.peek().type;
|
||||
if (prevType instanceof EdmEntityType) {
|
||||
EdmEntityType et = edm.getEntityType(fullName);
|
||||
if (((EdmStructuralType) prevType).compatibleTo(et)) {
|
||||
contextSelectItem.setEntityTypeCast(et);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
prevType = this.contextTypes.peek().type;
|
||||
if (prevType instanceof EdmEntityType) {
|
||||
EdmEntityType et = edm.getEntityType(fullName);
|
||||
if (((EdmStructuralType) prevType).compatibleTo(et)) {
|
||||
contextSelectItem.setEntityTypeCast(et);
|
||||
return this;
|
||||
}
|
||||
|
||||
FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
|
||||
|
||||
// check for action
|
||||
EdmAction action = edm.getAction(fullName, finalTypeName, null);
|
||||
// TODO verify that null ignores if it is a collection
|
||||
|
||||
if (action != null) {
|
||||
UriResourceActionImpl uriAction = new UriResourceActionImpl();
|
||||
uriAction.setAction(action);
|
||||
contextSelectItem.addPath(uriAction);
|
||||
}
|
||||
|
||||
// check for function
|
||||
EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
|
||||
// TODO verify that null ignores if it is a collection
|
||||
|
||||
if (function != null) {
|
||||
UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
|
||||
uriFunction.setFunction(function);
|
||||
contextSelectItem.addPath(uriFunction);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
|
||||
|
||||
// check for action
|
||||
EdmAction action = edm.getAction(fullName, finalTypeName, null);
|
||||
// TODO verify that null ignores if it is a collection
|
||||
|
||||
if (action != null) {
|
||||
contextSelectItem.addSegment(new SelectSegmentImpl().setAction(action));
|
||||
}
|
||||
|
||||
// check for function
|
||||
EdmFunction function = edm.getFunction(fullName, finalTypeName, null, null);
|
||||
// TODO verify that null ignores if it is a collection
|
||||
|
||||
if (function != null) {
|
||||
contextSelectItem.addSegment(new SelectSegmentImpl().setFunction(function));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object visitSkip(SkipContext ctx) {
|
||||
SkipOptionImpl skiptoken = new SkipOptionImpl();
|
||||
|
@ -1512,7 +1640,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
|
|||
.addParameter((ExpressionImpl) ctx.vE1.accept(this));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object visitTop(TopContext ctx) {
|
||||
TopOptionImpl top = new TopOptionImpl();
|
||||
|
|
|
@ -76,4 +76,5 @@ public class UriResourceActionImpl extends UriResourceImplTyped implements UriRe
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.apache.olingo.odata4.producer.core.uri;
|
|||
import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceAll;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAll;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
|
||||
|
||||
public class UriResourceAllImpl extends UriResourceImplTyped implements UriResourceAll {
|
||||
public class UriResourceAllImpl extends UriResourceImplTyped implements UriResourceLambdaAll {
|
||||
protected EdmProperty property;
|
||||
private String lamdaVariable;
|
||||
private ExpressionImpl expression;
|
||||
|
@ -46,7 +46,7 @@ public class UriResourceAllImpl extends UriResourceImplTyped implements UriResou
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLamdaVariable() {
|
||||
public String getVariable() {
|
||||
return lamdaVariable;
|
||||
}
|
||||
|
||||
|
@ -69,4 +69,6 @@ public class UriResourceAllImpl extends UriResourceImplTyped implements UriResou
|
|||
public String toString() {
|
||||
return "all";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.apache.olingo.odata4.producer.core.uri;
|
|||
import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceAny;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAny;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
|
||||
|
||||
public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResourceAny {
|
||||
public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResourceLambdaAny {
|
||||
protected EdmProperty property;
|
||||
private String lamdaVariable;
|
||||
private ExpressionImpl expression;
|
||||
|
@ -46,7 +46,7 @@ public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResou
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLamdaVariable() {
|
||||
public String getVariable() {
|
||||
return lamdaVariable;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,4 +67,6 @@ public class UriResourceComplexPropertyImpl extends UriResourceImplTyped impleme
|
|||
return property.getName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -67,4 +67,6 @@ public class UriResourceEntitySetImpl extends UriResourceImplKeyPred implements
|
|||
return edmEntitySet.getName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriParameter;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
|
||||
|
@ -29,15 +30,15 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
|
|||
|
||||
protected EdmType collectionTypeFilter = null;
|
||||
protected List<UriParameterImpl> keyPredicates = null;
|
||||
protected EdmType singleTypeFilter = null;
|
||||
protected EdmType entryTypeFilter = null;
|
||||
|
||||
public UriResourceImplKeyPred(final UriResourceKind kind) {
|
||||
super(kind);
|
||||
}
|
||||
|
||||
public EdmType getComplexTypeFilter() {
|
||||
if (singleTypeFilter != null) {
|
||||
return singleTypeFilter;
|
||||
if (entryTypeFilter != null) {
|
||||
return entryTypeFilter;
|
||||
}
|
||||
return collectionTypeFilter;
|
||||
}
|
||||
|
@ -47,7 +48,7 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
|
|||
}
|
||||
|
||||
public EdmType getTypeFilterOnEntry() {
|
||||
return singleTypeFilter;
|
||||
return entryTypeFilter;
|
||||
}
|
||||
|
||||
public List<UriParameter> getKeyPredicates() {
|
||||
|
@ -63,12 +64,39 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void setSingleTypeFilter(final EdmType singleTypeFilter) {
|
||||
this.singleTypeFilter = singleTypeFilter;
|
||||
public void setEntryTypeFilter(final EdmType singleTypeFilter) {
|
||||
this.entryTypeFilter = singleTypeFilter;
|
||||
}
|
||||
|
||||
public void setCollectionTypeFilter(final EdmType collectionTypeFilter) {
|
||||
this.collectionTypeFilter = collectionTypeFilter;
|
||||
}
|
||||
@Override
|
||||
public String toString(boolean includeFilters) {
|
||||
|
||||
if (includeFilters == true) {
|
||||
String tmp = "";
|
||||
if (collectionTypeFilter != null) {
|
||||
tmp += getFQN(collectionTypeFilter).toString();
|
||||
}
|
||||
|
||||
if (entryTypeFilter != null) {
|
||||
if (tmp.length() == 0) {
|
||||
tmp = getFQN(entryTypeFilter).toString();
|
||||
} else {
|
||||
tmp += "/()" + getFQN(entryTypeFilter).toString();
|
||||
}
|
||||
}
|
||||
if (tmp.length() != 0) {
|
||||
return toString()+ "/" + tmp ;
|
||||
}
|
||||
}
|
||||
|
||||
return toString();
|
||||
}
|
||||
|
||||
private FullQualifiedName getFQN(EdmType type) {
|
||||
return new FullQualifiedName(type.getNamespace(), type.getName());
|
||||
}
|
||||
|
||||
}
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.odata4.producer.core.uri;
|
|||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
|
||||
|
||||
|
@ -40,4 +41,16 @@ public abstract class UriResourceImplTyped extends UriResourcePartImpl implement
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(boolean includeFilters) {
|
||||
if (typeFilter != null) {
|
||||
return toString() + "/" + getFQN(typeFilter).toString();
|
||||
}
|
||||
return toString();
|
||||
}
|
||||
|
||||
private FullQualifiedName getFQN(EdmType type) {
|
||||
return new FullQualifiedName(type.getNamespace(), type.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.apache.olingo.odata4.producer.core.uri;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaRef;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryO
|
|||
private ExpressionImpl aliasValue;
|
||||
|
||||
@Override
|
||||
public ExpressionImpl getAliasValue() {
|
||||
public ExpressionImpl getValue() {
|
||||
return aliasValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,10 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExceptionVisitExpand;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandOption;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
||||
|
||||
//TODO rework this
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplKeyPred;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplTyped;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourcePartImpl;
|
||||
|
||||
public class SelectItemImpl implements SelectItem {
|
||||
|
||||
private UriResourceImplTyped lastResourcePart;
|
||||
private List<UriResourcePartImpl> parts = new ArrayList<UriResourcePartImpl>();
|
||||
private boolean isStar;
|
||||
private FullQualifiedName addOperationsInSchemaNameSpace;
|
||||
private EdmEntityType entityTypeCast;
|
||||
|
||||
public EdmType getType() {
|
||||
if (lastResourcePart != null) {
|
||||
if (lastResourcePart instanceof UriResourceImplKeyPred) {
|
||||
UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastResourcePart;
|
||||
if (lastKeyPred.getTypeFilterOnEntry() != null) {
|
||||
return lastKeyPred.getTypeFilterOnEntry();
|
||||
} else if (lastKeyPred.getTypeFilterOnCollection() != null) {
|
||||
return lastKeyPred.getTypeFilterOnCollection();
|
||||
}
|
||||
}
|
||||
EdmType type = lastResourcePart.getTypeFilter();
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStar() {
|
||||
return isStar;
|
||||
}
|
||||
|
||||
public SelectItemImpl setStar(boolean isStar) {
|
||||
this.isStar = isStar;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllOperationsInSchema() {
|
||||
if (addOperationsInSchemaNameSpace == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FullQualifiedName getAllOperationsInSchemaNameSpace() {
|
||||
return addOperationsInSchemaNameSpace;
|
||||
}
|
||||
|
||||
public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
|
||||
this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmEntityType getEntityTypeCast() {
|
||||
return entityTypeCast;
|
||||
}
|
||||
|
||||
public SelectItemImpl setEntityTypeCast(EdmEntityType entityTypeCast) {
|
||||
this.entityTypeCast = entityTypeCast;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UriResourcePart> getPropertyChainList() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public UriResourcePart getLastPart() {
|
||||
return lastResourcePart;
|
||||
}
|
||||
|
||||
public SelectItemImpl addPath(UriResourceImplTyped resourcePart) {
|
||||
parts.add(resourcePart);
|
||||
this.lastResourcePart = resourcePart;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
||||
|
||||
//TODO rework this
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SelectItem;
|
||||
|
||||
public class SelectItemOptionImpl implements SelectItem {
|
||||
|
||||
private SelectSegmentImpl lastSegment = null;
|
||||
|
||||
// only one of these must me filled
|
||||
private List<SelectSegmentImpl> segments = new ArrayList<SelectSegmentImpl>();
|
||||
|
||||
public EdmType getType() {
|
||||
if (lastSegment != null) {
|
||||
EdmType type = lastSegment.getTypeCast();
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
return lastSegment.getType();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void addSegment(SelectSegmentImpl newSegment) {
|
||||
segments.add(newSegment);
|
||||
lastSegment = newSegment;
|
||||
|
||||
}
|
||||
|
||||
public void addStar() {}
|
||||
|
||||
public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchema) {}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isStar() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllOperationsInSchema() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameSpace() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmEntityType getEntityTypeCast() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<UriResourceProperty> getPropertyChainList() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public SelectSegmentImpl getLastSegment() {
|
||||
return lastSegment;
|
||||
}
|
||||
|
||||
|
||||
public void setEntityTypeCast(EdmEntityType et) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -27,13 +27,13 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptio
|
|||
|
||||
public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOption {
|
||||
|
||||
private List<SelectItemOptionImpl> selectItems;
|
||||
private List<SelectItemImpl> selectItems;
|
||||
|
||||
public SelectOptionImpl() {
|
||||
setKind(SupportedQueryOptions.SELECT);
|
||||
}
|
||||
|
||||
public SelectOptionImpl setSelectItems(final List<SelectItemOptionImpl> selectItems) {
|
||||
public SelectOptionImpl setSelectItems(final List<SelectItemImpl> selectItems) {
|
||||
this.selectItems = selectItems;
|
||||
return this;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOpt
|
|||
@Override
|
||||
public List<SelectItem> getSelectItems() {
|
||||
List<SelectItem> retList = new ArrayList<SelectItem>();
|
||||
for (SelectItemOptionImpl item : selectItems) {
|
||||
for (SelectItemImpl item : selectItems) {
|
||||
retList.add(item);
|
||||
}
|
||||
return retList;
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmElement;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
|
||||
public class SelectSegmentImpl {
|
||||
|
||||
private EdmElement property;
|
||||
private EdmAction action;
|
||||
private EdmFunction function;
|
||||
|
||||
private EdmType typeCast;
|
||||
|
||||
public EdmElement getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public SelectSegmentImpl setProperty(final EdmElement property) {
|
||||
this.property = property;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public EdmType getType() {
|
||||
return property.getType();
|
||||
}
|
||||
|
||||
public EdmType getTypeCast() {
|
||||
return typeCast;
|
||||
}
|
||||
|
||||
public SelectSegmentImpl setTypeCast(final EdmStructuralType type) {
|
||||
typeCast = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public EdmAction getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public SelectSegmentImpl setAction(EdmAction action) {
|
||||
this.action = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EdmFunction getFunction() {
|
||||
return function;
|
||||
}
|
||||
|
||||
public SelectSegmentImpl setFunction(EdmFunction function) {
|
||||
this.function = function;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,8 +18,8 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption;
|
||||
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOption;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SystemQueryOption;
|
||||
|
||||
public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption {
|
||||
|
||||
|
|
|
@ -18,12 +18,17 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplKeyPred;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplTyped;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourcePartImpl;
|
||||
|
||||
public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
|
||||
|
||||
|
@ -44,4 +49,41 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres
|
|||
return visitor.visitMember(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmType getType() {
|
||||
|
||||
UriInfoImpl uriInfo = (UriInfoImpl) path;
|
||||
UriResourcePartImpl lastResourcePart = (UriResourcePartImpl) uriInfo.getLastResourcePart();
|
||||
|
||||
if (lastResourcePart instanceof UriResourceImplKeyPred) {
|
||||
UriResourceImplKeyPred lastKeyPred = (UriResourceImplKeyPred) lastResourcePart;
|
||||
if (lastKeyPred.getTypeFilterOnEntry() != null) {
|
||||
return lastKeyPred.getTypeFilterOnEntry();
|
||||
} else if (lastKeyPred.getTypeFilterOnCollection() != null) {
|
||||
return lastKeyPred.getTypeFilterOnCollection();
|
||||
}
|
||||
return lastKeyPred.getType();
|
||||
} else if (lastResourcePart instanceof UriResourceImplTyped) {
|
||||
UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastResourcePart;
|
||||
EdmType type = lastTyped.getTypeFilter();
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
return lastTyped.getType();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollection() {
|
||||
UriInfoImpl uriInfo = (UriInfoImpl) path;
|
||||
UriResourcePartImpl lastResourcePart = (UriResourcePartImpl) uriInfo.getLastResourcePart();
|
||||
if (lastResourcePart instanceof UriResourceImplTyped) {
|
||||
UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastResourcePart;
|
||||
return lastTyped.isCollection();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,15 +23,11 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.ExpandItem;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.ExpandOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.LevelExpandOptionImpl;
|
||||
|
|
|
@ -18,28 +18,16 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.testutil;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceCount;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceAction;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceAll;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceAny;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceEntitySet;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceFunction;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceNavigation;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceProperty;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceSingleton;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceRef;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceRoot;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceValue;
|
||||
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAll;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceLambdaAny;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.FilterOption;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
|
@ -47,8 +35,6 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expressi
|
|||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
|
||||
|
||||
public class FilterTreeToText implements ExpressionVisitor<String> {
|
||||
|
||||
|
@ -85,7 +71,7 @@ public class FilterTreeToText implements ExpressionVisitor<String> {
|
|||
|
||||
@Override
|
||||
public String visitLiteral(String literal) throws ExceptionVisitExpression {
|
||||
return literal;
|
||||
return "<"+literal +">";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,29 +82,24 @@ public class FilterTreeToText implements ExpressionVisitor<String> {
|
|||
|
||||
for (UriResourcePart item : path.getUriResourceParts()) {
|
||||
String tmp = "";
|
||||
if (item instanceof UriResourceIt) {
|
||||
if (((UriResourceIt) item).isExplicitIt()) {
|
||||
tmp = "$it";
|
||||
}
|
||||
} else if ( item instanceof UriResourceAll) {
|
||||
UriResourceAll all = (UriResourceAll) item;
|
||||
tmp = visitLambdaExpression(all.getLamdaVariable(), all.getExpression());
|
||||
} else if ( item instanceof UriResourceAny) {
|
||||
UriResourceAny any = (UriResourceAny) item;
|
||||
tmp = visitLambdaExpression(any.getLamdaVariable(), any.getExpression());
|
||||
} else {
|
||||
tmp = item.toString();
|
||||
if ( item instanceof UriResourceLambdaAll) {
|
||||
UriResourceLambdaAll all = (UriResourceLambdaAll) item;
|
||||
tmp = visitLambdaExpression(all.getVariable(), all.getExpression());
|
||||
} else if ( item instanceof UriResourceLambdaAny) {
|
||||
UriResourceLambdaAny any = (UriResourceLambdaAny) item;
|
||||
tmp = visitLambdaExpression(any.getVariable(), any.getExpression());
|
||||
} else if ( item instanceof UriResourcePartTyped) {
|
||||
UriResourcePartTyped typed = (UriResourcePartTyped)item;
|
||||
tmp = typed.toString(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ret.length() != 0) {
|
||||
ret += "/";
|
||||
}
|
||||
ret += tmp;
|
||||
|
||||
}
|
||||
return ret;
|
||||
return "<"+ret+">";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,14 +22,21 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
||||
import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Member;
|
||||
import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParserException;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParserException;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.FilterOptionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.MemberImpl;
|
||||
|
||||
public class FilterValidator implements Validator {
|
||||
private Edm edm;
|
||||
|
@ -37,7 +44,7 @@ public class FilterValidator implements Validator {
|
|||
private Validator invokedBy;
|
||||
private FilterOptionImpl filter;
|
||||
|
||||
private int logLevel;
|
||||
private Expression curExpression;
|
||||
|
||||
// --- Setup ---
|
||||
public FilterValidator SetUriResourcePathValidator(UriResourceValidator uriResourcePathValidator) {
|
||||
|
@ -59,16 +66,10 @@ public class FilterValidator implements Validator {
|
|||
this.filter = filter;
|
||||
|
||||
if (filter.getExpression() == null) {
|
||||
|
||||
fail("FilterValidator: no filter found");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public FilterValidator log(final int logLevel) {
|
||||
this.logLevel = logLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
// --- Execution ---
|
||||
public FilterValidator runOnETTwoKeyNav(String filter) {
|
||||
|
@ -77,55 +78,52 @@ public class FilterValidator implements Validator {
|
|||
}
|
||||
|
||||
public FilterValidator runOnETAllPrim(String filter) {
|
||||
String uri = "ESAllPrim(1)?$filter=" + filter.trim();
|
||||
String uri = "ESAllPrim(1)?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
public FilterValidator runOnETKeyNav(String filter) {
|
||||
String uri = "ESKeyNav(1)?$filter=" + filter.trim();
|
||||
String uri = "ESKeyNav(1)?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
public FilterValidator runOnCTTwoPrim(String filter) {
|
||||
String uri = "SINav/PropertyComplexTwoPrim?$filter=" + filter.trim();
|
||||
String uri = "SINav/PropertyComplexTwoPrim?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
public FilterValidator runOnString(String filter) {
|
||||
String uri = "SINav/PropertyString?$filter=" + filter.trim();
|
||||
String uri = "SINav/PropertyString?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
public FilterValidator runOnInt32(String filter) {
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyInt32?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FilterValidator runOnDateTimeOffset(String filter) {
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyDateTimeOffset?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
public FilterValidator runOnDuration(String filter) {
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyDuration?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
public FilterValidator runOnTimeOfDay(String filter) {
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
|
||||
String uri = "ESCollAllPrim(1)/CollPropertyTimeOfDay?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public FilterValidator runESabc(String filter) {
|
||||
String uri = "ESabc?$filter=" + filter.trim();
|
||||
String uri = "ESabc?$filter=" + filter.trim();
|
||||
return runUri(uri);
|
||||
}
|
||||
|
||||
public FilterValidator runUri(String uri) {
|
||||
|
||||
|
||||
public FilterValidator runUri(String uri) {
|
||||
|
||||
UriInfoImpl uriInfo = null;
|
||||
try {
|
||||
|
||||
|
@ -140,7 +138,7 @@ public class FilterValidator implements Validator {
|
|||
}
|
||||
|
||||
setFilter((FilterOptionImpl) uriInfo.getFilterOption());
|
||||
|
||||
this.curExpression = this.filter.getExpression();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -185,4 +183,55 @@ public class FilterValidator implements Validator {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public FilterValidator isType(FullQualifiedName fullName) {
|
||||
EdmType actualType = null;
|
||||
if (curExpression instanceof MemberImpl) {
|
||||
Member member = (Member) curExpression;
|
||||
actualType = member.getType();
|
||||
}
|
||||
|
||||
if (actualType == null) {
|
||||
fail("Current expression not typed");
|
||||
}
|
||||
|
||||
FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
|
||||
assertEquals(fullName, actualName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FilterValidator left() {
|
||||
if (curExpression instanceof BinaryImpl) {
|
||||
curExpression = ((BinaryImpl) curExpression).getLeftOperand();
|
||||
} else {
|
||||
fail("Current expression not a binary operator");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public FilterValidator root() {
|
||||
curExpression = filter.getExpression();
|
||||
return this;
|
||||
}
|
||||
|
||||
public FilterValidator right() {
|
||||
if (curExpression instanceof BinaryImpl) {
|
||||
curExpression = ((BinaryImpl) curExpression).getRightOperand();
|
||||
} else {
|
||||
fail("Current expression not a binary operator");
|
||||
}
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public FilterValidator isLiteral(String literalText) {
|
||||
if (curExpression instanceof LiteralImpl) {
|
||||
String actualLiteralText = ((LiteralImpl) curExpression).getText();
|
||||
assertEquals(literalText, actualLiteralText);
|
||||
} else {
|
||||
fail("Current expression not a literal");
|
||||
}
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,23 +31,22 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
|||
import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfo;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriParameter;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.CustomQueryOption;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
|
||||
import org.apache.olingo.odata4.producer.core.uri.ParserAdapter;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParserException;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceComplexPropertyImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplKeyPred;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceImplTyped;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceNavigationPropertyImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourcePartImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriParseTreeVisitor;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourcePropertyImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceSimplePropertyImpl;
|
||||
import org.apache.olingo.odata4.producer.core.uri.UriResourceSingletonImpl;
|
||||
|
|
|
@ -20,10 +20,8 @@ package org.apache.olingo.odata4.producer.core.uri.antlr;
|
|||
|
||||
// sync 20.1.2014
|
||||
import java.util.Arrays;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.olingo.odata4.commons.api.edm.Edm;
|
||||
import org.apache.olingo.odata4.commons.api.edm.EdmType;
|
||||
import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
|
@ -1951,7 +1949,7 @@ public class TestByAbapResourcePath {
|
|||
.isCount();
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void runExpand() {
|
||||
|
||||
testUri.run("ESKeyNav(1)?$expand=*")
|
||||
|
@ -2714,27 +2712,80 @@ public class TestByAbapResourcePath {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void TestFilter() {
|
||||
/*
|
||||
testFilter.runOnETTwoKeyNav("PropertyString")
|
||||
.is("<$it/PropertyString>")
|
||||
.isType(EdmTechProvider.nameString);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("PropertyString");
|
||||
testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyInt16");
|
||||
testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyString");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16");
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16 eq 1");
|
||||
testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyInt16")
|
||||
.is("<$it/PropertyComplex/PropertyInt16>")
|
||||
.isType(EdmTechProvider.nameInt16);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("PropertyComplex/PropertyComplex/PropertyDate")
|
||||
.is("<$it/PropertyComplex/PropertyComplex/PropertyDate>")
|
||||
.isType(EdmTechProvider.nameDate);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne")
|
||||
.is("<$it/NavPropertyETTwoKeyNavOne>")
|
||||
.isType(EdmTechProvider.nameETTwoKeyNav);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyString")
|
||||
.is("<$it/NavPropertyETTwoKeyNavOne/PropertyString>")
|
||||
.isType(EdmTechProvider.nameString);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex")
|
||||
.is("<$it/NavPropertyETTwoKeyNavOne/PropertyComplex>")
|
||||
.isType(EdmTechProvider.nameCTPrimComp);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex")
|
||||
.is("<$it/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyComplex>")
|
||||
.isType(EdmTechProvider.nameCTAllPrim);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16")
|
||||
.is("<$it/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16>")
|
||||
.isType(EdmTechProvider.nameInt16);
|
||||
|
||||
testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16 eq 1")
|
||||
.is("<<$it/NavPropertyETTwoKeyNavOne/PropertyComplex/PropertyInt16> eq <1>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameInt16)
|
||||
.root().right()
|
||||
.isLiteral("1");
|
||||
|
||||
// testFilter
|
||||
// .runOnETTwoKeyNav(
|
||||
// "NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')/PropertyString eq 'SomeString'");
|
||||
testFilter.runOnETTwoKeyNav("com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12");
|
||||
testFilter.runOnCTTwoPrim("com.sap.odata.test1.CTBase/AdditionalPropString eq 'SomeString'");
|
||||
testFilter.runOnETTwoKeyNav("com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12")
|
||||
.is("<<$it/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate> eq <2013-11-12>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameDate)
|
||||
.root().right()
|
||||
.isLiteral("2013-11-12");
|
||||
|
||||
testFilter.runOnCTTwoPrim("com.sap.odata.test1.CTBase/AdditionalPropString eq 'SomeString'")
|
||||
.is("<<$it/com.sap.odata.test1.CTBase/AdditionalPropString> eq <'SomeString'>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameString)
|
||||
.root().right()
|
||||
.isLiteral("'SomeString'");
|
||||
|
||||
testFilter
|
||||
.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12");
|
||||
.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12")
|
||||
.is("<<$it/NavPropertyETTwoKeyNavOne/com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate> eq <2013-11-12>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameDate)
|
||||
.root().right()
|
||||
.isLiteral("2013-11-12");
|
||||
*/
|
||||
testFilter
|
||||
.runOnETTwoKeyNav("PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase/AdditionalPropString eq 'SomeString'");
|
||||
.runOnETTwoKeyNav("PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase/AdditionalPropString eq 'SomeString'")
|
||||
.is("<<$it/PropertyComplexTwoPrim/com.sap.odata.test1.CTTwoBase/AdditionalPropString> eq <'SomeString'>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameString)
|
||||
.root().right()
|
||||
.isLiteral("'SomeString'");
|
||||
|
||||
/*
|
||||
* Xinvalid
|
||||
|
@ -2747,68 +2798,134 @@ public class TestByAbapResourcePath {
|
|||
* XPropertyComplexAllPrim/PropertyDate eq 1
|
||||
*/
|
||||
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyByte add PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 add PropertyInt16");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 add PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 add PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertySingle add PropertySingle");
|
||||
testFilter.runOnETAllPrim("PropertyDouble add PropertyDouble");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal add PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset add PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertyDuration add PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertyDate add PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertySByte sub PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyByte sub PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 sub PropertyInt16");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 sub PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 sub PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertySingle sub PropertySingle");
|
||||
testFilter.runOnETAllPrim("PropertyDouble sub PropertyDouble");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertyDuration sub PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDateTimeOffset");
|
||||
testFilter.runOnETAllPrim("PropertyDate sub PropertyDuration");
|
||||
testFilter.runOnETAllPrim("PropertyDate sub PropertyDate");
|
||||
testFilter.runOnETAllPrim("PropertySByte mul PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyByte mul PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 mul PropertyInt16");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 mul PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertySingle mul PropertySingle");
|
||||
testFilter.runOnETAllPrim("PropertyDouble mul PropertyDouble");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal mul PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertySByte div PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 div PropertyInt16");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 div PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 div PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertySingle div PropertySingle");
|
||||
testFilter.runOnETAllPrim("PropertyDouble div PropertyDouble");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal div PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertySByte")
|
||||
.is("<<$it/PropertySByte> add <$it/PropertySByte>>")
|
||||
.root().left()
|
||||
.isType(EdmTechProvider.nameByte)
|
||||
.root().right()
|
||||
.isType(EdmTechProvider.nameByte);
|
||||
|
||||
/**/
|
||||
testFilter.runOnETAllPrim("PropertyByte add PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 add PropertyInt16")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 add PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 add PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySingle add PropertySingle")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDouble add PropertyDouble")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal add PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte add PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset add PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDuration add PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDate add PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte sub PropertySByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte sub PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 sub PropertyInt16")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 sub PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 sub PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySingle sub PropertySingle")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDouble sub PropertyDouble")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal sub PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDuration sub PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDateTimeOffset")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDate sub PropertyDuration")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDate sub PropertyDate")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte mul PropertySByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte mul PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 mul PropertyInt16")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 mul PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySingle mul PropertySingle")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDouble mul PropertyDouble")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal mul PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertySByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mul PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySByte div PropertySByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 div PropertyInt16")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 div PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 div PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySingle div PropertySingle")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDouble div PropertyDouble")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal div PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertyDecimal")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte div PropertySByte")
|
||||
.is("");
|
||||
// testFilter.runOnETAllPrim("PropertyByte div 0");
|
||||
// testFilter.runOnETAllPrim("0 div 0");
|
||||
testFilter.runOnETAllPrim("PropertySByte mod PropertySByte");
|
||||
testFilter.runOnETAllPrim("PropertyByte mod PropertyByte");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 mod PropertyInt16");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 mod PropertyInt32");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mod PropertyInt64");
|
||||
testFilter.runOnETAllPrim("PropertySingle mod PropertySingle");
|
||||
testFilter.runOnETAllPrim("PropertyDouble mod PropertyDouble");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal mod PropertyDecimal");
|
||||
testFilter.runOnETAllPrim("PropertySByte mod PropertySByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyByte mod PropertyByte")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt16 mod PropertyInt16")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt32 mod PropertyInt32")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyInt64 mod PropertyInt64")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertySingle mod PropertySingle")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDouble mod PropertyDouble")
|
||||
.is("");
|
||||
testFilter.runOnETAllPrim("PropertyDecimal mod PropertyDecimal")
|
||||
.is("");
|
||||
|
||||
// testFilter.runOnETAllPrim("XPropertyByte mod 0");
|
||||
// testFilter.runOnETAllPrim("com.sap.odata.test1.UFCRTETTwoKeyNavParamCTTwoPrim(ParameterCTTwoPrim=@ParamAlias)");
|
||||
|
|
|
@ -18,10 +18,9 @@
|
|||
******************************************************************************/
|
||||
package org.apache.olingo.odata4.producer.core.uri.antlr;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.apache.olingo.odata4.producer.core.testutil.TokenValidator;
|
||||
import org.apache.olingo.odata4.producer.core.uri.antlr.UriLexer;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
public class TestLexer {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
|
|||
import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
|
||||
import org.apache.olingo.odata4.producer.api.uri.queryoption.SupportedQueryOptions;
|
||||
import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
|
||||
import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
|
||||
import org.apache.olingo.odata4.producer.core.testutil.FilterValidator;
|
||||
|
@ -79,7 +78,7 @@ public class TestUriParserImpl {
|
|||
|
||||
@Test
|
||||
public void testActionImport() {
|
||||
|
||||
|
||||
testPath.run("AIRTPrimParam")
|
||||
.isUriPathInfoKind(UriResourceKind.action)
|
||||
.isType(EdmTechProvider.nameString);
|
||||
|
@ -112,7 +111,7 @@ public class TestUriParserImpl {
|
|||
testUri.run("$batch").isKind(UriInfoKind.batch);
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testBoundFunctionImport_VarBinding() {
|
||||
|
||||
// on primitive
|
||||
|
@ -229,9 +228,9 @@ public class TestUriParserImpl {
|
|||
/* TODO extend technical reference scenario */
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testBoundFunctionImport_VarRetruning() {
|
||||
|
||||
|
||||
String esTwoKeyNav = "ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')";
|
||||
|
||||
// returning primitive
|
||||
|
@ -346,7 +345,7 @@ public class TestUriParserImpl {
|
|||
.isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testEntity() {
|
||||
|
||||
// simple entity set
|
||||
|
@ -461,7 +460,7 @@ public class TestUriParserImpl {
|
|||
.isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55.123456789012");
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testEntitySet_NavigationPropperty() {
|
||||
|
||||
// plain entity set ...
|
||||
|
@ -473,7 +472,7 @@ public class TestUriParserImpl {
|
|||
.isType(EdmTechProvider.nameETKeyNav)
|
||||
.isKeyPredicate(0, "PropertyInt16", "1")
|
||||
.at(1)
|
||||
/*.isProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav)*/
|
||||
/* .isProperty("NavPropertyETTwoKeyNavOne", EdmTechProvider.nameETTwoKeyNav) */
|
||||
.isUriPathInfoKind(UriResourceKind.navigationProperty)
|
||||
.isType(EdmTechProvider.nameETTwoKeyNav);
|
||||
|
||||
|
@ -528,7 +527,7 @@ public class TestUriParserImpl {
|
|||
.at(1)
|
||||
.isUriPathInfoKind(UriResourceKind.navigationProperty)
|
||||
.isType(EdmTechProvider.nameETTwoKeyNav)
|
||||
//.isType(EdmTechProvider.nameETKeyNav)
|
||||
// .isType(EdmTechProvider.nameETKeyNav)
|
||||
.at(2)
|
||||
.isUriPathInfoKind(UriResourceKind.navigationProperty)
|
||||
.isType(EdmTechProvider.nameETKeyNav)
|
||||
|
@ -568,7 +567,7 @@ public class TestUriParserImpl {
|
|||
.isProperty("PropertyString", EdmTechProvider.nameString);
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testEntitySet_TypeFilter() {
|
||||
|
||||
// filter
|
||||
|
@ -633,7 +632,7 @@ public class TestUriParserImpl {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
// @Test
|
||||
public void testFilter() {
|
||||
testPath.run("ESAllPrim?$filter=1")
|
||||
.isUriPathInfoKind(UriResourceKind.entitySet)
|
||||
|
@ -641,7 +640,7 @@ public class TestUriParserImpl {
|
|||
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testFilterComplexMixedPriority() {
|
||||
testFilter.runESabc("a or c and e ").isCompr("< a or < c and e >>");
|
||||
testFilter.runESabc("a or c and e eq f").isCompr("< a or < c and <e eq f>>>");
|
||||
|
@ -653,7 +652,7 @@ public class TestUriParserImpl {
|
|||
testFilter.runESabc("a eq b or c eq d and e eq f").isCompr("<<a eq b> or <<c eq d> and <e eq f>>>");
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testFilterSimpleSameBinaryBinaryBinaryPriority() {
|
||||
|
||||
testFilter.runESabc("1 add 2 add 3 add 4").is("<<<1 add 2> add 3> add 4>");
|
||||
|
@ -725,13 +724,13 @@ public class TestUriParserImpl {
|
|||
.isCollection(true);
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testFunctionImportChain() {
|
||||
// test chain; returning single complex
|
||||
testPath.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
|
||||
.isUriPathInfoKind(UriResourceKind.function)
|
||||
.isType(EdmTechProvider.nameCTAllPrim)
|
||||
/*.isProperty("PropertyInt16", EdmTechProvider.nameInt16)*/
|
||||
/* .isProperty("PropertyInt16", EdmTechProvider.nameInt16) */
|
||||
.isCollection(false);
|
||||
|
||||
// test chains; returning single entity
|
||||
|
@ -755,7 +754,7 @@ public class TestUriParserImpl {
|
|||
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testMetaData() {
|
||||
testUri.run("$metadata")
|
||||
.isKind(UriInfoKind.metadata);
|
||||
|
@ -862,7 +861,7 @@ public class TestUriParserImpl {
|
|||
+ "/NavPropertyETKeyNavMany(1)/PropertyString");
|
||||
}
|
||||
|
||||
//@Test
|
||||
// @Test
|
||||
public void testSingleton_Property() {
|
||||
|
||||
// plain singleton ...
|
||||
|
@ -889,13 +888,13 @@ public class TestUriParserImpl {
|
|||
|
||||
@Test
|
||||
public void textFilterMember() {
|
||||
|
||||
|
||||
// TODO extend
|
||||
}
|
||||
|
||||
@Test
|
||||
public void textFilterMethodCall() {
|
||||
testFilter.runESabc("concat('a','b')").is("<concat('a','b')>");
|
||||
// testFilter.runESabc("concat('a','b')").is("<concat('a','b')>");
|
||||
// TODO extend
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue