Commit d3076754ba0f3ab1a97ff4249d74b6cab2ed26d8
1 parent
30967e2f
Exists in
master
Criação do arquétipo HTML+REST
Showing
44 changed files
with
1139 additions
and
10 deletions
Show diff stats
@@ -0,0 +1,94 @@ | @@ -0,0 +1,94 @@ | ||
1 | +<!-- | ||
2 | + Demoiselle Framework | ||
3 | + Copyright (C) 2010 SERPRO | ||
4 | + ============================================================================ | ||
5 | + This file is part of Demoiselle Framework. | ||
6 | + | ||
7 | + Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | + modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | + as published by the Free Software Foundation. | ||
10 | + | ||
11 | + This program is distributed in the hope that it will be useful, | ||
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + GNU General Public License for more details. | ||
15 | + | ||
16 | + You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | + along with this program; if not, see <http://www.gnu.org/licenses /> | ||
18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | + Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | + ============================================================================ | ||
21 | + Este arquivo é parte do Framework Demoiselle. | ||
22 | + | ||
23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | + do Software Livre (FSF). | ||
26 | + | ||
27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | + para maiores detalhes. | ||
31 | + | ||
32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses /> | ||
34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | +--> | ||
37 | +<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"> | ||
38 | + | ||
39 | + <modelVersion>4.0.0</modelVersion> | ||
40 | + | ||
41 | + <groupId>br.gov.frameworkdemoiselle.archetypes</groupId> | ||
42 | + <artifactId>demoiselle-html-rest</artifactId> | ||
43 | + <packaging>jar</packaging> | ||
44 | + | ||
45 | + <parent> | ||
46 | + <groupId>br.gov.frameworkdemoiselle</groupId> | ||
47 | + <artifactId>demoiselle-archetype-parent</artifactId> | ||
48 | + <version>2.5.0-SNAPSHOT</version> | ||
49 | + <relativePath>../../parent/archetype</relativePath> | ||
50 | + </parent> | ||
51 | + | ||
52 | + <name>Demoiselle Framework HTML and REST Archetype</name> | ||
53 | + <description> | ||
54 | + Archetype for web applications (HTML + REST) using Demoiselle Framework | ||
55 | + </description> | ||
56 | + <url>http://www.frameworkdemoiselle.gov.br</url> | ||
57 | + | ||
58 | + <licenses> | ||
59 | + <license> | ||
60 | + <name>GNU Lesser General Public License, Version 3</name> | ||
61 | + <url>http://www.gnu.org/licenses/lgpl-3.0.txt</url> | ||
62 | + </license> | ||
63 | + </licenses> | ||
64 | + | ||
65 | + <organization> | ||
66 | + <name>SERPRO - Serviço Federal de Processamento de Dados</name> | ||
67 | + <url>http://www.serpro.gov.br</url> | ||
68 | + </organization> | ||
69 | + | ||
70 | + <repositories> | ||
71 | + <repository> | ||
72 | + <id>sonatype-nexus-snapshots</id> | ||
73 | + <name>Sonatype Nexus Snapshots</name> | ||
74 | + <url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
75 | + <snapshots> | ||
76 | + <enabled>true</enabled> | ||
77 | + </snapshots> | ||
78 | + <releases> | ||
79 | + <enabled>false</enabled> | ||
80 | + </releases> | ||
81 | + </repository> | ||
82 | + <repository> | ||
83 | + <id>sonatype-nexus-releases</id> | ||
84 | + <name>Sonatype Nexus Releases</name> | ||
85 | + <url>https://oss.sonatype.org/content/repositories/releases</url> | ||
86 | + <snapshots> | ||
87 | + <enabled>false</enabled> | ||
88 | + </snapshots> | ||
89 | + <releases> | ||
90 | + <enabled>true</enabled> | ||
91 | + </releases> | ||
92 | + </repository> | ||
93 | + </repositories> | ||
94 | +</project> |
archetype/html-rest/src/main/resources/META-INF/maven/archetype-metadata.xml
0 → 100755
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +<!-- | ||
2 | + Demoiselle Framework | ||
3 | + Copyright (C) 2010 SERPRO | ||
4 | + ============================================================================ | ||
5 | + This file is part of Demoiselle Framework. | ||
6 | + | ||
7 | + Demoiselle Framework is free software; you can redistribute it and/or | ||
8 | + modify it under the terms of the GNU Lesser General Public License version 3 | ||
9 | + as published by the Free Software Foundation. | ||
10 | + | ||
11 | + This program is distributed in the hope that it will be useful, | ||
12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | + GNU General Public License for more details. | ||
15 | + | ||
16 | + You should have received a copy of the GNU Lesser General Public License version 3 | ||
17 | + along with this program; if not, see <http://www.gnu.org/licenses/> | ||
18 | + or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
19 | + Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | + ============================================================================ | ||
21 | + Este arquivo é parte do Framework Demoiselle. | ||
22 | + | ||
23 | + O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
24 | + modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
25 | + do Software Livre (FSF). | ||
26 | + | ||
27 | + Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
28 | + GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
29 | + APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
30 | + para maiores detalhes. | ||
31 | + | ||
32 | + Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
33 | + "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | ||
34 | + ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
35 | + 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
36 | +--> | ||
37 | +<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | ||
38 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
39 | + xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" | ||
40 | + name="#{project.artifactId}"> | ||
41 | + | ||
42 | + <fileSets> | ||
43 | + <fileSet filtered="true" packaged="false"> | ||
44 | + <directory /> | ||
45 | + <includes> | ||
46 | + <include>readme.txt</include> | ||
47 | + </includes> | ||
48 | + </fileSet> | ||
49 | + <fileSet filtered="true" packaged="false"> | ||
50 | + <directory>src/main/webapp</directory> | ||
51 | + <excludes> | ||
52 | + <exclude>**/*.png</exclude> | ||
53 | + <exclude>**/*.gif</exclude> | ||
54 | + <exclude>**/*.jpg</exclude> | ||
55 | + </excludes> | ||
56 | + </fileSet> | ||
57 | + <fileSet filtered="false" packaged="false"> | ||
58 | + <directory>src/main/webapp</directory> | ||
59 | + <includes> | ||
60 | + <include>**/*.png</include> | ||
61 | + <include>**/*.gif</include> | ||
62 | + <include>**/*.jpg</include> | ||
63 | + </includes> | ||
64 | + </fileSet> | ||
65 | + <fileSet filtered="true" packaged="true"> | ||
66 | + <directory>src/main/java</directory> | ||
67 | + </fileSet> | ||
68 | + <fileSet filtered="true" packaged="false"> | ||
69 | + <directory>src/main/resources</directory> | ||
70 | + </fileSet> | ||
71 | + <fileSet filtered="true" packaged="true"> | ||
72 | + <directory>src/test/java</directory> | ||
73 | + </fileSet> | ||
74 | + <fileSet filtered="true" packaged="false"> | ||
75 | + <directory>src/test/resources</directory> | ||
76 | + </fileSet> | ||
77 | + </fileSets> | ||
78 | + | ||
79 | +</archetype-descriptor> | ||
0 | \ No newline at end of file | 80 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/pom.xml
0 → 100755
@@ -0,0 +1,49 @@ | @@ -0,0 +1,49 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
4 | + | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + | ||
7 | + <groupId>${groupId}</groupId> | ||
8 | + <artifactId>${artifactId}</artifactId> | ||
9 | + <version>${version}</version> | ||
10 | + <packaging>war</packaging> | ||
11 | + | ||
12 | + <name></name> | ||
13 | + <description></description> | ||
14 | + <url></url> | ||
15 | + | ||
16 | + <parent> | ||
17 | + <groupId>br.gov.frameworkdemoiselle</groupId> | ||
18 | + <artifactId>demoiselle-rest-parent</artifactId> | ||
19 | + <version>#{parent.version}</version> | ||
20 | + </parent> | ||
21 | + | ||
22 | + <dependencies> | ||
23 | + <dependency> | ||
24 | + <groupId>br.gov.frameworkdemoiselle</groupId> | ||
25 | + <artifactId>demoiselle-jpa</artifactId> | ||
26 | + <scope>compile</scope> | ||
27 | + </dependency> | ||
28 | + <!-- If you are using a JTA transaction then use this extension --> | ||
29 | + <!-- | ||
30 | + <dependency> | ||
31 | + <groupId>br.gov.frameworkdemoiselle</groupId> | ||
32 | + <artifactId>demoiselle-jta</artifactId> | ||
33 | + <scope>compile</scope> | ||
34 | + </dependency> | ||
35 | + --> | ||
36 | + | ||
37 | + <dependency> | ||
38 | + <groupId>br.gov.frameworkdemoiselle.component</groupId> | ||
39 | + <artifactId>demoiselle-junit</artifactId> | ||
40 | + <version>2.3.1</version> | ||
41 | + <scope>test</scope> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.slf4j</groupId> | ||
45 | + <artifactId>slf4j-log4j12</artifactId> | ||
46 | + <scope>test</scope> | ||
47 | + </dependency> | ||
48 | + </dependencies> | ||
49 | +</project> |
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/business/BookmarkBC.java
0 → 100644
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +package ${package}.business; | ||
2 | + | ||
3 | +import br.gov.frameworkdemoiselle.lifecycle.Startup; | ||
4 | +import br.gov.frameworkdemoiselle.stereotype.BusinessController; | ||
5 | +import br.gov.frameworkdemoiselle.template.DelegateCrud; | ||
6 | +import br.gov.frameworkdemoiselle.transaction.Transactional; | ||
7 | + | ||
8 | +import ${package}.domain.Bookmark; | ||
9 | +import ${package}.persistence.BookmarkDAO; | ||
10 | + | ||
11 | +@BusinessController | ||
12 | +public class BookmarkBC extends DelegateCrud<Bookmark, Long, BookmarkDAO> { | ||
13 | + | ||
14 | + private static final long serialVersionUID = 1L; | ||
15 | + | ||
16 | + @Startup | ||
17 | + @Transactional | ||
18 | + public void load() { | ||
19 | + if (findAll().isEmpty()) { | ||
20 | + insert(new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br")); | ||
21 | + insert(new Bookmark("Demoiselle SourceForge", "http://sf.net/projects/demoiselle")); | ||
22 | + insert(new Bookmark("Twitter", "http://twitter.frameworkdemoiselle.gov.br")); | ||
23 | + insert(new Bookmark("Blog", "http://blog.frameworkdemoiselle.gov.br")); | ||
24 | + insert(new Bookmark("Wiki", "http://wiki.frameworkdemoiselle.gov.br")); | ||
25 | + insert(new Bookmark("Bug Tracking", "http://tracker.frameworkdemoiselle.gov.br")); | ||
26 | + insert(new Bookmark("Forum", "http://forum.frameworkdemoiselle.gov.br")); | ||
27 | + insert(new Bookmark("SVN", "http://svn.frameworkdemoiselle.gov.br")); | ||
28 | + insert(new Bookmark("Maven", "http://repository.frameworkdemoiselle.gov.br")); | ||
29 | + insert(new Bookmark("Downloads", "http://download.frameworkdemoiselle.gov.br")); | ||
30 | + } | ||
31 | + } | ||
32 | + | ||
33 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/constant/readme.txt
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/domain/Bookmark.java
0 → 100644
@@ -0,0 +1,63 @@ | @@ -0,0 +1,63 @@ | ||
1 | +package ${package}.domain; | ||
2 | + | ||
3 | +import static javax.persistence.GenerationType.SEQUENCE; | ||
4 | + | ||
5 | +import java.io.Serializable; | ||
6 | + | ||
7 | +import javax.persistence.Column; | ||
8 | +import javax.persistence.Entity; | ||
9 | +import javax.persistence.GeneratedValue; | ||
10 | +import javax.persistence.Id; | ||
11 | + | ||
12 | +@Entity | ||
13 | +public class Bookmark implements Serializable { | ||
14 | + | ||
15 | + private static final long serialVersionUID = 1L; | ||
16 | + | ||
17 | + /* | ||
18 | + * If you are using Glassfish then remove the strategy attribute | ||
19 | + */ | ||
20 | + @Id | ||
21 | + @GeneratedValue(strategy = SEQUENCE) | ||
22 | + private Long id; | ||
23 | + | ||
24 | + @Column | ||
25 | + private String description; | ||
26 | + | ||
27 | + @Column | ||
28 | + private String link; | ||
29 | + | ||
30 | + public Bookmark() { | ||
31 | + super(); | ||
32 | + } | ||
33 | + | ||
34 | + public Bookmark(String description, String link) { | ||
35 | + this.description = description; | ||
36 | + this.link = link; | ||
37 | + } | ||
38 | + | ||
39 | + public Long getId() { | ||
40 | + return id; | ||
41 | + } | ||
42 | + | ||
43 | + public void setId(Long id) { | ||
44 | + this.id = id; | ||
45 | + } | ||
46 | + | ||
47 | + public String getDescription() { | ||
48 | + return description; | ||
49 | + } | ||
50 | + | ||
51 | + public void setDescription(String description) { | ||
52 | + this.description = description; | ||
53 | + } | ||
54 | + | ||
55 | + public String getLink() { | ||
56 | + return link; | ||
57 | + } | ||
58 | + | ||
59 | + public void setLink(String link) { | ||
60 | + this.link = link; | ||
61 | + } | ||
62 | + | ||
63 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/exception/readme.txt
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/message/readme.txt
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/persistence/BookmarkDAO.java
0 → 100644
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +package ${package}.persistence; | ||
2 | + | ||
3 | +import br.gov.frameworkdemoiselle.stereotype.PersistenceController; | ||
4 | +import br.gov.frameworkdemoiselle.template.JPACrud; | ||
5 | + | ||
6 | +import ${package}.domain.Bookmark; | ||
7 | + | ||
8 | +@PersistenceController | ||
9 | +public class BookmarkDAO extends JPACrud<Bookmark, Long> { | ||
10 | + | ||
11 | + private static final long serialVersionUID = 1L; | ||
12 | + | ||
13 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/rest/BookmarkREST.java
0 → 100644
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +package ${package}.rest; | ||
2 | + | ||
3 | +import java.net.URI; | ||
4 | +import java.util.List; | ||
5 | + | ||
6 | +import javax.inject.Inject; | ||
7 | +import javax.ws.rs.Consumes; | ||
8 | +import javax.ws.rs.DELETE; | ||
9 | +import javax.ws.rs.GET; | ||
10 | +import javax.ws.rs.POST; | ||
11 | +import javax.ws.rs.Path; | ||
12 | +import javax.ws.rs.PathParam; | ||
13 | +import javax.ws.rs.Produces; | ||
14 | +import javax.ws.rs.core.Context; | ||
15 | +import javax.ws.rs.core.Response; | ||
16 | +import javax.ws.rs.core.UriInfo; | ||
17 | + | ||
18 | +import ${package}.business.BookmarkBC; | ||
19 | +import ${package}.domain.Bookmark; | ||
20 | +import br.gov.frameworkdemoiselle.BadRequestException; | ||
21 | +import br.gov.frameworkdemoiselle.NotFoundException; | ||
22 | +import br.gov.frameworkdemoiselle.transaction.Transactional; | ||
23 | + | ||
24 | +//@ValidateRequest | ||
25 | +@Path("bookmark") | ||
26 | +// @Consumes(APPLICATION_JSON) | ||
27 | +public class BookmarkREST { | ||
28 | + | ||
29 | + @Inject | ||
30 | + private BookmarkBC bc; | ||
31 | + | ||
32 | + @GET | ||
33 | + @Produces("application/json") | ||
34 | + public List<Bookmark> find() throws Exception { | ||
35 | + return bc.findAll(); | ||
36 | + } | ||
37 | + | ||
38 | + @GET | ||
39 | + @Path("{id}") | ||
40 | + @Produces("application/json") | ||
41 | + public Bookmark load(@PathParam("id") Long id) throws Exception { | ||
42 | + Bookmark result = bc.load(id); | ||
43 | + | ||
44 | + if (result == null) { | ||
45 | + throw new NotFoundException(); | ||
46 | + } | ||
47 | + | ||
48 | + return result; | ||
49 | + } | ||
50 | + | ||
51 | + @POST | ||
52 | + @Transactional | ||
53 | + @Consumes("application/json") | ||
54 | + @Produces("text/plain") | ||
55 | + public Response insert(Bookmark entity, @Context UriInfo uriInfo) { | ||
56 | + if (entity.getId() != null) { | ||
57 | + throw new BadRequestException(); | ||
58 | + } | ||
59 | + | ||
60 | + String id = bc.insert(entity).getId().toString(); | ||
61 | + URI location = uriInfo.getRequestUriBuilder().path(id).build(); | ||
62 | + | ||
63 | + return Response.created(location).entity(id).build(); | ||
64 | + } | ||
65 | + | ||
66 | + @DELETE | ||
67 | + @Transactional | ||
68 | + @Consumes("application/json") | ||
69 | + public void delete(List<Long> ids) { | ||
70 | + bc.delete(ids); | ||
71 | + } | ||
72 | + | ||
73 | + @DELETE | ||
74 | + @Path("{id}") | ||
75 | + @Transactional | ||
76 | + public void delete(@PathParam("id") Long id) { | ||
77 | + bc.delete(id); | ||
78 | + } | ||
79 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/rest/RESTApp.java
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/java/util/readme.txt
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/META-INF/beans.xml
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/META-INF/persistence.xml
0 → 100644
@@ -0,0 +1,121 @@ | @@ -0,0 +1,121 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> | ||
4 | + | ||
5 | + <!-- If you are using JBoss AS7 with non JTA transaction then use this persistence-unit --> | ||
6 | + <!-- | ||
7 | + --> | ||
8 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
9 | + <non-jta-data-source>java:jboss/datasources/ExampleDS</non-jta-data-source> | ||
10 | + | ||
11 | + <class>${package}.domain.Bookmark</class> | ||
12 | + | ||
13 | + <properties> | ||
14 | + <property name="hibernate.show_sql" value="true" /> | ||
15 | + <property name="hibernate.format_sql" value="false" /> | ||
16 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | ||
17 | + <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /> | ||
18 | + </properties> | ||
19 | + </persistence-unit> | ||
20 | + | ||
21 | + <!-- If you are using JBoss AS7 with JTA transaction then use this persistence-unit --> | ||
22 | + <!-- | ||
23 | + <persistence-unit name="bookmark-ds" transaction-type="JTA"> | ||
24 | + <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> | ||
25 | + | ||
26 | + <class>${package}.domain.Bookmark</class> | ||
27 | + | ||
28 | + <exclude-unlisted-classes>true</exclude-unlisted-classes> | ||
29 | + <properties> | ||
30 | + <property name="hibernate.show_sql" value="true" /> | ||
31 | + <property name="hibernate.format_sql" value="false" /> | ||
32 | + <property name="hibernate.hbm2ddl.auto" value="update" /> | ||
33 | + <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> | ||
34 | + <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" /> | ||
35 | + </properties> | ||
36 | + </persistence-unit> | ||
37 | + --> | ||
38 | + | ||
39 | + <!-- If you are using JBoss AS6 with non JTA transaction then use this persistence-unit --> | ||
40 | + <!-- | ||
41 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
42 | + <non-jta-data-source>java:/DefaultDS</non-jta-data-source> | ||
43 | + | ||
44 | + <class>${package}.domain.Bookmark</class> | ||
45 | + | ||
46 | + <properties> | ||
47 | + <property name="hibernate.show_sql" value="true" /> | ||
48 | + <property name="hibernate.format_sql" value="false" /> | ||
49 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | ||
50 | + <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> | ||
51 | + </properties> | ||
52 | + </persistence-unit> | ||
53 | + --> | ||
54 | + | ||
55 | + <!-- If you are using JBoss AS6 with JTA transaction then use this persistence-unit --> | ||
56 | + <!-- | ||
57 | + <persistence-unit name="bookmark-ds" transaction-type="JTA"> | ||
58 | + <jta-data-source>java:/DefaultDS</jta-data-source> | ||
59 | + | ||
60 | + <class>${package}.domain.Bookmark</class> | ||
61 | + <exclude-unlisted-classes>true</exclude-unlisted-classes> | ||
62 | + <properties> | ||
63 | + <property name="hibernate.show_sql" value="true" /> | ||
64 | + <property name="hibernate.format_sql" value="false" /> | ||
65 | + <property name="hibernate.hbm2ddl.auto" value="update" /> | ||
66 | + <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> | ||
67 | + <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> | ||
68 | + </properties> | ||
69 | + </persistence-unit> | ||
70 | + --> | ||
71 | + | ||
72 | + <!-- If you are using GlassFish 3 with non JTA transaction then use this persistence-unit --> | ||
73 | + <!-- | ||
74 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
75 | + <non-jta-data-source>jdbc/__default</non-jta-data-source> | ||
76 | + | ||
77 | + <class>${package}.domain.Bookmark</class> | ||
78 | + | ||
79 | + <properties> | ||
80 | + <property name="eclipselink.logging.level" value="FINE" /> | ||
81 | + <property name="eclipselink.ddl-generation" value="create-tables" /> | ||
82 | + <property name="eclipselink.ddl-generation.output-mode" value="database" /> | ||
83 | + </properties> | ||
84 | + </persistence-unit> | ||
85 | + --> | ||
86 | + | ||
87 | + <!-- If you are using GlassFish 3 with JTA transaction then use this persistence-unit --> | ||
88 | + <!-- | ||
89 | + <persistence-unit name="bookmark-ds" transaction-type="JTA"> | ||
90 | + <jta-data-source>jdbc/__TimerPool</jta-data-source> | ||
91 | + | ||
92 | + <class>${package}.domain.Bookmark</class> | ||
93 | + | ||
94 | + <properties> | ||
95 | + <property name="eclipselink.logging.level" value="FINE" /> | ||
96 | + <property name="eclipselink.ddl-generation" value="create-tables" /> | ||
97 | + <property name="eclipselink.ddl-generation.output-mode" value="database" /> | ||
98 | + </properties> | ||
99 | + </persistence-unit> | ||
100 | + --> | ||
101 | + | ||
102 | + <!-- If you are using Tomcat 6 / Tomcat 7 / JUnit then use this persistence-unit --> | ||
103 | + <!-- | ||
104 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
105 | + | ||
106 | + <class>${package}.domain.Bookmark</class> | ||
107 | + | ||
108 | + <properties> | ||
109 | + <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" /> | ||
110 | + <property name="javax.persistence.jdbc.user" value="sa" /> | ||
111 | + <property name="javax.persistence.jdbc.password" value="" /> | ||
112 | + <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:hsql:." /> | ||
113 | + | ||
114 | + <property name="eclipselink.logging.level" value="FINE" /> | ||
115 | + <property name="eclipselink.ddl-generation" value="create-tables" /> | ||
116 | + <property name="eclipselink.ddl-generation.output-mode" value="database" /> | ||
117 | + </properties> | ||
118 | + </persistence-unit> | ||
119 | + --> | ||
120 | + | ||
121 | +</persistence> | ||
0 | \ No newline at end of file | 122 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/ValidationMessages.properties
0 → 100644
@@ -0,0 +1,28 @@ | @@ -0,0 +1,28 @@ | ||
1 | +br.gov.frameworkdemoiselle.pispasep=Informe um PIS/PASEP v\u00E1lido. | ||
2 | +br.gov.frameworkdemoiselle.inscricaoestadual=Informe uma Inscri\u00E7\u00E3o Estadual v\u00E1lida. | ||
3 | +br.gov.frameworkdemoiselle.cpf=Informe um CPF v\u00E1lido. | ||
4 | +br.gov.frameworkdemoiselle.cnpj=Informe um CNPJ v\u00E1lido. | ||
5 | +br.gov.frameworkdemoiselle.cep=Informe um CEP v\u00E1lido. | ||
6 | + | ||
7 | +javax.validation.constraints.AssertFalse.message=Este campo deve conter o valor falso. | ||
8 | +javax.validation.constraints.AssertTrue.message=Este campo deve conter o valor verdadeiro. | ||
9 | +javax.validation.constraints.DecimalMax.message=O valor deve ser menor ou igual a {value}. | ||
10 | +javax.validation.constraints.DecimalMin.message=O valor deve ser maior ou igual a {value}. | ||
11 | +javax.validation.constraints.Digits.message=Valor num\u00E9rico incorreto. (<{integer} d\u00EDgitos>.<{fraction} d\u00EDgitos> esperado). | ||
12 | +javax.validation.constraints.Future.message=Deve ser uma data no futuro. | ||
13 | +javax.validation.constraints.Max.message=O valor deve ser menor ou igual a {value}. | ||
14 | +javax.validation.constraints.Min.message=O valor deve ser maior ou igual a {value}. | ||
15 | +javax.validation.constraints.NotNull.message=N\u00E3o pode ser nulo. | ||
16 | +javax.validation.constraints.Null.message=Deve ser nulo. | ||
17 | +javax.validation.constraints.Past.message=Deve ser uma data no passado. | ||
18 | +javax.validation.constraints.Pattern.message=O valor deve seguir o padr\u00E3o "{regexp}". | ||
19 | +javax.validation.constraints.Size.message=O tamanho deve ser entre {min} e {max}. | ||
20 | + | ||
21 | +org.hibernate.validator.constraints.Email.message=E-mail inv\u00E1lido. | ||
22 | +org.hibernate.validator.constraints.Length.message=O tamanho deve ser entre {min} e {max}. | ||
23 | +org.hibernate.validator.constraints.NotBlank.message=N\u00E3o pode ser vazio. | ||
24 | +org.hibernate.validator.constraints.NotEmpty.message=N\u00E3o pode ser vazio. | ||
25 | +org.hibernate.validator.constraints.Range.message=Deve ser um valor entre {min} e {max}. | ||
26 | +org.hibernate.validator.constraints.URL.message=Endere\u00E7o de Internet inv\u00E1lido. | ||
27 | +org.hibernate.validator.constraints.CreditCardNumber.message=N\u00FAmero de cart\u00E3o de cr\u00E9dito inv\u00E1lido. | ||
28 | +org.hibernate.validator.constraints.ScriptAssert.message=Express\u00E3o de script "{script}" n\u00E3o avaliada como verdadeira. |
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/demoiselle.properties
0 → 100755
@@ -0,0 +1,5 @@ | @@ -0,0 +1,5 @@ | ||
1 | +# Enables JPA transaction strategy, automatically detected if demoiselle-jpa component is detected. Use only if you need to overwrite the default behaviour | ||
2 | +#frameworkdemoiselle.transaction.class=br.gov.frameworkdemoiselle.transaction.JPATransaction | ||
3 | + | ||
4 | +# Enables JTA transaction strategy, automatically detected if demoiselle-jta component is detected. Use only if you need to overwrite the default behaviour | ||
5 | +#frameworkdemoiselle.transaction.class=br.gov.frameworkdemoiselle.transaction.JTATransaction |
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/log4j.properties
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/messages.properties
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +menu.bookmark=Bookmarks | ||
2 | +bookmark.label=Bookmark | ||
3 | + | ||
4 | +bookmark-delete-ok=Bookmark exclu\u00EDdo\: {0} | ||
5 | +bookmark-insert-ok=Bookmark inserido: {0} | ||
6 | +bookmark-update-ok=Bookmark atualizado: {0} | ||
7 | + | ||
8 | +bookmark.list.table.title=Lista de Links | ||
9 | + | ||
10 | +bookmark.label.id=ID | ||
11 | +bookmark.label.link=Link | ||
12 | +bookmark.label.description=Descri\u00E7\u00E3o | ||
13 | + | ||
14 | +bookmark.alt.id=ID | ||
15 | +bookmark.alt.link=Link | ||
16 | +bookmark.alt.description=Descri\u00E7\u00E3o | ||
17 | + | ||
18 | +button.add.new=Incluir Novo | ||
19 | +button.back=Voltar | ||
20 | +button.delete=Excluir | ||
21 | +button.dialog.no=N\u00E3o, desculpe\! | ||
22 | +button.dialog.yes=Sim, claro! | ||
23 | +button.edit=Editar | ||
24 | +button.new=Novo | ||
25 | +button.save=Salvar | ||
26 | + | ||
27 | +label.action=A\u00E7\u00E3o | ||
28 | +label.dialog.alert=Alerta | ||
29 | +label.dialog.delete=Excluir | ||
30 | +label.confirm.delete=Confirma? | ||
31 | +label.date.pattern=dd/MM/yyyy | ||
32 | + | ||
33 | +main.app.title=Bookmarks | ||
34 | +main.app.welcome=Bem-vindo \u00E0 aplica\u00E7\u00E3o de exemplo Bookmark. Este \u00E9 o seu ponto de partida, portanto sinta-se \u00E0 vontade para modificar esta aplica\u00E7\u00E3o. | ||
35 | +main.change.skin=Mudar Pele | ||
36 | +main.skin=Pele | ||
37 | +main.footer.text=Aplica\u00E7\u00E3o de exemplo do Demoiselle ${parent.version} | ||
38 | + | ||
39 | +menu.language=Idioma | ||
40 | +menu.menuitem.language-portuguese=Portugu\u00EAs | ||
41 | +menu.menuitem.language-english=Ingl\u00EAs | ||
42 | +menu.menuitem.contents=Conte\u00FAdo | ||
43 | +menu.menuitem.list=Listar | ||
44 | +menu.menuitem.new=Novo | ||
45 | +menu.menuitem.quit=Sair |
archetype/html-rest/src/main/resources/archetype-resources/src/main/resources/messages_en.properties
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +menu.bookmark=Bookmarks | ||
2 | +bookmark.label=Bookmark | ||
3 | + | ||
4 | +bookmark-delete-ok=Bookmark removed\: {0} | ||
5 | +bookmark-insert-ok=Bookmark inserted\: {0} | ||
6 | +bookmark-update-ok=Bookmark updated\: {0} | ||
7 | + | ||
8 | +bookmark.list.table.title=All Links | ||
9 | + | ||
10 | +bookmark.label.id=ID | ||
11 | +bookmark.label.link=Link | ||
12 | +bookmark.label.description=Description | ||
13 | + | ||
14 | +bookmark.alt.id=ID | ||
15 | +bookmark.alt.link=Link | ||
16 | +bookmark.alt.description=Description | ||
17 | + | ||
18 | +button.add.new=Insert New | ||
19 | +button.back=Back | ||
20 | +button.delete=Remove | ||
21 | +button.dialog.no=No, sorry\! | ||
22 | +button.dialog.yes=Yes, sure\! | ||
23 | +button.edit=Edit | ||
24 | +button.new=New | ||
25 | +button.save=Save | ||
26 | + | ||
27 | +label.action=Action | ||
28 | +label.dialog.alert=Alert | ||
29 | +label.dialog.delete=Remove | ||
30 | +label.confirm.delete=Confirm? | ||
31 | +label.date.pattern=MM/dd/yyyy | ||
32 | + | ||
33 | +main.app.title=Bookmarks | ||
34 | +main.app.welcome=Welcome to the example application Bookmark. This is your starting point, feel free to change this application. | ||
35 | +main.change.skin=Change Skin | ||
36 | +main.skin=Skin | ||
37 | +main.footer.text=Example Application for Demoiselle ${parent.version} | ||
38 | + | ||
39 | +menu.language=Language | ||
40 | +menu.menuitem.language-portuguese=Portuguese | ||
41 | +menu.menuitem.language-english=English | ||
42 | +menu.menuitem.contents=Content | ||
43 | +menu.menuitem.list=List | ||
44 | +menu.menuitem.new=New | ||
45 | +menu.menuitem.quit=Quit |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
2 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | ||
3 | + | ||
4 | + <interceptors> | ||
5 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | ||
6 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | ||
7 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | ||
8 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | ||
9 | + </interceptors> | ||
10 | + | ||
11 | +</beans> |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/faces-config.xml
0 → 100755
@@ -0,0 +1,5 @@ | @@ -0,0 +1,5 @@ | ||
1 | +<?xml version="1.0"?> | ||
2 | +<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" | ||
3 | + 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"> | ||
4 | + | ||
5 | +</faces-config> |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
0 → 100755
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +<?xml version="1.0"?> | ||
2 | +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" | ||
3 | + xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
4 | + version="3.0"> | ||
5 | + | ||
6 | + <!-- If you are using tomcat6/tomcat7/gae then uncomment this listener --> | ||
7 | + <!-- | ||
8 | + <listener> | ||
9 | + <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> | ||
10 | + </listener> | ||
11 | + --> | ||
12 | + | ||
13 | + <!-- If you are using servlet 2.5 then uncomment this listener --> | ||
14 | + <!-- | ||
15 | + <listener> | ||
16 | + <listener-class>br.gov.frameworkdemoiselle.util.ServletListener</listener-class> | ||
17 | + </listener> | ||
18 | + <filter> | ||
19 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
20 | + <filter-class>br.gov.frameworkdemoiselle.util.ServletFilter</filter-class> | ||
21 | + </filter> | ||
22 | + <filter-mapping> | ||
23 | + <filter-name>Demoiselle Servlet Filter</filter-name> | ||
24 | + <url-pattern>/*</url-pattern> | ||
25 | + </filter-mapping> | ||
26 | + --> | ||
27 | + | ||
28 | + <servlet> | ||
29 | + <servlet-name>Faces Servlet</servlet-name> | ||
30 | + <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> | ||
31 | + <load-on-startup>1</load-on-startup> | ||
32 | + </servlet> | ||
33 | + | ||
34 | + <servlet-mapping> | ||
35 | + <servlet-name>Faces Servlet</servlet-name> | ||
36 | + <url-pattern>*.jsf</url-pattern> | ||
37 | + </servlet-mapping> | ||
38 | + | ||
39 | + <security-constraint> | ||
40 | + <display-name>Restrict raw XHTML Documents</display-name> | ||
41 | + <web-resource-collection> | ||
42 | + <web-resource-name>XHTML</web-resource-name> | ||
43 | + <url-pattern>*.xhtml</url-pattern> | ||
44 | + </web-resource-collection> | ||
45 | + <auth-constraint /> | ||
46 | + </security-constraint> | ||
47 | + | ||
48 | +</web-app> |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark_edit.xhtml
0 → 100644
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" | ||
2 | + xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" | ||
3 | + xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml"> | ||
4 | + | ||
5 | + <ui:define name="body"> | ||
6 | + <h:form prependId="false"> | ||
7 | + <p:toolbar> | ||
8 | + <p:toolbarGroup align="left"> | ||
9 | + <p:commandButton value="#{messages['button.save']}" action="#{bookmarkEditMB.insert}" | ||
10 | + rendered="#{!bookmarkEditMB.updateMode}" ajax="false" /> | ||
11 | + <p:commandButton value="#{messages['button.save']}" action="#{bookmarkEditMB.update}" | ||
12 | + rendered="#{bookmarkEditMB.updateMode}" ajax="false" /> | ||
13 | + <p:commandButton value="#{messages['button.delete']}" onclick="confirmation.show()" | ||
14 | + rendered="#{bookmarkEditMB.updateMode}" type="button" immediate="true" ajax="false" /> | ||
15 | + <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode" | ||
16 | + header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation"> | ||
17 | + <h:commandButton value="#{messages['button.dialog.yes']}" action="#{bookmarkEditMB.delete}" immediate="true" | ||
18 | + ajax="false" /> | ||
19 | + <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" /> | ||
20 | + </p:confirmDialog> | ||
21 | + </p:toolbarGroup> | ||
22 | + </p:toolbar> | ||
23 | + | ||
24 | + <br /> | ||
25 | + | ||
26 | + <p:fieldset legend="#{messages['bookmark.label']}" toggleable="true" toggleSpeed="500"> | ||
27 | + <h:panelGrid id="fields" columns="3"> | ||
28 | + <h:outputLabel value="#{messages['bookmark.label.id']}: " for="id" styleClass="text-input" /> | ||
29 | + <h:outputText id="id" value="#{bookmarkEditMB.bean.id}" /> | ||
30 | + <p:message for="id" /> | ||
31 | + | ||
32 | + <h:outputLabel value="#{messages['bookmark.label.description']}: " for="description" styleClass="text-input" /> | ||
33 | + <h:inputText id="description" value="#{bookmarkEditMB.bean.description}" | ||
34 | + title="#{messages['bookmark.alt.description']}" /> | ||
35 | + <p:message for="description" /> | ||
36 | + | ||
37 | + <h:outputLabel value="#{messages['bookmark.label.link']}: " for="link" styleClass="text-input" /> | ||
38 | + <h:inputText id="link" value="#{bookmarkEditMB.bean.link}" title="#{messages['bookmark.alt.link']}" /> | ||
39 | + <p:message for="link" /> | ||
40 | + </h:panelGrid> | ||
41 | + </p:fieldset> | ||
42 | + </h:form> | ||
43 | + </ui:define> | ||
44 | +</ui:composition> | ||
0 | \ No newline at end of file | 45 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark_list.xhtml
0 → 100644
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" | ||
2 | + xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" | ||
3 | + xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml"> | ||
4 | + | ||
5 | + <ui:define name="body"> | ||
6 | + <h:form> | ||
7 | + <p:toolbar> | ||
8 | + <p:toolbarGroup align="left"> | ||
9 | + <p:commandButton title="#{messages['button.new']}" icon="ui-icon-document" action="#{bookmarkListMB.getNextView}" | ||
10 | + actionListener="#{bookmarkListMB.clear}" ajax="false" /> | ||
11 | + | ||
12 | + <p:commandButton title="#{messages['button.delete']}" icon="ui-icon-trash" onclick="confirmation.show()" | ||
13 | + type="button" immediate="true" ajax="false" /> | ||
14 | + | ||
15 | + <p:confirmDialog message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode" | ||
16 | + header="#{messages['label.dialog.alert']}!" severity="alert" widgetVar="confirmation"> | ||
17 | + | ||
18 | + <h:commandButton value="#{messages['button.dialog.yes']}" action="#{bookmarkListMB.deleteSelection}" | ||
19 | + actionListener="#{bookmarkListMB.clear}" /> | ||
20 | + <h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" /> | ||
21 | + </p:confirmDialog> | ||
22 | + </p:toolbarGroup> | ||
23 | + </p:toolbar> | ||
24 | + | ||
25 | + <p:dataTable id="list" var="bean" value="#{bookmarkListMB.resultList}"> | ||
26 | + <f:facet name="header">#{messages['bookmark.list.table.title']}</f:facet> | ||
27 | + <p:column style="width:5%;"> | ||
28 | + <h:selectBooleanCheckbox value="#{bookmarkListMB.selection[bean.id]}" /> | ||
29 | + </p:column> | ||
30 | + <p:column style="width:5%;" sortBy="#{bean.id}"> | ||
31 | + <f:facet name="header">#{messages['bookmark.label.id']}</f:facet> | ||
32 | + <h:outputText value="#{bean.id}" /> | ||
33 | + </p:column> | ||
34 | + <p:column sortBy="#{bean.description}"> | ||
35 | + <f:facet name="header">#{messages['bookmark.label.description']}</f:facet> | ||
36 | + <h:commandLink action="#{bookmarkListMB.getNextView}" actionListener="#{bookmarkListMB.clear}"> | ||
37 | + <h:outputText value="#{bean.description}" /> | ||
38 | + <f:param name="id" value="#{bean.id}" /> | ||
39 | + </h:commandLink> | ||
40 | + </p:column> | ||
41 | + <p:column sortBy="#{bean.link}"> | ||
42 | + <f:facet name="header">#{messages['bookmark.label.link']}</f:facet> | ||
43 | + <h:commandLink action="#{bookmarkListMB.getNextView}" actionListener="#{bookmarkListMB.clear}"> | ||
44 | + <h:outputText value="#{bean.link}" /> | ||
45 | + <f:param name="id" value="#{bean.id}" /> | ||
46 | + </h:commandLink> | ||
47 | + </p:column> | ||
48 | + </p:dataTable> | ||
49 | + </h:form> | ||
50 | + </ui:define> | ||
51 | +</ui:composition> | ||
0 | \ No newline at end of file | 52 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/styles.css
0 → 100644
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +@CHARSET "UTF-8"; | ||
2 | + | ||
3 | +.ui-icon-locale-pt | ||
4 | + ,.ui-icon-locale-en{ | ||
5 | + width: 32px; | ||
6 | + height: 31px; | ||
7 | + background-position: center; | ||
8 | + display: block; | ||
9 | + float: left; | ||
10 | + background-repeat: no-repeat; | ||
11 | +} | ||
12 | + | ||
13 | +.ui-icon-locale-pt{ | ||
14 | + background-image: url("../images/locale_pt.png"); | ||
15 | +} | ||
16 | + | ||
17 | +.ui-icon-locale-en{ | ||
18 | + background-image: url("../images/locale_en.png"); | ||
19 | +} | ||
0 | \ No newline at end of file | 20 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/images/locale_en.png
0 → 100644
1.95 KB
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/images/locale_pt.png
0 → 100644
2.16 KB
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/images/logo.png
0 → 100644
7.21 KB
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html
0 → 100644
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.xhtml
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" | ||
2 | + xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" | ||
3 | + xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml"> | ||
4 | + | ||
5 | + <ui:define name="body"> | ||
6 | + <p:panel> | ||
7 | + #{messages['main.app.welcome']} | ||
8 | + </p:panel> | ||
9 | + </ui:define> | ||
10 | + | ||
11 | +</ui:composition> | ||
0 | \ No newline at end of file | 12 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.xhtml
0 → 100644
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" | ||
2 | + xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" | ||
3 | + xmlns:ui="http://java.sun.com/jsf/facelets"> | ||
4 | + | ||
5 | + <h:form> | ||
6 | + <p:menubar> | ||
7 | + <p:submenu label="#{messages['menu.bookmark']}"> | ||
8 | + <p:menuitem value="#{messages['menu.menuitem.new']}" url="/bookmark_edit.jsf" /> | ||
9 | + <p:menuitem value="#{messages['menu.menuitem.list']}" url="/bookmark_list.jsf" /> | ||
10 | + </p:submenu> | ||
11 | + | ||
12 | + <p:menuitem value="#{messages['menu.menuitem.quit']}" url="http://www.frameworkdemoiselle.gov.br/" | ||
13 | + action="#{securityContext.logout}" /> | ||
14 | + </p:menubar> | ||
15 | + </h:form> | ||
16 | + | ||
17 | +</ui:composition> | ||
0 | \ No newline at end of file | 18 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/template/main.xhtml
0 → 100644
@@ -0,0 +1,51 @@ | @@ -0,0 +1,51 @@ | ||
1 | +<html xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" | ||
2 | + xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> | ||
3 | + | ||
4 | +<f:view contentType="text/html" locale="#{locales.currentLocale}" /> | ||
5 | + | ||
6 | +<h:head> | ||
7 | + <title>#{messages['main.app.title']}</title> | ||
8 | + <link type="text/css" rel="stylesheet" href="css/styles.css" /> | ||
9 | +</h:head> | ||
10 | + | ||
11 | +<h:body style="background-color:#f1f1f1"> | ||
12 | + <table style="width: 100%"> | ||
13 | + <tr> | ||
14 | + <td height="70" align="left"> | ||
15 | + <a href="index.jsf"><img src="images/logo.png" border="0" /></a> | ||
16 | + <div style="float: right;"> | ||
17 | + <h:form id="language_form" prependId="true"> | ||
18 | + <h:commandLink action="#{locales.setCurrentLocale('pt')}"> | ||
19 | + <span class="ui-icon-locale-pt" ></span> | ||
20 | + </h:commandLink> | ||
21 | + <h:commandLink action="#{locales.setCurrentLocale('en')}"> | ||
22 | + <span class="ui-icon-locale-en" ></span> | ||
23 | + </h:commandLink> | ||
24 | + </h:form> | ||
25 | + </div> | ||
26 | + </td> | ||
27 | + </tr> | ||
28 | + <tr> | ||
29 | + <td height="20"><ui:include src="/menu.xhtml" /></td> | ||
30 | + </tr> | ||
31 | + <tr valign="top"> | ||
32 | + <td height="400"><ui:insert name="body" /></td> | ||
33 | + </tr> | ||
34 | + <tr align="center"> | ||
35 | + <td height="20" align="center" class="text-input">#{messages['main.footer.text']}</td> | ||
36 | + </tr> | ||
37 | + </table> | ||
38 | + | ||
39 | + <p:growl id="messages" globalOnly="true" /> | ||
40 | + | ||
41 | + <p:ajaxStatus style="width:16px;height:16px;"> | ||
42 | + <f:facet name="start"> | ||
43 | + </f:facet> | ||
44 | + | ||
45 | + <f:facet name="complete"> | ||
46 | + <h:outputText value="" /> | ||
47 | + </f:facet> | ||
48 | + </p:ajaxStatus> | ||
49 | + <link type="text/css" rel="stylesheet" href="css/aristo/skin.css" /> | ||
50 | +</h:body> | ||
51 | +</html> | ||
0 | \ No newline at end of file | 52 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/test/java/business/BookmarkBCTest.java
0 → 100644
@@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
1 | +package ${package}.business; | ||
2 | + | ||
3 | +import static org.junit.Assert.assertEquals; | ||
4 | +import static org.junit.Assert.assertNotNull; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +import javax.inject.Inject; | ||
9 | + | ||
10 | +import org.junit.Before; | ||
11 | +import org.junit.Test; | ||
12 | +import org.junit.runner.RunWith; | ||
13 | + | ||
14 | +import br.gov.frameworkdemoiselle.junit.DemoiselleRunner; | ||
15 | +import ${package}.domain.Bookmark; | ||
16 | + | ||
17 | +@RunWith(DemoiselleRunner.class) | ||
18 | +public class BookmarkBCTest { | ||
19 | + | ||
20 | + @Inject | ||
21 | + private BookmarkBC bookmarkBC; | ||
22 | + | ||
23 | + @Before | ||
24 | + public void before() { | ||
25 | + for (Bookmark bookmark : bookmarkBC.findAll()) { | ||
26 | + bookmarkBC.delete(bookmark.getId()); | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | + @Test | ||
31 | + public void testLoad() { | ||
32 | + bookmarkBC.load(); | ||
33 | + List<Bookmark> listaBookmarks = bookmarkBC.findAll(); | ||
34 | + assertNotNull(listaBookmarks); | ||
35 | + assertEquals(10, listaBookmarks.size()); | ||
36 | + } | ||
37 | + | ||
38 | + @Test | ||
39 | + public void testInsert() { | ||
40 | + Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br"); | ||
41 | + bookmarkBC.insert(bookmark); | ||
42 | + List<Bookmark> listaBookmarks = bookmarkBC.findAll(); | ||
43 | + assertNotNull(listaBookmarks); | ||
44 | + assertEquals(1, listaBookmarks.size()); | ||
45 | + } | ||
46 | + | ||
47 | + @Test | ||
48 | + public void testDelete() { | ||
49 | + Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br"); | ||
50 | + bookmarkBC.insert(bookmark); | ||
51 | + | ||
52 | + List<Bookmark> listaBookmarks = bookmarkBC.findAll(); | ||
53 | + assertNotNull(listaBookmarks); | ||
54 | + assertEquals(1, listaBookmarks.size()); | ||
55 | + | ||
56 | + bookmarkBC.delete(bookmark.getId()); | ||
57 | + listaBookmarks = bookmarkBC.findAll(); | ||
58 | + assertEquals(0, listaBookmarks.size()); | ||
59 | + } | ||
60 | + @Test | ||
61 | + public void testUpdate() { | ||
62 | + Bookmark bookmark = new Bookmark("Demoiselle Portal", "http://www.frameworkdemoiselle.gov.br"); | ||
63 | + bookmarkBC.insert(bookmark); | ||
64 | + | ||
65 | + List<Bookmark> listaBookmarks = bookmarkBC.findAll(); | ||
66 | + Bookmark bookmark2 = (Bookmark)listaBookmarks.get(0); | ||
67 | + assertNotNull(listaBookmarks); | ||
68 | + assertEquals("Demoiselle Portal", bookmark2.getDescription()); | ||
69 | + | ||
70 | + bookmark2.setDescription("Demoiselle Portal alterado"); | ||
71 | + bookmarkBC.update(bookmark2); | ||
72 | + | ||
73 | + listaBookmarks = bookmarkBC.findAll(); | ||
74 | + Bookmark bookmark3 = (Bookmark)listaBookmarks.get(0); | ||
75 | + assertEquals("Demoiselle Portal alterado", bookmark3.getDescription()); | ||
76 | + } | ||
77 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/beans.xml
0 → 100644
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
2 | + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"> | ||
3 | + | ||
4 | + <interceptors> | ||
5 | + <class>br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor</class> | ||
6 | + <class>br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor</class> | ||
7 | + <class>br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor</class> | ||
8 | + <class>br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor</class> | ||
9 | + </interceptors> | ||
10 | + | ||
11 | +</beans> |
archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/META-INF/persistence.xml
0 → 100644
@@ -0,0 +1,60 @@ | @@ -0,0 +1,60 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> | ||
4 | + | ||
5 | + <!-- If you are using tomcat6/tomcat7/junit then use this persistence-unit --> | ||
6 | + <!-- | ||
7 | + --> | ||
8 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
9 | + | ||
10 | + <class>${package}.domain.Bookmark</class> | ||
11 | + | ||
12 | + <properties> | ||
13 | + <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" /> | ||
14 | + <property name="javax.persistence.jdbc.user" value="sa" /> | ||
15 | + <property name="javax.persistence.jdbc.password" value="" /> | ||
16 | + <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:." /> | ||
17 | + | ||
18 | + <property name="hibernate.show_sql" value="true" /> | ||
19 | + <property name="hibernate.format_sql" value="false" /> | ||
20 | + <property name="hibernate.hbm2ddl.auto" value="create-drop" /> | ||
21 | + | ||
22 | + <property name="eclipselink.logging.level" value="FINE" /> | ||
23 | + <property name="eclipselink.ddl-generation" value="create-tables" /> | ||
24 | + <property name="eclipselink.ddl-generation.output-mode" value="database" /> | ||
25 | + </properties> | ||
26 | + </persistence-unit> | ||
27 | + | ||
28 | + <!-- If you are using jboss6 with non JTA transaction then use this persistence-unit --> | ||
29 | + <!-- | ||
30 | + <persistence-unit name="bookmark-ds" transaction-type="RESOURCE_LOCAL"> | ||
31 | + <non-jta-data-source>java:/DefaultDS</non-jta-data-source> | ||
32 | + | ||
33 | + <class>${package}.domain.Bookmark</class> | ||
34 | + | ||
35 | + <properties> | ||
36 | + <property name="hibernate.show_sql" value="true" /> | ||
37 | + <property name="hibernate.format_sql" value="false" /> | ||
38 | + <property name="hibernate.hbm2ddl.auto" value="update" /> | ||
39 | + <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> | ||
40 | + </properties> | ||
41 | + </persistence-unit> | ||
42 | + --> | ||
43 | + | ||
44 | + <!-- If you are using jboss6 with JTA transaction then use this persistence-unit --> | ||
45 | + <!-- | ||
46 | + <persistence-unit name="bookmark-ds" transaction-type="JTA"> | ||
47 | + <jta-data-source>java:/DefaultDS</jta-data-source> | ||
48 | + | ||
49 | + <class>${package}.domain.Bookmark</class> | ||
50 | + | ||
51 | + <properties> | ||
52 | + <property name="hibernate.show_sql" value="true" /> | ||
53 | + <property name="hibernate.format_sql" value="false" /> | ||
54 | + <property name="hibernate.hbm2ddl.auto" value="update" /> | ||
55 | + <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" /> | ||
56 | + </properties> | ||
57 | + </persistence-unit> | ||
58 | + --> | ||
59 | + | ||
60 | +</persistence> | ||
0 | \ No newline at end of file | 61 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/test/resources/demoiselle.properties
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +frameworkdemoiselle.transaction.class=br.gov.frameworkdemoiselle.transaction.JPATransaction |
impl/extension/jpa/src/main/java/br/gov/frameworkdemoiselle/template/JPACrud.java
@@ -218,7 +218,7 @@ public class JPACrud<T, I> implements Crud<T, I> { | @@ -218,7 +218,7 @@ public class JPACrud<T, I> implements Crud<T, I> { | ||
218 | */ | 218 | */ |
219 | protected List<T> findByJPQL(String jpql) { | 219 | protected List<T> findByJPQL(String jpql) { |
220 | TypedQuery<T> listQuery = getEntityManager().createQuery(jpql, getBeanClass()); | 220 | TypedQuery<T> listQuery = getEntityManager().createQuery(jpql, getBeanClass()); |
221 | - | 221 | + |
222 | if (getPagination() != null) { | 222 | if (getPagination() != null) { |
223 | String countQuery = createCountQuery(jpql); | 223 | String countQuery = createCountQuery(jpql); |
224 | Query query = getEntityManager().createQuery(countQuery); | 224 | Query query = getEntityManager().createQuery(countQuery); |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/BadRequestException.java
0 → 100644
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +package br.gov.frameworkdemoiselle; | ||
2 | + | ||
3 | +import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; | ||
4 | + | ||
5 | +import javax.xml.ws.http.HTTPException; | ||
6 | + | ||
7 | +public class BadRequestException extends HTTPException { | ||
8 | + | ||
9 | + private static final long serialVersionUID = 1L; | ||
10 | + | ||
11 | + public BadRequestException() { | ||
12 | + super(SC_BAD_REQUEST); | ||
13 | + } | ||
14 | +} |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/NotFoundException.java
0 → 100644
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +package br.gov.frameworkdemoiselle; | ||
2 | + | ||
3 | +import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; | ||
4 | + | ||
5 | +import javax.xml.ws.http.HTTPException; | ||
6 | + | ||
7 | +public class NotFoundException extends HTTPException { | ||
8 | + | ||
9 | + private static final long serialVersionUID = 1L; | ||
10 | + | ||
11 | + public NotFoundException() { | ||
12 | + super(SC_NOT_FOUND); | ||
13 | + } | ||
14 | +} |
impl/extension/rest/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/HTTPExceptionMapper.java
0 → 100644
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +package br.gov.frameworkdemoiselle.internal.implementation; | ||
2 | + | ||
3 | +import javax.ws.rs.core.Response; | ||
4 | +import javax.ws.rs.ext.ExceptionMapper; | ||
5 | +import javax.ws.rs.ext.Provider; | ||
6 | +import javax.xml.ws.http.HTTPException; | ||
7 | + | ||
8 | +@Provider | ||
9 | +public class HTTPExceptionMapper implements ExceptionMapper<HTTPException> { | ||
10 | + | ||
11 | + @Override | ||
12 | + public Response toResponse(HTTPException exception) { | ||
13 | + return Response.status(exception.getStatusCode()).build(); | ||
14 | + } | ||
15 | +} |
impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/BasicAuthFilter.java
@@ -53,6 +53,7 @@ import javax.servlet.http.HttpServletResponse; | @@ -53,6 +53,7 @@ import javax.servlet.http.HttpServletResponse; | ||
53 | 53 | ||
54 | import org.apache.commons.codec.binary.Base64; | 54 | import org.apache.commons.codec.binary.Base64; |
55 | 55 | ||
56 | +import br.gov.frameworkdemoiselle.security.AuthenticationException; | ||
56 | import br.gov.frameworkdemoiselle.security.Credentials; | 57 | import br.gov.frameworkdemoiselle.security.Credentials; |
57 | import br.gov.frameworkdemoiselle.security.InvalidCredentialsException; | 58 | import br.gov.frameworkdemoiselle.security.InvalidCredentialsException; |
58 | import br.gov.frameworkdemoiselle.security.SecurityContext; | 59 | import br.gov.frameworkdemoiselle.security.SecurityContext; |
@@ -102,7 +103,7 @@ public class BasicAuthFilter implements Filter { | @@ -102,7 +103,7 @@ public class BasicAuthFilter implements Filter { | ||
102 | Beans.getReference(SecurityContext.class).logout(); | 103 | Beans.getReference(SecurityContext.class).logout(); |
103 | } | 104 | } |
104 | 105 | ||
105 | - private void setUnauthorizedStatus(HttpServletResponse response, Exception cause) throws IOException { | 106 | + private void setUnauthorizedStatus(HttpServletResponse response, AuthenticationException cause) throws IOException { |
106 | response.setStatus(SC_UNAUTHORIZED); | 107 | response.setStatus(SC_UNAUTHORIZED); |
107 | response.setContentType("text/html"); | 108 | response.setContentType("text/html"); |
108 | 109 |
parent/rest/pom.xml
@@ -71,12 +71,6 @@ | @@ -71,12 +71,6 @@ | ||
71 | <groupId>br.gov.frameworkdemoiselle</groupId> | 71 | <groupId>br.gov.frameworkdemoiselle</groupId> |
72 | <artifactId>demoiselle-rest</artifactId> | 72 | <artifactId>demoiselle-rest</artifactId> |
73 | <scope>compile</scope> | 73 | <scope>compile</scope> |
74 | - <exclusions> | ||
75 | - <exclusion> | ||
76 | - <groupId>javax.ws.rs</groupId> | ||
77 | - <artifactId>jsr311-api</artifactId> | ||
78 | - </exclusion> | ||
79 | - </exclusions> | ||
80 | </dependency> | 74 | </dependency> |
81 | </dependencies> | 75 | </dependencies> |
82 | 76 |
pom.xml
@@ -74,11 +74,12 @@ | @@ -74,11 +74,12 @@ | ||
74 | <module>impl/extension/servlet</module> | 74 | <module>impl/extension/servlet</module> |
75 | <module>impl/extension/rest</module> | 75 | <module>impl/extension/rest</module> |
76 | <module>impl/extension/jmx</module> | 76 | <module>impl/extension/jmx</module> |
77 | -<!-- | 77 | + <!-- |
78 | <module>impl/extension/jaas</module> | 78 | <module>impl/extension/jaas</module> |
79 | ---> | 79 | + --> |
80 | <module>archetype/minimal</module> | 80 | <module>archetype/minimal</module> |
81 | <module>archetype/jsf-jpa</module> | 81 | <module>archetype/jsf-jpa</module> |
82 | + <module>archetype/html-rest</module> | ||
82 | <module>documentation/quickstart</module> | 83 | <module>documentation/quickstart</module> |
83 | <module>documentation/reference</module> | 84 | <module>documentation/reference</module> |
84 | </modules> | 85 | </modules> |