cancel
Showing results for 
Search instead for 
Did you mean: 

Reuse of OVS code

Former Member
0 Kudos

Hi all,

i want to use same OVS code in 2 views view1 and view2.

In applyResult method i am getting classcastException as

IPRivateView1.node<Name> applicationnode= IPRivateView1.create<name>element

because for 2nd view it has to come as

IPRivateView2.node<Name> applicationnode= IPRivateView2.create<name>element

How to identify that the result should be shown means view1 or view2.Otherwise is there any other solution for resolving this??

Regards

Padma N

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Write the OVS code in the component controller and try to execute from it in both the views.As it is global you can accesses the same with "n" number of views.

Create a method in the comp.controller and write the OVS code in that method.And access the method from any view.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Create a context attribute ... e.g InputViewName

Set InputViewName to string view1 if View1 is implelemnting OVS else

set it to string view2

In applyResult method check if the context

InputViewName == view1

IPRivateView1.node<Name> applicationnode= IPRivateView1.create<name>element

else

InputViewName == view2

because for 2nd view it has to come as

IPRivateView2.node<Name> applicationnode= IPRivateView2.create<name>element

former_member335005
Participant
0 Kudos

Hi Padma,

In applyResult() method, you can try using this:

IPrivateView1.I<node>Element ovsCallerNodeElement1 =

(IPrivateView1.I<node>Element) applicationNodeElement;

IPrivateView2.I<node>Element ovsCallerNodeElement2 =

(IPrivateView2.I<node>Element) applicationNodeElement;

And then set the context attributes for the caller nodes of both the views - View1 and View2.

Regards,

Sangeeta