package oracle.srdemo.view.util;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.model.binding.DCParameter;
import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;
import oracle.binding.ControlBinding;
import oracle.jbo.ApplicationModule;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.srdemo.model.common.SRService;
/**
* A series of convenience functions for dealing with ADF Bindings.
* @author Duncan Mills
* @author Steve Muench
* $Id: ADFUtils.java,v 1.5 2006/04/20 12:07:44 steve Exp $.
*/
public class ADFUtils {
/**
* Constant for signalling failed SRService checkout during eager test.
*/
public static final String SRSERVICE_CHECKOUT_FAILED = "SRServiceFailed";
/**
* Get application module for an application module data control by name.
* @param name application module data control name
* @return ApplicationModule
*/
public static ApplicationModule getApplicationModuleForDataControl(String name) {
return (ApplicationModule)JSFUtils.resolveExpression("#{data."+name+".dataProvider}");
}
/**
* A convenience method for getting the value of a bound attribute in the
* current page context programatically.
* @param attributeName of the bound value in the pageDef
* @return value of the attribute
*/
public static Object getBoundAttributeValue(String attributeName) {
return findControlBinding(attributeName).getInputValue();
}
/**
* A convenience method for setting the value of a bound attribute in the
* context of the current page.
* @param attributeName of the bound value in the pageDef
* @param value to set
*/
public static void setBoundAttributeValue(String attributeName, Object value) {
findControlBinding(attributeName).setInputValue(value);
}
/**
* Returns the evaluated value of a pageDef parameter.
* @param pageDefName reference to the page definition file of the page with the parameter
* @param parameterName name of the pagedef parameter
* @return evaluated value of the parameter as a String
*/
public static Object getPageDefParameterValue(String pageDefName,
String parameterName) {
BindingContainer bindings = findBindingContainer(pageDefName);
DCParameter param = ((DCBindingContainer)bindings).findParameter(parameterName);
return param.getValue();
}
/**
* Convenience method to find a DCControlBinding as an AttributeBinding
* to get able to then call getInputValue() or setInputValue() on it.
* @param bindingContainer binding container
* @param attributeName name of the attribute binding.
* @return the control value binding with the name passed in.
*
*/
public static AttributeBinding findControlBinding(BindingContainer bindingContainer,
String attributeName) {
if (attributeName != null) {
if (bindingContainer != null) {
ControlBinding ctrlBinding = bindingContainer.getControlBinding(attributeName);
if (ctrlBinding instanceof AttributeBinding) {
return (AttributeBinding)ctrlBinding;
}
}
}
return null;
}
/**
* Convenience method to find a DCControlBinding as a JUCtrlValueBinding
* to get able to then call getInputValue() or setInputValue() on it.
* @param attributeName name of the attribute binding.
* @return the control value binding with the name passed in.
*
*/
public static AttributeBinding findControlBinding(String attributeName) {
return findControlBinding(getBindingContainer(), attributeName);
}
/**
* Return the current page's binding container.
* @return the current page's binding container
*/
public static BindingContainer getBindingContainer() {
return (BindingContainer)JSFUtils.resolveExpression("#{bindings}");
}
/**
* Return the Binding Container as a DCBindingContainer.
* @return current binding container as a DCBindingContainer
*/
public static DCBindingContainer getDCBindingContainer() {
return (DCBindingContainer)getBindingContainer();
}
/**
* Get List of ADF Faces SelectItem for an iterator binding.
*
* Uses the value of the 'valueAttrName' attribute as the key for
* the SelectItem key.
*
* @param iteratorName ADF iterator binding name
* @param valueAttrName name of the value attribute to use
* @param displayAttrName name of the attribute from iterator rows to display
* @return ADF Faces SelectItem for an iterator binding
*/
public static List<SelectItem> selectItemsForIterator(String iteratorName,
String valueAttrName,
String displayAttrName) {
return selectItemsForIterator(findIterator(iteratorName), valueAttrName,
displayAttrName);
}
/**
* Get List of ADF Faces SelectItem for an iterator binding with description.
*
* Uses the value of the 'valueAttrName' attribute as the key for
* the SelectItem key.
*
* @param iteratorName ADF iterator binding name
* @param valueAttrName name of the value attribute to use
* @param displayAttrName name of the attribute from iterator rows to display
* @param descriptionAttrName name of the attribute to use for description
* @return ADF Faces SelectItem for an iterator binding with description
*/
public static List<SelectItem> selectItemsForIterator(String iteratorName,
String valueAttrName,
String displayAttrName,
String descriptionAttrName) {
return selectItemsForIterator(findIterator(iteratorName), valueAttrName,
displayAttrName, descriptionAttrName);
}
/**
* Get List of attribute values for an iterator.
* @param iteratorName ADF iterator binding name
* @param valueAttrName value attribute to use
* @return List of attribute values for an iterator
*/
public static List attributeListForIterator(String iteratorName,
String valueAttrName) {
return attributeListForIterator(findIterator(iteratorName), valueAttrName);
}
/**
* Get List of Key objects for rows in an iterator.
* @param iteratorName iterabot binding name
* @return List of Key objects for rows
*/
public static List<Key> keyListForIterator(String iteratorName) {
return keyListForIterator(findIterator(iteratorName));
}
/**
* Get List of Key objects for rows in an iterator.
* @param iter iterator binding
* @return List of Key objects for rows
*/
public static List<Key> keyListForIterator(DCIteratorBinding iter) {
List attributeList = new ArrayList();
for (Row r: iter.getAllRowsInRange()) {
attributeList.add(r.getKey());
}
return attributeList;
}
/**
* Get List of Key objects for rows in an iterator using key attribute.
* @param iteratorName iterator binding name
* @param keyAttrName name of key attribute to use
* @return List of Key objects for rows
*/
public static List<Key> keyAttrListForIterator(String iteratorName,
String keyAttrName) {
return keyAttrListForIterator(findIterator(iteratorName), keyAttrName);
}
/**
* Get List of Key objects for rows in an iterator using key attribute.
没有合适的资源?快使用搜索试试~ 我知道了~
SRDemoSampleADFBC-migrated-to-11.1.13.0
共519个文件
xml:117个
class:105个
java:82个
需积分: 0 7 下载量 66 浏览量
2010-10-20
10:02:48
上传
评论
收藏 1.79MB ZIP 举报
温馨提示
学习JDeveloper ADF11g可以用
资源推荐
资源详情
资源评论
收起资源包目录
SRDemoSampleADFBC-migrated-to-11.1.13.0 (519个子文件)
Business Service Data Model.adfbc_diagram 44KB
Business Domain Layer.adfbc_diagram 30KB
Service Request View Object.adfbc_diagram 15KB
Business Service Data Model.oxd_bc4j.bak 183KB
Business Domain Layer.oxd_bc4j.bak 117KB
SRDemoDataBase.oxd_db.bak 113KB
Service Request View Object.oxd_bc4j.bak 52KB
SRDemoSample.deploy.bak 5KB
DataModelMiddleTier.deploy.bak 3KB
DataModelCommon.deploy.bak 3KB
DateMustComeAfterRule.deploy.bak 2KB
DateMustComeAfterRuleDT.deploy.bak 2KB
FrameworkExtensions.deploy.bak 2KB
SRDemoSampleEAR.deploy.bak 1KB
DataModel.bcdeploy.bak 374B
UserInterfacezyxr.cdi 268KB
UserInterfacezyxm.cdi 146KB
UserInterface.cdi 28KB
DataModelzyxr.cdi 14KB
DataModelzyxm.cdi 13KB
DataModel.cdi 12KB
FrameworkExtensionszyxm.cdi 10KB
FrameworkExtensions.cdi 9KB
FrameworkExtensionszyxr.cdi 6KB
UnitTestszyxm.cdi 4KB
UnitTests.cdi 4KB
UnitTestszyxr.cdi 3KB
DataModel.cdi_javac 16KB
UserInterface.cdi_javac 15KB
FrameworkExtensions.cdi_javac 12KB
__srsearch_jspx.class 89KB
__srmanage_jspx.class 72KB
__srmain_jspx.class 67KB
__srlist_jspx.class 54KB
__sredit_jspx.class 53KB
__srcreateconfirm_jspx.class 52KB
__srcreate_jspx.class 48KB
__srstaffsearch_jspx.class 47KB
__srskills_jspx.class 38KB
__srwelcome_jspx.class 35KB
__srhelp_jspx.class 32KB
__srcreatedone_jspx.class 31KB
__srabout_jspx.class 30KB
__srfaq_jspx.class 30KB
__srdemotemplate_jspx.class 29KB
__srlogout_jspx.class 27KB
__srfileupload_jspx.class 26KB
__srlogin_jspx.class 21KB
SRServiceImpl.class 10KB
__globalmenu_jspx.class 9KB
ADFUtils.class 9KB
SRDemoPageLifecycle.class 9KB
ServiceRequestImpl.class 8KB
SRServiceTestAsManagerRole.class 7KB
DateMustComeAfterRuleCustomizer.class 7KB
JSFUtils.class 6KB
SREntityImpl.class 6KB
ServiceHistoryImpl.class 6KB
SRMain.class 6KB
UserImpl.class 5KB
SRFileUpload.class 5KB
SRViewObjectImpl.class 4KB
__index_jspx.class 4KB
OnPageLoadBackingBeanBase.class 4KB
ProductImpl.class 4KB
AttributeMustExistInViewRowRule.class 3KB
StaffListRowImpl.class 3KB
SRServiceTestAsUserRole.class 3KB
SRStaticDataViewObjectImpl.class 3KB
SRUnitTestBase.class 3KB
ShuttlePageBackingBeanBase.class 3KB
UserSystemState.class 3KB
DateMustComeAfterRule.class 3KB
LoggedInUserRowImpl.class 3KB
SRServiceTestAsTechnicianRole.class 2KB
SRPropertiesFileViewObjectImpl.class 2KB
MenuItem.class 2KB
UserInfo.class 2KB
MenuModelAdapter.class 2KB
ProductDefImpl.class 2KB
ServiceRequestImplMsgBundle.class 2KB
Utils.class 2KB
GlobalsRowImpl.class 2KB
ServiceRequestStatusListRowImpl.class 2KB
StaffListRowClient.class 2KB
ServiceRequestImplMsgBundle_it.class 2KB
StaffListByEmailNameRoleImpl.class 2KB
SRServiceClient.class 2KB
TrainModelAdapter.class 2KB
SRApplicationModuleImpl.class 2KB
ResourceAdapter.class 2KB
SRManage.class 2KB
SRServiceFixture.class 2KB
MenuTreeModelAdapter.class 2KB
ServiceHistoryImplMsgBundle.class 1KB
ServiceHistoryImplMsgBundle_it.class 1KB
SREntityDefImpl.class 1KB
JUnitFixureLoginInfoProvider.class 1KB
SRCreateConfirm.class 1KB
LoggedInUserImpl.class 1KB
共 519 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
yuyanbingfly
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功