if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) { final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null); for (Map.Entry<String, ClientValue> param : parameters.entrySet()) { ClientProperty property = null; newPrimitiveProperty(param.getKey(), param.getValue().asPrimitive()); } else if (param.getValue().isComplex()) { property = odataClient.getObjectFactory(). newComplexProperty(param.getKey(), param.getValue().asComplex()); } else if (param.getValue().isCollection()) { property = odataClient.getObjectFactory(). newCollectionProperty(param.getKey(), param.getValue().asCollection()); } else if (param.getValue().isEnum()) { property = odataClient.getObjectFactory().newEnumProperty(param.getKey(), param.getValue().asEnum());
private static Pair<ClientComplexValue, Class<?>> init( final Class<?> typeRef, final AbstractService<?> service) { final Class<?> complexTypeRef; if (Collection.class.isAssignableFrom(typeRef)) { complexTypeRef = ClassUtils.extractTypeArg(typeRef); } else { complexTypeRef = typeRef; } final ComplexType annotation = complexTypeRef.getAnnotation(ComplexType.class); if (annotation == null) { throw new IllegalArgumentException("Invalid complex type " + complexTypeRef); } final FullQualifiedName typeName = new FullQualifiedName(ClassUtils.getNamespace(complexTypeRef), annotation.name()); final ClientComplexValue complex = service.getClient().getObjectFactory().newComplexValue(typeName.toString()); return new ImmutablePair<ClientComplexValue, Class<?>>(complex, complexTypeRef); }
private ClientLink buildNavigationLink(final String name, final URI uri, final ClientLinkType type) { ClientLink result; switch (type) { case ENTITY_NAVIGATION: result = service.getClient().getObjectFactory().newEntityNavigationLink(name, uri); break; case ENTITY_SET_NAVIGATION: result = service.getClient().getObjectFactory().newEntitySetNavigationLink(name, uri); break; default: throw new IllegalArgumentException("Invalid link type " + type.name()); } return result; }
value = client.getObjectFactory().newCollectionValue(type == null ? null : "Collection(" + type.toString() + ")"); value = client.getObjectFactory().newEnumValue(type == null ? null : type.toString(), valuable.asEnum().toString()); } else if (valuable.isComplex()) { final ClientComplexValue lcValue = client.getObjectFactory().newComplexValue(type == null ? null : type.toString()); } else { if (valuable.isGeospatial()) { value = client.getObjectFactory().newPrimitiveValueBuilder(). setValue(valuable.asGeospatial()). setType(type == null ClientComplexValue cValue = client.getObjectFactory().newComplexValue(type.toString()); value = cValue; } else { value = client.getObjectFactory().newPrimitiveValueBuilder(). setValue(valuable.asPrimitive()). setType(type == null || !EdmPrimitiveType.EDM_NAMESPACE.equals(type.getNamespace()) client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
value = client.getObjectFactory().newCollectionValue(type.getFullQualifiedName().toString()); value = client.getObjectFactory().newEnumValue(type.getFullQualifiedName().toString(), ((Enum<?>) obj).name()); } else { value = client.getObjectFactory().newPrimitiveValueBuilder().setType(type.getPrimitiveTypeKind()).setValue(obj). build();
service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName()); newEntityNavigationLink(delayedUpdate.getSourceName(), targetURI) : service.getClient().getObjectFactory(). newEntitySetNavigationLink(delayedUpdate.getSourceName(), targetURI));
? client.getObjectFactory().newEntity(typeName) : client.getObjectFactory().newEntity(typeName, URIUtils.getURI(base, resource.getPayload().getSelfLink().getHref())); newAssociationLink(link.getTitle(), URIUtils.getURI(base, link.getHref()))); entity.addLink(client.getObjectFactory().newMediaReadLink(link.getTitle(), URIUtils.getURI(base, link.getHref()), link.getType(), link.getMediaETag())); } else { entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), URIUtils.getURI(base, link.getHref()), link.getType(), link.getMediaETag()));
private EntityInvocationHandler( final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.uuid = new EntityUUID(null, typeRef, null); }
value = client.getObjectFactory().newCollectionValue(type == null ? null : "Collection(" + type.toString() + ")"); value = client.getObjectFactory().newEnumValue(type == null ? null : type.toString(), valuable.asEnum().toString()); } else if (valuable.isComplex()) { final ClientComplexValue lcValue = client.getObjectFactory().newComplexValue(type == null ? null : type.toString()); } else { if (valuable.isGeospatial()) { value = client.getObjectFactory().newPrimitiveValueBuilder(). setValue(valuable.asGeospatial()). setType(type == null ClientComplexValue cValue = client.getObjectFactory().newComplexValue(type.toString()); value = cValue; } else { value = client.getObjectFactory().newPrimitiveValueBuilder(). setValue(valuable.asPrimitive()). setType(type == null || !EdmPrimitiveType.EDM_NAMESPACE.equals(type.getNamespace()) client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
value = client.getObjectFactory().newCollectionValue(type.getFullQualifiedName().toString()); value = client.getObjectFactory().newEnumValue(type.getFullQualifiedName().toString(), ((Enum<?>) obj).name()); } else { value = client.getObjectFactory().newPrimitiveValueBuilder().setType(type.getPrimitiveTypeKind()).setValue(obj). build();
service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName()); newEntityNavigationLink(delayedUpdate.getSourceName(), targetURI) : service.getClient().getObjectFactory(). newEntitySetNavigationLink(delayedUpdate.getSourceName(), targetURI));
? client.getObjectFactory().newEntity(typeName) : client.getObjectFactory().newEntity(typeName, URIUtils.getURI(base, resource.getPayload().getSelfLink().getHref())); newAssociationLink(link.getTitle(), URIUtils.getURI(base, link.getHref()))); entity.addLink(client.getObjectFactory().newMediaReadLink(link.getTitle(), URIUtils.getURI(base, link.getHref()), link.getType(), link.getMediaETag())); } else { entity.addLink(client.getObjectFactory().newMediaEditLink(link.getTitle(), URIUtils.getURI(base, link.getHref()), link.getType(), link.getMediaETag()));
private EntityInvocationHandler( final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.uuid = new EntityUUID(null, typeRef, null); }
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) { final ClientEntity tmp = odataClient.getObjectFactory().newEntity(null); for (Map.Entry<String, ClientValue> param : parameters.entrySet()) { ClientProperty property = null; newPrimitiveProperty(param.getKey(), param.getValue().asPrimitive()); } else if (param.getValue().isComplex()) { property = odataClient.getObjectFactory(). newComplexProperty(param.getKey(), param.getValue().asComplex()); } else if (param.getValue().isCollection()) { property = odataClient.getObjectFactory(). newCollectionProperty(param.getKey(), param.getValue().asCollection()); } else if (param.getValue().isEnum()) { property = odataClient.getObjectFactory().newEnumProperty(param.getKey(), param.getValue().asEnum());
private ClientLink buildNavigationLink(final String name, final URI uri, final ClientLinkType type) { ClientLink result; switch (type) { case ENTITY_NAVIGATION: result = service.getClient().getObjectFactory().newEntityNavigationLink(name, uri); break; case ENTITY_SET_NAVIGATION: result = service.getClient().getObjectFactory().newEntitySetNavigationLink(name, uri); break; default: throw new IllegalArgumentException("Invalid link type " + type.name()); } return result; }
private EntityInvocationHandler( final URI entityURI, final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.baseURI = entityURI; this.uri = entityURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString()); this.uuid = new EntityUUID(null, typeRef, null); }
private static Pair<ClientComplexValue, Class<?>> init( final Class<?> typeRef, final AbstractService<?> service) { final Class<?> complexTypeRef; if (Collection.class.isAssignableFrom(typeRef)) { complexTypeRef = ClassUtils.extractTypeArg(typeRef); } else { complexTypeRef = typeRef; } final ComplexType annotation = complexTypeRef.getAnnotation(ComplexType.class); if (annotation == null) { throw new IllegalArgumentException("Invalid complex type " + complexTypeRef); } final FullQualifiedName typeName = new FullQualifiedName(ClassUtils.getNamespace(complexTypeRef), annotation.name()); final ClientComplexValue complex = service.getClient().getObjectFactory().newComplexValue(typeName.toString()); return new ImmutablePair<ClientComplexValue, Class<?>>(complex, complexTypeRef); }
public static ClientProperty getODataProperty( final EdmEnabledODataClient client, final String name, final EdmTypeInfo type, final Object obj) { ClientProperty property; try { if (obj == null) { property = client.getObjectFactory().newPrimitiveProperty(name, null); } else { final EdmTypeInfo valueType = type == null ? guessTypeFromObject(client, obj) : type; final ClientValue value = getODataValue(client, valueType, obj); if (valueType.isCollection()) { property = client.getObjectFactory().newCollectionProperty(name, value.asCollection()); } else if (valueType.isPrimitiveType()) { property = client.getObjectFactory().newPrimitiveProperty(name, value.asPrimitive()); } else if (valueType.isComplexType()) { property = client.getObjectFactory().newComplexProperty(name, value.asComplex()); } else if (valueType.isEnumType()) { property = client.getObjectFactory().newEnumProperty(name, value.asEnum()); } else { throw new UnsupportedOperationException("Usupported object type " + valueType.getFullQualifiedName()); } } return property; } catch (Exception e) { throw new IllegalStateException(e); } }
client.getObjectFactory().newEntityNavigationLink(title, URIUtils.getURI(base, href)) : client.getObjectFactory().newEntitySetNavigationLink(title, URIUtils.getURI(base, href))); } else if (inlineEntity != null) { odataLinked.addLink(createODataInlineEntity(inlineEntity,
private EntityInvocationHandler( final URI entityURI, final Class<?> typeRef, final AbstractService<?> service) { super(typeRef, service); final String name = typeRef.getAnnotation(org.apache.olingo.ext.proxy.api.annotations.EntityType.class).name(); final String namespace = typeRef.getAnnotation(Namespace.class).value(); this.internal = service.getClient().getObjectFactory().newEntity(new FullQualifiedName(namespace, name)); ClientEntity.class.cast(this.internal).setMediaEntity(typeRef.getAnnotation(EntityType.class).hasStream()); this.baseURI = entityURI; this.uri = entityURI == null ? null : getClient().newURIBuilder(baseURI.toASCIIString()); this.uuid = new EntityUUID(null, typeRef, null); }