http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java deleted file mode 100644 index da1bba1..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java +++ /dev/null @@ -1,163 +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.commons.core.domain; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.olingo.commons.api.domain.ODataAnnotatable; -import org.apache.olingo.commons.api.domain.ODataAnnotation; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataProperty; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; - -public class ODataPropertyImpl implements ODataProperty, ODataAnnotatable, ODataValuable { - - - private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>(); - private final String name; - private final ODataValue value; - private final ODataValuable valuable; - - public ODataPropertyImpl(final String name, final ODataValue value) { - this.name = name; - this.value = value; - this.valuable = new ODataValuableImpl(value); - } - - /** - * Returns property name. - * - * @return property name. - */ - @Override - public String getName() { - return name; - } - - /** - * Returns property value. - * - * @return property value. - */ - @Override - public ODataValue getValue() { - return value; - } - - /** - * Checks if has null value. - * - * @return 'TRUE' if has null value; 'FALSE' otherwise. - */ - @Override - public boolean hasNullValue() { - return value == null || value.isPrimitive() && value.asPrimitive().toValue() == null; - } - - /** - * Checks if has primitive value. - * - * @return 'TRUE' if has primitive value; 'FALSE' otherwise. - */ - @Override - public boolean hasPrimitiveValue() { - return !hasNullValue() && value.isPrimitive(); - } - - /** - * Gets primitive value. - * - * @return primitive value if exists; null otherwise. - */ - @Override - public ODataPrimitiveValue getPrimitiveValue() { - return hasPrimitiveValue() ? value.asPrimitive() : null; - } - - /** - * Checks if has complex value. - * - * @return 'TRUE' if has complex value; 'FALSE' otherwise. - */ - @Override - public boolean hasComplexValue() { - return !hasNullValue() && value.isComplex(); - } - - /** - * Checks if has collection value. - * - * @return 'TRUE' if has collection value; 'FALSE' otherwise. - */ - @Override - public boolean hasCollectionValue() { - return !hasNullValue() && value.isCollection(); - } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public boolean hasEnumValue() { - return valuable.hasEnumValue(); - } - - @Override - public ODataEnumValue getEnumValue() { - return valuable.getEnumValue(); - } - - @Override - public ODataComplexValue getComplexValue() { - return valuable.getComplexValue(); - } - - @Override - public ODataCollectionValue<ODataValue> getCollectionValue() { - return valuable.getCollectionValue(); - } - - @Override - public List<ODataAnnotation> getAnnotations() { - return annotations; - } - - @Override - public String toString() { - return "ODataPropertyImpl{" - + "name=" + getName() - + ",valuable=" + valuable - + ", annotations=" + annotations - + '}'; - } -}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java deleted file mode 100644 index dbb65ee..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataValuableImpl.java +++ /dev/null @@ -1,111 +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.commons.core.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ReflectionToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.olingo.commons.api.domain.ODataCollectionValue; -import org.apache.olingo.commons.api.domain.ODataComplexValue; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataPrimitiveValue; -import org.apache.olingo.commons.api.domain.ODataValuable; -import org.apache.olingo.commons.api.domain.ODataValue; - -public class ODataValuableImpl implements ODataValuable { - - private final ODataValue value; - - public ODataValuableImpl(final ODataValue value) { - this.value = value; - } - - @Override - public ODataValue getValue() { - return value; - } - - @Override - public boolean hasNullValue() { - return value == null; - } - - @Override - public boolean hasPrimitiveValue() { - return !hasNullValue() && value.isPrimitive(); - } - - @Override - public ODataPrimitiveValue getPrimitiveValue() { - return hasPrimitiveValue() ? value.asPrimitive() : null; - } - - @Override - public boolean hasCollectionValue() { - return !hasNullValue() && value.isCollection(); - } - - @Override - public ODataCollectionValue<ODataValue> getCollectionValue() { - return hasCollectionValue() - ? getValue().<ODataValue> asCollection() - : null; - } - - @Override - public boolean hasComplexValue() { - return !hasNullValue() && value.isComplex(); - } - - @Override - public ODataComplexValue getComplexValue() { - return hasComplexValue() - ? getValue().asComplex() - : null; - } - - @Override - public boolean hasEnumValue() { - return !hasNullValue() && getValue().isEnum(); - } - - @Override - public ODataEnumValue getEnumValue() { - return hasEnumValue() - ? getValue().asEnum() - : null; - } - - @Override - public boolean equals(final Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java index 15658ab..7adeb3e 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java @@ -23,38 +23,38 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataEnumValue; -import org.apache.olingo.commons.api.domain.ODataValue; +import org.apache.olingo.commons.api.domain.ClientEnumValue; +import org.apache.olingo.commons.api.domain.ClientValue; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression; import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression; import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression; -import org.apache.olingo.commons.core.domain.ODataCollectionValueImpl; -import org.apache.olingo.commons.core.domain.ODataEnumValueImpl; -import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl; +import org.apache.olingo.commons.core.domain.ClientCollectionValueImpl; +import org.apache.olingo.commons.core.domain.ClientEnumValueImpl; +import org.apache.olingo.commons.core.domain.ClientPrimitiveValueImpl; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotationExpression { - private final ODataValue value; + private final ClientValue value; public EdmConstantAnnotationExpressionImpl(final ConstantAnnotationExpression constExprConstruct) { if (constExprConstruct.getType() == ConstantAnnotationExpression.Type.EnumMember) { - final List<ODataEnumValue> enumValues = new ArrayList<ODataEnumValue>(); + final List<ClientEnumValue> enumValues = new ArrayList<ClientEnumValue>(); String enumTypeName = null; for (String split : StringUtils.split(constExprConstruct.getValue(), ' ')) { final String[] enumSplit = StringUtils.split(split, '/'); enumTypeName = enumSplit[0]; - enumValues.add(new ODataEnumValueImpl(enumSplit[0], enumSplit[1])); + enumValues.add(new ClientEnumValueImpl(enumSplit[0], enumSplit[1])); } if (enumValues.size() == 1) { value = enumValues.get(0); } else { - final ODataCollectionValueImpl<ODataEnumValue> collValue - = new ODataCollectionValueImpl<ODataEnumValue>(enumTypeName); - for (ODataValue enumValue : enumValues) { + final ClientCollectionValueImpl<ClientEnumValue> collValue + = new ClientCollectionValueImpl<ClientEnumValue>(enumTypeName); + for (ClientValue enumValue : enumValues) { collValue.add(enumValue); } value = collValue; @@ -96,7 +96,7 @@ public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotatio default: kind = EdmPrimitiveTypeKind.String; } - final ODataPrimitiveValueImpl.BuilderImpl primitiveValueBuilder = new ODataPrimitiveValueImpl.BuilderImpl(); + final ClientPrimitiveValueImpl.BuilderImpl primitiveValueBuilder = new ClientPrimitiveValueImpl.BuilderImpl(); primitiveValueBuilder.setType(kind); try { final EdmPrimitiveType primitiveType = EdmPrimitiveTypeFactory.getInstance(kind); @@ -133,7 +133,7 @@ public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotatio } @Override - public ODataValue getValue() { + public ClientValue getValue() { return value; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java index 26cafc2..460e367 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java @@ -50,9 +50,9 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataOperation; -import org.apache.olingo.commons.api.domain.ODataPropertyType; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientOperation; +import org.apache.olingo.commons.api.domain.ClientPropertyType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -214,7 +214,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setValue(valueType, values); } - private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo) + private ClientPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo) throws XMLStreamException { XMLEvent child = null; @@ -227,24 +227,24 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - final ODataPropertyType type; + final ClientPropertyType type; if (child == null) { - type = typeInfo == null || typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.ENUM; + type = typeInfo == null || typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE : ClientPropertyType.ENUM; } else { if (child.isStartElement()) { if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; } else if (elementQName.equals(child.asStartElement().getName())) { - type = ODataPropertyType.COLLECTION; + type = ClientPropertyType.COLLECTION; } else { - type = ODataPropertyType.COMPLEX; + type = ClientPropertyType.COMPLEX; } } else if (child.isCharacters()) { type = typeInfo == null || typeInfo.isPrimitiveType() - ? ODataPropertyType.PRIMITIVE - : ODataPropertyType.ENUM; + ? ClientPropertyType.PRIMITIVE + : ClientPropertyType.ENUM; } else { - type = ODataPropertyType.EMPTY; + type = ClientPropertyType.EMPTY; } } @@ -286,9 +286,9 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setType(typeInfo.internal()); } - final ODataPropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) : - typeInfo.isCollection() ? ODataPropertyType.COLLECTION : - typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE : ODataPropertyType.COMPLEX; + final ClientPropertyType propType = typeInfo == null ? guessPropertyType(reader, typeInfo) : + typeInfo.isCollection() ? ClientPropertyType.COLLECTION : + typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE : ClientPropertyType.COMPLEX; if (nullAttr == null) { switch (propType) { @@ -316,10 +316,10 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY); } } else { - valuable.setValue(propType == ODataPropertyType.PRIMITIVE ? ValueType.PRIMITIVE : - propType == ODataPropertyType.ENUM ? ValueType.ENUM : - propType == ODataPropertyType.COMPLEX ? ValueType.COMPLEX : - propType == ODataPropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE, + valuable.setValue(propType == ClientPropertyType.PRIMITIVE ? ValueType.PRIMITIVE : + propType == ClientPropertyType.ENUM ? ValueType.ENUM : + propType == ClientPropertyType.COMPLEX ? ValueType.COMPLEX : + propType == ClientPropertyType.COLLECTION ? ValueType.COLLECTION_PRIMITIVE : ValueType.PRIMITIVE, null); } } @@ -649,7 +649,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria entity.getMediaEditLinks().add(link); } } else if (actionQName.equals(event.asStartElement().getName())) { - final ODataOperation operation = new ODataOperation(); + final ClientOperation operation = new ClientOperation(); final Attribute metadata = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_METADATA)); if (metadata != null) { @@ -800,8 +800,8 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - private ODataError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException { - final ODataError error = new ODataError(); + private ClientError error(final XMLEventReader reader, final StartElement start) throws XMLStreamException { + final ClientError error = new ClientError(); boolean setCode = false; boolean codeSet = false; @@ -851,7 +851,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } @Override - public ODataError toError(final InputStream input) throws ODataDeserializerException { + public ClientError toError(final InputStream input) throws ODataDeserializerException { try { final XMLEventReader reader = getReader(input); final StartElement start = skipBeforeFirstStartElement(reader); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java index 7543eac..52a1bd3 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java @@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.geo.Geospatial; @@ -302,7 +302,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize links(writer, entity.getMediaEditLinks()); if (serverMode) { - for (ODataOperation operation : entity.getOperations()) { + for (ClientOperation operation : entity.getOperations()) { writer.writeStartElement(namespaceMetadata, Constants.ATOM_ELEM_ACTION); writer.writeAttribute(Constants.ATTR_METADATA, operation.getMetadataAnchor()); writer.writeAttribute(Constants.ATTR_TITLE, operation.getTitle()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java index c9c715a..9977b06 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java @@ -43,9 +43,9 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataPropertyType; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientPropertyType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -100,11 +100,11 @@ public class JsonDeserializer implements ODataDeserializer { JsonEntityDeserializer entityDeserializer = new JsonEntityDeserializer(serverMode); if (inline instanceof ObjectNode) { - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); link.setInlineEntity(entityDeserializer.doDeserialize(inline.traverse(codec)).getPayload()); } else if (inline instanceof ArrayNode) { - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); final EntityCollection entitySet = new EntityCollection(); for (final Iterator<JsonNode> entries = inline.elements(); entries.hasNext();) { @@ -136,7 +136,7 @@ public class JsonDeserializer implements ODataDeserializer { if (field.getValue().isValueNode()) { link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); } linked.getNavigationLinks().add(link); @@ -148,7 +148,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_ASSOCIATION_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ASSOCIATION.toString()); + link.setType(ClientLinkType.ASSOCIATION.toString()); linked.getAssociationLinks().add(link); toRemove.add(field.getKey()); @@ -168,7 +168,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); linked.getNavigationLinks().add(link); toRemove.add(setInline(field.getKey(), suffix, tree, codec, link)); @@ -180,7 +180,7 @@ public class JsonDeserializer implements ODataDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_NAVIGATION_LINK_REL + getTitle(field)); link.setHref(node.asText()); - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); linked.getNavigationLinks().add(link); toRemove.add(setInline(field.getKey(), Constants.JSON_BIND_LINK_SUFFIX, tree, codec, link)); } @@ -189,32 +189,32 @@ public class JsonDeserializer implements ODataDeserializer { } } - private Map.Entry<ODataPropertyType, EdmTypeInfo> guessPropertyType(final JsonNode node) { - ODataPropertyType type; + private Map.Entry<ClientPropertyType, EdmTypeInfo> guessPropertyType(final JsonNode node) { + ClientPropertyType type; String typeExpression = null; if (node.isValueNode() || node.isNull()) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; typeExpression = guessPrimitiveTypeKind(node).getFullQualifiedName().toString(); } else if (node.isArray()) { - type = ODataPropertyType.COLLECTION; + type = ClientPropertyType.COLLECTION; if (node.has(0) && node.get(0).isValueNode()) { typeExpression = "Collection(" + guessPrimitiveTypeKind(node.get(0)) + ')'; } } else if (node.isObject()) { if (node.has(Constants.ATTR_TYPE)) { - type = ODataPropertyType.PRIMITIVE; + type = ClientPropertyType.PRIMITIVE; typeExpression = "Edm.Geography" + node.get(Constants.ATTR_TYPE).asText(); } else { - type = ODataPropertyType.COMPLEX; + type = ClientPropertyType.COMPLEX; } } else { - type = ODataPropertyType.EMPTY; + type = ClientPropertyType.EMPTY; } final EdmTypeInfo typeInfo = typeExpression == null ? null : new EdmTypeInfo.Builder().setTypeExpression(typeExpression).build(); - return new SimpleEntry<ODataPropertyType, EdmTypeInfo>(type, typeInfo); + return new SimpleEntry<ClientPropertyType, EdmTypeInfo>(type, typeInfo); } private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) { @@ -337,15 +337,15 @@ public class JsonDeserializer implements ODataDeserializer { EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType()) ? null : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build(); - final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = guessPropertyType(node); + final Map.Entry<ClientPropertyType, EdmTypeInfo> guessed = guessPropertyType(node); if (typeInfo == null) { typeInfo = guessed.getValue(); } - final ODataPropertyType propType = typeInfo == null ? guessed.getKey() - : typeInfo.isCollection() ? ODataPropertyType.COLLECTION - : typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE - : node.isValueNode() ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX; + final ClientPropertyType propType = typeInfo == null ? guessed.getKey() + : typeInfo.isCollection() ? ClientPropertyType.COLLECTION + : typeInfo.isPrimitiveType() ? ClientPropertyType.PRIMITIVE + : node.isValueNode() ? ClientPropertyType.ENUM : ClientPropertyType.COMPLEX; switch (propType) { case COLLECTION: @@ -411,7 +411,7 @@ public class JsonDeserializer implements ODataDeserializer { } @Override - public ODataError toError(final InputStream input) throws ODataDeserializerException { + public ClientError toError(final InputStream input) throws ODataDeserializerException { try { parser = new JsonFactory(new ObjectMapper()).createParser(input); return new JsonODataErrorDeserializer(serverMode).doDeserialize(parser); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java index 703f6b6..47a2598 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java @@ -35,8 +35,8 @@ import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataLinkType; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientLinkType; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.core.edm.EdmTypeInfo; @@ -154,7 +154,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { link.setTitle(getTitle(field)); link.setRel(Constants.NS_MEDIA_EDIT_LINK_REL + getTitle(field)); link.setHref(field.getValue().textValue()); - link.setType(ODataLinkType.MEDIA_EDIT.toString()); + link.setType(ClientLinkType.MEDIA_EDIT.toString()); entity.getMediaEditLinks().add(link); if (tree.has(link.getTitle() + getJSONAnnotation(Constants.JSON_MEDIA_ETAG))) { @@ -174,7 +174,7 @@ public class JsonEntityDeserializer extends JsonDeserializer { } toRemove.add(field.getKey()); } else if (field.getKey().charAt(0) == '#') { - final ODataOperation operation = new ODataOperation(); + final ClientOperation operation = new ClientOperation(); operation.setMetadataAnchor(field.getKey()); final ObjectNode opNode = (ObjectNode) tree.get(field.getKey()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java index b6a32ef..9f58664 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataOperation; +import org.apache.olingo.commons.api.domain.ClientOperation; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.core.edm.EdmTypeInfo; @@ -122,7 +122,7 @@ public class JsonEntitySerializer extends JsonSerializer { } if (serverMode) { - for (ODataOperation operation : entity.getOperations()) { + for (ClientOperation operation : entity.getOperations()) { jgen.writeObjectFieldStart("#" + StringUtils.substringAfterLast(operation.getMetadataAnchor(), "#")); jgen.writeStringField(Constants.ATTR_TITLE, operation.getTitle()); jgen.writeStringField(Constants.ATTR_TARGET, operation.getTarget().toASCIIString()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java index 89252dc..9e225ad 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDeserializer.java @@ -25,8 +25,8 @@ import java.util.Iterator; import java.util.List; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; @@ -38,9 +38,9 @@ public class JsonODataErrorDeserializer extends JsonDeserializer { super(serverMode); } - protected ODataError doDeserialize(final JsonParser parser) throws IOException { + protected ClientError doDeserialize(final JsonParser parser) throws IOException { - final ODataError error = new ODataError(); + final ClientError error = new ClientError(); final ObjectNode tree = parser.getCodec().readTree(parser); if (tree.has(Constants.JSON_ERROR)) { @@ -61,7 +61,7 @@ public class JsonODataErrorDeserializer extends JsonDeserializer { error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue()); } if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) { - List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>(); + List<ClientErrorDetail> details = new ArrayList<ClientErrorDetail>(); JsonODataErrorDetailDeserializer detailDeserializer = new JsonODataErrorDetailDeserializer(serverMode); for (JsonNode jsonNode : errorNode.get(Constants.ERROR_DETAILS)) { details.add(detailDeserializer.doDeserialize(jsonNode.traverse(parser.getCodec())) http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java index 138bad3..0b5cddb 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonODataErrorDetailDeserializer.java @@ -23,7 +23,7 @@ import java.net.URI; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ResWrap; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; @@ -34,9 +34,9 @@ public class JsonODataErrorDetailDeserializer extends JsonDeserializer { super(serverMode); } - protected ResWrap<ODataErrorDetail> doDeserialize(final JsonParser parser) throws IOException { + protected ResWrap<ClientErrorDetail> doDeserialize(final JsonParser parser) throws IOException { - final ODataErrorDetail error = new ODataErrorDetail(); + final ClientErrorDetail error = new ClientErrorDetail(); final JsonNode errorNode = parser.getCodec().readTree(parser); if (errorNode.has(Constants.ERROR_CODE)) { error.setCode(errorNode.get(Constants.ERROR_CODE).textValue()); @@ -53,6 +53,6 @@ public class JsonODataErrorDetailDeserializer extends JsonDeserializer { error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue()); } - return new ResWrap<ODataErrorDetail>((URI) null, null, error); + return new ResWrap<ClientErrorDetail>((URI) null, null, error); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java index 84ed5f7..2eae519 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java @@ -40,7 +40,7 @@ import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.data.Valuable; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.geo.Geospatial; @@ -157,14 +157,14 @@ public class JsonSerializer implements ODataSerializer { valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm()); } - ODataLinkType type = null; + ClientLinkType type = null; try { - type = ODataLinkType.fromString(link.getRel(), link.getType()); + type = ClientLinkType.fromString(link.getRel(), link.getType()); } catch (IllegalArgumentException e) { // ignore } - if (type == ODataLinkType.ENTITY_SET_NAVIGATION) { + if (type == ClientLinkType.ENTITY_SET_NAVIGATION) { final List<String> uris; if (entitySetLinks.containsKey(link.getTitle())) { uris = entitySetLinks.get(link.getTitle()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.java new file mode 100644 index 0000000..f64f0d0 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ClientServerError.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.server.api; + +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; + +/** + * Server error. + */ +public class ClientServerError extends ClientError { + + private Exception exception; + private int statusCode; + private Locale locale; + + /** + * Gets the locale. + * @return the locale for the exception message + */ + public Locale getLocale() { + return locale; + } + + /** + * Sets the locale. + * @return this for method chaining + */ + public ClientServerError setLocale(Locale locale) { + this.locale = locale; + return this; + } + + /** + * Gets the exception. + * @return the exception with its hierarchy + */ + public Exception getException() { + return exception; + } + + /** + * Sets the exception. + * @return this for method chaining + */ + public ClientServerError setException(Exception exception) { + this.exception = exception; + return this; + } + + /** + * Gets the status code. + * @return the status code which this error results in. + */ + public int getStatusCode() { + return statusCode; + } + + /** + * Sets the status code. + * @param statusCode the status code which this error results in + * @return this for method chaining + */ + public ClientServerError setStatusCode(int statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * The value for the code name/value pair is a language-independent string. + * Its value is a service-defined error code. This code serves as a sub-status + * for the HTTP error code specified in the response. MAY be null. + * @return this for method chaining + */ + public ClientServerError setCode(String code) { + super.setCode(code); + return this; + } + + /** + * The value for the message name/value pair MUST be a human-readable, + * language-dependent representation of the error. MUST not be null. + * @return this for method chaining + */ + public ClientServerError setMessage(String message) { + super.setMessage(message); + return this; + } + + /** + * The value for the target name/value pair is the target of the particular error (for example, the name of the + * property in error). MAY be null. + * @return this for method chaining + */ + public ClientServerError setTarget(String target) { + super.setTarget(target); + return this; + } + + /** + * Sets error details. + * @return this for method chaining. + */ + public ClientServerError setDetails(List<ClientErrorDetail> details) { + super.setDetails(details); + return this; + } + + /** + * Sets server defined key-value pairs for debug environment only. + * @return this for method chaining. + */ + public ClientServerError setInnerError(Map<String, String> innerError) { + super.setInnerError(innerError); + return this; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java deleted file mode 100644 index 8b184b2..0000000 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java +++ /dev/null @@ -1,138 +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.server.api; - -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; - -/** - * Server error. - */ -public class ODataServerError extends ODataError { - - private Exception exception; - private int statusCode; - private Locale locale; - - /** - * Gets the locale. - * @return the locale for the exception message - */ - public Locale getLocale() { - return locale; - } - - /** - * Sets the locale. - * @return this for method chaining - */ - public ODataServerError setLocale(Locale locale) { - this.locale = locale; - return this; - } - - /** - * Gets the exception. - * @return the exception with its hierarchy - */ - public Exception getException() { - return exception; - } - - /** - * Sets the exception. - * @return this for method chaining - */ - public ODataServerError setException(Exception exception) { - this.exception = exception; - return this; - } - - /** - * Gets the status code. - * @return the status code which this error results in. - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Sets the status code. - * @param statusCode the status code which this error results in - * @return this for method chaining - */ - public ODataServerError setStatusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - /** - * The value for the code name/value pair is a language-independent string. - * Its value is a service-defined error code. This code serves as a sub-status - * for the HTTP error code specified in the response. MAY be null. - * @return this for method chaining - */ - public ODataServerError setCode(String code) { - super.setCode(code); - return this; - } - - /** - * The value for the message name/value pair MUST be a human-readable, - * language-dependent representation of the error. MUST not be null. - * @return this for method chaining - */ - public ODataServerError setMessage(String message) { - super.setMessage(message); - return this; - } - - /** - * The value for the target name/value pair is the target of the particular error (for example, the name of the - * property in error). MAY be null. - * @return this for method chaining - */ - public ODataServerError setTarget(String target) { - super.setTarget(target); - return this; - } - - /** - * Sets error details. - * @return this for method chaining. - */ - public ODataServerError setDetails(List<ODataErrorDetail> details) { - super.setDetails(details); - return this; - } - - /** - * Sets server defined key-value pairs for debug environment only. - * @return this for method chaining. - */ - public ODataServerError setInnerError(Map<String, String> innerError) { - super.setInnerError(innerError); - return this; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java index f2da16e..fc5e37a 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java @@ -28,7 +28,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; import org.apache.olingo.server.api.serializer.SerializerException; @@ -71,7 +71,7 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce } @Override - public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + public void processError(ODataRequest request, ODataResponse response, ClientServerError serverError, ContentType requestedContentType) { try { ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType)); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java index 145fb5b..af2c116 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java @@ -21,7 +21,7 @@ package org.apache.olingo.server.api.processor; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; /** * Processor which is called if any error/exception occurs inside the library or another processor. @@ -36,6 +36,6 @@ public interface ErrorProcessor extends Processor { * @param serverError the server error * @param responseFormat requested content type after content negotiation */ - public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError, + public void processError(ODataRequest request, ODataResponse response, ClientServerError serverError, ContentType responseFormat); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java index c7f7bba..e822415 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java @@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; /** OData serializer */ @@ -52,7 +52,7 @@ public interface ODataSerializer { * @param error the main error * @return inputStream containing the OData-formatted error */ - SerializerResult error(ODataServerError error) throws SerializerException; + SerializerResult error(ClientServerError error) throws SerializerException; /** * Writes entity-collection data into an InputStream. http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java index b83d383..d7fb341 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ErrorHandler.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.batch.exception.BatchDeserializerException; import org.apache.olingo.server.api.deserializer.DeserializerException; @@ -55,40 +55,40 @@ public class ErrorHandler { public void handleException(Exception e, ODataRequest request, ODataResponse response) { if (e instanceof UriValidationException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriValidationException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriValidationException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserSemanticException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSemanticException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSemanticException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserSyntaxException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSyntaxException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserSyntaxException)e, null); handleServerError(request, response, serverError); } else if(e instanceof UriParserException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((UriParserException)e, null); handleServerError(request, response, serverError); } else if(e instanceof ContentNegotiatorException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((ContentNegotiatorException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((ContentNegotiatorException)e, null); handleServerError(request, response, serverError); } else if(e instanceof SerializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((SerializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((SerializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof BatchDeserializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((BatchDeserializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((BatchDeserializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof DeserializerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((DeserializerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((DeserializerException)e, null); handleServerError(request, response, serverError); } else if(e instanceof ODataHandlerException) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException)e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException)e, null); handleServerError(request, response, serverError); } else { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleServerError(request, response, serverError); } } void handleServerError(final ODataRequest request, final ODataResponse response, - final ODataServerError serverError) { + final ClientServerError serverError) { ContentType requestedContentType; try { UriInfo uriInfo = new Parser().parseUri(request.getRawODataPath(), request.getRawQueryPath(), @@ -103,7 +103,7 @@ public class ErrorHandler { processError(response, serverError, requestedContentType); } - void processError(ODataResponse response, ODataServerError serverError, + void processError(ODataResponse response, ClientServerError serverError, ContentType requestedContentType) { try { ODataSerializer serializer = this.odata.createSerializer(ODataFormat http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java index eb79c07..6bbb706 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntityResponse.java @@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.EntitySerializerOptions; @@ -150,7 +150,7 @@ public class EntityResponse extends ServiceResponse { } } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java index 27675c3..e068bc5 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/EntitySetResponse.java @@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; @@ -82,7 +82,7 @@ public class EntitySetResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java index a644358..4f8719a 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/MetadataResponse.java @@ -23,7 +23,7 @@ import java.util.Map; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -61,7 +61,7 @@ public class MetadataResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java index 86ce46f..3326491 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/PropertyResponse.java @@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; @@ -144,7 +144,7 @@ public class PropertyResponse extends ServiceResponse { writeNoContent(true); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java index 257f8c7..e20299a 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ResponseUtil.java @@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; public class ResponseUtil { public static Property createPrimitive(final String name, final String type, final Object value) { @@ -62,7 +62,7 @@ public class ResponseUtil { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); link.setTitle(navigationPropertyName); entity.getNavigationLinks().add(link); } @@ -73,7 +73,7 @@ public class ResponseUtil { Link link = entity.getNavigationLink(navigationPropertyName); if (link == null) { link = new Link(); - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); link.setTitle(navigationPropertyName); EntityCollection target = new EntityCollection(); target.getEntities().addAll(Arrays.asList(targets)); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java ---------------------------------------------------------------------- diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java index 0f3733c..e8b7419 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/responses/ServiceDocumentResponse.java @@ -23,7 +23,7 @@ import java.util.Map; import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ODataSerializer; @@ -62,7 +62,7 @@ public class ServiceDocumentResponse extends ServiceResponse { visitor.visit(this); } - public void writeError(ODataServerError error) { + public void writeError(ClientServerError error) { try { writeContent(this.serializer.error(error).getContent(), error.getStatusCode(), true); } catch (SerializerException e) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java index e162504..e20ad2a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java @@ -22,7 +22,7 @@ import java.util.Locale; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ODataTranslatedException.ODataErrorMessage; import org.apache.olingo.server.api.deserializer.DeserializerException; @@ -34,14 +34,14 @@ import org.apache.olingo.server.core.uri.validator.UriValidationException; public class ODataExceptionHelper { - public static ODataServerError createServerErrorObject(UriValidationException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriValidationException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey()) || UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) { serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode()); @@ -51,8 +51,8 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(UriParserSyntaxException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserSyntaxException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode( UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT.equals(e.getMessageKey()) ? HttpStatusCode.NOT_ACCEPTABLE.getStatusCode() : @@ -60,20 +60,20 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(UriParserException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(UriParserException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(ContentNegotiatorException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(ContentNegotiatorException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.NOT_ACCEPTABLE.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(ODataHandlerException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(ODataHandlerException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); if (ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED.equals(e.getMessageKey()) || ODataHandlerException.MessageKeys.PROCESSOR_NOT_IMPLEMENTED.equals(e.getMessageKey())) { serverError.setStatusCode(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode()); @@ -88,42 +88,42 @@ public class ODataExceptionHelper { return serverError; } - public static ODataServerError createServerErrorObject(SerializerException e, Locale requestedLocale) { - ODataServerError serverError = basicTranslatedError(e, requestedLocale); + public static ClientServerError createServerErrorObject(SerializerException e, Locale requestedLocale) { + ClientServerError serverError = basicTranslatedError(e, requestedLocale); serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); return serverError; } - public static ODataServerError createServerErrorObject(final DeserializerException e, final Locale requestedLocale) { + public static ClientServerError createServerErrorObject(final DeserializerException e, final Locale requestedLocale) { return basicTranslatedError(e, requestedLocale) .setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode()); } - public static ODataServerError createServerErrorObject(ODataTranslatedException e, Locale requestedLocale) { + public static ClientServerError createServerErrorObject(ODataTranslatedException e, Locale requestedLocale) { return basicTranslatedError(e, requestedLocale); } - public static ODataServerError createServerErrorObject(ODataApplicationException e) { - ODataServerError serverError = basicServerError(e); + public static ClientServerError createServerErrorObject(ODataApplicationException e) { + ClientServerError serverError = basicServerError(e); serverError.setStatusCode(e.getStatusCode()); serverError.setLocale(e.getLocale()); serverError.setCode(e.getODataErrorCode()); return serverError; } - public static ODataServerError createServerErrorObject(Exception e) { - ODataServerError serverError = basicServerError(e); + public static ClientServerError createServerErrorObject(Exception e) { + ClientServerError serverError = basicServerError(e); serverError.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode()); serverError.setLocale(Locale.ENGLISH); return serverError; } - private static ODataServerError basicServerError(Exception e) { - return new ODataServerError().setException(e).setMessage(e.getMessage()); + private static ClientServerError basicServerError(Exception e) { + return new ClientServerError().setException(e).setMessage(e.getMessage()); } - private static ODataServerError basicTranslatedError(ODataTranslatedException e, Locale requestedLocale) { - ODataServerError serverError = basicServerError(e); + private static ClientServerError basicTranslatedError(ODataTranslatedException e, Locale requestedLocale) { + ClientServerError serverError = basicServerError(e); ODataErrorMessage translatedMessage = e.getTranslatedMessage(requestedLocale); serverError.setMessage(translatedMessage.getMessage()); serverError.setLocale(translatedMessage.getLocale()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java index ad0bba0..282504a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java @@ -38,7 +38,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.deserializer.DeserializerException; import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor; @@ -111,34 +111,34 @@ public class ODataHandler { processInternal(request, response); } catch (final UriValidationException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserSemanticException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserSyntaxException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (final UriParserException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ContentNegotiatorException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (SerializerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (DeserializerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ODataHandlerException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null); handleException(request, response, serverError); } catch (ODataApplicationException e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleException(request, response, serverError); } catch (Exception e) { - ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e); + ClientServerError serverError = ODataExceptionHelper.createServerErrorObject(e); handleException(request, response, serverError); } return response; @@ -194,7 +194,7 @@ public class ODataHandler { } public void handleException(final ODataRequest request, final ODataResponse response, - final ODataServerError serverError) { + final ClientServerError serverError) { ErrorProcessor exceptionProcessor; try { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java index 41750c7..f7e7ecf 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java @@ -37,7 +37,7 @@ import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataHttpHandler; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ODataTranslatedException; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.processor.Processor; @@ -80,7 +80,7 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler { private ODataResponse handleException(ODataRequest odRequest, Exception e) { ODataResponse resp = new ODataResponse(); - ODataServerError serverError; + ClientServerError serverError; if (e instanceof ODataHandlerException) { serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException) e, null); } else if (e instanceof ODataTranslatedException) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java index a6c3e8d..e6ab0c9 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java @@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Parameter; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; -import org.apache.olingo.commons.api.domain.ODataLinkType; +import org.apache.olingo.commons.api.domain.ClientLinkType; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityType; @@ -358,14 +358,14 @@ public class ODataJsonDeserializer implements ODataDeserializer { final ExpandTreeBuilder childExpandBuilder = (expandBuilder != null) ? expandBuilder.expand(edmNavigationProperty) : null; if (jsonNode.isArray() && edmNavigationProperty.isCollection()) { - link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_SET_NAVIGATION.toString()); EntityCollection inlineEntitySet = new EntityCollection(); inlineEntitySet.getEntities().addAll(consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode, childExpandBuilder)); link.setInlineEntitySet(inlineEntitySet); } else if (!jsonNode.isArray() && (!jsonNode.isValueNode() || jsonNode.isNull()) && !edmNavigationProperty.isCollection()) { - link.setType(ODataLinkType.ENTITY_NAVIGATION.toString()); + link.setType(ClientLinkType.ENTITY_NAVIGATION.toString()); if (!jsonNode.isNull()) { Entity inlineEntity = consumeEntityNode(edmNavigationProperty.getType(), (ObjectNode) jsonNode, childExpandBuilder); @@ -409,7 +409,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { } bindingLinkStrings.add(arrayValue.asText()); } - bindingLink.setType(ODataLinkType.ENTITY_COLLECTION_BINDING.toString()); + bindingLink.setType(ClientLinkType.ENTITY_COLLECTION_BINDING.toString()); bindingLink.setBindingLinks(bindingLinkStrings); } else { assertIsNullNode(key, jsonNode); @@ -418,7 +418,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key); } bindingLink.setBindingLink(jsonNode.asText()); - bindingLink.setType(ODataLinkType.ENTITY_BINDING.toString()); + bindingLink.setType(ClientLinkType.ENTITY_BINDING.toString()); } return bindingLink; } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java index 14381bb..354c811 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java @@ -21,15 +21,15 @@ package org.apache.olingo.server.core.serializer.json; import java.io.IOException; import org.apache.olingo.commons.api.Constants; -import org.apache.olingo.commons.api.domain.ODataError; -import org.apache.olingo.commons.api.domain.ODataErrorDetail; +import org.apache.olingo.commons.api.domain.ClientError; +import org.apache.olingo.commons.api.domain.ClientErrorDetail; import org.apache.olingo.server.api.serializer.SerializerException; import com.fasterxml.jackson.core.JsonGenerator; public class ODataErrorSerializer { - public void writeErrorDocument(JsonGenerator json, final ODataError error) + public void writeErrorDocument(JsonGenerator json, final ClientError error) throws IOException, SerializerException { if (error == null) { throw new SerializerException("ODataError object MUST NOT be null!", @@ -43,7 +43,7 @@ public class ODataErrorSerializer { if (error.getDetails() != null) { json.writeArrayFieldStart(Constants.ERROR_DETAILS); - for (ODataErrorDetail detail : error.getDetails()) { + for (ClientErrorDetail detail : error.getDetails()) { json.writeStartObject(); writeODataError(json, detail.getCode(), detail.getMessage(), detail.getTarget()); json.writeEndObject(); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c37d4da5/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java index 1de8562..3fe4fcb 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java @@ -43,7 +43,7 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataFormat; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; -import org.apache.olingo.server.api.ODataServerError; +import org.apache.olingo.server.api.ClientServerError; import org.apache.olingo.server.api.ServiceMetadata; import org.apache.olingo.server.api.serializer.ComplexSerializerOptions; import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions; @@ -115,7 +115,7 @@ public class ODataJsonSerializer implements ODataSerializer { } @Override - public SerializerResult error(final ODataServerError error) throws SerializerException { + public SerializerResult error(final ClientServerError error) throws SerializerException { CircleStreamBuffer buffer = new CircleStreamBuffer(); try { JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
