Friday, 20 December 2013

ADF : Entity Validation : Script Validation - Display customized message from bundle

Entity Validation : Script Validation - Display customized message from bundle


Step1: Define Script expression for "LocationId"



Step2: Drag that View as Form on UI.

           Run the page.




If your DepartmentId > 30, It should throw error when you click on any button.
Note: It won't execute your entity validation for "LocationId" until you change the value of that.
As shown below, i have deleted/altered the value of "LocationId", then only Entity validation will be invoked and throw an error message.

The Reason is:


2nd step is "Apply Request Values" then 3rd step is "Process Validation" (Means: After applying the change only validation happens, if there is no change it will skip the validation step)


Thursday, 5 December 2013

ADF : ViewCriteria : ViewCriteriaItem -> In XML / Java

ViewCriteria : ViewCriteriaItem -> In XML / Java



In XML







In JAVA



        ViewObject vo = am.findViewObject("Employees");
        ViewCriteria vc =  vo.createViewCriteria();
        ViewCriteriaRow vcr =  vc.createViewCriteriaRow();
        ViewCriteriaItem vci =vcr.ensureCriteriaItem("EmployeeId");
        vci.setOperator(JboCompOper.OPER_IN);
        vci.setValueMinCardinality(3);
        vci.setValueMaxCardinality(3);
        vci.setValue(0, 101);
        vci.setValue(1, 102);
        vci.setValue(2, 103);
        vc.addRow(vcr);
        vo.applyViewCriteria(vc);

ADF : ViewCriteria : Query Panel with CheckBox

ViewCriteria : Query Panel with CheckBox

 

MyRequiremen:
In Query Panel when ever user check the check box and search's then only the checked Info should display in the table

Solution:
1. In VO -> make Attribute to Check Box in Control Hints.
2. Override the Expression of that Attribue using DECODE

For More Info Refer:

http://adfspecialists.blogspot.in/2012/12/adf-query-panel-with-checkbox-boolean.html 
   
 





ADF : ViewCriteria : Execute MyLogic then Execute Search functionality.

ViewCriteria : Execute MyLogic then Execute Search functionality.


MyRequirement:
In Search Panel if user clicks on Search button, i need to execute my Login then execute the Search functionality.

Solution: 
Just override the executeQuery() function in VOImpl + Do you Logic + super.executeQuery()

For More Info Refer:
 http://andrejusb.blogspot.in/2010/05/yes-no-check-box-in-query-criteria.html




Solution2:

Generate custom where clause fragment for the ViewCriteriaItem

http://www.jobinesh.com/2010/09/using-bind-variable-for-sql-statements.html




Wednesday, 27 November 2013

ADF : ValueChangeEvent : Forcefully execute all event change queued logic.

ValueChangeEvent : Forcefully execute all event change queued logic.


Problem: some times on valuechangeevent you will not get latest selected value.
Because, all valuechangeevent will go to queue, and it executes at particular ADF lifecycle.

Solution: to get the latest selected value, we need to manually execute the ADF lifecycle before taking the value.

##############Your code - from ValueChangeEvent method ##########################

yourMethod(ValueChangeEvent valueChangeEvent){

----------------
------------

this.setValueChangeEventComponentToNewValue(valueChangeEvent);

                ViewObject vo =
                    this.findIterator("MktImpJobs1Iterator").getViewObject();
                this.jobrow = vo.getCurrentRow();
----------------
 -------------

}

##############new method you need to add ##############

 public  void setValueChangeEventComponentToNewValue(ValueChangeEvent vce) {
            vce.getComponent()
               .getValueExpression("value")
               .setValue(FacesContext.getCurrentInstance().getELContext(),vce.getNewValue());
          
        }

 
########################################################

Wednesday, 13 November 2013

Windows Command to check port usage

Windows Command to check port usage


netstat -aon | find /i "listening"



tasklist /svc /FI "PID eq 2632"


JAVA : Java Code : Take Screenshot, Schedule Program, Send Mail.

Java Code : Take Screenshot, Schedule Program, Send Mail.


1. Take Screenshot:


##############################################################################

import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;

import javax.imageio.ImageIO;

public class RobotExp {
   
    public static void main(String[] args) {
       
        try {
            Date a = new Date();
            Robot robot = new Robot();
            // Capture the screen shot of the area of the screen defined by the rectangle
            BufferedImage bi=robot.createScreenCapture(new Rectangle(1000,1000));
            ImageIO.write(bi, "jpg", new File("D:/tt/imageTest.jpg"));
           
        } catch (AWTException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
##############################################################################

2. Schedule Program

##############################################################################

 import java.awt.Toolkit;
import java.util.Timer;
import java.util.TimerTask;
/**
 * Simple demo that uses java.util.Timer to schedule a task to execute once 5
 * seconds have passed.
 */
public class ReminderBeep {
  Toolkit toolkit;
  Timer timer;
  public ReminderBeep(int seconds) {
    toolkit = Toolkit.getDefaultToolkit();
    timer = new Timer();
    timer.schedule(new RemindTask(), seconds * 1000);
  }
  class RemindTask extends TimerTask {
    public void run() {
      System.out.println("Time's up!");
      toolkit.beep();
      String args[] = new String[3];
      main(args);
      //timer.cancel(); //Not necessary because we call System.exit
      //System.exit(0); //Stops the AWT thread (and everything else)
    }
  }
  public static void main(String args[]) {
    System.out.println("About to schedule task.");
    new ReminderBeep(5);
    System.out.println("Task scheduled.");
  }
}

    

##############################################################################

3. Send Mail

For this we need 2 Jars:
   a. javax.mail.jar
   b. activation-1.0.2.jar

Then we need: SMTP host, port

############################################################################## 

 

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendFileEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "pavan.x.mr@oracle.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);
      properties.setProperty("mail.smtp.port", "465");

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Create the message part
         BodyPart messageBodyPart = new MimeBodyPart();

         // Fill the message
         messageBodyPart.setText("This is message body");
         
         // Create a multipar message
         Multipart multipart = new MimeMultipart();

         // Set text message part
         multipart.addBodyPart(messageBodyPart);

         // Part two is attachment
         messageBodyPart = new MimeBodyPart();
         String filename = "file.txt";
         DataSource source = new FileDataSource(filename);
         messageBodyPart.setDataHandler(new DataHandler(source));
         messageBodyPart.setFileName(filename);
         multipart.addBodyPart(messageBodyPart);

         // Send the complete message parts
         message.setContent(multipart );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}

##############################################################################

 

Tuesday, 12 November 2013

HTML : Web Page Design : HTML, CSS, Javascript and JQuery.

Web Page Design : HTML, CSS, Javascript and JQuery.


1. Gothrough this url - which has different menu design.
       - below that u have download option, u can download the code (html,css,js)
Eg : one sample menu design as shown below

ADF Table Sort:

ADF Table Sort:


1. Sort on VO Query : For all the VO's it affects.
2. Sort for VO Iterator : only for that VO - Iterator it affects.
3. Sort for <af:table : only for that page, that table it affects (if we have 2 <af:table based on same iterator also, it affects differently, bez we are applying on <af:table)

1. Sort on VO Query : For all the VO's it affects.




 2. Sort for VO Iterator : only for that VO - Iterator it affects.




3. Sort for <af:table : only for that page, that table it affects



Thursday, 7 November 2013

ADF : ViewCriteria : Change display components in af:query

ViewCriteria : Change display components in af:query


Requirement:
-> I want to change the display component in af:query
    Eg: i have "Flag" column in table, i am using "Flag" in my view criteria, but on screen i want to display check box instead of input text box.

Refer below URL:

http://andrejusb.blogspot.in/2010/05/yes-no-check-box-in-query-criteria.html



Wednesday, 30 October 2013

ADF : VO Performance Increase:

VO Performance Increase:




1.    Mark VOs as insert only. This will avoid unnecessary select queries from being issued.
 
2.       2. Set VO in forward only mode which will prevent caching of previous sets of rows.

3.       3. Enable EO batch processing which reduces no of trips to database.

4.      4. Commit records at regular intervals.

5.   Set setListenToEntityEvents to false.




Through JAVA : The Same thing can be set using Java (Programatically)

VO Impl change

---------------------------------------------------------------
  voi.setListenToEntityEvents(false);
                    voi.setMaxFetchSize(0);
                    voi.setAccessMode(RowSet.FORWARD_ONLY);
                    if(voi.getViewDef() != null){
                        voi.getViewDef().setFetchMode(voi.FETCH_AS_NEEDED);
                        voi.getViewDef().setInheritPersonalizationStrValue("merge");
                    }

 EO Impl change

----------------------------------------------------------------
if(voi != null && voi.getViewDef() != null){
                        EntityReference[] er =  voi.getViewDef().getEntityUsages();
                        if(er != null){
                            for(EntityReference e:er){
                                   EntityDefImpl eoDefImpl = e.getEntityDef();
                                    if(eoDefImpl != null)
                                    eoDefImpl.setBatchThreshold(10);
                            }
                        }
                    }

NOTE: If Entity has BLOB/CLOB attributes then eoDefImpl.setBatchThreshold(10); will not work.

It starts giving different error like : RowAllreadyDeleteException .....etc.
MoreInfo: http://waslleysouza.com.br/en/2014/08/enabling-update-batching-in-adf/



Friday, 25 October 2013

ADF : Skin Selection

ADF : Skin Selection









ADF Security Implementation

ADF Security Implementation






It Creates the jazn-data.xml – to create user, roles and grants.

Define User
admin
normal



Define Role
admin – role
normal – role

Give Grants
1.       Page Level Security


1.       Field Level Security
#{securityContext.userInRole['staff']}







ADF : Oracle extended template use

oracle extended template


1.       Download the oracle extended template source code from http://www.oracle.com/technetwork/developer-tools/adf/uishell-093084.html
Use this link http://www.oracle.com/technetwork/developer-tools/adf/394631.zip. In the above site to download zip file.
2.       You will get like this in jdeveloper. Change according to your change.


1.       Take the jar file of this.


1.        Use it in SecondUI project library.







ADF : View Object - Operations

View Object - setCurrentRowWithKey

 https://blogs.oracle.com/shay/entry/selecting_a_row_in_a_table_to


Thursday, 24 October 2013

ADF Expression Use on JSPX

ADF Expression Use on JSPX


####################
My Requirement is i should disable the button if table rowcount is > = 500

Use -> #{bindings.MapView11.estimatedRowCount ge 500}  on Disabled property of button

########################IN JSPX ##########################

 <af:commandButton text="#{bindings.MapView11.estimatedRowCount}"
                          binding="#{backingBeanScope.backing_ObjectMain_ObjectFake_MapView.cb1}"
                          id="cb1" partialTriggers="tt1 tt2 t1"
                          disabled="#{bindings.MapView11.estimatedRowCount ge 500}"/>


ADF Working Flow

ADF Working Flow





UCM Connection From Java





ADF Bindings

ADF Bindings


ADF : Samples

Worked/Knowledge on:

ü  VO Tuning

  ADF Multi language support.


  Using Data source.

  Dynamic Tab shell template.

  Dynamic Task flow.

  ADF Custom skin.

  ADF Declarative component.

  Developing Menu, Tree and Tab elements.

  Entity objects, View objects and View links.

  Unbounded and Bounded TaskFlows

  Task flow level exception handling.

  Validation (Entity level with Domain and Attribute level and JSF)

  Security Implementation

  Java script loading using adf-js-partition

  Cascaded LOV.

  Using DBSeq and Groovy expressions.

  Using Router and Return components in TF level.

  Extending PagePhaseListner.

  Contextual event.
  Concepts – Create, CreateInsert, CreatewithParams, NextSet, PreviousSet, executeWithParam, setCurrentRowWithKey and setCurrentRowWithKeyValue.

  Autosuggest and carousal components.

  Report generation using XML Publisher.

  Import/Export Excel data.

  Upload/Retrieve Image using servlet.

  Cache Implementation.

  Knowledge on ADF Life cycle.

  Knowledge on ADF with Webservice (JAX-WS 2.0).

  Knowledge on ADF with spring and Hibernate integration.

ü  Knowledge on Oracle BPM, BPEL, SOA and OSB.