Skip to content

Instantly share code, notes, and snippets.

@sednem
sednem / ISBN.java
Created October 25, 2012 16:10
Annotation ISBN
package br.ufpe.nti.entity.beanValidation;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@sednem
sednem / ValidaISBN.java
Created October 25, 2012 16:11
Implementa a validação do annotation ISBN
package br.ufpe.nti.entity.beanValidation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class ValidaISBN implements ConstraintValidator<ISBN, String>{
public void initialize(ISBN constraintAnnotation) {
}
@sednem
sednem / properies_fr.properties
Created October 28, 2012 17:11
Properties fr
#mensagens_fr.properties
nome=Nom
senha=Mot de passe
conf.senha=Password Check
data.nascimento=Date de naissance
email=E-mail
sexo=Sex
sexo.masculino=Homme
sexo.feminino=Femme
usuario=Utilisateur
@sednem
sednem / properies_en.properties
Created October 28, 2012 17:34
Properties en
#mensagens_en.properties
nome=Name
senha=Password
conf.senha=Check Password
data.nascimento=Date of Birth
email=E-mail
sexo=Sex
sexo.masculino=Male
sexo.feminino=Female
usuario=User
@sednem
sednem / Autor.java
Created December 6, 2012 17:09
Classes mapeada com JPA
package br.ufpe.nti.entity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
@sednem
sednem / GenericDAO.java
Created December 6, 2012 17:10
DAO Genérico
package br.ufpe.nti.dao;
import java.io.Serializable;
import java.util.List;
public interface GenericDAO<T, I extends Serializable>{
/**
* Persiste um objeto
* @param object
@sednem
sednem / TesteJPA.java
Created December 6, 2012 18:01
Classe de Teste JPA
package br.ufpe.nti.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
@sednem
sednem / context.xml
Created December 6, 2012 19:07
Configuração Tomcat para Spring
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@sednem
sednem / faces-config.xml
Created October 17, 2013 17:00
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
</faces-config>
@sednem
sednem / index.xhtml
Created October 17, 2013 18:01
index.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF 2.2</title>
</h:head>
<h:body>
<h:outputText value="#{meuBean.texto}"/>
<h:commandButton value="Blah!" />