http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java deleted file mode 100644 index 18ffb34..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java +++ /dev/null @@ -1,356 +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.annotation; - -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.client.core.edm.xml.AbstractEdmDeserializer; -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 = AbstractDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class) -public abstract class AbstractDynamicAnnotationExpression - extends AbstractAnnotationExpression 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 AbstractEdmDeserializer<AbstractDynamicAnnotationExpression> { - - 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 AbstractElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName) - throws JsonParseException { - - try { - @SuppressWarnings("unchecked") - Class<? extends AbstractElementOrAttributeExpression> elOrAttrClass = - (Class<? extends AbstractElementOrAttributeExpression>) ClassUtils.getClass( - getClass().getPackage().getName() + "." + simpleClassName + "Impl"); - return elOrAttrClass.newInstance(); - } catch (Exception e) { - throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e); - } - } - - private AbstractAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException { - AbstractAnnotationExpression result; - if (isAnnotationConstExprConstruct(jp)) { - result = parseAnnotationConstExprConstruct(jp); - } else { - result = jp.readValueAs(AbstractDynamicAnnotationExpression.class); - } - jp.nextToken(); - - return result; - } - - @Override - protected AbstractDynamicAnnotationExpression doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - - AbstractDynamicAnnotationExpression expression = null; - - if ("Not".equals(jp.getCurrentName())) { - final NotImpl not = new NotImpl(); - - jp.nextToken(); - //Search for field name - while (jp.getCurrentToken() != JsonToken.FIELD_NAME) { - jp.nextToken(); - } - not.setExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.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 TwoParamsOpDynamicAnnotationExpressionImpl dynExprDoubleParamOp = - new TwoParamsOpDynamicAnnotationExpressionImpl(); - 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(AbstractDynamicAnnotationExpression.class)); - dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.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 AbstractElementOrAttributeExpression elOrAttr = getElementOrAttributeExpression(jp.getCurrentName()); - elOrAttr.setValue(jp.nextTextValue()); - expression = elOrAttr; - } else if (APPLY.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(ApplyImpl.class); - } else if (CAST.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(CastImpl.class); - } else if (COLLECTION.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(CollectionImpl.class); - } else if (IF.equals(jp.getCurrentName())) { - jp.nextToken(); - jp.nextToken(); - - final IfImpl ifImpl = new IfImpl(); - 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(IsOfImpl.class); - } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(LabeledElementImpl.class); - } else if (NULL.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(NullImpl.class); - } else if (RECORD.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(RecordImpl.class); - } else if (URL_REF.equals(jp.getCurrentName())) { - jp.nextToken(); - expression = jp.readValueAs(UrlRefImpl.class); - } - - return expression; - } - } -}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java deleted file mode 100644 index 8237fca..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.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.annotation; - -/** - * Groups dynamic expressions that may be provided using element notation or attribute notation. - */ -abstract class AbstractElementOrAttributeExpression extends AbstractDynamicAnnotationExpression { - - 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java deleted file mode 100644 index 86a7503..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.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.annotation; - -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath; - -public class AnnotationPathImpl extends AbstractElementOrAttributeExpression implements AnnotationPath { - - private static final long serialVersionUID = 5360735207353494466L; - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java deleted file mode 100644 index a2733cc..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java +++ /dev/null @@ -1,82 +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.annotation; - -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.client.core.edm.xml.AbstractEdmDeserializer; -import org.apache.olingo.client.core.edm.xml.AnnotationImpl; -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 = ApplyImpl.ApplyDeserializer.class) -public class ApplyImpl extends AbstractAnnotatableDynamicAnnotationExpression 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 AbstractEdmDeserializer<ApplyImpl> { - - @Override - protected ApplyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final ApplyImpl apply = new ApplyImpl(); - 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(AnnotationImpl.class)); - } else if (isAnnotationConstExprConstruct(jp)) { - apply.getParameters().add(parseAnnotationConstExprConstruct(jp)); - } else { - apply.getParameters().add(jp.readValueAs(AbstractDynamicAnnotationExpression.class)); - } - } - } - - return apply; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java deleted file mode 100644 index 8e8f6e3..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java +++ /dev/null @@ -1,139 +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.annotation; - -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.AbstractEdmDeserializer; -import org.apache.olingo.client.core.edm.xml.AnnotationImpl; -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 = CastImpl.CastDeserializer.class) -public class CastImpl extends AbstractAnnotatableDynamicAnnotationExpression 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 AbstractEdmDeserializer<CastImpl> { - - @Override - protected CastImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final CastImpl cast = new CastImpl(); - 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(AnnotationImpl.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(AbstractDynamicAnnotationExpression.class)); - } - } - } - return cast; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java new file mode 100644 index 0000000..1787708 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath; + +public class ClientAnnotationPath extends AbstractClientElementOrAttributeExpression implements AnnotationPath { + + private static final long serialVersionUID = 5360735207353494466L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java new file mode 100644 index 0000000..c731036 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java @@ -0,0 +1,82 @@ +/* + * 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 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.client.core.edm.xml.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java new file mode 100644 index 0000000..f8eb827 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java @@ -0,0 +1,139 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java new file mode 100644 index 0000000..83419a3 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java @@ -0,0 +1,65 @@ +/* + * 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 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.client.core.edm.xml.AbstractClientEdmDeserializer; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java new file mode 100644 index 0000000..13d9e72 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression; + +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java new file mode 100644 index 0000000..4795f14 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.If; + +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java new file mode 100644 index 0000000..ed13dbc --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java @@ -0,0 +1,138 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java new file mode 100644 index 0000000..3273585 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java @@ -0,0 +1,81 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java new file mode 100644 index 0000000..fd19270 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference; + +public class ClientLabeledElementReference + extends AbstractClientElementOrAttributeExpression implements LabeledElementReference { + + private static final long serialVersionUID = 7560525604021670529L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java new file mode 100644 index 0000000..b7be32e --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath; + +public class ClientNavigationPropertyPath extends AbstractClientElementOrAttributeExpression + implements NavigationPropertyPath { + + private static final long serialVersionUID = 879840502446301312L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java new file mode 100644 index 0000000..a85c052 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.Not; + +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java new file mode 100644 index 0000000..d8d5de1 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java @@ -0,0 +1,53 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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) +public 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java new file mode 100644 index 0000000..6dd5518 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.Path; + +public class ClientPath extends AbstractClientElementOrAttributeExpression implements Path { + + private static final long serialVersionUID = 6020168217561402545L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java new file mode 100644 index 0000000..e4804fe --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.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.annotation; + +import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath; + +public class ClientPropertyPath extends AbstractClientElementOrAttributeExpression implements PropertyPath { + + private static final long serialVersionUID = -9133862135834738470L; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java new file mode 100644 index 0000000..97ff40a --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java @@ -0,0 +1,82 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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 = ClientPropertyValue.PropertyValueDeserializer.class) +public class ClientPropertyValue extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientPropertyValue> { + @Override + protected ClientPropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientPropertyValue propValue = new ClientPropertyValue(); + 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(ClientAnnotation.class)); + } else if (isAnnotationConstExprConstruct(jp)) { + propValue.setValue(parseAnnotationConstExprConstruct(jp)); + } else { + propValue.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + return propValue; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java new file mode 100644 index 0000000..744e061 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java @@ -0,0 +1,78 @@ +/* + * 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 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.client.core.edm.xml.AbstractClientEdmDeserializer; +import org.apache.olingo.client.core.edm.xml.ClientAnnotation; +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 = ClientRecord.RecordDeserializer.class) +public class ClientRecord extends AbstractClientAnnotatableDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientRecord> { + @Override + protected ClientRecord doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientRecord record = new ClientRecord(); + 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(ClientAnnotation.class)); + } else { + record.getPropertyValues().add(jp.readValueAs(ClientPropertyValue.class)); + } + } + } + return record; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java new file mode 100644 index 0000000..2c371b6 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression; +import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression; + +public class ClientTwoParamsOpDynamicAnnotationExpression + extends AbstractClientDynamicAnnotationExpression 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java new file mode 100644 index 0000000..82d6d38 --- /dev/null +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java @@ -0,0 +1,66 @@ +/* + * 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 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.AbstractClientEdmDeserializer; +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 = ClientUrlRef.UrlRefDeserializer.class) +public class ClientUrlRef extends AbstractClientDynamicAnnotationExpression 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 AbstractClientEdmDeserializer<ClientUrlRef> { + @Override + protected ClientUrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt) + throws IOException { + final ClientUrlRef urlref = new ClientUrlRef(); + 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(AbstractClientDynamicAnnotationExpression.class)); + } + } + } + return urlref; + } + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java deleted file mode 100644 index 243d0a3..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.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.annotation; - -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.client.core.edm.xml.AbstractEdmDeserializer; -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 = CollectionImpl.CollectionDeserializer.class) -public class CollectionImpl extends AbstractDynamicAnnotationExpression 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 AbstractEdmDeserializer<CollectionImpl> { - @Override - protected CollectionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt) - throws IOException { - final CollectionImpl collection = new CollectionImpl(); - 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(AbstractDynamicAnnotationExpression.class)); - } - } - } - - return collection; - } - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java deleted file mode 100644 index 5e1cc93..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java +++ /dev/null @@ -1,52 +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.annotation; - -import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression; - -public class ConstantAnnotationExpressionImpl - extends AbstractAnnotationExpression 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/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java deleted file mode 100644 index e6dd688..0000000 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.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.annotation; - -import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression; -import org.apache.olingo.commons.api.edm.provider.annotation.If; - -public class IfImpl extends AbstractAnnotatableDynamicAnnotationExpression 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; - } - -}
