Laliwala IT Services

Laliwala IT Services
Website Development

Friday, June 24, 2011

Microsoft SharePoint Services, share point development, share point training, sherpoint integration, architecture

We implements and deploys Microsoft SharePoint Services in client organizations in order to help them improve employee productivity and efficiency of their business processes.

Windows SharePoint Services, built on Windows Server, provides a framework for building dynamic web based applications that enable users, across an organization, to collate and share information and knowledge, and work in coordination with each other. Extensive document management, storage and collaboration capabilities and tools are included with SharePoint Server. It has a flexible architecture, making it easy to adapt and modify the applications to meet changing business needs. SharePoint Services is easy to use and deploy as it offers tight integration with Microsoft Office applications.

SharePoint includes a set of tools and components that can be used to create SharePoint websites. A whole range of ASP.NET components and web parts can be assembled and integrated to develop tailor made solutions that match the unique requirements of each organization. SharePoint can be used to create online workspaces to conduct meetings, discussions, and other collaborative tasks that helps employees to pool resources and work for efficiently thereby improving the productivity of individual users as well as the team as a whole.

Sharepoint

Wednesday, June 22, 2011

Drupal Training, Drupal Administration, Drupal Development, Drupal installation, Drupal configuration, Drupal security

Drupal Training

Objective
Drupal is a well-known and award winning free, Open Source Content Management System (CMS). Drupal 5 Days Training covers all the important aspects of Drupal Administration and Development. This training covers theory as well as practical and hands-on sessions. Drupal Administration includes installation, configuration, backups, updates, user management, content management, security and permissions. Drupal Development includes customization, module creation, workflow, integration, theme creation and maintenance of a Drupal website. After this training you will be able to build powerful Drupal Portal and CMS for any organization with Web2.0 and collaboration features such as blogs, forum, wiki, product catalogs, newsletters, polls, calendar and maps integration.

Duration
40 Hrs (8 Hrs * 5 days)

Location
On Request

Batch size
Batch size 5-10 participants

Course Contents



Day 1 - Drupal Administration

Understanding of CMS
Introduction to Drupal
Use of Drupal
Drupal community
Setting up The Drupal Environment
Installation of Drupal
Basic Functionality (Menu, Blocks, Modules, links, etc..)
Site Configuration
Access Control
Basic Content Creation

Day 2 - Drupal Administration

Advanced Content Management (Taxonomy, Tags, CCK, etc..)
Drupal Interface
Themes Management
Modules Management
SEO
Drupal Backup
Drupal Upgrade
Installing Plugins

Day 3 - Drupal Development

Understanding Drupal
Drupal Architecture
Drupal Core Components
Module Development
Updating existing module
Disabling and uninstalling modules
Hooks
Actions
Triggers

Day 4 - Drupal Development

Database Interaction
Forms API
Working with User
Nodes and Block
Filter System
Localization

Day 5- Drupal Development

Theme Creation
Session Management
Performance
Caching
Throttling
Dynamic JavaScript
Drupal Optimization
Development Best Practices


Prerequisites
Basic PHP and Database

Hardware Requirements
Desktop or Laptop 2.0 GHz, 1GB RAM with Windows XP and internet facility

Drupal development training, Drupal Administration training

Drupal Training, Drupal development Training, Drupal developer Training



Drupal Content Management System

Wednesday, June 15, 2011

Training Liferay System Administration

Training Liferay System Administration

Course Contents

(1 Day)
Liferay Tomcat Bundle Installation
MySQL Database Integration
Liferay Clustering
- Cluster Architecture
- Recommendation
Multicasting
EHCache Configuration and setting
Hibernate Configuration
Jackrabbit Configuration
Lucene Configuration
Load Balancing using Apache HTTP Server
Performance setting and monitoring
Setting Log Level
LDAP-SSO Integration
Liferay Deployment
Server Administration
Portal Monitoring
Liferay Monitoring, Back up and upgrade

liferay training





------------------------------------------------------------------------------------
Laliwala IT

Office Address :
Mangal Girdhar Compund,
Nr. B.G.Tower, Out Side Dehli Darwaja,
Shahibaug Road, Dehli Darwaja,
Ahmedabad - 380004, Gujarat, India.

Please send us for Business Inquiry to :
E-mail : contact@laliwalait.com
E-mail : training@laliwalait.com

Mobile No. : +91-09904245322  

Thursday, June 2, 2011

Alfresco Content Management System

Alfresco Content Management System

Attune has Alfresco Expertise like…

Attune Infocom is one of the leading companies in India with hands on Alfresco implementation and customization experience. We have been involved with Alfresco enhancement as per the client’s requirement and have successfully completed certain enterprise level Alfresco assignments on consultation, integration and customization projects. Our expertise in Open Source technology can help you switch over to Alfresco ECM as seamlessly as possible.

Main categories of ECM

Enterprise CMS (ECM): An enterprise content management (ECM) system is concerned with content, documents, details and records related to the organizational processes of an enterprise. The purpose is to manage the organization’s unstructured information content, with all its diversity of format and location

Web CMS (WCM):A ‘web content management’ (WCM) system is a CMS designed to simplify the publication of Web content to Web sites, in particular allowing content creators to submit content without requiring technical knowledge.

Document management system (DMS): A document management system (DMS) is used to track and store electronic documents and/or images of paper documents. It is often viewed as a component of enterprise content management (ECM) systems and related to digital asset management, document imaging, workflow systems and records management systems.

Attune Infocom offers a full rank of services for Enterprise Content Management (ECM) Systems and platform implementation. It will allow businesses to reduce the costs and increase operational efficiency by exercising control over their business processes. Attune Infocom provides ready to use solutions and platform customization and integration of CMS systems with enterprise applications, including all types of up-gradation. Attune Infocom is capable of merging services from different CMS vendors to deliver the solutions tailored to your business needs.

Alfresco offers true Enterprise Content Management (ECM) and aspires to be “Documentum fast and free”, and Alfresco can store a wide range of digital content in flexible, smart spaces. Content is accessible through a web interface, shared network folders, FTP, WebDav, and other methods.

Attune Infocom offers organizations users to set up Alfresco to process content in certain ways, according to business rules and workflow requirements. It can also apply version control to documents automatically, making it easy and safe to collaborate and update documents. Alfresco is regarded as the most powerful open-source enterprise content management system. Using Alfresco, administrators can easily create rich, shared content repositories.

Alfresco Community Edition is design to geared towards users who require a high degree of modularity and scalable performance. Alfresco includes a content repository, an out-of-the-box web portal framework for managing and using standard portal content, a CIFS interface that provides file system compatibility on Microsoft Windows and Unix-like operating systems, a web content management system capable of virtualizing webapps and static sites via Apache Tomcat, Lucene indexing, and jBPM workflow. The Alfresco system is developed using Java technology.

Utility of Alfresco

Enterprise content management for documents, web, records, images, and collaborative content development. In addition, Alfresco provides numerous interfaces (including CIFS, WebDAV, REST APIs, Web Services APIs, Java APIs, CMIS) and application development capabilities (Webscripts, Surf Web application framework)

Alfresco comes with enrich features like…

Document Management
Web Content Management (including full webapp & session virtualization)
Repository-level versioning (similar to Subversion)
Transparent overlays (similar to unionfs)
Records Management
Image Management
Auto-generated XForms with AJAX support
Integrated Publishing
Repository access via CIFS/SMB, FTP, WebDAV and CMIS
jBPM workflow
Lucene search
Federated servers
Multi-language support
Portable application packaging
Multi-platform support (officially Windows, Linux and Solaris)
Browser-based GUI (official support for Internet Explorer and Firefox)
Desktop integration with Microsoft Office and OpenOffice.org
Clustering support

Attune Infocom provides training, consulting and development / customization services on Alfresco / Liferay Portal integration, Alfresco / Jboss integration and Alfresco / Drupal integration.

liferay theme development

http://cms-and-portal.blogspot.com/2011/05/liferay-theme-development-for-telecom.html






Liferay Theme Development for Telecom United

About Telecom United
Telecom United is a community of telecommunications professionals who choose to work together under one banner, forming franchises or virtual companies by sharing resources, skills and networking to create all the benefits of a large international company whilst remaining personal, efficient and leaving the profit in the hands of those that produce it. Around the globe independent telecommunications professionals have organized to share resources and skills. - Motivated professionals and suppliers leverage their membership to benefit themselves and their clients. Around the globe motivated independent telecommunications professionals are sharing resources and skills, leveraging this network to benefit themselves and their clients. Telecom United is for Qualified telecommunications professionals in sales, a technical field or in a supply chain, Click here to investigate the opportunities.

Saturday, May 28, 2011

liferay portlet development

Deploying portlet
liferay portlet development
 liferay portal development
liferay portal assessment services

There are 2 main ways to deploy a portlet on Liferay.

1ST, but you need to allow autodeploy, you can use /liferay/deploy this is very simple: just drop in that directory your portlet (as a war file) and watch it beeing deployed on the portal.
This is the way plugins available on Liferay's SVN are deployed.

I concider it very reliable and fast. Very efficient when developing and testing your own (liferay) portlets in the field.

The second method is to use Liferay User Interface (UI). Simply log in with a user allowed to install new portlets and go to Admin > Plugins
You will find there a "Install More Portlets" button. Click on it.
There you have several options:

one is to use a local file and upload it this way to the server,
an other is download file, when you know where the porlet war file lies on the net,
and the default is to use Liferay repository, which means you are going to install a portlet part of one of the suggested online repositories.


Friday, April 1, 2011

liferay bigbluebutton

integration liferay bigbluebutton


Liferay Enterprise Edition (EE)

Liferay Community Edition (CE)

version 4.1.0.

Liferay Portal 6

Liferay5.2 EE

Liferay 6

Liferay Community Edition Version6.1

Liferay Portal 6.0.5 Community Edition

Liferay 6.0.6

Liferay Portal development platform for versions 6.0

liferay 5.3

Liferay Portal 5.2.x

Liferay version 5.1.2

Liferay Portal Community Edition 6.0.6

Thursday, March 31, 2011

liferay tutorial custom sql - liferay database configuration training

Liferay tutorial 

Liferay custom sql 
Liferay portal tables
Liferay Mysql
Liferay database
 
In this liferay tutorial, we will learn about Custom-sql.

  • custom sql query in liferay portal
  • custom SQL configurations
  • default database
  • how to build custom sql
  • portal database
  • custom SQL in liferay
  • How to configure Liferay Database
  • MySQL, Oracle, MS SQL Server
  • custom SQL statements
  • database SQL script
  • Liferay Database Document
  • How to Make Database connection in Liferay
  • SQL Database tables

How to work with Custom-sql in liferay portal?


Step-1: liferay portal custom sql Create ext.xml file


Create the file default-ext.xml under ext-impl/src/custom-sql (You need to first create this folder)

<?xml version="1.0"?>

<custom-sql>
<sql file="custom-sql/book.xml" />
</custom-sql>

(This file will list all the custom sql files developed for a specific application.
Also refer default.xml under portal source)

Step-2: liferay portal custom sql Create book.xml file
------

Create the file book.xml, under the same folder, which will contain all the application specific queries as name / value pairs.

<?xml version="1.0"?>
<custom-sql>
<sql id="com.ext.portlet.library.service.persistence.BookFinderImpl.getBooks">
<![CDATA[
SELECT
{Book.*}
FROM
Book
WHERE
(Book.title like ?)
]]>
</sql>
</custom-sql>

(The beauty is the queries are separated from the code, so that we can change them any time without touching the code)




Step-3: liferay portal custom sql Over ride portal-ext.properties
------

Over-ride the property in portal-ext.properties

custom.sql.configs=\
custom-sql/default.xml, \
custom-sql/default-ext.xml

So far we have seen the configuration part.

Now we'll move on to the implementation part.

Step-4: liferay portal custom sql create bookfinderimpl.java
------

Create the file "BookFinderImpl.java" under service/persistence

package com.ext.portlet.library.service.persistence;

import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

public class BookFinderImpl extends BasePersistenceImpl implements
BookFinder{

}

Step-5: liferay portal custom sql ant build service
------

Do ant build-service, so that the necessary interface is generated.
Refresh the workspace in eclipse to see everything compiled properly.

Step-6: liferay portal custom sql update bookfinderimpl
------

Now write the actual logic to access the custom SQL. You need to update the BookFinderImpl
we developed in the previous step.

// the name of the query
public static String GET_BOOKS = BookFinderImpl.class.getName()
+ ".getBooks";

// the method which will be called from the ServiceImpl class
public List<Book> getBooks(String pattern) throws SystemException {

Session session = null;
try {
// open a new hibernate session
session = openSession();

// pull out our query from book.xml, created earlier
String sql = CustomSQLUtil.get(GET_BOOKS);

// create a SQLQuery object
SQLQuery q = session.createSQLQuery(sql);

// replace the "Book" in the query string with the fully qualified java class
// this has to be the hibernate table name
q.addEntity("Book", BookImpl.class);


// Get query position instance
QueryPos qPos = QueryPos.getInstance(q);

// fill in the "?" value of the custom query
// this is same like forming a prepared statement
qPos.add(pattern);

// execute the query and return a list from the db
return (List<Book>)q.list();

/*
// use this block if you want to return the no. of rows (count)

int rows = 0;

Iterator<Long> itr = q.list().iterator();

if (itr.hasNext()) { Long count = itr.next();

if (count != null) { rows = count.intValue(); } }

return rows;
*/
} catch (Exception e) {
throw new SystemException(e);
} finally {
closeSession(session);
}
}

Make the necessary additional imports.

import java.util.List;

import com.ext.portlet.library.model.Book;
import com.ext.portlet.library.model.impl.BookImpl;
import com.liferay.portal.SystemException;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.SQLQuery;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.util.dao.orm.CustomSQLUtil;

Note:

To get the result between a start and end index, you have to use,

QueryUtil.list(q, getDialect(), begin, end);

in the place of

q.list();

where, you will pass the parameters (begin and end) from your ServiceImpl class.

Step-7: liferay portal custom sql write method booklacalserviceimpl.java
------

write the method in BookLocalServiceImpl.java

public List<Book> searchBook(String title) throws PortalException,
SystemException, RemoteException {

// return bookPersistence.findByTitle(title);
return BookFinderUtil.getBooks("%" + title + "%");
}


Step-8: liferay portal custom sql and build service
------

run "ant build-service" again passing the service.xml file as parameter.

This will update the corresponding interface with the new method defined.


Step 9: liferay portal custom sql add search2 button
-------

in view.jsp

Add for 'search2' button

<input type="button" value="Search2" onClick="<portlet:namespace />findBook('search2');" />

Note: the findBook JS function is now accepting a parameter, do changes to this function and also to the "Find Book" button.


Step 10: liferay portal custom sql write code addbookaction.java
-------


Write code in AddBookAction.java to invoke the new finder API thru the BookFinderUtil.

if (Validator.isNull(cmd)) {
BookLocalServiceUtil.create(bookTitle);
} else {
List<Book> results = null;
if (cmd.equals("find")) {
results = BookLocalServiceUtil.findBooks(bookTitle);
} else if (cmd.equals("search")) {
DetachedCriteria dCriteria = DetachedCriteria.forClass(Book.class);
dCriteria.add(Restrictions.like("title", "%" + bookTitle + "%"));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);
results = (List)BookLocalServiceUtil.dynamicQuery(dynamicQuery);
} else {
results = (List)BookLocalServiceUtil.searchBook(bookTitle);
}
req.setAttribute("results", results);
req.setAttribute("cmd", cmd);
}

Step 11 : liferay portal custom sql deploy
========
deploy :

verify we've done all the steps properly
ant deploy from ext-impl,
ant deploy-fast from ext-web,
restart tomcat

Congratulations !!!

Glossary:
--------

1. Look at the custom-sql xml files written for some liferay portlets.

2. How to replace strings in the sql statements using StringUtil.replace.




Liferay tutorial Dynamic Query - hibernate api

Liferay tutorial Dynamic Query

 Liferay action
Liferay services
Liferay tomcat

===============================================================
Writing Dynamic Query using Hibernate API's


http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Queries+2%3A+DynamicQuery+API

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How+to+create+a+custom+query+in+liferay

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How+to+create+a+custom+query+in+ext+for+Liferay+models


Forming a Dynamic Query :
=========================
Step 1:

in AddBookAction.java:

if (Validator.isNull(cmd)) {
BookLocalServiceUtil.create(bookTitle);
} else {
List<Book> results = null;
if (cmd.equals(" find" )) {
results = BookLocalServiceUtil.findBooks(bookTitle);
} else {
DetachedCriteria dCriteria = DetachedCriteria.forClass(Book.class);
dCriteria.add(Restrictions.like(" title" , " %" + bookTitle + " %" ));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);
results = (List)BookLocalServiceUtil.dynamicQuery(dynamicQuery);
}
req.setAttribute(" results" , results);
req.setAttribute(" cmd" , cmd);
}

Make following imports

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.liferay.portal.kernel.dao.orm.*;
import com.liferay.portal.dao.orm.hibernate.DynamicQueryImpl;


Step 2:
=======
in view.jsp

Add for 'search' button

<input type=" button" value=" Search" onClick=" <portlet:namespace />findBook('search');" />

Note: the findBook JS function is now accepting a parameter, do changes to this function and also to the " Find Book" button.

Step 3:
=======

in Success.jsp update this

if (Validator.isNotNull(cmd)) {
books = (List)request.getAttribute(" results" );
} else {
books = BookLocalServiceUtil.getAllBooks();
}

Step4 :
========
verify we've done all the steps properly
ant deploy from ext-impl,
ant deploy-fast from ext-web,
restart tomcat

Congratulations Liferay developers!!!


Liferay example tutorial : finder tag in service.xml file

Liferay update services.xml file
Liferay example


===============================================================
Generating finder methods using finder tags in service.xml file
===============================================================

1. update the service.xml file with order by clause

< !-- order by -->
< order by=" asc" >
< order-column name=" title" />
< /order>


More on order by (sorting). Taken from DTD file.

< !--
The attributes of the order-column element allows you to fine tune the ordering
of the entity.

For example:

< order by=" asc" >
< order-column name=" parentLayoutId" />
< order-column name=" priority" />
< /order>

The above settings will order by parentLayoutId and then by priority in an
ascending manner.

For example:

< order by=" asc" >
< order-column name=" name" case-sensitive=" false" />
< /order>

The above settings will order by name and will not be case sensitive.

For example:

< order>
< order-column name=" articleId" order-by=" asc" />
< order-column name=" version" order-by=" desc" />
< /order>

The above settings will order by articleId in an ascending manner and then by
version in a descending manner.
-->


2. update the service layer with new finder methods.

< !-- Finder methods -->

< finder name=" BookId" return-type=" Book" >
< finder-column name=" bookId" />
< /finder>

< finder name=" Title" return-type=" Collection" >
< finder-column name=" title" />
< /finder>

< finder name=" Title_Author" return-type=" Collection" >
< finder-column name=" title" />
< finder-column name=" author" />
< /finder>

2. Run " ant build-service" to re-generate the service layer.

You'll find the new finder methods generated.

difference fetchBy and findBy methods.

3. Writing a new method in BookLocalServiceImpl.java to invoke a finder method.

public List< Book> findBooks(String title)
throws PortalException, SystemException, RemoteException {

//return bookPersistence.findByTitle(title);
return BookUtil.findByTitle(title);
}

When to use the persistence object and the interface.

4. update view.jsp

Add a new button " Find Book" and a hidden variable 'cmd'

< input type=" hidden" name=" < portlet:namespace /> cmd" />
< input type=" button" value=" Find Book" onClick=" < portlet:namespace /> findBook();" />


Write new JS function,

function < portlet:namespace /> findBook() {
var frm = document.< portlet:namespace /> fm;

frm.< portlet:namespace /> cmd.value = 'find';

frm.submit();
}

5. updating the AddBookAction.java to invoke the new API.


Add the line,

String cmd = ParamUtil.getString(req, " cmd" );

replace,

BookLocalServiceUtil.create(bookTitle);

with,

if (Validator.isNull(cmd)) {
BookLocalServiceUtil.create(bookTitle);
} else {
List< Book> results = BookLocalServiceUtil.findBooks(bookTitle);
req.setAttribute(" results" , results);
req.setAttribute(" cmd" , cmd);
}

un-comment setForward and comment out res.sendRedirect

6. updating the success.jsp

replace,

List< Book> books = BookLocalServiceUtil.getAllBooks();

with,

List< Book> books = null;

String cmd = ParamUtil.getString(request, " cmd" );

if (Validator.isNotNull(cmd)) {
books = (List)request.getAttribute(" results" );
} else {
books = BookLocalServiceUtil.getAllBooks();
}


7. deploy

verify we've done all the steps properly
ant deploy-fast from ext-web (we ve only modified files view.jsp and success.jsp)
ant deploy from ext-impl
restart the server and confirm the find feature is working perfectely fine.

Congratulations !!!

8. Advantages and dis-advantages of using finder tags.

a. it generated the indices for the database.
b. can only do " EQ" finds
c. " where" attribute can be used.

eg. where=" dateAdded is not NULL"

Liferay tutorial json : call service api "Liferay tutorial version 5.2"

 Liferay JSON tutorial
Liferay services layer
Liferay version 5.2.x
Liferay remote method


===============================================================
Invokining service layer thru JSON.
===============================================================

pre-requisite for JSON to work, we should have a remote method.

1. look into the following file

ext-web/docroot/html/js/liferay/ext_service_unpacked.js

Note: In liferay version 5.2.x onwards this file is "ext_service.js"

Note: in the earlier versions the file name is ext_service_unpacked.js

2. define a new java script function in view.jsp

< script src="/html/js/liferay/ext_service.js">< /script>

< script>
function < portlet:namespace />addBookThruJSON() {

var frm = document.< portlet:namespace />fm;
var title = frm.< portlet:namespace />book_title.value;
var params = {
title:title
};
Liferay.Service.Library.Book.create(params);
alert('Book successfully added');
frm.< portlet:namespace />book_title.value = "";
}
< /script>

3. Update the form,

Add another button to the form which when clicked will invoke addBookThruJSON() javascript method.

< input type="button" value="Add thru JSON" onClick="< portlet:namespace />addBookThruJSON();">

Now do "ant deploy-fast" from ext-web and see adding of the book thru json is working perfectly fine.

in the next example we'll see how to write a call back.





Liferay tutorial web service


 Liferay tutorial web service
Liferay update service 
Liferay book



===============================================================
7. Exposing the method as a web service
===============================================================
7.1 update service.xml
----------------------
specify remote-service="true" (default)
difference between local service and remote service.
Needless to say, once you do any modifications to service.xml file, please run "ant build-service"
7.2 updating service layer class - 2
------------------------------------
(file location - ext\ext-impl\src\com\ext\portlet\library\service\impl\BookServiceImpl.java)
public Book create(String title)
throws PortalException, SystemException, RemoteException {
return bookLocalService.create(title, "abcd");
}
(insert the additional import statements required to compile this class,)
import com.ext.portlet.library.model.Book;
import java.rmi.RemoteException;
import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
Important: Dont forget to re-generate the service layer after inserting this method into BookServiceImpl.java
7.3 steps to expose as a web-service
------------------------------------
a. go to "/ext/ext-impl"
b. execute "ant build-wsdd -Dservice.file=src/com/ext/portlet/library/service.xml"
c. make sure the build is successful
d. from ext level run "ant deploy"
e. re-start the server
g. make sure our new web-service is listed out and hence exposed.
h. in subsequent sessions we'll see how to consume this web-service from any other application.
Excercise:
Expose the getAllBooks method as a web service.

struts portlet tutorial, struts portlet, Irshad Mansuri

Prepared by Aasif and Ahmed under the guidance of Irshad Mansuri

Attune Infocom
----------------------------------------------------------------------------------
===============================================================
6. Struts Portlet - Adding Redirect to avoid duplicate insertion
===============================================================

6.1 update struts-config.xml
----------------------------

add /ext/library/success so that we have a landing path

(location "ext/ext-web/docroot/WEB-INF")

<action path="/ext/library/success" forward="portlet.ext.library.success" />

run "ant deploy" from "ext-web"


6.2 update AddBookAction.java
-----------------------------

* We are going to modify our java to use a redirect instead of a forward
* A forward still submits to the page that it lands on. But a redirect will no longer retain the submit state on the landing page

Comment out the forward line
//setForward(req, "portlet.ext.library.success");

replace with these lines

PortletURL redirectURL = ((ActionResponseImpl) res).createRenderURL();
redirectURL.setParameter("struts_action", "/ext/library/success");
res.sendRedirect(redirectURL + "&title=" + bookTitle);

Make necessary imports


6.3 ant deploy
--------------

ant deploy from "ext-impl", re-start server and check the previous problem is not happening anymore.

6.4 Exercise
------------

What changes are required if we dont want to display the book title in the success.jsp file.

Adding database interaction, Retrieving records

Prepared by Aasif and Ahmed under the guidance of Irshad Mansuri

Attune Infocom
----------------------------------------------------------------------------------
===============================================================
5. Adding database interaction - Retrieving records

5.1 Update BookLocalServicImpl.java
------------------------------------

add the new method

public List<Book> getAllBooks()
throws PortalException, SystemException, RemoteException {
return bookPersistence.findAll();
}

append the new import,

import java.util.List;

5.2 run ant build-service again to re-generate the corresponding Util classes
-----------------------------------------------------------------------------

a. execute "ant build-service -Dservice.file=src/com/ext/portlet/library/service.xml"

b. execute "ant deploy" from ext-impl to compile and deploy all the generated file and make sure the build is SUCCESSFUL.


5.3 update "init.jsp"
---------------------

Make additional imports. The intent is to get access to generated service layer classes inside any of the jsp's of this portlet.

(location "ext/ext-web/docroot/html/portlet/ext/library")

<%@ page import="java.util.List" %>
<%@ page import="com.ext.portlet.library.model.Book" %>
<%@ page import="com.ext.portlet.library.service.BookLocalServiceUtil" %>








5.4 update "success.jsp" (append the below code)
------------------------------------------------

(location "ext/ext-web/docroot/html/portlet/ext/library")

<%
String bookTitle = request.getParameter("title");

// new line inserted.
List<Book> books = BookLocalServiceUtil.getAllBooks();
%>

<table align="center" cellspacing="10" cellpadding="3">
<tr>
<td style="font-weight:bold">Book Title: </td>
<td><%= bookTitle %></td>
</tr>
</table>

<!-- new code added -->
<table border="1">
<%
for (Book book : books) {
%>
<tr>
<td>Book Id: <%= book.getBookId()%></td>
<td>Title: <%= book.getTitle() %></td>
</tr>
<%
}
%>
</table>

5.5 ant deploy to tomcat
------------------------

a. run "ant deploy-fast" from "ext-web"

b. re-start the tomcat server

c. see the updates to the library portlet (the records are retrieved properly)

Exercise:

display the dateAdded column in the table where all the books are listed.


5.6 the problem with page re-fresh
----------------------------------

everything is working fine. try to refresh the page and see what happens.

duplicate record is getting added to the database. In the next section, we'll see how to handle this
















See that after refreshing duplicate record is added.

Check the table contents which shows duplicate recors.