[OLINGO-564] Moved client edm classes
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/cbbe3da6 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/cbbe3da6 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/cbbe3da6 Branch: refs/heads/OLINGO-564 Commit: cbbe3da695ffaf629aa1da7b956801bb722e3ddd Parents: 754e23a Author: Michael Bolz <[email protected]> Authored: Fri Apr 24 09:12:05 2015 +0200 Committer: Michael Bolz <[email protected]> Committed: Fri Apr 24 09:12:05 2015 +0200 ---------------------------------------------------------------------- .../retrieve/XMLMetadataRequestImpl.java | 8 +- .../client/core/edm/ClientXMLMetadata.java | 75 ++++ ...tAnnotatableDynamicAnnotationExpression.java | 38 ++ .../xml/AbstractClientAnnotationExpression.java | 49 +++ ...stractClientDynamicAnnotationExpression.java | 356 ++++++++++++++++++ .../edm/xml/AbstractClientEdmDeserializer.java | 4 +- ...tractClientElementOrAttributeExpression.java | 37 ++ .../client/core/edm/xml/ClientAction.java | 2 +- .../client/core/edm/xml/ClientActionImport.java | 2 +- .../client/core/edm/xml/ClientAnnotation.java | 3 +- .../core/edm/xml/ClientAnnotationPath.java | 27 ++ .../client/core/edm/xml/ClientAnnotations.java | 2 +- .../olingo/client/core/edm/xml/ClientApply.java | 80 +++++ .../olingo/client/core/edm/xml/ClientCast.java | 137 +++++++ .../client/core/edm/xml/ClientCollection.java | 64 ++++ .../client/core/edm/xml/ClientComplexType.java | 2 +- .../xml/ClientConstantAnnotationExpression.java | 52 +++ .../client/core/edm/xml/ClientDataServices.java | 2 +- .../core/edm/xml/ClientEntityContainer.java | 2 +- .../client/core/edm/xml/ClientEntityKey.java | 2 +- .../client/core/edm/xml/ClientEntitySet.java | 2 +- .../client/core/edm/xml/ClientEntityType.java | 2 +- .../client/core/edm/xml/ClientEnumMember.java | 2 +- .../client/core/edm/xml/ClientEnumType.java | 2 +- .../client/core/edm/xml/ClientFunction.java | 2 +- .../core/edm/xml/ClientFunctionImport.java | 2 +- .../olingo/client/core/edm/xml/ClientIf.java | 61 ++++ .../client/core/edm/xml/ClientInclude.java | 2 +- .../core/edm/xml/ClientIncludeAnnotations.java | 2 +- .../olingo/client/core/edm/xml/ClientIsOf.java | 136 +++++++ .../core/edm/xml/ClientLabeledElement.java | 79 ++++ .../edm/xml/ClientLabeledElementReference.java | 28 ++ .../core/edm/xml/ClientNavigationProperty.java | 2 +- .../xml/ClientNavigationPropertyBinding.java | 2 +- .../edm/xml/ClientNavigationPropertyPath.java | 28 ++ .../olingo/client/core/edm/xml/ClientNot.java | 39 ++ .../olingo/client/core/edm/xml/ClientNull.java | 51 +++ .../client/core/edm/xml/ClientOnDelete.java | 2 +- .../client/core/edm/xml/ClientParameter.java | 2 +- .../olingo/client/core/edm/xml/ClientPath.java | 27 ++ .../client/core/edm/xml/ClientProperty.java | 2 +- .../client/core/edm/xml/ClientPropertyPath.java | 27 ++ .../client/core/edm/xml/ClientPropertyRef.java | 2 +- .../core/edm/xml/ClientPropertyValue.java | 80 +++++ .../client/core/edm/xml/ClientRecord.java | 76 ++++ .../client/core/edm/xml/ClientReference.java | 2 +- .../edm/xml/ClientReferentialConstraint.java | 2 +- .../client/core/edm/xml/ClientReturnType.java | 2 +- .../client/core/edm/xml/ClientSchema.java | 2 +- .../client/core/edm/xml/ClientSingleton.java | 2 +- .../olingo/client/core/edm/xml/ClientTerm.java | 2 +- ...tTwoParamsOpDynamicAnnotationExpression.java | 62 ++++ .../core/edm/xml/ClientTypeDefinition.java | 2 +- .../client/core/edm/xml/ClientUrlRef.java | 65 ++++ .../client/core/edm/xml/ClientXMLMetadata.java | 75 ---- ...tAnnotatableDynamicAnnotationExpression.java | 38 -- .../AbstractClientAnnotationExpression.java | 49 --- ...stractClientDynamicAnnotationExpression.java | 357 ------------------- ...tractClientElementOrAttributeExpression.java | 37 -- .../xml/annotation/ClientAnnotationPath.java | 27 -- .../core/edm/xml/annotation/ClientApply.java | 82 ----- .../core/edm/xml/annotation/ClientCast.java | 139 -------- .../edm/xml/annotation/ClientCollection.java | 65 ---- .../ClientConstantAnnotationExpression.java | 52 --- .../core/edm/xml/annotation/ClientIf.java | 61 ---- .../core/edm/xml/annotation/ClientIsOf.java | 138 ------- .../xml/annotation/ClientLabeledElement.java | 81 ----- .../ClientLabeledElementReference.java | 28 -- .../ClientNavigationPropertyPath.java | 28 -- .../core/edm/xml/annotation/ClientNot.java | 39 -- .../core/edm/xml/annotation/ClientNull.java | 53 --- .../core/edm/xml/annotation/ClientPath.java | 27 -- .../edm/xml/annotation/ClientPropertyPath.java | 27 -- .../edm/xml/annotation/ClientPropertyValue.java | 82 ----- .../core/edm/xml/annotation/ClientRecord.java | 78 ---- ...tTwoParamsOpDynamicAnnotationExpression.java | 62 ---- .../core/edm/xml/annotation/ClientUrlRef.java | 66 ---- .../ClientODataDeserializerImpl.java | 2 +- .../olingo/client/core/uri/URIEscapeTest.java | 4 +- .../client/core/uri/v4/FilterFactoryTest.java | 4 +- .../olingo/client/core/v4/MetadataTest.java | 21 +- 81 files changed, 1721 insertions(+), 1746 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java index 510c9e6..304c1bc 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java @@ -31,8 +31,6 @@ import org.apache.olingo.client.api.edm.xml.Include; import org.apache.olingo.client.api.edm.xml.IncludeAnnotations; import org.apache.olingo.client.api.edm.xml.Reference; import org.apache.olingo.client.api.edm.xml.XMLMetadata; -import org.apache.olingo.client.core.edm.xml.ClientAnnotations; -import org.apache.olingo.client.core.edm.xml.ClientSchema; import org.apache.olingo.commons.api.edm.provider.Annotation; import org.apache.olingo.commons.api.edm.provider.Annotations; import org.apache.olingo.commons.api.edm.provider.Schema; @@ -68,7 +66,7 @@ public class XMLMetadataRequestImpl if (includedSchema != null) { response.getBody().getSchemas().add(includedSchema); if (StringUtils.isNotBlank(include.getAlias())) { - ((ClientSchema) includedSchema).setAlias(include.getAlias()); + includedSchema.setAlias(include.getAlias()); } } } @@ -77,7 +75,7 @@ public class XMLMetadataRequestImpl for (IncludeAnnotations include : reference.getIncludeAnnotations()) { for (Schema schema : includeMetadata.getSchemas()) { // create empty schema that will be fed with edm:Annotations that match the criteria in IncludeAnnotations - final ClientSchema forInclusion = new ClientSchema(); + final Schema forInclusion = new Schema(); forInclusion.setNamespace(schema.getNamespace()); forInclusion.setAlias(schema.getAlias()); @@ -91,7 +89,7 @@ public class XMLMetadataRequestImpl && (StringUtils.isBlank(include.getQualifier()) || include.getQualifier().equals(annotationGroup.getQualifier()))) { - final ClientAnnotations toBeIncluded = new ClientAnnotations(); + final Annotations toBeIncluded = new Annotations(); toBeIncluded.setTarget(annotationGroup.getTarget()); toBeIncluded.setQualifier(annotationGroup.getQualifier()); // only import annotations with terms matching the given TermNamespace http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java new file mode 100644 index 0000000..661750d --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java @@ -0,0 +1,75 @@ +/* + * 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; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; +import org.apache.olingo.client.api.edm.xml.Edmx; +import org.apache.olingo.client.api.edm.xml.Reference; +import org.apache.olingo.client.api.edm.xml.XMLMetadata; +import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem; +import org.apache.olingo.commons.api.edm.provider.Schema; + +/** + * Entry point for access information about EDM metadata. + */ +public class ClientXMLMetadata extends AbstractEdmItem implements XMLMetadata { + + private static final long serialVersionUID = 6025723060298454901L; + protected final Edmx edmx; + + public ClientXMLMetadata(final Edmx edmx) { + this.edmx = edmx; + } + + @Override + public List<Schema> getSchemas() { + return this.edmx.getDataServices().getSchemas(); + } + + @Override + public Schema getSchema(final int index) { + return getSchemas().get(index); + } + + @Override + public Schema getSchema(final String key) { + return getSchemaByNsOrAlias().get(key); + } + + @Override + public Map<String, Schema> getSchemaByNsOrAlias() { + final Map<String, Schema> schemaByNsOrAlias = new HashMap<String, Schema>(); + for (Schema schema : getSchemas()) { + schemaByNsOrAlias.put(schema.getNamespace(), schema); + if (StringUtils.isNotBlank(schema.getAlias())) { + schemaByNsOrAlias.put(schema.getAlias(), schema); + } + } + return schemaByNsOrAlias; + } + + @Override + public List<Reference> getReferences() { + return this.edmx.getReferences(); + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java new file mode 100644 index 0000000..614ca1f --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java @@ -0,0 +1,38 @@ +/* + * 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.Annotatable; +import org.apache.olingo.commons.api.edm.provider.Annotation; + +abstract class AbstractClientAnnotatableDynamicAnnotationExpression + extends AbstractClientDynamicAnnotationExpression implements Annotatable { + + private static final long serialVersionUID = -450668773857358139L; + + private final List<Annotation> annotations = new ArrayList<Annotation>(); + + @Override + public List<Annotation> getAnnotations() { + return annotations; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java new file mode 100644 index 0000000..4bc802f --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java @@ -0,0 +1,49 @@ +/* + * 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.AbstractEdmItem; +import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; + +abstract class AbstractClientAnnotationExpression extends AbstractEdmItem implements AnnotationExpression { + + private static final long serialVersionUID = -4238652997159205377L; + + @Override + public boolean isConstant() { + return this instanceof ConstantAnnotationExpression; + } + + @Override + public ConstantAnnotationExpression asConstant() { + return isConstant() ? (ConstantAnnotationExpression) this : null; + } + + @Override + public boolean isDynamic() { + return this instanceof DynamicAnnotationExpression; + } + + @Override + public DynamicAnnotationExpression asDynamic() { + return isDynamic() ? (DynamicAnnotationExpression) this : null; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java new file mode 100644 index 0000000..8e8440e --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java @@ -0,0 +1,356 @@ +/* + * 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.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 = AbstractClientDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class) +abstract class AbstractClientDynamicAnnotationExpression + extends AbstractClientAnnotationExpression 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 AbstractClientEdmDeserializer<AbstractClientDynamicAnnotationExpression> { + + 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 AbstractClientElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName) + throws JsonParseException { + + try { + @SuppressWarnings("unchecked") + Class<? extends AbstractClientElementOrAttributeExpression> elOrAttrClass = + (Class<? extends AbstractClientElementOrAttributeExpression>) ClassUtils.getClass( + getClass().getPackage().getName() + ".Client" + simpleClassName); + return elOrAttrClass.newInstance(); + } catch (Exception e) { + throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e); + } + } + + private AbstractClientAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException { + AbstractClientAnnotationExpression result; + if (isAnnotationConstExprConstruct(jp)) { + result = parseAnnotationConstExprConstruct(jp); + } else { + result = jp.readValueAs(AbstractClientDynamicAnnotationExpression.class); + } + jp.nextToken(); + + return result; + } + + @Override + protected AbstractClientDynamicAnnotationExpression doDeserialize(final JsonParser jp, + final DeserializationContext ctxt) throws IOException { + + AbstractClientDynamicAnnotationExpression expression = null; + + if ("Not".equals(jp.getCurrentName())) { + final ClientNot not = new ClientNot(); + + jp.nextToken(); + //Search for field name + while (jp.getCurrentToken() != JsonToken.FIELD_NAME) { + jp.nextToken(); + } + not.setExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.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 ClientTwoParamsOpDynamicAnnotationExpression dynExprDoubleParamOp = + new ClientTwoParamsOpDynamicAnnotationExpression(); + 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(AbstractClientDynamicAnnotationExpression.class)); + dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.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 AbstractClientElementOrAttributeExpression elOrAttr = + getElementOrAttributeExpression(jp.getCurrentName()); + elOrAttr.setValue(jp.nextTextValue()); + expression = elOrAttr; + } else if (APPLY.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientApply.class); + } else if (CAST.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientCast.class); + } else if (COLLECTION.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientCollection.class); + } else if (IF.equals(jp.getCurrentName())) { + jp.nextToken(); + jp.nextToken(); + + final ClientIf ifImpl = new ClientIf(); + 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(ClientIsOf.class); + } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientLabeledElement.class); + } else if (NULL.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientNull.class); + } else if (RECORD.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientRecord.class); + } else if (URL_REF.equals(jp.getCurrentName())) { + jp.nextToken(); + expression = jp.readValueAs(ClientUrlRef.class); + } + + return expression; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java index e02c054..5447de6 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java @@ -20,14 +20,12 @@ package org.apache.olingo.client.core.edm.xml; import java.io.IOException; -import org.apache.olingo.client.core.edm.xml.annotation.ClientConstantAnnotationExpression; - 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; -public abstract class AbstractClientEdmDeserializer<T> extends JsonDeserializer<T> { +abstract class AbstractClientEdmDeserializer<T> extends JsonDeserializer<T> { protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException { return ClientConstantAnnotationExpression.Type.fromString(jp.getCurrentName()) != null; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java new file mode 100644 index 0000000..7bcbf90 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java @@ -0,0 +1,37 @@ +/* + * 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 AbstractClientElementOrAttributeExpression extends AbstractClientDynamicAnnotationExpression { + + 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/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java index 57bdad6..ceedc25 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientAction.ActionDeserializer.class) -public class ClientAction extends Action { +class ClientAction extends Action { private static final long serialVersionUID = 5321541275349234088L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java index 8c251f3..4be6305 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.provider.ActionImport; import java.io.IOException; @JsonDeserialize(using = ClientActionImport.ActionImportDeserializer.class) -public class ClientActionImport extends ActionImport { +class ClientActionImport extends ActionImport { private static final long serialVersionUID = 2971468441177647068L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java index 85b866d..cb27d0b 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java @@ -23,13 +23,12 @@ import java.io.IOException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; -import org.apache.olingo.client.core.edm.xml.annotation.AbstractClientDynamicAnnotationExpression; import org.apache.olingo.commons.api.edm.provider.Annotation; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(using = ClientAnnotation.AnnotationDeserializer.class) -public class ClientAnnotation extends Annotation { +class ClientAnnotation extends Annotation { private static final long serialVersionUID = 5464714417411058033L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotationPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotationPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotationPath.java new file mode 100644 index 0000000..7644c03 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotationPath.java @@ -0,0 +1,27 @@ +/* + * 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 ClientAnnotationPath extends AbstractClientElementOrAttributeExpression implements AnnotationPath { + + private static final long serialVersionUID = 5360735207353494466L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java index 55d9cbd..561fcfd 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientAnnotations.AnnotationsDeserializer.class) -public class ClientAnnotations extends Annotations { +class ClientAnnotations extends Annotations { private static final long serialVersionUID = -5961207981571644200L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientApply.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientApply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientApply.java new file mode 100644 index 0000000..9d89fc7 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientApply.java @@ -0,0 +1,80 @@ +/* + * 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 = ClientApply.ApplyDeserializer.class) +class ClientApply extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientApply> { + + @Override + protected ClientApply doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientApply apply = new ClientApply(); + 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(ClientAnnotation.class)); + } else if (isAnnotationConstExprConstruct(jp)) { + apply.getParameters().add(parseAnnotationConstExprConstruct(jp)); + } else { + apply.getParameters().add(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + + return apply; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCast.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCast.java new file mode 100644 index 0000000..2160268 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCast.java @@ -0,0 +1,137 @@ +/* + * 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 = ClientCast.CastDeserializer.class) +class ClientCast extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientCast> { + + @Override + protected ClientCast doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientCast cast = new ClientCast(); + 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(ClientAnnotation.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(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + return cast; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCollection.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCollection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCollection.java new file mode 100644 index 0000000..6dc43a9 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientCollection.java @@ -0,0 +1,64 @@ +/* + * 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 = ClientCollection.CollectionDeserializer.class) +class ClientCollection extends AbstractClientDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientCollection> { + @Override + protected ClientCollection doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientCollection collection = new ClientCollection(); + 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(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + + return collection; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java index ebc0452..875b56f 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientComplexType.ComplexTypeDeserializer.class) -public class ClientComplexType extends ComplexType { +class ClientComplexType extends ComplexType { private static final long serialVersionUID = 4076944306925840115L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientConstantAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientConstantAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientConstantAnnotationExpression.java new file mode 100644 index 0000000..6ff3fd3 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientConstantAnnotationExpression.java @@ -0,0 +1,52 @@ +/* + * 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.ConstantAnnotationExpression; + +class ClientConstantAnnotationExpression + extends AbstractClientAnnotationExpression implements ConstantAnnotationExpression { + + private static final long serialVersionUID = 5618680702707972904L; + + private Type type; + + private String value; + + @Override + public Type getType() { + return type; + } + + @Override + public void setType(final Type type) { + this.type = type; + } + + @Override + public String getValue() { + return value; + } + + @Override + public void setValue(final String value) { + this.value = value; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java index f68c457..3292b34 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java @@ -32,7 +32,7 @@ import org.apache.olingo.commons.api.edm.provider.Schema; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(using = ClientDataServices.DataServicesDeserializer.class) -public class ClientDataServices extends AbstractEdmItem implements DataServices { +class ClientDataServices extends AbstractEdmItem implements DataServices { private static final long serialVersionUID = 4200317286476885204L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java index d91f8d3..6efbf34 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientEntityContainer.EntityContainerDeserializer.class) -public class ClientEntityContainer extends EntityContainer { +class ClientEntityContainer extends EntityContainer { private static final long serialVersionUID = 5631432527646955795L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java index f238699..6e2a137 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java @@ -31,7 +31,7 @@ import org.apache.olingo.commons.api.edm.provider.PropertyRef; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize(using = ClientEntityKey.EntityKeyDeserializer.class) -public class ClientEntityKey extends AbstractEdmItem { +class ClientEntityKey extends AbstractEdmItem { private static final long serialVersionUID = 520227585458843347L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java index 655f80d..11d3cde 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientEntitySet.EntitySetDeserializer.class) -public class ClientEntitySet extends EntitySet { +class ClientEntitySet extends EntitySet { private static final long serialVersionUID = -5553885465204370676L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java index 9089bc9..4e1e7eb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientEntityType.EntityTypeDeserializer.class) -public class ClientEntityType extends EntityType { +class ClientEntityType extends EntityType { private static final long serialVersionUID = -3986417775876689669L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java index af6f64d..603e7fe 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.provider.EnumMember; import java.io.IOException; @JsonDeserialize(using = ClientEnumMember.EnumMemberDeserializer.class) -public class ClientEnumMember extends EnumMember { +class ClientEnumMember extends EnumMember { private static final long serialVersionUID = -6138606817225829791L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java index 284b5c9..4abaebb 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientEnumType.EnumTypeDeserializer.class) -public class ClientEnumType extends EnumType { +class ClientEnumType extends EnumType { private static final long serialVersionUID = 9191189755592743333L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java index c9260f1..7901399 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientFunction.FunctionDeserializer.class) -public class ClientFunction extends Function { +class ClientFunction extends Function { private static final long serialVersionUID = -5494898295282843362L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java index 3a7230f..86bce9c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientFunctionImport.FunctionImportDeserializer.class) -public class ClientFunctionImport extends FunctionImport { +class ClientFunctionImport extends FunctionImport { private static final long serialVersionUID = -1686801084142932402L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIf.java new file mode 100644 index 0000000..26d33e6 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIf.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; + +import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.If; + +class ClientIf extends AbstractClientAnnotatableDynamicAnnotationExpression 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/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java index 01984e0..4bc8075 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java @@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem; import java.io.IOException; @JsonDeserialize(using = ClientInclude.IncludeDeserializer.class) -public class ClientInclude extends AbstractEdmItem implements Include { +class ClientInclude extends AbstractEdmItem implements Include { private static final long serialVersionUID = -5450008299655584221L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java index 4cf80c0..30ddccc 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java @@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem; import java.io.IOException; @JsonDeserialize(using = ClientIncludeAnnotations.IncludeAnnotationsDeserializer.class) -public class ClientIncludeAnnotations extends AbstractEdmItem implements IncludeAnnotations { +class ClientIncludeAnnotations extends AbstractEdmItem implements IncludeAnnotations { private static final long serialVersionUID = -8157841387011422396L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIsOf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIsOf.java new file mode 100644 index 0000000..bae05ac --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIsOf.java @@ -0,0 +1,136 @@ +/* + * 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 = ClientIsOf.IsOfDeserializer.class) +class ClientIsOf extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientIsOf> { + @Override + protected ClientIsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientIsOf isof = new ClientIsOf(); + 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(ClientAnnotation.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(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + return isof; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElement.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElement.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElement.java new file mode 100644 index 0000000..5ae9a89 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElement.java @@ -0,0 +1,79 @@ +/* + * 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 = ClientLabeledElement.LabeledElementDeserializer.class) +class ClientLabeledElement + extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientLabeledElement> { + @Override + protected ClientLabeledElement doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientLabeledElement element = new ClientLabeledElement(); + 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(ClientAnnotation.class)); + } else { + element.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + return element; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElementReference.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElementReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElementReference.java new file mode 100644 index 0000000..e1a6303 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientLabeledElementReference.java @@ -0,0 +1,28 @@ +/* + * 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 ClientLabeledElementReference + extends AbstractClientElementOrAttributeExpression implements LabeledElementReference { + + private static final long serialVersionUID = 7560525604021670529L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java index cea0c83..2c561c7 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientNavigationProperty.NavigationPropertyDeserializer.class) -public class ClientNavigationProperty extends NavigationProperty { +class ClientNavigationProperty extends NavigationProperty { private static final long serialVersionUID = 6240231735592427582L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java index dae72f3..fffe729 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding; import java.io.IOException; @JsonDeserialize(using = ClientNavigationPropertyBinding.NavigationPropertyBindingDeserializer.class) -public class ClientNavigationPropertyBinding extends NavigationPropertyBinding { +class ClientNavigationPropertyBinding extends NavigationPropertyBinding { private static final long serialVersionUID = -7056978592235483660L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyPath.java new file mode 100644 index 0000000..8a3173c --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyPath.java @@ -0,0 +1,28 @@ +/* + * 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 ClientNavigationPropertyPath extends AbstractClientElementOrAttributeExpression + implements NavigationPropertyPath { + + private static final long serialVersionUID = 879840502446301312L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNot.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNot.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNot.java new file mode 100644 index 0000000..eca2b67 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNot.java @@ -0,0 +1,39 @@ +/* + * 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 ClientNot extends AbstractClientDynamicAnnotationExpression 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/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNull.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNull.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNull.java new file mode 100644 index 0000000..950d10c --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNull.java @@ -0,0 +1,51 @@ +/* + * 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 = ClientNull.NullDeserializer.class) +class ClientNull extends AbstractClientAnnotatableDynamicAnnotationExpression implements Null { + + private static final long serialVersionUID = -3148516847180393142L; + + static class NullDeserializer extends AbstractClientEdmDeserializer<ClientNull> { + @Override + protected ClientNull doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientNull _null = new ClientNull(); + 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(ClientAnnotation.class)); + } + } + } + return _null; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java index 398fd58..bd38595 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java @@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.edm.provider.OnDeleteAction; import java.io.IOException; @JsonDeserialize(using = ClientOnDelete.OnDeleteDeserializer.class) -public class ClientOnDelete extends OnDelete { +class ClientOnDelete extends OnDelete { private static final long serialVersionUID = -7130889202653716784L; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cbbe3da6/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java index 34f95cf..be2ecea 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java @@ -30,7 +30,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.IOException; @JsonDeserialize(using = ClientParameter.ParameterDeserializer.class) -public class ClientParameter extends Parameter { +class ClientParameter extends Parameter { private static final long serialVersionUID = 7119478691341167904L;
