Skip to content

Instantly share code, notes, and snippets.

View arthurportas's full-sized avatar

Arthur Portas arthurportas

  • Jumia
  • Porto-Portugal
View GitHub Profile
@arthurportas
arthurportas / new-employee.ftl
Created May 27, 2017 16:18
new-employee.ftl
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New Employee</title>
</head>
<body>
Employee created with success!
${emp}
</body>
@arthurportas
arthurportas / search-employee.html
Created May 27, 2017 16:17
search-employee.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>::StaffGest:: - search-employee</title>
<meta name="description" content="StaffGest:: - search-employee">
<meta name="author" content="Arthur Portas">
</head>
<body>
@arthurportas
arthurportas / search-employee.ftl
Created May 27, 2017 16:17
search-employee.ftl
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Search Employee</title>
</head>
<body>
Search results: ${emp}
</body>
</html>
@arthurportas
arthurportas / EmployeeDaoUT.java
Created May 14, 2017 20:46
EmployeeDaoUT.java
package unittests;
import com.arthurportas.persistence.daos.EmployeeDaoImpl;
import com.arthurportas.persistence.entities.Employee;
import com.github.javafaker.Faker;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@arthurportas
arthurportas / EmployeeDaoImpl.java
Created May 14, 2017 20:45
EmployeeDaoImpl.java
package com.arthurportas.persistence.daos;
import com.arthurportas.persistence.entities.Employee;
import java.util.List;
/**
* Created by arthurportas on 10/05/2017.
*/
public class EmployeeDaoImpl extends GenericDaoImpl<Employee> implements EmployeeDaoCustom<Employee> {
@arthurportas
arthurportas / EmployeeDaoCustom.java
Created May 14, 2017 20:44
EmployeeDaoCustom.java
package com.arthurportas.persistence.daos;
import java.util.List;
/**
* Created by arthurportas on 10/05/2017.
*/
public interface EmployeeDaoCustom<Employee> {
List<Employee> findByName(String pattern);
@arthurportas
arthurportas / GenericDaoImpl.java
Created May 14, 2017 20:43
GenericDaoImpl.java
package com.arthurportas.persistence.daos;
import com.arthurportas.persistence.PersistenceEnum;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
/**
* Created by arthurportas on 14/05/2017.
*/
@arthurportas
arthurportas / GenericDao.java
Created May 14, 2017 20:26
GenericDao.java Interface
package com.arthurportas.persistence.daos;
/**
* Created by arthurportas on 10/05/2017.
*/
public interface GenericDao<T> {
T save(T entity);
void delete(T entity);
@arthurportas
arthurportas / persistence.xml
Created May 14, 2017 20:25
persistence.xml RESOURCE_LOCAL H2 HIBERNATE
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="jpa-example" transaction-type="RESOURCE_LOCAL">
<!-- Persistence provider -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!-- Entity classes -->
<class>com.arthurportas.persistence.entities.Employee</class>
<properties>
@arthurportas
arthurportas / search-employee-result.xhtml
Created May 8, 2017 21:52
search-employee-result.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<head>
<title>::StaffGest:: - search-employee</title>
</head>