Binding Context :-
1. It is a container object which holds the list of available data control and the data binding objects.
2. BindingContext is used to access the page bindings.
3. It is used to access the iterator binding from the page.
4. It is also used to access the data control binding such as action and attribute bindings.
5. It is the java representation of cpx file.
6. Import package "oracle.adf.model.BindingContext".
BindingContainer :-
1. BindingContainer class is the java representation of page definition file.
2. Import package "oracle.binding.BindingContainer".
Herircherchy :-
1. BindingContext -> DataControl.
2. BindingContext -> BindingContainer -> iterator binding.
3. BindingContext -> BindingContainer -> attribute and action binding.
Code to get the BindingContainer object from BindingContext :-
BindingContainer containerObj = BindingContext.getCurrent().getCurrentBindingEntry();
FacesContext :-
Import package "javax.faces.context.FacesContext".
FacesContext context = FacesContext.getCurrentInstance();
1. FacesContext class is used to find the JSF component.
Syntax to implement :-
UIComponent uicomp = context.getViewRoot().findComponent("binding id of the ui component from the page");
2. Used to change the locale.
Syntax to implement :-
facesCtx.getViewRoot().setLocale(java.util.Locale.ENGLISH);
3. Used to get the ELContext.
Syntax to implement :-
Application app = context .getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = context.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext,
"#{xxxx}",
Object.class);
Object result = valueExp.getValue(elContext);
4. Used to get the ExternalContext.
Syntax to implement:-
ExternalContext extContext = context.getExternalContext();
5. Used to add the message at the view level.
Syntax to implement :-
a. FacesMessage class is used to add the message using the severity like
SEVERITY_ERROR,SEVERITY_INFO, SEVERITY_WARN, SEVERITY_FATAL based on the type of message to show at page level.
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "msg" , "This is the detailed message to show");
b. Then add the facesmessage in facescontext object.
context.addMessage(null, message);
ExternalContext :-
1. Package to import "javax.faces.context.ExternalContext"
ExternalContext ectx = context.getExternalContext();
2. This class is used to get all the java init and web.xml parameters.
Syntax to implement :-
Map<String, Object> initParamsVar = ectx.getInitParameterMap();
3. It is also used to get the request parameters.
Syntax to implement :-
Map<String, String> requestParamsVar = ectx.getRequestParameterMap();
4. Used to get the session parameters.
Syntax to implement :-
Map<String, Object> sessionParamsVar = ectx.getSessionMap();
5. Used to retrive the wen application url.
Syntax to implement :-
String contextPath = ectx.getRequestContextPath();
AdfFacesContext :-
1. Package to import "oracle.adf.view.rich.context.AdfFacesContext".
Syntax to implement :-
AdfFacesContext facesContext= AdfFacesContext.getCurrentInstance();
2. This class is basically used for performing the partial page rendering (PPR) i.e to refresh the page components based on component id.
Syntax to implement :-
facesContext.addPartialTarget("UI component id");
3. Used to access only PageFlowScope and ViewScope variables and no any other scopes variable is access by this class.
Syntax to implement :-
facesContext.getPageFlowScope();
facesContext.getViewScope();
ADFContext :-
1. Package to import "oracle.adf.share.ADFContext".
Syntax to implement :-
ADFContext adfContext = ADFContext.getCurrent();
2. It is used to access the all memory scopes Application, Request, Session, PageFlow, View.
Syntax to implement :-
Map<String, Object> applicationVar = adfCtx.getApplicationScope();
Map<String, Object> pageParamsVar = adfCtx.getPageFlowScope();
Map<String, String> requestParamsVar = adfCtx.getRequestScope();
Map<String, Object> sessionParamsVar = adfCtx.getSessionScope();
Map<String, Object> sessionParamsVar = adfCtx.getViewScope();
3. It is also used to get the ELContext.
Syntax to implement :-
ELContext elContext = adfContext .getELContext();
ExpressionFactory elFactory = adfContext .getExpressionFactory();
ValueExpression valueExp = elFactory.createValueExpression(elContext,
"#{xxxx}",
Object.class);
Object result = valueExp.getValue(elContext);
4. Used to get the SecurityContext.
Syntax to implement :-
SecurityContext secContext = adfContext.getSecurityContext();
SecurityContext :-
1. Package to import "oracle.adf.share.security.SecurityContext".
Syntax to implement :-
SecurityContext secContext = adfContext.getSecurityContext();
2. This class is used to retrive the user and its roles.
Syntax to implement :-
String user = secContext.getUserName();
String[] roles = secContext.getUserRoles();
ControllerContext :-
1. Package to import "oracle.adf.controller.ControllerContext".
Syntax to implement :-
ControllerContext controlContext= ControllerContext.getInstance();
2. This class is used to get the exception.
Syntax to implement :-
Exception exp = controlContext.getCurrentViewPort().getExceptionData();
0 comments:
Post a Comment