This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.brascov.querocomprar.model.dao; | |
import java.io.Serializable; | |
import javax.persistence.EntityManager; | |
/** | |
* @author Anderson | |
* | |
* classe base que possui os métodos comuns para todas as Daos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NamedQueries({ | |
@NamedQuery(name = "Lojista.listarTodos", query = "" + "SELECT DISTINCT l FROM Lojista l " | |
+ "LEFT JOIN FETCH l.endereco " + "LEFT JOIN FETCH l.loja " + "WHERE l.status = :pStatus"), | |
@NamedQuery(name = "Lojista.find", query = "" + "SELECT DISTINCT l FROM Lojista l " | |
+ "LEFT JOIN FETCH l.endereco " + "LEFT JOIN FETCH l.loja " + "WHERE l.id = :pId") }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "evento") | |
public class Evento { | |
// ... Outros campos ... | |
@ManyToOne | |
@JoinColumn(name = "categoria_id") | |
private Categoria categoria; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum StatusBinarioEnum { | |
ATIVO,INATIVO; | |
} | |
@Enumerated(EnumType.STRING) | |
@Column(nullable = false, name = "status") | |
private StatusBinarioEnum status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @author anderson | |
* Enum feito para os estados do Brasil, podendo mudar ou até adicionar indices | |
*/ | |
public enum EstadosBrasilEnum { | |
AC,AL,AP,AM,BA,CE,DF,ES,GO,MA,MT,MS,MG,PA,PB,PR,PE,PI,RJ,RN,RS,RO,RR,SC,SP,SE,TO; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p:outputLabel value="Email:" for="email" /> | |
<p:inputText id="email" value="#{seuBeanAqui}" | |
required="true" validatorMessage="Email inválido"> | |
<f:attribute name="type" value="email" /> | |
<f:passThroughAttribute name="placeholder" value="E-mail" /> | |
<f:validateRegex | |
pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" /> | |
<f:ajax event="blur" render="messageEmail" /> | |
</p:inputText> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h:head> | |
<h:outputScript library="js" name="locale-primefaces.js"/> | |
</h:head> | |
<p:outputLabel value="Data Nascimento" for="dataNacimento" /> | |
<p:calendar id="dataNacimento" | |
value="#{seuBean.entidade.dataNascimento}" | |
showOn="button" | |
pattern="dd-MM-yyyy" | |
navigator="true" | |
locale="pt_BR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p:outputLabel value="Senha" for="senha" /> | |
<p:password id="senha" value="#{seuBean.entidade.senha}" | |
feedback="true" | |
required="true" | |
requiredMessage="Campo senha não pode estar em branco" | |
validatorMessage="Senha inválida" | |
> | |
<f:attribute name="type" value="password" /> | |
<f:passThroughAttribute name="placeholder" value="No mímino 6 e no máximo 20 caracteres" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p:outputLabel value="Cpf/CNPJ " for="cpf" /> | |
<p:inputText id="cpf" value="#{seuBean.entitade.cpfCnpj}" | |
maxlength="20" required="true" | |
requiredMessage="Campo cpf não pode estar em branco" | |
validatorMessage="CPF inválido"> | |
<f:passThroughAttribute name="placeholder" value="Informe o seu CPF ou CNPJ" /> | |
<f:validateRegex | |
pattern="([0-9]{2}[\.]?[0-9]{3}[\.]?[0-9]{3}[\/]?[0-9]{4}[-]?[0-9]{2})|([0-9]{3}[\.]?[0-9]{3}[\.]?[0-9]{3}[-]?[0-9]{2})" /> | |
<f:ajax event="blur" render="messageCpf" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseBean implements Serializable { | |
/** | |
* | |
*/ | |
private static final long serialVersionUID = 1L; | |
public Date getMinAge() { | |
Calendar currentDate = Calendar.getInstance(); | |
currentDate.add(Calendar.YEAR, - DatasLimiteEnum.IdadeMinima.getIdadeNumeral()); | |
logger.info("Min Age: " + currentDate.get(Calendar.MONTH) + "/" + currentDate.get(Calendar.DATE) + "/" |
OlderNewer