/** * Adds field to the complex type. * * @param field field to be added. */ @Override public ClientComplexValue add(final ClientProperty field) { fields.put(field.getName(), field); return this; }
/** * Adds field to the complex type. * * @param field field to be added. */ @Override public ClientComplexValue add(final ClientProperty field) { fields.put(field.getName(), field); return this; }
@Override public ClientProperty getProperty(final String name) { ClientProperty result = null; if (StringUtils.isNotBlank(name)) { for (ClientProperty property : getProperties()) { if (name.equals(property.getName())) { result = property; break; } } } return result; }
@Override public ClientProperty getProperty(final String name) { ClientProperty result = null; if (StringUtils.isNotBlank(name)) { for (ClientProperty property : getProperties()) { if (name.equals(property.getName())) { result = property; break; } } } return result; }
public Collection<String> readAdditionalPropertyNames() { final Set<String> res = new HashSet<String>(propertyChanges.keySet()); final Set<String> propertyNames = new HashSet<String>(); for (Method method : typeRef.getMethods()) { final Annotation ann = method.getAnnotation(Property.class); if (ann != null) { final String property = ((Property) ann).name(); propertyNames.add(property); // maybe someone could add a normal attribute to the additional set res.remove(property); } } for (ClientProperty property : getInternalProperties()) { if (!propertyNames.contains(property.getName())) { res.add(property.getName()); } } return res; }
public Collection<String> readAdditionalPropertyNames() { final Set<String> res = new HashSet<String>(propertyChanges.keySet()); final Set<String> propertyNames = new HashSet<String>(); for (Method method : typeRef.getMethods()) { final Annotation ann = method.getAnnotation(Property.class); if (ann != null) { final String property = ((Property) ann).name(); propertyNames.add(property); // maybe someone could add a normal attribute to the additional set res.remove(property); } } for (ClientProperty property : getInternalProperties()) { if (!propertyNames.contains(property.getName())) { res.add(property.getName()); } } return res; }
@Override public Property getProperty(final ClientProperty property) { final Property propertyResource = new Property(); propertyResource.setName(property.getName()); updateValuable(propertyResource, property); annotations(property, propertyResource); return propertyResource; }
@Override public Property getProperty(final ClientProperty property) { final Property propertyResource = new Property(); propertyResource.setName(property.getName()); updateValuable(propertyResource, property); annotations(property, propertyResource); return propertyResource; }
public static Object getKey( final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Class<?> entityTypeRef, final ClientEntity entity) { Object res = null; if (!entity.getProperties().isEmpty()) { final Class<?> keyRef = ClassUtils.getCompoundKeyRef(entityTypeRef); if (keyRef == null) { final ClientProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); if (property != null && property.hasPrimitiveValue()) { res = primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(entityTypeRef, property.getName())); } } else { try { res = keyRef.newInstance(); populate(client, typeHandler, res, CompoundKeyElement.class, entity.getProperties().iterator()); } catch (Exception e) { LOG.error("Error population compound key {}", keyRef.getSimpleName(), e); throw new IllegalArgumentException("Cannot populate compound key"); } } } return res; }
public static Object getKey( final EdmEnabledODataClient client, final EntityInvocationHandler typeHandler, final Class<?> entityTypeRef, final ClientEntity entity) { Object res = null; if (!entity.getProperties().isEmpty()) { final Class<?> keyRef = ClassUtils.getCompoundKeyRef(entityTypeRef); if (keyRef == null) { final ClientProperty property = entity.getProperty(firstValidEntityKey(entityTypeRef)); if (property != null && property.hasPrimitiveValue()) { res = primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(entityTypeRef, property.getName())); } } else { try { res = keyRef.newInstance(); populate(client, typeHandler, res, CompoundKeyElement.class, entity.getProperties().iterator()); } catch (Exception e) { LOG.error("Error population compound key {}", keyRef.getSimpleName(), e); throw new IllegalArgumentException("Cannot populate compound key"); } } } return res; }
final ClientProperty property = propItor.next(); final Method getter = ClassUtils.findGetterByAnnotatedName(typeRef, getterAnn, property.getName()); property.getName(), bean.getClass().getName()); } else { try { } else if (property.hasPrimitiveValue()) { setPropertyValue(bean, getter, primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(typeRef, property.getName()))); } else if (property.hasComplexValue()) { final Object complex = Proxy.newProxyInstance( if (value.isPrimitive()) { collection.add(primitiveValueToObject( value.asPrimitive(), getPropertyClass(typeRef, property.getName()))); } else if (value.isComplex()) { final Object collItem = Proxy.newProxyInstance(
final ClientProperty property = propItor.next(); final Method getter = ClassUtils.findGetterByAnnotatedName(typeRef, getterAnn, property.getName()); property.getName(), bean.getClass().getName()); } else { try { } else if (property.hasPrimitiveValue()) { setPropertyValue(bean, getter, primitiveValueToObject( property.getPrimitiveValue(), getPropertyClass(typeRef, property.getName()))); } else if (property.hasComplexValue()) { final Object complex = Proxy.newProxyInstance( if (value.isPrimitive()) { collection.add(primitiveValueToObject( value.asPrimitive(), getPropertyClass(typeRef, property.getName()))); } else if (value.isComplex()) { final Object collItem = Proxy.newProxyInstance(
@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()); } }
items.add(ProxyUtils.getComplexProxy( service, property.getName(), item, itemRef, if (returnType.isComplexType()) { res = ProxyUtils.getComplexProxy( service, property.getName(), property.getValue().asComplex(), ref, null, null, false); } else { res = CoreUtils.getObjectFromODataValue(property.getValue(), targetRef, service);
items.add(ProxyUtils.getComplexProxy( service, property.getName(), item, itemRef, if (returnType.isComplexType()) { res = ProxyUtils.getComplexProxy( service, property.getName(), property.getValue().asComplex(), ref, null, null, false); } else { res = CoreUtils.getObjectFromODataValue(property.getValue(), targetRef, service);