You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Scott Kurinskas <sk...@gmail.com> on 2007/02/01 07:28:16 UTC

Re: Types SDOs & a changeSummary question or two

Thanks again, this really helps.  As I need the new values, it should be
relatively simple to iterate through the change summary and generate a
datagraph with the delta.  What I cannot figure out after playing around
with the ChangeSummary class is how figure out the "node" that has been
updated.  For example, I have a QuoteList type that could contain thousands
of QuoteTypes, with only one or two being updated.

If I print out the change summary datagraph, an update to node 0 looks like:
<objectChanges key="#//@eRootObject/@QuoteType.0">

What I cannot figure out is how to programmatically get a reference to
either the index of the updated dataobject or the key value.  Once I have
the index, I should be good.

Thanks,
Scott

Re: Types SDOs & a changeSummary question or two

Posted by Scott Kurinskas <sk...@gmail.com>.
Darn it.  Problem solved.  The problem was in line 4.  it should have been:

list = (List)changeSummary.getOldValue(container, property).getValue();

Just like in your e-mail!

Re: Types SDOs & a changeSummary question or two

Posted by Scott Kurinskas <sk...@gmail.com>.
Almost there.  The only problem I have are with deletes and trying to get
the "original" index.  If try the following:

1 if (dobj.getChangeSummary().isDeleted(dobj))   {
2    property = changeSummary.getOldContainmentProperty(dobj);
3    container = changeSummary.getOldContainer(dobj);
4    list = (List)changeSummary.getOldValue(dobj, property).getValue();
5    int index = list.indexOf(dobj);
6    System.out.println("index = " + index);

I get a NPE on line 5.  If I replace line 5 with:

list = container.getList(property);

The index returned is -1.  The XML representation is below.  The index
attribute is correct, but I'm at a loss at how to get it via the APIs.

<objectChanges key="#//@eRootObject">
      <value xsi:type="sdo_1:ChangeSummarySetting" featureName="QuoteType">
        <listChanges index="1" referenceValues="
#//@eChangeSummary/@objectsToAttach.0"/>
      </value>
</objectChanges>

Thanks,
Scott

Re: Types SDOs & a changeSummary question or two

Posted by Yang ZHONG <le...@gmail.com>.
changeSummary.getChangedDataObjects() contains changed DataObjects.
changeSummary.isCreated, changeSummary.isDeleted and
changeSummary.isModofied can be used to distinguish them.

"objectChanges key" uses a path to reference a changed DataObject.
If an index is still desired, here's how to get it:
  Property property = changedDataObject.getContainmentProperty(); //or
changeSummary.getOldContainmentProperty(deletedDataObject)
  DataObject container = changedDataObject.getContainer(); //or
changeSummary.getOldContainer(deletedDataObject)
  List list = container.getList(property); //or
(List)changeSummary.getOldValue(container,property).getValue() for
deletedDataObject
  int index = list.indexOf(changedDataObject);


On 1/31/07, Scott Kurinskas <sk...@gmail.com> wrote:
>
> Thanks again, this really helps.  As I need the new values, it should be
> relatively simple to iterate through the change summary and generate a
> datagraph with the delta.  What I cannot figure out after playing around
> with the ChangeSummary class is how figure out the "node" that has been
> updated.  For example, I have a QuoteList type that could contain
> thousands
> of QuoteTypes, with only one or two being updated.
>
> If I print out the change summary datagraph, an update to node 0 looks
> like:
> <objectChanges key="#//@eRootObject/@QuoteType.0">
>
> What I cannot figure out is how to programmatically get a reference to
> either the index of the updated dataobject or the key value.  Once I have
> the index, I should be good.
>
> Thanks,
> Scott
>



-- 

Yang ZHONG