Sunday, April 27, 2014

Active Data Service with ADF Table component

Hi All,

I have already posted one post on active data service with adf table component and oracle coherence. But in this post will explain ADS without using oracle coherence.

As you all know that ADS is basically a push technology which send data from server to client without any user intervention . However client will send request periodically to server ask for update. Which further configure in adf-config.xml.

The transport has following favor
1-long-polling.
2-polling
3-streamming

This all i wrote in my previously post.Today i will explain some thing new and obviously interesting things.

As you all know ADS support limited number of component , table is one of them .So basically in table it's support only output text which will there in table column. You can not change any table or column related property. Although you can change only out put  related property.

So in output component what property you can changes this is next question ? and answer is very simple,
you can changes following property of output text. (only this property changes make sense)

1-Value (main property )
2-inline style
3-style class.

Ya , you can changes only above three property of output text. And i recommend that do not try to use other component .because it doesn't make much any sense because ADS is only for dashboard kind of application where you can show latest status of any trend.
The main part which i would like to point out here, that way of creating buildActiveDataUpdateEvent event.

Example is
ActiveDataUpdateEvent event =
            ActiveDataEventUtil.buildActiveDataUpdateEvent(ActiveDataEntry.ChangeType.UPDATE,
                                                           getActiveModel().getCurrentChangeCount(),
                                                           new Object[] { rowKey },
                                                           new Object[] { null },
                                                           new String[] { "name",
                                                                          "idInlineStyle",
                                                                          "nameInlineStyle" },
                                                           new Object[] { name,
                                                                          idInlineMap.get(i),
                                                                          nameInlineMap.get(i) });

Explanation 

1-ActiveDataEntry.ChangeType.UPDATE : Type of Event , it has following type
1-UPDATE
2-INSERT
3-INSERT_BEFORE
4-INSERT_AFTER
5-INSERT_INSIDE
6-REMOVE
7-REFRESH

2-ChangeCount : keep track of number of changes happened
  
3-Key : is key of row which you want to update.Since this table is based on list of object therefore key will always same order which order you added object in list. And if this graph then it could combination of column and row.

4-InsertKey :  the key to indicate the insert position.
This is useful when you want to insert new row in specific position.  Event type -INSERT_BEFORE and  INSERT_AFTER can use with this.

5-Names : now this one is interesting for understanding prospective. It does not represent actual value however it is just a key which value you want to change.
Suppose if your table has one column and that column has one output text and that out put text has following value #{row.name} .so if yow want to change this value then you should need to pass "name" as key.
example  new String[] { "name"}.
Apart from value you can also change inline and style class . For changing this value you should have to binding this value to EL , if you do not do this it is not going to work.

In page , output look like following

  <af:outputText value="#{row.id}" id="ot2"  styleClass="#{row.idStyleClass}"
                           inlineStyle="#{row.idInlineStyle}"/>

for changing style class or inline style you have to pass like new String[] { "idStyleClass" ,"idInlineStyle}.

6-Values : This argument basically represent actual array of object values. Which value will change.


  new Object[] { "newValue","color:Aqua;", "yourstyleclass" }

i-newValue is new value of out put text
ii-color:Aqua; is inline style class for output text
iii-yourstyleclass is your defined style class.

Apart for above explanation other vital information about ADS is presented at following link

1-http://adfwithejb.blogspot.com/2012/10/active-data-service-ads.html
2-http://adfwithejb.blogspot.com/2012/11/oracle-coherence-with-active-data.html

You can find sample application at following location .

https://drive.google.com/file/d/0B8cP4jZuxLlXNU5lTVh4NzNwVkE

Thanks,
Prateek

No comments:

Post a Comment