You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/20 15:33:49 UTC
[27/59] [abbrv] Cleanup of core
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java
index ac46316..f6ae572 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriParserImpl.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri;
@@ -67,11 +67,12 @@ import org.apache.olingo.odata2.core.uri.expression.OrderByParserImpl;
/**
* Parser for the OData part of the URL.
- *
+ *
*/
public class UriParserImpl extends UriParser {
- private static final Pattern INITIAL_SEGMENT_PATTERN = Pattern.compile("(?:([^.()]+)\\.)?([^.()]+)(?:\\((.+)\\)|(\\(\\)))?");
+ private static final Pattern INITIAL_SEGMENT_PATTERN = Pattern
+ .compile("(?:([^.()]+)\\.)?([^.()]+)(?:\\((.+)\\)|(\\(\\)))?");
private static final Pattern NAVIGATION_SEGMENT_PATTERN = Pattern.compile("([^()]+)(?:\\((.+)\\)|(\\(\\)))?");
private static final Pattern NAMED_VALUE_PATTERN = Pattern.compile("(?:([^=]+)=)?([^=]+)");
@@ -91,13 +92,14 @@ public class UriParserImpl extends UriParser {
/**
* Parse the URI part after an OData service root,
* already splitted into path segments and query parameters.
- * @param pathSegments the {@link PathSegment}s of the resource path,
- * potentially percent-encoded
+ * @param pathSegments the {@link PathSegment}s of the resource path,
+ * potentially percent-encoded
* @param queryParameters the query parameters, already percent-decoded
* @return a {@link UriInfoImpl} instance containing the parsed information
*/
@Override
- public UriInfo parse(final List<PathSegment> pathSegments, final Map<String, String> queryParameters) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ public UriInfo parse(final List<PathSegment> pathSegments, final Map<String, String> queryParameters)
+ throws UriSyntaxException, UriNotMatchingException, EdmException {
this.pathSegments = copyPathSegmentList(pathSegments);
systemQueryOptions = new HashMap<SystemQueryOption, String>();
otherQueryParameters = new HashMap<String, String>();
@@ -188,7 +190,8 @@ public class UriParserImpl extends UriParser {
}
}
- private void handleEntitySet(final EdmEntitySet entitySet, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ private void handleEntitySet(final EdmEntitySet entitySet, final String keyPredicate) throws UriSyntaxException,
+ UriNotMatchingException, EdmException {
final EdmEntityType entityType = entitySet.getEntityType();
uriResult.setTargetType(entityType);
@@ -326,7 +329,8 @@ public class UriParserImpl extends UriParser {
}
}
- private void addNavigationSegment(final String keyPredicateName, final EdmNavigationProperty navigationProperty) throws UriSyntaxException, EdmException {
+ private void addNavigationSegment(final String keyPredicateName, final EdmNavigationProperty navigationProperty)
+ throws UriSyntaxException, EdmException {
final EdmEntitySet targetEntitySet = uriResult.getTargetEntitySet().getRelatedEntitySet(navigationProperty);
final EdmEntityType targetEntityType = targetEntitySet.getEntityType();
uriResult.setTargetEntitySet(targetEntitySet);
@@ -341,7 +345,8 @@ public class UriParserImpl extends UriParser {
uriResult.addNavigationSegment(navigationSegment);
}
- private void handlePropertyPath(final EdmProperty property) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ private void handlePropertyPath(final EdmProperty property) throws UriSyntaxException, UriNotMatchingException,
+ EdmException {
uriResult.addProperty(property);
final EdmType type = property.getType();
@@ -408,7 +413,8 @@ public class UriParserImpl extends UriParser {
}
}
- private ArrayList<KeyPredicate> parseKey(final String keyPredicate, final EdmEntityType entityType) throws UriSyntaxException, EdmException {
+ private ArrayList<KeyPredicate> parseKey(final String keyPredicate, final EdmEntityType entityType)
+ throws UriSyntaxException, EdmException {
final List<EdmProperty> keyProperties = entityType.getKeyProperties();
ArrayList<EdmProperty> parsedKeyProperties = new ArrayList<EdmProperty>();
ArrayList<KeyPredicate> keyPredicates = new ArrayList<KeyPredicate>();
@@ -457,7 +463,8 @@ public class UriParserImpl extends UriParser {
return keyPredicates;
}
- private void handleFunctionImport(final EdmFunctionImport functionImport, final String emptyParentheses, final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ private void handleFunctionImport(final EdmFunctionImport functionImport, final String emptyParentheses,
+ final String keyPredicate) throws UriSyntaxException, UriNotMatchingException, EdmException {
final EdmTyped returnType = functionImport.getReturnType();
final EdmType type = returnType.getType();
final boolean isCollection = returnType.getMultiplicity() == EdmMultiplicity.MANY;
@@ -525,7 +532,8 @@ public class UriParserImpl extends UriParser {
for (SystemQueryOption queryOption : systemQueryOptions.keySet()) {
- if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5) && uriResult.isValue()) {
+ if (queryOption == SystemQueryOption.$format && (uriType == UriType.URI4 || uriType == UriType.URI5)
+ && uriResult.isValue()) {
throw new UriSyntaxException(UriSyntaxException.INCOMPATIBLESYSTEMQUERYOPTION.addContent(queryOption));
}
@@ -644,7 +652,8 @@ public class UriParserImpl extends UriParser {
}
}
- private void handleSystemQueryOptionExpand(final String expandStatement) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ private void handleSystemQueryOptionExpand(final String expandStatement) throws UriSyntaxException,
+ UriNotMatchingException, EdmException {
ArrayList<ArrayList<NavigationPropertySegment>> expand = new ArrayList<ArrayList<NavigationPropertySegment>>();
if (expandStatement.startsWith(",") || expandStatement.endsWith(",")) {
@@ -688,7 +697,8 @@ public class UriParserImpl extends UriParser {
uriResult.setExpand(expand);
}
- private void handleSystemQueryOptionSelect(final String selectStatement) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ private void handleSystemQueryOptionSelect(final String selectStatement) throws UriSyntaxException,
+ UriNotMatchingException, EdmException {
ArrayList<SelectItem> select = new ArrayList<SelectItem>();
if (selectStatement.startsWith(",") || selectStatement.endsWith(",")) {
@@ -827,17 +837,20 @@ public class UriParserImpl extends UriParser {
}
@Override
- public FilterExpression parseFilterString(final EdmEntityType entityType, final String expression) throws ExpressionParserException, ODataMessageException {
+ public FilterExpression parseFilterString(final EdmEntityType entityType, final String expression)
+ throws ExpressionParserException, ODataMessageException {
return new FilterParserImpl(entityType).parseFilterString(expression);
}
@Override
- public OrderByExpression parseOrderByString(final EdmEntityType entityType, final String expression) throws ExpressionParserException, ODataMessageException {
+ public OrderByExpression parseOrderByString(final EdmEntityType entityType, final String expression)
+ throws ExpressionParserException, ODataMessageException {
return new OrderByParserImpl(entityType).parseOrderByString(expression);
}
@Override
- public ExpandSelectTreeNode buildExpandSelectTree(final List<SelectItem> select, final List<ArrayList<NavigationPropertySegment>> expand) throws EdmException {
+ public ExpandSelectTreeNode buildExpandSelectTree(final List<SelectItem> select,
+ final List<ArrayList<NavigationPropertySegment>> expand) throws EdmException {
return new ExpandSelectTreeCreator(select, expand).create();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriType.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriType.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriType.java
index ed98a0e..0983d08 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriType.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriType.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri;
@@ -31,7 +31,9 @@ public enum UriType {
/**
* Entity set
*/
- URI1(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount, SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top, SystemQueryOption.$expand, SystemQueryOption.$select),
+ URI1(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount,
+ SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top,
+ SystemQueryOption.$expand, SystemQueryOption.$select),
/**
* Entity set with key predicate
*/
@@ -55,7 +57,9 @@ public enum UriType {
/**
* Navigation property of an entity with target multiplicity '*'
*/
- URI6B(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount, SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top, SystemQueryOption.$expand, SystemQueryOption.$select),
+ URI6B(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount,
+ SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top,
+ SystemQueryOption.$expand, SystemQueryOption.$select),
/**
* Link to a single entity
*/
@@ -63,7 +67,8 @@ public enum UriType {
/**
* Link to multiple entities
*/
- URI7B(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount, SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top),
+ URI7B(SystemQueryOption.$format, SystemQueryOption.$filter, SystemQueryOption.$inlinecount,
+ SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, SystemQueryOption.$skip, SystemQueryOption.$top),
/**
* Metadata document
*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ActualBinaryOperator.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ActualBinaryOperator.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ActualBinaryOperator.java
index aa73a06..f1b2f2b 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ActualBinaryOperator.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ActualBinaryOperator.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/BinaryExpressionImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/BinaryExpressionImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/BinaryExpressionImpl.java
index f475cdc..5243536 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/BinaryExpressionImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/BinaryExpressionImpl.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
@@ -37,7 +37,8 @@ public class BinaryExpressionImpl implements BinaryExpression {
final protected Token token;
protected EdmType edmType;
- public BinaryExpressionImpl(final InfoBinaryOperator operatorInfo, final CommonExpression leftSide, final CommonExpression rightSide, final Token token) {
+ public BinaryExpressionImpl(final InfoBinaryOperator operatorInfo, final CommonExpression leftSide,
+ final CommonExpression rightSide, final Token token) {
this.operatorInfo = operatorInfo;
this.leftSide = leftSide;
this.rightSide = rightSide;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ExpressionParserInternalError.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ExpressionParserInternalError.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ExpressionParserInternalError.java
index a43c747..62dcea1 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ExpressionParserInternalError.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/ExpressionParserInternalError.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
@@ -25,17 +25,23 @@ import org.apache.olingo.odata2.api.uri.expression.CommonExpression;
/**
* Internal error in the expression parser.
- *
+ *
*/
public class ExpressionParserInternalError extends ODataMessageException {
static final long serialVersionUID = 77L;
- public static final MessageReference ERROR_PARSING_METHOD = createMessageReference(ExpressionParserInternalError.class, "ERROR_PARSING_METHOD");
- public static final MessageReference ERROR_PARSING_PARENTHESIS = createMessageReference(ExpressionParserInternalError.class, "ERROR_PARSING_PARENTHESIS");
- public static final MessageReference ERROR_ACCESSING_EDM = createMessageReference(ExpressionParserInternalError.class, "ERROR_ACCESSING_EDM");
- public static final MessageReference INVALID_TYPE_COUNT = createMessageReference(ExpressionParserInternalError.class, "INVALID_TYPE_COUNT");;
- public static final MessageReference INVALID_TOKEN_AT = createMessageReference(ExpressionParserInternalError.class, "INVALID_TOKEN_AT");
- public static final MessageReference INVALID_TOKENKIND_AT = createMessageReference(ExpressionParserInternalError.class, "INVALID_TOKENKIND_AT");
+ public static final MessageReference ERROR_PARSING_METHOD = createMessageReference(
+ ExpressionParserInternalError.class, "ERROR_PARSING_METHOD");
+ public static final MessageReference ERROR_PARSING_PARENTHESIS = createMessageReference(
+ ExpressionParserInternalError.class, "ERROR_PARSING_PARENTHESIS");
+ public static final MessageReference ERROR_ACCESSING_EDM = createMessageReference(
+ ExpressionParserInternalError.class, "ERROR_ACCESSING_EDM");
+ public static final MessageReference INVALID_TYPE_COUNT = createMessageReference(ExpressionParserInternalError.class,
+ "INVALID_TYPE_COUNT");;
+ public static final MessageReference INVALID_TOKEN_AT = createMessageReference(ExpressionParserInternalError.class,
+ "INVALID_TOKEN_AT");
+ public static final MessageReference INVALID_TOKENKIND_AT = createMessageReference(
+ ExpressionParserInternalError.class, "INVALID_TOKENKIND_AT");
CommonExpression parenthesisExpression = null;
@@ -68,7 +74,8 @@ public class ExpressionParserInternalError extends ODataMessageException {
return new ExpressionParserInternalError(ERROR_PARSING_PARENTHESIS, cause);
}
- public static ExpressionParserInternalError createERROR_PARSING_PARENTHESIS(final CommonExpression parenthesisExpression, final TokenizerExpectError cause) {
+ public static ExpressionParserInternalError createERROR_PARSING_PARENTHESIS(
+ final CommonExpression parenthesisExpression, final TokenizerExpectError cause) {
return new ExpressionParserInternalError(ERROR_PARSING_PARENTHESIS, cause).setExpression(parenthesisExpression);
}
@@ -92,7 +99,8 @@ public class ExpressionParserInternalError extends ODataMessageException {
return new ExpressionParserInternalError(ERROR_ACCESSING_EDM);
}
- public static ExpressionParserInternalError createINVALID_TOKEN_AT(final String expectedToken, final Token actualToken) {
+ public static ExpressionParserInternalError
+ createINVALID_TOKEN_AT(final String expectedToken, final Token actualToken) {
MessageReference msgRef = ExpressionParserInternalError.INVALID_TOKEN_AT.create();
msgRef.addContent(expectedToken);
@@ -102,7 +110,8 @@ public class ExpressionParserInternalError extends ODataMessageException {
return new ExpressionParserInternalError(msgRef);
}
- public static ExpressionParserInternalError createINVALID_TOKENKIND_AT(final TokenKind expectedTokenKind, final Token actualToken) {
+ public static ExpressionParserInternalError createINVALID_TOKENKIND_AT(final TokenKind expectedTokenKind,
+ final Token actualToken) {
MessageReference msgRef = ExpressionParserInternalError.INVALID_TOKEN_AT.create();
msgRef.addContent(expectedTokenKind.toString());
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterExpressionImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterExpressionImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterExpressionImpl.java
index b0a7ef0..8d6ac2a 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterExpressionImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterExpressionImpl.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParser.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParser.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParser.java
index 255b951..972e3b3 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParser.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParser.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
@@ -25,33 +25,39 @@ import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
/**
* Interface which defines a method for parsing a $filter expression to allow different parser implementations
* <p>
- * The current expression parser supports expressions as defined in the OData specification 2.0 with the following restrictions
- * - the methods "cast", "isof" and "replace" are not supported
- *
+ * The current expression parser supports expressions as defined in the OData specification 2.0 with the following
+ * restrictions
+ * - the methods "cast", "isof" and "replace" are not supported
+ *
* The expression parser can be used with providing an Entity Data Model (EDM) an without providing it.
- * <p>When a EDM is provided the expression parser will be as strict as possible. That means:
- * <li>All properties used in the expression must be defined inside the EDM</li>
- * <li>The types of EDM properties will be checked against the lists of allowed type per method, binary- and unary operator</li>
- * </p>
- * <p>If no EDM is provided the expression parser performs a lax validation
- * <li>The properties used in the expression are not looked up inside the EDM and the type of the expression node representing the
- * property will be "null"</li>
- * <li>Expression node with EDM-types which are "null" are not considered during the parameter type validation, to the return type of the parent expression node will
- * also become "null"</li>
- *
- *
+ * <p>When a EDM is provided the expression parser will be as strict as possible. That means:
+ * <li>All properties used in the expression must be defined inside the EDM</li>
+ * <li>The types of EDM properties will be checked against the lists of allowed type per method, binary- and unary
+ * operator</li>
+ * </p>
+ * <p>If no EDM is provided the expression parser performs a lax validation
+ * <li>The properties used in the expression are not looked up inside the EDM and the type of the expression node
+ * representing the
+ * property will be "null"</li>
+ * <li>Expression node with EDM-types which are "null" are not considered during the parameter type validation, to the
+ * return type of the parent expression node will
+ * also become "null"</li>
+ *
+ *
*/
public interface FilterParser {
/**
* Parses a $filter expression string and creates an $orderby expression tree.
* @param expression
- * The $filter expression string ( for example "city eq 'Sydney'" ) to be parsed
+ * The $filter expression string ( for example "city eq 'Sydney'" ) to be parsed
* @return
- * Expression tree which can be traversed with help of the interfaces {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor} and {@link org.apache.olingo.odata2.api.uri.expression.Visitable}
+ * Expression tree which can be traversed with help of the interfaces
+ * {@link org.apache.olingo.odata2.api.uri.expression.ExpressionVisitor} and
+ * {@link org.apache.olingo.odata2.api.uri.expression.Visitable}
* @throws ExpressionParserException
- * Exception thrown due to errors while parsing the $filter expression string
+ * Exception thrown due to errors while parsing the $filter expression string
* @throws ODataMessageException
- * Used for extensibility
+ * Used for extensibility
**/
FilterExpression parseFilterString(String expression) throws ExpressionParserException, ODataMessageException;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserExceptionImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserExceptionImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserExceptionImpl.java
index 4a95bf1..403fe2f 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserExceptionImpl.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/expression/FilterParserExceptionImpl.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* 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
+ * 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
+ * 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.
+ * 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.odata2.core.uri.expression;
@@ -30,11 +30,11 @@ import org.apache.olingo.odata2.api.uri.expression.PropertyExpression;
/**
* This class is used to create exceptions of type FilterParserException.
- * Because this class lies inside org.apache.olingo.odata2.core it is possible to define better/more detailed
+ * Because this class lies inside org.apache.olingo.odata2.core it is possible to define better/more detailed
* input parameters for inserting into the exception text.<br>
* The exception {@link ExpressionParserException} does not know the org.apache.olingo.odata2.core content
*
- *
+ *
*/
public class FilterParserExceptionImpl extends ExpressionParserException {
private static final long serialVersionUID = 77L;
@@ -43,7 +43,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(ODataBadRequestException.COMMON);
}
- static public ExpressionParserException createERROR_IN_TOKENIZER(final TokenizerException exceptionTokenizer, final String expression) {
+ static public ExpressionParserException createERROR_IN_TOKENIZER(final TokenizerException exceptionTokenizer,
+ final String expression) {
Token token = exceptionTokenizer.getToken();
MessageReference msgRef = ExpressionParserException.ERROR_IN_TOKENIZER.create();
@@ -54,7 +55,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef, exceptionTokenizer);
}
- static public ExpressionParserException createINVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING(final Token token, final String expression) {
+ static public ExpressionParserException createINVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING(final Token token,
+ final String expression) {
MessageReference msgRef = ExpressionParserException.INVALID_TRAILING_TOKEN_DETECTED_AFTER_PARSING.create();
msgRef.addContent(token.getUriLiteral());
@@ -64,7 +66,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- static public ExpressionParserException createEXPRESSION_EXPECTED_AFTER_POS(final Token token, final String expression) {
+ static public ExpressionParserException
+ createEXPRESSION_EXPECTED_AFTER_POS(final Token token, final String expression) {
MessageReference msgRef = ExpressionParserException.EXPRESSION_EXPECTED_AFTER_POS.create();
msgRef.addContent(Integer.toString(token.getPosition() + 1));
@@ -73,7 +76,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- static public ExpressionParserException createEXPRESSION_EXPECTED_AFTER_POS(final int position, final String expression) {
+ static public ExpressionParserException createEXPRESSION_EXPECTED_AFTER_POS(final int position,
+ final String expression) {
MessageReference msgRef = ExpressionParserException.EXPRESSION_EXPECTED_AFTER_POS.create();
msgRef.addContent(position);
@@ -82,7 +86,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- static public ExpressionParserException createCOMMA_OR_END_EXPECTED_AT_POS(final Token token, final String expression) {
+ static public ExpressionParserException
+ createCOMMA_OR_END_EXPECTED_AT_POS(final Token token, final String expression) {
MessageReference msgRef = ExpressionParserException.COMMA_OR_END_EXPECTED_AT_POS.create();
msgRef.addContent(Integer.toString(token.getPosition() + 1));
@@ -100,7 +105,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- static public ExpressionParserException createCOMMA_OR_CLOSING_PHARENTHESIS_EXPECTED_AFTER_POS(final Token token, final String expression) {
+ static public ExpressionParserException createCOMMA_OR_CLOSING_PHARENTHESIS_EXPECTED_AFTER_POS(final Token token,
+ final String expression) {
MessageReference msgRef = ExpressionParserException.COMMA_OR_CLOSING_PHARENTHESIS_EXPECTED_AFTER_POS.create();
msgRef.addContent(Integer.toString(token.getPosition() + token.getUriLiteral().length()));
@@ -109,22 +115,23 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createMETHOD_WRONG_ARG_COUNT(final MethodExpressionImpl methodExpression, final Token token, final String expression) {
+ public static ExpressionParserException createMETHOD_WRONG_ARG_COUNT(final MethodExpressionImpl methodExpression,
+ final Token token, final String expression) {
MessageReference msgRef = null;
int minParam = methodExpression.getMethodInfo().getMinParameter();
int maxParam = methodExpression.getMethodInfo().getMaxParameter();
if ((minParam == -1) && (maxParam == -1)) {
- //no exception thrown in this case
+ // no exception thrown in this case
} else if ((minParam != -1) && (maxParam == -1)) {
- //Tested with TestParserExceptions.TestPMreadParameters CASE 7-1
+ // Tested with TestParserExceptions.TestPMreadParameters CASE 7-1
msgRef = ExpressionParserException.METHOD_WRONG_ARG_X_OR_MORE.create();
msgRef.addContent(methodExpression.getMethod().toUriLiteral());
msgRef.addContent(token.getPosition() + 1);
msgRef.addContent(expression);
msgRef.addContent(minParam);
} else if ((minParam == -1) && (maxParam != -1)) {
- //Tested with TestParserExceptions.TestPMreadParameters CASE 8-2
+ // Tested with TestParserExceptions.TestPMreadParameters CASE 8-2
msgRef = ExpressionParserException.METHOD_WRONG_ARG_X_OR_LESS.create();
msgRef.addContent(methodExpression.getMethod().toUriLiteral());
msgRef.addContent(token.getPosition() + 1);
@@ -132,14 +139,14 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
msgRef.addContent(maxParam);
} else if ((minParam != -1) && (maxParam != -1)) {
if (minParam == maxParam) {
- //Tested with TestParserExceptions.TestPMreadParameters CASE 11-1
+ // Tested with TestParserExceptions.TestPMreadParameters CASE 11-1
msgRef = ExpressionParserException.METHOD_WRONG_ARG_EXACT.create();
msgRef.addContent(methodExpression.getMethod().toUriLiteral());
msgRef.addContent(token.getPosition() + 1);
msgRef.addContent(expression);
msgRef.addContent(minParam);
} else {
- //Tested with TestParserExceptions.TestPMreadParameters CASE 10-1
+ // Tested with TestParserExceptions.TestPMreadParameters CASE 10-1
msgRef = ExpressionParserException.METHOD_WRONG_ARG_BETWEEN.create();
msgRef.addContent(methodExpression.getMethod().toUriLiteral());
msgRef.addContent(token.getPosition() + 1);
@@ -152,10 +159,11 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createMETHOD_WRONG_INPUT_TYPE(final MethodExpressionImpl methodExpression, final Token token, final String expression) {
+ public static ExpressionParserException createMETHOD_WRONG_INPUT_TYPE(final MethodExpressionImpl methodExpression,
+ final Token token, final String expression) {
MessageReference msgRef = null;
- //Tested with TestParserExceptions.TestPMreadParameters CASE 7-1
+ // Tested with TestParserExceptions.TestPMreadParameters CASE 7-1
msgRef = ExpressionParserException.METHOD_WRONG_INPUT_TYPE.create();
msgRef.addContent(methodExpression.getMethod().toUriLiteral());
msgRef.addContent(token.getPosition() + 1);
@@ -164,7 +172,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createLEFT_SIDE_NOT_A_PROPERTY(final Token token, final String expression) throws ExpressionParserInternalError {
+ public static ExpressionParserException createLEFT_SIDE_NOT_A_PROPERTY(final Token token, final String expression)
+ throws ExpressionParserInternalError {
MessageReference msgRef = ExpressionParserException.LEFT_SIDE_NOT_A_PROPERTY.create();
msgRef.addContent(token.getPosition() + 1);
@@ -173,7 +182,9 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createLEFT_SIDE_NOT_STRUCTURAL_TYPE(final EdmType parentType, final PropertyExpressionImpl property, final Token token, final String expression) throws ExpressionParserInternalError {
+ public static ExpressionParserException createLEFT_SIDE_NOT_STRUCTURAL_TYPE(final EdmType parentType,
+ final PropertyExpressionImpl property, final Token token, final String expression)
+ throws ExpressionParserInternalError {
MessageReference msgRef = ExpressionParserException.LEFT_SIDE_NOT_STRUCTURAL_TYPE.create();
try {
@@ -188,7 +199,9 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createPROPERTY_NAME_NOT_FOUND_IN_TYPE(final EdmStructuralType parentType, final PropertyExpression property, final Token token, final String expression) throws ExpressionParserInternalError {
+ public static ExpressionParserException createPROPERTY_NAME_NOT_FOUND_IN_TYPE(final EdmStructuralType parentType,
+ final PropertyExpression property, final Token token, final String expression)
+ throws ExpressionParserInternalError {
MessageReference msgRef = ExpressionParserException.PROPERTY_NAME_NOT_FOUND_IN_TYPE.create();
try {
@@ -203,7 +216,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createTOKEN_UNDETERMINATED_STRING(final int position, final String expression) {
+ public static ExpressionParserException
+ createTOKEN_UNDETERMINATED_STRING(final int position, final String expression) {
MessageReference msgRef = ExpressionParserException.TOKEN_UNDETERMINATED_STRING.create();
msgRef.addContent(position + 1);
@@ -212,7 +226,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createINVALID_TYPES_FOR_BINARY_OPERATOR(final BinaryOperator op, final EdmType left, final EdmType right, final Token token, final String expression) {
+ public static ExpressionParserException createINVALID_TYPES_FOR_BINARY_OPERATOR(final BinaryOperator op,
+ final EdmType left, final EdmType right, final Token token, final String expression) {
MessageReference msgRef = ExpressionParserException.INVALID_TYPES_FOR_BINARY_OPERATOR.create();
msgRef.addContent(op.toUriLiteral());
@@ -233,7 +248,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createMISSING_CLOSING_PHARENTHESIS(final int position, final String expression, final TokenizerExpectError e) {
+ public static ExpressionParserException createMISSING_CLOSING_PHARENTHESIS(final int position,
+ final String expression, final TokenizerExpectError e) {
MessageReference msgRef = ExpressionParserException.MISSING_CLOSING_PHARENTHESIS.create();
msgRef.addContent(position + 1);
@@ -250,7 +266,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
return new ExpressionParserException(msgRef);
}
- public static ExpressionParserException createINVALID_METHOD_CALL(final CommonExpression leftNode, final Token prevToken, final String expression) {
+ public static ExpressionParserException createINVALID_METHOD_CALL(final CommonExpression leftNode,
+ final Token prevToken, final String expression) {
final MessageReference msgRef = ExpressionParserException.INVALID_METHOD_CALL.create();
msgRef.addContent(leftNode.getUriLiteral());
@@ -261,7 +278,8 @@ public class FilterParserExceptionImpl extends ExpressionParserException {
}
- public static ExpressionParserException createTYPE_EXPECTED_AT(final EdmType expectedType, final EdmType actualType, final int position, final String expression) {
+ public static ExpressionParserException createTYPE_EXPECTED_AT(final EdmType expectedType, final EdmType actualType,
+ final int position, final String expression) {
final MessageReference msgRef = ExpressionParserException.TYPE_EXPECTED_AT.create();
try {