Friday, July 22, 2011

Managing software development teams

I have started a new blog at: http://www.selftaughtmanager.c​om/ This blog will cover a wide variety of topics on management and leadership with a particular focus on software development and individual contributors who transition into management roles. If these topics interest you please subscribe, comment and recommend this blog to others.

Thursday, June 9, 2011

A shout out to XMarks

I have to give a plug to out to Xmarks (recently acquired by LastPass).  XMarks bookmark sync allows you to synchronize your bookmarks across browsers and computers.  For someone like me I run three browsers on three computers and the ability to synchronize those bookmarks is paramount.  Being in software development I often need to test on different browsers.  I also run into problems with other websites I use that don't work on certain browsers, so for example I generally use Chrome but sometimes need to switch to IE when a site doesn't work on Chrome.  Then I have a work computer and two home computers.  All of this leaves me with nine or more browsers which  I use fairly often.  And in my line of work bookmarks are key to accessing all the information I need.  XMarks is free, but you can signup for a paid version and I encourage you to contribute to help support such a useful tool.  I was not solicited in any way to write this, I just wanted to give credit where credit is due.

Thursday, June 2, 2011

ADF Entity associations with constants

This post discusses two approaches for creating entity object associations when you need to use constants in your relationship query; this can commonly come up when you have a child entity that can have different types of parents. 

Let's start by laying out a simple example where we have a company selling products and services such that we either have an ORDER or a durational CONTRACT.  For some reason we've chosen to model these  entities separately, however in each case we are selling PRODUCTs and we'd like to share a common entity for the product lines.  So an ORDER has PRODUCTs and a CONTRACT has PRODUCTs.  To model this we'll give our PRODUCT entity two attributes:
  • ParentEntityId - the primary key of our parent
  • ParentEntityType - the type of our parent, either 'Order' or 'Contract'
For these I would have created the following EOs in my ADF model project:
  • OrderEO
  • ContractEO
  • ProductEO
And I would like the following associations:
  • OrderEOToProductEO
  • ContractEOToProductEO
How should I build these associations? 

Option 1: Build an EO Association based on ID and modify the generated association query

When you create the association you will choose the relationship between the OrderEO.OrderId and ProductEO.ParentEntityId.  You will then need to manually modify the query expression to add a condition for ParentEntityType.  

The query from source to destination would be: 
(:Bind_OrderId = ProductEO.PARENT_ENTITY_ID) AND ('Order' = ProductEO.PARENT_ENTITY_TYPE)

And from destination to source:
(:Bind_ParentEntityId = OrderEO.ORDER_ID) AND (:Bind_ParentEntityType = 'Order')

The advantage of this approach is that only the EO association is hampered with the details of how these entities are related.  The disadvantage is that you've manually changed the query and if you alter the relationship of these entities in the future (or someone else does), the query may need manual intervention to include this clause for the parent entity code.  

Option 2:  Use a transient attribute on the parent entities

Create a transient attribute in Order and Contract called "ParentEntityType" and set it to be "Derived from SQL Expression".  For OrderEO the attribute will have a value of "Order", and for ContractEO "Contract".  For example (from OrderEO.xml):

  Attribute
    Name="ParentEntityType"
    IsQueriable="false"
    IsPersistent="false"
    ColumnName="none"
    SQLType="VARCHAR"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    DefaultValue="Order"
    Precision="255"
    Expression="'Order'"

Then when you create your EO assocation you can select both attributes for the relationship.  You select OrderEO.OrderId = ProductEO.ParentEntityId and OrderEO.ParentEntityType = ProductEO.ParentEntityType.  

The query from source to destination would be: 
(:Bind_OrderId = ProductEO.PARENT_ENTITY_ID) AND (:Bind_ParentEntityType = ProductEO.PARENT_ENTITY_TYPE)

And from destination to source:
(:Bind_ParentEntityId = OrderEO.ORDER_ID) AND (:Bind_ParentEntityType = 'Order')

The advantage of this approach is that the query is generated automatically by the framework and any changes you make in the future to the association will auto-generate without manual intervention.  You've also included the constant as an attribute of the EO which could be used across multiple associations/etc. The disadvantage is that you've added an attribute to your EOs to store a constant that is probably only used in this relationship.  And if you don't want these constants in your VOs then you have to manually remove them so they only show up in the EO.

Conclusion

Either way works and I've done both, but I recommend Option 1 as this isolates the association specific logic in the EOAssociation and does not taint your EO/VO with attributes that are just for constants.  Also note that if you can model your relationship with VOs and View Links then this becomes easier because the view link will use a view criteria.



Wednesday, December 23, 2009

What is a Price Band

My first edit to wikipedia: http://en.wikipedia.org/wiki/Price_band Needs a lot of work, but hey at least I devoted a few minutes to enhancing community knowledge :)

Tuesday, December 1, 2009

Setting ADF view object bind variable programatically

Let's say you have an ADF VO defined which uses a Bind Variable, such as:

...and line.order_header_id = :paramOrderHeaderId

You want to set this parameter before the view is used, perhaps before a page is displayed which shows data from that view. There are a couple of ways to do this:


Option 1: Use a page invokeAction to call an AM method to set the bind variable. (RECOMMEND WAY)

Firstly create a method in your application module to set the view parameter, such as:


public void initializeMyVO() {
MyVOImpl vo = (MyVOImpl)findViewObject("MyVO1"); vo.setNamedWhereClauseParam("paramOrderHeaderId",new Long("100000013205391"));

}

Next in your application module definition expose this method on the client interface.

On the page which has a binding for your view, create a method action binding for this method such as:

<methodAction id="initializeMyVO" InstanceName="MyAppModuleDataControl.dataProvider" DataControl="MyAppModuleDataControl" RequiresUpdateModel="true" Action="invokeMethod" MethodName="initializeMyVO" IsViewObjectMethod="false"/>

Then create an invokeAction to call your AM method. This is done in the page definition file such as:

<invokeAction id="executeInitialize" Binds="initializeMyVO" Refresh="prepareModel" RefreshCondition="${!adfFacesContext.postback}"/>

The above refresh conditions should call this method only once when the page is shown. For more explanation on the refresh conditions see: http://download.oracle.com/docs/html/B25947_01/bcdcpal005.htm#sthref837



Option 2: Call AM method from a task flow

Optionally you can also create the same application module method as above, but call it from a task flow. Just drag and drop the method from your application module's data control to the task flow diagram. You can call the method before your page is invoked or as needed. If you have a bounded task flow, you could make this call the default activity.


Option 3: Retrieve the bind variable variable from user session data hash table



With this option you can have your bind variable use a Groovy expression to get the value of a variable that was placed in the user data hash table. This method is described in Manish Rungta's blog at: http://blog.us.oracle.com/manish/?96498842

Tuesday, October 6, 2009

Configuring JDeveloper integrated Weblogic server for SOA Suite

This post covers how to create a SOA development environement using the Weblogic server that is installed along with JDeveloper 11GR1. JDeveloper 11 includes an embedded Weblogic 10.3 installation, however that install is not setup for SOA suite. While many development setups will involve deploying from a local JDev to a standalone Weblogic server somewhere else, sometimes you want to develop and test all on the same machine and you won't need to install Weblogic seperatly to do this.

Pre-reqs: You'll need JDeveloper installed already and a database. Ideally you've already deployed something to JDev to make sure its all working.


1. First you need to install the JDeveloper SOA Suite extension. Goto Help/Check for Updates/ and pick the "Oracle SOA ..." choice. Restart JDev after this.

2. You'll need to download Oracle SOA Suite (http://www.oracle.com/technologies/soa/soa-suite.html), unzip and run setup. When prompted for a FMW home directory, select the directory created when you installed JDeveloper.

3. Setup database schemas using the RCU tool. Certain schemas (such as MDS) are required before installing SOA suite. You'll need to use the FMW RCU tool to create them. For more information consult: http://download.oracle.com/docs/cd/E12839_01/doc.1111/e14259/overview.htm.

4. Run the domain configuration wizard which will be installed at fmw/Oracle_SOA1/common/bin/config.cmd . You will prompted for a domain and you should select the DefaultDomain already created when you setup JDeveloper. It will be a path like jdeveloper/systemxxxxx/DefaultDomain .
Next select "Oracle SOA Suite 11.1.1.0" when prompted on which components to add to the domain. You should also select Oracle Enterprise Manager and Business Activity Monitoring. EM and BAM will be very helpful in developing SOA apps.
You will then be prompted for a data source (you may have already created a datasource in your Weblogic server to reuse). After that you'll be asked for the schema information for the schemas created previously using the RCU tool.

5. Start your servers! You're domain now has 3 servers: an admin server, soa server and bam server. You can start your default server and soa server using these commands:

DefaultDomain\startWebLogic
DefaultDomain\startManagedWebLogic soa_server1


Your domain's config.xml will have been modified with the new server settings including the port numbers if you forget them or need to change them.

It begins...

In my career as a software developer I often find myself scouring the Internet for solutions to problems. I also end up creating lots of notes on internal wiki pages or in personal documents as I figure things out. I've decided to attempt at keeping up a blog where I post some of this information that will hopefully be useful to other developers. This will also be useful for myself to manage my own notes.

I currently work for Oracle developing SaaS pricing applications using the latest in Java and Fusion Middleware technologies. Some frameworks and products I use often are SOA, ADF, webservices, Weblogic, Siebel, CRM OnDemand, JDeveloper, SQL, JSP, Oracle DB ... and many more.

Any opinions expressed in this blog are entirely my own and do not represent those of my employer.