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 / five-users.json
Created January 28, 2017 19:43
five-users.json
{
"user": {
"data": [
{
"id": "119bbacd-9c03-4044-867f-4c26e8f715f6",
"firstName": "Arthur",
"lastName": "Portas",
"email": "arthurportas[AT]gmail.com",
"lastUpdated": {
"$date": "2017-01-24T10:09:15.210Z"
@arthurportas
arthurportas / FongoConfiguration.java
Created January 28, 2017 19:49
FongoConfiguration.java
package com.arthurportas.mongodb.example.config;
import com.github.fakemongo.Fongo;
import com.mongodb.Mongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
@arthurportas
arthurportas / UserRepositoryTest.java
Created January 28, 2017 20:08
UserRepositoryTest.java
package com.arthurportas.repository;
import com.arthurportas.mongodb.example.repository.UserRepository;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.lordofthejars.nosqlunit.annotation.UsingDataSet;
import com.lordofthejars.nosqlunit.core.LoadStrategyEnum;
import com.lordofthejars.nosqlunit.mongodb.InMemoryMongoDb;
import com.lordofthejars.nosqlunit.mongodb.MongoDbRule;
import org.junit.Before;
import org.junit.ClassRule;
@arthurportas
arthurportas / EmployeeController.java
Created April 23, 2017 11:13
Controller for employees as a simple servlet
package com.arthurportas.presentation.servlets;
import com.arthurportas.entities.Employee;
import com.arthurportas.services.EmployeeService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@arthurportas
arthurportas / new-employee.html
Created April 23, 2017 11:20
Form to create employee
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>::StaffGest:: - new-employee</title>
<meta name="description" content="StaffGest:: - search-employee">
<meta name="author" content="Arthur Portas">
</head>
<body>
@arthurportas
arthurportas / new-employee.jsp
Created April 23, 2017 11:21
View with result uppon employee creation
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<!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!
@arthurportas
arthurportas / search-employee.html
Created April 23, 2017 11:23
Form to search for an employee
<!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.jsp
Created April 23, 2017 11:23
View with result uppon employee search
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Search Employee</title>
</head>
<body>
Search results: ${emp}
@arthurportas
arthurportas / web.xml
Created May 8, 2017 21:46
Sample JSF configuration
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>new-employee.xhtml</welcome-file>
</welcome-file-list>
@arthurportas
arthurportas / EmployeeBean.java
Created May 8, 2017 21:48
Backing Bean for Employee
package com.arthurportas.presentation.backingbeans;
import com.arthurportas.entities.Employee;
import com.arthurportas.services.EmployeeService;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;
import java.io.Serializable;