Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Friday 24 April 2015

set DB time

Hello Fellas,

today I'm sharing my learning to how to set DB time,
just use time command from sqlplus or browser,

ALTER DATABASE SET TIME_ZONE = '+5.30';




thank you :)

Monday 1 December 2014

Email Validation in ADF

Hello Fellas,
Today I'm sharing my learning to how to make a custom validation in Oracle JDeveloper,
Create a java class,

Lets take an example to create a e-mail validation,



import java.io.Serializable;

import java.util.regex.Matcher;
import java.util.regex.Pattern;import javax.faces.application.FacesMessage;import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

public class EmailValidator implements Serializable, Validator {

    public EmailValidator() {
        super();
    }
    public void validate(FacesContext facesContext, UIComponent uiComponent,
                         Object object) {
        String value = (String)object;
        if ((value == null) || value.length() == 0) {
            System.out.println("null value found");
            return;
            //System.out.println("null value found");
        }
        //String expression="^[\\\\w\\\\-]([\\\\.\\\\w])+[\\\\w]+@([\\\\w\\\\-]+\\\\.)+[A-Z]{2,4}$";
        String expression =
            "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
        CharSequence inputstr = value;
        Pattern pattern =
            Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(inputstr);
        if (!matcher.matches()) {
            throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                                          "Enter the proper Email Id",
                                                          null));
        }
    }
}





Go to faces-config.xml and open validators tab give a meaningful Id like EmailValidator
& class name
in this case it should be EmailValidator(along with the package)

in the input file just write
<af:inputText label="Enter EmailID" id="it1">
<f:validator validatorid="EmailValidator"/>
</af:inputText>


thank you :)

Monday 10 November 2014

Create a SQL sequence in Oracle

Hello fellas,
Today I'm sharing my learning to how to create a sequence in Oracle from a SQL squery.
Just open a JDeveloper, followed by the SQL worksheet,

CREATE SEQUENCE sequence_name
  MINVALUE value
  MAXVALUE value
  START WITH value
  INCREMENT BY value
  CACHE value;

example


 and following the select query will show the incremented value


thank you :)

Monday 8 September 2014

Display Value Of SelectOneChoice in Bean or LOV in ADF.

Hello Fellas, today I'm Sharing my learning on how to get the get the display value of SelectOneChoice in Bean or LOV.

make the SelectOneChoice autoSubmit value true and make a  method on valueChangeEvent of the SelectOneChoice,

and write this simple code Snipet in the method.

Object obj=valueChangeEvent.getNewValue(); 
Object xxx=ADFUtils.evaluateEL("#{bindings.CountryName.items['"+obj.toString()+"'].label}"); System.out.println(xxx.toString());

where CountryName to which you want to get in your bean,

you can use this code anywhere in your bean.


you can use the ADFUtils from here ADFUtils which simply depends on 

JSFUtils so please download that too from here JSFUtils


thank you :)

Saturday 30 August 2014

Current Date and Time in ADF

Hello fellas,
today i'm sharing my learning to how to show current date and time in adf

First take a JSF(jspx) page and take a output field, 
create a managed bean, of the type Date(by extending java.util.Date),
make, value of the output field of the type of your bean



output will be like this,

use a convert date and time in the output field used. by searching it from component pallete and choose this one as we are using jspx.



use poll from the operations under component palette, set interval of the poll to 1000,



make a bind variable name,  create getters and setters.
select the poll from the structure, and go to the poll listner, and connect this listener to this  refreshPage method
bind the output text to the dates variable provided. 



code to be provided.
    public void refreshPage(PollEvent pollEvent) {
        refresh();
        AdfFacesContext.getCurrentInstance().addPartialTarget(dates);
    }
        protected void refresh() {
            FacesContext ctx = FacesContext.getCurrentInstance();
            String refreshpage = ctx.getViewRoot().getViewId();
            ViewHandler views = ctx.getApplication().getViewHandler();
            UIViewRoot view = views.createView(ctx, refreshpage);
            view.setViewId(refreshpage);
            ctx.setViewRoot(view);
        }


run the page.
you can download the application from here App 

thank you :)

Friday 29 August 2014

Disable Future Date on ADF Page

Hello Fellas,
today i'm sharing my learning, to how to Disable future date on our ADF page.

Take a Input date component on your page.
Make a managed bean, and simply create a method, and put this snipet of code on your bean,


    public Date getDate()      {            Date date=new Date(new java.sql.Date(new java.util.Date().getTime()));            return date;            }  

make the date of type oracle.jbo.domain.Date 
you can get the actual java class from this link     .XBean.java 

and make max value of the input date component from the source code.





actual result





thank you :)


you can download the actual code from here

FutureDateApp

Thursday 31 July 2014

Create Dynamic Reigon In ADF

Hello Fellas, today i'm sharing my learning about how to create a Dynamic Reigon in adf,


you can download the sample app from here
First create a least Bounded task flow and drop one Page Fragments Respectively,
I'll show you how, I've created one for you and the second you have to create by yourself,

task flows should be WEB-INF folder, pages in web content similarly the task flows too in the web content


put some content in the JSFF so that we can differentiate between them and drag them to the task flows created,



you do the second by yourself,



now create a page for your self containing at least two facets, make it two coloums page.



  




now drop the task-flow in on page as dynamic region



it will ask to create a managed bean just create it.




now create a link on the second facet



similarly for the second task flow,



 now run it.


results





thank you :)

Tuesday 29 July 2014

Create a Managed Bean in ADF

Hello Fellas,
Today I'm sharing my learning to how to create a managed bean without using any component, it's very simple and easy.

Just Create a Java Class.

Make getter(accessor) and setter(mutator) as required.




Open adfc-config.xml with managed bean  tab under overview section.
Give the bean any name and select the Class which we just created right now.
by editing the class text-field. and see the hierarchy, find your package, and you class.
always keep the scope to the lowest. most of the times "request"





now we can simply use it as required.





Thank you :)

Monday 16 June 2014

AFStretchWidth on table in adf

Hello Fellas, today I sharing my learning how to show all the columns of a table in ADF with using vertical scrollbar,
without using AFStretchWidth we can see the data in this form


but when we use the AFStretchWidth of styleClass property of the table this issue can be resolved.


thank you :)

Thursday 5 June 2014

Image Display from BLOB (database) in ADF.

Hello Fellas, today I'm sharing my ADF learning, as display of images from Database column BLOB, from Corousel
1. Create a table containing at-least two columns one containing id and another the blob.
2. Make EO & VO of the table.
3. Drag it to the jspx in form of corousel 

4. Drag image component from common components to the img.jspx structure,


leave the dialouge box containing Source & Short Desc,

5. Create a servlet by right click on view controller and selecting new



code of the servlet is available here 


6. now edit the source and shortdesc of image. by writing the code in.
source                        /imgservlet?id=#{item.Id}
shortdesc                    #{item.id}



where
imgservlet is the name of the servlet which we created as ImgServlet
and item is a variable created by the carousel item


FINAL OUTPUT




thank you :)
thanks to Adeel

Sunday 1 June 2014

Dependent LOV in ADF

Hi Friends, today I'm going to tell you how to make a  dependent LOV(list of values).
tested on oracle Jdeveloper 11.1.1.7
1. Create a Fusion-Web-Application. name it anything I named id as Dependent_LOV.




2. Select Next  and click Finish.





3. Select new from model and goto to business tier, adf business component and Select business component from tables.


4. create your connection.

5. I've created two new tables named continent and country in the hr schema.
continent sql               country sql


6. Make a bind variable name it CurrentContinent in CountryVO. in query section.


7. edit the SQL QUERY



8. copy and paste the query in the where clause.

CountryEO.CONTINENTS=:CurrentContinent


9. make a LOV. from the CountryVO
First Continent LOV


10.from the data list source select a create a new view accessor


11.  shuttle the ContinentVO1 to the right hand side. and select ok.


12.select list attribute as id. and in the ui-hints shuttle the ContinentName 


13. Now the MOST important LOV i.e. the country LOV
create the new view accessor from the data source. and select the CountryVO1 and EDIT it

14 in the edit view accessor. see the bind parameter values and write that component of the current VO on which our current LOV is showing dependency i.e. in our case the Continents
apply it and OK.

15. list attribute:- id, ui hints display attributes CountryName. and avoid selecting no included item.


16. save It and run the app module.
 it will ask for the bind varaible,just click okay.
and Open CountryVO.





thank you :)



A Guide to Installing Oracle HR Schema on an Existing Docker Container

  Hi Reader, Today I want to share my learning on how to install Oracle HR schema on a existing docker container. Step 1: Download the verif...