[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-23 Thread Austin Chau (Google employee)
Basically you need a permanent storage that you manage on your own (not
provided by the API) to maintain the context data for each blip.  That's
what I meant by your own datastore to keep track of the blip ids and
associated data.  Take a look at the sample robot Stocky which has a
persistence layer to remember blips data with JDO on AppeEngine -

http://google-wave-resources.googlecode.com/svn/trunk/samples/extensions/robots/java/stocky/src/robot/


Austin

On Fri, Oct 23, 2009 at 6:22 PM, Smola  wrote:

>
> Keeping track of the IDs for "lookup?"  I have been searching for a
> method in the API which takes a blip ID as an argument and returns the
> blip matching that ID but have been unable to find one.  Am I missing
> something?  Please tell me how this can be done if possible because my
> development has been stalled as a result.
>
>
> Smola
>
>
> On Oct 23, 2:55 am, "Austin Chau (Google employee)"
>  wrote:
> > So yes, when a blip is out of context you would have no way to retrieve
> its
> > document content from the event callback alone.  What can you do now is
> > maintain the context on your own with a datastore backend.  Essentially
> > keeping track of all wavelet and blip ids for lookup.
> > We know that this is not ideal and we are working on this as speak to
> remove
> > the limited context on callback.  Stay tuned for updates.
> > Austin
> >
> > 2009/10/22 Bálint Kriván 
> >
> >
> >
> > > Oh I see...So robot doesn't get the whole wavelet with all of the
> blips,
> > > but the blip of the related event and it's parent.
> > > Ok, but if I would like to access to the rootblip, and I get its id
> with
> > > wavelet.getRootBlipId(), how can I request its content
> > > (getDoucment().getText())?
> (wavelet.getRootBlip().getDocument().getText()
> > > also throws null exception in these cases, so I don't have any idea how
> to
> > > achieve this)
> >
> > > Thanks for your guidance!
> >
> > > On Fri, Oct 23, 2009 at 2:56 AM, Austin Chau (Google employee) <
> > > api.aus...@google.com> wrote:
> >
> > >> Hi,
> > >> To get the root blip id in your scenario -
> >
> > >> wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
> >
> > >> This would work because it does not require "context" of a grandparent
> > >> blip.  The reason that you are getting exception is because the
> context
> > >> associated with an event callback only goes back its immediate parent.
>  So
> > >> in your case if the triggering event is resulted from a grandchild
> blip away
> > >> from root, it will no longer has context to recreate the root blip
> when you
> > >> invoked wavelet.getRootBlip() - thus you will get a null reference.
> >
> > >> Hope it helps,
> > >> Austin
> >
> > >> 2009/10/22 Bálint Kriván 
> >
> > >> Reply to myself and others: I think this is related to
> > >>>http://code.google.com/p/google-wave-resources/issues/detail?id=200.
> >
> > >>> 2009/10/22 Bálint Kriván 
> >
> > >>> Hi!
> >  I have this little chunk of code:
> >
> >   public void debug(RobotMessageBundle bundle, String msg)
> >
> >   {
> >
> >   List list = new ArrayList();
> >
> >   list.add("");
> >
> >   Wavelet wave = bundle.createWavelet(list);
> >
> >    wave.appendBlip().getDocument().append(msg);
> >
> >   }
> >
> >    @Override
> >
> >   public void processEvents(RobotMessageBundle robotMessageBundle) {
> >
> >   Wavelet wavelet = robotMessageBundle.getWavelet();
> >
> >   for (Event event : robotMessageBundle.getEvents()) {
> >
> >   Blip currentBlip = event.getBlip();
> >
> >   switch (event.getType()) {
> >
> >   case BLIP_SUBMITTED:
> >
> >   debug(robotMessageBundle,
> > > String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
> >
> >   }
> >
> >   }
> >
> >   }
> >
> >  So when I add a blip to the wavelet where the robot is, it should
> open a
> >  new wave with me and send the id of the root blip (The top blip in
> the
> >  wavelet).
> >  But if this blip isn't right after the root blip (so the very first
> >  Reply button) then I've got a NullPointerException:
> >
> >  java.lang.NullPointerException
> >
> >    at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
> >
> >    at robot.MainServlet.processEvents(MainServlet.java:46)
> >
> >    at
> > >
> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:8
> 9)
> >
> >    [...]
> >
> >  What is the recommended way to access the very first blip (which is
> I
> >  guess the RootBlip)?
> >
> >  Thanks for your help!
> >
> >  --
> >  Üdv,
> >  Kriván Bálint
> >
> > >>> --
> > >>> Üdv,
> > >>> Kriván Bálint
> >
> > > --
> > > Üdv,
> > > Kriván Bálint
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wa

[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-23 Thread Smola

Keeping track of the IDs for "lookup?"  I have been searching for a
method in the API which takes a blip ID as an argument and returns the
blip matching that ID but have been unable to find one.  Am I missing
something?  Please tell me how this can be done if possible because my
development has been stalled as a result.


Smola


On Oct 23, 2:55 am, "Austin Chau (Google employee)"
 wrote:
> So yes, when a blip is out of context you would have no way to retrieve its
> document content from the event callback alone.  What can you do now is
> maintain the context on your own with a datastore backend.  Essentially
> keeping track of all wavelet and blip ids for lookup.
> We know that this is not ideal and we are working on this as speak to remove
> the limited context on callback.  Stay tuned for updates.
> Austin
>
> 2009/10/22 Bálint Kriván 
>
>
>
> > Oh I see...So robot doesn't get the whole wavelet with all of the blips,
> > but the blip of the related event and it's parent.
> > Ok, but if I would like to access to the rootblip, and I get its id with
> > wavelet.getRootBlipId(), how can I request its content
> > (getDoucment().getText())? (wavelet.getRootBlip().getDocument().getText()
> > also throws null exception in these cases, so I don't have any idea how to
> > achieve this)
>
> > Thanks for your guidance!
>
> > On Fri, Oct 23, 2009 at 2:56 AM, Austin Chau (Google employee) <
> > api.aus...@google.com> wrote:
>
> >> Hi,
> >> To get the root blip id in your scenario -
>
> >> wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
>
> >> This would work because it does not require "context" of a grandparent
> >> blip.  The reason that you are getting exception is because the context
> >> associated with an event callback only goes back its immediate parent.  So
> >> in your case if the triggering event is resulted from a grandchild blip 
> >> away
> >> from root, it will no longer has context to recreate the root blip when you
> >> invoked wavelet.getRootBlip() - thus you will get a null reference.
>
> >> Hope it helps,
> >> Austin
>
> >> 2009/10/22 Bálint Kriván 
>
> >> Reply to myself and others: I think this is related to
> >>>http://code.google.com/p/google-wave-resources/issues/detail?id=200.
>
> >>> 2009/10/22 Bálint Kriván 
>
> >>> Hi!
>  I have this little chunk of code:
>
>   public void debug(RobotMessageBundle bundle, String msg)
>
>   {
>
>   List list = new ArrayList();
>
>   list.add("");
>
>   Wavelet wave = bundle.createWavelet(list);
>
>    wave.appendBlip().getDocument().append(msg);
>
>   }
>
>    @Override
>
>   public void processEvents(RobotMessageBundle robotMessageBundle) {
>
>   Wavelet wavelet = robotMessageBundle.getWavelet();
>
>   for (Event event : robotMessageBundle.getEvents()) {
>
>   Blip currentBlip = event.getBlip();
>
>   switch (event.getType()) {
>
>   case BLIP_SUBMITTED:
>
>   debug(robotMessageBundle,
> > String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
>
>   }
>
>   }
>
>   }
>
>  So when I add a blip to the wavelet where the robot is, it should open a
>  new wave with me and send the id of the root blip (The top blip in the
>  wavelet).
>  But if this blip isn't right after the root blip (so the very first
>  Reply button) then I've got a NullPointerException:
>
>  java.lang.NullPointerException
>
>    at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
>
>    at robot.MainServlet.processEvents(MainServlet.java:46)
>
>    at
> > com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:8
> >  9)
>
>    [...]
>
>  What is the recommended way to access the very first blip (which is I
>  guess the RootBlip)?
>
>  Thanks for your help!
>
>  --
>  Üdv,
>  Kriván Bálint
>
> >>> --
> >>> Üdv,
> >>> Kriván Bálint
>
> > --
> > Üdv,
> > Kriván Bálint
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-23 Thread Bálint Kriván
Thanks for the help!Now I've found a little workaround for the current issue
(I store the needed data in a DataDocument on a wavelet, which is written
when the first blip is created, and the robot can access it all the time),
but I'm tuned for the updates!

On Fri, Oct 23, 2009 at 8:55 AM, Austin Chau (Google employee) <
api.aus...@google.com> wrote:

> So yes, when a blip is out of context you would have no way to retrieve its
> document content from the event callback alone.  What can you do now is
> maintain the context on your own with a datastore backend.  Essentially
> keeping track of all wavelet and blip ids for lookup.
> We know that this is not ideal and we are working on this as speak to
> remove the limited context on callback.  Stay tuned for updates.
>
> Austin
>
> 2009/10/22 Bálint Kriván 
>
>> Oh I see...So robot doesn't get the whole wavelet with all of the blips,
>> but the blip of the related event and it's parent.
>> Ok, but if I would like to access to the rootblip, and I get its id with
>> wavelet.getRootBlipId(), how can I request its content
>> (getDoucment().getText())? (wavelet.getRootBlip().getDocument().getText()
>> also throws null exception in these cases, so I don't have any idea how to
>> achieve this)
>>
>> Thanks for your guidance!
>>
>>
>> On Fri, Oct 23, 2009 at 2:56 AM, Austin Chau (Google employee) <
>> api.aus...@google.com> wrote:
>>
>>> Hi,
>>> To get the root blip id in your scenario -
>>>
>>> wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
>>>
>>> This would work because it does not require "context" of a grandparent
>>> blip.  The reason that you are getting exception is because the context
>>> associated with an event callback only goes back its immediate parent.  So
>>> in your case if the triggering event is resulted from a grandchild blip away
>>> from root, it will no longer has context to recreate the root blip when you
>>> invoked wavelet.getRootBlip() - thus you will get a null reference.
>>>
>>> Hope it helps,
>>> Austin
>>>
>>> 2009/10/22 Bálint Kriván 
>>>
>>> Reply to myself and others: I think this is related to
 http://code.google.com/p/google-wave-resources/issues/detail?id=200 .

 2009/10/22 Bálint Kriván 

 Hi!
> I have this little chunk of code:
>
>  public void debug(RobotMessageBundle bundle, String msg)
>
>  {
>
>  List list = new ArrayList();
>
>  list.add("");
>
>  Wavelet wave = bundle.createWavelet(list);
>
>   wave.appendBlip().getDocument().append(msg);
>
>  }
>
>   @Override
>
>  public void processEvents(RobotMessageBundle robotMessageBundle) {
>
>  Wavelet wavelet = robotMessageBundle.getWavelet();
>
>  for (Event event : robotMessageBundle.getEvents()) {
>
>  Blip currentBlip = event.getBlip();
>
>  switch (event.getType()) {
>
>  case BLIP_SUBMITTED:
>
>  debug(robotMessageBundle,
>> String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
>
>  }
>
>  }
>
>  }
>
>
> So when I add a blip to the wavelet where the robot is, it should open
> a new wave with me and send the id of the root blip (The top blip in the
> wavelet).
> But if this blip isn't right after the root blip (so the very first
> Reply button) then I've got a NullPointerException:
>
> java.lang.NullPointerException
>
>   at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
>
>   at robot.MainServlet.processEvents(MainServlet.java:46)
>
>   at
>> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89)
>
>   [...]
>
>
> What is the recommended way to access the very first blip (which is I
> guess the RootBlip)?
>
> Thanks for your help!
>
> --
> Üdv,
> Kriván Bálint
>



 --
 Üdv,
 Kriván Bálint



>>>
>>>
>>>
>>
>>
>> --
>> Üdv,
>> Kriván Bálint
>>
>>
>>
>
> >
>


-- 
Üdv,
Kriván Bálint

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-22 Thread Austin Chau (Google employee)
So yes, when a blip is out of context you would have no way to retrieve its
document content from the event callback alone.  What can you do now is
maintain the context on your own with a datastore backend.  Essentially
keeping track of all wavelet and blip ids for lookup.
We know that this is not ideal and we are working on this as speak to remove
the limited context on callback.  Stay tuned for updates.
Austin

2009/10/22 Bálint Kriván 

> Oh I see...So robot doesn't get the whole wavelet with all of the blips,
> but the blip of the related event and it's parent.
> Ok, but if I would like to access to the rootblip, and I get its id with
> wavelet.getRootBlipId(), how can I request its content
> (getDoucment().getText())? (wavelet.getRootBlip().getDocument().getText()
> also throws null exception in these cases, so I don't have any idea how to
> achieve this)
>
> Thanks for your guidance!
>
>
> On Fri, Oct 23, 2009 at 2:56 AM, Austin Chau (Google employee) <
> api.aus...@google.com> wrote:
>
>> Hi,
>> To get the root blip id in your scenario -
>>
>> wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
>>
>> This would work because it does not require "context" of a grandparent
>> blip.  The reason that you are getting exception is because the context
>> associated with an event callback only goes back its immediate parent.  So
>> in your case if the triggering event is resulted from a grandchild blip away
>> from root, it will no longer has context to recreate the root blip when you
>> invoked wavelet.getRootBlip() - thus you will get a null reference.
>>
>> Hope it helps,
>> Austin
>>
>> 2009/10/22 Bálint Kriván 
>>
>> Reply to myself and others: I think this is related to
>>> http://code.google.com/p/google-wave-resources/issues/detail?id=200 .
>>>
>>> 2009/10/22 Bálint Kriván 
>>>
>>> Hi!
 I have this little chunk of code:

  public void debug(RobotMessageBundle bundle, String msg)

  {

  List list = new ArrayList();

  list.add("");

  Wavelet wave = bundle.createWavelet(list);

   wave.appendBlip().getDocument().append(msg);

  }

   @Override

  public void processEvents(RobotMessageBundle robotMessageBundle) {

  Wavelet wavelet = robotMessageBundle.getWavelet();

  for (Event event : robotMessageBundle.getEvents()) {

  Blip currentBlip = event.getBlip();

  switch (event.getType()) {

  case BLIP_SUBMITTED:

  debug(robotMessageBundle,
> String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!

  }

  }

  }


 So when I add a blip to the wavelet where the robot is, it should open a
 new wave with me and send the id of the root blip (The top blip in the
 wavelet).
 But if this blip isn't right after the root blip (so the very first
 Reply button) then I've got a NullPointerException:

 java.lang.NullPointerException

   at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)

   at robot.MainServlet.processEvents(MainServlet.java:46)

   at
> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89)

   [...]


 What is the recommended way to access the very first blip (which is I
 guess the RootBlip)?

 Thanks for your help!

 --
 Üdv,
 Kriván Bálint

>>>
>>>
>>>
>>> --
>>> Üdv,
>>> Kriván Bálint
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Üdv,
> Kriván Bálint
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-22 Thread Bálint Kriván
Oh I see...So robot doesn't get the whole wavelet with all of the blips, but
the blip of the related event and it's parent.
Ok, but if I would like to access to the rootblip, and I get its id with
wavelet.getRootBlipId(), how can I request its content
(getDoucment().getText())? (wavelet.getRootBlip().getDocument().getText()
also throws null exception in these cases, so I don't have any idea how to
achieve this)

Thanks for your guidance!

On Fri, Oct 23, 2009 at 2:56 AM, Austin Chau (Google employee) <
api.aus...@google.com> wrote:

> Hi,
> To get the root blip id in your scenario -
>
> wave.appendBlip().getDocument().append(wavelet.getRootBlipId());
>
> This would work because it does not require "context" of a grandparent
> blip.  The reason that you are getting exception is because the context
> associated with an event callback only goes back its immediate parent.  So
> in your case if the triggering event is resulted from a grandchild blip away
> from root, it will no longer has context to recreate the root blip when you
> invoked wavelet.getRootBlip() - thus you will get a null reference.
>
> Hope it helps,
> Austin
>
> 2009/10/22 Bálint Kriván 
>
> Reply to myself and others: I think this is related to
>> http://code.google.com/p/google-wave-resources/issues/detail?id=200 .
>>
>> 2009/10/22 Bálint Kriván 
>>
>> Hi!
>>> I have this little chunk of code:
>>>
>>>  public void debug(RobotMessageBundle bundle, String msg)
>>>
>>>  {
>>>
>>>  List list = new ArrayList();
>>>
>>>  list.add("");
>>>
>>>  Wavelet wave = bundle.createWavelet(list);
>>>
>>>   wave.appendBlip().getDocument().append(msg);
>>>
>>>  }
>>>
>>>   @Override
>>>
>>>  public void processEvents(RobotMessageBundle robotMessageBundle) {
>>>
>>>  Wavelet wavelet = robotMessageBundle.getWavelet();
>>>
>>>  for (Event event : robotMessageBundle.getEvents()) {
>>>
>>>  Blip currentBlip = event.getBlip();
>>>
>>>  switch (event.getType()) {
>>>
>>>  case BLIP_SUBMITTED:
>>>
>>>  debug(robotMessageBundle,
 String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
>>>
>>>  }
>>>
>>>  }
>>>
>>>  }
>>>
>>>
>>> So when I add a blip to the wavelet where the robot is, it should open a
>>> new wave with me and send the id of the root blip (The top blip in the
>>> wavelet).
>>> But if this blip isn't right after the root blip (so the very first Reply
>>> button) then I've got a NullPointerException:
>>>
>>> java.lang.NullPointerException
>>>
>>>   at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
>>>
>>>   at robot.MainServlet.processEvents(MainServlet.java:46)
>>>
>>>   at
 com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89)
>>>
>>>   [...]
>>>
>>>
>>> What is the recommended way to access the very first blip (which is I
>>> guess the RootBlip)?
>>>
>>> Thanks for your help!
>>>
>>> --
>>> Üdv,
>>> Kriván Bálint
>>>
>>
>>
>>
>> --
>> Üdv,
>> Kriván Bálint
>>
>>
>>
>
> >
>


-- 
Üdv,
Kriván Bálint

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-22 Thread Austin Chau (Google employee)
Hi,
To get the root blip id in your scenario -

wave.appendBlip().getDocument().append(wavelet.getRootBlipId());

This would work because it does not require "context" of a grandparent blip.
 The reason that you are getting exception is because the context associated
with an event callback only goes back its immediate parent.  So in your case
if the triggering event is resulted from a grandchild blip away from root,
it will no longer has context to recreate the root blip when you invoked
wavelet.getRootBlip() - thus you will get a null reference.

Hope it helps,
Austin

2009/10/22 Bálint Kriván 

> Reply to myself and others: I think this is related to
> http://code.google.com/p/google-wave-resources/issues/detail?id=200 .
>
> 2009/10/22 Bálint Kriván 
>
> Hi!
>> I have this little chunk of code:
>>
>>  public void debug(RobotMessageBundle bundle, String msg)
>>
>>  {
>>
>>  List list = new ArrayList();
>>
>>  list.add("");
>>
>>  Wavelet wave = bundle.createWavelet(list);
>>
>>   wave.appendBlip().getDocument().append(msg);
>>
>>  }
>>
>>   @Override
>>
>>  public void processEvents(RobotMessageBundle robotMessageBundle) {
>>
>>  Wavelet wavelet = robotMessageBundle.getWavelet();
>>
>>  for (Event event : robotMessageBundle.getEvents()) {
>>
>>  Blip currentBlip = event.getBlip();
>>
>>  switch (event.getType()) {
>>
>>  case BLIP_SUBMITTED:
>>
>>  debug(robotMessageBundle,
>>> String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
>>
>>  }
>>
>>  }
>>
>>  }
>>
>>
>> So when I add a blip to the wavelet where the robot is, it should open a
>> new wave with me and send the id of the root blip (The top blip in the
>> wavelet).
>> But if this blip isn't right after the root blip (so the very first Reply
>> button) then I've got a NullPointerException:
>>
>> java.lang.NullPointerException
>>
>>   at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
>>
>>   at robot.MainServlet.processEvents(MainServlet.java:46)
>>
>>   at
>>> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89)
>>
>>   [...]
>>
>>
>> What is the recommended way to access the very first blip (which is I
>> guess the RootBlip)?
>>
>> Thanks for your help!
>>
>> --
>> Üdv,
>> Kriván Bálint
>>
>
>
>
> --
> Üdv,
> Kriván Bálint
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: Wavelet.getRootBlip() -- Do I understand something wrong?

2009-10-22 Thread Bálint Kriván
Reply to myself and others: I think this is related to
http://code.google.com/p/google-wave-resources/issues/detail?id=200 .

2009/10/22 Bálint Kriván 

> Hi!
> I have this little chunk of code:
>
>  public void debug(RobotMessageBundle bundle, String msg)
>
>  {
>
>  List list = new ArrayList();
>
>  list.add("");
>
>  Wavelet wave = bundle.createWavelet(list);
>
>   wave.appendBlip().getDocument().append(msg);
>
>  }
>
>   @Override
>
>  public void processEvents(RobotMessageBundle robotMessageBundle) {
>
>  Wavelet wavelet = robotMessageBundle.getWavelet();
>
>  for (Event event : robotMessageBundle.getEvents()) {
>
>  Blip currentBlip = event.getBlip();
>
>  switch (event.getType()) {
>
>  case BLIP_SUBMITTED:
>
>  debug(robotMessageBundle,
>> String.valueOf(wavelet.getRootBlip().getBlipId())); // line 46!
>
>  }
>
>  }
>
>  }
>
>
> So when I add a blip to the wavelet where the robot is, it should open a
> new wave with me and send the id of the root blip (The top blip in the
> wavelet).
> But if this blip isn't right after the root blip (so the very first Reply
> button) then I've got a NullPointerException:
>
> java.lang.NullPointerException
>
>   at com.google.wave.api.impl.BlipImpl.getBlipId(BlipImpl.java:56)
>
>   at robot.MainServlet.processEvents(MainServlet.java:46)
>
>   at
>> com.google.wave.api.AbstractRobotServlet.doPost(AbstractRobotServlet.java:89)
>
>   [...]
>
>
> What is the recommended way to access the very first blip (which is I guess
> the RootBlip)?
>
> Thanks for your help!
>
> --
> Üdv,
> Kriván Bálint
>



-- 
Üdv,
Kriván Bálint

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---