How to edit products using Eclipse

From OpenQuote

Jump to: navigation, search
Note: Requires OpenQuote 1.2 or later.

It is perfectly possible to create and edit products entirely from the "Product Manager" portal page using Alfresco's built in editors. But there are real advantages to be had by using an IDE like Eclipse to do this kind of work. Eclipse makes it far easier to edit product content by providing all of the tools and features that developers expect these days.

While the notes here are focused on using Eclipse, and indeed the demo products (MotorPlus, LifePlus, etc) come pre-configured as Eclipse projects, you will see in a moment that there is nothing to stop other IDEs or editors being used in the same way.

The key to editing product content outside of Alfresco is Alfresco's ability to expose all or parts of it's repository as an SMB file systems. This allows those areas of the repository to be mounted onto a product developer's PC as a filesystem and for the content to edited just as though it was local files.

SMB is supported by MS Windows, MacOS X, and Linux. Currently (as of OpenQuote 1.2EA1), the notes here are somewhat MacOS X focused. This will be addressed in the full 1.2 release.

[edit] Editing products using a Community installation

  • If you don't already have OpenQuote community installed, download it from source forge and run through the normally installation procedure.
  • If you don't have Eclipse, download it from here and install it.
  • If OpenQuote isn't already running, start it now by running <OpenQuote Home>/bin/run.sh. When you see [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 1m:24s:935ms in the log, it is ready.
  • From the command line, cd into a folder which is convenient for you to work in, and execute the following two command to mount the Product space:
mkdir products
mount_smbfs //davy:davy@localhost:1445/Alfresco/Product products
  • In Eclipse, setup a linked resource called "OPENQUOTE_TEMP" to point Eclipse at a temporary folder which it can use to store working files as it processes product content. In Eclipse go to Preferences->General->Workspace->Linked Resources to do this.
  • Setup a classpath variable in Eclipse called "OpenQuote Library" to list all of the jar files needed during product development. In Eclipse, go to Preferences->Java->Build Path->User Libraries. Click "New" and enter "OpenQuote Library" as the User library name, then click OK. Now click "Add JARs...", navigate to your OpenQuote installation, then into the "lib" folder and add all of the files in that folder.
  • Import the product projects into Eclipse. From "File->Import", select "General->Existing Projects into Workspace". Hit the Browse button next to "Select root directory", locate the "products" folder and click "Open". Eclipse will find all of the product projects, and list them. Click "Finish" to add them all to your workspace.

[edit] Editing product in a system development environment

  • Get a local build of OpenQuote as described here. You only need to the "development" and "openquote" projects.
  • Add openquote/BuildCommands.xml into the Eclipse Ant view, and run the "openquote:commands/jboss: start server" target. JBoss will take a minute or two to start. When you see [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 1m:24s:935ms in the log, it is ready.
  • Again from the Ant view in eclipse, run the "openquote:commands/alfresco: mount product space" target. This target will mount the product space onto your filesystem in a folder next to your openquote source tree in a folder called "openquote-products".
  • Setup a linked resource in Eclipse called "OPENQUOTE_TEMP" to point Eclipse at a temporary folder which it can use to store working files as it processes product content. In Eclipse go to Preferences->General->Workspace->Linked Resources to do this.
  • Setup a classpath variable in Eclipse called "OpenQuote Library" to list all of the jar files needed during product development. In Eclipse, go to Preferences->Java->Build Path->User Libraries. Click "New" and enter "OpenQuote Library" as the User library name, then click OK. Now click "Add JARs...", navigate to your openquote project, then down into target/lib and add all of the files in that folder to the library.
  • Import the product projects into Eclipse. From "File->Import", select "General->Existing Projects into Workspace". Hit the Browse button next to "Select root directory", locate the "openquote-products" folder and click "Open". Eclipse will find all of the product projects, and list them. Click "Finish" to add them all to your workspace.

[edit] Example session

Now you can make changes to product content from Eclipse. Any changes that you make to content will immediately appear in the Alfresco repository, and be immediately apparent in the OpenQuote Sandpit portlet for test. There is no longer any need to clear caches, or reset products. OpenQuote monitors the changes you make and takes care of these things for you.

For example:

  • Login to OpenQuote now as the user "davy".
  • Go to the Sandpit page, and select the "AIL.Demo.LifePlus" product and hit "Get a Quote". You'll see a page with three questions, including "Are you currently a smoker?". Leave this page open in your browser.
  • From Eclipse, open the LifePlus project, and then edit the QuotationPageFlow.xml. Change "Are you currently a smoker?" to "Are you a smoker?" and save the change.
  • Now if you go back to your browser and hit refresh you'll see the question text change.

This same kind of process will work for all product content including product Registry changes.

Personal tools