Develop Portal using liferay I-Develop Portlet

Lets begin on  how to build a portal with liferay. Familiarize with below term while develop portal:

  1. Portlet.
  2. Theme
  3. Hook
  4. Layout

Capability on develop those four components is necessary in order to build a portal.

I assume you familiar with Java in order to develop portlet while 3 others component is good to have but not mandatory.

Preparation

Install it liferay eclipse plugin(http://releases.liferay.com/tools/ide/latest/stable/)

Download liferay SDK  and extract it

Download liferay tomcat bundled (6.2 CE edition) and extract it

Configure Eclipse for SDK liferay and tomcat bundled refer to image below for this step

Image

 

Now let’s rock by creating a project for a portlet

Create new project (we will use ant instead of maven since its easier.

Image

Image

The generated code will be like this

Image

Start to deploy your first portlet

 

 

Image

Start Server

 

Image

 

Check if Ojolali portlet is deployed

Image

In view mode after added into a page looks like below

 

 

 

Image

Now you can start build your own portlet. :)

The source code for article can be downloaded from

 

 

Bash Script Validation

Eg

#!/bin/bash

if [ $# -lt 3 ] ; then
echo “Usage: $0 username password true/false”
exit 1
fi

Validate and show if the param at least has 3 params

Waht about this ?

function printUsage {
echo "Usage: $0 "
exit 1
}

if [ $# -lt 4 ]; then
printUsage
fi

Exposing Simple REST Service

Exposing Simple REST Service.

Mule Studio, adding Community Edition Lib

Mule Studio by default is using

 

In order to install Community Edition following is the step:

1.  Click Help=>Install New Sofware.

2. Shoose All Available Sites

3. Click in tick box for MuleStudio Community Runtimes

4. Click Next keep continue :)

 

Here is the screenshoot that might help you guys

 

 

Screenshot_1

 

 

Happy Muleeeee

Mule ESB

Imagine you are integrating one app to another app and more app is there. The integration point is hetero gen one to another application. One application provide flat file, while the other use web service, another one provide DB read  only (view) for the integration point (we called it end point).

So, to handle this kind of situation two approach can use

1. Develop application and do formatting as per integration point.

2. Use ESB to do handle this.

 

Mule is one of the open source ESB dan provide community Edition and Enterprise Edition.

Here is the sample that I made in Mule Designer to integrate .Net (REST API) endpoint with Java (cxf API).

 

Mule ESB

Using Community Edition

Audit Master Table by Trigger

Misal Nama Table yang kita mau audit adalah table M_PRICE dan kita mau mengaudit setiap ada activity Add, Update and Delete terhadadap table ini.
Kita perlu 2 table untuk mengaudit, satu untuk mencatat data2 yang diubah (tracking), satu table lagi digunakan untuk mencatat summary sudah berapa kali berubah master table tersebut.

M_PRICE ==> master table

M_PRICE_A ==> Audit table

M_PRICE_C ==> tracking berapa kali berubah

Dan berikut Triger yang bisa kita buat dengan nama M_PRICE_T

 

create or replace
TRIGGER M_PRICE_T BEFORE INSERT OR DELETE OR UPDATE ON M_PRICE FOR EACH ROW
DECLARE
l_change_num NUMBER;
BEGIN
— Increment the change_num for this table and keep the new value
UPDATE M_PRICE_C set change_num = change_num+1 returning change_num into l_change_num;

— Insert appropriate audit row(s)
IF INSERTING THEN
INSERT INTO M_PRICE_A(PRICE_ID, PRICE_NAME, change_num, aud_action, aud_timestamp) VALUES(:new.PRICE_ID, :new.PRICE_NAME, l_change_num, ‘I’, SYSDATE);
ELSIF UPDATING THEN
INSERT INTO M_PRICE_A(PRICE_ID, PRICE_NAME, change_num, aud_action, aud_timestamp) VALUES(:new.PRICE_ID, :new.PRICE_NAME, l_change_num, ‘AU’, SYSDATE);
INSERT INTO M_PRICE_A(PRICE_ID, PRICE_NAME, change_num, aud_action, aud_timestamp) VALUES(:old.PRICE_ID, : old.PRICE_NAME, l_change_num, ‘BU’, SYSDATE);
ELSE
INSERT INTO M_PRICE_A(PRICE_ID, PRICE_NAME, change_num, aud_action, aud_timestamp) VALUES(:old.PRICE_ID, : old.PRICE_NAME, l_change_num, ‘D’, SYSDATE);
END IF;
END M_PRICE_T;

In Oracle how to Check is there any table got locked?

Here is the query

SELECT a.sid,a.serial#, a.username,c.os_user_name,a.terminal,
b.object_id,substr(b.object_name,1,40) object_name
from v$session a, dba_objects b, v$locked_object c
where a.sid = c.session_id
and b.object_id = c.object_id

Follow

Get every new post delivered to your Inbox.