[OLINGO-786] Make annotaion csdl classes spec compliant`
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/67ccbf9d Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/67ccbf9d Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/67ccbf9d Branch: refs/heads/master Commit: 67ccbf9ddb22b6f51a05acfc5213a41fdfddf39b Parents: 576acf4 Author: Christian Amend <[email protected]> Authored: Fri Oct 16 14:12:24 2015 +0200 Committer: Christian Amend <[email protected]> Committed: Fri Oct 16 14:12:24 2015 +0200 ---------------------------------------------------------------------- ...lAnnotatableDynamicAnnotationExpression.java | 38 -- ...ctClientCsdlDynamicAnnotationExpression.java | 357 ------------------- .../xml/AbstractClientCsdlEdmDeserializer.java | 26 +- ...tClientCsdlElementOrAttributeExpression.java | 37 -- .../core/edm/xml/ClientCsdlAnnotation.java | 9 +- .../core/edm/xml/ClientCsdlAnnotationPath.java | 27 -- .../client/core/edm/xml/ClientCsdlApply.java | 80 ----- .../client/core/edm/xml/ClientCsdlCast.java | 137 ------- .../core/edm/xml/ClientCsdlCollection.java | 64 ---- .../ClientCsdlConstantAnnotationExpression.java | 27 -- .../client/core/edm/xml/ClientCsdlIf.java | 61 ---- .../client/core/edm/xml/ClientCsdlIsOf.java | 136 ------- .../core/edm/xml/ClientCsdlLabeledElement.java | 79 ---- .../xml/ClientCsdlLabeledElementReference.java | 28 -- .../xml/ClientCsdlNavigationPropertyPath.java | 28 -- .../client/core/edm/xml/ClientCsdlNot.java | 39 -- .../client/core/edm/xml/ClientCsdlNull.java | 51 --- .../client/core/edm/xml/ClientCsdlPath.java | 27 -- .../core/edm/xml/ClientCsdlPropertyPath.java | 27 -- .../core/edm/xml/ClientCsdlPropertyValue.java | 81 ----- .../client/core/edm/xml/ClientCsdlRecord.java | 76 ---- ...lTwoParamsOpDynamicAnnotationExpression.java | 62 ---- .../client/core/edm/xml/ClientCsdlUrlRef.java | 65 ---- .../edm/xml/annotation/ClientCsdlApply.java | 61 ++++ .../core/edm/xml/annotation/ClientCsdlCast.java | 72 ++++ .../xml/annotation/ClientCsdlCollection.java | 55 +++ .../annotation/ClientCsdlDynamicExpression.java | 162 +++++++++ .../core/edm/xml/annotation/ClientCsdlIsOf.java | 71 ++++ .../annotation/ClientCsdlLabeledElement.java | 57 +++ .../core/edm/xml/annotation/ClientCsdlNull.java | 53 +++ .../xml/annotation/ClientCsdlPropertyValue.java | 59 +++ .../edm/xml/annotation/ClientCsdlRecord.java | 57 +++ .../edm/xml/annotation/ClientCsdlUrlRef.java | 54 +++ .../apache/olingo/client/core/MetadataTest.java | 47 +-- .../commons/api/edm/annotation/EdmNot.java | 6 +- ...mTwoParamsOpDynamicAnnotationExpression.java | 4 +- .../api/edm/provider/CsdlAnnotation.java | 12 +- .../api/edm/provider/CsdlExpression.java | 26 -- .../AbstractCsdlAnnotationExpression.java | 49 --- .../annotation/AnnotationExpression.java | 52 --- .../edm/provider/annotation/AnnotationPath.java | 31 -- .../api/edm/provider/annotation/Apply.java | 49 --- .../api/edm/provider/annotation/Cast.java | 65 ---- .../api/edm/provider/annotation/Collection.java | 36 -- .../ConstantAnnotationExpression.java | 118 ------ .../provider/annotation/CsdlAnnotationPath.java | 41 +++ .../api/edm/provider/annotation/CsdlApply.java | 77 ++++ .../api/edm/provider/annotation/CsdlCast.java | 124 +++++++ .../edm/provider/annotation/CsdlCollection.java | 50 +++ .../CsdlConstantAnnotationExpression.java | 58 --- .../annotation/CsdlConstantExpression.java | 142 ++++++++ .../annotation/CsdlDynamicExpression.java | 282 +++++++++++++++ .../edm/provider/annotation/CsdlExpression.java | 58 +++ .../api/edm/provider/annotation/CsdlIf.java | 95 +++++ .../api/edm/provider/annotation/CsdlIsOf.java | 131 +++++++ .../provider/annotation/CsdlLabeledElement.java | 74 ++++ .../annotation/CsdlLabeledElementReference.java | 42 +++ .../CsdlLogicalOrComparisonExpression.java | 150 ++++++++ .../annotation/CsdlNavigationPropertyPath.java | 43 +++ .../api/edm/provider/annotation/CsdlNull.java | 45 +++ .../api/edm/provider/annotation/CsdlPath.java | 44 +++ .../provider/annotation/CsdlPropertyPath.java | 42 +++ .../provider/annotation/CsdlPropertyValue.java | 76 ++++ .../api/edm/provider/annotation/CsdlRecord.java | 73 ++++ .../api/edm/provider/annotation/CsdlUrlRef.java | 59 +++ .../annotation/DynamicAnnotationExpression.java | 241 ------------- .../commons/api/edm/provider/annotation/If.java | 54 --- .../api/edm/provider/annotation/IsOf.java | 66 ---- .../edm/provider/annotation/LabeledElement.java | 42 --- .../annotation/LabeledElementReference.java | 33 -- .../annotation/NavigationPropertyPath.java | 33 -- .../api/edm/provider/annotation/Not.java | 31 -- .../api/edm/provider/annotation/Null.java | 28 -- .../api/edm/provider/annotation/Path.java | 35 -- .../edm/provider/annotation/PropertyPath.java | 33 -- .../edm/provider/annotation/PropertyValue.java | 42 --- .../api/edm/provider/annotation/Record.java | 43 --- .../TwoParamsOpDynamicAnnotationExpression.java | 96 ----- .../api/edm/provider/annotation/UrlRef.java | 33 -- .../commons/core/edm/EdmAnnotationImpl.java | 61 ++-- ...mTwoParamsOpDynamicAnnotationExpression.java | 11 +- .../commons/core/edm/annotation/EdmAndImpl.java | 3 +- .../core/edm/annotation/EdmCastImpl.java | 6 +- .../EdmConstantAnnotationExpressionImpl.java | 10 +- .../commons/core/edm/annotation/EdmEqImpl.java | 4 +- .../commons/core/edm/annotation/EdmGeImpl.java | 4 +- .../commons/core/edm/annotation/EdmGtImpl.java | 4 +- .../core/edm/annotation/EdmIsOfImpl.java | 6 +- .../commons/core/edm/annotation/EdmLeImpl.java | 3 +- .../commons/core/edm/annotation/EdmLtImpl.java | 4 +- .../commons/core/edm/annotation/EdmNeImpl.java | 4 +- .../commons/core/edm/annotation/EdmNotImpl.java | 7 +- .../commons/core/edm/annotation/EdmOrImpl.java | 4 +- .../tecsvc/provider/ContainerProvider.java | 15 +- .../server/tecsvc/provider/TermProvider.java | 11 +- 95 files changed, 2484 insertions(+), 2947 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java deleted file mode 100644 index 68e98ae..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java +++ /dev/null @@ -1,38 +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.client.core.edm.xml; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable; -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; - -abstract class AbstractClientCsdlAnnotatableDynamicAnnotationExpression - extends AbstractClientCsdlDynamicAnnotationExpression implements CsdlAnnotatable { - - private static final long serialVersionUID = -450668773857358139L; - - private final List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>(); - - @Override - public List<CsdlAnnotation> getAnnotations() { - return annotations; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java deleted file mode 100644 index 4202471..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java +++ /dev/null @@ -1,357 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonLocation; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.ClassUtils; -import org.apache.olingo.commons.api.edm.provider.annotation.AbstractCsdlAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath; -import org.apache.olingo.commons.api.edm.provider.annotation.Apply; -import org.apache.olingo.commons.api.edm.provider.annotation.Cast; -import org.apache.olingo.commons.api.edm.provider.annotation.Collection; -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.If; -import org.apache.olingo.commons.api.edm.provider.annotation.IsOf; -import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement; -import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference; -import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath; -import org.apache.olingo.commons.api.edm.provider.annotation.Not; -import org.apache.olingo.commons.api.edm.provider.annotation.Null; -import org.apache.olingo.commons.api.edm.provider.annotation.Path; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue; -import org.apache.olingo.commons.api.edm.provider.annotation.Record; -import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = AbstractClientCsdlDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class) -abstract class AbstractClientCsdlDynamicAnnotationExpression - extends AbstractCsdlAnnotationExpression implements DynamicAnnotationExpression { - - private static final long serialVersionUID = 1093411847477874348L; - - @Override - public boolean isNot() { - return this instanceof Not; - } - - @Override - public Not asNot() { - return isNot() ? (Not) this : null; - - } - - @Override - public boolean isTwoParamsOp() { - return this instanceof TwoParamsOpDynamicAnnotationExpression; - } - - @Override - public TwoParamsOpDynamicAnnotationExpression asTwoParamsOp() { - return isTwoParamsOp() ? (TwoParamsOpDynamicAnnotationExpression) this : null; - } - - @Override - public boolean isAnnotationPath() { - return this instanceof AnnotationPath; - } - - @Override - public AnnotationPath asAnnotationPath() { - return isAnnotationPath() ? (AnnotationPath) this : null; - } - - @Override - public boolean isApply() { - return this instanceof Apply; - } - - @Override - public Apply asApply() { - return isApply() ? (Apply) this : null; - } - - @Override - public boolean isCast() { - return this instanceof Cast; - } - - @Override - public Cast asCast() { - return isCast() ? (Cast) this : null; - } - - @Override - public boolean isCollection() { - return this instanceof Collection; - } - - @Override - public Collection asCollection() { - return isCollection() ? (Collection) this : null; - } - - @Override - public boolean isIf() { - return this instanceof If; - } - - @Override - public If asIf() { - return isIf() ? (If) this : null; - } - - @Override - public boolean isIsOf() { - return this instanceof IsOf; - } - - @Override - public IsOf asIsOf() { - return isIsOf() ? (IsOf) this : null; - } - - @Override - public boolean isLabeledElement() { - return this instanceof LabeledElement; - } - - @Override - public LabeledElement asLabeledElement() { - return isLabeledElement() ? (LabeledElement) this : null; - } - - @Override - public boolean isLabeledElementReference() { - return this instanceof LabeledElementReference; - } - - @Override - public LabeledElementReference asLabeledElementReference() { - return isLabeledElementReference() ? (LabeledElementReference) this : null; - } - - @Override - public boolean isNull() { - return this instanceof Null; - } - - @Override - public Null asNull() { - return isNull() ? (Null) this : null; - } - - @Override - public boolean isNavigationPropertyPath() { - return this instanceof NavigationPropertyPath; - } - - @Override - public NavigationPropertyPath asNavigationPropertyPath() { - return isNavigationPropertyPath() ? (NavigationPropertyPath) this : null; - } - - @Override - public boolean isPath() { - return this instanceof Path; - } - - @Override - public Path asPath() { - return isPath() ? (Path) this : null; - } - - @Override - public boolean isPropertyPath() { - return this instanceof PropertyPath; - } - - @Override - public PropertyPath asPropertyPath() { - return isPropertyPath() ? (PropertyPath) this : null; - } - - @Override - public boolean isPropertyValue() { - return this instanceof PropertyValue; - } - - @Override - public PropertyValue asPropertyValue() { - return isPropertyValue() ? (PropertyValue) this : null; - } - - @Override - public boolean isRecord() { - return this instanceof Record; - } - - @Override - public Record asRecord() { - return isRecord() ? (Record) this : null; - } - - @Override - public boolean isUrlRef() { - return this instanceof UrlRef; - } - - @Override - public UrlRef asUrlRef() { - return isUrlRef() ? (UrlRef) this : null; - } - - static class DynamicAnnotationExpressionDeserializer - extends AbstractClientCsdlEdmDeserializer<AbstractClientCsdlDynamicAnnotationExpression> { - - private static final String[] EL_OR_ATTR = { - AnnotationPath.class.getSimpleName(), NavigationPropertyPath.class.getSimpleName(), - Path.class.getSimpleName(), PropertyPath.class.getSimpleName() - }; - - private static final String APPLY = Apply.class.getSimpleName(); - private static final String CAST = Cast.class.getSimpleName(); - private static final String COLLECTION = Collection.class.getSimpleName(); - private static final String IF = If.class.getSimpleName(); - private static final String IS_OF = IsOf.class.getSimpleName(); - private static final String LABELED_ELEMENT = LabeledElement.class.getSimpleName(); - private static final String NULL = Null.class.getSimpleName(); - private static final String RECORD = Record.class.getSimpleName(); - private static final String URL_REF = UrlRef.class.getSimpleName(); - - private AbstractClientCsdlElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName) - throws JsonParseException { - - try { - @SuppressWarnings("unchecked") - Class<? extends AbstractClientCsdlElementOrAttributeExpression> elOrAttrClass = - (Class<? extends AbstractClientCsdlElementOrAttributeExpression>) ClassUtils.getClass( - getClass().getPackage().getName() + ".ClientCsdl" + simpleClassName); - return elOrAttrClass.newInstance(); - } catch (Exception e) { - throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e); - } - } - - private AbstractCsdlAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException { - AbstractCsdlAnnotationExpression result; - if (isAnnotationConstExprConstruct(jp)) { - result = parseAnnotationConstExprConstruct(jp); - } else { - result = jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class); - } - jp.nextToken(); - - return result; - } - - @Override - protected AbstractClientCsdlDynamicAnnotationExpression doDeserialize(final JsonParser jp, - final DeserializationContext ctxt) throws IOException { - - AbstractClientCsdlDynamicAnnotationExpression expression = null; - - if ("Not".equals(jp.getCurrentName())) { - final ClientCsdlNot not = new ClientCsdlNot(); - - jp.nextToken(); - //Search for field name - while (jp.getCurrentToken() != JsonToken.FIELD_NAME) { - jp.nextToken(); - } - not.setExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - //Search for end object - while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals("Not")) { - jp.nextToken(); - } - - expression = not; - } else if (TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName()) != null) { - final ClientCsdlTwoParamsOpDynamicAnnotationExpression dynExprDoubleParamOp = - new ClientCsdlTwoParamsOpDynamicAnnotationExpression(); - dynExprDoubleParamOp.setType(TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName())); - - jp.nextToken(); - //Search for field name - while (jp.getCurrentToken() != JsonToken.FIELD_NAME) { - jp.nextToken(); - } - dynExprDoubleParamOp.setLeftExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - //Search for expression - while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals(dynExprDoubleParamOp - .getType().name())) { - jp.nextToken(); - } - - expression = dynExprDoubleParamOp; - } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) { - final AbstractClientCsdlElementOrAttributeExpression elOrAttr = - getElementOrAttributeExpression(jp.getCurrentName()); - elOrAttr.setValue(jp.nextTextValue()); - expression = elOrAttr; - } else if (APPLY.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlApply.class); - } else if (CAST.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlCast.class); - } else if (COLLECTION.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlCollection.class); - } else if (IF.equals(jp.getCurrentName())) { - jp.nextToken(); - jp.nextToken(); - - final ClientCsdlIf ifImpl = new ClientCsdlIf(); - ifImpl.setGuard(parseConstOrEnumExpression(jp)); - ifImpl.setThen(parseConstOrEnumExpression(jp)); - ifImpl.setElse(parseConstOrEnumExpression(jp)); - - expression = ifImpl; - } else if (IS_OF.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlIsOf.class); - } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlLabeledElement.class); - } else if (NULL.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlNull.class); - } else if (RECORD.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlRecord.class); - } else if (URL_REF.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ClientCsdlUrlRef.class); - } - - return expression; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java index c96654c..a6943d1 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -20,21 +20,23 @@ package org.apache.olingo.client.core.edm.xml; import java.io.IOException; +import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression; + import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser; -abstract class AbstractClientCsdlEdmDeserializer<T> extends JsonDeserializer<T> { +public abstract class AbstractClientCsdlEdmDeserializer<T> extends JsonDeserializer<T> { protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException { - return ClientCsdlConstantAnnotationExpression.Type.fromString(jp.getCurrentName()) != null; + return CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName()) != null; } - protected ClientCsdlConstantAnnotationExpression parseAnnotationConstExprConstruct(final JsonParser jp) + protected CsdlConstantExpression parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException { - final ClientCsdlConstantAnnotationExpression constExpr = new ClientCsdlConstantAnnotationExpression(); - constExpr.setType(ClientCsdlConstantAnnotationExpression.Type.fromString(jp.getCurrentName())); + final CsdlConstantExpression constExpr = new CsdlConstantExpression(); + constExpr.setType(CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName())); constExpr.setValue(jp.nextTextValue()); return constExpr; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java deleted file mode 100644 index 6c4c5cf..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java +++ /dev/null @@ -1,37 +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.client.core.edm.xml; - -/** - * Groups dynamic expressions that may be provided using element notation or attribute notation. - */ -class AbstractClientCsdlElementOrAttributeExpression extends AbstractClientCsdlDynamicAnnotationExpression { - - private static final long serialVersionUID = 1588336268773032932L; - - private String value; - - public String getValue() { - return value; - } - - public void setValue(final String value) { - this.value = value; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotation.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotation.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotation.java index 5413444..131b6c9 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotation.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotation.java @@ -20,15 +20,16 @@ package org.apache.olingo.client.core.edm.xml; import java.io.IOException; +import org.apache.olingo.client.core.edm.xml.annotation.ClientCsdlDynamicExpression; +import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; + import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(using = ClientCsdlAnnotation.AnnotationDeserializer.class) -class ClientCsdlAnnotation extends CsdlAnnotation { +public class ClientCsdlAnnotation extends CsdlAnnotation { private static final long serialVersionUID = 5464714417411058033L; @@ -55,7 +56,7 @@ class ClientCsdlAnnotation extends CsdlAnnotation { annotation.setExpression(parseAnnotationConstExprConstruct(jp)); } else { // Dynamic Expressions - annotation.setExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); + annotation.setExpression(jp.readValueAs(ClientCsdlDynamicExpression.class)); } } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotationPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotationPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotationPath.java deleted file mode 100644 index 195f24b..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlAnnotationPath.java +++ /dev/null @@ -1,27 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath; - -class ClientCsdlAnnotationPath extends AbstractClientCsdlElementOrAttributeExpression implements AnnotationPath { - - private static final long serialVersionUID = 5360735207353494466L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlApply.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlApply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlApply.java deleted file mode 100644 index 2d80c98..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlApply.java +++ /dev/null @@ -1,80 +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.client.core.edm.xml; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.Apply; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ClientCsdlApply.ApplyDeserializer.class) -class ClientCsdlApply extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements Apply { - - private static final long serialVersionUID = 4358398303405059879L; - - private String function; - - private final List<AnnotationExpression> parameters = new ArrayList<AnnotationExpression>(); - - @Override - public String getFunction() { - return function; - } - - public void setFunction(final String function) { - this.function = function; - } - - @Override - public List<AnnotationExpression> getParameters() { - return parameters; - } - - static class ApplyDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlApply> { - - @Override - protected ClientCsdlApply doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlApply apply = new ClientCsdlApply(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Function".equals(jp.getCurrentName())) { - apply.setFunction(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - apply.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else if (isAnnotationConstExprConstruct(jp)) { - apply.getParameters().add(parseAnnotationConstExprConstruct(jp)); - } else { - apply.getParameters().add(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - - return apply; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCast.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCast.java deleted file mode 100644 index 384f6fa..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCast.java +++ /dev/null @@ -1,137 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.annotation.Cast; -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlCast.CastDeserializer.class) -class ClientCsdlCast extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements Cast { - - private static final long serialVersionUID = 3312415984116005313L; - - private String type; - - private Integer maxLength; - - private Integer precision; - - private Integer scale; - - private SRID srid; - - private DynamicAnnotationExpression value; - - @Override - public String getType() { - return type; - } - - public void setType(final String type) { - this.type = type; - } - - @Override - public Integer getMaxLength() { - return maxLength; - } - - public void setMaxLength(final Integer maxLength) { - this.maxLength = maxLength; - } - - @Override - public Integer getPrecision() { - return precision; - } - - public void setPrecision(final Integer precision) { - this.precision = precision; - } - - @Override - public Integer getScale() { - return scale; - } - - public void setScale(final Integer scale) { - this.scale = scale; - } - - @Override - public SRID getSrid() { - return srid; - } - - public void setSrid(final SRID srid) { - this.srid = srid; - } - - @Override - public DynamicAnnotationExpression getValue() { - return value; - } - - public void setValue(final DynamicAnnotationExpression value) { - this.value = value; - } - - static class CastDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlCast> { - - @Override - protected ClientCsdlCast doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlCast cast = new ClientCsdlCast(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Type".equals(jp.getCurrentName())) { - cast.setType(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - cast.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else if ("MaxLength".equals(jp.getCurrentName())) { - final String maxLenght = jp.nextTextValue(); - cast.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght)); - } else if ("Precision".equals(jp.getCurrentName())) { - cast.setPrecision(Integer.valueOf(jp.nextTextValue())); - } else if ("Scale".equals(jp.getCurrentName())) { - final String scale = jp.nextTextValue(); - cast.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); - } else if ("SRID".equals(jp.getCurrentName())) { - final String srid = jp.nextTextValue(); - if (srid != null) { - cast.setSrid(SRID.valueOf(srid)); - } - } else { - cast.setValue(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - return cast; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCollection.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCollection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCollection.java deleted file mode 100644 index cc9832b..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlCollection.java +++ /dev/null @@ -1,64 +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.client.core.edm.xml; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.Collection; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ClientCsdlCollection.CollectionDeserializer.class) -class ClientCsdlCollection extends AbstractClientCsdlDynamicAnnotationExpression implements Collection { - - private static final long serialVersionUID = -724749123749715643L; - - private final List<AnnotationExpression> items = new ArrayList<AnnotationExpression>(); - - @Override - public List<AnnotationExpression> getItems() { - return items; - } - - static class CollectionDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlCollection> { - @Override - protected ClientCsdlCollection doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlCollection collection = new ClientCsdlCollection(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if (isAnnotationConstExprConstruct(jp)) { - collection.getItems().add(parseAnnotationConstExprConstruct(jp)); - } else { - collection.getItems().add(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - - return collection; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlConstantAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlConstantAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlConstantAnnotationExpression.java deleted file mode 100644 index 97ac1cc..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlConstantAnnotationExpression.java +++ /dev/null @@ -1,27 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantAnnotationExpression; - -class ClientCsdlConstantAnnotationExpression - extends CsdlConstantAnnotationExpression { - - private static final long serialVersionUID = 5618680702707972904L; -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIf.java deleted file mode 100644 index 1289637..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIf.java +++ /dev/null @@ -1,61 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.If; - -class ClientCsdlIf extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements If { - - private static final long serialVersionUID = -8571383625077590656L; - - private AnnotationExpression guard; - - private AnnotationExpression _then; - - private AnnotationExpression _else; - - @Override - public AnnotationExpression getGuard() { - return guard; - } - - public void setGuard(final AnnotationExpression guard) { - this.guard = guard; - } - - @Override - public AnnotationExpression getThen() { - return _then; - } - - public void setThen(final AnnotationExpression _then) { - this._then = _then; - } - - @Override - public AnnotationExpression getElse() { - return _else; - } - - public void setElse(final AnnotationExpression _else) { - this._else = _else; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIsOf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIsOf.java deleted file mode 100644 index 58b34e0..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlIsOf.java +++ /dev/null @@ -1,136 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.IsOf; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlIsOf.IsOfDeserializer.class) -class ClientCsdlIsOf extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements IsOf { - - private static final long serialVersionUID = -893355856129761174L; - - private String type; - - private Integer maxLength; - - private Integer precision; - - private Integer scale; - - private SRID srid; - - private DynamicAnnotationExpression value; - - @Override - public String getType() { - return type; - } - - public void setType(final String type) { - this.type = type; - } - - @Override - public Integer getMaxLength() { - return maxLength; - } - - public void setMaxLength(final Integer maxLength) { - this.maxLength = maxLength; - } - - @Override - public Integer getPrecision() { - return precision; - } - - public void setPrecision(final Integer precision) { - this.precision = precision; - } - - @Override - public Integer getScale() { - return scale; - } - - public void setScale(final Integer scale) { - this.scale = scale; - } - - @Override - public SRID getSrid() { - return srid; - } - - public void setSrid(final SRID srid) { - this.srid = srid; - } - - @Override - public DynamicAnnotationExpression getValue() { - return value; - } - - public void setValue(final DynamicAnnotationExpression value) { - this.value = value; - } - - static class IsOfDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlIsOf> { - @Override - protected ClientCsdlIsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlIsOf isof = new ClientCsdlIsOf(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Type".equals(jp.getCurrentName())) { - isof.setType(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - isof.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else if ("MaxLength".equals(jp.getCurrentName())) { - final String maxLenght = jp.nextTextValue(); - isof.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght)); - } else if ("Precision".equals(jp.getCurrentName())) { - isof.setPrecision(Integer.valueOf(jp.nextTextValue())); - } else if ("Scale".equals(jp.getCurrentName())) { - final String scale = jp.nextTextValue(); - isof.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); - } else if ("SRID".equals(jp.getCurrentName())) { - final String srid = jp.nextTextValue(); - if (srid != null) { - isof.setSrid(SRID.valueOf(srid)); - } - } else { - isof.setValue(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - return isof; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElement.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElement.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElement.java deleted file mode 100644 index db1a734..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElement.java +++ /dev/null @@ -1,79 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlLabeledElement.LabeledElementDeserializer.class) -class ClientCsdlLabeledElement - extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements LabeledElement { - - private static final long serialVersionUID = 4909387630253341824L; - - private String name; - - private DynamicAnnotationExpression value; - - @Override - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - @Override - public DynamicAnnotationExpression getValue() { - return value; - } - - public void setValue(final DynamicAnnotationExpression value) { - this.value = value; - } - - static class LabeledElementDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlLabeledElement> { - @Override - protected ClientCsdlLabeledElement doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlLabeledElement element = new ClientCsdlLabeledElement(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Name".equals(jp.getCurrentName())) { - element.setName(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - element.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else { - element.setValue(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - return element; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElementReference.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElementReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElementReference.java deleted file mode 100644 index b3f1e5a..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlLabeledElementReference.java +++ /dev/null @@ -1,28 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference; - -class ClientCsdlLabeledElementReference - extends AbstractClientCsdlElementOrAttributeExpression implements LabeledElementReference { - - private static final long serialVersionUID = 7560525604021670529L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNavigationPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNavigationPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNavigationPropertyPath.java deleted file mode 100644 index 039af20..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNavigationPropertyPath.java +++ /dev/null @@ -1,28 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath; - -class ClientCsdlNavigationPropertyPath extends AbstractClientCsdlElementOrAttributeExpression - implements NavigationPropertyPath { - - private static final long serialVersionUID = 879840502446301312L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNot.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNot.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNot.java deleted file mode 100644 index b417341..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNot.java +++ /dev/null @@ -1,39 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.Not; - -class ClientCsdlNot extends AbstractClientCsdlDynamicAnnotationExpression implements Not { - - private static final long serialVersionUID = -437788415922966812L; - - private DynamicAnnotationExpression expression; - - @Override - public DynamicAnnotationExpression getExpression() { - return expression; - } - - public void setExpression(final DynamicAnnotationExpression expression) { - this.expression = expression; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNull.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNull.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNull.java deleted file mode 100644 index 5181c0f..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlNull.java +++ /dev/null @@ -1,51 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.Null; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlNull.NullDeserializer.class) -class ClientCsdlNull extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements Null { - - private static final long serialVersionUID = -3148516847180393142L; - - static class NullDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlNull> { - @Override - protected ClientCsdlNull doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlNull _null = new ClientCsdlNull(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Annotation".equals(jp.getCurrentName())) { - _null.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } - } - } - return _null; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPath.java deleted file mode 100644 index ed4d2bc..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPath.java +++ /dev/null @@ -1,27 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.Path; - -class ClientCsdlPath extends AbstractClientCsdlElementOrAttributeExpression implements Path { - - private static final long serialVersionUID = 6020168217561402545L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyPath.java deleted file mode 100644 index 45b66dc..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyPath.java +++ /dev/null @@ -1,27 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath; - -class ClientCsdlPropertyPath extends AbstractClientCsdlElementOrAttributeExpression implements PropertyPath { - - private static final long serialVersionUID = -9133862135834738470L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyValue.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyValue.java deleted file mode 100644 index d1cec62..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlPropertyValue.java +++ /dev/null @@ -1,81 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlPropertyValue.PropertyValueDeserializer.class) -class ClientCsdlPropertyValue extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression - implements PropertyValue { - - private static final long serialVersionUID = -8437649215282645228L; - - private String property; - - private AnnotationExpression value; - - @Override - public String getProperty() { - return property; - } - - public void setProperty(final String property) { - this.property = property; - } - - @Override - public AnnotationExpression getValue() { - return value; - } - - public void setValue(final AnnotationExpression value) { - this.value = value; - } - - static class PropertyValueDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlPropertyValue> { - @Override - protected ClientCsdlPropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlPropertyValue propValue = new ClientCsdlPropertyValue(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Property".equals(jp.getCurrentName())) { - propValue.setProperty(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - propValue.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else if (isAnnotationConstExprConstruct(jp)) { - propValue.setValue(parseAnnotationConstExprConstruct(jp)); - } else { - propValue.setValue(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - return propValue; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlRecord.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlRecord.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlRecord.java deleted file mode 100644 index f1176c9..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlRecord.java +++ /dev/null @@ -1,76 +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.client.core.edm.xml; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue; -import org.apache.olingo.commons.api.edm.provider.annotation.Record; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -@JsonDeserialize(using = ClientCsdlRecord.RecordDeserializer.class) -class ClientCsdlRecord extends AbstractClientCsdlAnnotatableDynamicAnnotationExpression implements Record { - - private static final long serialVersionUID = 4275271751615410709L; - - private String type; - - private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>(); - - @Override - public String getType() { - return type; - } - - public void setType(final String type) { - this.type = type; - } - - @Override - public List<PropertyValue> getPropertyValues() { - return propertyValues; - } - - static class RecordDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlRecord> { - @Override - protected ClientCsdlRecord doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlRecord record = new ClientCsdlRecord(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if ("Type".equals(jp.getCurrentName())) { - record.setType(jp.nextTextValue()); - } else if ("Annotation".equals(jp.getCurrentName())) { - record.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); - } else { - record.getPropertyValues().add(jp.readValueAs(ClientCsdlPropertyValue.class)); - } - } - } - return record; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlTwoParamsOpDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlTwoParamsOpDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlTwoParamsOpDynamicAnnotationExpression.java deleted file mode 100644 index b4d3732..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlTwoParamsOpDynamicAnnotationExpression.java +++ /dev/null @@ -1,62 +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.client.core.edm.xml; - -import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression; - -class ClientCsdlTwoParamsOpDynamicAnnotationExpression - extends AbstractClientCsdlDynamicAnnotationExpression implements TwoParamsOpDynamicAnnotationExpression { - - private static final long serialVersionUID = 6241842185452451946L; - - private Type type; - - private DynamicAnnotationExpression left; - - private DynamicAnnotationExpression right; - - @Override - public Type getType() { - return type; - } - - public void setType(final Type type) { - this.type = type; - } - - @Override - public DynamicAnnotationExpression getLeftExpression() { - return left; - } - - public void setLeftExpression(final DynamicAnnotationExpression left) { - this.left = left; - } - - @Override - public DynamicAnnotationExpression getRightExpression() { - return right; - } - - public void setRightExpression(final DynamicAnnotationExpression right) { - this.right = right; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlUrlRef.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlUrlRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlUrlRef.java deleted file mode 100644 index 280e1af..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCsdlUrlRef.java +++ /dev/null @@ -1,65 +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.client.core.edm.xml; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; - -@JsonDeserialize(using = ClientCsdlUrlRef.UrlRefDeserializer.class) -class ClientCsdlUrlRef extends AbstractClientCsdlDynamicAnnotationExpression implements UrlRef { - - private static final long serialVersionUID = -7693224811739000440L; - - private AnnotationExpression value; - - @Override - public AnnotationExpression getValue() { - return value; - } - - public void setValue(final AnnotationExpression value) { - this.value = value; - } - - static class UrlRefDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlUrlRef> { - @Override - protected ClientCsdlUrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ClientCsdlUrlRef urlref = new ClientCsdlUrlRef(); - for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { - final JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.FIELD_NAME) { - if (isAnnotationConstExprConstruct(jp)) { - urlref.setValue(parseAnnotationConstExprConstruct(jp)); - } else { - urlref.setValue(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class)); - } - } - } - return urlref; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlApply.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlApply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlApply.java new file mode 100644 index 0000000..4e2a000 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlApply.java @@ -0,0 +1,61 @@ +/* + * 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.client.core.edm.xml.annotation; + +import java.io.IOException; + +import org.apache.olingo.client.core.edm.xml.AbstractClientCsdlEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientCsdlAnnotation; +import org.apache.olingo.commons.api.edm.provider.annotation.CsdlApply; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = ClientCsdlApply.ApplyDeserializer.class) +class ClientCsdlApply extends CsdlApply { + + private static final long serialVersionUID = 4358398303405059879L; + + static class ApplyDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlApply> { + + @Override + protected ClientCsdlApply doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientCsdlApply apply = new ClientCsdlApply(); + for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { + final JsonToken token = jp.getCurrentToken(); + if (token == JsonToken.FIELD_NAME) { + if ("Function".equals(jp.getCurrentName())) { + apply.setFunction(jp.nextTextValue()); + } else if ("Annotation".equals(jp.getCurrentName())) { + apply.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); + } else if (isAnnotationConstExprConstruct(jp)) { + apply.getParameters().add(parseAnnotationConstExprConstruct(jp)); + } else { + apply.getParameters().add(jp.readValueAs(ClientCsdlDynamicExpression.class)); + } + } + } + + return apply; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/67ccbf9d/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlCast.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlCast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlCast.java new file mode 100644 index 0000000..7880fb8 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCsdlCast.java @@ -0,0 +1,72 @@ +/* + * 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.client.core.edm.xml.annotation; + +import java.io.IOException; + +import org.apache.olingo.client.core.edm.xml.AbstractClientCsdlEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientCsdlAnnotation; +import org.apache.olingo.commons.api.edm.geo.SRID; +import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCast; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = ClientCsdlCast.CastDeserializer.class) +class ClientCsdlCast extends CsdlCast { + + private static final long serialVersionUID = 3312415984116005313L; + + static class CastDeserializer extends AbstractClientCsdlEdmDeserializer<ClientCsdlCast> { + + @Override + protected ClientCsdlCast doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientCsdlCast cast = new ClientCsdlCast(); + for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) { + final JsonToken token = jp.getCurrentToken(); + if (token == JsonToken.FIELD_NAME) { + if ("Type".equals(jp.getCurrentName())) { + cast.setType(jp.nextTextValue()); + } else if ("Annotation".equals(jp.getCurrentName())) { + cast.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class)); + } else if ("MaxLength".equals(jp.getCurrentName())) { + final String maxLenght = jp.nextTextValue(); + cast.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght)); + } else if ("Precision".equals(jp.getCurrentName())) { + cast.setPrecision(Integer.valueOf(jp.nextTextValue())); + } else if ("Scale".equals(jp.getCurrentName())) { + final String scale = jp.nextTextValue(); + cast.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale)); + } else if ("SRID".equals(jp.getCurrentName())) { + final String srid = jp.nextTextValue(); + if (srid != null) { + cast.setSrid(SRID.valueOf(srid)); + } + } else { + cast.setValue(jp.readValueAs(ClientCsdlDynamicExpression.class)); + } + } + } + return cast; + } + } +}
