You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Bhargav Golla <bh...@gmail.com> on 2013/09/01 18:54:18 UTC

How to add and remove dependencies

Hello

I am trying to add a dependency to a TODO. It's arguments are supposed to
by like this {"toDoItem":{"value":"XXXX"}}  where XXXX should be some
value. Could I know what should be placed in XXXX place to add a ToDo item
as a dependency? I tried ID of a ToDo item, but it is giving me this
response.
{
    "toDoItem": {
        "value": "http://localhost:8080/restful/objects/TODO/L_18",
        "invalidReason": "Expected a link (because this object's type is
not a value) but found no 'href'"
    },
    "x-ro-invalidReason": "Mandatory"
}

Regards

Bhargav Golla
Developer. Freelancer.
B.E (Hons.) Computer Science
BITS-Pilani
Github <http://www.github.com/bhargavgolla> |
LinkedIN<http://www.linkedin.com/in/bhargavgolla>
 | Website <http://www.bhargavgolla.com/>

Re: How to add and remove dependencies

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Bhargav:

There isn't any URI, unfortunately.... this behaviour is internal to the
Wicket server.

Right now the best you can do (but it would be a lot of work) is to iterate
over the registered services and try to discover the autoComplete action.
 You could then check the metadata ("describedby" link) to confirm it
returns a list of ToDoItems.

Rather than do all that, I think you would be better off, in these last
week and a half, to spend some time getting the PhoneGap packaging sorted
out.  Perhaps that's trivial, I don't know, but I'm sure it would take some
time.

~~~
Dimuthu, Bhargav:

In your code submission for Google, I'd just document a limitation that
invoking actions with reference args is not yet completed (primarily
because the RO spec does not define autocomplete yet).


To make the demo work I suggest you alter the app so that:

public class ToDoItem {

    public ToDoItem add(ToDoItem t) {
        getDependencies().add(t);
        return this;
    }

}


becomes instead something like:

public class ToDoItem {

    public ToDoItem add(@Named("ToDo Item") String description) {
        List<ToDoItem> items = toDoItems.autoComplete(description);
        if(items.size() >0) {
             add(items.get(0));
        } else {
             // I'm not sure if this is in the RO server or not...
             // if so, it would be a Warning header set in the HTTP
response.
             getContainer().warnUser("No matching item found");
        }
        return this;
    }
    private ToDoItem add(ToDoItem t) { ... }


    private ToDoItems toDoItems;
    void injectToDoItems(ToDoItems tdi) { .... {
}


and ditto for remove, etc.


HTH
Dan




On 7 September 2013 19:10, Bhargav Golla <bh...@gmail.com> wrote:

> Looks like Wicket Viewer is fetching all objects. How can I know which URL
> to make a call to to fetch all objects in this context?
>
>  Bhargav Golla
> Developer. Freelancer.
> B.E (Hons.) Computer Science
> BITS-Pilani
> Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla>
>  | Website <http://www.bhargavgolla.com/>
>
>
> On Sat, Sep 7, 2013 at 11:30 PM, Bhargav Golla <bh...@gmail.com>wrote:
>
>> Hi Dan
>>
>> Reopening this for more clarification.
>>
>> On Mon, Sep 2, 2013 at 11:59 PM, Dan Haywood <
>> dan@haywood-associates.co.uk> wrote:
>>
>>>
>>> On 1 September 2013 17:54, Bhargav Golla <bh...@gmail.com>wrote:
>>>
>>>> Hello
>>>>
>>>>
>>> Sorry for the delay in replying, Bhargav... was on vacation.
>>>
>>>
>>>
>>>> I am trying to add a dependency to a TODO. It's arguments are supposed
>>>> to by like this {"toDoItem":{"value":"XXXX"}}  where XXXX should be some
>>>> value.
>>>>
>>>
>>> That's the case for scalar values, but it isn't the case for references
>>> to other objects.
>>>
>>>
>>>
>>>> Could I know what should be placed in XXXX place to add a ToDo item as
>>>> a dependency? I tried ID of a ToDo item, but it is giving me this response.
>>>> {
>>>>     "toDoItem": {
>>>>         "value": "http://localhost:8080/restful/objects/TODO/L_18",
>>>>          "invalidReason": "Expected a link (because this object's type
>>>> is not a value) but found no 'href'"
>>>>     },
>>>>     "x-ro-invalidReason": "Mandatory"
>>>> }
>>>>
>>>>
>>> So, you almost got it right.  As per sec 2.9.2.1 of the RO spec, the
>>> value must be a json-node with a "href", ie:
>>>
>>> { "toDoItem":
>>>     {"value":
>>>         { "href": "http://localhost:8080/restful/objects/TODO/L_18" }
>>>     }
>>> }
>>>
>>>
>>> ~~~
>>> Your next question, I suspect, will be: "how do I know which hrefs to
>>> provide?"  In the Wicket viewer, we have support for the autoComplete
>>> facet, and so render a drop-down.  In the RO spec v1.0, there is no support
>>> currently for autoComplete, so there is no easy way to support it.
>>>
>>> I am working on v1.1. of the spec that defines this capability.  A
>>> couple of ideas for you in the meantime:
>>> - extend the dom application to support choices (this is defined in the
>>> RO spec), and render a drop-down of these
>>>
>> Could you explain this idea about extending DOM application more?
>>
>>>  - cache objects identifiers as they are visited and make them
>>> available in a drop-down (as "recently viewed")
>>> - provide some sort of ability to pin or bookmark objects (eg onto a
>>> "shelf" area) so that they can then be dragged down into the slot
>>> afterwards.
>>>
>>> Dan
>>>
>>>
>>>
>>>
>>>> Regards
>>>>
>>>> Bhargav Golla
>>>> Developer. Freelancer.
>>>> B.E (Hons.) Computer Science
>>>> BITS-Pilani
>>>> Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla>
>>>>  | Website <http://www.bhargavgolla.com/>
>>>>
>>>
>>>
>>
>

Re: How to add and remove dependencies

Posted by Bhargav Golla <bh...@gmail.com>.
Looks like Wicket Viewer is fetching all objects. How can I know which URL
to make a call to to fetch all objects in this context?

Bhargav Golla
Developer. Freelancer.
B.E (Hons.) Computer Science
BITS-Pilani
Github <http://www.github.com/bhargavgolla> |
LinkedIN<http://www.linkedin.com/in/bhargavgolla>
 | Website <http://www.bhargavgolla.com/>


On Sat, Sep 7, 2013 at 11:30 PM, Bhargav Golla <bh...@gmail.com>wrote:

> Hi Dan
>
> Reopening this for more clarification.
>
> On Mon, Sep 2, 2013 at 11:59 PM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>>
>> On 1 September 2013 17:54, Bhargav Golla <bh...@gmail.com> wrote:
>>
>>> Hello
>>>
>>>
>> Sorry for the delay in replying, Bhargav... was on vacation.
>>
>>
>>
>>> I am trying to add a dependency to a TODO. It's arguments are supposed
>>> to by like this {"toDoItem":{"value":"XXXX"}}  where XXXX should be some
>>> value.
>>>
>>
>> That's the case for scalar values, but it isn't the case for references
>> to other objects.
>>
>>
>>
>>> Could I know what should be placed in XXXX place to add a ToDo item as a
>>> dependency? I tried ID of a ToDo item, but it is giving me this response.
>>> {
>>>     "toDoItem": {
>>>         "value": "http://localhost:8080/restful/objects/TODO/L_18",
>>>          "invalidReason": "Expected a link (because this object's type
>>> is not a value) but found no 'href'"
>>>     },
>>>     "x-ro-invalidReason": "Mandatory"
>>> }
>>>
>>>
>> So, you almost got it right.  As per sec 2.9.2.1 of the RO spec, the
>> value must be a json-node with a "href", ie:
>>
>> { "toDoItem":
>>     {"value":
>>         { "href": "http://localhost:8080/restful/objects/TODO/L_18" }
>>     }
>> }
>>
>>
>> ~~~
>> Your next question, I suspect, will be: "how do I know which hrefs to
>> provide?"  In the Wicket viewer, we have support for the autoComplete
>> facet, and so render a drop-down.  In the RO spec v1.0, there is no support
>> currently for autoComplete, so there is no easy way to support it.
>>
>> I am working on v1.1. of the spec that defines this capability.  A couple
>> of ideas for you in the meantime:
>> - extend the dom application to support choices (this is defined in the
>> RO spec), and render a drop-down of these
>>
> Could you explain this idea about extending DOM application more?
>
>>  - cache objects identifiers as they are visited and make them available
>> in a drop-down (as "recently viewed")
>> - provide some sort of ability to pin or bookmark objects (eg onto a
>> "shelf" area) so that they can then be dragged down into the slot
>> afterwards.
>>
>> Dan
>>
>>
>>
>>
>>> Regards
>>>
>>> Bhargav Golla
>>> Developer. Freelancer.
>>> B.E (Hons.) Computer Science
>>> BITS-Pilani
>>> Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla>
>>>  | Website <http://www.bhargavgolla.com/>
>>>
>>
>>
>

Re: How to add and remove dependencies

Posted by Bhargav Golla <bh...@gmail.com>.
Hi Dan

Reopening this for more clarification.

On Mon, Sep 2, 2013 at 11:59 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:

>
> On 1 September 2013 17:54, Bhargav Golla <bh...@gmail.com> wrote:
>
>> Hello
>>
>>
> Sorry for the delay in replying, Bhargav... was on vacation.
>
>
>
>> I am trying to add a dependency to a TODO. It's arguments are supposed to
>> by like this {"toDoItem":{"value":"XXXX"}}  where XXXX should be some
>> value.
>>
>
> That's the case for scalar values, but it isn't the case for references to
> other objects.
>
>
>
>> Could I know what should be placed in XXXX place to add a ToDo item as a
>> dependency? I tried ID of a ToDo item, but it is giving me this response.
>> {
>>     "toDoItem": {
>>         "value": "http://localhost:8080/restful/objects/TODO/L_18",
>>          "invalidReason": "Expected a link (because this object's type is
>> not a value) but found no 'href'"
>>     },
>>     "x-ro-invalidReason": "Mandatory"
>> }
>>
>>
> So, you almost got it right.  As per sec 2.9.2.1 of the RO spec, the value
> must be a json-node with a "href", ie:
>
> { "toDoItem":
>     {"value":
>         { "href": "http://localhost:8080/restful/objects/TODO/L_18" }
>     }
> }
>
>
> ~~~
> Your next question, I suspect, will be: "how do I know which hrefs to
> provide?"  In the Wicket viewer, we have support for the autoComplete
> facet, and so render a drop-down.  In the RO spec v1.0, there is no support
> currently for autoComplete, so there is no easy way to support it.
>
> I am working on v1.1. of the spec that defines this capability.  A couple
> of ideas for you in the meantime:
> - extend the dom application to support choices (this is defined in the RO
> spec), and render a drop-down of these
>
Could you explain this idea about extending DOM application more?

>  - cache objects identifiers as they are visited and make them available
> in a drop-down (as "recently viewed")
> - provide some sort of ability to pin or bookmark objects (eg onto a
> "shelf" area) so that they can then be dragged down into the slot
> afterwards.
>
> Dan
>
>
>
>
>> Regards
>>
>> Bhargav Golla
>> Developer. Freelancer.
>> B.E (Hons.) Computer Science
>> BITS-Pilani
>> Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla>
>>  | Website <http://www.bhargavgolla.com/>
>>
>
>

Re: How to add and remove dependencies

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 1 September 2013 17:54, Bhargav Golla <bh...@gmail.com> wrote:

> Hello
>
>
Sorry for the delay in replying, Bhargav... was on vacation.



> I am trying to add a dependency to a TODO. It's arguments are supposed to
> by like this {"toDoItem":{"value":"XXXX"}}  where XXXX should be some
> value.
>

That's the case for scalar values, but it isn't the case for references to
other objects.



> Could I know what should be placed in XXXX place to add a ToDo item as a
> dependency? I tried ID of a ToDo item, but it is giving me this response.
> {
>     "toDoItem": {
>         "value": "http://localhost:8080/restful/objects/TODO/L_18",
>          "invalidReason": "Expected a link (because this object's type is
> not a value) but found no 'href'"
>     },
>     "x-ro-invalidReason": "Mandatory"
> }
>
>
So, you almost got it right.  As per sec 2.9.2.1 of the RO spec, the value
must be a json-node with a "href", ie:

{ "toDoItem":
    {"value":
        { "href": "http://localhost:8080/restful/objects/TODO/L_18" }
    }
}


~~~
Your next question, I suspect, will be: "how do I know which hrefs to
provide?"  In the Wicket viewer, we have support for the autoComplete
facet, and so render a drop-down.  In the RO spec v1.0, there is no support
currently for autoComplete, so there is no easy way to support it.

I am working on v1.1. of the spec that defines this capability.  A couple
of ideas for you in the meantime:
- extend the dom application to support choices (this is defined in the RO
spec), and render a drop-down of these
- cache objects identifiers as they are visited and make them available in
a drop-down (as "recently viewed")
- provide some sort of ability to pin or bookmark objects (eg onto a
"shelf" area) so that they can then be dragged down into the slot
afterwards.

Dan




> Regards
>
> Bhargav Golla
> Developer. Freelancer.
> B.E (Hons.) Computer Science
> BITS-Pilani
> Github <http://www.github.com/bhargavgolla> | LinkedIN<http://www.linkedin.com/in/bhargavgolla>
>  | Website <http://www.bhargavgolla.com/>
>