Fix for proxy inline entity and entity set retrieving
This commit is contained in:
parent
baf2cd1098
commit
bda51643b1
|
@ -109,7 +109,7 @@ public class FilterTestITCase extends AbstractTestITCase {
|
|||
public void loadWithSelectAndExpand() {
|
||||
final Customer customer = container.getCustomers().getByKey(1);
|
||||
|
||||
// customer.expand("Orders");
|
||||
customer.expand("Orders");
|
||||
customer.select("Orders", "PersonID");
|
||||
|
||||
customer.load();
|
||||
|
|
|
@ -250,7 +250,8 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
|
|||
final StringWriter writer = new StringWriter();
|
||||
try {
|
||||
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
||||
} catch (final ODataSerializerException e) {}
|
||||
} catch (final ODataSerializerException e) {
|
||||
}
|
||||
writer.flush();
|
||||
LOG.debug("EntitySet -> ODataEntitySet:\n{}", writer.toString());
|
||||
}
|
||||
|
@ -308,14 +309,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
|
|||
odataLinked.addLink(new ODataInlineEntity(client.getServiceVersion(),
|
||||
URIUtils.getURI(base, link.getHref()), ODataLinkType.ENTITY_NAVIGATION, link.getTitle(),
|
||||
getODataEntity(new ResWrap<Entity>(
|
||||
inlineEntity.getBaseURI() == null ? base : inlineEntity.getBaseURI(),
|
||||
inlineEntity.getBaseURI() == null ? null : inlineEntity.getBaseURI(),
|
||||
metadataETag,
|
||||
inlineEntity))));
|
||||
} else {
|
||||
odataLinked.addLink(new ODataInlineEntitySet(client.getServiceVersion(),
|
||||
URIUtils.getURI(base, link.getHref()), ODataLinkType.ENTITY_SET_NAVIGATION, link.getTitle(),
|
||||
getODataEntitySet(new ResWrap<EntitySet>(
|
||||
inlineEntitySet.getBaseURI() == null ? base : inlineEntitySet.getBaseURI(),
|
||||
inlineEntitySet.getBaseURI() == null ? null : inlineEntitySet.getBaseURI(),
|
||||
metadataETag,
|
||||
inlineEntitySet))));
|
||||
}
|
||||
|
@ -375,14 +376,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
|
|||
final StringWriter writer = new StringWriter();
|
||||
try {
|
||||
client.getSerializer(ODataFormat.JSON).write(writer, resource.getPayload());
|
||||
} catch (final ODataSerializerException e) {}
|
||||
} catch (final ODataSerializerException e) {
|
||||
}
|
||||
writer.flush();
|
||||
LOG.debug("EntityResource -> ODataEntity:\n{}", writer.toString());
|
||||
}
|
||||
|
||||
final URI base = resource.getContextURL() == null
|
||||
? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
|
||||
|
||||
final EdmType edmType = findType(resource.getContextURL(), resource.getMetadataETag());
|
||||
FullQualifiedName typeName = null;
|
||||
if (resource.getPayload().getType() == null) {
|
||||
|
@ -489,19 +490,19 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
|
|||
.setValue(valuable.asGeospatial())
|
||||
.setType(type == null
|
||||
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(type)
|
||||
|| EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type) ?
|
||||
valuable.asGeospatial().getEdmPrimitiveTypeKind() :
|
||||
EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
|
||||
|| EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type)
|
||||
? valuable.asGeospatial().getEdmPrimitiveTypeKind()
|
||||
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
|
||||
} else if (valuable.isPrimitive() || valuable.getValueType() == null) {
|
||||
value = client.getObjectFactory().newPrimitiveValueBuilder()
|
||||
.setValue(valuable.asPrimitive())
|
||||
.setType(type == null || !EdmPrimitiveType.EDM_NAMESPACE.equals(type.getNamespace()) ? null :
|
||||
EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
|
||||
.setType(type == null || !EdmPrimitiveType.EDM_NAMESPACE.equals(type.getNamespace()) ? null
|
||||
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
|
||||
} else if (valuable.isComplex() || valuable.isLinkedComplex()) {
|
||||
value = client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
|
||||
if (!valuable.isNull()) {
|
||||
final List<Property> properties = valuable.isLinkedComplex() ?
|
||||
valuable.asLinkedComplex().getValue() : valuable.asComplex();
|
||||
final List<Property> properties = valuable.isLinkedComplex()
|
||||
? valuable.asLinkedComplex().getValue() : valuable.asComplex();
|
||||
for (Property property : properties) {
|
||||
value.asComplex().add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
|
|||
if (value == null) {
|
||||
valueType = ValueType.COLLECTION_PRIMITIVE;
|
||||
} else if (value.isPrimitive()) {
|
||||
valueType = value.asPrimitive().toValue() instanceof Geospatial ?
|
||||
ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
|
||||
valueType = value.asPrimitive().toValue() instanceof Geospatial
|
||||
? ValueType.COLLECTION_GEOSPATIAL : ValueType.COLLECTION_PRIMITIVE;
|
||||
} else if (value.isEnum()) {
|
||||
valueType = ValueType.COLLECTION_ENUM;
|
||||
} else if (value.isLinkedComplex()) {
|
||||
|
|
|
@ -53,6 +53,9 @@ public class ContextURL {
|
|||
|
||||
private boolean deltaDeletedLink;
|
||||
|
||||
private ContextURL() {
|
||||
}
|
||||
|
||||
public static ContextURL getInstance(final URI contextURL) {
|
||||
final ContextURL instance = new ContextURL();
|
||||
instance.uri = contextURL;
|
||||
|
@ -193,5 +196,4 @@ public class ContextURL {
|
|||
public String toString() {
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue