Pages

Tuesday, December 24, 2013

Access Application module from simple Java Class.

I got a requirement like accessing AM from a java class

Say as e.g.:           
           
Where I have a common Application Module(name it as CommonAM from CommonApp). 
It folds of common Entity Objects, ViewObjects. this CommonApp make it as ADFSharedLib).
This ADFSharedLib invoked it in each and every 'n' Projects. 
Then I try to access that commonAM and its entities and views in other Projects.

Note:
I dont want to use a Bean to access the commonAM via DataControl. 

So, I want to use one Java Class across all other Application Modules.

There are lot of ways to achieve that.
Here I'm going to share one way.I'm not sure this recommend practice. but we can also do by the way.

Step 1: Following Figure that how my CommonApp looks just employee eo , vo.



Step 2: I packed the CommonApp as ADFSharedLib.



Step 3: I'm trying to invoke the ADFSharedlib from File system.


Step 4: By creating root application while invoking the method at run time. I can able to access my view objects instances. 

say as e.g.: Creating a programmatic view criteria find the employee id and updating the salary...

After commit. there is no need to act as root. so i release the resource.




Step 5: finally i invoke this from current working application. that is WorkApp.
I'm trying to execute that from WorkAM.



Step 6: before executing let us check the db data. Now for the employee id '100' having the salary 2400.



 Step 7: Now i'm going to execute this method from BC Tester.




Step 8: After execution let us check in db. salary of the employee. 


It's updated. 
By this way i can able to communicate with my commonAM.

CommonApp Download here

WorkApp Download here

I'll later explain little more simplifier than this post. check this post.

No comments:

Post a Comment