Id, title and description for an item

0 views
Skip to first unread message

bgoetzmann

unread,
Jun 24, 2008, 4:01:30 PM6/24/08
to Mesh4x Discussion
Hello,

In code applicationn when I try to synchronise two feed, I get a
NullPointerException on the execution of the SyncEngine's synchronize
method. The cause comes from the comparaison between of the two
XMLContent instances (equals method) that tries to compares the
properties id, title and description. But the Item instances seems not
have such properties.

I remark that, when I add an Item to a feed with such code:

Element element = makeElement("<payload><texte>Salut !</texte></
payload>");
XMLContent content = new XMLContent("id", "titre", "description",
element);
Item item = new Item(content, new Sync("123", "odelia", new Date(),
false));
feed.addItem(item);

... I get something like:

<item><texte>Salut !</texte><author><name>odelia</name></
author><sx:sync id="123" updates="1" deleted="false"
noconflicts="false"><sx:history sequence="1" when="Tue, 24 Jun 2008
19:57:01 GMT" by="odelia"/></sx:sync></item>

I have my payload, a author element, but not elements like id, title
or description.
I think it's the origin of my exception !

Can you help on that point?


Thank you,

Bertrand.

bgoetzmann

unread,
Jun 26, 2008, 4:21:33 PM6/26/08
to Mesh4x Discussion
Hello,

I've seen that the FeedWriter.writer(Element, Item) method, in
FeedWriter.java, doesn't write the Item's id, title and description.
It seems we have to correct this method!


Cheers,

Bertrand.

Marcelo Tondato

unread,
Jun 27, 2008, 12:01:06 AM6/27/08
to mes...@googlegroups.com
Hello,
    I fixed this issues. You have the last version in the repository.

Only a summary.

XmlContent is an implementation of IContent, the attribute id is the syncID, this attribute is used for adapters to
associate content with sync (see SplitAdapter), in the case of FeedAdapter this value is in sx:sync element.

Code example:

String syncID = "123";
Element element = makeElement("<payload><texte>Salut !</texte></payload>");
XMLContent content = new XMLContent(syncID, "title", "description", element);
Item item = new Item(content, new Sync(syncID, "odelia", new Date(), false));

The title and description attributes (in the java version) are shortcuts to the payload elements Title and Description.
When a feed is read if the item payload have a title/description its values are set in the xmlContent. 

But, when I read your necessity and real use, I change this idea, Now, FeedWriter write this values in the following way:

Title:
    add Title element if the xmlContent has a title and element does not exists in the payload.
    update Title element if the xmlContent has a title and element exists in the payload.
    delete Title element if the xmlContent has not a title and element exists in the payload.

Description:
    add Description element if the xmlContent has a description and element does not exists in the payload.
    update Description element if the xmlContent has a description and element exists in the payload.
    delete Description element if the xmlContent has not a description and element exists in the payload.

What do you think?

Thanks for your feedback,

JMT

bgoetzmann

unread,
Jul 2, 2008, 7:49:46 AM7/2/08
to Mesh4x Discussion
Thank you !

It's OK for me. And I no more exception when I call SyncEngine's
synchronize.


Cheers,

Bertrand.


On 27 juin, 06:01, "Marcelo Tondato" <jtond...@gmail.com> wrote:
> Hello,
>     I fixed this issues. You have the last version in the repository.
>
> Only a summary.
>
> XmlContent is an implementation of IContent, the attribute id is the syncID,
> this attribute is used for adapters to
> associate content with sync (see SplitAdapter), in the case of FeedAdapter
> this value is in sx:sync element.
>
> Code example:
>
> String *syncID *= "123";
> Element element = makeElement("<payload><texte>Salut !</texte></payload>");
> XMLContent content = new XMLContent*(syncID, *"title", "description",
> element);
> Item item = new Item(content, new Sync*(syncID, *"odelia", new Date(),
> false));
>
> The title and description attributes (in the java version) are shortcuts to
> the payload elements Title and Description.
> When a feed is read if the item payload have a title/description its values
> are set in the xmlContent.
>
> But, when I read your necessity and real use, I change this idea, Now,
> FeedWriter write this values in the following way:
>
> Title:
>     add Title element if the xmlContent has a title and element does not
> exists in the payload.
>     update Title element if the xmlContent has a title and element exists in
> the payload.
>     delete Title element if the xmlContent has not a title and element
> exists in the payload.
>
> Description:
>     add Description element if the xmlContent has a description and element
> does not exists in the payload.
>     update Description element if the xmlContent has a description and
> element exists in the payload.
>     delete Description element if the xmlContent has not a description and
> element exists in the payload.
>
> What do you think?
>
> Thanks for your feedback,
>
> JMT
>
> On Thu, Jun 26, 2008 at 5:21 PM, bgoetzmann <bgoetzm...@sophia.symag.com>
> > > Bertrand.- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -
Reply all
Reply to author
Forward
0 new messages