Thanks Dan.
I guessed as much,  it is a bit of a learning curve for the developers involved 
(included myself).  

We will change the updateVan() definition and implementation as you've adviced.

Please, could you review the JSON request for me or better still, which JSON 
data will be required for the first argument (van reference) of the revised 
updateVan() method?

Below is my update request JSON Object:

                        "van" : {
                                                                "id":"Van",
                                                                "href" : 
"http://localhost:8080/xxxx-webapp-1.0-SNAPSHOT/restful/objects/Van/XXXXX";, 
???????
                                                                "value":
                                                                { "vanNumber" : 
{
                                                                                
"id" : "vanNumber",
                                                                                
"memberType": "property",
                                                                                
"value" : formData.vanNumber
                                                                },
                                                                "category" : {
                                                                                
"id" : "category",
                                                                                
"memberType" : "property",
                                                                                
"value" : formData.category
                                                                },
                                                                "vanType" : {
                                                                                
id : "vanType",
                                                                                
memberType: "property",
                                                                                
value : formData.type
                                                                },
                                                                "vanStatus" : {
                                                                                
id : "vanStatus",
                                                                                
memberType : "property",
                                                                                
value : formData.status
                                                                },
                                                                "expiryDate" : {
                                                                                
id : "expiryDate",
                                                                                
memberType: "property",
                                                                                
value : formData.expiryDate
                                                                },
                                                                "vanId" : {
                                                                                
id : "vanId",
                                                                                
memberType : "property",
                                                                                
value : formData.vanId
                                                                } }
                                                }
 


-----Original Message-----
From: Dan Haywood [mailto:[email protected]] 
Sent: Thursday, March 13, 2014 1:35 PM
To: users
Subject: Re: Isis AngularJS Client - Update NOT Working

I think you are confusing two separate concepts here...  the updating of a 
reference to a van, vs the creation/update of the van itself.

Before we get into the RO stuff, can we just focus on the domain model.
 The snippets of Java that you've pasted in don't make much sense to me; 
further comments below.



On 13 March 2014 13:21, Tomoloju, Ola <[email protected]> wrote:

>
>

>
> Below is the method definition in the service:
>
>
>
>   /**
>
>      * Update the given van with details.
>
>      *
>
>      * *@param* card
>
>      * Given Van
>
>      */
>
>     @Bookmarkable
>
>     @ActionSemantics(Of.*IDEMPOTENT*)
>
>     @MemberOrder(sequence = "4")
>
>     *public* *final* *void* updateVan(@Named("Van") *final* Van van) {
>
>         container.persist(van);
>
>     }
>
>


>
> Should we update by passing in the object, as done above?
>

This doesn't make much sense to me (at least if it were to be invoked from RO); 
the Van argument would need to be a reference to an already-persisted object, 
but all the method is doing is attempting to then persist the object.




>  Or, should it be similar to createVan(@Named("van Number") 
> *final*String vanNumber,
>
>             @Named("Category") *final*  Constants.CATEGORY category,
>
>             @Named("van Type") *final*  Constants.VAN_TYPES type,
>
>             @Named("van Status") *final*  Constants.STATUS status,
>
>             @Named("Expiry Date") *final* LocalDate expiryDate,
>
>             @Named("van Id") *final* Integer vanId)
>
>
>

This handles only the creation of a van (I presume... you didn't include the 
body).


I suspect what you want is an action that combines these two:

updateVan(@Named("Van") *final* Van van,

            @Named("van Number") *final* String vanNumber,

            @Named("Category") *final*  Constants.CATEGORY category,

            @Named("van Type") *final*  Constants.VAN_TYPES type,

            @Named("van Status") *final*  Constants.STATUS status,

            @Named("Expiry Date") *final* LocalDate expiryDate,

            @Named("van Id") *final* Integer vanId)

the first parameter would be a reference (href) to the existing van, the 
remaining 6 parameters are the new values.  Probably annotate these other 
parameters with @Optional so that they don't all have to be specified...

Does that make sense?

Dan

Reply via email to