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

Strong Liu commented on USERGRID-82:
------------------------------------

ah, running into a problem that I think we need to make a decision:

what I did is trying to find out if there is a immutable property in the PUT 
request payload, and if there is, then throws IllegalArgumentException.

but, what if the immutable property value is the same as the one stored?

for example, get a User entity by id, then update the user entity's 'nickname' 
property, then send a PUT request with the whole User entity (see 
org.apache.usergrid.rest.applications.users.UserResourceIT#nameUpdate).

what should this be response?
clearly, it is not trying to actually *UPDATE* the immutable property

I can see there are two ways to resolve this, but neither of them are perfect 
IMO

1. for every PUT request with immutable property, we load the entity from db, 
then compare each immutable property to see if the request is trying to 
*UPDATE* the value, if it is , then throw exception, but this require we load 
lots of things when considering batch update

2. just remove the immutable property from request payload and continue, this 
is easier, but if the request does intent update an immutable 
property(wrongly), the request would still success

any idea?





> Cannot change custom entity name
> --------------------------------
>
>                 Key: USERGRID-82
>                 URL: https://issues.apache.org/jira/browse/USERGRID-82
>             Project: Usergrid
>          Issue Type: Bug
>          Components: Stack
>            Reporter: Scott Ganyo
>            Assignee: Strong Liu
>             Fix For: 1.1
>
>
> If you have a custom entity and attempt to update the entity's name (via 
> PUT), the system will accept the request and return success (200), but the 
> name will remain unchanged.
> eg. using ugc:
> ugc create foo "name: 'bar'"
> ugc update foo/bar "name: 'baz'"
> (Note: Referencing the entity in the PUT via UUID has the same effect.)



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

Reply via email to