Slide 1 Slide 2 Slide 3 Slide 4 Slide 5
Posted by Unknown | 1 comments

Create a Spring portlet with CRUD function in Easy Steps

What is Spring?

•    Spring is an open source framework developed by Spring Source, a division of VMware.
•    It provides lightweight solution to develop maintainable and reusable applications.
•    Any JAVA application can benefit from Spring.
  •   Simplicity
  •   Testability
  •   Loose coupling
•    Attributes of Spring
  • Lightweight
  • Inversion of control
  • Aspect oriented
  • Container
  • Framework
•    Spring is to keep the code as simple as possible.
•    It develops application with loosely coupled simple Java beans.
•    The current stable version of Spring is 3.0
•    Spring framework can be summarized in two ways.

Container:
  1. Spring can be described as a light-weight container, as it does not involve installation, configuration,  start and stop activities.
  2. It’s just simple collection of few JAVA Archive files that need to be added to the project class path.
Framework:
  1. Spring can be described as an API containing a large collection of classes, methods, interfaces, annotations, XML tag that can be used in enterprise application.
  2. API helps you to use any framework or functionality very easily in your application.
Why Spring?

•    Basic Spring philosophy
  • Better leverage
  • Avoid tight coupling among classes
  • Enables POJO programming
  • IOC simplifies JDBC
  • DI helps testability
  • No dependency cycles
  • Not exclusive to JAVA (e.g. Microsoft .NET)
  • Communicate to ORM , DAO, Web MVC



Main Spring Modules

•    Dependency Injection
o    DI is the basic design principal on which core Spring framework is built.
o    DI helps you to avoid unnecessary creation and lookup code in your application.
o    Lets you define an XML file that specifies which beans are created and what their properties are
  •     Simplifies OOP by promoting loose coupling between classes.
  •     Also called “Inversion of Control” (IoC)
  •     IoC refers to the creating instances being done by the Spring container.
  •     The control for creating and constructing object is taken care by the Spring container.
  •     Primary goal is reduction of dependencies in code
                           •  An excellent goal in any case
                           •  This is the central part of Spring

•    Aspect Oriented Programming
  •     “Aspect Oriented Programming” refers to the ability to add side effects to a class method calls  without modifying the class source code.
  •     Lets you separate business logic from system services.
  •     Attempts to separate concerns, increase modularity, and decrease redundancy
  •     Separation of Concerns (SoC)
  •     Break up features to minimize overlap
  •     Don’t Repeat Yourself (DRY)
  •     Minimize code duplication
  •    Cross-Cutting Concerns
  •      Program aspects that affect many others (e.g. logging)

Step 1: Start Eclipse IDE, create a Spring Portlet known as Spring Sample Portlet.
Go to File -> New->Liferay Project and click on Next








Step 2: Select Liferay MVC from Portlet Framework and click on Finish.
 



Step 3: Go to New -> Liferay Service Builder




Step 4: Provide Package path, Namespace as well as Author Name and unchecked the box.
Click on finish.



Step 5: Add entity, finder and order by details in service.xml.



Step 6: Add necessary Spring related library in WEB-INF/lib


Step 7: Create a Spring context file with named as PORTLET_NAME-portlet.xml.


Step 8: Add beans entry in it.


Step 9: Add Spring Dispatcher Servlet Portlet class in place of default MVC Portlet class in portlet.xml.


Step 10: Add below entry in web.xml


Step 11: Execute ant build-service command through below navigation from Eclipse IDE.
Liferay Service Artifactory generate implementation, utility classes for entity mentioned in service.xml



  
Step 12: Now Create class under src/com/liferay called Film Profile Controller, and put below code in this class.

import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping;

import com.liferay.test.model.Film;
import com.liferay.test.model.impl.FilmImpl;
import com.liferay.test.service.FilmLocalServiceUtil;


@Controller("filmController")
@RequestMapping(value = "VIEW")
public class FilmProfileController {


    @RenderMapping
    public String showFilms(RenderResponse response) {
        System.out.println("inside show films......");
        return "home";
    }

  
    @ModelAttribute
    public Film newRequest(@RequestParam(required=false) Long filmId) {
        try{
            Film film = new FilmImpl();
            if(filmId!=null){
                film = FilmLocalServiceUtil.getFilm(filmId);
            }
        return film;
        }catch(Exception e){return new FilmImpl();}
    }


    @RenderMapping(params = "myaction=addFilmForm")
    public String showAddFilmForm(RenderResponse response) {
        return "addFilmForm";
    }

    @RenderMapping(params="myaction=editFilmForm")
    public String showEditBookForm() {
        return "editFilmForm";
    }

    @ActionMapping(params = "myaction=deleteFilmForm")
    public void deleteFilmForm(@ModelAttribute Film film,ActionResponse response) {
        System.out.println("Inside delete film ...............");
        try {
            FilmLocalServiceUtil.deleteFilmProfile(film.getFilmId());
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }       
           
        }
   
    @ActionMapping(params = "myaction=addFilm")
    public void addFilm(@ModelAttribute Film film,
            BindingResult bindingResult, ActionResponse response, SessionStatus sessionStatus) {
        System.out.println("Inside add film ...............");
        try {
            FilmLocalServiceUtil.create(film);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }       
            response.setRenderParameter("myaction", "books");
            sessionStatus.setComplete();
        }
}

Step 13: Create another class called Long Number Editor under src/com/liferay/test, and put below code in this class file.

import java.beans.PropertyEditorSupport;
public class LongNumberEditor extends PropertyEditorSupport
{
    @Override
    public String getAsText() {
        String returnVal = "";
        if(getValue() instanceof Long) {
            returnVal = String.valueOf((Long)getValue());
        }
        if(getValue() != null && getValue() instanceof String[]) {
            returnVal = ((String[]) getValue())[0];
        }
        return returnVal;
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        setValue(Long.valueOf(text));
    }
}

Step 14: Create another class called My Property Editor Registrar under src/com/liferay/test, and put below code in this class file.

import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;

public class MyPropertyEditorRegistrar implements PropertyEditorRegistrar
{
    public void registerCustomEditors(PropertyEditorRegistry registry) {
        registry.registerCustomEditor(Long.class, new LongNumberEditor());
    }

}

Step 15: Edit the FilmLocalServiceImpl.java file, and put below code in Impl file. 

public Film create(long userId,long groupId,String director, String cast) throws SystemException {
       
        long filmId = counterLocalService.increment();
       
        Film film = filmPersistence.create(filmId);

        film.setUserId(userId);
        film.setGroupId(groupId);
        film.setDirector(director);
        film.setCast(cast);
        filmPersistence.update(film, false);
        return film;
    }

    public Film create(Film film) throws SystemException {
       
        long filmId = counterLocalService.increment();
       
        //Film film = filmPersistence.create(filmId);
        film.setFilmId(filmId);
       
        filmPersistence.update(film, false);
        return film;
    }
public List getFilmData(long userId)throws Exception
    {
        return filmPersistence.findByUserId(userId);
    }

    public List getCompanyFilm(long groupId)throws Exception
    {
        return filmPersistence.findByGroupId(groupId);
    }

    public int getCompanyFilmCount(long groupId)throws Exception
    {
        return filmPersistence.countByGroupId(groupId);
    }

    public void deleteFilmProfile(long filmId)throws Exception
    {

        filmLocalService.deleteFilm(filmId);
    }
}

Step 16: Now build the service and deploy the portlet.
Read more...
Posted by Unknown | 4 comments

Why to Choose PHP for Web Development

It is very essential for every business, to survive in this highly competitive market and for that it is very vital to contain a well developed and well designed website; if they have been looking for an online sales and business. To make this websites look attractive, there are numerous ways to build the website, for an instance, HTML for static, flash websites and so on. Also there are some script languages, which are quicker and safe to develop the websites. Amongst those languages, PHP is the most admired technology to develop the website, as it is simple and contains the advance features. 

PHP stands for Hyper text Preprocess, which is a well renowned programming language, contains more than 700 functions which is eventually reduces the complexities while programming. It is compatible to multiple databases such as Oracle, SQL, MYSQL servers and MS Access, but it is more helpful, if the website is hosted on Linux. On what grounds PHP is more preferable for web development, is mentioned as below.
 
Effortlessness
As PHP is similar to languages like Pearl and C, it is very simple to understand and learn. It is so comfortable to any one, from kind of field.
 
Compatibility
This programming language is completely fledged; hence, it gets very easily integrate, even with any complex application. It is more attuned with the source language called MYSQL database.

More admired in CMS
It is more admired in the Content Management Systems such as Wordpress, Drupal and Joomla; as PHP can be customized and can be manipulated as per the necessity of the programmer.
 
Cost Saving
As this programming language can be downloaded from the internet, free of charge; so it very much in flame to develop the website. It is more favorable for the new businesses, which are just getting into the market with limited budge.

Advanced Usability
PHP makes the site more attractive and interactive due to its advance features for the owner and for the visitors.  Things such as Liberty of choosing the language; comparatively low cost and fast turnaround time; can be embedded in HTML as well; Free from restrictive authorizations; regular updates; and so on.
It is very essential for the owner to know how many people have been visiting the site and what their feedback are. With PHP made website, the owner can track and target the activity of the viewers.

Attune Infocom is one of the most secured companies whereby you can develop your website in PHP.  We have expert team of professional PHP developers, who are able to provide you the complete solution in PHP web development.
Read more...
Posted by Unknown | 1 comments

5 Things to Consider Before you Approach Web Portal Development Company

Web portal is a necessity for every small, medium and large scale companies. It becomes useful to connect all internal departments into web platform whether it’s a local area or wide area with multiple locations. There are many web portal development companies working in countries like India, China, Pakistan and Philippines and claim them self as one of the best web portal development company. Client will be in great confusion because not been able to decide whom to select and award the important web development project.

Hiring or outsourcing web portal application Development Companies a common trend. As per the current market trend, there are number of IT companies that offer portal development services, and the demand in the number of organization has made it tough for the clients to select their prospective portal development partners. So, in order to help you to select offshore portal development company from India, below are the points needed to consider approaching one. 

To remove complexity and assist you to find a reputed web portal and web application Development Company from India is the objective of this blog.

First task is to get the project requirement crystal clear and refer to the five things that you must consider before connecting web portal Development Company in India.

Get ready with the list of Portal Applications and Requirements


This is universal accepted primary task for you to get on. It has been witnessed that many people enthusiastically approach company’s sales person by a mail or live chat session without preparing the thorough objective and needs. When the points triggers out, and discussion reaches to project requirement, it is ended immaturely and time spent on this task considered a waste. You may get response from company sales person with convincing what they want to sell rather what you want. Sometimes the sales person wins the situation and you are ending your decision to buy the solution with wrong portal application stack not able to fulfill your requirements.

Alert! Before you start identifying the web portal development company, define your requirement properly and clearly. Prepare a list of all available web portal application stacks that can serve your actual requirements. If you demand web portal design, then browse through the Internet and keep reference sites ready. Make a list of all the objects that you want in your web portal and the application comparison that would help you to accomplish taking right decision. It is recommended that if you’re going for web application development, then make a rough plan of its design and functionality.

Understanding of Business and Technology Consultancy


 Some of the IT web portal development company may have team of very good technocrats for development and implementation of client requirements but they may have a lack of business domain and it can result into unsuccessful project. The efforts made will have a cost and it can be a huge loss. Consider the business domain understanding and technology expertise in your selection criteria before hiring web portal development company.Now a day, there are many company offering the business process consultancy and technology consultancy in order to help customers like you to achieve project objectives and your investment goes in right direction. The consultancy services help you to identify the technology and define the scope of your projects in a much better way.It allows you to know the current market trends and guide you to build proper strategy on how you should proceed with your project.However, you are the decision maker and anytime if you feel that you are well aware of all the aspect then you can skip going for consultancy services. But, in any case, if you have queries in mind, then it is advisable to approach a consultancy services company.

Web Portal Application should be flexible enough to scale up

 Once we have decided on the business aspects, the next step is to select technology and development partner to ensure that the web portal should never goes down in any case. The web portal should be flexible in terms of programming and deployment that it can scale up at the time of peak usage and perform all the time as per the standards. The product and design should be also one of the key factors while talking about scalability. It is advisable to hire a company who can give you a complete solution for a flexible web portal with scalability option and an added advantage if they can offer a cloud based solution.

Project Cost while Outsourcing

 This is a major affecting factor while taking the decision to outsource the project to a web portal development company in India. There is always been a budget for every project with 20% (+/-) consideration of cost. The cost of the project may vary from organization to organization and depending on the technology selected to customize your requirement. The cost will majeure from quality of work and it can be seen from past work done. Before selecting a partner company for your project, do a proper homework, study the market and fix your budget in order to stay focused on your requirements.

As projected, the budget should be flexible enough to get a good quality work, as quality work always cost higher than other. In short, if you need a world class web portal, price does matter.

Maintenance and Support

 Developing and delivering an outstanding web portal is a great success for you and Partner Company. The web portal needs an attention of both while requirement rises as manpower rises in your organization. Kindly consider maintenance and support factor while finalizing and outsourcing the web portal development project. To keep the flow of visitors to your web portal, it should be updated regularly. If you are running an eCommerce portal, introducing new features and user friendly aspects is a critical demand of your project. Dynamic nature of web portal with support and maintenance by Development Company is what you must consider.

To make your hiring task easy, do a proper home work by considering all above points before approaching and finalizing your decision to web portal development company in India. Attune Infocom is one of the most growing Web development company in India. Feel free to contact us for one stop web portal solution.
Read more...