private static Class<?> getEnumTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getEnumTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); }
private static Class<?> getEnumTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getEnumTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); }
public static Class<?> getComplexTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getComplexTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); }
public static Class<?> getComplexTypeRef(final AbstractService<?> service, final ClientValue value) { return service.getComplexTypeClass(value.getTypeName().replaceAll("^Collection\\(", "").replaceAll("\\)$", "")); }
private void annotations(final ClientAnnotatable odataAnnotatable, final Annotatable annotatable) { for (ClientAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { final Annotation annotation = new Annotation(); annotation.setTerm(odataAnnotation.getTerm()); annotation.setType(odataAnnotation.getValue().getTypeName()); updateValuable(annotation, odataAnnotation); annotatable.getAnnotations().add(annotation); } }
private void annotations(final ClientAnnotatable odataAnnotatable, final Annotatable annotatable) { for (ClientAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) { final Annotation annotation = new Annotation(); annotation.setTerm(odataAnnotation.getTerm()); annotation.setType(odataAnnotation.getValue().getTypeName()); updateValuable(annotation, odataAnnotation); annotatable.getAnnotations().add(annotation); } }
collection.add(CoreUtils.enumValueToObject(itemValue.asEnum(), ref)); } else { throw new RuntimeException("Unsupported collection item type " + itemValue.getTypeName());
@SuppressWarnings("unchecked") @Override public Triple<List<T>, URI, List<ClientAnnotation>> fetchPartial(final URI uri, final Class<T> typeRef) { final ODataPropertyRequest<ClientProperty> req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); final ODataRetrieveResponse<ClientProperty> res = req.execute(); final List<T> resItems = new ArrayList<T>(); final ClientProperty property = res.getBody(); if (property != null && property.hasCollectionValue()) { for (ClientValue item : (ClientCollectionValue<ClientValue>) property.getValue()) { Class<?> actualRef = null; if (StringUtils.isNotBlank(item.getTypeName())) { actualRef = service.getComplexTypeClass(item.getTypeName()); } if (actualRef == null) { actualRef = typeRef; } resItems.add((T) getComplex(property.getName(), item, actualRef, null, null, true)); } } return new ImmutableTriple<List<T>, URI, List<ClientAnnotation>>( resItems, null, Collections.<ClientAnnotation> emptyList()); } }
@SuppressWarnings("unchecked") @Override public Triple<List<T>, URI, List<ClientAnnotation>> fetchPartial(final URI uri, final Class<T> typeRef) { final ODataPropertyRequest<ClientProperty> req = getClient().getRetrieveRequestFactory().getPropertyRequest(uri); req.setPrefer(getClient().newPreferences().includeAnnotations("*")); final ODataRetrieveResponse<ClientProperty> res = req.execute(); final List<T> resItems = new ArrayList<T>(); final ClientProperty property = res.getBody(); if (property != null && property.hasCollectionValue()) { for (ClientValue item : (ClientCollectionValue<ClientValue>) property.getValue()) { Class<?> actualRef = null; if (StringUtils.isNotBlank(item.getTypeName())) { actualRef = service.getComplexTypeClass(item.getTypeName()); } if (actualRef == null) { actualRef = typeRef; } resItems.add((T) getComplex(property.getName(), item, actualRef, null, null, true)); } } return new ImmutableTriple<List<T>, URI, List<ClientAnnotation>>( resItems, null, Collections.<ClientAnnotation> emptyList()); } }
collection.add(CoreUtils.enumValueToObject(itemValue.asEnum(), ref)); } else { throw new RuntimeException("Unsupported collection item type " + itemValue.getTypeName());