Tuesday, 1 December 2015

Ajax calling example

<portlet:resourceURL var="SubmitURL"  />
      <input type="text" name="txt1" id="txt1" />
   <input   type="button" onclick="helpful();"  value="Submit" />  
 
   function helpful()
 {
 var textvalue=document.getElementById('txt1').value;
    $.ajax ({
     
        url:'<%=SubmitURL%>',
        type: 'POST',
        data : ({
           textVal: textvalue
           
             }),
        success: function()
        {           alert('success');
           
         }
    });
 
 
}

final String textValue= resourceRequest.getParameter("textVal");

Diffrence between Liferay Portal v6.2 and Liferay Portal v6.1

 Liferay Portal v6.2 and  Liferay Portal v6.1

Ans-In the Liferay 6.2 CE Version you will see all the things are very much organized or Categorize form then the previous version. 

 

·                     1>Look & Feel :- When I downloaded the latest tomcat bundle of liferay 6.2 CE, the first thing I noticed is there is a change in the Default Liferay theme. Liferay is now upgraded to Alloy 2.0.

2>Dockbar :- The Second thing

In Liferay 6.2 they have made it more Categorize form. They have Categorize Admin(Control Panel)and MySites which all comes together in GOTO Section in liferay 6.1 version.

 

3>Control Panel :- There was a Major Change in the Control Panel Section. It was divided into Four Sections
Users - It contains User, UserGroup, Password Policies, Roles, Organization etc in this section.
Sites - It contains Sites,Sites Template,Page Template,Blogs,Wiki, Document and Media etc in this section.
Apps - It contains Market Place,Plugins Configuration, Plugins Installation etc in this section.
Configuration - It contains Portal Settings,Custom Fields,Server Administration and Portal Instances in this section.   

4>Sites


There are couple of changes and also new portlets are added at site level.
Recycle Bin :- The name itself speaks a lot. You all knows what the Recycle Bin do in Windows or Trash in Mac. The same feature liferay has implemented here.

5>New Template Script Editor with Auto complete :- Good to have this. It was hectic to write scripts in previous versions. It will make life easier.

Q2-How to install liferay with eclipse?
Ans-
1.      Install JDK and setting required environment variables (JAVA_HOME, path)
2.      Download MySQL server and Start MySQL server
3.      Download and unzip the Tomcat Bundle Liferay Portal :
4.      Install the Liferay IDE extension in Eclipse
> Help > Install New Software > Add
Name: Liferay IDE Stable
URL: http://releases.liferay.com/tools/ide/latest/stable/
5.      Add in Eclipse the Liferay Plugin SDK instance previously installed:
> Windows > Preferences > Liferay > Installed Plugins SDKs > Add >
6.      Add in Eclipse a Tomcat Runntime Environment based on the Liferay Portal previously installed:
> Windows > Preferences > Server > Runtime Environment > Add > Liferay,Inc > Liferay v6.2 CE (Tomcat 7)
7.      Configure database setting in portal-ext.properties file and place properties file in Liferay Home(bundles) directory.
8.      Configure Liferay Tomcat sever information in Plugins SDK properties file.
9.      Start Eclipse and configure liferay prospective
10. Configure Plugins SDK in Eclipse
11. Configure Liferay Tomcat Server in Eclipse
12. Start Tomcat from Eclipse and access liferay portal
13. Complete required basic configurations for liferay portal (This is only for first time)
14. Start Liferay Application Development

Q-How to connect mysql with liferay eclipse?
Ans-Follow the below steps->
1.    Create a new liferay server (Point it to the liferay portal).
2.    Start the server.
3.    When the server will start hit the localhost:8080.
4.    A page will be displayed for the database configuration and user configuration.
5.    provide the db name and usename and password.
6.    Once you provide that, liferay will use that database.(Obviously that DB should be in your database)
Else you can create a portal-setup-wizard.properties file in \liferay-portal-6.2.0-ce-ga1 directory. Then add the following entries.
admin.email.from.name=Test Test
jdbc.default.password=root
liferay.home=D:/5555555/liferay-portal-6.2.0-ce-ga1
admin.email.from.address=test@liferay.com
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.username=root
jdbc.default.url=jdbc:mysql://localhost/project_monitor_liferay?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
setup.wizard.enabled=false



Q diffrence between hot deployment and deployment?
ans-hot deployment means direct deployment
ex- Hook
deployment means restart the server
ex- EXT

 




Friday, 27 November 2015

Jquery Data table for delete on click on button

<%-- <%@page import="com.bc.basil.model.CustomOrgConfiguration"%>
<%@page import="com.bc.basil.service.CustomOrgConfigurationLocalServiceUtil"%> --%>
<%-- <%@page import="com.liferay.portal.kernel.util.ParamUtil"%> --%>
<%@page import="com.bc.basil.service.CustomOrgConfigurationLocalServiceUtil"%>
<%@page import="com.bc.basil.model.CustomOrgConfiguration"%>
<%@page import="javax.portlet.PortletURL"%>

<%@ include file="init.jsp" %>
<portlet:defineObjects />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css"/>

<portlet:renderURL var="regionUrl">
<portlet:param name="action" value="add_region"/>
</portlet:renderURL>
<a href="<%=regionUrl%>">Add</a>

<%
Organization org=null;
List<Organization> organisationsList=OrganizationLocalServiceUtil.getOrganizations(-1, -1);

PortletURL deleteRegionURL = renderResponse.createActionURL();
deleteRegionURL.setParameter("action", "deleteRegion");



PortletURL saveURL=renderResponse.createActionURL();
saveURL.setParameter("action", "saveRegion");


List<CustomOrgConfiguration> customOrgConfigurationList = CustomOrgConfigurationLocalServiceUtil.getCustomOrgConfigurations(-1, -1);
%>


</br>



<div>
<table id="regionTable"  border="1" cellspacing="0" width="100%">
<thead>
   <tr>
        <th>OrganizationId</th>
       <th>Parent OrganizationId</th>
       <th>Type</th>
        <th>Code</th>
       <th>Action</th>
   </tr>
</thead>
<tbody>

<c:if test="<%=customOrgConfigurationList!=null %>" >

<% for (CustomOrgConfiguration ConfigurationScreen :customOrgConfigurationList) {

deleteRegionURL.setParameter("customId",  String.valueOf(ConfigurationScreen.getCustomId()));
%>


<tr>
<td><%=  OrganizationLocalServiceUtil.getOrganization(ConfigurationScreen.getOrganizationId()).getName() %></td>
<td><%= OrganizationLocalServiceUtil.getOrganization(ConfigurationScreen.getParentOrgId()).getName()%></td>
<td><%= ConfigurationScreen.getType()%></td>
<td><%= ConfigurationScreen.getCode()%></td>
   <td><button class="edit" >Edit File</button>
   <a href="<%=deleteRegionURL.toString()%>"> <button class="remove" >Delete File</button></a></td>

</tr>


<% } %>
</c:if>

</tbody>
</table>
</div>


<script type="text/javascript">
$(document).ready(function() {
    $('#regionTable').DataTable();
} );
</script>

delete on click using jquery data table

https://drive.google.com/drive/folders/0B3sQxSdVvw_HUDhQcXFHdDhPOEE

Sunday, 22 November 2015

comprator and comprable example

comprator and comprable example

http://www.codejava.net/java-core/collections/sorting-arrays-examples-with-comparable-and-comparator

Friday, 20 November 2015

java assignment

1. For any given date(in MM/DD/YYYY format) calculate 10th working day(exclude Saturdays, Sundays and span holidays) and display the 10th Working day.(Get SPAN holidays from http://ispan.com/Lists/Holiday/AllItems.aspx

2.            Employee Maintenance System
Write a program to read the following parameters for each Employee.
a.            First name
b.            Last name
c.             Date of Join (dd/mm/yyyy)
d.            Date of Birth
e.            Gender (M or F)
f.             Temporary (True or false)
g.            Department (ASG/Sales/Engineering/Support/Accounts)
h.            Salary
i.      Designation(Java developer, Application Tester, Quality analyser, Project Manager etc)

After you read the input for about 10 records, display the below options to the user to choose from.

1.            Display employees in Ascending order of their Last name
2.            Display employees for the given Department (Note: selecting the option 2, should ask the user to enter Department name and then display the employees pertaining to that department)
3.            Display the age of all employees
4.            Display the permanent employees
5.            Display the employees with salary > 10000.
6.            Search for an Employee (First name starts with)
7.      Display employees who belongs to only engineering department and Male employee
8.      Calculate average salary of all employees.
9.            Exit

3.            Shop Maintenance:
Note: Hardcode the products data in the program.

Show the following menu when the application starts.

***************************************************
        *                             Welcome to <shop name> Shop                                    *
        ***************************************************
1.            Display Products
2.            Search Product
3.            Purchase Product
4.            Display shopping cart
5.            Print Invoice
6.            Exit

1. Display Products :

        ************************************************************************************
        SKU#              Product Name                                   Stock                     Price                Manufacturer                                     **
        ************************************************************************************
        Xxx                 Xxxxxxxx                                             xx                           xxxx.xx                 xxxxxxxxxxxx


Enter the item SKU number to purchase the item.

Note: Once the item SKU has been entered and the item is in stock, it has to be reduced by 1 in the quantity of products.

2.  Search Product :

Enter the product SKU or Name (starts with) :

Product you have searched for :

<Display products header and product details to be displayed.>

No match found for the given input.

3. Purchase Product :

Enter the item SKU number to purchase the item :

Note: Once the item SKU has been entered and the item is in stock, it has to be reduced by 1 in the quantity of products.

4. Display Shopping cart

       ************************************************************************************
        SKU#              Product Name                                   Quantity              Price                    Manufacturer                                 **
        ************************************************************************************
       Xxx                  Xxxxxxxx                                             xx                           xxxx.xx                 xxxxxxxxxxxx
       Xxx                  Xxxxxxxx                                             xx                           xxxx.xx                 xxxxxxxxxxxx
*************************************************************************************                                                                              
Total                                                                                      xx                           xxxx.xx
*************************************************************************************
5.  Print Invoice

                                                                                <Shop Name>
                                                                                <Address 1>
Invoice Details
               *************************************************************************************
             SKU#              Product Name                       Quantity              Price                                          Tax                                                   **
              **************************************************************************************
                Xxx                  Xxxxxxxx                                    xx                           xxxx.xx                                 <10% tax amount>
                Xxx                  Xxxxxxxx                                    xx                           xxxx. xx                                 <10% tax amount>
            ***************************************************************************************                                                                              
           Total (Incl of Tax 10%: xx)                                 xx                           xxxx.xx(without tax)      <10% tax amount>       xxxx.xx(total with Tax)    
           ***************************************************************************************