You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "fabio martelli (JIRA)" <ji...@apache.org> on 2014/08/09 09:10:11 UTC

[jira] [Commented] (OLINGO-395) Java client should support the deletion based on locally created entity

    [ https://issues.apache.org/jira/browse/OLINGO-395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14091682#comment-14091682 ] 

fabio martelli commented on OLINGO-395:
---------------------------------------

Currently, if you perform a "valid" object create and then, before flush, you perform a delete then both requests will be sent.

I mean, the following code

Order order = getContainer().newEntityInstance(Order.class);
order.setOrderID(1105);
getContainer().getOrders().add(order); // this will generate a create
getContainer().getOrders().delete(order); // this will generate a delete
getContainer().flush();

will generate

POST <service>/Orders
DELETE <service>/Orders(1105)

Without the statement "getContainer().getOrders().add(order)" POST (create) request won't be generated but a single DELETE request will be sent.

Of course, in this case, if order 1105 doesn't exist, delete request will fail (may be, depending on service implementation?).

> Java client should support the deletion based on locally created entity
> -----------------------------------------------------------------------
>
>                 Key: OLINGO-395
>                 URL: https://issues.apache.org/jira/browse/OLINGO-395
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: V4 4.0.0-beta-01
>            Reporter: Challen
>            Assignee: fabio martelli
>             Fix For: V4 4.0.0-beta-01
>
>
> this line of code will issue delete request as expected:
> container.getMe().getDrafts().getMessages().delete("msg3_tobedeleted_chh");
> =======================
> DELETE https://xxxx.yyyy.com/EWS/OData/Me/Drafts/Messages('msg3_tobedeleted_chh') HTTP/1.1
> =======================
> but this locally created entity should (1) also create a DELETE request with the key that has been set, (2) or should immediately throw exception of 'invalid DELETE on the unattached entity' :
> Message msg2 = <locally created entity>;
> msg2.setId("sdfafdsds_chh");
> manager.service.getMe().getDrafts().getMessages().delete(msg2);
> =======================
> EntityContext.attach(EntityInvocationHandler, AttachedEntityStatus) line: 107	
> EntitySetInvocationHandler<T,KEY,EC>.delete(S) line: 266	
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
> Method.invoke(Object, Object...) line: 606	
> EntitySetInvocationHandler<T,KEY,EC>(AbstractInvocationHandler).invokeSelfMethod(Method, Object[]) line: 88	
> EntitySetInvocationHandler<T,KEY,EC>.invoke(Object, Method, Object[]) line: 91	
> $Proxy18.delete(EntityType) line: 
> =======================



--
This message was sent by Atlassian JIRA
(v6.2#6252)