Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Projetos de teste do componente demoiselle-authorization.

  • Loading branch information...
commit f662950e4a6b47f6d538352bcffe1b25d83a2763 1 parent dcd02f9
Wilson Guimarães authored
Showing with 1,091 additions and 0 deletions.
  1. +3 −0  favorito-security/.gitignore
  2. +36 −0 favorito-security/pom.xml
  3. +52 −0 favorito-security/src/main/java/br/gov/serpro/favorito/security/FavoritoAuthenticationProvider.java
  4. 0  favorito-security/src/main/resources/demoiselle.properties
  5. +3 −0  favoritos/.gitignore
  6. +74 −0 favoritos/pom.xml
  7. +83 −0 favoritos/src/main/java/br/gov/serpro/favoritos/business/FavoritoBC.java
  8. +29 −0 favoritos/src/main/java/br/gov/serpro/favoritos/config/FavoritoConfig.java
  9. +61 −0 favoritos/src/main/java/br/gov/serpro/favoritos/entity/Favorito.java
  10. +13 −0 favoritos/src/main/java/br/gov/serpro/favoritos/message/ErrorMessages.java
  11. +13 −0 favoritos/src/main/java/br/gov/serpro/favoritos/message/InfoMessages.java
  12. +20 −0 favoritos/src/main/java/br/gov/serpro/favoritos/persistence/FavoritoDAO.java
  13. +24 −0 favoritos/src/main/java/br/gov/serpro/favoritos/validator/Url.java
  14. +28 −0 favoritos/src/main/java/br/gov/serpro/favoritos/validator/UrlValidator.java
  15. +47 −0 favoritos/src/main/java/br/gov/serpro/favoritos/view/managedbean/FavoritoEditMB.java
  16. +71 −0 favoritos/src/main/java/br/gov/serpro/favoritos/view/managedbean/FavoritoListMB.java
  17. +11 −0 favoritos/src/main/resources/META-INF/beans.xml
  18. +53 −0 favoritos/src/main/resources/META-INF/persistence.xml
  19. +30 −0 favoritos/src/main/resources/ValidationMessages.properties
  20. +36 −0 favoritos/src/main/resources/demoiselle.properties
  21. +2 −0  favoritos/src/main/resources/favoritos.properties
  22. +10 −0 favoritos/src/main/resources/log4j.properties
  23. +49 −0 favoritos/src/main/resources/messages.properties
  24. +67 −0 favoritos/src/main/resources/reports/Favoritos.jrxml
  25. +3 −0  favoritos/src/main/webapp/META-INF/MANIFEST.MF
  26. +6 −0 favoritos/src/main/webapp/WEB-INF/faces-config.xml
  27. +39 −0 favoritos/src/main/webapp/WEB-INF/web.xml
  28. +30 −0 favoritos/src/main/webapp/access.xhtml
  29. +44 −0 favoritos/src/main/webapp/favorito_edit.xhtml
  30. +54 −0 favoritos/src/main/webapp/favorito_list.xhtml
  31. BIN  favoritos/src/main/webapp/images/logo.png
  32. +5 −0 favoritos/src/main/webapp/index.html
  33. +11 −0 favoritos/src/main/webapp/index.xhtml
  34. +28 −0 favoritos/src/main/webapp/login.xhtml
  35. +16 −0 favoritos/src/main/webapp/menu.xhtml
  36. +40 −0 favoritos/src/main/webapp/template/main.xhtml
  37. 0  favoritos/src/test/java/br/gov/serpro/favoritos/readme.txt
  38. 0  favoritos/src/test/resources/readme.txt
3  favorito-security/.gitignore
View
@@ -0,0 +1,3 @@
+/.project
+/.classpath
+/.settings
36 favorito-security/pom.xml
View
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
+ 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>br.gov.serpro</groupId>
+ <artifactId>favorito-security</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name></name>
+ <description></description>
+ <url></url>
+
+ <parent>
+ <groupId>br.gov.frameworkdemoiselle</groupId>
+ <artifactId>demoiselle-minimal-parent</artifactId>
+ <version>2.2.0-RC1</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <artifactId>demoiselle-security</artifactId>
+ <groupId>br.gov.component.demoiselle</groupId>
+ <version>1.2.1</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>demoiselle.sourceforge.net-release</id>
+ <url>http://demoiselle.sourceforge.net/repository/release</url>
+ </repository>
+ </repositories>
+</project>
52 favorito-security/src/main/java/br/gov/serpro/favorito/security/FavoritoAuthenticationProvider.java
View
@@ -0,0 +1,52 @@
+package br.gov.serpro.favorito.security;
+
+import java.security.Principal;
+import java.security.cert.X509Certificate;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import br.gov.component.demoiselle.security.auth.AuthException;
+import br.gov.component.demoiselle.security.auth.Certificate;
+import br.gov.component.demoiselle.security.auth.User;
+import br.gov.component.demoiselle.security.auth.provider.IAuthenticationProvider;
+import br.gov.component.demoiselle.security.auth.provider.implementation.SampleAuthenticationProvider;
+import br.gov.component.demoiselle.security.message.ProviderMessageContext;
+
+public class FavoritoAuthenticationProvider implements IAuthenticationProvider {
+
+ private static Logger log = Logger.getLogger(SampleAuthenticationProvider.class.getName());
+
+ public Principal authenticate(String user, String password) {
+ if ("mensagem".equalsIgnoreCase(user)) {
+ log.info("authenticate");
+ ProviderMessageContext messageContext = ProviderMessageContext.getInstance();
+ messageContext.addMessage("Sample authenticate Message");
+ return new User(user);
+ } else if ("demoiselle".equalsIgnoreCase(user)) {
+ log.info("authenticate");
+ log.info("user [" + user + "] password [" + password + "]");
+ return new User(user);
+ } else {
+ log.info("dont authenticate");
+ throw new AuthException("User fail");
+ }
+ }
+
+ public Principal authenticate(String user, String password, String newPassword) {
+ log.info("authenticate");
+ log.info("user [" + user + "] password [" + password + "] new password [" + newPassword + "]");
+ return new User(user);
+ }
+
+ public Principal authenticate(X509Certificate x509) {
+ log.info("authenticate");
+ log.info("certificate " + x509.getSubjectDN().getName());
+ return new Certificate(x509);
+ }
+
+ public void initialize(Properties props) {
+ log.info("initialize");
+ log.info("properties " + props);
+ }
+
+}
0  favorito-security/src/main/resources/demoiselle.properties
View
No changes.
3  favoritos/.gitignore
View
@@ -0,0 +1,3 @@
+/.project
+/.classpath
+/.settings
74 favoritos/pom.xml
View
@@ -0,0 +1,74 @@
+<?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>br.gov.serpro</groupId>
+ <artifactId>favoritos</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>br.gov.serpro.parent</groupId>
+ <artifactId>serpro-demoiselle-parent-webapp</artifactId>
+ <version>2.0.0-BETA3</version>
+ </parent>
+
+ <dependencies>
+ <!-- Demoiselle Extensions -->
+ <dependency>
+ <groupId>br.gov.frameworkdemoiselle</groupId>
+ <artifactId>demoiselle-jpa</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>br.gov.frameworkdemoiselle</groupId>
+ <artifactId>demoiselle-jta</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- Demoiselle Components -->
+ <dependency>
+ <groupId>br.gov.frameworkdemoiselle.component</groupId>
+ <artifactId>demoiselle-report</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>br.gov.frameworkdemoiselle.component</groupId>
+ <artifactId>demoiselle-authorization</artifactId>
+ <scope>compile</scope>
+ <version>2.0.1-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Bibliotecas específicas da aplicação -->
+ <dependency>
+ <groupId>org.primefaces</groupId>
+ <artifactId>primefaces</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>component.internal</id>
+ <name>SERPRO Component Maven Repository</name>
+ <url>http://archiva.desenv.serpro/repository/component-internal</url>
+ </repository>
+
+ <!-- Repositório temporário da versão BETA -->
+<!-- <repository> -->
+<!-- <id>demoiselle-serpro-temp.sourceforge.net</id> -->
+<!-- <name>Demoiselle Temporary Serpro Maven Repository</name> -->
+<!-- <url>http://demoiselle.sourceforge.net/repository-serpro</url> -->
+<!-- <snapshots> -->
+<!-- <enabled>true</enabled> -->
+<!-- </snapshots> -->
+<!-- </repository> -->
+ </repositories>
+
+ <properties>
+ <demoiselle.version>2.2.0-RC1</demoiselle.version>
+ </properties>
+</project>
83 favoritos/src/main/java/br/gov/serpro/favoritos/business/FavoritoBC.java
View
@@ -0,0 +1,83 @@
+package br.gov.serpro.favoritos.business;
+
+import javax.inject.Inject;
+
+import br.gov.frameworkdemoiselle.annotation.Startup;
+import br.gov.frameworkdemoiselle.message.MessageContext;
+import br.gov.frameworkdemoiselle.message.SeverityType;
+import br.gov.frameworkdemoiselle.stereotype.BusinessController;
+import br.gov.frameworkdemoiselle.template.DelegateCrud;
+import br.gov.frameworkdemoiselle.transaction.TransactionException;
+import br.gov.frameworkdemoiselle.transaction.Transactional;
+import br.gov.serpro.favoritos.config.FavoritoConfig;
+import br.gov.serpro.favoritos.entity.Favorito;
+import br.gov.serpro.favoritos.message.ErrorMessages;
+import br.gov.serpro.favoritos.message.InfoMessages;
+import br.gov.serpro.favoritos.persistence.FavoritoDAO;
+
+@BusinessController
+public class FavoritoBC extends DelegateCrud<Favorito, Long, FavoritoDAO> {
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ private FavoritoConfig config;
+
+ @Inject
+ private MessageContext messageContext;
+
+ @Override
+ @Transactional
+ public void insert(Favorito favorito) {
+ try {
+ super.insert(favorito);
+ messageContext.add(InfoMessages.FAVORITO_INSERT_OK, favorito.getDescricao());
+ } catch (TransactionException te) {
+ messageContext.add(ErrorMessages.FAVORITO_INSERT_NOK, te.getMessage(), SeverityType.ERROR);
+ }
+ }
+
+ @Override
+ @Transactional
+ public void update(Favorito favorito) {
+ try {
+ super.update(favorito);
+ messageContext.add(InfoMessages.FAVORITO_UPDATE_OK, favorito.getDescricao());
+ } catch (TransactionException te) {
+ messageContext.add(ErrorMessages.FAVORITO_UPDATE_NOK, te.getMessage(), SeverityType.ERROR);
+ }
+ }
+
+ @Override
+ @Transactional
+ public void delete(Long id) {
+ try {
+ super.delete(id);
+ messageContext.add(InfoMessages.FAVORITO_DELETE_OK, id);
+ } catch (TransactionException te) {
+ messageContext.add(ErrorMessages.FAVORITO_DELETE_NOK, te.getMessage(), SeverityType.ERROR);
+ }
+ }
+
+ @Startup
+ @Transactional
+ public void load() {
+ // Para ativar essa configuração modifique o valor em favoritos.config -> general.loadInitialData =
+ // true
+ if (config.isLoadInitialData()) {
+ if (findAll().isEmpty()) {
+ insert(new Favorito("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Demoiselle SourceForge", "http://sf.net/projects/demoiselle"));
+ insert(new Favorito("Twitter", "http://twitter.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Blog", "http://blog.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Wiki", "http://wiki.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Bug Tracking", "http://tracker.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Forum", "http://forum.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("SVN", "http://svn.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Maven", "http://repository.frameworkdemoiselle.gov.br"));
+ insert(new Favorito("Downloads", "http://download.frameworkdemoiselle.gov.br"));
+ }
+ }
+ }
+
+}
29 favoritos/src/main/java/br/gov/serpro/favoritos/config/FavoritoConfig.java
View
@@ -0,0 +1,29 @@
+package br.gov.serpro.favoritos.config;
+
+import java.io.Serializable;
+
+import javax.validation.constraints.NotNull;
+
+import br.gov.frameworkdemoiselle.annotation.Name;
+import br.gov.frameworkdemoiselle.configuration.Configuration;
+
+@Configuration(resource = "favoritos", prefix = "general")
+public class FavoritoConfig implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Name("app.title")
+ private String applicationTitle;
+
+ @NotNull
+ private boolean loadInitialData;
+
+ public String getApplicationTitle() {
+ return applicationTitle;
+ }
+
+ public boolean isLoadInitialData() {
+ return loadInitialData;
+ }
+
+}
61 favoritos/src/main/java/br/gov/serpro/favoritos/entity/Favorito.java
View
@@ -0,0 +1,61 @@
+package br.gov.serpro.favoritos.entity;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import br.gov.serpro.favoritos.validator.Url;
+
+@Entity
+public class Favorito implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue
+ private Long id;
+
+ @Column
+ private String descricao;
+
+ @Column
+ @Url
+ private String url;
+
+ public Favorito() {
+ super();
+ }
+
+ public Favorito(String descricao, String url) {
+ this.descricao = descricao;
+ this.url = url;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getDescricao() {
+ return descricao;
+ }
+
+ public void setDescricao(String descricao) {
+ this.descricao = descricao;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+}
13 favoritos/src/main/java/br/gov/serpro/favoritos/message/ErrorMessages.java
View
@@ -0,0 +1,13 @@
+package br.gov.serpro.favoritos.message;
+
+import br.gov.frameworkdemoiselle.message.DefaultMessage;
+import br.gov.frameworkdemoiselle.message.Message;
+
+
+public interface ErrorMessages {
+
+ final Message FAVORITO_INSERT_NOK = new DefaultMessage("{favorito-insert-nok}");
+ final Message FAVORITO_UPDATE_NOK = new DefaultMessage("{favorito-update-nok}");
+ final Message FAVORITO_DELETE_NOK = new DefaultMessage("{favorito-delete-nok}");
+
+}
13 favoritos/src/main/java/br/gov/serpro/favoritos/message/InfoMessages.java
View
@@ -0,0 +1,13 @@
+package br.gov.serpro.favoritos.message;
+
+import br.gov.frameworkdemoiselle.message.DefaultMessage;
+import br.gov.frameworkdemoiselle.message.Message;
+
+
+public interface InfoMessages {
+
+ final Message FAVORITO_INSERT_OK = new DefaultMessage("{favorito-insert-ok}");
+ final Message FAVORITO_UPDATE_OK = new DefaultMessage("{favorito-update-ok}");
+ final Message FAVORITO_DELETE_OK = new DefaultMessage("{favorito-delete-ok}");
+
+}
20 favoritos/src/main/java/br/gov/serpro/favoritos/persistence/FavoritoDAO.java
View
@@ -0,0 +1,20 @@
+package br.gov.serpro.favoritos.persistence;
+
+import javax.inject.Inject;
+
+import org.slf4j.Logger;
+
+import br.gov.frameworkdemoiselle.stereotype.PersistenceController;
+import br.gov.frameworkdemoiselle.template.JPACrud;
+import br.gov.serpro.favoritos.entity.Favorito;
+
+@PersistenceController
+public class FavoritoDAO extends JPACrud<Favorito, Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ @SuppressWarnings("unused")
+ private Logger logger;
+
+}
24 favoritos/src/main/java/br/gov/serpro/favoritos/validator/Url.java
View
@@ -0,0 +1,24 @@
+package br.gov.serpro.favoritos.validator;
+
+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.Retention;
+import java.lang.annotation.Target;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+
+@Target({ FIELD, METHOD })
+@Retention(RUNTIME)
+@Constraint(validatedBy = UrlValidator.class)
+public @interface Url {
+
+ Class<?>[] groups() default {};
+
+ String message() default "{br.gov.serpro.favoritos.url}";
+
+ Class<? extends Payload>[] payload() default {};
+
+}
28 favoritos/src/main/java/br/gov/serpro/favoritos/validator/UrlValidator.java
View
@@ -0,0 +1,28 @@
+package br.gov.serpro.favoritos.validator;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class UrlValidator implements ConstraintValidator<Url, String> {
+
+ @Override
+ public void initialize(final Url constraintAnnotation) {
+ }
+
+ @Override
+ public boolean isValid(String url, final ConstraintValidatorContext context) {
+ boolean result = false;
+ if ( url == null || "".equals(url) ) {
+ result = true;
+ } else {
+ Pattern pattern = Pattern.compile("^(http(?:s)?\\:\\/\\/[a-zA-Z0-9\\-]+(?:\\.[a-zA-Z0-9\\-]+)*\\.[a-zA-Z]{2,6}(?:\\/?|(?:\\/[\\w\\-]+)*)(?:\\/?|\\/\\w+\\.[a-zA-Z]{2,4}(?:\\?[\\w]+\\=[\\w\\-]+)?)?(?:\\&[\\w]+\\=[\\w\\-]+)*)$");
+ Matcher matcher = pattern.matcher(url);
+ result = matcher.find();
+ }
+ return result;
+ }
+
+}
47 favoritos/src/main/java/br/gov/serpro/favoritos/view/managedbean/FavoritoEditMB.java
View
@@ -0,0 +1,47 @@
+package br.gov.serpro.favoritos.view.managedbean;
+
+import javax.inject.Inject;
+
+import br.gov.frameworkdemoiselle.annotation.PreviousView;
+import br.gov.frameworkdemoiselle.stereotype.ViewController;
+import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
+import br.gov.frameworkdemoiselle.transaction.Transactional;
+import br.gov.serpro.favoritos.business.FavoritoBC;
+import br.gov.serpro.favoritos.entity.Favorito;
+
+@ViewController
+@PreviousView("/favorito_list.xhtml")
+public class FavoritoEditMB extends AbstractEditPageBean<Favorito, Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ private FavoritoBC bc;
+
+ @Override
+ @Transactional
+ public String delete() {
+ this.bc.delete(getId());
+ return getPreviousView();
+ }
+
+ @Override
+ @Transactional
+ public String insert() {
+ this.bc.insert(getBean());
+ return getPreviousView();
+ }
+
+ @Override
+ @Transactional
+ public String update() {
+ this.bc.update(getBean());
+ return getPreviousView();
+ }
+
+ @Override
+ protected void handleLoad() {
+ setBean(this.bc.load(getId()));
+ }
+
+}
71 favoritos/src/main/java/br/gov/serpro/favoritos/view/managedbean/FavoritoListMB.java
View
@@ -0,0 +1,71 @@
+package br.gov.serpro.favoritos.view.managedbean;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import br.gov.frameworkdemoiselle.annotation.NextView;
+import br.gov.frameworkdemoiselle.annotation.PreviousView;
+import br.gov.frameworkdemoiselle.report.Report;
+import br.gov.frameworkdemoiselle.report.Type;
+import br.gov.frameworkdemoiselle.report.annotation.Path;
+import br.gov.frameworkdemoiselle.stereotype.ViewController;
+import br.gov.frameworkdemoiselle.template.AbstractListPageBean;
+import br.gov.frameworkdemoiselle.transaction.Transactional;
+import br.gov.frameworkdemoiselle.util.FileRenderer;
+import br.gov.serpro.favoritos.business.FavoritoBC;
+import br.gov.serpro.favoritos.entity.Favorito;
+
+@ViewController
+@NextView("/favorito_edit.xhtml")
+@PreviousView("/favorito_list.xhtml")
+public class FavoritoListMB extends AbstractListPageBean<Favorito, Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ private FavoritoBC bc;
+
+ @Inject
+ @Path("reports/Favoritos.jrxml")
+ private Report relatorio;
+
+ @Inject
+ private FileRenderer renderer;
+
+ @Override
+ protected List<Favorito> handleResultList() {
+ return this.bc.findAll();
+ }
+
+ @Transactional
+ public String deleteSelection() {
+ boolean delete;
+ for (Iterator<Long> iter = getSelection().keySet().iterator(); iter.hasNext();) {
+ Long id = iter.next();
+ delete = getSelection().get(id);
+
+ if (delete) {
+ bc.delete(id);
+ iter.remove();
+ }
+ }
+ return getPreviousView();
+ }
+
+ public String showReport() {
+
+ Map<String, Object> param = new HashMap<String, Object>();
+
+ param.put("titulo", "Relatório de teste");
+
+ byte[] buffer = this.relatorio.export(getResultList(), param, Type.PDF);
+ this.renderer.render(buffer, FileRenderer.ContentType.PDF, "relatorio.pdf");
+
+ return getNextView();
+ }
+
+}
11 favoritos/src/main/resources/META-INF/beans.xml
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:weld="http://jboss.org/schema/weld/beans"
+ xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd
+ http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_0.xsd">
+
+ <alternatives>
+ <class>br.gov.frameworkdemoiselle.transaction.JPATransaction</class>
+<!-- <class>br.gov.frameworkdemoiselle.transaction.JTATransaction</class> -->
+ </alternatives>
+
+</beans>
53 favoritos/src/main/resources/META-INF/persistence.xml
View
@@ -0,0 +1,53 @@
+<?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="favorito-ds" transaction-type="RESOURCE_LOCAL">
+ <non-jta-data-source>java:/DefaultDS</non-jta-data-source>
+
+ <class>br.gov.serpro.favoritos.entity.Favorito</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="true" />
+ <property name="hibernate.format_sql" value="false" />
+ <property name="hibernate.hbm2ddl.auto" value="update" />
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ </properties>
+ </persistence-unit>
+
+ <!-- If you are using jboss6 with JTA transaction then use this persistence-unit -->
+
+<!-- <persistence-unit name="favorito-ds" transaction-type="JTA"> -->
+<!-- <jta-data-source>java:/DefaultDS</jta-data-source> -->
+
+<!-- <class>br.gov.serpro.favoritos.entity.Favorito</class> -->
+
+<!-- <properties> -->
+<!-- <property name="hibernate.show_sql" value="true" /> -->
+<!-- <property name="hibernate.format_sql" value="false" /> -->
+<!-- <property name="hibernate.hbm2ddl.auto" value="update" /> -->
+<!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> -->
+<!-- </properties> -->
+<!-- </persistence-unit> -->
+
+
+ <!-- If you are using tomcat6/tomcat7 then use this persistence-unit -->
+ <!--
+ <persistence-unit name="favorito-ds" transaction-type="RESOURCE_LOCAL">
+
+ <class>br.gov.serpro.favoritos.entity.Favorito</class>
+
+ <properties>
+ <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
+ <property name="javax.persistence.jdbc.user" value="sa" />
+ <property name="javax.persistence.jdbc.password" value="" />
+ <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:hsql:." />
+
+ <property name="eclipselink.logging.level" value="FINE" />
+ <property name="eclipselink.ddl-generation" value="create-tables" />
+ <property name="eclipselink.ddl-generation.output-mode" value="database" />
+ </properties>
+ </persistence-unit>
+ -->
+
+</persistence>
30 favoritos/src/main/resources/ValidationMessages.properties
View
@@ -0,0 +1,30 @@
+br.gov.frameworkdemoiselle.pispasep=Informe um PIS/PASEP v\u00E1lido.
+br.gov.frameworkdemoiselle.inscricaoestadual=Informe uma Inscri\u00E7\u00E3o Estadual v\u00E1lida.
+br.gov.frameworkdemoiselle.cpf=Informe um CPF v\u00E1lido.
+br.gov.frameworkdemoiselle.cnpj=Informe um CNPJ v\u00E1lido.
+br.gov.frameworkdemoiselle.cep=Informe um CEP v\u00E1lido.
+
+br.gov.serpro.favoritos.url=Informe uma URL v\u00E1lida.
+
+javax.validation.constraints.AssertFalse.message=Este campo deve conter o valor falso.
+javax.validation.constraints.AssertTrue.message=Este campo deve conter o valor verdadeiro.
+javax.validation.constraints.DecimalMax.message=O valor deve ser menor ou igual a {value}.
+javax.validation.constraints.DecimalMin.message=O valor deve ser maior ou igual a {value}.
+javax.validation.constraints.Digits.message=Valor num\u00E9rico incorreto. (<{integer} d\u00EDgitos>.<{fraction} d\u00EDgitos> esperado).
+javax.validation.constraints.Future.message=Deve ser uma data no futuro.
+javax.validation.constraints.Max.message=O valor deve ser menor ou igual a {value}.
+javax.validation.constraints.Min.message=O valor deve ser maior ou igual a {value}.
+javax.validation.constraints.NotNull.message=N\u00E3o pode ser nulo.
+javax.validation.constraints.Null.message=Deve ser nulo.
+javax.validation.constraints.Past.message=Deve ser uma data no passado.
+javax.validation.constraints.Pattern.message=O valor deve seguir o padr\u00E3o "{regexp}".
+javax.validation.constraints.Size.message=O tamanho deve ser entre {min} e {max}.
+
+org.hibernate.validator.constraints.Email.message=E-mail inv\u00E1lido.
+org.hibernate.validator.constraints.Length.message=O tamanho deve ser entre {min} e {max}.
+org.hibernate.validator.constraints.NotBlank.message=N\u00E3o pode ser vazio.
+org.hibernate.validator.constraints.NotEmpty.message=N\u00E3o pode ser vazio.
+org.hibernate.validator.constraints.Range.message=Deve ser um valor entre {min} e {max}.
+org.hibernate.validator.constraints.URL.message=Endere\u00E7o de Internet inv\u00E1lido.
+org.hibernate.validator.constraints.CreditCardNumber.message=N\u00FAmero de cart\u00E3o de cr\u00E9dito inv\u00E1lido.
+org.hibernate.validator.constraints.ScriptAssert.message=Express\u00E3o de script "{script}" n\u00E3o avaliada como verdadeira.
36 favoritos/src/main/resources/demoiselle.properties
View
@@ -0,0 +1,36 @@
+# Demoiselle Framework
+# Copyright (C) 2010 SERPRO
+# ----------------------------------------------------------------------------
+# This file is part of Demoiselle Framework.
+#
+# Demoiselle Framework is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License version 3
+# as published by the Free Software Foundation.
+#
+# This program 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. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License version 3
+# along with this program; if not, see <http://www.gnu.org/licenses/>
+# or write to the Free Software Foundation, Inc., 51 Franklin Street,
+# Fifth Floor, Boston, MA 02110-1301, USA.
+# ----------------------------------------------------------------------------
+# Este arquivo � parte do Framework Demoiselle.
+#
+# O Framework Demoiselle � um software livre; voc� pode redistribu�-lo e/ou
+# modific�-lo dentro dos termos da GNU LGPL vers�o 3 como publicada pela Funda��o
+# do Software Livre (FSF).
+#
+# Este programa � distribu�do na esperan�a que possa ser �til, mas SEM NENHUMA
+# GARANTIA; sem uma garantia impl�cita de ADEQUA��O a qualquer MERCADO ou
+# APLICA��O EM PARTICULAR. Veja a Licen�a P�blica Geral GNU/LGPL em portugu�s
+# para maiores detalhes.
+#
+# Voc� deve ter recebido uma c�pia da GNU LGPL vers�o 3, sob o t�tulo
+# "LICENCA.txt", junto com esse programa. Se n�o, acesse <http://www.gnu.org/licenses/>
+# ou escreva para a Funda��o do Software Livre (FSF) Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+
+frameworkdemoiselle.security.redirect.after.logout=/index
2  favoritos/src/main/resources/favoritos.properties
View
@@ -0,0 +1,2 @@
+app.title=Favoritos Demoiselle
+general.loadInitialData=true
10 favoritos/src/main/resources/log4j.properties
View
@@ -0,0 +1,10 @@
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+log4j.logger.br.gov.demoiselle=DEBUG, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n
49 favoritos/src/main/resources/messages.properties
View
@@ -0,0 +1,49 @@
+menu.bookmark=Favoritos
+favoritos.label=Favorito
+
+favorito-delete-ok=Favorito exclu\u00EDdo\: {0}
+favorito-insert-ok=Favorito inserido: {0}
+favorito-update-ok=Favorito atualizado: {0}
+
+favorito-delete-nok=Erro ao tentar excluir Favorito\: {0}
+favorito-insert-nok=Erro ao tentar inserir Favorito\: {0}
+favorito-update-nok=Erro ao tentar atualizar Favorito\: {0}
+
+favoritos.list.table.title=Lista de Links
+
+favoritos.label.id=ID
+favoritos.label.url=URL
+favoritos.label.descricao=Descri\u00E7\u00E3o
+
+favoritos.alt.id=ID
+favoritos.alt.url=URL
+favoritos.alt.descricao=Descri\u00E7\u00E3o
+
+button.add.new=Incluir Novo
+button.back=Voltar
+button.delete=Excluir
+button.dialog.no=N\u00E3o, desculpe\!
+button.dialog.yes=Sim, claro!
+button.edit=Editar
+button.new=Novo
+button.save=Salvar
+
+label.action=A\u00E7\u00E3o
+label.dialog.alert=Alerta
+label.dialog.delete=Excluir
+label.confirm.delete=Confirma?
+label.date.pattern=dd/MM/yyyy
+
+main.app.title=Favoritos
+main.app.welcome=Bem-vindo \u00E0 aplica\u00E7\u00E3o de exemplo Favoritos. Este \u00E9 o seu ponto de partida, portanto sinta-se \u00E0 vontade para modificar esta aplica\u00E7\u00E3o.
+main.change.skin=Mudar Pele
+main.skin=Pele
+main.footer.text=Aplica\u00E7\u00E3o de exemplo do Demoiselle ${parent.version}
+
+menu.language=Idioma
+menu.menuitem.language-portuguese=Portugu\u00EAs
+menu.menuitem.language-english=Ingl\u00EAs
+menu.menuitem.contents=Conte\u00FAdo
+menu.menuitem.list=Listar
+menu.menuitem.new=Novo
+menu.menuitem.quit=Sair
67 favoritos/src/main/resources/reports/Favoritos.jrxml
View
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Bookmarks" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
+ <property name="ireport.zoom" value="1.0"/>
+ <property name="ireport.x" value="15"/>
+ <property name="ireport.y" value="0"/>
+ <parameter name="titulo" class="java.lang.String"/>
+ <field name="url" class="java.lang.String"/>
+ <field name="descricao" class="java.lang.String"/>
+ <background>
+ <band splitType="Stretch"/>
+ </background>
+ <title>
+ <band height="58" splitType="Stretch">
+ <textField>
+ <reportElement x="99" y="16" width="603" height="38"/>
+ <textElement textAlignment="Center">
+ <font size="18" isBold="true"/>
+ </textElement>
+ <textFieldExpression><![CDATA[$P{titulo}]]></textFieldExpression>
+ </textField>
+ </band>
+ </title>
+ <pageHeader>
+ <band height="35" splitType="Stretch"/>
+ </pageHeader>
+ <columnHeader>
+ <band height="20" splitType="Stretch">
+ <staticText>
+ <reportElement x="45" y="0" width="274" height="20"/>
+ <textElement verticalAlignment="Middle">
+ <font isBold="true"/>
+ </textElement>
+ <text><![CDATA[Descricao]]></text>
+ </staticText>
+ <staticText>
+ <reportElement x="319" y="0" width="483" height="20"/>
+ <textElement verticalAlignment="Middle">
+ <font isBold="true"/>
+ </textElement>
+ <text><![CDATA[URL]]></text>
+ </staticText>
+ </band>
+ </columnHeader>
+ <detail>
+ <band height="27" splitType="Stretch">
+ <textField>
+ <reportElement x="45" y="0" width="274" height="20"/>
+ <textElement verticalAlignment="Middle"/>
+ <textFieldExpression><![CDATA[$F{descricao}]]></textFieldExpression>
+ </textField>
+ <textField>
+ <reportElement x="319" y="0" width="483" height="20"/>
+ <textElement verticalAlignment="Middle"/>
+ <textFieldExpression><![CDATA[$F{url}]]></textFieldExpression>
+ </textField>
+ </band>
+ </detail>
+ <columnFooter>
+ <band height="18" splitType="Stretch"/>
+ </columnFooter>
+ <pageFooter>
+ <band height="21" splitType="Stretch"/>
+ </pageFooter>
+ <summary>
+ <band height="21" splitType="Stretch"/>
+ </summary>
+</jasperReport>
3  favoritos/src/main/webapp/META-INF/MANIFEST.MF
View
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
6 favoritos/src/main/webapp/WEB-INF/faces-config.xml
View
@@ -0,0 +1,6 @@
+<?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_2_0.xsd"
+ version="2.0">
+
+</faces-config>
39 favoritos/src/main/webapp/WEB-INF/web.xml
View
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" 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-app_3_0.xsd">
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <security-constraint>
+ <display-name>Restrict raw XHTML Documents</display-name>
+ <web-resource-collection>
+ <web-resource-name>XHTML</web-resource-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </web-resource-collection>
+ <auth-constraint/>
+ </security-constraint>
+ <security-constraint>
+ <display-name>Controle de acesso com o JAAS</display-name>
+ <web-resource-collection>
+ <web-resource-name>Area Protegida</web-resource-name>
+ <description>Limita o acesso a todos os recursos JSF</description>
+ <url-pattern>*.jsf</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>*</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <form-login-config>
+ <form-login-page>/login.xhtml</form-login-page>
+ <form-error-page>/access.xhtml</form-error-page>
+ </form-login-config>
+ </login-config>
+</web-app>
30 favoritos/src/main/webapp/access.xhtml
View
@@ -0,0 +1,30 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
+<h:head>
+ <title>Erro de Login</title>
+</h:head>
+ <h:body>
+ <h2>Erro de Permissão</h2>
+ <form method="post" action="j_security_check">
+ <h:messages />
+ <table align="center">
+ <tr>
+ <td colspan="2"><h2>Digite as informações de Login:</h2></td>
+ </tr>
+ <tr>
+ <td><label for="username">Login</label></td>
+ <td><input type="text" id="username" name="j_username" /></td>
+ </tr>
+ <tr>
+ <td><label for="password">Senha</label></td>
+ <td><input type="password" id="password" name="j_password" /></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="submit" value="Tentar Novamente" /></td>
+ </tr>
+ </table>
+ </form>
+ </h:body>
+</html>
44 favoritos/src/main/webapp/favorito_edit.xhtml
View
@@ -0,0 +1,44 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">
+
+ <ui:define name="body">
+ <h:form prependId="false">
+ <p:toolbar>
+ <p:toolbarGroup align="left">
+ <p:commandButton value="#{messages['button.save']}" action="#{favoritoEditMB.insert}"
+ rendered="#{!favoritoEditMB.updateMode}" ajax="false" />
+ <p:commandButton value="#{messages['button.save']}" action="#{favoritoEditMB.update}"
+ rendered="#{favoritoEditMB.updateMode}" ajax="false" />
+ <p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()"
+ rendered="#{favoritoEditMB.updateMode}" type="button" immediate="true" ajax="false" />
+ <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
+ header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
+ <h:commandButton value="#{messages['button.dialog.yes']}" action="#{favoritoEditMB.delete}" immediate="true"
+ ajax="false" />
+ <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
+ </p:confirmDialog>
+ </p:toolbarGroup>
+ </p:toolbar>
+
+ <br />
+
+ <p:fieldset legend="#{messages['favoritos.label']}" toggleable="true" toggleSpeed="500">
+ <h:panelGrid id="fields" columns="3">
+ <h:outputLabel value="#{messages['favoritos.label.id']}: " for="id" styleClass="text-input" />
+ <h:outputText id="id" value="#{favoritoEditMB.bean.id}" />
+ <p:message for="id" />
+
+ <h:outputLabel value="#{messages['favoritos.label.descricao']}: " for="descricao" styleClass="text-input" />
+ <h:inputText id="descricao" value="#{favoritoEditMB.bean.descricao}"
+ title="#{messages['favoritos.alt.descricao']}" />
+ <p:message for="descricao" />
+
+ <h:outputLabel value="#{messages['favoritos.label.url']}: " for="url" styleClass="text-input" />
+ <h:inputText id="url" value="#{favoritoEditMB.bean.url}" title="#{messages['favoritos.alt.url']}" />
+ <p:message for="url" />
+ </h:panelGrid>
+ </p:fieldset>
+ </h:form>
+ </ui:define>
+</ui:composition>
54 favoritos/src/main/webapp/favorito_list.xhtml
View
@@ -0,0 +1,54 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">
+
+ <ui:define name="body">
+ <h:form>
+ <p:toolbar>
+ <p:toolbarGroup align="left">
+ <p:commandButton title="#{messages['button.new']}" image="ui-icon-document" action="#{favoritoListMB.getNextView}"
+ actionListener="#{favoritoListMB.clear}" ajax="false" />
+
+ <p:commandButton title="#{messages['button.delete']}" image="ui-icon-trash" onclick="confirmation.show()"
+ type="button" immediate="true" ajax="false" />
+
+ <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
+ header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation">
+
+ <h:commandButton value="#{messages['button.dialog.yes']}" action="#{favoritoListMB.deleteSelection}"
+ actionListener="#{favoritoListMB.clear}" />
+ <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
+ </p:confirmDialog>
+
+ <h:commandLink target="popupWindow" value="Gerar PDF" action="#{favoritoListMB.showReport}" />
+
+ </p:toolbarGroup>
+ </p:toolbar>
+
+ <p:dataTable id="list" var="bean" value="#{favoritoListMB.resultList}">
+ <f:facet name="header">#{messages['favoritos.list.table.title']}</f:facet>
+ <p:column style="width:5%;">
+ <h:selectBooleanCheckbox value="#{favoritoListMB.selection[bean.id]}"></h:selectBooleanCheckbox>
+ </p:column>
+ <p:column style="width:5%;" sortBy="#{bean.id}">
+ <f:facet name="header">#{messages['favoritos.label.id']}</f:facet>
+ <h:outputText value="#{bean.id}" />
+ </p:column>
+ <p:column sortBy="#{bean.descricao}">
+ <f:facet name="header">#{messages['favoritos.label.descricao']}</f:facet>
+ <h:commandLink action="#{favoritoListMB.getNextView}" actionListener="#{favoritoListMB.clear}">
+ <h:outputText value="#{bean.descricao}" />
+ <f:param name="id" value="#{bean.id}" />
+ </h:commandLink>
+ </p:column>
+ <p:column sortBy="#{bean.url}">
+ <f:facet name="header">#{messages['favoritos.label.url']}</f:facet>
+ <h:commandLink action="#{favoritoListMB.getNextView}" actionListener="#{favoritoListMB.clear}">
+ <h:outputText value="#{bean.url}" />
+ <f:param name="id" value="#{bean.id}" />
+ </h:commandLink>
+ </p:column>
+ </p:dataTable>
+ </h:form>
+ </ui:define>
+</ui:composition>
BIN  favoritos/src/main/webapp/images/logo.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 favoritos/src/main/webapp/index.html
View
@@ -0,0 +1,5 @@
+<html>
+<head>
+<meta http-equiv="Refresh" content="0; URL=index.jsf">
+</head>
+</html>
11 favoritos/src/main/webapp/index.xhtml
View
@@ -0,0 +1,11 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">
+
+ <ui:define name="body">
+ <p:panel>
+ #{messages['main.app.welcome']}
+ </p:panel>
+ </ui:define>
+
+</ui:composition>
28 favoritos/src/main/webapp/login.xhtml
View
@@ -0,0 +1,28 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
+<h:head>
+ <title>Tela de Login</title>
+</h:head>
+ <h:body>
+ <form method="post" action="j_security_check">
+ <table align="center">
+ <tr>
+ <td colspan="2"><h2>Digite as informações de Login:</h2></td>
+ </tr>
+ <tr>
+ <td><label for="username">Login</label></td>
+ <td><input type="text" id="username" name="j_username" /></td>
+ </tr>
+ <tr>
+ <td><label for="password">Senha</label></td>
+ <td><input type="password" id="password" name="j_password" /></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="submit" value="Entrar" /></td>
+ </tr>
+ </table>
+ </form>
+ </h:body>
+</html>
16 favoritos/src/main/webapp/menu.xhtml
View
@@ -0,0 +1,16 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <h:form>
+ <p:menubar>
+ <p:submenu label="#{messages['menu.bookmark']}">
+ <p:menuitem value="#{messages['menu.menuitem.new']}" url="/favorito_edit.jsf" />
+ <p:menuitem value="#{messages['menu.menuitem.list']}" url="/favorito_list.jsf" />
+ </p:submenu>
+
+ <p:menuitem value="#{messages['menu.menuitem.quit']}" action="#{securityContext.logout}" />
+ </p:menubar>
+ </h:form>
+
+</ui:composition>
40 favoritos/src/main/webapp/template/main.xhtml
View
@@ -0,0 +1,40 @@
+<html xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui"
+ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<f:view contentType="text/html" locale="#currentLocale" />
+
+<h:head>
+ <title>#{messages['main.app.title']}</title>
+ <link type="text/css" rel="stylesheet" href="css/styles.css" />
+</h:head>
+
+<h:body style="background-color:#f1f1f1">
+ <table style="width: 100%">
+ <tr>
+ <td height="70" width="5%" align="left"><a href="index.jsf"><img src="images/logo.png" border="0" /></a></td>
+ <td height="70" width="95%" align="left"><p:themeSwitcher initialText="Change Skin" buttonPreText="Skin: " /></td>
+ </tr>
+ <tr>
+ <td height="20" colspan="2"><ui:include src="/menu.xhtml" /></td>
+ </tr>
+ <tr valign="top">
+ <td height="400" colspan="2"><ui:insert name="body" /></td>
+ </tr>
+ <tr align="center">
+ <td height="20" colspan="2" align="center" class="text-input">#{messages['main.footer.text']}</td>
+ </tr>
+ </table>
+
+ <p:growl id="messages" globalOnly="true" />
+
+ <p:ajaxStatus style="width:16px;height:16px;">
+ <f:facet name="start">
+ </f:facet>
+
+ <f:facet name="complete">
+ <h:outputText value="" />
+ </f:facet>
+ </p:ajaxStatus>
+ <link type="text/css" rel="stylesheet" href="css/aristo/skin.css" />
+</h:body>
+</html>
0  favoritos/src/test/java/br/gov/serpro/favoritos/readme.txt
View
No changes.
0  favoritos/src/test/resources/readme.txt
View
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.