OpenPortal - WebSynergy

Portal Server 7.2 is now available [download]. Based on the OpenPortal project, this release has several new features such as Delegated Administration, Google Gadget support, and JSR 286 / Portlet 2.0 support.

Looking ahead, Project WebSynergy [earlier post, info, download] is combining the efforts of Sun Portal and Liferay, and producing a lightweight, modular framework for developing and deploying next-gen webapps targeting the web 2.0 crowd. Looking forward to seeing this partnership in action!

For more information, visit the Sun/Liferay Community Page.
Project WebSynergy 

We had recently started work on semantic enabling Project WebSynergy's community feature.

Read my blog on that.

For doing this we had to extend the existing table structure by adding new columns
and  also creating new tables.

In this blog I will show how easy it is do this using
Project WebSynergy's ServiceBuilder framework 

The use case for this example will be to add an ontologyId column
to the existing BlogsEntry table.
We would also create a new BlogsEntryOntologyMapping Table. 

Open the
<synergy-workspace>\e2demo\synergy\liferay\patch\portal-impl\src\com\liferay
\portlet\blogs\service.xml

in your favorite IDE (we would recommend NetBeans)

Each <entity> tag corresponds to a table in the DB.

To add "OntologyId" column to the BlogsEntry table
add the following in <entity name="BlogsEntry"> </entity> tag

<column name="ontologyId" type="String" />

We can also add a finder method corresponding to the column that we have just added.
Using this the callers can get the blog entries corresponding to an ontologyId.

        <finder name="OntologyId" return-type="Collection">
            <finder-column name="ontologyId" />
        </finder>
This would generate a findByOntologyId() in the BlogsEntryPersistence
and BlogsEntryPersistenceImpl.

To add a new BlogsEntryOntlogyMapping table add the following 

 <entity name="BlogsEntryOntlogyMapping" local-service="true" remote-service="true">
        <column name="entryId" type="long" primary="true" />
        <column name="ontologyId" type="long" />
    </entity>

Next we need to add getBlogEntriesByOntologyId() to the BlogsEntryLocalServiceImpl class.

public List getBlogEntriesByOntologyId(String ontologyId) throws SystemException{ 

             List blogtnriesList = blogsEntryPersistence.findByOntologyId(ontologyId);

return blogtnriesList;

You will get a compilation error on the blogsEntryPersistence.findByOntologyId(ontologyId) line.
This is because the method is still not added to the BlogsEntryPersistence interface.

But dont mind that as of now :)

After making these changes,
cd to <synergy-workspace>\e2demo\synergy\liferay\portal\portal-impl
in the command prompt and run the following ant script.

ant build-service-portlet-blogs 

This generates all the service, util, persistence and  factory classes that are relevant to Blogs.

Open the <synergy-workspace>\e2demo\synergy\liferay\portal\portal-service\src\com\liferay\portlet\blogs \service\persistence\BlogsEntryPersistence, you will find that the findByOntologyId() is newly generated.

Open the <synergy-workspace>\e2demo\synergy\liferay\portal\portal-service\src\com\liferay\portlet\blogs\ service\BlogsEntryLocalService and BlogsEntryLocalServiceUtil, you will find that the getBlogEntriesByOntologyId() is newly generated.

Now you can call the BlogsEntryLocalServiceUtil .getBlogEntriesByOntologyId() from any portlet class or jsp,
you will get the blog entries that the specific ontologyId applied to that.

Next the changes have to be made in the db scripts.

For this run ant build-db in the command prompt that you opened before.

Open the <synergy-workspace>\e2demo\synergy\liferay\portal\sql\portal-tables.sql and <synergy-workspace>\e2demo\synergy\liferay\portal\sql\create-*.sql.

You will find that the scripts have been suitably modifled.

For the changes to be reflected on the DB (could be MySQL, HSQL, etc),
drop the existing tables under lPortal database if any, and re-start the server.
The ontologyId column would be added to the BlogsEntry Table and BlogsEntryOntologyMapping table would have been created.

Extending Project WebSynergy's tables is as simple as this. You can extend this example to any other feature like wiki, bookmarks, etc.

 


   WebSynergy

 Semantic Web

The community feature of Project WebSynergy has been semantically enabled. This is a preview version of that.
This is taking the first step towards Web3.0 enablement.

So whats the Semantic Web ??
The semantic web is an evolving extension of the world wide web, in which web content can be expressed not only in a natural language but also in a format that can be read and used by machines for processing the information. It is w3c recommendation.

As a human when we write and read a blob of text, we know what it means but a machine reading a bunch of characters has no idea as to what it means. 

For the machine to be as intelligent as humans to decipher similar information from the text, there has to be some kind of information that the machine has to be provided with. This "extra" information is traditionally provided as meta-data in the form of tags, microformats or some other means. A much more structured and scientific way of applying metadata to a blurb of text is via what is called an ontology.

The community feature of Project WebSynergy allows you to add blog entries, wiki pages and message boards.

Refer to my blog on how to create a community in Project WebSynergy.
For an idea of what a Semantic Community Portal is, see here.

In a Project WebSynergy community, when the user creates a blog entry or a wiki page, he/she can optionally associate it with an ontology element (which acts as the metadata).
When the user views the blog entry, the other semantically related blog entries and wiki pages are displayed. The search for the related entires is not a key word search, but a semantic search done by the reasoner. The semantic reasoner infers the related ontology elements and we can see the blog entries and wiki pages for which  the related ontology elements have been applied to.

An example of the Semantic Community Portal is shown in the screen-casts.

 

 This blog describes the steps to create a community in Project WebSynergy.

  1. Login as admin@example.com/admin into Project WebSynergy
    Move your mouse over the "Welcome Admin User" message and click on Add Application
  2. In the Add Application window that shows up, select the Communities under Community Section. You can also type "communities" in the search content text box. Click on "Add" or drag and drop the portlet into one of your tabs. The communitiy portlet is now added to your tab.
  3. Click on Add Community button.
  4. Enter name (say Synergy) and click on Save. The community is created with the name that you specified.
    Click on "Available Communities" sub-tab.
  5. For the community that you just created, click on the "Actions" button and select "Manage Pages".
    Enter name for the community page (say MySynergyPage ) and click on "Add Page".
  6. Click on View Pages.
    To this community page, you can add the any  portlets. For eg.
        Blog Portlet
        Blogs Aggregator Portlet
        Wiki Portlet
        Message Boards Portlet
  7. All these portlets are available under the Colloboration section in Add Application window
The "MySynergyPage"that you have created, allows user to add / view blogs, wiki and message boards. 



The expense-report widget, that is delivered as a part of the Project WebSynergy bundle, models a typical workflow scenario  where SAW (Simple API for Workflow) could be used. In an organization, employees raise expense reports and submit them to the managers to be approved or rejected. Once submitted, the report triggers a workflow process(in a workflow engine like JavaCAPS), and becomes a pending task for the associated manager. When the manager approves/rejects the report, the report goes to the next step in the workflow process.

This widget has been integrated with a simple JavaCAPS workflow process. If a workflow engine is unavailable, the SAW calls to the  Workflow engine can be disabled using the preferences. If the call to the workflow engine is enabled without configuring the engine, it results in a system error.

 In addition to Workflow, this widget has the following features: 

  •  JMaki - Uses JMaki Yahoo Datatable
  •  Usage of ServeResource feature of JSR286 portlets for Ajax requests (For Displaying Report Details)

Click here to know more about this widget....

Here is a step-by-step screencast showcasing the widget.

     With the announcement of Project WebSynergy, the aggregation and presentation solution for most internet and enterprise applications looks to be heading in the right direction. A significant requirement for any such application is a good Content Management System (CMS). Check out this entry as to how Project Mirage is leveraged and used in WebSynergy. 

There is a preview version of the WebSynergy plug-in available at Portal Pack project site. This NetBeans plug-in supports portlet development and deployment on the new WebSynergy and also works with Liferay. For more details read here...