Dec 28, 2013

Create RESTful Service from Java Class

With JDeveloper 12c finally it is possible to create RESTful Services from a Java Class. The implementation is based on Jersey following the Java EE 6 specification JAX-RS. For testing JDeveloper includes a comprehensive Tooling. In general RESTful services are really popular for mobile applications, e.g. ADF Mobile.


Get started
Create a simple Java Class for your business domain object plus a Service Facade that you want to expose as a RESTful Service.
package enpit.sample.adf12c.pojorest.model;

import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Person {
    
    private Long id;
    private String firstname;
    private String lastname;
    private Date hiredate;    
    private Long addressId;
    
    public Person() {
        super();
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setHiredate(Date hiredate) {
        this.hiredate = hiredate;
    }

    public Date getHiredate() {
        return hiredate;
    }

    public void setAddressId(Long addressId) {
        this.addressId = addressId;
    }

    public Long getAddressId() {
        return addressId;
    }
}

Make sure to annotate the class with the @XmlRootElement otherwise the REST Service will not work for this domain object.
Next create a simple service facade with some test data, e.g.
package enpit.sample.adf12c.pojorest.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PersonService 
{     
private List persons;    
 private Person person;    
 public PersonService()
 {        
 super();        
 this.persons = new ArrayList();       
  for (long i = 0; i < 10; i++) 
{           
  Person p = new Person();  
           p.setId(i);            
 p.setFirstname("Firstname " + i);            
 p.setLastname("Last " + i);            
 p.setHiredate(new Date());            
 this.persons.add(p);       
  }         
this.person = this.persons.get(0);    
 }
    public List getPersons()
{      
   return this.persons; 
    }
    public void addPerson(Person person) 
{     
    System.out.println("add person " + person);   
      if(person != null)
{       
      getPersons().add(person);  
       }
     }  
  public Person getPerson()
{      
   return person; 
    }
 }
So far there is nothing special. 
Create RESTful Service with the help of JDeveloper 12c
Now comes the interesting part. Select the PersonService.java in the application navigator and
choose "Create RESTful Service…"
You will get a wizard to specify the RESTful Service interface. Set the desired root path. Choose the desired media types and the Methods you want to expose as REST Service
After finishing the wizard the following happens
package enpit.sample.adf12c.pojorest.model;
import java.util.ArrayList; 
import java.util.Date;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam; 
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("rest")
@Produces(value = { "application/json""application/xml" })
@Consumes(value = { "application/json""application/xml" }) 
public class PersonService
 {  
   private List persons;  
   private Person person;   
  public PersonService()
 {      
   super();      
   this.persons = new ArrayList()
{         
for (long i = 0; i < 10; i++)
 {       
      Person p = new Person();    
         p.setId(i);      
       p.setFirstname("Firstname " + i);    
         p.setLastname("Last " + i);     
        p.setHiredate(new Date());    
         this.persons.add(p);   
      }      
   this.person = this.persons.get(0);   
  }
    @GET   
  @Path("/persons")   
  public List getPersons()
{     
    return this.persons;     }
    @POST  
   @Path("/person")     
    public void addPerson(@FormParam("person"Person person)
 {
        System.out.println("add person " + person);    
     if(person != null)
{             getPersons().add(person);         }     } 
     @GET     
@Path("/person")  
   public Person getPerson(){  
       return person;     }
}
- web.xml is created. The Jersey Servlet is configured properly.

 

                                                                                                                                                              
Testing the RESTful Service in JDeveloper 12c
Jdeveloper is quite powerful. It lets you test the RESTful service right in the IDE.
Right-Click on the PersonService.java class and choose Run.
In background WebLogic Server 12c starts and the RESTFul Service gets deployed.
The WADL is kind of WSDL for RESTful Services. Clicking on the "Target Application WADL" URL brings you to the overview of the provided service operations.
You can test each Service Operation right from the IDE. Pressing the "Test" Button brings you to the HTTP Analyzer Screen.
Here you can choose the Method, change HTTP Headers (e.g. what kind of media type you want to accept).
Press "Send Request" to actually test the Service Operation. Make sure to change the view to "HTTP Content" not "WADL Structure" otherwise you want see the pretty formatted output on the right hand side.
Change the Accept-Header to application/json and send the request again. The output automatically will be in JSON format.
The HTTP Analyzer is even so good to parse the POST Parameter to create a good looking form for data entry

Dec 27, 2013

E-Business Suite Plug-in 12.1.0.2 for Enterprise Manager 12c

E-Business Suite Plug-in 12.1.0.2 for Enterprise Manager 12c Now Available

Oracle E-Business Suite Plug-in 12.1.0.2.0 is now available for use with Oracle Enterprise Manager 12c.  Oracle E-Business Suite Plug-in 12.1.0.2 is part of Oracle Enterprise Manager 12 Application Management Suite for Oracle E-Business Suite. This latest plug-in extends EM 12c Cloud Control with E-Business Suite specific system management capabilities and features enhanced change management support.

The Oracle Enterprise Manager 12c Application Management Suite for Oracle E-Business Suite includes:
  • Functionality that was available in the previously-standalone Application Management Pack for Oracle E-Business Suite and Application Change Management Pack for Oracle E-Business Suite
  • Oracle Real User Experience Insight
  • Oracle Configuration & Compliance capabilities 
Licensing information 
A license for Oracle Enterprise Manager 12c Cloud Control is required to use this product. There is an additional licensing cost for the Application Management Suite for Oracle E-Business Suite.  A license for the Application Management Suite includes licenses for the E-Business Suite Plug-in, Oracle Real User Experience Insight, and Oracle Configuration & Compliance products.
This is a Development blog, and we don't have the background to discuss licensing in more detail.  We'd recommend contacting your Oracle account manager for more information about licenses. Updates to product bundling

Features that were previously available in the standalone management packs are now packaged in the Oracle E-Business Suite Plug-in, which is certified with Oracle Enterprise Manager 12c Cloud Control: 
  • Functionality previously available for Application Management Pack (AMP) is now classified as “System Management for Oracle E-Business Suite” within the plug-in.
  • Functionality previously available for Application Change Management Pack (ACMP) is now classified as “Change Management for Oracle E-Business Suite” within the plug-in.
The Application Configuration Console and the Configuration Change Console are now native components of Oracle Enterprise Manager 12c.
EBS Plug-in 12 screenshot
New enhancements in this release
General
  • Support for managing E-Business Suite R12.2 technology stack including monitoring of Web Logic Server services.
  • New ADF pages that allow personalization of System Management home page and E-Business Suite landing page.
  • New landing page displays all available E-Business Suite targets, Compliance summary, least compliant targets, and related Incidents summary.
  • All tabs and links have been moved to drop down menus for easy navigation.
Compliance Framework
  • Integrated with Enterprise Manager Compliance Framework and includes shipped Security Compliance Standards for Oracle E-Business Suite.
Customization Manager
  • Oracle E-Business Suite Release 12.2 Readiness Report: Customization Manager now includes an option to generate the Oracle E-Business Suite Release 12.2 customization readiness report for online patching directly from the UI. Customers who are currently on Oracle E-Business Suite Releases 11i, 12, or 12.1 can run this report to validate if their customizations are ready for Oracle E-Business Suite Releases 12.2 online patching. Customers who are currently on Oracle E-Business Suite Releases 11i, 12.0, or 12.1 can run this report to validate if their customizations are ready for Oracle E-Business Suite Release 12.2 online patching.
  • Auto-correction of invalid custom applications
  • Support for source code branches and tags
  • Option to hide unused custom applications
  • "Create like" feature for file source mapping and Oracle E-Business Suite Mapping
  • Detailed status messages for packages
  • Option to download a consolidated log for package creation
  • New file type to support force upload of seed data LDT files
Patch Manager
  • Simplified Oracle E-Business Suite R12.2 online patching deployment procedures.
  • New Patch Manager Dashboard allows patch management for all releases of Oracle E-Business Suite instances. Patch Manager dashboard provides a consolidated and personalizable view of all patching activities for all Oracle E-Business Suite instances.
  • Customers now can view all the AD worker log files without the need for command line operations.
Setup Manager Installation & Upgrades
  • Customers currently running on Enterprise Manager 12c, can use Self Update to download and install AMP 12.1.0.2.0.
  • All others can download it here:
  • Oracle Software Delivery Cloud
Prerequisites
  • Enterprise Manager Cloud Control 12c
  • One or more of the following Oracle E-Business Suite Releases
    • Release 12.2.2
    • Release 12.1 with R12.ATG_PF.B.delta.3
    • Release 12.0.4 with R12.ATG_PF.A.delta.6
    • Release 11.5.10 CU2 with 11i.ATG_PF.H.RUP6 or higher

Dec 12, 2013

JSP Pre-Compilation in WebLogic Application Server:


Performance is paramount for any production system. A few seconds saved at the bottle neck is few seconds gained in the over all performance of the system. Compilation of JSP at runtime in a production environment can infuse an overhead. Hence it is a best practice to pre compile those JSP in such scenarios.
Precompilation offers below advantages:
Enhances the performance by ensuring pre compilation of all the JSPs before deployment of the application.
The Syntax errors in the sciptlet codes and custom tag elements could be detected at the compile time itself rather when the end user is accessing the application.
In WebLogic Server this can be achieved by weblogic.appc tool.
Weblogic.appc:
It’s an utility that generates and compiles the classes needed to deploy EJBs and JSP to WebLogic Application Server. It provides other features like deployment descriptor validations for standards compliance at both individual module level and the application level.
Syntax:
java weblogic.appc [options] <ear, jar, or war file or directory>

Using weblogic.appc as ant task:
You can incorporate appc in build.xml using an ant task wlappc..
For Ex:
<taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc" classpathref="dev.classpath"/>
<target name="jspc-webapps">
<!-- Pre-compile webapp JSP pages to src/web/WEB-INF/classes -->
<wlappc source="${srcweb}" classpathref="dev.classpath" verbose="true">
</wlappc>
</target>
This would ensure that the appc would scan through the web application at the source location and precompile the JSPs.
Further references:
http://docs.oracle.com/cd/E11035_01/wls100/ejb/appc_ejbc.html

Dec 10, 2013

BPM Human Task to show the Location Map in ADF page




Step 1: Create BPM Application; add an asynchronous BPM process, with User interactive activity.

Figure 1: Asynchronous BPM Process

Step 2: Create a Business Object (AddressBO) base on address.xsd [I am standard US address format - street, city, state and zip]

Figure 2: adress.xsd

Step 3: Create a Data Object (addressDO) base on AddressBO (Business Object)
Step4: Create the human task called it ShowLocationHT, with adressDO in its payload.

Step 5: Now create a generic project under BPM Application. [File > New > All Technologies > Project > Generic Project]

Step 6: Right Click on the Generic Project, Select “New” as show below

Step7: Select “ADF Task Flow base on Human Task (JSF)“.
Tip: search with “human task” to quickly find the item.

Step 8: Select the correct .task file from the BPM Project folder.

Step9: Click on “OK” (go with default settings), Let Jdeveloper to create the required component for you.
Step10: Open default activity within the task flow (one with green background).

Step 11: Enter file Name and click on “OK” button. It will create an empty jspx file.


























Step 12: Under data control navigator, you should be able to see a data control with _.
Expand the data control as show below.

Step 13: Drag and drop “Task” into the empty page. Select Human Task> Complete Task with Payload as shown below.
Click on “OK” twice; wait for JDeveloper to create all the components of Human task.

Step 14: JDeveloper will create all required component for the Human task along with its payload.

Step 15: Before adding map component to the human task, Go to the Project Properties of the ADF task flow project and select Project Properties as shown below.
[ADF task flow Project >Project properties]


Step 16: Select “JSP Tag Libraries” tab,
Click on “Add” to add “ADF Data Visualization 1.1” libraries.

Step 17: From the data control navigator drag and drop Address object into jspx page where you want to show the map.
Select getTaskDetails()>Return>Task>Payload > Address >
Geographic Map > Map and Point Theme. As shown below.

Step 18: In Create Geographic Map wizard, click on the green plus to add Map Configuration.

Step 19: Add MapViewer and Geocoder URL by clicking green plus icon against each field.

Step 20: Add MapViewer URL, click on Test Connection to test the connectivity.
MapViewer URL: http://elocation.oracle.com/mapviewer


Step 21: Add Geocoder URL, click on Test Connection to test the connectivity.
[Geocoder URL: http://elocation.oracle.com/geocoder/gcserver%5D


Step 22: Select MapViewer URL and Geocoder URL and click OK.

Step 23: If you configuration is correct you should be able to see the world map. Like the one you see below.

Step 24: Select US (street,city,state,zip) from the drop down menu.

Step 25: Map street, city, state, zip values as shown below.

Step 25: Once DVT map component is added, open property inspector to change its property.
Under Appearance tab
  • Set map Theme_Id for AutoZoomThemeId.
  • Set StartingX and StartingY values.
  • Set MapZoon to 14 (street level zooming).


Under Other tab
  • Set AutoZoomStrategy to CENTERALZOOMLEVEL.
  • Provide Summary value [any string value will do].

Step 26: deploy the BPM process.
Step 27: Make sure you DON’T select the ADF project along with your BPM project while deploying BPM project.
[DON'T check any of the following checkboxes.]

Step 28: Wait for BPM process to deploy

Step 29: Right Click on Application, Select Deploy > [ADF project name]

Step 30: Select “Deploy to Application Server” as shown below.

Step 31: Select right Application Server.

Step 32: Select soa_server1, from the list of Standalone Server and Clusters.

Step 32: Click “finish“.

Step 33: Click “Deploy“.

Step 34: for open process in em console, click on “Test” button.


Step 35: Provide a valid US address then Click on “Test Webservice“.

Step 36: Login into BPM workspace, click on the work item to view the address on DVT geographic map embedded on a human task.