[OLINGO-328] Merge remote-tracking branch 'origin/master' into olingo328
This commit is contained in:
commit
bf96839818
|
@ -24,7 +24,6 @@ import java.lang.reflect.Type;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
@ -44,8 +43,6 @@ import org.apache.olingo.ext.proxy.utils.CoreUtils;
|
|||
|
||||
public class ComplexInvocationHandler extends AbstractStructuredInvocationHandler {
|
||||
|
||||
private static final long serialVersionUID = 2629912294765040037L;
|
||||
|
||||
private static Pair<ODataComplexValue<? extends CommonODataProperty>, Class<?>> init(
|
||||
final CommonEdmEnabledODataClient<?> client,
|
||||
final Class<?> reference) {
|
||||
|
@ -151,8 +148,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
|
|||
}
|
||||
}
|
||||
|
||||
for (final Iterator<? extends CommonODataProperty> itor = getComplex().iterator(); itor.hasNext();) {
|
||||
final CommonODataProperty property = itor.next();
|
||||
for (final CommonODataProperty property : getComplex()) {
|
||||
if (!propertyNames.contains(property.getName())) {
|
||||
res.add(property.getName());
|
||||
}
|
||||
|
@ -180,10 +176,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
|
|||
if (value == null) {
|
||||
toBeAdded = null;
|
||||
} else if (Collection.class.isAssignableFrom(value.getClass())) {
|
||||
toBeAdded = new ArrayList<Object>();
|
||||
for (Object obj : (Collection) value) {
|
||||
Collection.class.cast(toBeAdded).add(obj);
|
||||
}
|
||||
toBeAdded = new ArrayList<Object>((Collection<? extends Object>) value);
|
||||
} else {
|
||||
toBeAdded = value;
|
||||
}
|
||||
|
|
|
@ -216,6 +216,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Object getValue(final ODataValue value) {
|
||||
Object valueResource;
|
||||
if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
|
||||
|
|
|
@ -122,6 +122,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria
|
|||
return value;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
|
||||
throws XMLStreamException, EdmPrimitiveTypeException {
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class JsonDeserializer implements ODataDeserializer {
|
|||
link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
|
||||
|
||||
EntitySet entitySet = new EntitySetImpl();
|
||||
Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
|
||||
Iterator<JsonNode> entries = inline.elements();
|
||||
while (entries.hasNext()) {
|
||||
entitySet.getEntities().add(
|
||||
entityDeserializer.doDeserialize(entries.next().traverse(codec)).getPayload());
|
||||
|
@ -326,25 +326,24 @@ public class JsonDeserializer implements ODataDeserializer {
|
|||
|
||||
private Object fromComplex(final ObjectNode node, final ObjectCodec codec)
|
||||
throws IOException, EdmPrimitiveTypeException {
|
||||
final Object value = version.compareTo(ODataServiceVersion.V40) < 0 ?
|
||||
new ArrayList<Property>() :
|
||||
new LinkedComplexValueImpl();
|
||||
|
||||
if (value instanceof LinkedComplexValue) {
|
||||
if (version.compareTo(ODataServiceVersion.V40) < 0) {
|
||||
List<Property> properties = new ArrayList<Property>();
|
||||
populate(null, properties, node, codec);
|
||||
return properties;
|
||||
} else {
|
||||
LinkedComplexValue linkComplexValue = new LinkedComplexValueImpl();
|
||||
final Set<String> toRemove = new HashSet<String>();
|
||||
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
|
||||
final Map.Entry<String, JsonNode> field = itor.next();
|
||||
|
||||
links(field, (LinkedComplexValue) value, toRemove, node, codec);
|
||||
links(field, linkComplexValue, toRemove, node, codec);
|
||||
}
|
||||
node.remove(toRemove);
|
||||
|
||||
populate((LinkedComplexValue) value, ((LinkedComplexValue) value).getValue(), node, codec);
|
||||
} else {
|
||||
populate(null, (List<Property>) value, node, codec);
|
||||
populate(linkComplexValue, linkComplexValue.getValue(), node, codec);
|
||||
return linkComplexValue;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private void fromCollection(Valuable valuable, final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
|
||||
|
|
Loading…
Reference in New Issue