Simple Navigation

Note: This post was written using Oracle JDeveloper 11.1.1.3, running in 64-bit mode on 64-bit Ubuntu 10.04 LTS, but will work with JDeveloper 11.x on any platform.

This post is part of a series on Oracle Application Development Framework (ADF).  This post assumes that you have completed the example in the previous “Hello World!” post.  Subsequent posts will build on this post with increasing, additional functionality.

Let’s return to the application we started in the previous post.  In the Application Navigator navigate to the adfc-config file in your ViewController project under Web Content then Page Flows.  If you have just completed the previous post, this file will probably still be open.  If you can’t see the Application Navigator, you can open it by selecting Application Navigator from the View menu.

Add two new pages to the diagram by dragging a View from the Component Palette onto the canvas, like we did in the previous post.  If you don’t see the Component Palette, select it from the View menu.  Name these new pages “one” and “two” as shown in the image below.  If you accidentally lose focus on the name before you have typed in the name you want, just click on the text again and you will be able to edit it.

Now we will create some rules that determine how users can navigate around our application.  In this example we are going to create some very simple rules, but later on we will see how we can have more complex navigation rules including conditions and “sub-navigation.”  For now, click on the Control Flow Case in the Component Palette, then click on the the home page to start an arrow and then the one page to end the arrow.  Your screen should look like the image below.  Type in one to name this arrow.  If you lose focus, just click on the name to change it.

We named this arrow the same as the view that it is pointing to.  This is not mandatory, but in this example it does make it a little clearer what it happening.  The name of the arrow is important though.  When we are developing our views (pages) and we want to have a component (like a button for example) cause the application to follow a navigation path (one of these arrows), we will be selecting the name of the arrow from a list.  So choosing good names will make life easier for us later.

Go ahead and create some more arrows so that users will be able to navigate from any page to any other page, as shown below.  The details of the arrows are as follows:

Source        Target        Name
------------  ------------  ------------
home          one           one
home          two           two
one           home          home
one           two           two
two           home          home
two           one           one

Your project should look like this:

Save your work by selecting Save All from the File menu.  Now that we have defined our views (pages) and navigation (arrows), we are ready to create the views (pages).  Just like we did in the last post, double click on each new page in turn (one and two) and create the page.  You can just accept the default name, which is the same as the view name with .jspx on the end, but make sure you choose the Oracle Three Column Layout template.

Note: there is nothing special about this template.  You could complete the example without using it, but we plan to put things in to the columns in later posts, and it is nice for all our pages to look the same.

Now let’s use some buttons to allow the user to navigate around the pages.  Button is not the only component that allows navigation, in fact there are many components that we could use, but button is simple to use and understand, so it is a good choice for this example.

Open up your home view and drag two buttons from the Component Palette right after your Output Text which we set to display Hello World! in the previous post.  Your screen should now look like this:

You may want to open the Structure view (from the View menu) at this point.  We don’t really need it right now, but it is something that you will definitely want to use later on, as your pages get more complex, so it is a good idea to get used to using it now.  You can see it there on the left hand side of the next image.  It shows all of the components on the page (in this case) in a tabular format.  This makes it easy for us to navigate through the page structure and select components we want to work on.  Notice that the first button is highlighted in the Structure view, and also in the graphical design view.  If you select a component in either of these two views, it will also be selected in the other.  When you have a lot of components on a page, you will find it is much easier to select the exact component you want from the structure view.

Notice also, that when a component is highlighted in the Structure view, its properties are displayed in the Property Inspector which is visible on the right hand side in the image below.  If you don’t see it, you can open it by selecting Property Inspector from the View menu.  Take a moment now to notice that you can move these views around the screen to set them up however you like.  Grab the title bar of a view with your mouse and drag it around.  Notice that you can drop it on top of another view and you will get tabbed views, like you see in the image below.  Notice that I have the Application Navigator and the Structure view sharing the left hand side of the screen (see the tabs at the top), and the Component Palette, Resource Palette and Property Inspector sharing the right hand side.  You can also double click on the title bar of a view to maximise it, and then again to restore it.

If you accidentally lose a view you want, you can always reopen them from the View menu, as you have seen previously.  If you get your screen all messed up and you can’t work out where things are, you can always select Reset windows to factory settings from the Window menu to get back to a sane and reasonable layout.

Now, back to our application!  Select the first button and use the Property Inspector to change its Text property to Go to page one and its Action property to one, as shown in the image below.  Note that the drop down box for the Action property contains the names we gave to the arrows that originate at this particular view.

Select the second button and set its Text property to Go to page two and its Action to two.

Your page should now look like the image below.  Save your work by selecting Save All from the File menu.  Also, notice that JDeveloper automatically added a Group component to hold your Output Text and two Buttons.  You can see it in the Structure view.  I have highlighted it in the image below.  This is not important right now, but we will look at it in the next post, when we start to care about the layout of our components.  For now, you might want to just take note that whenever we put multiple components in to a facet – like the center facet we got from our Oracle Three Column Layout page template, we need to put them into some kind of layout container.

Now go ahead and add an Output Text and two Buttons to page one.  Set the Value property of the Output Text component to This is page one.  For the first button, set Text to Go to home page and Action to home.  For the second button, set Text to Go to page two and Action to two.  Save your work.

Similarly, on page two, add an Output Text with Value set to This is page two, followed by a button with Text set to Go to home page and Action set to home, followed by a second button with Text set to Go to page one and Action set to one.  Save your work.

Now we are ready to run our application and try it out!  Return to the the home page and right click on the page in the design area.  Select Run from the popup menu as shown below.

After a few moments (or minutes if you have shut down your test server since you did the last exercise) the update page should appear in your browser, as shown below.

Go ahead and click on the buttons to navigate around your application.   Here is page one:

And page two:

That completes this exercise!  Now we have seen how to add additional pages to our application, and one simple way of creating navigation using buttons.  In future posts, we will look at a number of other approaches to navigation, but first, we will explore layouts.  Stay tuned!

Posted in Uncategorized | Tagged | 1 Comment

Additional configuration to allow SOA managed server to be started from Node Manager

I usually don’t start my managed servers from the Node Manager, as I like to have easy access to the console while I am developing and debugging.  But today, I needed to get it working as a prerequisite for another product.

When I simply started the Node Manager and attempted to start my SOA managed server using it, I got a bunch of ClassNotFoundExceptions and it sat there keeping one CPU busy for a long time, with nothing happening.

Turns out there is one additional piece of configuration that needs to be done to enable the managed servers to be started from the Node Manager, you need to run this script (once):

$SOA_HOME/oracle_common/common/bin/setNMProps.sh
Posted in Uncategorized | Tagged , , | 1 Comment

Creating rules in Oracle Policy Automation

As a follow up to this earlier post, we will now explore how to create a basic rulebase using Oracle Policy Automation.

This post was created using Oracle Policy Modeling 10.1.0.27 on Windows 2008 Server R2.

Unlike other rules engines, Oracle Policy Automation allows you to write your rules in (or very, very close to) human language, and that language does not have to be English.

In this post, we will create a simple set of rules to determine employee eligibility for leave, and look at how to test the rulebase, and some simple user interface improvements and analysis.

Here are our rules:

Human Resources Policy 100 – Maternity Leave 

100.1. The employee is eligible for maternity leave if

a. The employee is female and
b. Either
 i. The employee has given birth to a natural child or
 ii. The employee has taken legal custody of an adopted child
 and
c. The employee is a full time employee and
d. The employee has been employed for at least 12 months continuously

Our first step is to open up Oracle Policy Modeling and create a new project. Select New Project… from the File menu.

image

Give the project a name and select the language and folder to store the project in.  I called mine “RedStack.”

image

Rules can be stored in Word or Excel documents.  We will use Word for this example.  Right click on the Rules folder and select Add New Word Document from the popup context menu.

image

Now right click on the newly added Word document and select Rename from the popup context menu.  I renamed mine to Maternity Leave.doc as you see in the image below.

image

Now double click on the Word document to open it in Word.  Word will open up with an empty document.  Oracle Policy Automation adds a few extra buttons in the Word ribbon.  You can see these by clicking on the Add-Ins tab.

image

We are going to use the following:

  • Conclusion – this tells OPA that the highlighted text is a conclusion or decision.
  • Level 1, 2, 3, etc. – this tells OPA that the highlighted text is a rule.  Level 1 rules contribute directly to the conclusion.  Level 2 rules contribute to a Level 1 rule, and so on – this will be more clear when we look at our example.
  • Rule Name – this tells OPA that the highlighted text is the name of the rulebase.
  • image Smiley face – This tells OPA to compile the rules to check that they are correct.
  • image Running man – This tells OPA to hide the clause information.

Go ahead and type the rules into Word.  Take care to put a TAB after the numbers (100.1., a., b., etc.) as this is what tells OPA that these are numbered clauses.

image

Now we want to tell OPA what the different parts of the document are.  First highlight the first line of the document, and mark it as a Rule Name by pressing Alt+N or clicking on Rule Name in the ribbon.  Note that the formatting changes slightly to give us a visual clue as to what various parts of the document are.

image

Next, select the second line and mark it as a Conclusion.

image

Continue in this fashion marking all of the remaining lines as Level 1, except for the two that start with i. and ii.

image

Finally, mark the two remaining lines as Level 2.

image

Your document should now resemble the one shown above.  Now, save your document and then click on the image Smiley face to compile it.  A dialog box will appear to show you the new attributes that were discovered.  You can modify wording and other options here, but for now just click on OK to continue.

image

You will get another dialog box letting you know that the compilation is complete.  Again, click on OK.

image

Your document should now look like this:

image

Note that OPA has added the clause numbers in red.  You can click on image Running man to hide these.  After doing so, your document will look like this:

image

You can now close Word and return to Oracle Policy Modeling and we are ready to test our rules.  Select Build and Run… from the Build menu.

image

If you get a message telling you that you need to recompile, just click on Compile and Continue, and then OK in the next dialog box.

image

In the popup dialog box, select Run with Oracle Web Determinations and click on Run.

image

This will start up the Oracle Policy Automation server in the background and open a browser directly to the “Web Determinations” screen which will conduct an interview with a user using our rules.  Click on the Is the employee eligible for maternity leave? link to start an interview.

image

OPA will ask you the first question it needs an answer for.  You may want to walk through this interview several times, providing different answers to see what happens.

image

In this example, we will say the employee is female, has not given birth to a natural child, has taken legal custody of an adopted child, is a full time employee and has been for 12 months.

image

image

image

image

After completing the interview with these responses, OPA tells us that the employee is eligible for maternity leave.  Now click on the Why? link after the result.

image

This will cause OPA to display all of the information provided and show us how it arrived at the decision it did, with direct reference back to the policy/rules we wrote.

image

So we can see that our rules work the way expected, but the interview is a bit clunky.  Let’s take a look at how we can make it a bit nicer.

One way to do this is to group the questions together into logical groups, and display each group of questions on a separate screen, rather than having one question at a time.  This is only one of the ways the OPA provides to make our interview more appealing.

Let’s start by right clicking on the Interviews folder and selecting Add New Screens File from the popup context menu.

image

The name will be highlighted for you to enter a new name.  I called mine Leave, but you can call it whatever you like.  If you accidentally press Enter too soon, just right click on it and select Rename from the popup menu.

image

Now double click on your new Interview to open it in the main editing pane (on the right).  Next, right click on the Question Screens folder and select New Question Screen from the popup menu.

image

Enter Sex in the Screen Title field at the top, then click on the New Attribute Input button to add a question to this screen.  Select “the employee is female” from the list of available questions (on the right) and click on the Create button to add it to the screen.  Questions that you have added will appear on the left hand side.  Then click on OK.

image

Repeat this same process to create two more screens:

  • Children containing “the employee has given birth to a natural child” and “the employee has taken legal custody of an adopted child”, and
  • Employment containing the remaining two questions.

Your screen should now look like this:

image

Now run the project again (select Build and Run… from the Build menu) and observe that the questions are now grouped and labeled as we defined.

image

Finally, let’s do a little analysis to round out this exercise.  Oracle Policy Automation will perform dependency identification for us and identify unused rules and circular logic.  Hopefully we wont have any of those in this simple example!

Let’s create a visualisation of our rulebase.  Right click on the Visualizations folder and select Add New Visual Browser File from the popup menu.

image

Give the file a name, as we did before.  I called mine dependencies.  Again, you can call yours whatever you like.

image

Right click in the main editor pain (where the popup menu appears in the image below) and select New Item… from the popup menu.

image

In the dialog box, choose “the employee is eligible for maternity leave” and click on OK.  Note that this is our conclusion from our rulebase.

image

The conclusion will appear in the editor pane, as shown in the image below, as a blue box.  Right click on this box and select Generate Rule Structure… from the popup menu.  This will help us to visualise the relationships between the rules in our rulebase.

image

In the dialog box that appears, just click on OK.

image

A diagram will appear, similar to the one shown below, that shows the rules and conclusions and how they relate to each other.  This lets you see how the rules engine goes about collecting facts to arrive at the conclusion.

image

Well, that’s it for this time!  Hopefully that gives you a feel for the simplicity and power of Oracle Policy Automation.  Remember, the rules can be much more complex than this, they can be hundreds of pages of legislation or policy documents.  They can also be expressed in Excel tables.  In addition to the web based interview we saw, they can also be exposed as a service that can be consumed by other applications or by an integration layer.

Next time we will look at how to deploy this rulebase to the Oracle Policy Automation server and consume it as a web service.  See you then!

Posted in Uncategorized | Tagged , | Leave a comment

Adding location-based search to URM (or UCM) using Google Maps

Recently I was working with an organisation that manages a large collection of physical assets and wanted to add a location-based search capability to Oracle Universal Records Management. In order to carry out a ‘proof of concept’ we built some simple integration with Google Maps.

This same simple add-on could equally be done with Oracle Universal Content Management.  The only difference would be in the way the metadata are defined and accessed in the query.  If you are using UCM, not URM, the tables will be different.  If you don’t know how to work it out, add a question to the post.

This post was built using Oracle Universal Records Management 11.1.1.2 running on Windows Server 2008 DataCenter Edition with Oracle Database 10g Express Edition.

The integration is built as a Java ServerPages (JSP) add-on.  URM has a built-in JSP server, but we have to enable it.

Connect to the URM web interface at http://yourserver:16300 and click on the Login link.

Log on as an administration, such as weblogic.

Open the Administration menu and select the link for Admin Server.  Note that your menus may look different based on user preferences, e.g. they may be drop-down menus across the top of the screen, or a different colour scheme.

A new window will open for the Admin Server.  Select the General Configuration link as highlighted in the image below.

Tick the checkbox to Enable Java Server Page (JSP) support, as shown, and provide a name for the JSP Enabled Groups.  I called mine “JSP.”  Note that this needs to match the group that we will create a little later on, and also becomes part of the URL to access the JSP pages.

Save these changes, and then restart your URM server instance.

These changes tell the URM server that when we access a JSP file in the group called JSP, it should run that page on its internal JSP server and return us the output, rather than just sending us the text in the file itself.  This is a very quick and easy way to add some new functionality to URM (or UCM for that matter.)

Once the server is restarted, return to the web interface, and open the Admin Applets in the Administration menu.  Then open the User Admin applet from that page.

Note that the admin applets will require a Java enabled browser as they are Java applets that will load and run on your local machine.

When the User Admin applet opens, select Permissions by Group… from the Security menu.

This will open a list of groups.  Click on the Add Group… button.  In the popup dialog box, enter JSP as the name for your new group.  Note that this MUST match the name you specified earlier in the Admin Server General Configuration page.  Then click on OK.

Click on the Edit Permissions… button and set the permissions for admin to RWDA as shown below.

Close the User Admin applet, saving your changes.

This completes the configuration to allow us to run JSP pages.  Now we want to define some metadata to store our location information.  In this post, we will use two fields to hold the latitude and longitude where the physical item was found.

To create our metadata, we go to the Records menu and select Configure then Metadata then Metadata Sets as shown in the image below.

On the Auxiliary metadata set information page, we provide a name and other details and the add the fields we want to define.  Complete this page using the information below:

Name:          gaMetadata
Display Name:  Location Metadata
Table Name:    gametadata
Column Prefix: ga

Add fields with the following names and types:

SurveyNumber                 Text
SurveyName                   Text
SourceLocationLatitude       Text
SourceLocationLongitude      Text
SampleType                   Text
SampleOwner                  Text
EmbargoDate                  Date
CollectionDate               Date

We will use these fields later to construct the search and display information about the search results on the map.

Now we are ready to add our actual JSP search page.  As this activity was conducted as a ‘proof of concept’ this JSP does not have all the error handling that you would want in a real production system, and it does not use connection pooling, etc.  So please be aware that you should improve the code quality if you plan to use this!

Here is the source code for the JSP.  You can put this into a file, I called mine mark.jsp, that we will upload shortly.  I wont give a line by line description of this code (unless somebody asks for it) but at a high level it is a simple HTML form that posts back to itself.  If the form has data in it, the page will use JDBC to connect to the database and run a query to find items within a specified distance (uncomment this if you want it) of a given location.  It then loops through the result set and creates markers on a Google Map to display the search results, along with some hover text and a popup box.  The marker also allows you to click on the search result to go to it’s details page in the web interface.  Note that you will need to set the database URL, userid, password, and your server address correctly.  These are highlighted in bold in the code below.

Note also that the code uses the SDO_GEOM package to do the spatial calculations – in this case the distance between two points in kilometres.  These are written to work on a standard projection with the normal everyday latitude and longitude coordinate system that most people are familiar with.  The Oracle database supports many other coordinate systems, measurement scales and spatial routines.

<%@page language="java" import="java.sql.*"%>
<%
  System.out.println("+++ Entering mark.jsp");
  java.sql.Connection conn;
  java.sql.Statement stmt;
  java.sql.ResultSet rs;
  if (request.getParameter("xLat") != null) {
    try {
      // query the database
      Class.forName("oracle.jdbc.driver.OracleDriver");
      conn = DriverManager.getConnection(
        "jdbc:oracle:thin:@localhost:1521:ecm11g", "dev_urmserver", "welcome1");
      String query = "select g.did, sdo_geom.sdo_distance( SDO_GEOMETRY( 2001, "
        + "8307, SDO_POINT_TYPE(" + request.getParameter("xLong") + ", " + request.getParameter("xLat")
        + ", NULL), NULL, NULL), SDO_GEOMETRY( 2001, 8307, SDO_POINT_TYPE(gacol_4, gacol_3, "
        + "NULL), NULL, NULL), 0.001, 'UNIT=KM') distance_in_km, gacol_4, gacol_3, gacol_1, gacol_2, "
        + "gacol_5, gacol_6, gacol_7, gacol_8, x.ddocname from gametadata g, extitems x ";
        //+ "where g.did = x.did and distance_in_km < " + request.getParameter("xDist");
      stmt = conn.createStatement();
      rs = stmt.executeQuery(query);
%>
<head>
<title>test</title>
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/container/assets/container.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/treeview-core.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/treeview-skin.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/skins/sam/treeview-skin.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/menu/assets/menu-core.css" />
<link href="/urm/resources/layouts/Trays/Oracle/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
  var latlng = new google.maps.LatLng(<%
  if (request.getParameter("xLat") != null) {
%><%= request.getParameter("xLat") %><%
  } else {
%>-35.282019<%
  }
%>,<%
  if (request.getParameter("xLong") != null) {
%><%= request.getParameter("xLong") %><%
  } else {
%>149.128748<%
  }
%>);
  var myOptions = {
    zoom: 12,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
<%
    int i = 1;
    while (rs.next()) {
%>
    var latlng<%= i %> = new google.maps.LatLng(<%= rs.getString(4) %>,<%= rs.getString(3) %>);
    var marker<%= i %> = new google.maps.Marker({
      position: latlng<%= i %>,
      map: map,
      title: "<%= rs.getString(11) %> from Survey <%= rs.getString(5) %>, <%= rs.getString(6) %>. A <%= rs.getString(7) %> submitted by <%= rs.getString(8) %>"
    });
    var contentString<%= i %> = '<div id="content">' +
      '</div>' +
      '<h1 id="firstHeading"><%= rs.getString(11) %></h1>' +
      '<div id="bodyContent">' +
      '<p><%= rs.getString(11) %> from Survey <%= rs.getString(5) %>, <%= rs.getString(6) %>.<br>A <%= rs.getString(7) %> submitted by <%= rs.getString(8) %>. </p>' +
      '<p><a href="http://yourserver:16300/urm/idcplg?IdcService=INFO_EXTERNAL_ITEM_FORM&dSource=Physical&dID=<%= rs.getString(1) %>">View details</a></p></div></div>';
    var infowindow<%= i %> = new google.maps.InfoWindow({
      content: contentString<%= i %>
    });
    google.maps.event.addListener(marker<%= i %>, 'click', function() {
      infowindow<%= i %>.open(map,marker<%= i %>);
    });
<%
    i++;
  }
%>
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div >
<h1>Search by Location</h1>
<form method="POST" action="#">
Latitude: <input type="text" name="xLat" value="<%
if (request.getParameter("xLat") != null) {
%><%= request.getParameter("xLat") %><%
} else {
%>-35.282019<%
}
%>"><br/>
Longitude: <input type="text" name="xLong" value="<%
if (request.getParameter("xLong") != null) {
%><%= request.getParameter("xLong") %><%
} else {
%>149.128748<%
}
%>"<br/>
Distance: <input type="text" name="xDist" value="<%
if (request.getParameter("xDist") != null) {
%><%= request.getParameter("xDist") %><%
}
%>"<br/>
<input type="submit" value="Search">
</form>
<p/>
</div>
<div id="map_canvas" style="width: 800px; height: 450px"></div>
</body>
<%
      rs.close();
      stmt.close();
      conn.close();
    } catch (Exception e) {
%><%= e.toString() %><%
    }
  } else {
%>
<head>
<title>test</title>
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/container/assets/container.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/treeview-core.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/treeview-skin.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/treeview/assets/skins/sam/treeview-skin.css" />
<link rel="stylesheet" type="text/css" href="/urm/resources/yui/menu/assets/menu-core.css" />
<link href="/urm/resources/layouts/Trays/Oracle/skin.css" rel="stylesheet" type="text/css" />
<body onload="initialize()" onunload="GUnload()">
<div >
<h1>Search by Location</h1>
<form method="POST" action="#">
Latitude: <input type="text" name="xLat" value="-35.282019"><br/>
Longitude: <input type="text" name="xLong" value="149.128748"<br/>
Distance: <input type="text" name="xDist" value="50"><br/>
<input type="submit" value="Search">
</form>
<p/>
</div>
<div id="map_canvas" style="width: 800px; height: 450px"></div>
</body>
<%
}
%>

Once you have the code saved in a file, you are ready to check that file into the URM server.

From the New Check-In menu, select your URM instance and then Standard Check In.  A form similar to the one below will open.  Set the fields as shown below:

Type:            Document - Any generic document
Title:           mark
Author:          weblogic
Security Group:  JSP
Primary File:    (click on Choose File and point to your mark.jsp)
Content ID:      MARK
Revision:        1

When you have completed the fields, click on the Check In button.  Note that the Security Group MUST match the one we defined earlier, which in turn matched the one we set in the Admin Server General Configuration page.  You can use a different title or content ID if you wish, however you will need to adjust your URL (coming soon) to match the values you choose.

Now we will set up a quick link to our page so it is easy to access it from the URM web interface.  In the My Content Server menu, click on the My URLs link.  This will open a page where you can define links, as shown below.  Add a new link.  I gave mine the title Search by Location and the URL shown below.  Note that you will need to change the URL (where highlighted in bold) if you have used a different filename or security group.  You will also need to put your server name into the URL.

http://yourserver:16300/urm/groups/jsp/documents/document/mark.jsp

Press Update once you are done.  You will notice that a Search by Location link appears under the My URLs folder in your menu now.

Finally, we will need some actual physical assets in the system so that we have some search results to look at!  The image below shows two sample records I used.

Check some physical assets into your system, if you have not already.  Make sure you add the Location Metadata Auxiliary Metadata Set to your new record using the drop down box at the top right.  You might want to do this before you start filling out the other fields…

Provide some values as shown above.  Note that this item has its SurveyName, SourceLocationLatitude, SourceLocationLongitude and SampleType set.  Note the values, you will see them later in the search results.

Now we are all set to run our add-in.  Click on the Search by Location link under My URLs in the My Content Server menu.  You should see your JSP page appear in the main content pane on the right, as shown below.  Enter some search terms and press the Search button.  Here I searched for -33.8122, 151.1755, the location of a large tunnel near Oracle’s office in Sydney, Australia.

The search results will be displayed on the map, as shown in the digram below.  Note that you can hover over the markers to see details.  You can also click on the marker to make the balloon appear (as has been done below).  The View details link in the balloon will take you to the subject item’s page in the URM web interface.  Note that you can also pan and zoon the map, and select the mode (Map, Satellite, Hybrid).

That concludes the example!  Happy searching by location.

Posted in Uncategorized | Tagged , , , , | 2 Comments

Recovering an Oracle database after doing something bad to your SPFILE

Well it has been over a year since the last time I broke my database, but I did it again today!  This time I increased the sga size without also increasing some other parameter, and the database would not start, and since it would not start, I could not change the parameter.  What to do?

After a bit of hacking the SPFILE to no avail, I worked out the following process:

First, log on to Oracle as an administrator:

sqlplus / as sysdba

Next, create a nice editable plain text PFILE from the “binary” SPFILE:

create pfile from spfile;
exit

Now you can edit PFILE to change whatever parameters you need to.  Once you are done, you can start up the database from the PFILE:

sqlplus /  as sysdba
startup pfile=initSID.ora

Problem solved!

Posted in Uncategorized | Tagged , | Leave a comment

WebCenter Spaces for iPhone released in AppStore

Reposting from Peter Moskovits:

If you have a WebCenter Spaces deployment (or are thinking about getting one), you should definitely check out the free WebCenter Spaces iPhone App, that allows you to access your activity stream, your contacts, all  your Spaces along with the documents, discussion forums, lists, space members, and more.

Posted in Uncategorized | Tagged , , | Leave a comment

ADF Faces Hello World!

Note: This post was written using Oracle JDeveloper 11.1.1.3, running in 64-bit mode on 64-bit Ubuntu 10.04 LTS, but will work with JDeveloper 11.x on any platform.

This is the first in a series of posts on Oracle Application Development Framework (ADF).  This post assumes that you have got Oracle JDeveloper installed, and presents a very simple “Hello World!” application, that shows us the most basic creation and deployment of an ADF application.  Subsequent posts will build on this post with increasing, additional functionality.

Watch this post on YouTube!

First, we need to create a new application to hold our work.  With JDeveloper open, select New from the File menu.  The New Gallery will open.  Select Applications under General on the left hand side, and Fusion Web Application (ADF) on the right.  Then click on OK.

The Create Fusion Web Application (ADF) wizard will open.  You need to give your application a name.  I called mine RedStack.  Normally you could just click on Finish now, but as this is our first time, let’s click on Next instead and get a bit of background as to what this wizard is doing for us.

You will notice from the left hand side, that this wizard is creating and “Application” that contains two “Projects.”  The first project is called Model, as you can see below.  You can also see in the Selected Project Technologies area (bottom right) that this project is automatically configured to support Java and ADF Business Components.  We wont be using these until a later post.  It is worth knowing that we can add extra technologies now, or later.  Adding a technology is going to make the necessary libraries available to build and deploy artefacts built using that technology.  For example, if we knew that we wanted to call a web service, we might want to add the web services technology, which would add libraries like web services client proxies, XML libraries, JAXB, etc.  For now, just click on Next twice to continue to the second project.

Here we see the second project is called ViewController.  This is where we will be spending most of our time for the next several posts.  This project will end up being a Java EE web application, in a web archive (WAR) deployment unit.  You can see it is preconfigured with various web technologies, Java and XML.  Click on Finish.

After a few moments, our application will be created.  You can see the two projects in the Application Navigator shown on the left.  In the main (centre) pane, there is a project overview which will guide us through various steps to get our application working.  For now, we are going to close that and ignore it!  If you move your mouse to the RedStack Overview tab, a close icon will appear at the right hand end of the tab.  Click on that to close the tab.

If we use the + icons to expand out our ViewController project, you can see what artefacts are created by default.  You will notice there is a Web Content folder, where we will keep all of our pages, templates, images, etc.  Later on (in a later post), when we create Java classes, an Application Sources folder will appear as well.

Let’s start by taking a look at the adfc-config file, located in the Page Flows folder under Web Content.  Double click on it to open it in the main pane.

You will see an empty diagram, as shown below.  This diagram is used to create the pages, “Views,” in our application, and to set the rules about navigation between the pages.  We will see how to use this a lot more in later posts.

For now, we are going to drag a View from the Component Palette on the right hand side, and drop it on the diagram, as indicated by the red arrow in the diagram below.  When you drop it, the name will be highlighted, and you can type in a name for the page.  I called mine home.

If you accidentally hit enter too soon, you can double click on the name to edit it.

If you don’t see the Component Palette, you can open it using the View menu in JDeveloper.

Hint: It is a good habit to hit Save All in the File menu after each action.  In this simple example, it does not really matter, but as move on to more complex examples, it is good to make sure all of your changes are saved before you move on.  Sometimes actions that you take may update several files, not just the one you are working on.  I like to Save All after every action I take.  Once you make it a habit, you will do it without thinking about it, probably much more often than you need to, but it will save you pain later on!  It also creates more save points in the revision history that you can revert to if you do something wrong.  Try to get into the habit, I am pretty sure you will ba happy you did.

Now, double click on the home View that you just added to the diagram.  This will open the Create JSF Page dialog, as shown below.

Specify a file name for your page.  I like to make it the same as the name of the view.  You want to use jspx, not jsp, so that you can take advantage of the additional validators that are available for jspx.  Again, this will save you time later on.

Also, select a Page Template from the pulldown list.  Later we will create our own templates, but for now, select Oracle Three Column Layout.  Page templates are useful for ensuring consistency across all of our pages.  They are a good place to put things like branding, navigation, shared logic, copyright notices, menus, etc.  We will see them in later posts.  For now, just click on OK.

After a couple of moment, our new empty page will open.  You will notice that it has a logo, three columns and spaces for headers, copyright notices, etc.  You should also notice that your Component Palette (on the right) will change to show different components now.  The components that appear now are the ADF Faces components and layouts.  You may notice there is a pulldown box at the top of the component palette which lets you select different groups of components.

For now, we are going to get started with one of the simplest components, the Output Text component.  Scroll down in the Common Components section of the Component Palette and drag one across to your page.  Drop it in the centre section of the page, as indicated by the red arrow in the diagram below.

In the bottom right of your screen, you should see the Property Inspector.  If it is not there, you can open it using the View menu in JDeveloper.  It should show properties for the Output Text component that you just added.  If not, just click on the component in the centre pane to select it, and the properties for that component will be displayed.

We are going to change the Value property, as shown in the diagram below.  Let’s change it to that old favourite, Hello World! as shown.  Make sure you press Enter when you have finished typing in the new value.  Then hit Save All!

You may notice that some properties have a little green dot beside them.  This indicates that they are not set to their default value.  This is a visual clue to let you know which properties you have edited.

Now we are ready to run our humble application.  Right click on the page in the centre pane, and select Run from the popup context menu.

The first time you do this it will take up to a couple of minutes (depending on the speed of your machine) to create a WebLogic Server instance, start it up and build and deploy our application.  Once the server is running, we leave it running as we make iterative changes to our application and retest them.  So in general, you will only start the server once per development session.

Once the server is started and the application is deployed (you can watch the progress in the Log window at the bottom of the JDeveloper screen) JDeveloper will open up your application in the default browser.

You can see from the diagram below what your application should look like.  Notice the Hello World! message.

So that completes our very first, very simple ADF application.  We saw how to create an application, add pages to the application, use a page template, add components to pages, and build, deploy and run our application!  It might not have seemed like much, but it is some of the basics that we will use over and over again in subsequent posts as we build on this application to add much more functionality as we explore ADF!

See you next time.

Posted in Uncategorized | Tagged | 7 Comments

What you need to use ADF

This blog contains many articles about Oracle Application Development Framework (ADF).  In order to develop and run applications using ADF, you will need to install Oracle JDeveloper, which you can download from the Oracle Technology Network (here).

Each post will contain a note to let you know what version of JDeveloper was used for that post.

If you use multiple operating systems, and a mixture of 32-bit and 64-bit (like me) then you should grab the “base install” version, which is a generic JAR file that can be installed on any platform (provided you have a supported JDK).  I have installed this version on 32-bit Windows and Linux, and 64-bit Windows, Linux, Mac OS X and Solaris.  If you are going to use Mac OS X, you might want to check the hints here.

Posted in Uncategorized | Tagged , | Leave a comment

How to make Chrome on OS X trust a self-signed certificate

When setting up Subversion recently to use with my various JDeveloper and NetBeans installations here, there and everywhere, I wanted to browse my repositories from Chrome (my main day to day browser) on Mac OS X (my main day to day OS).  But, my Subversion installation is using HTTPS with a self-signed certificate, so I had to tell Chrome how to understand it.

The process is as follows:

  • Open the offending site in Chrome
  • Click on little bang icon at the right hand end of the address bar
  • Hold down the Option key and drag the certificate from the popup dialog to the desktop
  • Rename it with a .cer extension
  • In the Chrome menu, navigate to Preferences, Under the Hood, Security, Manage Certificates
  • Click on the plus “+” icon to add a certificate
  • Point to the .cer file on the desktop
  • Select the option to trust the certificate

That’s it, all done!

Posted in Uncategorized | Tagged , , , | Leave a comment

Installing Oracle XE database on 64-bit Ubuntu

After many years, I took a fresh look at Ubuntu, and I found it to be great!  So naturally, I wanted to install Oracle XE database to play around with.  But this comes as a 32-bit rpm.  What to do?

Fortunately, I found a great post over at littlebrain.org that describes the process and pitfalls in some details.  I wont repeat the whole post here, just the key steps, but I strongly encourage you to head on over and take a look at Aldiantoro’s post!

sudo apt-get install libc6-i386
wget -c http://oss.oracle.com/debian/dists/unstable/main/binary-i386/libaio_0.3.104-1_i386.deb http://oss.oracle.com/debian/dists/unstable/non-free/binary-i386/oracle-xe-universal_10.2.0.1-1.1_i386.deb
sudo dpkg -i --force-architecture libaio_0.3.104-1_i386.deb
sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb
sudo /etc/init.d/oracle-xe configure

Then edit your ~/.bashrc

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
Posted in Uncategorized | Tagged , | 3 Comments