diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f41517d
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

+  <modelVersion>4.0.0</modelVersion>

+  

+  <groupId>com.ellisdon.portal</groupId>

+  <artifactId>ellisdon-myvacation-portlet</artifactId>

+  <packaging>war</packaging>

+  <version>1.0</version>  

+  

+  <repositories>

+   <repository>

+     <id>ZK EE</id>

+     <name>ZK Maven Reposiroty</name>

+     <url>https://maven.zkoss.org/repo/zk/ee</url>

+   </repository>

+   

+    <repository>

+        <id>JBoss</id>

+        <name>JBoss Maven Repsitory</name>

+        <url>https://repository.jboss.org/nexus/content/groups/public/</url>

+    </repository>

+   

+  </repositories>

+  

+  <properties>

+    <spring.version>3.0.5.RELEASE</spring.version>

+    <zk.version>5.0.5</zk.version>    

+    <hibernate.version>3.6.0.Beta2</hibernate.version>

+  </properties>

+  

+  <dependencies>

+        <!-- Spring Framework artificats -->

+		<dependency>

+			<groupId>org.springframework</groupId>

+			<artifactId>spring-orm</artifactId>

+			<version>${spring.version}</version>

+		</dependency>

+	

+		<dependency>

+			<groupId>org.springframework</groupId>

+			<artifactId>spring-jdbc</artifactId>

+			<version>${spring.version}</version>

+		</dependency>

+	

+		<dependency>

+			<groupId>org.springframework</groupId>

+			<artifactId>spring-aop</artifactId>

+			<version>${spring.version}</version>

+		</dependency>

+	

+		<dependency>

+			<groupId>org.springframework</groupId>

+			<artifactId>spring-test</artifactId>

+			<version>${spring.version}</version>

+		</dependency> 

+		

+		<!-- Hibernate & Java Persistence artificats --> 

+		<dependency>

+		  <groupId>org.hibernate</groupId>

+		  <artifactId>hibernate-core</artifactId>

+		  <version>${hibernate.version}</version>

+		</dependency>

+		

+		<dependency>

+			<groupId>javax.persistence</groupId>

+			<artifactId>persistence</artifactId>

+			<version>3.0</version>

+		</dependency>

+

+		<!-- LifeRay artificats -->

+		<dependency>

+			<groupId>com.liferay</groupId>

+			<artifactId>portal-service</artifactId>

+			<version>1.0</version>

+			<scope>provided</scope>

+		</dependency>

+

+		<dependency>

+			<groupId>com.liferay</groupId>

+			<artifactId>portal-kernel</artifactId>

+			<version>1.0</version>

+			<scope>provided</scope>

+		</dependency>

+

+		

+		<!-- ZK Framework artificats -->  	

+		<dependency>

+		   	<groupId>org.zkoss.zk</groupId>

+		   	<artifactId>zk</artifactId>

+		   	<version>${zk.version}</version>

+		</dependency>

+		   

+		<dependency>

+		   	<groupId>org.zkoss.zk</groupId>

+		   	<artifactId>zul</artifactId>

+		   	<version>${zk.version}</version>

+		   </dependency>

+		   

+		<dependency>

+		   	<groupId>org.zkoss.zk</groupId>

+		   	<artifactId>zkmax</artifactId>

+		   	<version>${zk.version}</version>

+		</dependency>

+

+		<dependency>

+		  <groupId>org.zkoss.zk</groupId>

+		  <artifactId>zkspring-core</artifactId>

+		  <version>3.0RC</version>

+		</dependency>

+		

+		<!-- Log4J -->

+		<dependency>

+			<groupId>log4j</groupId>

+			<artifactId>log4j</artifactId>

+			<version>1.2.15</version>

+		</dependency>

+        

+        <!-- JUnit -->

+		<dependency>

+			<groupId>junit</groupId>

+			<artifactId>junit</artifactId>

+			<version>4.8</version>

+		</dependency>

+

+        <!-- JDBC Driver -->

+		<dependency>

+		  <groupId>com.mysql</groupId>

+		  <artifactId>jdbc-driver</artifactId>

+		  <version>5.1.5</version>

+		</dependency>

+		

+		<!-- Other Dependencies -->

+		<dependency>

+			<groupId>org.slf4j</groupId>

+			<artifactId>slf4j-api</artifactId>

+			<version>1.5.6</version>

+		</dependency>

+

+		<dependency>

+			<groupId>org.slf4j</groupId>

+			<artifactId>slf4j-log4j12</artifactId>

+			<version>1.5.6</version>

+		</dependency>

+

+		<dependency>

+			<groupId>javassist</groupId>

+			<artifactId>javassist</artifactId>

+			<version>3.4.GA</version>

+		</dependency>

+

+		<dependency>

+			<groupId>cglib</groupId>

+			<artifactId>cglib</artifactId>

+			<version>2.2</version>

+		</dependency>

+    

+  </dependencies>  

+  

+  <build>

+    <plugins>

+      <plugin>

+        <groupId>org.apache.maven.plugins</groupId>

+        <artifactId>maven-compiler-plugin</artifactId>

+        <configuration>

+          <source>1.6</source>

+          <target>1.6</target>

+        </configuration>

+      </plugin>

+    </plugins>

+  </build>

+  

+</project>

diff --git a/src/main/java/com/ellisdon/portal/mv/controller/VacationEntitelmentViewControllor.java b/src/main/java/com/ellisdon/portal/mv/controller/VacationEntitelmentViewControllor.java
new file mode 100644
index 0000000..d868bb0
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/controller/VacationEntitelmentViewControllor.java
@@ -0,0 +1,63 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.controller;

+

+import org.apache.log4j.Logger;

+import org.zkoss.zk.ui.Component;

+import org.zkoss.zk.ui.util.GenericForwardComposer;

+import org.zkoss.zul.Button;

+import org.zkoss.zul.Label;

+import org.zkoss.zul.Listbox;

+import org.zkoss.zul.Listitem;

+

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.model.UserVacationBean;

+import com.ellisdon.portal.mv.util.CommanConstants;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ *This is the view controller for the VacationEntitelment view of MyVacation Portlet

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 9, 2010

+ * @since JDK1.6

+ */

+public class VacationEntitelmentViewControllor extends GenericForwardComposer{

+

+	private Listbox listEntDays;

+	private Label lbEntUpdate;

+	private Button btnEntUpdate;

+	

+	private static final Logger logger = MyVacationLogger.getLogger(VacationEntitelmentViewControllor.class);

+	

+	@Override

+	public void doAfterCompose(Component comp) throws Exception {

+	    super.doAfterCompose(comp);

+	    

+	    logger.debug("------  VacationEntitelmentViewControllor : doAfterCompose -----------");

+	    

+

+	    /*

+	    //Get handle to the UserVacationBean

+	    UserVacationBean userVacation = (UserVacationBean) session.getAttribute(CommanConstants.USER_VACATION_HELPER_BEAN);

+     

+	    Integer userEntDays = userVacation.getUserEntitlementDays();

+	    Listitem lstItem = new Listitem(userEntDays.toString());

+	    listEntDays.setSelectedItem(lstItem);

+	    

+	    lbEntUpdate.setValue(userVacation.getUserEntLastUpdated());

+	    */	    

+	}    

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/controller/VacationEntryViewController.java b/src/main/java/com/ellisdon/portal/mv/controller/VacationEntryViewController.java
new file mode 100644
index 0000000..0d9bcfe
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/controller/VacationEntryViewController.java
@@ -0,0 +1,108 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.controller;

+

+import static org.zkoss.zk.ui.event.Events.ON_CLICK;

+

+import java.util.Date;

+

+import org.apache.log4j.Logger;

+import org.zkoss.zk.ui.Component;

+import org.zkoss.zk.ui.event.Event;

+import org.zkoss.zk.ui.event.EventListener;

+import org.zkoss.zk.ui.util.GenericForwardComposer;

+import org.zkoss.zul.Button;

+import org.zkoss.zul.Datebox;

+import org.zkoss.zul.Messagebox;

+import org.zkoss.zul.Spinner;

+import org.zkoss.zul.Tabbox;

+import org.zkoss.zul.Textbox;

+

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.model.UserVacationBean;

+import com.ellisdon.portal.mv.util.CommanConstants;

+

+/**

+ * This is the view controller for the Vacation Entry view of My Vacation portlet

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 7, 2010

+ * @since JDK1.6

+ */

+public class VacationEntryViewController extends GenericForwardComposer {

+	

+	private Datebox fromDate;

+	private Datebox toDate;

+	private Spinner daysTaken;

+	private Textbox comments;

+

+	private static final Logger logger = MyVacationLogger.getLogger(VacationEntryViewController.class);

+	

+	@Override

+	public void doAfterCompose(Component comp) throws Exception {

+	    super.doAfterCompose(comp);

+	}	

+

+	public void onClick$save(Event event) {

+

+	 try {	

+	    //Get handle to the UserVacationBean

+	    UserVacationBean userVacation = (UserVacationBean) session.getAttribute(CommanConstants.USER_VACATION_HELPER_BEAN);

+		

+		if (!fromDate.isValid()){

+			fromDate.setFocus(true);

+			

+			return;			

+		}else if(!toDate.isValid()){		

+			toDate.setFocus(true);

+			return;

+		}else if(!daysTaken.isValid()){		

+			daysTaken.setFocus(true);

+			return;

+		}else if(!comments.isValid()){		

+			comments.setFocus(true);

+			return;

+		}

+	

+		//Save the Vacation for User

+		VacationHistoryDTO vachistdto = new VacationHistoryDTO();

+	    vachistdto.setFromdate(fromDate.getValue());

+	    vachistdto.setTodate(toDate.getValue());

+	    vachistdto.setDaystaken(daysTaken.getValue());

+	    vachistdto.setComments(comments.getText());		

+	    userVacation.takeUserVacation(vachistdto);

+	    

+	    //Display the message

+	    //Messagebox.show("Vacation have been saved successfully.");

+

+	    //Clear the form

+	    fromDate.setValue(new Date());	

+		toDate.setValue(new Date());

+		daysTaken.setValue(1);

+		comments.setValue(" ");		

+		

+	 }catch(Exception ex){

+		ex.printStackTrace();

+	 }

+    }

+	

+	public void onClick$reset(Event event) {

+		fromDate.setValue(new Date());	

+		toDate.setValue(new Date());

+		daysTaken.setValue(1);

+		comments.setValue(" ");		

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/controller/VacationHistoryViewController.java b/src/main/java/com/ellisdon/portal/mv/controller/VacationHistoryViewController.java
new file mode 100644
index 0000000..d4352ab
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/controller/VacationHistoryViewController.java
@@ -0,0 +1,60 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.controller;

+

+import org.apache.log4j.Logger;

+import org.zkoss.zk.ui.Component;

+import org.zkoss.zk.ui.util.GenericForwardComposer;

+import org.zkoss.zul.Button;

+import org.zkoss.zul.Grid;

+import org.zkoss.zul.Label;

+import org.zkoss.zul.Row;

+import org.zkoss.zul.RowRenderer;

+import org.zkoss.zk.ui.event.Event;

+import org.zkoss.zk.ui.event.EventListener;

+import static org.zkoss.zk.ui.event.Events.ON_CLICK;

+

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.model.UserVacationBean;

+import com.ellisdon.portal.mv.ui.VacationHistoryRowRenderer;

+import com.ellisdon.portal.mv.util.CommanConstants;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is the view controller for the VactionHistory view of MyVacation Portlet

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 2, 2010

+ * @since JDK1.6

+ */

+public class VacationHistoryViewController extends GenericForwardComposer {

+

+	private static final Logger logger = MyVacationLogger.getLogger(VacationHistoryViewController.class);

+	private Grid gridVacHistory;

+

+	@Override

+	public void doAfterCompose(Component comp) throws Exception {

+	    super.doAfterCompose(comp);

+    

+	    //Get handle to the UserVacationBean

+	    UserVacationBean userVacation = (UserVacationBean) session.getAttribute(CommanConstants.USER_VACATION_HELPER_BEAN);

+	    userVacation.setGridVacHistory(gridVacHistory);

+

+	    gridVacHistory.setModel(userVacation.getUserVacationHistory());

+	    gridVacHistory.setRowRenderer(new VacationHistoryRowRenderer(userVacation));

+	    

+    	}	

+}

+

diff --git a/src/main/java/com/ellisdon/portal/mv/controller/VacationPortletInitiator.java b/src/main/java/com/ellisdon/portal/mv/controller/VacationPortletInitiator.java
new file mode 100644
index 0000000..d5e5e3c
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/controller/VacationPortletInitiator.java
@@ -0,0 +1,74 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.controller;

+

+import java.util.Map;

+

+import org.apache.log4j.Logger;

+import org.zkoss.zk.ui.Desktop;

+import org.zkoss.zk.ui.Page;

+import org.zkoss.zk.ui.Session;

+import org.zkoss.zk.ui.util.Initiator;

+

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.model.LifeRayUser;

+import com.ellisdon.portal.mv.model.UserVacationBean;

+import com.ellisdon.portal.mv.util.CommanConstants;

+

+/**

+ * This is the Initiator class for My Vacation Portlet.

+ * It will get the 'User' object of the currently logged in

+ * LifeRay user and set it as an attribute in the current desktop   

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 2, 2010

+ * @since JDK1.6

+ */

+public class VacationPortletInitiator implements Initiator {

+

+	private static final Logger logger = MyVacationLogger.getLogger(VacationPortletInitiator.class);

+	

+	@Override

+	public void doInit(Page page, Map arg) throws Exception {

+		logger.debug("------ Initiator : doInit() -----------");

+		

+		//Below is the temporary code to mimic the LifeRay user login

+		LifeRayUser user = new LifeRayUser(11201, "Bilal Ahmed");

+		Desktop dsktop = page.getDesktop();

+		dsktop.setAttribute(CommanConstants.USER, user);

+		

+		//Setup the UserVacationBean for the logged-in user

+		UserVacationBean uservacBean = new UserVacationBean();

+		uservacBean.setUserid(user.getUserId());

+		Session session = page.getDesktop().getSession();

+		session.setAttribute(CommanConstants.USER_VACATION_HELPER_BEAN, uservacBean);

+		

+	}

+	

+	@Override

+	public void doAfterCompose(Page arg0) throws Exception {

+		logger.debug("------ Initiator : doAfterCompose() -----------");       		

+	}

+

+	@Override

+	public boolean doCatch(Throwable arg0) throws Exception {

+		return false;

+	}

+

+	@Override

+	public void doFinally() throws Exception {

+	}

+

+

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/controller/VacationWindowViewController.java b/src/main/java/com/ellisdon/portal/mv/controller/VacationWindowViewController.java
new file mode 100644
index 0000000..e81805e
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/controller/VacationWindowViewController.java
@@ -0,0 +1,52 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.controller;

+

+import org.apache.log4j.Logger;

+import org.zkoss.zk.ui.Component;

+import org.zkoss.zk.ui.util.GenericForwardComposer;

+import org.zkoss.zul.Window;

+

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.model.LifeRayUser;

+import com.ellisdon.portal.mv.util.*;

+

+/**

+ * This is the view controller for the main window of MyVacation portlet

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 2, 2010

+ * @since JDK1.6

+ */

+public class VacationWindowViewController extends GenericForwardComposer {

+

+	private static final Logger logger = MyVacationLogger.getLogger(VacationWindowViewController.class);

+	private Window winVacation;

+	

+	@Override

+	public void doAfterCompose(Component comp) throws Exception {

+        super.doAfterCompose(comp);

+        

+		logger.debug("------ VacationWindowViewController : doAfterCompose() -----------");

+		LifeRayUser user = (LifeRayUser) page.getDesktop().getAttribute(CommanConstants.USER);

+		if (Utility.isNull(user)) {

+		  logger.error("Life Ray user object can't be find");

+		  //Redirect user to error screen - Code required

+		}else{

+		  winVacation.setTitle("My Vacation - " + user.getUserName());	

+		}

+				

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dao/VacationEntitlementDAO.java b/src/main/java/com/ellisdon/portal/mv/dao/VacationEntitlementDAO.java
new file mode 100644
index 0000000..a10b64d
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dao/VacationEntitlementDAO.java
@@ -0,0 +1,34 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dao;

+

+import org.springframework.dao.DataAccessException;

+

+import com.ellisdon.portal.mv.exception.MyVacationRuntimeException;

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+

+/**

+ * This is the Interface Class for Data Access Object

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 28, 2010

+ * @since JDK1.6

+ */

+public interface VacationEntitlementDAO {

+

+	public VacationEntitlementDTO getUserEntitlement(int IDUser) throws DataAccessException;

+

+	public void updateUserEntitlement(VacationEntitlementDTO vacentdto) throws DataAccessException;	

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dao/VacationHistoryDAO.java b/src/main/java/com/ellisdon/portal/mv/dao/VacationHistoryDAO.java
new file mode 100644
index 0000000..ea60f1b
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dao/VacationHistoryDAO.java
@@ -0,0 +1,41 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dao;

+

+import java.util.List;

+

+import org.springframework.dao.DataAccessException;

+

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.exception.MyVacationRuntimeException;

+

+/**

+ * This is the Interface Class for Data Access Object

+ *  

+ * @author ahmedb

+ * @version 1.0, Nov 29, 2010

+ * @since JDK1.6

+ */

+public interface VacationHistoryDAO {

+

+	public List<VacationHistoryDTO> getUserVacationHistory(int IDUser) throws DataAccessException;

+

+	public void updateUserVacationHistory(VacationHistoryDTO vacHistDTO) throws DataAccessException;

+	

+	public void insertVacationHistory(VacationHistoryDTO vacHistDTO) throws DataAccessException;

+

+	public VacationHistoryDTO getVacationHistory(int vacHistID) throws DataAccessException;

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationEntitlementDAOImpl.java b/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationEntitlementDAOImpl.java
new file mode 100644
index 0000000..9d66ea1
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationEntitlementDAOImpl.java
@@ -0,0 +1,53 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dao.impl;

+

+import org.hibernate.Session;

+import org.hibernate.SessionFactory;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.dao.DataAccessException;

+import org.springframework.stereotype.Repository;

+

+import com.ellisdon.portal.mv.dao.VacationEntitlementDAO; 

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+

+/**

+ * This is implementation class for VacationEntitlementDAO interface

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 28, 2010

+ * @since JDK1.6

+ */

+@Repository("vacEntitlementDAOBean")

+public class VacationEntitlementDAOImpl implements VacationEntitlementDAO{

+	

+	@Autowired(required=true)

+	private SessionFactory sessFactory;

+	

+	@Override

+	public VacationEntitlementDTO getUserEntitlement(int UserID) throws DataAccessException {

+		VacationEntitlementDTO vacentdto = null;

+		Session sess = sessFactory.getCurrentSession();

+		vacentdto = (VacationEntitlementDTO) sess.load(VacationEntitlementDTO.class, UserID);

+		//vacentdto = (VacationEntitlementDTO) sess.get(VacationEntitlementDTO.class, UserID);

+		return vacentdto;

+	}

+

+	@Override

+	public void updateUserEntitlement(VacationEntitlementDTO vacentdto)  throws DataAccessException {

+		Session sess = sessFactory.getCurrentSession();

+		sess.merge(vacentdto);

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationHistoryDAOImpl.java b/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationHistoryDAOImpl.java
new file mode 100644
index 0000000..7d26fa0
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dao/impl/VacationHistoryDAOImpl.java
@@ -0,0 +1,70 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dao.impl;

+

+import java.util.List;

+

+import org.hibernate.Session;

+import org.hibernate.SessionFactory;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.dao.DataAccessException;

+import org.springframework.stereotype.Repository;

+

+import com.ellisdon.portal.mv.dao.VacationHistoryDAO;

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+

+/**

+ * This is implementation class for VacationHistoryDAO interface

+ * 

+ * @author ahmedb

+ * @version 1.0, Nov 29, 2010

+ * @since JDK1.6

+ */

+@Repository("vacHistoryDAOBean")

+public class VacationHistoryDAOImpl implements VacationHistoryDAO{

+	

+	@Autowired(required=true)

+	private SessionFactory sessFactory;

+	

+	@Override

+	public List<VacationHistoryDTO> getUserVacationHistory(int IDUser)throws DataAccessException {

+		Session sess = sessFactory.getCurrentSession();

+		List<VacationHistoryDTO> vacHistDTOList = sess.createQuery(

+	    "from VacationHistoryDTO as vacHist where vacHist.userid = ?")

+	    .setInteger(0, IDUser)

+	    .list();

+         return vacHistDTOList;

+     }

+

+	@Override

+	public void updateUserVacationHistory(VacationHistoryDTO vacHistDTO) throws DataAccessException {

+		Session sess = sessFactory.getCurrentSession();

+		sess.merge(vacHistDTO);

+	}

+

+	@Override

+	public void insertVacationHistory(VacationHistoryDTO vacHistDTO) throws DataAccessException {

+		Session sess = sessFactory.getCurrentSession();

+		sess.save(vacHistDTO);		

+	}

+

+	public VacationHistoryDTO getVacationHistory(int vacHistID) throws DataAccessException{

+		VacationHistoryDTO vacHistDto = null;

+		Session sess = sessFactory.getCurrentSession();

+		vacHistDto = (VacationHistoryDTO) sess.load(VacationHistoryDTO.class, vacHistID); 

+		return vacHistDto;		

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dto/VacationEntitlementDTO.java b/src/main/java/com/ellisdon/portal/mv/dto/VacationEntitlementDTO.java
new file mode 100644
index 0000000..e37e303
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dto/VacationEntitlementDTO.java
@@ -0,0 +1,93 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dto;

+

+import java.util.Date;

+

+import javax.persistence.*;

+

+/**

+ * This Class is a Data Transfer Object for table VacationEntitlement, use to transefer data between 

+ * different application architecture layers e.g. Controller, Service, DAO etc  

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 28, 2010

+ * @since JDK1.6

+ */

+

+@Entity

+@Table(name = "users_vacation_entitlement")

+public class VacationEntitlementDTO {

+

+	@Id

+	@Column(name = "userid")

+	private int userid;

+

+	@Column(name = "daysentitle")

+	private int entitledays;

+

+	@Column(name = "carryover")

+	private float carryoverday;

+	

+	@Column(name = "lastupdated")

+	private Date lastupdated;

+		

+	/**

+	 * @return the carryover

+	 */

+	public float getCarryoverdays() {

+		return carryoverday;

+	}

+

+	/**

+	 * @return the userid

+	 */

+	public int getUserid() {

+		return userid;

+	}

+

+	/**

+	 * @return the entitledays

+	 */

+	public int getEntitledays() {

+		return entitledays;

+	}

+

+	/**

+	 * @param entitledays the entitledays to set

+	 */

+	public void setEntitledays(int entitledays) {

+		this.entitledays = entitledays;

+	}

+

+	/**

+	 * @return the lastupdated

+	 */

+	public Date getLastupdated() {

+		return lastupdated;

+	}

+

+	/**

+	 * @param lastupdated the lastupdated to set

+	 */

+	public void setLastupdated(Date lastupdated) {

+		this.lastupdated = lastupdated;

+	}

+

+	@Override

+	public String toString() {

+		return "com.ellisdon.portal.mv.dto.VacationEntitlementDTO[ID=" + this.userid + "]";

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/dto/VacationHistoryDTO.java b/src/main/java/com/ellisdon/portal/mv/dto/VacationHistoryDTO.java
new file mode 100644
index 0000000..c6e7259
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/dto/VacationHistoryDTO.java
@@ -0,0 +1,154 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.dto;

+

+import java.util.Date;

+

+import javax.persistence.Column;

+import javax.persistence.Entity;

+import javax.persistence.Id;

+import javax.persistence.Table;

+

+/**

+ * This Class is a Data Transfer Object for table VacationHistory, use to transfer data between 

+ * different application architecture layers e.g. Controller, Service, DAO etc  

+ * 

+ * @author ahmedb

+ * @version 1.0, Nov 28, 2010

+ * @since JDK1.6

+ */

+

+@Entity

+@Table(name = "users_vacation_history")

+public class VacationHistoryDTO {

+	

+	@Id

+	@Column(name = "iduservacation")

+	private int uservacationid;

+

+	@Column(name = "userid")

+	private int userid;

+	

+	@Column(name = "fromdate")

+	private Date fromdate;

+

+	@Column(name = "todate")

+	private Date todate;

+	

+	@Column(name = "daystaken")

+	private float daystaken;

+	

+	@Column(name = "daysnottaken")

+	private float daysnottaken;

+	

+	@Column(name = "comments")

+	private String comments;

+	

+	/**

+	 * @return the fromdate

+	 */

+	public Date getFromdate() {

+		return fromdate;

+	}

+

+	/**

+	 * @param fromdate the fromdate to set

+	 */

+	public void setFromdate(Date fromdate) {

+		this.fromdate = fromdate;

+	}

+

+	/**

+	 * @return the todate

+	 */

+	public Date getTodate() {

+		return todate;

+	}

+

+	/**

+	 * @param todate the todate to set

+	 */

+	public void setTodate(Date todate) {

+		this.todate = todate;

+	}

+

+	/**

+	 * @return the daystaken

+	 */

+	public float getDaystaken() {

+		return daystaken;

+	}

+

+	/**

+	 * @param daystaken the daystaken to set

+	 */

+	public void setDaystaken(float daystaken) {

+		this.daystaken = daystaken;

+	}

+

+	/**

+	 * @return the daysnottaken

+	 */

+	public float getDaysnottaken() {

+		return daysnottaken;

+	}

+

+	/**

+	 * @param daysnottaken the daysnottaken to set

+	 */

+	public void setDaysnottaken(float daysnottaken) {

+		this.daysnottaken = daysnottaken;

+	}

+

+	/**

+	 * @return the comments

+	 */

+	public String getComments() {

+		return comments;

+	}

+

+	/**

+	 * @param comments the comments to set

+	 */

+	public void setComments(String comments) {

+		this.comments = comments;

+	}

+

+	/**

+	 * @return the uservacationid

+	 */

+	public int getUservacationid() {

+		return uservacationid;

+	}

+

+	/**

+	 * @return the userid

+	 */

+	public int getUserid() {

+		return userid;

+	}

+

+	/**

+	 * @param userid the userid to set

+	 */

+	public void setUserid(int userid) {

+		this.userid = userid;

+	}

+

+	@Override

+	public String toString() {

+		return "com.ellisdon.portal.mv.dto.VacationHistoryDTO[ID=" + this.uservacationid + "]";

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/exception/MyVacationRuntimeException.java b/src/main/java/com/ellisdon/portal/mv/exception/MyVacationRuntimeException.java
new file mode 100644
index 0000000..99f7366
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/exception/MyVacationRuntimeException.java
@@ -0,0 +1,7 @@
+package com.ellisdon.portal.mv.exception;

+

+public class MyVacationRuntimeException extends RuntimeException {

+	public MyVacationRuntimeException(String errorMessage,Throwable cause) {

+        super(errorMessage,cause);        

+    }	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/logger/MyVacationLogger.java b/src/main/java/com/ellisdon/portal/mv/logger/MyVacationLogger.java
new file mode 100644
index 0000000..777e9ab
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/logger/MyVacationLogger.java
@@ -0,0 +1,14 @@
+package com.ellisdon.portal.mv.logger;

+

+import org.apache.log4j.Logger;

+import org.apache.log4j.*;

+

+public class MyVacationLogger extends Logger  {

+	static{

+		PropertyConfigurator.configure("log4j.properties");

+	}

+	

+	protected MyVacationLogger(String name) {

+		super(name);

+	}

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/model/LifeRayUser.java b/src/main/java/com/ellisdon/portal/mv/model/LifeRayUser.java
new file mode 100644
index 0000000..c1bb77e
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/model/LifeRayUser.java
@@ -0,0 +1,66 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.model;

+

+/**

+ * This is the dummy class to represent LifeRay user

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 1, 2010

+ * @since JDK1.6

+ */

+public class LifeRayUser {

+

+	private int userId;

+	private String UserName;

+

+	/**

+	 * @param userId

+	 * @param userName

+	 */

+	public LifeRayUser(int userId, String userName) {

+		super();

+		this.userId = userId;

+		UserName = userName;

+	}

+	

+	

+	

+	/**

+	 * @return the userId

+	 */

+	public int getUserId() {

+		return userId;

+	}

+	/**

+	 * @param userId the userId to set

+	 */

+	public void setUserId(int userId) {

+		this.userId = userId;

+	}

+	/**

+	 * @return the userName

+	 */

+	public String getUserName() {

+		return UserName;

+	}

+	/**

+	 * @param userName the userName to set

+	 */

+	public void setUserName(String userName) {

+		UserName = userName;

+	}

+

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/model/UserVacationBean.java b/src/main/java/com/ellisdon/portal/mv/model/UserVacationBean.java
new file mode 100644
index 0000000..1ffab05
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/model/UserVacationBean.java
@@ -0,0 +1,104 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.model;

+

+import java.util.List;

+

+import org.zkoss.zkplus.spring.SpringUtil;

+import org.zkoss.zul.Grid;

+import org.zkoss.zul.GroupsModelArray;

+//import org.zkoss.zul.ListModelList;

+

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.service.VacationService;

+import com.ellisdon.portal.mv.ui.VacationHistoryComparator;

+import com.ellisdon.portal.mv.ui.VacationHistoryGroupsModelArray;

+import com.ellisdon.portal.mv.util.CommanConstants;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is the Helper Bean which is used for the interaction between the Controller and Service layer.

+ * It also hold intermediate data model state use by views. J2EE Pattern : ViewHelper/ValueBean.

+ * This bean will be created and stored in the user session, and will be destroyed when user session 

+ * expired or invalidated automatically.

+ * 

+ * @author ahmedb

+ * @version 1.0, Dec 7, 2010

+ * @since JDK1.6

+ */

+public class UserVacationBean {

+

+	private int userid;

+	private VacationService vacServiceBean;

+	private Grid gridVacHistory;

+	

+	public UserVacationBean(){

+		//Get handle to spring managed business service bean

+		vacServiceBean = (VacationService) SpringUtil.getBean(CommanConstants.SPRING_VACATION_SERVICE_BEAN);

+	}

+	

+

+	public int getUserEntitlementDays() {

+		VacationEntitlementDTO vacentdto = vacServiceBean.getUserEntitlement(this.userid);

+		return vacentdto.getEntitledays();		

+	}

+	

+	public float getUserCarryOverDays() {

+		VacationEntitlementDTO vacentdto = vacServiceBean.getUserEntitlement(this.userid);

+		return vacentdto.getCarryoverdays();		

+	}

+

+	public String getUserEntLastUpdated() throws Exception{

+		VacationEntitlementDTO vacentdto = vacServiceBean.getUserEntitlement(this.userid);

+		String lastupdated = Utility.convertDate2String(vacentdto.getLastupdated(), "yyyy-MM-dd");

+		return lastupdated;		

+	}

+	

+	public GroupsModelArray getUserVacationHistory(){

+		List<VacationHistoryDTO> vacHistDTOList = vacServiceBean.getUserVacationHistory(userid);

+	    if (!Utility.isNull(vacHistDTOList) & (vacHistDTOList.size() > 0)){	      	

+	    	return new VacationHistoryGroupsModelArray(vacHistDTOList.toArray(), new VacationHistoryComparator());

+	    }

+	    else{

+	    	return null;	

+	    }    	

+    }

+    

+	public void cancelUserVacation(VacationHistoryDTO vachistdto){

+		vacServiceBean.cancelVaction(vachistdto);

+		refreshVacationHistoryGrid();

+	}

+

+	public void takeUserVacation(VacationHistoryDTO vachistdto){

+		vachistdto.setUserid(this.userid);

+		vacServiceBean.takeVaction(vachistdto);	

+		refreshVacationHistoryGrid();

+	}

+	

+	private void refreshVacationHistoryGrid(){

+		gridVacHistory.setModel(getUserVacationHistory());

+	}

+	

+	public void setUserid(int userid) {

+		this.userid = userid;

+	}

+

+	public void setGridVacHistory(Grid gridVacHistory) {

+		this.gridVacHistory = gridVacHistory;

+	}

+	

+	

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/portlet/MyVacationPortlet.java b/src/main/java/com/ellisdon/portal/mv/portlet/MyVacationPortlet.java
new file mode 100644
index 0000000..0d11cf5
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/portlet/MyVacationPortlet.java
@@ -0,0 +1,177 @@
+/**
+ * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.ellisdon.portal.mv.portlet;
+
+import com.ellisdon.portal.mv.util.CommanConstants;
+import com.liferay.portal.PortalException;
+import com.liferay.portal.SystemException;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.model.User;
+import com.liferay.portal.service.UserLocalServiceUtil;
+
+import java.applet.AppletContext;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.servlet.http.HttpServletRequest;
+
+import javax.portlet.Portlet;
+
+import org.zkoss.zk.ui.Execution;
+import org.zkoss.zk.ui.Executions;
+import org.zkoss.zk.ui.http.DHtmlLayoutPortlet;
+/**
+ * <a href="JSPPortlet.java.html"><b><i>View Source</i></b></a>
+ *
+ * @author Brian Wing Shun Chan
+ *
+ */
+public class MyVacationPortlet extends DHtmlLayoutPortlet {
+
+	public void init() throws PortletException {
+		editJSP = getInitParameter("edit-jsp");
+		helpJSP = getInitParameter("help-jsp");
+		viewJSP = getInitParameter("view-jsp");
+	}
+
+	public void doDispatch(
+			RenderRequest renderRequest, RenderResponse renderResponse)
+		throws IOException, PortletException {
+
+		String jspPage = renderRequest.getParameter("jspPage");
+
+		if (jspPage != null) {
+			include(jspPage, renderRequest, renderResponse);
+		}
+		else {
+			super.doDispatch(renderRequest, renderResponse);
+		}
+	}
+
+	
+	public void doEdit(
+			RenderRequest req, RenderResponse res)
+		throws IOException, PortletException {
+		res.setContentType("text/html");
+		PortletURL addName = res.createActionURL();
+		addName.setParameter("addName", "addName");
+		req.setAttribute("addNameUrl", addName.toString());
+		res.setTitle("Title From Code");
+		include(editJSP, req, res);
+	}
+	public void doHelp(
+			RenderRequest renderRequest, RenderResponse renderResponse)
+		throws IOException, PortletException {
+		User luser = null;
+		 luser = getCurrentUser(renderRequest);
+		 renderResponse.setTitle("My Vacation - " + luser.getFullName());
+		include(helpJSP, renderRequest, renderResponse);
+		
+		//showhelp();
+	}
+
+	public void doView(
+			RenderRequest renderRequest, RenderResponse renderResponse)
+		throws IOException, PortletException {
+		User luser = null;
+		 PortletPreferences prefs = renderRequest.getPreferences();
+		
+		 luser = getCurrentUser(renderRequest);
+		// renderRequest.setAttribute("USER",luser);
+		 renderRequest.setAttribute(CommanConstants.USER,luser);
+		 renderResponse.setTitle("My Vacation - " + luser.getFullName());
+		include(viewJSP, renderRequest, renderResponse);
+	}
+
+	public void processAction(
+			ActionRequest actionRequest, ActionResponse actionResponse)
+		throws IOException, PortletException {
+		
+		String addName = actionRequest.getParameter("addName");
+		if (addName!=null) {
+			 PortletPreferences prefs = actionRequest.getPreferences();
+			 prefs.setValue("name", actionRequest.getParameter("username"));
+			 prefs.store();
+			 actionResponse.setPortletMode(PortletMode.VIEW);
+		}
+	}
+
+	protected void include(
+			String path, RenderRequest renderRequest,
+			RenderResponse renderResponse)
+		throws IOException, PortletException {
+
+		PortletRequestDispatcher portletRequestDispatcher =
+			getPortletContext().getRequestDispatcher(path);
+
+		if (portletRequestDispatcher == null) {
+			_log.error(path + " is not a valid include");
+		}
+		else {
+			portletRequestDispatcher.include(renderRequest, renderResponse);
+		}
+	}
+	
+
+	protected User getCurrentUser(RenderRequest renderRequest) {
+		User u = null;
+
+		if (renderRequest.getUserPrincipal() == null) {
+
+			System.out.println("current principal is null");
+		} else {
+			Long id = Long
+					.parseLong(renderRequest.getUserPrincipal().getName());
+			try {
+				u = UserLocalServiceUtil.getUserById(id);
+			} catch (PortalException ex) {
+
+				System.out.println(ex.getMessage());
+			} catch (SystemException ex) {
+
+				System.out.println(ex.getMessage());
+			}
+		}
+		return u;
+	}
+
+	protected String editJSP;
+	protected String helpJSP;
+	protected String viewJSP;
+
+	private static Log _log = LogFactoryUtil.getLog(MyVacationPortlet.class);
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/ellisdon/portal/mv/service/VacationService.java b/src/main/java/com/ellisdon/portal/mv/service/VacationService.java
new file mode 100644
index 0000000..694a507
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/service/VacationService.java
@@ -0,0 +1,43 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.service;

+

+import java.util.List;

+

+import org.springframework.dao.DataAccessException;

+

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.exception.MyVacationRuntimeException;

+

+/**

+ * This is the public interface for VacationHistory service

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 1, 2010

+ * @since JDK1.6

+ */

+public interface VacationService {

+

+	public List<VacationHistoryDTO> getUserVacationHistory(int IDUser) throws MyVacationRuntimeException;

+

+	public void cancelVaction(VacationHistoryDTO vacHistDto) throws MyVacationRuntimeException;

+	

+	public void takeVaction(VacationHistoryDTO vacHistDto) throws MyVacationRuntimeException;

+	

+	public VacationEntitlementDTO getUserEntitlement(int IDUser) throws MyVacationRuntimeException;

+

+	public void updateUserEntitlement(VacationEntitlementDTO vacentdto) throws MyVacationRuntimeException;	

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/service/impl/VacationServiceImpl.java b/src/main/java/com/ellisdon/portal/mv/service/impl/VacationServiceImpl.java
new file mode 100644
index 0000000..87391a3
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/service/impl/VacationServiceImpl.java
@@ -0,0 +1,120 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.service.impl;

+

+import java.util.List;

+

+import org.apache.log4j.Logger;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.dao.DataAccessException;

+import org.springframework.stereotype.Service;

+import org.springframework.transaction.annotation.Transactional;

+

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.dao.VacationEntitlementDAO;

+import com.ellisdon.portal.mv.dao.VacationHistoryDAO;

+import com.ellisdon.portal.mv.exception.MyVacationRuntimeException;

+import com.ellisdon.portal.mv.logger.MyVacationLogger;

+import com.ellisdon.portal.mv.service.VacationService;

+

+/**

+ * This is the single service class for MyVacation Portlet application

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 1, 2010

+ * @since JDK1.6

+ */

+@Service("vacationServiceBean")

+public class VacationServiceImpl implements VacationService{

+	

+	private static final Logger logger = MyVacationLogger.getLogger(VacationServiceImpl.class);

+	

+	@Autowired(required=true)

+	private VacationHistoryDAO vacHistDAO;

+	

+	@Autowired(required=true)

+	private VacationEntitlementDAO vacEntDAO;	

+			

+	@Transactional(readOnly=true)

+	public List<VacationHistoryDTO> getUserVacationHistory(int IDUser) throws MyVacationRuntimeException {

+	 List<VacationHistoryDTO> listVacHist;

+	 try {		

+		listVacHist = vacHistDAO.getUserVacationHistory(IDUser);

+		return listVacHist;		

+	 }catch(DataAccessException dex) {

+ 	     logger.error("Data access exception occured : " + dex.getMessage(), dex);

+ 	     throw new MyVacationRuntimeException("Data access exception", dex);

+	 }catch(Exception ex){

+ 	     logger.error("Exception occured : " + ex.getMessage(), ex);

+ 	     throw new MyVacationRuntimeException(ex.getMessage(), ex);

+	 }

+	}

+

+	@Transactional(readOnly=false)

+	public void cancelVaction(VacationHistoryDTO vacHistDto) throws MyVacationRuntimeException {

+      try {

+		float daysTaken = vacHistDto.getDaystaken();

+		vacHistDto.setDaysnottaken(daysTaken);

+		vacHistDto.setDaystaken(0);

+		vacHistDAO.updateUserVacationHistory(vacHistDto);

+	 }catch(DataAccessException dex) {

+ 	     logger.error("Data access exception occured : " + dex.getMessage(), dex);

+ 	     throw new MyVacationRuntimeException("Data access exception", dex);

+	 }catch(Exception ex){

+ 	     logger.error("Exception occured : " + ex.getMessage(), ex);

+ 	     throw new MyVacationRuntimeException(ex.getMessage(), ex);

+	 }

+	}

+	

+	@Transactional(readOnly=false)

+	public void takeVaction(VacationHistoryDTO vacHistDto) throws MyVacationRuntimeException {

+      try{

+		vacHistDAO.insertVacationHistory(vacHistDto);

+	 }catch(DataAccessException dex) {

+ 	     logger.error("Data access exception occured : " + dex.getMessage(), dex);

+ 	     throw new MyVacationRuntimeException("Data access exception", dex);

+	 }catch(Exception ex){

+ 	     logger.error("Exception occured : " + ex.getMessage(), ex);

+ 	     throw new MyVacationRuntimeException(ex.getMessage(), ex);

+	 }

+	}

+

+	@Transactional(readOnly=true)

+	public VacationEntitlementDTO getUserEntitlement(int IDUser) throws MyVacationRuntimeException {

+	      try{

+	  		return vacEntDAO.getUserEntitlement(IDUser);

+	  	 }catch(DataAccessException dex) {

+	   	     logger.error("Data access exception occured : " + dex.getMessage(), dex);

+	   	     throw new MyVacationRuntimeException("Data access exception", dex);

+	  	 }catch(Exception ex){

+	   	     logger.error("Exception occured : " + ex.getMessage(), ex);

+	   	     throw new MyVacationRuntimeException(ex.getMessage(), ex);

+	  	 }

+	}

+

+	@Transactional(readOnly=false)

+	public void updateUserEntitlement(VacationEntitlementDTO vacentdto) throws MyVacationRuntimeException{

+	      try{

+		      vacEntDAO.updateUserEntitlement(vacentdto);

+		  }catch(DataAccessException dex) {

+		   	  logger.error("Data access exception occured : " + dex.getMessage(), dex);

+		   	  throw new MyVacationRuntimeException("Data access exception", dex);

+		  }catch(Exception ex){

+		   	  logger.error("Exception occured : " + ex.getMessage(), ex);

+		   	  throw new MyVacationRuntimeException(ex.getMessage(), ex);

+		  }

+	}

+	

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryComparator.java b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryComparator.java
new file mode 100644
index 0000000..fb7447e
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryComparator.java
@@ -0,0 +1,48 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.ui;

+

+import java.util.Calendar;

+import java.util.Comparator;

+import java.util.Date;

+

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+

+/**

+ * This is the comparator class to sort and group the user vacation history by years. 

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 8, 2010

+ * @since JDK1.6

+ */

+public class VacationHistoryComparator implements Comparator{

+

+    @Override

+    public int compare(Object o1, Object o2) {

+    	int result = 0;

+    	

+        VacationHistoryDTO vachistdto1 =(VacationHistoryDTO) o1;

+        VacationHistoryDTO vachistdto2 =(VacationHistoryDTO) o2;

+       

+        Calendar cal = Calendar.getInstance();

+        cal.setTime(vachistdto1.getFromdate());

+        String year1 = Integer.toString(cal.get(Calendar.YEAR));

+        

+        cal.setTime(vachistdto2.getFromdate());

+        String year2 = Integer.toString(cal.get(Calendar.YEAR));

+        

+        //Descending order

+        return year2.toString().compareTo(year1.toString());    	

+    } 

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryGroupsModelArray.java b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryGroupsModelArray.java
new file mode 100644
index 0000000..cd283a1
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryGroupsModelArray.java
@@ -0,0 +1,63 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.ui;

+

+import java.util.Comparator;

+

+import org.zkoss.zul.GroupsModelArray;

+

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is the customized version of org.zkoss.zul.GroupsModelArray

+ * to create header in the VacationHistory Grid the display of Total 

+ * Vacations taken per year.

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 9, 2010

+ * @since JDK1.6

+ */

+public class VacationHistoryGroupsModelArray extends GroupsModelArray{

+

+	public VacationHistoryGroupsModelArray(Object[] data, Comparator cmpr) {

+		super(data, cmpr);	

+	}

+	

+	public VacationHistoryGroupsModelArray(Object[] data, Comparator cmpr, int col) {

+		super(data, cmpr, col);	

+	}

+

+    //Create GroupHeader Data

+    protected Object createGroupHead(Object[] groupdata, int index, int col) {

+        //Calculate the total vacation days taken per year

+    	String groupheader = null;

+    	float totaldaysTaken = 0;

+    	

+    	try {

+    	VacationHistoryDTO vachistdto=null;

+    	for (Object data : groupdata) {  

+    	     vachistdto = (VacationHistoryDTO) data; 

+    	     totaldaysTaken = vachistdto.getDaystaken() + totaldaysTaken;    		

+    	}

+    	

+    	String vacYear = Utility.convertDate2String(vachistdto.getFromdate(), "yyyy");

+    	groupheader = vacYear + " [ Vacation days Taken : " + totaldaysTaken + " ]";  

+    	

+       	}catch (Exception ex){

+    		ex.printStackTrace();

+    	}

+    	return groupheader; 

+    }

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryRowRenderer.java b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryRowRenderer.java
new file mode 100644
index 0000000..9721781
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/ui/VacationHistoryRowRenderer.java
@@ -0,0 +1,83 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.ui;

+

+import static org.zkoss.zk.ui.event.Events.ON_CLICK;

+

+import org.zkoss.zk.ui.event.Event;

+import org.zkoss.zk.ui.event.EventListener;

+import org.zkoss.zul.Button;

+import org.zkoss.zul.Cell;

+import org.zkoss.zul.Group;

+import org.zkoss.zul.Groupfoot;

+import org.zkoss.zul.Label;

+import org.zkoss.zul.Row;

+import org.zkoss.zul.RowRenderer;

+

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.model.UserVacationBean;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This class is the RowRenderer implementation for Vacation History Grid 

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 8, 2010

+ * @since JDK1.6

+ */

+public class VacationHistoryRowRenderer implements RowRenderer {

+

+	private UserVacationBean userVacation;

+	

+	public VacationHistoryRowRenderer(UserVacationBean userVacation){

+		this.userVacation = userVacation;

+	}

+	

+	@Override

+	public void render(Row row, Object data) throws Exception {

+

+		final VacationHistoryDTO vachistdto;

+		if (row instanceof Group) {

+	        row.appendChild(new Label(data.toString()));

+	    }

+        else {

+        	vachistdto = (VacationHistoryDTO) data;

+			String fromDate = Utility.convertDate2String(vachistdto.getFromdate(), "yyyy-MM-dd");

+			row.appendChild(new Label("" + fromDate));

+			String toDate = Utility.convertDate2String(vachistdto.getTodate(), "yyyy-MM-dd");

+			row.appendChild(new Label("" + toDate));        			

+		    row.appendChild(new Label("" + vachistdto.getDaystaken()));

+		    row.appendChild(new Label("" + vachistdto.getDaysnottaken()));

+		    row.appendChild(new Label("" + vachistdto.getComments()));    

+			

+			Button button = new Button("Not Taken");

+			row.appendChild(button);

+						

+			if (vachistdto.getDaystaken() == 0 ){

+				button.setDisabled(true);

+			}

+

+  			button.addEventListener(ON_CLICK, new EventListener() {

+				public void onEvent(Event event) throws Exception {

+					try{

+						userVacation.cancelUserVacation(vachistdto);

+					}catch(Exception e){

+						//errorLb.setValue(e.getMessage());

+					}

+				}

+			});		

+        }		

+	}

+

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/util/CommanConstants.java b/src/main/java/com/ellisdon/portal/mv/util/CommanConstants.java
new file mode 100644
index 0000000..803983b
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/util/CommanConstants.java
@@ -0,0 +1,28 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.util;

+

+/**

+ * This interface contains the common constants used by the application

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 1, 2010

+ * @since JDK1.6

+ */

+public interface CommanConstants {

+

+	static final String USER = "USER";

+	static final String SPRING_VACATION_SERVICE_BEAN = "vacationServiceBean";

+	static final String USER_VACATION_HELPER_BEAN = "userVacationBean";

+}

diff --git a/src/main/java/com/ellisdon/portal/mv/util/Utility.java b/src/main/java/com/ellisdon/portal/mv/util/Utility.java
new file mode 100644
index 0000000..be86803
--- /dev/null
+++ b/src/main/java/com/ellisdon/portal/mv/util/Utility.java
@@ -0,0 +1,116 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.util;

+

+import java.text.DateFormat;

+import java.text.ParseException;

+import java.text.SimpleDateFormat;

+import java.util.Collection;

+import java.util.Date;

+

+/**

+ * This class contains Utility methods for data formatting, type conversions, etc

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 30, 2010

+ * @since JDK1.6

+ */

+public class Utility {

+	public static final String EMPTY_STRING = ""; 

+	

+	/**

+     * This method return true if the object is meaningfully null. 

+     * If the input object is string then it is also checked if the string is empty.

+     * If the input object is a collection it is checked if its size is greater than zero

+     * @param obj The object which has to be checked for null

+     * @return true if the obj is null

+     */

+    public static boolean isNull(Object obj){

+       if(obj == null){

+            return true;

+       }

+       else if(obj instanceof String){

+            return (((String)obj).trim().length()==0);

+       }

+       else if(obj instanceof Collection){

+            return (((Collection)obj).size() == 0);

+       }

+       else{

+            return false;

+       }

+    }	

+	

+	 /**

+	 * 

+	 * @param dateValue

+	 * @param dateOnlyFormat

+	 * @return Date

+	 * @throws ParseException

+	 */

+	public static Date convertString2Date(String dateValue,String dateFormat) throws ParseException{	

+		if(Utility.isNull(dateValue)){

+			return null;

+		}

+		Date date = null;

+		SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);

+		try 

+		{			

+			date = new Date(simpleDateFormat.parse(dateValue).getTime());

+			return date;

+		}

+		catch(ParseException e){			

+			throw e;

+		}

+	}

+	

+	/**

+	 * 

+	 * @param dateValue

+	 * @param dateFormat

+	 * @return String

+	 * @throws Exception

+	 */

+	public static String convertDate2String(Date dateValue,String dateFormat)throws Exception{

+		if(Utility.isNull(dateValue)){

+			return Utility.EMPTY_STRING;

+		}

+		try{	

+			SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);

+			return formatter.format(dateValue);

+		}

+		catch(Exception e){			

+			throw e;

+		}

+	}

+

+	/**

+	 * 

+	 * @param dateValue

+	 * @param dateFormat

+	 * @return String

+	 * @throws Exception

+	 */

+	public static String convertDate2String(Date dateValue,int dateFormat)throws Exception{

+		if(Utility.isNull(dateValue)){

+			return Utility.EMPTY_STRING;

+		}

+		try{	

+			DateFormat formatter = DateFormat.getDateInstance(dateFormat);

+			return formatter.format(dateValue);

+		}

+		catch(Exception e){			

+			throw e;

+		}

+	}

+}

diff --git a/src/main/resources/DDL-MyVacation.sql b/src/main/resources/DDL-MyVacation.sql
new file mode 100644
index 0000000..395ebd0
--- /dev/null
+++ b/src/main/resources/DDL-MyVacation.sql
@@ -0,0 +1,20 @@
+DROP TABLE IF EXISTS `lportal`.`users_vacation_entitlement`;

+CREATE TABLE  `lportal`.`users_vacation_entitlement` (

+  `userid` bigint(20) unsigned NOT NULL,

+  `daysentitle` int(10) unsigned NOT NULL,

+  `carryover` float NOT NULL,

+  `lastupdated` datetime NOT NULL,

+  PRIMARY KEY (`userid`)

+) ENGINE=InnoDB DEFAULT CHARSET=latin1;

+

+DROP TABLE IF EXISTS `lportal`.`users_vacation_history`;

+CREATE TABLE  `lportal`.`users_vacation_history` (

+  `iduservacation` bigint(10) unsigned NOT NULL AUTO_INCREMENT,

+  `userid` bigint(10) unsigned NOT NULL,

+  `fromdate` datetime NOT NULL,

+  `todate` datetime NOT NULL,

+  `daystaken` float NOT NULL,

+  `daysnottaken` float NOT NULL,

+  `comments` varchar(45) NOT NULL,

+  PRIMARY KEY (`iduservacation`)

+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
\ No newline at end of file
diff --git a/src/main/resources/DML-MyVacation.sql b/src/main/resources/DML-MyVacation.sql
new file mode 100644
index 0000000..26e090a
--- /dev/null
+++ b/src/main/resources/DML-MyVacation.sql
@@ -0,0 +1,71 @@
+DELETE From users_vacation_history;

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2006-11-24', '2007-01-05', 28, 0, "Back home visit");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2009-06-15', '2009-06-19', 5, 0, "Time off");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2009-12-13', '2009-12-17', 5, 0, "US Visit");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2010-05-21', '2010-05-21', 1, 0, "Montreal Trip");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2010-09-15', '2010-09-15', 0.5, 0, "Doctor Appointment");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11201, '2010-04-21', '2010-04-21', 0.5, 0, "Dentist Visit");

+

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11252, '2010-09-15', '2010-09-15', 0.5, 0, "Doctor Appointment");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11252, '2010-04-21', '2010-04-21', 0.5, 0, "Dentist Visit");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11252, '2009-06-15', '2009-06-19', 5, 0, "Time off");

+

+INSERT INTO users_vacation_history

+(userid, fromdate, todate, daystaken, daysnottaken, comments)

+VALUES

+(11252, '2009-12-13', '2009-12-17', 5, 0, "US Vsist");

+

+DELETE From users_vacation_entitlement;

+

+INSERT INTO users_vacation_entitlement

+(userid, daysentitle, carryover, lastupdated)

+VALUES

+(11201, 20, 12.5, '2010-03-01');

+

+INSERT INTO users_vacation_entitlement

+(userid, daysentitle, carryover, lastupdated)

+VALUES

+(11252, 15, 16, '2010-01-01');

+

+

+

+

+

+

+

diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml
new file mode 100644
index 0000000..48a079b
--- /dev/null
+++ b/src/main/resources/hibernate.cfg.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

+<hibernate-configuration>

+	<session-factory>

+		<mapping class="com.ellisdon.portal.mv.dto.VacationHistoryDTO" />

+		<mapping class="com.ellisdon.portal.mv.dto.VacationEntitlementDTO"/>

+	</session-factory>

+</hibernate-configuration>

diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties
new file mode 100644
index 0000000..b010841
--- /dev/null
+++ b/src/main/resources/log4j.properties
@@ -0,0 +1,25 @@
+#log4j.rootLogger=DEBUG,myvacation

+log4j.logger.com.ellisdon.portal.mv=DEBUG,myvacation

+log4j.appender.myvacation=org.apache.log4j.RollingFileAppender

+log4j.appender.myvacation.File=${catalina.home}/logs/myvacation/myvacation.log

+log4j.appender.myvacation.MaxFileSize=5MB

+log4j.appender.myvacation.MaxBackupIndex=10

+log4j.appender.myvacation.layout=org.apache.log4j.PatternLayout

+log4j.appender.myvacation.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] [%-6p][%l] "%m"%n

+

+log4j.logger.org.hibernate=DEBUG,mvhibernate

+log4j.appender.mvhibernate=org.apache.log4j.RollingFileAppender

+log4j.appender.mvhibernate.File=${catalina.home}/logs/myvacation/hibernate.log

+log4j.appender.mvhibernate.MaxFileSize=5MB

+log4j.appender.mvhibernate.MaxBackupIndex=10

+log4j.appender.mvhibernate.layout=org.apache.log4j.PatternLayout

+log4j.appender.mvhibernate.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] [%-6p][%l] "%m"%n

+

+

+log4j.logger.org.springframework=DEBUG,mvspring

+log4j.appender.mvspring=org.apache.log4j.RollingFileAppender

+log4j.appender.mvspring.File=${catalina.home}/logs/myvacation/spring.log

+log4j.appender.mvspring.MaxFileSize=5MB

+log4j.appender.mvspring.MaxBackupIndex=10

+log4j.appender.mvspring.layout=org.apache.log4j.PatternLayout

+log4j.appender.mvspring.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] [%-6p][%l] "%m"%n

diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0

+Class-Path: 

+

diff --git a/src/main/webapp/WEB-INF/applicationContext.xml b/src/main/webapp/WEB-INF/applicationContext.xml
new file mode 100644
index 0000000..a4cfe8e
--- /dev/null
+++ b/src/main/webapp/WEB-INF/applicationContext.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:aop="http://www.springframework.org/schema/aop"

+	xmlns:context="http://www.springframework.org/schema/context"

+	xsi:schemaLocation=

+	"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

+		

+        <context:annotation-config />

+         

+  	    <import resource="bean-dao.xml" />	

+  	    

+  	    <!-- 

+  	    <import resource="bean-mv.xml" />

+  	     -->      

+        <context:component-scan base-package="com.ellisdon.portal.mv.dao.impl" />

+        <context:component-scan base-package="com.ellisdon.portal.mv.service.impl" />

+         

+</beans>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/bean-dao.xml b/src/main/webapp/WEB-INF/bean-dao.xml
new file mode 100644
index 0000000..6ef20f1
--- /dev/null
+++ b/src/main/webapp/WEB-INF/bean-dao.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xmlns:tx="http://www.springframework.org/schema/tx"

+		xsi:schemaLocation="http://www.springframework.org/schema/beans

+							http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+							http://www.springframework.org/schema/tx

+							http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

+

+	<!--

+		JNDI connection to datasource - Comment this out when ready to deploy

+		on server <jee:jndi-lookup id="dataSource"

+		jndi-name="java:/g3customerDS"/>

+	-->

+

+     <!--  Enable the configuration of transactional behavior of application Service beans

+           annotated with @Transactional -->

+     <tx:annotation-driven transaction-manager="transactionManager"/>

+		

+	<!-- Hibernate transaction manager bean -->	

+	<bean id="transactionManager"

+		class="org.springframework.orm.hibernate3.HibernateTransactionManager">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+

+	<!-- Data source definition for MySQL Driver -->

+	<bean id="dataSource"

+		class="org.springframework.jdbc.datasource.DriverManagerDataSource">

+		<property name="driverClassName" value="com.mysql.jdbc.Driver" />

+		<property name="url" value="jdbc:mysql://localhost:3306/lportal" />

+		<property name="username" value="root" />

+		<property name="password" value="bahmed" />

+	</bean>

+

+	<!-- Hibernate SessionFactory Bean Definition -->

+	<bean id="sessionFactory"

+		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

+		

+		<property name="dataSource">

+			<ref local="dataSource" />

+		</property>

+

+		<property name="configLocation" value="classpath:hibernate.cfg.xml" />

+

+		<property name="hibernateProperties">

+			<props>

+				<!--

+					The classname of a Hibernate org.hibernate.dialect.Dialect which

+					allows Hibernate to generate SQL optimized for a particular

+					relational database.

+				-->

+				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>

+

+				<!--

+					Write all SQL statements to console. This is an alternative to

+					setting the log category org.hibernate.SQL to debug.

+				-->

+				<prop key="hibernate.show_sql">true</prop>

+

+				<!-- Pretty print the SQL in the log and console. -->

+				<prop key="hibernate.format_sql">true</prop>

+

+				<!--

+					Sets a maximum "depth" for the outer join fetch tree for

+					single-ended associations (one-to-one, many-to-one). A 0 disables

+					default outer join fetching. recommended values between 0 and 3

+				-->

+				<prop key="hibernate.max_fetch_depth">2</prop>

+

+				<!--

+					Sets a default size for Hibernate batch fetching of

+					associations.recommended values 4, 8, 16

+				-->

+				<prop key="hibernate.jdbc.batch_size">16</prop>

+

+				<!--

+					If enabled, Hibernate will collect statistics useful for

+					performance tuning. true | false

+				-->

+				<prop key="hibernate.generate_statistics">true</prop>

+

+				<!--

+					If turned on, Hibernate will generate comments inside the SQL, for

+					easier debugging, defaults to false.

+				-->

+				<prop key="hibernate.use_sql_comments">true</prop>

+

+				<!--

+					If enabled, generated identifier properties will be reset to

+					default values when objects are deleted. true | false

+				-->

+				<prop key="hibernate.use_identifier_rollback">true</prop>

+

+				<!--

+					A non-zero value determines the JDBC fetch size (calls

+					Statement.setFetchSize()).

+				-->

+				<prop key="hibernate.jdbc.fetch_size">20</prop>

+

+				<!--

+					A non-zero value enables use of JDBC2 batch updates by Hibernate.

+					recommended values between 5 and 30

+				-->

+				<prop key="hibernate.default_batch_fetch_size">30</prop>

+

+				<!--

+					Set this property to true if your JDBC driver returns correct row

+					counts from executeBatch(). It is usually safe to turn this option

+					on. Hibernate will then use batched DML for automatically versioned

+					data. Defaults to false.

+				-->

+				<prop key="hibernate.jdbc.batch_versioned_data">true</prop>

+

+				<!--

+					Optimizes second-level cache operation to minimize writes, at the

+					cost of more frequent reads. This setting is most useful for

+					clustered caches and, in Hibernate3, is enabled by default for

+					clustered cache implementations. true|false

+				-->

+				<prop key="hibernate.cache.use_minimal_puts">false</prop>

+

+				<!--

+					Enables the query cache. Individual queries still have to be set

+					cachable. true|false

+				-->

+				<prop key="hibernate.cache.use_query_cache">false</prop>

+

+				<!--

+					Can be used to completely disable the second level cache, which is

+					enabled by default for classes which specify a <cache> mapping.

+					true|false

+				-->

+				<prop key="hibernate.cache.use_second_level_cache">false</prop>

+

+				<!-- Log all SQL DML statements as they are executed -->

+				<prop key="org.hibernate.SQL">debug</prop>

+

+				<!-- Log all JDBC parameters -->

+				<prop key="org.hibernate.type">debug</prop>

+

+				<!-- Log all SQL DDL statements as they are executed -->

+				<prop key="org.hibernate.tool.hbm2ddl">debug</prop>

+

+				<!--

+					Log the state of all entities (max 20 entities) associated with the

+					session at flush time

+				-->

+				<prop key="org.hibernate.pretty">debug</prop>

+

+				<!-- Log all second-level cache activity -->

+				<prop key="org.hibernate.cache">debug</prop>

+

+				<!-- Log transaction related activity -->

+				<prop key="org.hibernate.transaction">debug</prop>

+

+				<!-- Log all JDBC resource acquisition -->

+				<prop key="org.hibernate.jdbc">debug</prop>

+

+				<!-- Log HQL and SQL ASTs during query parsing -->

+				<prop key="org.hibernate.hql.ast.AST">debug</prop>

+

+				<prop key="hbm2ddl.auto">none</prop>

+

+			</props>

+		</property>

+	</bean>

+

+    <!-- Applies persistence exception translation to DAO's annotated with @Repository using AOP -->       

+    <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

+

+      

+	<!-- DAOs defination for MyVacation application -->

+	<!-- 

+	Note : 

+	The below application related DAO beans declarations can be removed safely this configuration

+	file. All the DAO in the application have been marked as @Repository annotation.

+	

+	<bean id="vacHistoryDAOBean" class="com.ellisdon.portal.mv.dao.impl.VacationHistoryDAOImpl">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+    

+	<bean id="vacEntitlementDAOBean" class="com.ellisdon.portal.mv.dao.impl.VacationEntitlementDAOImpl">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+	 -->

+ 

+   

+</beans> 

diff --git a/src/main/webapp/WEB-INF/bean-mv.xml b/src/main/webapp/WEB-INF/bean-mv.xml
new file mode 100644
index 0000000..acce5e4
--- /dev/null
+++ b/src/main/webapp/WEB-INF/bean-mv.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xmlns:tx="http://www.springframework.org/schema/tx"

+		xsi:schemaLocation="http://www.springframework.org/schema/beans

+							http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+							http://www.springframework.org/schema/tx

+							http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

+							

+    <!-- Declaration of Controllers and Services Beans -->

+     

+    <!--      

+    Note : 

+	The below application related Service bean declarations can be removed safely from this configuration

+	file. All the Service beans in the application have been marked as @Service annotation.    

+    

+ 	<bean id="vacServiceBean"

+		class="com.ellisdon.portal.mv.service.impl.VacationServiceImpl">

+		<property name="vacHistDAO" ref="vacHistoryDAOBean" /> 

+	</bean>

+   	 -->   	 

+   	 

+</beans>

diff --git a/src/main/webapp/WEB-INF/liferay-display.xml b/src/main/webapp/WEB-INF/liferay-display.xml
new file mode 100644
index 0000000..bade04d
--- /dev/null
+++ b/src/main/webapp/WEB-INF/liferay-display.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?> <!DOCTYPE display PUBLIC "-//Liferay//DTD DISPLAY 2.0.0//EN" "http://www.liferay.com/dtd/liferay-display_2_0_0.dtd">

+<display>

+	<category name="EllisDonPortlets">

+		<portlet id="myvacation" />

+	</category>

+</display>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/liferay-portlet.xml b/src/main/webapp/WEB-INF/liferay-portlet.xml
new file mode 100644
index 0000000..e1eb133
--- /dev/null
+++ b/src/main/webapp/WEB-INF/liferay-portlet.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">

+<liferay-portlet-app>

+	<portlet>

+		<portlet-name>myvacation</portlet-name>

+	</portlet>

+	<role-mapper>

+		<role-name>user</role-name>

+		<role-link>User</role-link>

+	</role-mapper>

+	<role-mapper>

+		<role-name>power-user</role-name>

+		<role-link>Power User</role-link>

+	</role-mapper>

+	<role-mapper>

+		<role-name>administrator</role-name>

+		<role-link>Administrator</role-link>

+	</role-mapper>

+</liferay-portlet-app>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/portlet.xml b/src/main/webapp/WEB-INF/portlet.xml
new file mode 100644
index 0000000..57b4041
--- /dev/null
+++ b/src/main/webapp/WEB-INF/portlet.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<portlet-app version="1.0"

+	xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">

+	<portlet>

+		<description xml:lang="EN">myvacation</description>

+		<portlet-name>myvacation</portlet-name>

+		<display-name xml:lang="EN">myvacation</display-name>

+		<portlet-class>com.ellisdon.portal.mv.portlet.MyVacationPortlet</portlet-class>

+		<init-param>

+			<name>view-jsp</name>

+			<value>/myvacation.zul</value>

+		</init-param>

+		<init-param>

+			<name>help-jsp</name>

+			<value>/help.html</value>

+		</init-param>

+		<expiration-cache>0</expiration-cache>

+		<supports>

+			<mime-type>text/html</mime-type>

+			<portlet-mode>view</portlet-mode>

+			<portlet-mode>help</portlet-mode>

+		</supports>

+		<supported-locale>en</supported-locale>

+		<portlet-info>

+			<title>MyVacation</title>

+			<short-title>MyVacation</short-title>

+			<keywords>zk</keywords>

+		</portlet-info>

+

+		<security-role-ref>

+			<role-name>power-user</role-name>

+		</security-role-ref>

+		<security-role-ref>

+			<role-name>user</role-name>

+		</security-role-ref>

+		<security-role-ref>

+			<role-name>administrator</role-name>

+		</security-role-ref>

+	</portlet>

+	

+</portlet-app>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..638b238
--- /dev/null
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="JavateWebApp_ID" version="2.5">

+  <display-name>Archetype Created JavATE Application</display-name>

+

+  <!-- Spring related settings -->

+  <context-param>

+		<param-name>contextConfigLocation</param-name>

+		<param-value>/WEB-INF/applicationContext.xml</param-value>

+  </context-param>

+	

+  <listener>

+		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

+  </listener>

+

+

+

+  <!-- ZK related settings -->

+  <listener>

+    <description>Used to cleanup when a session is destroyed</description>

+    <display-name>ZK Session Cleaner</display-name>

+    <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>

+  </listener>

+  <servlet>

+    <description>The servlet loads the DSP pages.</description>

+    <servlet-name>dspLoader</servlet-name>

+    <servlet-class>org.zkoss.web.servlet.dsp.InterpreterServlet</servlet-class>

+  </servlet>

+  <servlet>

+    <description>ZK loader for ZUML pages</description>

+    <servlet-name>zkLoader</servlet-name>

+    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>

+    <init-param>

+      <param-name>update-uri</param-name>

+      <param-value>/zkau</param-value>

+    </init-param>

+    <load-on-startup>1</load-on-startup>

+  </servlet>

+  <servlet>

+    <description>The asynchronous update engine for ZK</description>

+    <servlet-name>auEngine</servlet-name>

+    <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>

+  </servlet>

+  <servlet-mapping>

+    <servlet-name>dspLoader</servlet-name>

+    <url-pattern>*.dsp</url-pattern>

+  </servlet-mapping>

+  <servlet-mapping>

+    <servlet-name>zkLoader</servlet-name>

+    <url-pattern>*.zul</url-pattern>

+  </servlet-mapping>

+  <servlet-mapping>

+    <servlet-name>zkLoader</servlet-name>

+    <url-pattern>*.zhtml</url-pattern>

+  </servlet-mapping>

+  <servlet-mapping>

+    <servlet-name>auEngine</servlet-name>

+    <url-pattern>/zkau/*</url-pattern>

+  </servlet-mapping>

+

+

+  <welcome-file-list>

+    <welcome-file>myvacation.zul</welcome-file>

+    <welcome-file>index.zul</welcome-file>

+  </welcome-file-list>

+

+</web-app>
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/zk.xml b/src/main/webapp/WEB-INF/zk.xml
new file mode 100644
index 0000000..108bc6c
--- /dev/null
+++ b/src/main/webapp/WEB-INF/zk.xml
@@ -0,0 +1,3 @@
+<zk>

+	

+</zk>
\ No newline at end of file
diff --git a/src/main/webapp/help.html b/src/main/webapp/help.html
new file mode 100644
index 0000000..b91b025
--- /dev/null
+++ b/src/main/webapp/help.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

+<html>

+<head>

+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

+<title>Insert title here</title>

+</head>

+<body onload = "newWin()">

+

+<script type="text/javascript" language="JavaScript">

+

+function newWin(){

+	window.open("/ellisdon-myvacation-portlet-1.0/help.zul","zk","height=800,width=600");

+

+	}

+</script> 

+</body>

+</html>
\ No newline at end of file
diff --git a/src/main/webapp/help.zul b/src/main/webapp/help.zul
new file mode 100644
index 0000000..4671065
--- /dev/null
+++ b/src/main/webapp/help.zul
@@ -0,0 +1,9 @@
+<?page title="Help" contentType="text/html;charset=UTF-8"?>
+<zk>
+
+<window title="Help" border="normal">
+
+Please help Here!
+
+</window>
+</zk>
\ No newline at end of file
diff --git a/src/main/webapp/images/DeleteCross-16x16.png b/src/main/webapp/images/DeleteCross-16x16.png
new file mode 100644
index 0000000..79daacf
--- /dev/null
+++ b/src/main/webapp/images/DeleteCross-16x16.png
Binary files differ
diff --git a/src/main/webapp/index.zul b/src/main/webapp/index.zul
new file mode 100644
index 0000000..034ed8b
--- /dev/null
+++ b/src/main/webapp/index.zul
@@ -0,0 +1,6 @@
+<?page title="Auto Generated index.zul"?>
+<window title="Hello World!!" border="normal" width="200px">
+
+<label value="You are using: ${desktop.webApp.version}"/>
+
+</window>
\ No newline at end of file
diff --git a/src/main/webapp/my_vacation.zul b/src/main/webapp/my_vacation.zul
new file mode 100644
index 0000000..d72b731
--- /dev/null
+++ b/src/main/webapp/my_vacation.zul
@@ -0,0 +1,143 @@
+<?page title="EllisDon Portal" contentType="text/html;charset=UTF-8"?>
+<zk>
+<window id="my_vacation" border="normal" width="680px" height="620px" >
+	<caption image="/images/happyface.png" label="My Vacation" style="font-size:12px;"/>
+
+<tablelayout columns="2" width="100%">
+	<tablechildren colspan="1" width="50%">
+     <panel title="Entitlement"  border="normal" height="145px" style="margin-bottom:5px">
+				<panelchildren style="padding-left:5px; padding-top:10px">
+					<vbox style="margin-top:3px; margin-left:3px">
+					     <div>
+					        <label style="font-size:12px;font-weight:bold;" value="Yearly Entitlement : "/>
+			                <listbox id="listEntDays" rows="1" mold="select" style="font-size:12px">
+			                    <listitem label="15" value="15" />
+			                    <listitem label="20" value="20" />
+			                    <listitem label="25" value="25" />
+			                    <listitem label="30" value="30" />
+			                    <listitem label="35" value="35" />			                    		       
+			                </listbox>	        
+			                <label style="font-size:12px;" value="Days"/>			                			                
+					     </div>
+					     <div style="margin-top:10px">			             
+							     <label style="font-size:12px;" value="Last Updated : "/>
+							     <label style="font-size:12px;" value="01-Jan-2010"/>
+					     </div>
+					     <div>					     
+					       <button id="EntUpdate" label="Update Entitlement"/>
+					     </div>
+					</vbox>
+				</panelchildren>
+      </panel>
+	</tablechildren>
+
+	<tablechildren  colspan="1" width="50%">
+      <panel title="Balance" border="normal" height="145px" style="margin-left:5pxs;margin-bottom:5px">
+				<panelchildren style="padding-top:10px; padding-left:5px">
+                 <vbox style="margin-top:3px; margin-left:3px">
+					<hbox>
+					     <div>
+							<label style="font-size:12px;font-weight:bold;" value="Balance to Date : "/>
+							<style dynamic="true">
+								.mylbl {
+								border: 1px solid black;
+								padding-left:10px;
+							    padding-right:10px;							    												
+							 }
+							 </style>
+							<label sclass="mylbl" id="lblBalanceDays" style="font-size:12px;font-weight:bold;color:red;" width="30px" value="10" />							
+							<label style="font-size:12px;" value="Days"/>
+					     </div>
+					</hbox>
+                    <hbox style="margin-top:10px">
+					     <div>
+							<label style="font-size:12px;" value="As of January 1, 2010 you had "/>
+							<style dynamic="true">
+								.mylbl {
+								border: 1px solid black;
+								padding-left:10px;
+							    padding-right:10px;							    												
+							 }
+							 </style>
+							<label sclass="mylbl" id="lblCarryForwardDays" style="font-size:12px;font-weight:bold;color:blue;" width="30px" value="15" />							
+							<label style="font-size:12px;" value=" days vacation carried forward. This vacation needs to be taken by"/>
+					     </div>	
+					</hbox>
+					<label style="font-size:12px;" value="July 01, 2012."/>
+				</vbox>	
+				</panelchildren>
+      </panel>
+	</tablechildren>
+
+
+	<tablechildren colspan="2">
+      <panel title="Take Vacation" border="normal" height="205px" style="margin-bottom:5px">
+        <panelchildren>
+         <div>
+         <grid fixedLayout="true">
+	       <columns>
+		     <column label="Type" width="150px" />
+		     <column label="Content" />
+	       </columns>
+	       <rows>
+		     <row>
+			   <label value="From" width="150px" />
+			   <datebox id="fromdb" width="150px" />
+		    </row>
+
+		     <row>
+			   <label value="To" width="150px" />
+			   <datebox id="todb" width="150px" />		   
+		    </row>
+
+		     <row>
+			   <label value="Days taken" width="150px" />
+			   <spinner value="1" constraint="no negative,no zero"/>
+		    </row>
+
+		     <row>
+			   <label value="Comments" width="150px" />
+			   <textbox value="" width="300px" />
+		    </row>
+
+		   </rows>      
+		 </grid>
+		 </div>
+		 
+        <div id="UpdateClear" style="padding-top:10px"> 
+         <hbox>
+           	<div >
+			   <button label="Update"/>
+			   <button label="Clear"/>
+			</div> 
+         </hbox>
+       </div>
+		 
+       </panelchildren>
+       
+      </panel>
+	</tablechildren>
+
+	<tablechildren colspan="2">
+      <panel title="History" border="normal" height="200px" >
+        <panelchildren>
+		      	<grid id="historyGrid">
+					<columns>
+					    <column label="Year" width="40px"/>
+					    <column label="From" width="40px"/>
+						<column label="To" width="40px"/>
+						<column label="Days Taken" width="60px"/>
+						<column label="Not Taken" width="60px"/>
+						<column label="Comments" width="100px" align="center"/>
+						<column label="Action" width="40px" align="center"/>
+					</columns>
+	
+				</grid>
+         </panelchildren>
+      </panel>
+	</tablechildren>
+
+</tablelayout>
+			
+</window>
+</zk>
\ No newline at end of file
diff --git a/src/main/webapp/myvacation.zul b/src/main/webapp/myvacation.zul
new file mode 100644
index 0000000..b9f6cc6
--- /dev/null
+++ b/src/main/webapp/myvacation.zul
@@ -0,0 +1,140 @@
+<?page title="My Vacation" ?>

+<?init class="com.ellisdon.portal.mv.controller.VacationPortletInitiator" ?>

+<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>

+<zk>

+  <window id="winVacation" title="My Vacation" border="normal" width="680px" height="620px" style="margin-top:3px;"

+   apply="com.ellisdon.portal.mv.controller.VacationWindowViewController">

+   <caption label="" style="font-size:12px;font-weight:bold;"/>

+  <vlayout spacing="15px">

+    <hbox spacing="5px" style="margin-top:3px; margin-left:5px">

+    

+      <!-- Entitelment Section -->

+      <groupbox width="300px" height="110px">

+        <caption label="Entitelment" style="font-size:12px;font-weight:bold;"/>      

+ 					<vbox id="entView" style="margin-top:3px; margin-left:3px" apply="com.ellisdon.portal.mv.controller.VacationEntitelmentViewControllor">

+					     <div>

+					        <label style="font-size:12px;font-weight:bold;" value="Yearly Entitlement : "/>

+			                <listbox id="listEntDays" rows="1" mold="select" style="font-size:12px">

+			                    <listitem label="15" value="15" />

+			                    <listitem label="20" value="20" />

+			                    <listitem label="25" value="25" />

+			                    <listitem label="30" value="30" />

+			                    <listitem label="35" value="35" />			                    		       

+			                </listbox>	        

+			                <label style="font-size:12px;" value="Days"/>			                			                

+					     </div>

+					     <div style="margin-top:10px">			             

+							     <label style="font-size:12px;" value="Last Updated : "/>

+							     <label id="lbEntUpdate" style="font-size:12px;" value=""/>

+					     </div>

+					     <div>					     

+					       <button id="btnEntUpdate" label="Update Entitlement"/>

+					     </div>

+					</vbox>

+     </groupbox>

+          

+     <!-- HR Notice Section -->

+      <groupbox width="300px" height="110px">

+        <caption label="HR Notice" style="font-size:12px;font-weight:bold;"/>  

+                 <vbox style="margin-top:3px; margin-left:3px">

+                    <!-- 

+					<hbox>

+					     <div>

+							<label style="font-size:12px;font-weight:bold;" value="Balance to Date : "/>

+							<style dynamic="true">

+								.mylbl {

+								border: 1px solid black;

+								padding-left:10px;

+							    padding-right:10px;							    												

+							 }

+							 </style>

+							<label sclass="mylbl" id="lblBalanceDays" style="font-size:12px;font-weight:bold;color:red;" width="30px" value="10" />							

+							<label style="font-size:12px;" value="Days"/>

+					     </div>

+					</hbox>

+					 -->

+                    <hbox style="margin-top:10px">

+					     <div>

+							<label style="font-size:12px;" value="As of January 1, 2010 you had "/>

+							<style dynamic="true">

+								.mylbl {

+								border: 1px solid black;

+								padding-left:10px;

+							    padding-right:10px;							    												

+							 }

+							 </style>

+							<label sclass="mylbl" id="lblCarryForwardDays" style="font-size:12px;font-weight:bold;color:blue;" width="30px" value="15" />							

+							<label style="font-size:12px;" value=" days vacation carried forward. This vacation needs to be taken by"/>

+					     </div>	

+					</hbox>

+					<label style="font-size:12px;" value="July 01, 2012."/>

+				</vbox>	

+      </groupbox>

+    </hbox>

+    

+     <!-- Vacation Entry Section -->

+     <groupbox id="vacEntry" width="635px" height="180px" style="margin-left:5px" apply="com.ellisdon.portal.mv.controller.VacationEntryViewController">

+        <caption label="Take Vacation" style="font-size:12px;font-weight:bold;"/>  

+         <div style="margin-top:3px" >

+         <grid fixedLayout="true">

+	       <columns>

+		     <column label="Type" width="150px" />

+		     <column label="Content" />

+	       </columns>

+	       <rows>

+		     <row>

+			   <label value="From" width="150px" />

+               <datebox id="fromDate" cols="16" format="yyyy/MM/dd " 

+                onCreate="self.value = new Date()" mold="rounded" constraint="no empty" />

+		    </row>

+

+		     <row>

+			   <label value="To" width="150px" />

+               <datebox id="toDate" cols="16" format="yyyy/MM/dd " 

+                onCreate="self.value = new Date()" mold="rounded" constraint="no empty" />

+		    </row>

+

+		     <row>

+			   <label value="Days taken" width="150px" />

+			   <spinner id="daysTaken" value="1" constraint="no negative,no zero, no empty" />

+		    </row>

+

+		     <row>

+			   <label value="Comments" width="150px" />

+			   <textbox id="comments" value="" width="350px" maxlength="45" constraint="no empty" />

+		    </row>

+

+		   </rows>      

+		 </grid>

+		 </div>

+		 

+        <div id="UpdateClear" style="padding-top:10px"> 

+         <hbox>

+           	<div >

+			   <button id="save" label="Save" width="100px"/>

+			   <button id="reset"  label="Reset" style="margin-left:3px" width="100px"/>

+			</div> 

+         </hbox>

+       </div>

+     </groupbox>

+

+     <!-- Vacation History Section -->

+     <groupbox width="635px" height="190px" style="margin-left:5px">

+        <caption label="Vacation History" style="font-size:12px;font-weight:bold;"/>

+           <div id="divVacHistory"  style="margin-top:3px" apply="com.ellisdon.portal.mv.controller.VacationHistoryViewController">  

+              	<grid id="gridVacHistory" fixedLayout="true" height="170px">

+					<columns>

+					    <column label="From" width="80px"/>

+                        <column label="To" width="80px"/>

+						<column label="Days Taken" width="75px" align="center"/>

+						<column label="Not Taken" width="70px" align="center"/>

+						<column label="Comments" width="215px"/>

+						<column label="Action" width="90px" align="center"/>					    

+					</columns>

+				</grid>

+				</div>

+         </groupbox>

+

+   </vlayout>

+   </window>

+</zk>
\ No newline at end of file
diff --git a/src/main/webapp/timeout.zul b/src/main/webapp/timeout.zul
new file mode 100644
index 0000000..1516297
--- /dev/null
+++ b/src/main/webapp/timeout.zul
@@ -0,0 +1,7 @@
+<window width="80%" title="Session Timeout" border="normal">
+	<vbox>
+The page or component you request is no longer available.
+This is normally caused by timeout, opening too many Web pages, or rebooting
+the server.
+	</vbox>
+</window>
\ No newline at end of file
diff --git a/src/main/webapp/vacation.zul b/src/main/webapp/vacation.zul
new file mode 100644
index 0000000..0312f4b
--- /dev/null
+++ b/src/main/webapp/vacation.zul
@@ -0,0 +1,107 @@
+<?page title="EllisDon Portal" contentType="text/html;charset=UTF-8"?>
+<zk>
+<window id="my_vacation" border="normal" width="600px" height="590px" >
+	<caption image="/images/happyface.png" label="My Vacation" style="font-size:12px;"/>
+
+<tablelayout columns="2" width="100%">
+	<tablechildren  colspan="1" width="50%">
+      <panel title="Summary" border="normal" height="120px" style="margin-bottom:10px">
+        <panelchildren>
+		      	<grid id="summaryGrid">
+					<columns>
+					    <column label="Year" width="50px"/>
+						<column label="Earned" width="50px"/>
+						<column label="Used" width="50px"/>
+						<column label="Balance" width="50px"/>
+					</columns>
+				</grid>
+        </panelchildren>
+      </panel>
+	</tablechildren>
+	
+	<tablechildren  colspan="1" width="50%">
+      <panel title="Entitlement" border="normal" height="120px" style="margin-bottom:10px; margin-left:5px">
+				<panelchildren style="padding-left:60px; padding-top:10px">
+					<vbox>
+					     <div>
+					        <label style="font-size:12px;font-weight:bold;" value="Entitlement : "/>
+					        <textbox width="30px"/>
+					        <label style="font-size:12px;font-weight:bold;" value="Days"/>
+					     </div>
+					     <div style="float:right">
+						   <button label="Update"/>
+						</div> 
+						<label style="font-size:12px;" value="Last Updated : "/>
+					</vbox>
+				</panelchildren>
+      </panel>
+	</tablechildren>
+
+	<tablechildren colspan="2">
+      <panel title="Update" border="normal" height="200px" style="margin-bottom:10px">
+        <panelchildren>
+         <div>
+         <grid fixedLayout="true">
+	       <columns>
+		     <column label="Type" width="150px" />
+		     <column label="Content" />
+	       </columns>
+	       <rows>
+		     <row>
+			   <label value="From" width="150px" />
+			   <datebox id="fromdb" width="150px" />
+		    </row>
+
+		     <row>
+			   <label value="To" width="150px" />
+			   <datebox id="todb" width="150px" />		   
+		    </row>
+
+		     <row>
+			   <label value="Days taken" width="150px" />
+			   <spinner value="1" constraint="no negative,no zero"/>
+		    </row>
+
+		     <row>
+			   <label value="Comments" width="150px" />
+			   <textbox value="" width="300px" />
+		    </row>
+
+		   </rows>      
+		 </grid>
+		 </div>
+		 
+        <div id="UpdateClear" style="padding-left:10px; padding-top:10px"> 
+         <hbox>
+           	<div >
+			   <button label="Update"/>
+			   <button label="Clear"/>
+			</div> 
+         </hbox>
+       </div>
+		 
+       </panelchildren>
+       
+      </panel>
+	</tablechildren>
+
+	<tablechildren colspan="2">
+      <panel title="History" border="normal" height="200px" >
+        <panelchildren>
+		      	<grid id="historyGrid">
+					<columns>
+					    <column label="From" width="50px"/>
+						<column label="To" width="50px"/>
+						<column label="Days Taken" width="50px"/>
+						<column label="Comments" width="50px" align="center"/>
+						<column label="Delete" width="50px" align="center"/>
+					</columns>
+				</grid>
+         </panelchildren>
+      </panel>
+	</tablechildren>
+
+</tablelayout>
+			
+</window>
+</zk>
\ No newline at end of file
diff --git a/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationEntitlementDAO.java b/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationEntitlementDAO.java
new file mode 100644
index 0000000..47f4073
--- /dev/null
+++ b/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationEntitlementDAO.java
@@ -0,0 +1,98 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.test.dao;

+

+import java.text.DateFormat;

+import java.util.Date;

+import java.util.Calendar;

+

+import org.junit.Test;

+import static org.junit.Assert.*;

+import org.junit.runner.RunWith;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.test.annotation.Rollback;

+import org.springframework.test.context.ContextConfiguration;

+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

+import org.springframework.transaction.annotation.Transactional;

+

+import com.ellisdon.portal.mv.dao.VacationEntitlementDAO;

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is the JUnit test class for VacationEntitlementDAO

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 28, 2010

+ * @since JDK1.6

+ */

+

+@RunWith(SpringJUnit4ClassRunner.class)

+@ContextConfiguration(locations={"classpath:/applicationContext.xml"})

+@Transactional

+public class TestVacationEntitlementDAO {

+

+	@Autowired

+    private VacationEntitlementDAO vacEntDAO;

+

+	@Test

+	public void testGetUserEntitlement(){

+		 try {

+				Integer userid = new Integer(11201);

+				VacationEntitlementDTO vacEntDTO = vacEntDAO.getUserEntitlement(userid);

+	            if (vacEntDTO != null){	            

+	            	System.out.println("--------- testGetUserEntitlement() ---------");

+	            	System.out.println("Entitlement Days : " + vacEntDTO.getEntitledays());

+	            	System.out.println("Carry over Days : " + vacEntDTO.getCarryoverdays());

+	            	

+	            	String formattedDate = Utility.convertDate2String(vacEntDTO.getLastupdated(), DateFormat.MEDIUM);

+	            	System.out.println("Last updated : " + formattedDate);

+	            	assertTrue(true);

+	            }

+	            else{

+	            	assertTrue(false);

+	            }

+			  }catch(Exception ex){

+				   ex.printStackTrace();	

+	 			   assertTrue(false);

+				}	

+	}

+	

+	@Test

+	@Rollback(false)

+	public void testUpdateUserEntitlement(){

+		 try {

+				Integer userid = new Integer(11252);

+				VacationEntitlementDTO vacEntDTO = vacEntDAO.getUserEntitlement(userid);

+	            if (vacEntDTO != null){

+	            	vacEntDTO.setEntitledays(25);	            	

+	            	vacEntDTO.setLastupdated(Calendar.getInstance().getTime());

+	            	vacEntDAO.updateUserEntitlement(vacEntDTO);

+	            	System.out.println("--------- testUpdateUserEntitlement() ---------");

+	            	System.out.println("Updated Entitlement Days : " + vacEntDTO.getEntitledays());

+	            	String formattedDate = Utility.convertDate2String(vacEntDTO.getLastupdated(), "yyyy-MMM-DD");

+	            	System.out.println("Last updated : " + formattedDate);

+	            	assertTrue(true);

+	            }

+	            else{

+	            	assertTrue(false);

+	            }

+			  }catch(Exception ex){

+				   ex.printStackTrace();	

+	 			   assertTrue(false);

+				}	

+	}

+	

+	

+}

diff --git a/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationHistoryDAO.java b/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationHistoryDAO.java
new file mode 100644
index 0000000..7c26199
--- /dev/null
+++ b/src/test/java/com/ellisdon/portal/mv/test/dao/TestVacationHistoryDAO.java
@@ -0,0 +1,139 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.test.dao;

+

+import static org.junit.Assert.assertTrue;

+

+import java.text.DateFormat;

+import java.util.Calendar;

+import java.util.Date;

+import java.util.GregorianCalendar;

+import java.util.List;

+

+import org.junit.Test;

+import org.junit.runner.RunWith;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.test.annotation.Rollback;

+import org.springframework.test.context.ContextConfiguration;

+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

+import org.springframework.transaction.annotation.Transactional;

+

+import com.ellisdon.portal.mv.dao.VacationHistoryDAO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is the JUnit test class for VacationHistoryDAO

+ *

+ * @author ahmedb

+ * @version 1.0, Nov 29, 2010

+ * @since JDK1.6

+ */

+@RunWith(SpringJUnit4ClassRunner.class)

+@ContextConfiguration(locations={"classpath:/applicationContext.xml"})

+@Transactional

+public class TestVacationHistoryDAO {

+

+	@Autowired

+    private VacationHistoryDAO vacHistDAO;

+	

+	@Test

+	public void testGetUserVacationHistory(){

+		 try {

+				Integer userid = new Integer(11201);

+				List<VacationHistoryDTO> vacHistDTOList = vacHistDAO.getUserVacationHistory(userid);

+	            if (vacHistDTOList != null){

+	            	if (vacHistDTOList.size() > 0 ) {

+	            		System.out.println(" ********* Vacation History For User ID : " + userid + "********");

+	            		  for (int i=0; i< vacHistDTOList.size(); i++)

+	            		  {

+	            			  VacationHistoryDTO vacHistDto = (VacationHistoryDTO) vacHistDTOList.get(i);	            			  

+	            			  System.out.println("Vacation ID : " + vacHistDto.getUservacationid());

+	            			  String formattedFromDate = Utility.convertDate2String(vacHistDto.getFromdate(), DateFormat.MEDIUM);

+	            			  System.out.println("From : " + formattedFromDate);

+	            			  String formattedToDate = Utility.convertDate2String(vacHistDto.getTodate(), DateFormat.MEDIUM);

+	            			  System.out.println("To : " + formattedToDate);

+	            			  System.out.println("Days taken : " + vacHistDto.getDaysnottaken());

+	            			  System.out.println("Days not taken : " + vacHistDto.getDaysnottaken());

+	            			  System.out.println("Comments : " + vacHistDto.getComments());

+	            			  System.out.println("");

+	            		  }

+	            	}else{

+	            		System.out.println("Vacation History not found for userid : " + userid.toString());	

+	            	}

+	            	assertTrue(true);

+	            }

+	            else{

+	            	assertTrue(false);

+	            }

+			  }catch(Exception ex){

+				   ex.printStackTrace();	

+	 			   assertTrue(false);

+				}	

+	}

+

+	@Test

+	@Rollback(false)

+	public void testUpdateUserVacationHistory(){

+		 //try {

+			 

+			 assertTrue(true);

+

+			 /*

+				Integer vacHistId = new Integer(49);

+				 VacationHistoryDTO vacHistDto = vacHistDAO.getVacationHistory(vacHistId);

+	            if (vacHistDto != null){

+	            	vacHistDto.setDaysnottaken(4);

+	            	vacHistDAO.updateUserVacationHistory(vacHistDto);

+	            	System.out.println("--------- testUpdateUserEntitlement() ---------");

+	            	System.out.println("Updated Not Taken Days for vacation history : " + vacHistDto.getUservacationid());

+	            	assertTrue(true);

+	            }

+	            else{

+	            	assertTrue(false);

+	            }

+			  }catch(Exception ex){

+				   ex.printStackTrace();	

+	 			   assertTrue(false);

+				}

+				*/			

+	}

+	

+	@Test

+	@Rollback(true)

+	public void testInsertVacationHistory(){

+	

+	  try {	

+		VacationHistoryDTO vacHistDto = new VacationHistoryDTO();

+		vacHistDto.setUserid(new Integer(11252));

+		//From Date

+		Date fromDate = Calendar.getInstance().getTime();

+		vacHistDto.setFromdate(fromDate);

+		//To Date

+		Calendar c = Calendar.getInstance();

+		c.add(Calendar.DAY_OF_WEEK, 3);

+		Date toDate = c.getTime();

+		vacHistDto.setTodate(toDate);

+		vacHistDto.setDaystaken(4);

+		vacHistDto.setDaysnottaken(0);

+		vacHistDto.setComments("Junit Test");

+		vacHistDAO.insertVacationHistory(vacHistDto);

+		assertTrue(true);

+	  }catch(Exception ex){

+		   ex.printStackTrace();	

+		   assertTrue(false);

+  	  }			

+	}

+	

+}

diff --git a/src/test/java/com/ellisdon/portal/mv/test/service/TestVacationService.java b/src/test/java/com/ellisdon/portal/mv/test/service/TestVacationService.java
new file mode 100644
index 0000000..5fa7aa5
--- /dev/null
+++ b/src/test/java/com/ellisdon/portal/mv/test/service/TestVacationService.java
@@ -0,0 +1,100 @@
+/**

+ * EllisDon,

+ * Copyright 2010-2012, EllisDon., and individual contributors as indicated

+ * by the @authors tag.

+ *

+ * This program is copyright protected and belongs to EllisDon. All rights are

+ * reserved.

+ *

+ * This software is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

+ */

+

+package com.ellisdon.portal.mv.test.service;

+

+import static org.junit.Assert.assertTrue;

+

+import java.text.DateFormat;

+import java.util.List;

+

+import org.junit.Test;

+import org.junit.runner.RunWith;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.test.context.ContextConfiguration;

+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

+import org.springframework.transaction.annotation.Transactional;

+

+import com.ellisdon.portal.mv.dto.VacationEntitlementDTO;

+import com.ellisdon.portal.mv.dto.VacationHistoryDTO;

+import com.ellisdon.portal.mv.service.VacationService;

+import com.ellisdon.portal.mv.util.Utility;

+

+/**

+ * This is JUnit test class for the VacationService class

+ *

+ * @author ahmedb

+ * @version 1.0, Dec 2, 2010

+ * @since JDK1.6

+ */

+@RunWith(SpringJUnit4ClassRunner.class)

+@ContextConfiguration(locations={"classpath:/applicationContext.xml"})

+@Transactional

+public class TestVacationService {

+	

+	@Autowired

+    private VacationService vacService;

+	

+	@Test

+	public void testGetUserVacationHistory(){

+		 try {

+				Integer userid = new Integer(11201);

+				List<VacationHistoryDTO> vacHistDTOList = vacService.getUserVacationHistory(userid);

+	            if (vacHistDTOList != null){

+	            	if (vacHistDTOList.size() > 0 ) {

+	            		System.out.println(" ********* Vacation History For User ID : " + userid + "********");

+	            		  for (int i=0; i< vacHistDTOList.size(); i++)

+	            		  {

+	            			  VacationHistoryDTO vacHistDto = (VacationHistoryDTO) vacHistDTOList.get(i);	            			  

+	            			  System.out.println("Vacation ID : " + vacHistDto.getUservacationid());

+	            			  String formattedFromDate = Utility.convertDate2String(vacHistDto.getFromdate(), "yyyy-MM-dd");

+	            			  System.out.println("From : " + formattedFromDate);

+	            			  String formattedToDate = Utility.convertDate2String(vacHistDto.getTodate(), "yyyy-MM-dd");

+	            			  System.out.println("To : " + formattedToDate);

+	            			  System.out.println("Days taken : " + vacHistDto.getDaysnottaken());

+	            			  System.out.println("Days not taken : " + vacHistDto.getDaysnottaken());

+	            			  System.out.println("Comments : " + vacHistDto.getComments());

+	            			  System.out.println("");

+	            		  }

+	            	}else{

+	            		System.out.println("Vacation History not found for userid : " + userid.toString());	

+	            	}

+	            	assertTrue(true);

+	            }

+	            else{

+	            	assertTrue(false);

+	            }

+			  }catch(Exception ex){

+				   ex.printStackTrace();	

+	 			   assertTrue(false);

+				}	

+	}	

+

+	@Test

+	public void testGetUserEntitlement() throws Exception{

+		Integer userid = new Integer(11201);

+		VacationEntitlementDTO  vacentdto = vacService.getUserEntitlement(userid);

+        if (vacentdto != null){

+        	System.out.println("Entitlement Days : " + vacentdto.getEntitledays());

+        	System.out.println("Carry over Days : " + vacentdto.getCarryoverdays());

+        	String formattedDate = Utility.convertDate2String(vacentdto.getLastupdated(), "yyyy-MM-dd");

+        	System.out.println("Last updated : " + formattedDate);

+        	assertTrue(true);

+        }else{

+        	assertTrue(false);

+        }

+    }

+	

+	

+	

+}

diff --git a/src/test/resources/applicationContext.xml b/src/test/resources/applicationContext.xml
new file mode 100644
index 0000000..169c630
--- /dev/null
+++ b/src/test/resources/applicationContext.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xmlns:aop="http://www.springframework.org/schema/aop"

+	xmlns:context="http://www.springframework.org/schema/context"

+	xsi:schemaLocation=

+	"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd

+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

+		

+

+        <context:annotation-config />

+         

+  	    <import resource="bean-dao.xml" />	

+  	    <!-- 

+  	    <import resource="bean-mv.xml" />

+  	     -->

+  	      

+        <context:component-scan base-package="com.ellisdon.portal.mv.dao.impl" />

+        <context:component-scan base-package="com.ellisdon.portal.mv.service.impl" />

+  	    				

+</beans>
\ No newline at end of file
diff --git a/src/test/resources/bean-dao.xml b/src/test/resources/bean-dao.xml
new file mode 100644
index 0000000..6ef20f1
--- /dev/null
+++ b/src/test/resources/bean-dao.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xmlns:tx="http://www.springframework.org/schema/tx"

+		xsi:schemaLocation="http://www.springframework.org/schema/beans

+							http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+							http://www.springframework.org/schema/tx

+							http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

+

+	<!--

+		JNDI connection to datasource - Comment this out when ready to deploy

+		on server <jee:jndi-lookup id="dataSource"

+		jndi-name="java:/g3customerDS"/>

+	-->

+

+     <!--  Enable the configuration of transactional behavior of application Service beans

+           annotated with @Transactional -->

+     <tx:annotation-driven transaction-manager="transactionManager"/>

+		

+	<!-- Hibernate transaction manager bean -->	

+	<bean id="transactionManager"

+		class="org.springframework.orm.hibernate3.HibernateTransactionManager">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+

+	<!-- Data source definition for MySQL Driver -->

+	<bean id="dataSource"

+		class="org.springframework.jdbc.datasource.DriverManagerDataSource">

+		<property name="driverClassName" value="com.mysql.jdbc.Driver" />

+		<property name="url" value="jdbc:mysql://localhost:3306/lportal" />

+		<property name="username" value="root" />

+		<property name="password" value="bahmed" />

+	</bean>

+

+	<!-- Hibernate SessionFactory Bean Definition -->

+	<bean id="sessionFactory"

+		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

+		

+		<property name="dataSource">

+			<ref local="dataSource" />

+		</property>

+

+		<property name="configLocation" value="classpath:hibernate.cfg.xml" />

+

+		<property name="hibernateProperties">

+			<props>

+				<!--

+					The classname of a Hibernate org.hibernate.dialect.Dialect which

+					allows Hibernate to generate SQL optimized for a particular

+					relational database.

+				-->

+				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>

+

+				<!--

+					Write all SQL statements to console. This is an alternative to

+					setting the log category org.hibernate.SQL to debug.

+				-->

+				<prop key="hibernate.show_sql">true</prop>

+

+				<!-- Pretty print the SQL in the log and console. -->

+				<prop key="hibernate.format_sql">true</prop>

+

+				<!--

+					Sets a maximum "depth" for the outer join fetch tree for

+					single-ended associations (one-to-one, many-to-one). A 0 disables

+					default outer join fetching. recommended values between 0 and 3

+				-->

+				<prop key="hibernate.max_fetch_depth">2</prop>

+

+				<!--

+					Sets a default size for Hibernate batch fetching of

+					associations.recommended values 4, 8, 16

+				-->

+				<prop key="hibernate.jdbc.batch_size">16</prop>

+

+				<!--

+					If enabled, Hibernate will collect statistics useful for

+					performance tuning. true | false

+				-->

+				<prop key="hibernate.generate_statistics">true</prop>

+

+				<!--

+					If turned on, Hibernate will generate comments inside the SQL, for

+					easier debugging, defaults to false.

+				-->

+				<prop key="hibernate.use_sql_comments">true</prop>

+

+				<!--

+					If enabled, generated identifier properties will be reset to

+					default values when objects are deleted. true | false

+				-->

+				<prop key="hibernate.use_identifier_rollback">true</prop>

+

+				<!--

+					A non-zero value determines the JDBC fetch size (calls

+					Statement.setFetchSize()).

+				-->

+				<prop key="hibernate.jdbc.fetch_size">20</prop>

+

+				<!--

+					A non-zero value enables use of JDBC2 batch updates by Hibernate.

+					recommended values between 5 and 30

+				-->

+				<prop key="hibernate.default_batch_fetch_size">30</prop>

+

+				<!--

+					Set this property to true if your JDBC driver returns correct row

+					counts from executeBatch(). It is usually safe to turn this option

+					on. Hibernate will then use batched DML for automatically versioned

+					data. Defaults to false.

+				-->

+				<prop key="hibernate.jdbc.batch_versioned_data">true</prop>

+

+				<!--

+					Optimizes second-level cache operation to minimize writes, at the

+					cost of more frequent reads. This setting is most useful for

+					clustered caches and, in Hibernate3, is enabled by default for

+					clustered cache implementations. true|false

+				-->

+				<prop key="hibernate.cache.use_minimal_puts">false</prop>

+

+				<!--

+					Enables the query cache. Individual queries still have to be set

+					cachable. true|false

+				-->

+				<prop key="hibernate.cache.use_query_cache">false</prop>

+

+				<!--

+					Can be used to completely disable the second level cache, which is

+					enabled by default for classes which specify a <cache> mapping.

+					true|false

+				-->

+				<prop key="hibernate.cache.use_second_level_cache">false</prop>

+

+				<!-- Log all SQL DML statements as they are executed -->

+				<prop key="org.hibernate.SQL">debug</prop>

+

+				<!-- Log all JDBC parameters -->

+				<prop key="org.hibernate.type">debug</prop>

+

+				<!-- Log all SQL DDL statements as they are executed -->

+				<prop key="org.hibernate.tool.hbm2ddl">debug</prop>

+

+				<!--

+					Log the state of all entities (max 20 entities) associated with the

+					session at flush time

+				-->

+				<prop key="org.hibernate.pretty">debug</prop>

+

+				<!-- Log all second-level cache activity -->

+				<prop key="org.hibernate.cache">debug</prop>

+

+				<!-- Log transaction related activity -->

+				<prop key="org.hibernate.transaction">debug</prop>

+

+				<!-- Log all JDBC resource acquisition -->

+				<prop key="org.hibernate.jdbc">debug</prop>

+

+				<!-- Log HQL and SQL ASTs during query parsing -->

+				<prop key="org.hibernate.hql.ast.AST">debug</prop>

+

+				<prop key="hbm2ddl.auto">none</prop>

+

+			</props>

+		</property>

+	</bean>

+

+    <!-- Applies persistence exception translation to DAO's annotated with @Repository using AOP -->       

+    <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

+

+      

+	<!-- DAOs defination for MyVacation application -->

+	<!-- 

+	Note : 

+	The below application related DAO beans declarations can be removed safely this configuration

+	file. All the DAO in the application have been marked as @Repository annotation.

+	

+	<bean id="vacHistoryDAOBean" class="com.ellisdon.portal.mv.dao.impl.VacationHistoryDAOImpl">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+    

+	<bean id="vacEntitlementDAOBean" class="com.ellisdon.portal.mv.dao.impl.VacationEntitlementDAOImpl">

+		<property name="sessionFactory" ref="sessionFactory" />

+	</bean>

+	 -->

+ 

+   

+</beans> 

diff --git a/src/test/resources/bean-mv.xml b/src/test/resources/bean-mv.xml
new file mode 100644
index 0000000..acce5e4
--- /dev/null
+++ b/src/test/resources/bean-mv.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<beans xmlns="http://www.springframework.org/schema/beans"

+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+		xmlns:tx="http://www.springframework.org/schema/tx"

+		xsi:schemaLocation="http://www.springframework.org/schema/beans

+							http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

+							http://www.springframework.org/schema/tx

+							http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

+							

+    <!-- Declaration of Controllers and Services Beans -->

+     

+    <!--      

+    Note : 

+	The below application related Service bean declarations can be removed safely from this configuration

+	file. All the Service beans in the application have been marked as @Service annotation.    

+    

+ 	<bean id="vacServiceBean"

+		class="com.ellisdon.portal.mv.service.impl.VacationServiceImpl">

+		<property name="vacHistDAO" ref="vacHistoryDAOBean" /> 

+	</bean>

+   	 -->   	 

+   	 

+</beans>