Groovy   发布时间:2022-04-12  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Using Groovy to read values from a different view object大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

原文: http://blogs.oracle.com/grantronald/entry/using_groovy_to_read_values

We recently posted an ADF Insider Essentials that showed how to build an LOV switcher.  In this example,Frank Nimphius wrote a custom method into the PaymentTypeVOImpl which returns the String CASH or CREDIT depending on the lookup value passed in (1 or 2).  This method is then called from the orders view object via a Groovy expression.

However,there is an even quicker way without even having to create a custom method.  To explain,I'm going to use the good old employees and Jobs tables from the HR scheR_912_11845@a.  Lets assume,that when you create a new employee their default role is AC_MGR (account manager) and their default salary should be the minimun salary for an accout manager.  In this case,we'll actually read the minimum salary into the employeesVO.Salary field from the JobsVO.Min_Salary field.

1) First create default ADF BC based on employees and Jobs

2) In the employeesVO add a view accessor to JobsVO (and call it JobsView).  This "links up" the employeesVO to the JobsVO

3) Set the default employeesVO.JobId to AC_MGR

4) Set the default employeesVO.Salary to JobsView.findByKey(key(JobId),1)[0].MinSalary

So what does this Groovy expression do?  It "walks" to the JobsVO using the JobsView accessor and then calls findByKey using the JobId.  This returns an array and since we kNow JobId is unique we can just get the first entry's MinSalary.

大佬总结

以上是大佬教程为你收集整理的Using Groovy to read values from a different view object全部内容,希望文章能够帮你解决Using Groovy to read values from a different view object所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。