// print the roles of the current user for ( String role : ADFContext.getCurrent().getSecurityContext().getUserRoles() ) { System.

out.println(”role “+role); } // get the ADF security context and test if the user has the role users SecurityContext sec = ADFContext.getCurrent().getSecurityContext(); if ( sec.isUserInRole(”users”) ) { } // is the user valid public boolean isAuthenticated() { return ADFContext.getCurrent().getSecurityContext().isAuthenticated(); } // return the user public String getCurrentUser() { return ADFContext.getCurrent().getSecurityContext().getUserName(); } // get the binding container BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); // get an ADF attributevalue from the ADF page definitions AttributeBinding attr = (AttributeBinding)bindings.getControlBinding(”test”); attr.setInputValue(”test”); // get an Action or MethodAction OperationBinding method = bindings.getOperationBinding(”methodAction”); method.execute(); List errors = method.getErrors();

getAttribute(”field1″). iterBind.getAllRowsInRange(). // Get the data from an ADF tree or table DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getMessage(). method. // Get all the rows of a iterator Row[] rows = iterBind. // Get a attribute value of the current row of iterator DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.getCurrentBindingsEntry().execute().method = bindings. Row[] rows = treeData. FacesCtrlHierBinding treeData = (FacesCtrlHierBinding)bc.getError(). } .getAllRowsInRange(). iterBind.getCurrentRow(). paramsMap.getParamsMap().put(”param”. // Get the error String error = iterBind.getDataProvider().”value”) . for (Row row : rows) { dataRow = (TestData)((DCDataRow)row). // refresh the iterator bindings.executeQuery(). TestData dataRow = null.refreshControl().getCurrent(). Map paramsMap = method.getControlBinding(”tree”).get(”testIterator”).refresh(DCIteratorBinding. String attribute = (String)iterBind.RANGESIZE_UNLIMITED).getOperationBinding(”methodAction”).

createValueExpression(ctx.getELContext().getApplication().class).currentRow. “#{testSessionBean}”.getValue(ctx. a different way FacesContext ctx = FacesContext. ValueExpression ve = ef.findExecutableBinding(”regions_employee_regionPageDef”). ValueExpression ve = ef.createValueExpression(ctx. // handle to binding container of the region. DCBindingContainer dcRegion = form. TestHead. TestSession. TestSession test = (TestSession)ve. // main jsf page DCBindingContainer dc = (DCBindingContainer)BindingContext. // return a methodexpression like a control flow case action or ADF pagedef action private MethodExpression getMethodExpression(String name) { Class [] argtypes = new Class[1].getELContext()). .getExpressionFactory(). ExpressionFactory ef = ctx. ExpressionFactory ef = ctx.dataProvider}”.getApplication(). “#{bindings.testIter.getCurrentBindingsEntry().getExpressionFactory(). // pagedef of a page fragment JUFormBinding form = (JUFormBinding) tf.getValue(ctx.getCurrentInstance().// Get the current row of a iterator .getCurrentInstance().getCurrent(). // Get a session bean FacesContext ctx = FacesContext.findExecutableBinding(”dynamicRegion1″).getELContext(). // taskflow binding DCTaskFlowBinding tf = (DCTaskFlowBinding)dc.getELContext()). TestHead test = (TestHead)ve.class).

ELContext elContext = facesCtx.getExpressionFactory(). Application app = facesCtx.argtypes[0] = ActionEvent.getELContext().name. button. menuPage1. button.setValueExpression(”disabled”. menuPage1. ELContext elContext = facesCtx. FacesContext facesCtx = FacesContext.null.execute}”).getExpressionFactory(). // get a value private ValueExpression getValueExpression(String name) { FacesContext facesCtx = FacesContext. RichCommandButton button = new RichCommandButton().”+item+”. MethodExpression me = getMethodExpression(”#{bindings. ExpressionFactory elFactory = app.setActionExpression(getMethodExpression(”page1″)).setText(item).getCurrentInstance().getApplication(). .getApplication().getChildren().createMethodExpression(elContext.argtypes).getCurrentInstance().getELContext().getValueExpression(”#{! bindings. ExpressionFactory elFactory = app. return elFactory.setText(”Page 1″).”+item+”.setId(item). menuPage1.enabled}”)). footer. button. button. } // RichCommandMenuItem menuPage1 = new RichCommandMenuItem().addActionListener(new MethodExpressionActionListener(me)).add(button). Application app = facesCtx.class.setId(”page1″).

getChildren(). } FacesMessage msg = new FacesMessage(FacesMessage. “”).getMessage().add(input).addMessage(uiComponent.getCurrentInstance(). .getClientId(facesContext). e.”+item+”. input.getValueExpression(”#{bindings.addMessage(null. facesContext.createValueExpression(elContext.class). input.setValueExpression(”label”. msgHead . input. panelForm. for ( UIComponent item : items ) { resetValueInputItems(adfFacesContext. // catch an exception and show it in the jsf page catch(Exception e) { FacesMessage msg = new FacesMessage(FacesMessage. msg).”+item+”.setValueExpression(”value”.SEVERITY_ERROR. // reset all the child uicomponents private void resetValueInputItems(AdfFacesContext adfFacesContext.setId(item).SEVERITY_WARN. FacesContext.item). msgDetail). msg). name.hint s.getChildren(). Object.label}”)). UIComponent component){ List<UIComponent> items = component.getValueExpression(”#{bindings. } // an example how to use this RichInputText input = new RichInputText().return elFactory.inp utValue}”)).

getExternalContext().getCurrentInstance().isDisabled() ) { input.addPartialTarget(input).getResponse().printStackTrace(). }. if ( !input. String url = ectx.jspx”. adfFacesContext. try { response.getRequestContextPath()+”/adfAuthentication? logout=true&end_url=/faces/start. } catch (Exception ex) { ex.if ( item instanceof RichInputText ) { RichInputText input = (RichInputText)item. } // PPR refresh a jsf component AdfFacesContext.resetValue() . adfFacesContext.getCurrentInstance(). if ( !input.sendRedirect(url).resetValue() . }.addPartialTarget(input). HttpServletResponse response = (HttpServletResponse)ectx.isDisabled() ) { input. } else if ( item instanceof RichInputDate ) { RichInputDate input = (RichInputDate)item. } } } // redirect to a other url ExternalContext ectx = FacesContext.addPartialTarget(UIComponent). .

FacesContext context = FacesContext. } // get the adf bc application module private OEServiceImpl getAm(){ FacesContext fc = FacesContext.getValue(elContext).getApplication().getCurrentViewPort().OEServiceDataControl. return facesCtx. context. “#{data. // get the stacktrace of a not handled exception private ControllerContext cc = ControllerContext.// find a jsf component private UIComponent getUIComponent(String name) { FacesContext facesCtx = FacesContext.getViewRoot().getViewRoot().getELContext().getExpressionFactory().class). ELContext elContext = fc.language).findComponent(name) .setLocale(newLocale). Object.getExceptionData()!=null ) { StringWriter sw = new StringWriter().dataProvider}”. ValueExpression valueExp = elFactory. . Application app = fc. public String getStacktrace() { if ( cc.getCurrentInstance(). return (OEServiceImpl)valueExp. } // change the locale Locale newLocale = new Locale(this.createValueExpression(elContext.getCurrentInstance().getCurrentInstance(). ExpressionFactory elFactory = app.getInstance().

getRowData().getSelectedRowKeys()) { table. } // get the selected rows from a table component RowKeySet selection = resultTable. } return null. List<Long> receivers = new ArrayList<Long>(keys. JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o. return sw. } // get selected Rows of a table 2 for (Object facesRowKey : table. .getCurrentViewPort().getRow().getExceptionData(). Object o = table. cc.PrintWriter pw = new PrintWriter(sw). } No Comments » No comments yet.getSelectedRowKeys(). Row row = rowData. for ( Object key : keys ) { User user = modelFriends.printStackTrace(pw).setRowKey(facesRowKey). Test testRow = (Test)((DCDataRow)row).get((Integer)key).getDataProvider() .length).toString().toArray(). Object[] keys = selection.

Sign up to vote on this title
UsefulNot useful