The largest Interview Solution Library on the web


Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

21.What Is The Difference Between View Mode And Edit Mode Of Portlets?

The modes of a portlet are typically related to the types of operations a user can perform on the portlet. A view mode is where users are allowed to do read only operations, whereas in edit mode user can add/update the data in the portlet.
Each portlet mode has a method which handles it:
doView()
doEdit()
doHelp()
These methods will contain mainly our "traffic directing" logic, which are responsible to decide what view the user wants to see.
Once the view has been determined, we will forward on to methods which actually implement that view.
For standard portlet view modes have two views:

  • The default view which shows the list of items.
  • The form, where users will mainly do the add and edit action.

In this where end user can edit the particular item, is called edit mode of portlet.

22.What Is A Liferay Theme? What Are The Advantages Of Using Them?

Liferay themes are the way to customize look and feel of a liferay portal page. The themes are extendable components that can be deployed separately on a portal and each page on the portal can choose a different theme (if required).
Themes are really powerful way to run multiple websites from a single portal. You can host multiple websites on a single liferay portal with totally different look and feel. This allows you to be unique at the same time save a lot resources on website hosting.
A lot of companies use liferay for creating multiple unique websites with the help of extraordinary themes that can be easily developed.
Themes are also available from marketplace.
For developing on our own, we have option of using VM pages(Velocity templates). Liferay provides the feature to deploy the different themes into the portal same like portlets war files. So number of themes we can be deployed into Liferay portal and we can further select those themes for user interface as per the requirement of end user for different site or organization pages

23.How To Use LDAP Authentication With Liferay?

LDAP is lightweight directory access protocol that is most commonly used for authentication and authorization of users. LDAP mainly consists users and usergroups of any organization with certain serach filter like DN entries. In the control panel of liferay we have option to provide the LDAP settings so that portal can contact the third party like LDAP and fetch the required users and groups as per given mappings.
For example Active directory is a LDAP implementation which can store users. Liferay support integration of any LDAP implementation through its admin control panel.
We need to provide the settings in control panel - > portal settings -> LDAP
This will require LDAP URL, username, password, users search filters mappings, groups search filters mapping etc.

24.What Is Portal-ext.properties File? How This Can Be Configured And Used In Liferay?

Liferay Portal comes with default configurations that are stored in portal.property file. You can use portal-ext.properties file to override the values in portal.properties file.
This allows you a clean way to keep your own copy of configurations that can be used outside the portal at the same time you can easily upgrade the portal.

25.What Is Inter-portlet Communication? Why Is It Required To Use JSR Style Inter-portlet Communication?

Sometimes we have the requirement where we need to establish communication in between two portlets for example any action done in one portlet redirecting the end user to other portlet where some kind of result is displaying as per action done on first portlet.
So in this use case we have to use liferay inter-portlet communication mechanism which serve the action performed by end user in one portlet and provide the result to the second portlet where the action result needs to be displayed. We can say that it works on striker-catcher mechanism.
JSR style inter portlet communication ensures that your portlets are going to work on any other JSR compliant portal server. If you use a liferay specific way to communicate between portlets than you may not be able to deploy and run the same portlet war on another JSR compliant portal (e.g. Apache Pluto)

26.What Is A Liferay Portal Instance?

Liferay portal ships with the one liferay portal tomcat bundle which is up and running in any server with certain database settings. We can have more than one liferay instances running from one database.
Liferay Portal allows you to run more than one portal instance on a single server. The Portal Instances page of the control panel lets you manage these instances. Data for each portal instance are kept separate. All portal data, however, is kept in the same database.
Each portal instance requires its own domain name. Liferay will direct users to the proper portal instance based on this domain name. So before you configure an instance, we need to configure its domain name in our network first. When we are ready to add an instance, click the Instances tab - > Add button.
It will be prompted for four fields and a check box:

  • Web ID: A general convention is to use the domain name for this. It’s a user-generated ID for the instance.
  • Virtual Host: Put the domain name you configured in your network here. When users are directed to your Liferay server via this domain name, Liferay will then be able to send them to the proper portal instance.
  • >Mail Domain: Enter the domain name for the mail host for this instance. Liferay will use this to send email notifications from the portal.
  • Max Users: Enter the maximum numbers of user accounts you would like your portal instance to support.
  • Active: Use this check box to choose whether to create an active or an inactive portal instance.

Now we need to click Save. Now navigate to the portal using new domain name. We will see that looks like a clean install of Liferay. This is our new portal instance which can now be up and running.

27.How Can I Configure Two Different Domain Names (e.g. First.example.com And Second.example.com) On Liferay?

At the time of creation of any site we need to provide domain names which further take it as site domain name. We need to provide the certain domain name as required through the control panel of liferay portal. Single instance of Liferay Portal supports hosting of two or more domain names via communities(sites).
When we will go to control panel -> Site settings -> we can provide the site URL, details like site(community) description, membership type, active status and virtual host.

28.How Can I Configure Liferay To Use Email Address As User Name Instead Of Screen Name?

We can set this from control panel -> portal settings -> Authentication -> LDAP -> How do users authenticate?. Here we can select whatever we require from email address,screen name or user ID. At the time of LDAP authentication, we need to provide the required LDAP mappings which basically reads all the details related to users and usergroups from LDAP directory and import into Liferay portal. At the time of this connection with third party we need to give the required field like authentication should be by email address or screen name or user ID.

29.How To Customize The Behavior Of Liferay Default Out Of The Box Portlets (e.g. Document View, Calendar, Blog, Wiki Etc) ?

If we need any customization, related to JSP and UI then we can implement this using Hooks. Liferay portal comes with a bundle where all the default built in portlets exist. If any customixation required in the core level classes then it can be done through EXT for example LDAP users and user groups import modification. but here in EXT, restart would be required.

30.What Is Liferay Service Builder? Is There Any Alternative To Use Service Builder? What Are The Advantages And Disadvantages Of Using It?

Liferay service builder is basically used to create the service layers for any business logic implementation. From developer point of view it is very helpfull as it used to create all the service layers automatic. Suppose we want to develop a portlet, for this we need to write all the required implementation classes, utility cleasses and other required classes. Service builder is used to create all these classes for developer, where they can add their business logic further and process the data and render the output to view as per the requirement.
As per the advantage, this service builder will create whole structure of the service layers for developer mainly. It really helps them to write the code and their logic in service builder created model implementations and service implementation classes. These classes comes with normal CRUD (create, update and delete)operations. For developer, no need to add anything extra as whole service and utility layers are already got created by service builder. It really speed up the developement process.
Service builder requires service.xml which is having some of the required entries. Each of the entry is basically called entity, which is having it's primary key fields with some other required fields. If we want to implement order and finder method, we can implement it by using this service.xml.
Each entity creates table into liferay configured database with the given column names and their types. We can create service.xml related local-service and remote-service by setting them value as "true". When we would run this build-service like below, this would create all the service layers(implementation, utility etc.) where developer can write their required business logic further. Creation of all the service-classes would be done by the build.xml, we need to build-services using this xml file into Ant view of IDE.

31.How To Set The Display Category Of A Custom Built Liferay Portlet ?

We can set the display category like below mentioned liferay-display.xml. Suppose we have developed one portlet where portlet ID we have provided. We need to enter the custom built liferay portlet into certain category like name "category.cms", "category.collaboration" etc. By doing this custom built liferay portlet would come in required category by clicking the add application feature of liferay as there would be many of portlets under different categories. So below tag we need to enter for the entry of a portlet into certain category.
<display>
<category name="category.cms">
<portlet id="20" />
</category>
</display>

32.How To Support Internationalization (i18n) On Liferay Portlets? How Do You Support Multiple Languages Without Writing Java Code In Liferay?

We can support internationalization (i18n) on Liferay portlets and through out this whole Liferay portal. We need to provide whatever language we need to support into LIferay portal. This is mainly reads the regions number and provide the available language like en_US(english), SG(singapore), zh_CN(simple chinease), zh_TW(traditional chinease), ja_JP(Japanease).
In the same way to provide support of multiple languages without writing java code in Liferay, we can use Locales this through out the portal,
portlet, hooks and themes. This entry we can provide into same portal-ext.properties which Liferay portal would read and provide all the translation accordingly.
locales=en_US,zh_CN,zh_TW,ja_JP,ko_KR
If we are writing some custom messages in out code then we need to provide the below property files also as per the called language and using of Locales would convert it accordingly. We can use LocaleUtil in our code which will convert the certain message given in language files.
For example we want the assetCategory title in multi languages then we need to use this assetCategory.getTitle(locale). So here whatever locale we have mentioned earlier would be in action and pick the given title name from certain locale related language.property file.
Language_en_US.properties
Language_zh_CN.properties
Language_zh_TW.properties

33.What Are The Advantages Of Using Tomcat Bundle Of Liferay Against Other App Servers (e.g. JBoss, Glassfish Or Others)?

It is possible to use Liferay with Liferay IDE with other then tomcat server bundles but there are some features or benefits that will not be available: Native eclipse server adapter that supports launching and debugging. Deployment via add/remove modules wizard would not be available. Auto redeployment based on changes to project resources.

34.Which One Is Best To Start In A Clean Setup?

Liferay bundle with tomcat app server is the best one to start in a clean setup.

35.How Do You Perform Junit Tests On Your Portlet?

Junit tests are there to check the code mainly by providing the value of any method input parameter, how the method would work and gives the values.
public class MyEmployeeTest {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"ApplicationContext-service.xml");
public void testMyMethod() {
UserService employeeService = (UserService) context.getBean("userService");
//Provide the user Id as 101581
User user = storeService.findUserByUserId(1234);
//get the employee
Set employee = user.getEmployeesForUserId();
System.out.println("Employee Name : "+employee.getName());
}
}

36.How Will You Configure A Portlet That Can Be Added Multiple Times On A Portal Page?

One property is there in portlet.xml which is as follows:
<instanceable>true</instanceable>
by using the value true and false we can configure a portler that can be added multiple times on a portal page.

37.How Can You Customize Liferay Search Feature? What Are The APIs To Do It?

We can customize Liferay Search feature, depends upon our requirement by below two ways.
Hook : If changes are required as per the view side like we need to change the search result form view then we can write the Hook
to customize it.
EXT : If changes are required as per the core functionality like we need to change the search query term, we can implement EXT.

38.How Can You Integrate Liferay With An External Content Management System (e.g. Alfresco)

Liferay passes user credentials through CMIS to the alfresco in order to connect. To enable this in liferay, we need to enter following below property in portal-ext.properties which will allow liferay to store password in session. session.store.password=true
Also one more thing we need to take into consideration is that Liferay passes logged in user's credentials to CMIS Repository (whihc is alfresco here) as described above. What this means is that userid/password in liferay must match userid/password in Alfresco. Alfresco by default uses a loginid (which is similar to screen-name in liferay) to authenticate user. So we need to make liferay also authenticate using screen name by making following entry into portal-ext.properties.
company.security.auth.type=screenName
So we need to start Liferay. Login as administrator and go to control panel. we need to go to Document and Media which will bring up a screen where we need to click on Add -> New Repository. this will bring one screen where we basically provide connection details to connect to Alfresco like below.
Name: Give any name you want to give to your repository view in liferay. For example, I will give Alfresco repository name. Description: A brief description about it.
Repository Type: We can connect either using AtomPub or using web services. AtomPub URL: This will be the CMIS repository URL where our alfresco is running. In our case, it's would be http://localhost:8080/alfresco/service/api/cmis (Note: In case of Alfresco 4.0, it will be http://host:port/alfresco/cmisatom). Repository ID: It is basically used to connect to a specific repository incase we have multiple repositories available. If we do not enter a repositoryId, then it will just look for the first repository using the given parameters and set it to that.

39.How To Setup A Liferay Cluster From Scratch?

We need to setup below properties in our portal-ext.properties(this is for one instance represented by 1p, same properties we need to add for second instance also represented by 2p) and some required IP addresses.
#cluster configurations - these settings are for cluster
net.sf.ehcache.configurationResourceName=/myehcache/hibernate-clustered.
xml
dl.store.file.system.root.dir=/webapps/document_library_cluster
#other settings for cluster
liferay.home=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/
lucene.dir=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/data/lucene
cluster.link.enabled=true
lucene.replicate.write=true
multicast.group.address["cluster-link-control"]=239.255.4.1

40.How To Use AUI In Liferay? What Are The Advantages Of Using It In Liferay Instead Of JQuery Or Some Other JS Library?

AlloyUI (AUI) is Liferay's open-source javascript library. It is built on Yahoo User Interface (YUI) and has support for a variety of advanced javascript functions specifically designed for portlets. As it is Liferay provided JS library here no need to merge this code. It is designed to take advantage of and incorporate patterns from the best libraries to make building robust and flexible web applications. It is a JavaScript library, a CSS framework, a set of HTML recipes and a taglib library, all combined to empower developers across multi-skilled teams deliver rich and dynamic applications. Only we need to add certain tag library like below in order to use Liferay Alloy UI libraries.
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-aui.tld</taglib-location>
</taglib>
So further we can use these all form and fields like below in our JSP code.
<aui:form>
<aui:input name="Name" size="45" />
</aui:form>

« Previous | 0 | 1 | 2 | 3 | 4 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com