├── .gitignore ├── LICENSE ├── README.md ├── docs ├── chapters │ ├── acks.adoc │ ├── appendix.adoc │ ├── batch.adoc │ ├── conclusion.adoc │ ├── introduction.adoc │ ├── jaxrs.adoc │ ├── jms.adoc │ ├── jsf.adoc │ ├── json.adoc │ ├── revision.adoc │ ├── solutions.adoc │ ├── statement.adoc │ ├── todo.adoc │ ├── troubleshooting.adoc │ ├── walkthrough.adoc │ └── websocket.adoc ├── convert.sh ├── images │ ├── 1.1-netbeans-download.png │ ├── 11-wildfly-server-log.png │ ├── 16-netbeans-add-dev-update-center.png │ ├── 16-netbeans-add-instance-wildfly.png │ ├── 16-netbeans-available-plugins-wildfly.png │ ├── 16-netbeans-wildfly-full-platform.png │ ├── 16-netbeans-wildfly-server.png │ ├── 2.0-problem-statement.png │ ├── 2.0-technologies.png │ ├── 2.1-fix-imports.png │ ├── 2.1-format.png │ ├── 2.1-server-endpoint.png │ ├── 3.2-persistence-xml.png │ ├── 3.2-project-structure.png │ ├── 3.4-missing-server.png │ ├── 3.5-schema.png │ ├── 3.6-glassfish-server.png │ ├── 3.6-wildfly-server.png │ ├── 3.8-first-page.png │ ├── 4.2-imports.png │ ├── 4.4-template.png │ ├── 4.6-chatroom.png │ ├── 4.8-chatroom-joined.png │ ├── 4.8-chatroom-two-browsers.png │ ├── 4.8-chatroom.png │ ├── 5.0-batch-intro.png │ ├── 5.10-imports.png │ ├── 5.14-sales.png │ ├── 5.15-sales.png │ ├── 5.16-sales-output.png │ ├── 6.12-output.png │ ├── 6.14-output.png │ ├── 6.2-imports.png │ ├── 6.6-imports.png │ ├── 6.8-output.png │ ├── 7.11-imports.png │ ├── 7.14-imports.png │ ├── 7.15-output.png │ ├── 7.16-output.png │ ├── 7.16-output2.png │ ├── 7.2-imports.png │ ├── 7.3-implements.png │ ├── 7.6-imports.png │ ├── 7.7-implements.png │ ├── 8.10-output.png │ ├── 8.10-output2.png │ ├── 8.10-output3.png │ ├── 8.10-output4.png │ ├── 8.10-output5.png │ ├── 8.10-output6.png │ ├── 8.10-output7.png │ ├── 8.2-imports.png │ ├── 9.11-output.png │ ├── 9.11-output2.png │ ├── 9.11-output3.png │ ├── 9.11-output4.png │ ├── 9.11-output5.png │ ├── 9.3-imports.png │ ├── block-diagram.key │ ├── i13-back-icon.png │ ├── i13-ellipsis-button.png │ ├── i13-exclamation-mark-icon.png │ ├── i13-glassfish-defined.png │ ├── i13-glassfish-fix-deployment.png │ ├── i13-glassfish-fix-domain.png │ ├── i13-glassfish-fix-url.png │ ├── i13-glassfish-home-directory.png │ ├── i13-glassfish-server-dialog-final.png │ ├── i13-glassfish-server-dialog-initial.png │ ├── i13-glassfish-start-database.png │ ├── i13-initial-project-structure.png │ ├── i13-jboss-defined.png │ ├── i13-jboss-fix-deployment.png │ ├── i13-jboss-fix-extension.png │ ├── i13-jboss-home-directory.png │ ├── i13-jboss-invalid-extension.png │ ├── i13-jboss-server-dialog-final.png │ ├── i13-jboss-server-dialog-initial.png │ ├── i13-jboss-url-fixed.png │ ├── i13-jdk-defined.png │ ├── i13-jdk-home.png │ ├── i13-jpa-detected-event-log.png │ ├── i13-jpa-detected-status-bar.png │ ├── i13-jpa-detected.png │ ├── i13-open-project.png │ ├── i13-open-terminal.png │ ├── i13-plus-glassfish.png │ ├── i13-plus-icon.png │ ├── i13-plus-jboss.png │ ├── i13-plus-jdk.png │ ├── i13-project-sdk.png │ ├── i13-run-configs-plus-glassfish.png │ ├── i13-run-configs-plus-jboss.png │ ├── i13-run-edit-configurations.png │ ├── i13-run-glassfish.png │ ├── i13-run-icon.png │ ├── i13-run-tool-window-glassfish.png │ ├── i13-run-tool-window-wildfly.png │ ├── i13-run-wildfly.png │ ├── i13-select-pom.png │ ├── i13-setup-frameworks-jpa.png │ ├── i13-show-tool-windows-icon.png │ ├── i13-starting-page-in-browser.png │ ├── i13-welcome-configure.png │ ├── idea-add-glassfish-server-configuration.png │ ├── idea-configure-jpa-dialogbox.png │ ├── idea-configure-jpa.png │ ├── idea-convertproject.png │ ├── idea-edit-glassfish-server-configuration-DeploymentTab.png │ ├── idea-edit-glassfish-server-configuration-servertab.png │ ├── idea-mavenprojects-run-package-command.png │ ├── idea-open-mavenprojects-pane.png │ ├── netbeans-addserver.png │ └── netbeans-view-log.png ├── javaee7-hol.adoc ├── javaee7-hol.html ├── javaee7-hol.pdf └── javaee7-hol.xml ├── solution ├── movieplex7-1.0-SNAPSHOT.war ├── movieplex7-solution.zip └── movieplex7 │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── org │ │ └── javaee7 │ │ └── movieplex7 │ │ ├── batch │ │ ├── SalesBean.java │ │ ├── SalesProcessor.java │ │ ├── SalesReader.java │ │ └── SalesWriter.java │ │ ├── booking │ │ └── Booking.java │ │ ├── chat │ │ └── ChatServer.java │ │ ├── client │ │ ├── MovieBackingBean.java │ │ └── MovieClientBean.java │ │ ├── entities │ │ ├── Movie.java │ │ ├── Sales.java │ │ ├── ShowTiming.java │ │ ├── Theater.java │ │ └── Timeslot.java │ │ ├── json │ │ ├── MovieReader.java │ │ └── MovieWriter.java │ │ ├── points │ │ ├── ReceivePointsBean.java │ │ └── SendPointsBean.java │ │ └── rest │ │ ├── AbstractFacade.java │ │ ├── ApplicationConfig.java │ │ ├── MovieFacadeREST.java │ │ ├── SalesFacadeREST.java │ │ ├── ShowTimingFacadeREST.java │ │ ├── TheaterFacadeREST.java │ │ └── TimeslotFacadeREST.java │ ├── resources │ └── META-INF │ │ ├── batch-jobs │ │ └── eod-sales.xml │ │ ├── create.sql │ │ ├── drop.sql │ │ ├── load.sql │ │ ├── persistence.xml │ │ └── sales.csv │ └── webapp │ ├── WEB-INF │ ├── faces-config.xml │ ├── template.xhtml │ └── web.xml │ ├── batch │ └── sales.xhtml │ ├── booking │ ├── booking-flow.xml │ ├── booking.xhtml │ ├── confirm.xhtml │ ├── print.xhtml │ └── showtimes.xhtml │ ├── chat │ ├── chatroom.xhtml │ └── websocket.js │ ├── client │ ├── addmovie.xhtml │ ├── movie.xhtml │ └── movies.xhtml │ ├── index.xhtml │ ├── points │ └── points.xhtml │ └── resources │ └── css │ ├── cssLayout.css │ └── default.css └── starting-template ├── movieplex7-starting-template.zip └── movieplex7 ├── pom.xml └── src └── main ├── java └── org │ └── javaee7 │ └── movieplex7 │ ├── entities │ ├── Movie.java │ ├── Sales.java │ ├── ShowTiming.java │ ├── Theater.java │ └── Timeslot.java │ └── rest │ ├── AbstractFacade.java │ ├── ApplicationConfig.java │ ├── MovieFacadeREST.java │ ├── ShowTimingFacadeREST.java │ ├── TheaterFacadeREST.java │ └── TimeslotFacadeREST.java ├── resources └── META-INF │ ├── create.sql │ ├── drop.sql │ ├── load.sql │ ├── persistence.xml │ └── sales.csv └── webapp ├── WEB-INF ├── template.xhtml └── web.xml ├── index.xhtml └── resources └── css ├── cssLayout.css └── default.css /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /starting-template/movieplex7/target/ 3 | /starting-template/tmp/movieplex7/target/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Java EE 7 Hands-on Lab 2 | ====================== 3 | 4 | This repository contains all sources for the Java EE 7 hands-on lab. 5 | 6 | -------------------------------------------------------------------------------- /docs/chapters/acks.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Acknowledgements 4 | 5 | The following Java EE community members graciously reviewed and contributed to this hands-on lab: 6 | 7 | * Antonio Goncalves (http://twitter.com/agoncal[@agoncal]) 8 | * Markus Eisele (http://twitter.com/myfear[@myfear]) 9 | * Craig Sharpe (http://twitter.com/dapugs[@dapugs]) 10 | * Marcus Vinicius Margarites (http://twitter.com/mvfm[@mvfm]) 11 | * David Delabasse (http://twitter.com/delabasse[@delabasse]) 12 | * John Clingan (http://twitter.com/jclingan[@jclingan]) 13 | * Reza Rahman (http://twitter.com/reza_rahman[@reza_rahman]) 14 | * Marian Muller (http://twitter.com/mullermarian[@mullermarian]) 15 | * Jason Porter (http://twitter.com/lightguardjp[@lightguardjp]) 16 | * Dan Allen (http://twitter.com/mojavelinux[@mojavelinux]) 17 | * Andrey Cheptsov (http://twitter.com/andrey_cheptsov[@andrey_cheptsov]) 18 | 19 | Thank you very much for providing the valuable feedback! 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/chapters/conclusion.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Conclusion 4 | 5 | This hands-on lab built a trivial 3-tier web application using Java EE 7 6 | and demonstrated the following features of the platform: 7 | 8 | 9 | . Java EE 7 Platform 10 | .. Maven coordinates 11 | .. Default DataSource 12 | .. Default JMSConnectionFactory 13 | . Java API for WebSocket 1.0 14 | .. Annotated server endpoint 15 | .. JavaScript client 16 | . Batch Applications for the Java Platform 1.0 17 | .. Chunk-style processing 18 | .. Exception handling 19 | . Java API for JSON Processing 1.0 20 | .. Streaming API for generating JSON 21 | .. Streaming API for consuming JSON 22 | . Java API for RESTful Web Services 2.0 23 | .. Client API 24 | .. Custom Entity Providers 25 | . Java Message Service 2.0 26 | .. Default ConnectionFactory 27 | .. Injecting JMSContext 28 | .. Synchronous message send and receive 29 | . Contexts and Dependency Injection 1.1 30 | .. Automatic discovery of beans 31 | .. Injection of beans 32 | . JavaServer Faces 2.2 33 | .. Faces Flow 34 | . Bean Validation 1.1 35 | .. Integration with JavaServer Faces 36 | . Java Transaction API 1.2 37 | .. @Transactional 38 | . Java Persistence API 2.1 39 | .. Schema generation properties 40 | 41 | Hopefully this has raised your interest enough in trying out Java EE 7 applications using 42 | ifdef::server-glassfish[] 43 | GlassFish 4. 44 | endif::server-glassfish[] 45 | ifdef::server-wildfly[] 46 | WildFly 8. 47 | endif::server-wildfly[] 48 | 49 | Send us feedback or file issues at http://github.com/javaee-samples/javaee7-hol. 50 | 51 | -------------------------------------------------------------------------------- /docs/chapters/introduction.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Introduction 4 | 5 | The Java EE 7 platform continues the ease of development push that 6 | characterized prior releases by bringing further simplification to 7 | enterprise development. It adds new and important APIs such as the REST 8 | client API in JAX-RS 2.0 and the long awaited Batch Processing API. Java 9 | Message Service 2.0 has undergone an extreme makeover to align with the 10 | improvements in the Java language. There are plenty of improvements to 11 | several other components. Newer web standards like HTML 5, WebSocket, 12 | and JSON processing are embraced to build modern web applications. 13 | 14 | This hands-on lab will build a typical 3-tier end-to-end application 15 | using the following Java EE 7 technologies: 16 | 17 | * Java API for WebSocket 1.0 (JSR 356) 18 | * Batch Applications for the Java Platform 1.0 (JSR 352) 19 | * Java API for JSON Processing 1.0 (JSR 353) 20 | * Java API for RESTful Web Services 2.0 (JSR 339) 21 | * Java Message Service 2.0 (JSR 343) 22 | * Java Persistence API 2.1 (JSR 338) 23 | * JavaServer Faces 2.2 (JSR 344) 24 | * Contexts and Dependency Injection 1.1 (JSR 346) 25 | * Bean Validation 1.1 (JSR 349) 26 | * Java Transaction API 1.2 (JSR 907) 27 | 28 | Together these APIs will allow you to be more productive by simplifying enterprise development. 29 | 30 | The latest version of this document can be downloaded from https://github.com/javaee-samples/javaee7-hol/blob/master/docs/asciidoc/javaee7-hol.html[javaee7-hol.html]. Please file issues or send pull requests for any updates. 31 | 32 | === Software Requirement 33 | 34 | The following software needs to be downloaded and installed: 35 | 36 | * JDK 7 from 37 | http://www.oracle.com/technetwork/java/javase/downloads/index.html[http://www.oracle.com/technetwork/java/javase/downloads/index.html]. 38 | * *Application Server*: This lab can use WildFly 8 or GlassFish 4 as the application server. This document provides instructions for 39 | ifdef::server-wildfly[WildFly 8.] 40 | ifdef::server-glassfish[GlassFish.] 41 | * *IDE*: NetBeans 8.0+, JBoss Developer Studio (Eclipse-based), or IntelliJ IDEA 13 can be used. This document provides instructions for 42 | ifdef::ide-netbeans[] 43 | NetBeans 8. 44 | + 45 | Download ``All'' or ``Java EE'' version from 46 | http://netbeans.org/downloads/[http://netbeans.org/downloads/]. A 47 | snapshot of the downloads page is shown and highlights the exact 48 | `Download' button to be clicked. 49 | + 50 | .NetBeans download 51 | image::1.1-netbeans-download.png[] 52 | endif::ide-netbeans[] 53 | + 54 | ifdef::server-glassfish[] 55 | GlassFish 4 comes pre-bundled with NetBeans 7.4+ and does not need to be downloaded explicitly. But if you want to download GlassFish 4 then can do so from http://glassfish.org/[glassfish.org]. 56 | + 57 | TIP: If you have downloaded GlassFish 4 separately or using a pre-installed version of GlassFish 4, then configure it in NetBeans IDE following the instructions in <>. 58 | + 59 | TIP: <> explains how to configure GlassFish in IntelliJ IDEA. 60 | endif::server-glassfish[] 61 | ifdef::server-wildfly[] 62 | WildFly 8 needs to be downloaded from http://wildfly.org/downloads/[wildfly.org] and configured in NetBeans IDE following the instructions in <>. 63 | + 64 | TIP: <> explains how to configure WildFly in IntelliJ IDEA. 65 | endif::server-wildfly[] 66 | -------------------------------------------------------------------------------- /docs/chapters/revision.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Revision History 4 | 5 | . Cleaned up NetBeans instructions and some other typos from DevoxxUK (Jun 25, 2014) 6 | . Added IntelliJ IDEA specific instructions (Jan 22, 2014) 7 | . Added macros to generate WildFly and GlassFish-server specific instructions. Also enabled IntelliJ and Eclipse specific macros (Jan 10, 2014) 8 | . Moving the source document from Pages to AsciiDoc (Dec 3, 2013) 9 | 10 | -------------------------------------------------------------------------------- /docs/chapters/solutions.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Completed Solutions 4 | 5 | The completed solution for this lab can be downloaded from https://github.com/javaee-samples/javaee7-hol/blob/master/solution/movieplex7-solution.zip[javaee7-hol]. 6 | 7 | -------------------------------------------------------------------------------- /docs/chapters/todo.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == TODO 4 | 5 | . Add the following use cases: 6 | .. Concurrency Utilities for Java EE 7 | .. WebSocket Java Client 8 | . Disable errors in persistence.xml 9 | . Add icons for Fix Imports, Format, Fix namespaces, Run the Project. 10 | . Change logging to use java.util.Logging. 11 | 12 | -------------------------------------------------------------------------------- /docs/chapters/troubleshooting.adoc: -------------------------------------------------------------------------------- 1 | :imagesdir: ../images 2 | 3 | == Troubleshooting 4 | 5 | [qanda] 6 | How can I start/stop/restart the application server from within the IDE ?:: 7 | In the `Services' tab, right-click on 8 | ifdef::server-glassfish[] 9 | `GlassFish Server 4'. 10 | endif::server-glassfish[] 11 | ifdef::server-wildfly[] 12 | `WildFly 8'. 13 | endif::server-wildfly[] 14 | All the commands to start, stop, and restart are available from the pop-up menu. 15 | 16 | I accidentally closed the output log window. How do I bring it back ?:: 17 | In “Services” tab of NetBeans, expand `Servers', choose the application server 18 | node, and select 19 | ifdef::server-glassfish[] 20 | `View Domain Server Log'. 21 | + 22 | image::netbeans-view-log.png[title="View GlassFish server log in NetBeans"] 23 | endif::server-glassfish[] 24 | ifdef::server-wildfly[] 25 | `View Server Log'. 26 | + 27 | image::11-wildfly-server-log.png[title="View WildFly server log in NetBeans"] 28 | endif::server-wildfly[] 29 | + 30 | In addition, the web-based administration console can be seen by clicking on 31 | ifdef::server-glassfish[] 32 | `View Domain Admin Console'. 33 | endif::server-glassfish[] 34 | ifdef::server-wildfly[] 35 | `View Admin Console'. 36 | endif::server-wildfly[] 37 | 38 | -------------------------------------------------------------------------------- /docs/convert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run using: 4 | # 5 | # ./convert.sh 6 | # 7 | # or 8 | # 9 | # ./convert.sh html,pdf 10 | # 11 | # ...where the first argument is a comma-delimited list of formats 12 | 13 | # Program paths 14 | ASCIIDOCTOR=asciidoctor 15 | FOPUB=~/tools/asciidoctor-fopub/fopub 16 | ASCIIDOCTOR_PDF=~/tools/asciidoctor-pdf/bin/asciidoctor-pdf 17 | #FOPUB=~/projects/asciidoctor/fopub/fopub 18 | #ASCIIDOCTOR_PDF=~/projects/asciidoctor/asciidoctor-pdf/bin/asciidoctor-pdf 19 | 20 | # File names 21 | MASTER_ADOC=javaee7-hol.adoc 22 | MASTER_DOCBOOK=${MASTER_ADOC/.adoc/.xml} 23 | 24 | # Command options 25 | SHARED_OPTIONS='-a numbered -a experimental -a source-highlighter=coderay -a imagesdir=images' 26 | 27 | # Formats 28 | if [ ! -z $1 ]; then 29 | read -a FORMATS <<<$(IFS=','; echo $1) 30 | else 31 | FORMATS=(html 32 | docbook 33 | fopdf) 34 | fi 35 | 36 | for f in ${FORMATS[*]}; do 37 | if [ $f == 'html' ]; then 38 | echo "Converting to HTML ..." 39 | $ASCIIDOCTOR -v $SHARED_OPTIONS $MASTER_ADOC 40 | elif [ $f == 'docbook' ]; then 41 | echo "Converting to DocBook ..." 42 | $ASCIIDOCTOR -b docbook $SHARED_OPTIONS $MASTER_ADOC 43 | elif [ $f == 'fopdf' ]; then 44 | echo "Converting to FO-PDF ..." 45 | $FOPUB $MASTER_DOCBOOK 46 | elif [ $f == 'pdf' ]; then 47 | echo "Converting to PDF ..." 48 | $ASCIIDOCTOR_PDF $SHARED_OPTIONS $MASTER_ADOC 49 | fi 50 | done 51 | 52 | exit 0 53 | -------------------------------------------------------------------------------- /docs/images/1.1-netbeans-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/1.1-netbeans-download.png -------------------------------------------------------------------------------- /docs/images/11-wildfly-server-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/11-wildfly-server-log.png -------------------------------------------------------------------------------- /docs/images/16-netbeans-add-dev-update-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/16-netbeans-add-dev-update-center.png -------------------------------------------------------------------------------- /docs/images/16-netbeans-add-instance-wildfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/16-netbeans-add-instance-wildfly.png -------------------------------------------------------------------------------- /docs/images/16-netbeans-available-plugins-wildfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/16-netbeans-available-plugins-wildfly.png -------------------------------------------------------------------------------- /docs/images/16-netbeans-wildfly-full-platform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/16-netbeans-wildfly-full-platform.png -------------------------------------------------------------------------------- /docs/images/16-netbeans-wildfly-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/16-netbeans-wildfly-server.png -------------------------------------------------------------------------------- /docs/images/2.0-problem-statement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/2.0-problem-statement.png -------------------------------------------------------------------------------- /docs/images/2.0-technologies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/2.0-technologies.png -------------------------------------------------------------------------------- /docs/images/2.1-fix-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/2.1-fix-imports.png -------------------------------------------------------------------------------- /docs/images/2.1-format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/2.1-format.png -------------------------------------------------------------------------------- /docs/images/2.1-server-endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/2.1-server-endpoint.png -------------------------------------------------------------------------------- /docs/images/3.2-persistence-xml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.2-persistence-xml.png -------------------------------------------------------------------------------- /docs/images/3.2-project-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.2-project-structure.png -------------------------------------------------------------------------------- /docs/images/3.4-missing-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.4-missing-server.png -------------------------------------------------------------------------------- /docs/images/3.5-schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.5-schema.png -------------------------------------------------------------------------------- /docs/images/3.6-glassfish-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.6-glassfish-server.png -------------------------------------------------------------------------------- /docs/images/3.6-wildfly-server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.6-wildfly-server.png -------------------------------------------------------------------------------- /docs/images/3.8-first-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/3.8-first-page.png -------------------------------------------------------------------------------- /docs/images/4.2-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.2-imports.png -------------------------------------------------------------------------------- /docs/images/4.4-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.4-template.png -------------------------------------------------------------------------------- /docs/images/4.6-chatroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.6-chatroom.png -------------------------------------------------------------------------------- /docs/images/4.8-chatroom-joined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.8-chatroom-joined.png -------------------------------------------------------------------------------- /docs/images/4.8-chatroom-two-browsers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.8-chatroom-two-browsers.png -------------------------------------------------------------------------------- /docs/images/4.8-chatroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/4.8-chatroom.png -------------------------------------------------------------------------------- /docs/images/5.0-batch-intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/5.0-batch-intro.png -------------------------------------------------------------------------------- /docs/images/5.10-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/5.10-imports.png -------------------------------------------------------------------------------- /docs/images/5.14-sales.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/5.14-sales.png -------------------------------------------------------------------------------- /docs/images/5.15-sales.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/5.15-sales.png -------------------------------------------------------------------------------- /docs/images/5.16-sales-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/5.16-sales-output.png -------------------------------------------------------------------------------- /docs/images/6.12-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/6.12-output.png -------------------------------------------------------------------------------- /docs/images/6.14-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/6.14-output.png -------------------------------------------------------------------------------- /docs/images/6.2-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/6.2-imports.png -------------------------------------------------------------------------------- /docs/images/6.6-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/6.6-imports.png -------------------------------------------------------------------------------- /docs/images/6.8-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/6.8-output.png -------------------------------------------------------------------------------- /docs/images/7.11-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.11-imports.png -------------------------------------------------------------------------------- /docs/images/7.14-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.14-imports.png -------------------------------------------------------------------------------- /docs/images/7.15-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.15-output.png -------------------------------------------------------------------------------- /docs/images/7.16-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.16-output.png -------------------------------------------------------------------------------- /docs/images/7.16-output2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.16-output2.png -------------------------------------------------------------------------------- /docs/images/7.2-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.2-imports.png -------------------------------------------------------------------------------- /docs/images/7.3-implements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.3-implements.png -------------------------------------------------------------------------------- /docs/images/7.6-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.6-imports.png -------------------------------------------------------------------------------- /docs/images/7.7-implements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/7.7-implements.png -------------------------------------------------------------------------------- /docs/images/8.10-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output.png -------------------------------------------------------------------------------- /docs/images/8.10-output2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output2.png -------------------------------------------------------------------------------- /docs/images/8.10-output3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output3.png -------------------------------------------------------------------------------- /docs/images/8.10-output4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output4.png -------------------------------------------------------------------------------- /docs/images/8.10-output5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output5.png -------------------------------------------------------------------------------- /docs/images/8.10-output6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output6.png -------------------------------------------------------------------------------- /docs/images/8.10-output7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.10-output7.png -------------------------------------------------------------------------------- /docs/images/8.2-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/8.2-imports.png -------------------------------------------------------------------------------- /docs/images/9.11-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.11-output.png -------------------------------------------------------------------------------- /docs/images/9.11-output2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.11-output2.png -------------------------------------------------------------------------------- /docs/images/9.11-output3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.11-output3.png -------------------------------------------------------------------------------- /docs/images/9.11-output4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.11-output4.png -------------------------------------------------------------------------------- /docs/images/9.11-output5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.11-output5.png -------------------------------------------------------------------------------- /docs/images/9.3-imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/9.3-imports.png -------------------------------------------------------------------------------- /docs/images/block-diagram.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/block-diagram.key -------------------------------------------------------------------------------- /docs/images/i13-back-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-back-icon.png -------------------------------------------------------------------------------- /docs/images/i13-ellipsis-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-ellipsis-button.png -------------------------------------------------------------------------------- /docs/images/i13-exclamation-mark-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-exclamation-mark-icon.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-defined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-defined.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-fix-deployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-fix-deployment.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-fix-domain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-fix-domain.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-fix-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-fix-url.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-home-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-home-directory.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-server-dialog-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-server-dialog-final.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-server-dialog-initial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-server-dialog-initial.png -------------------------------------------------------------------------------- /docs/images/i13-glassfish-start-database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-glassfish-start-database.png -------------------------------------------------------------------------------- /docs/images/i13-initial-project-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-initial-project-structure.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-defined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-defined.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-fix-deployment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-fix-deployment.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-fix-extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-fix-extension.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-home-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-home-directory.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-invalid-extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-invalid-extension.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-server-dialog-final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-server-dialog-final.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-server-dialog-initial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-server-dialog-initial.png -------------------------------------------------------------------------------- /docs/images/i13-jboss-url-fixed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jboss-url-fixed.png -------------------------------------------------------------------------------- /docs/images/i13-jdk-defined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jdk-defined.png -------------------------------------------------------------------------------- /docs/images/i13-jdk-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jdk-home.png -------------------------------------------------------------------------------- /docs/images/i13-jpa-detected-event-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jpa-detected-event-log.png -------------------------------------------------------------------------------- /docs/images/i13-jpa-detected-status-bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jpa-detected-status-bar.png -------------------------------------------------------------------------------- /docs/images/i13-jpa-detected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-jpa-detected.png -------------------------------------------------------------------------------- /docs/images/i13-open-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-open-project.png -------------------------------------------------------------------------------- /docs/images/i13-open-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-open-terminal.png -------------------------------------------------------------------------------- /docs/images/i13-plus-glassfish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-plus-glassfish.png -------------------------------------------------------------------------------- /docs/images/i13-plus-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-plus-icon.png -------------------------------------------------------------------------------- /docs/images/i13-plus-jboss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-plus-jboss.png -------------------------------------------------------------------------------- /docs/images/i13-plus-jdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-plus-jdk.png -------------------------------------------------------------------------------- /docs/images/i13-project-sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-project-sdk.png -------------------------------------------------------------------------------- /docs/images/i13-run-configs-plus-glassfish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-configs-plus-glassfish.png -------------------------------------------------------------------------------- /docs/images/i13-run-configs-plus-jboss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-configs-plus-jboss.png -------------------------------------------------------------------------------- /docs/images/i13-run-edit-configurations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-edit-configurations.png -------------------------------------------------------------------------------- /docs/images/i13-run-glassfish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-glassfish.png -------------------------------------------------------------------------------- /docs/images/i13-run-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-icon.png -------------------------------------------------------------------------------- /docs/images/i13-run-tool-window-glassfish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-tool-window-glassfish.png -------------------------------------------------------------------------------- /docs/images/i13-run-tool-window-wildfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-tool-window-wildfly.png -------------------------------------------------------------------------------- /docs/images/i13-run-wildfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-run-wildfly.png -------------------------------------------------------------------------------- /docs/images/i13-select-pom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-select-pom.png -------------------------------------------------------------------------------- /docs/images/i13-setup-frameworks-jpa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-setup-frameworks-jpa.png -------------------------------------------------------------------------------- /docs/images/i13-show-tool-windows-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-show-tool-windows-icon.png -------------------------------------------------------------------------------- /docs/images/i13-starting-page-in-browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-starting-page-in-browser.png -------------------------------------------------------------------------------- /docs/images/i13-welcome-configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/i13-welcome-configure.png -------------------------------------------------------------------------------- /docs/images/idea-add-glassfish-server-configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-add-glassfish-server-configuration.png -------------------------------------------------------------------------------- /docs/images/idea-configure-jpa-dialogbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-configure-jpa-dialogbox.png -------------------------------------------------------------------------------- /docs/images/idea-configure-jpa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-configure-jpa.png -------------------------------------------------------------------------------- /docs/images/idea-convertproject.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-convertproject.png -------------------------------------------------------------------------------- /docs/images/idea-edit-glassfish-server-configuration-DeploymentTab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-edit-glassfish-server-configuration-DeploymentTab.png -------------------------------------------------------------------------------- /docs/images/idea-edit-glassfish-server-configuration-servertab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-edit-glassfish-server-configuration-servertab.png -------------------------------------------------------------------------------- /docs/images/idea-mavenprojects-run-package-command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-mavenprojects-run-package-command.png -------------------------------------------------------------------------------- /docs/images/idea-open-mavenprojects-pane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/idea-open-mavenprojects-pane.png -------------------------------------------------------------------------------- /docs/images/netbeans-addserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/netbeans-addserver.png -------------------------------------------------------------------------------- /docs/images/netbeans-view-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/images/netbeans-view-log.png -------------------------------------------------------------------------------- /docs/javaee7-hol.adoc: -------------------------------------------------------------------------------- 1 | = Java EE 7 Hands-on Lab 2 | Arun Gupta 3 | v2.1, Jun 25, 2014 4 | :doctype: book 5 | :toc: 6 | :toclevels: 3 7 | :ide-netbeans: true 8 | :server-wildfly: true 9 | 10 | include::chapters/introduction.adoc[] 11 | 12 | include::chapters/statement.adoc[] 13 | 14 | include::chapters/walkthrough.adoc[] 15 | 16 | include::chapters/websocket.adoc[] 17 | 18 | include::chapters/batch.adoc[] 19 | 20 | include::chapters/jaxrs.adoc[] 21 | 22 | include::chapters/json.adoc[] 23 | 24 | include::chapters/jms.adoc[] 25 | 26 | include::chapters/jsf.adoc[] 27 | 28 | include::chapters/conclusion.adoc[] 29 | 30 | include::chapters/troubleshooting.adoc[] 31 | 32 | include::chapters/acks.adoc[] 33 | 34 | include::chapters/solutions.adoc[] 35 | 36 | include::chapters/todo.adoc[] 37 | 38 | include::chapters/revision.adoc[] 39 | 40 | include::chapters/appendix.adoc[] 41 | 42 | -------------------------------------------------------------------------------- /docs/javaee7-hol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/docs/javaee7-hol.pdf -------------------------------------------------------------------------------- /solution/movieplex7-1.0-SNAPSHOT.war: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/solution/movieplex7-1.0-SNAPSHOT.war -------------------------------------------------------------------------------- /solution/movieplex7-solution.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/solution/movieplex7-solution.zip -------------------------------------------------------------------------------- /solution/movieplex7/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.glassfish 6 | movieplex7 7 | 1.0-SNAPSHOT 8 | war 9 | 10 | Java EE 7 Hands-on Lab Solution 11 | 12 | 13 | 14 | javax 15 | javaee-api 16 | 7.0 17 | provided 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-compiler-plugin 26 | 2.3.2 27 | 28 | 1.7 29 | 1.7 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-war-plugin 35 | 2.1.1 36 | 37 | false 38 | 39 | 40 | 41 | org.wildfly.plugins 42 | wildfly-maven-plugin 43 | 1.0.2.Final 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/batch/SalesBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.batch; 41 | 42 | import java.util.List; 43 | import java.util.Properties; 44 | import javax.batch.operations.JobOperator; 45 | import javax.batch.operations.JobStartException; 46 | import javax.batch.runtime.BatchRuntime; 47 | import javax.enterprise.context.RequestScoped; 48 | import javax.inject.Named; 49 | import javax.persistence.EntityManagerFactory; 50 | import javax.persistence.PersistenceUnit; 51 | import org.javaee7.movieplex7.entities.Sales; 52 | 53 | 54 | /** 55 | * @author Arun Gupta 56 | */ 57 | @Named 58 | @RequestScoped 59 | public class SalesBean { 60 | 61 | @PersistenceUnit EntityManagerFactory em; 62 | 63 | public void runJob() { 64 | try { 65 | JobOperator jo = BatchRuntime.getJobOperator(); 66 | long jobId = jo.start("eod-sales", new Properties()); 67 | System.out.println("Started job: with id: " + jobId); 68 | } catch (JobStartException ex) { 69 | ex.printStackTrace(); 70 | } 71 | } 72 | 73 | public List getSalesData() { 74 | return em.createEntityManager().createNamedQuery("Sales.findAll", Sales.class).getResultList(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/batch/SalesProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.batch; 41 | 42 | import java.util.StringTokenizer; 43 | import javax.batch.api.chunk.ItemProcessor; 44 | import javax.enterprise.context.Dependent; 45 | import javax.inject.Named; 46 | import org.javaee7.movieplex7.entities.Sales; 47 | 48 | /** 49 | * @author Arun Gupta 50 | */ 51 | @Dependent 52 | @Named 53 | public class SalesProcessor implements ItemProcessor { 54 | 55 | @Override 56 | public Sales processItem(Object s) { 57 | Sales sales = new Sales(); 58 | 59 | StringTokenizer tokens = new StringTokenizer((String)s, ","); 60 | sales.setId(Integer.parseInt(tokens.nextToken())); 61 | sales.setAmount(Float.parseFloat(tokens.nextToken())); 62 | 63 | return sales; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/batch/SalesReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.batch; 41 | 42 | import java.io.BufferedReader; 43 | import java.io.IOException; 44 | import java.io.InputStreamReader; 45 | import java.io.Serializable; 46 | import java.util.logging.Level; 47 | import java.util.logging.Logger; 48 | import javax.batch.api.chunk.AbstractItemReader; 49 | import javax.enterprise.context.Dependent; 50 | import javax.inject.Named; 51 | 52 | /** 53 | * @author Arun Gupta 54 | */ 55 | @Dependent 56 | @Named 57 | public class SalesReader extends AbstractItemReader { 58 | 59 | private BufferedReader reader; 60 | 61 | @Override 62 | public void open(Serializable checkpoint) throws Exception { 63 | reader = new BufferedReader( 64 | new InputStreamReader( 65 | Thread.currentThread() 66 | .getContextClassLoader() 67 | .getResourceAsStream("META-INF/sales.csv"))); 68 | } 69 | 70 | @Override 71 | public String readItem() { 72 | String string = null; 73 | try { 74 | string = reader.readLine(); 75 | System.out.println("SalesReader.readItem: " + string); 76 | } catch (IOException ex) { 77 | Logger.getLogger(SalesReader.class.getName()).log(Level.SEVERE, null, ex); 78 | } 79 | return string; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/batch/SalesWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.batch; 41 | 42 | import java.util.List; 43 | import javax.batch.api.chunk.AbstractItemWriter; 44 | import javax.enterprise.context.Dependent; 45 | import javax.inject.Named; 46 | import javax.persistence.EntityManager; 47 | import javax.persistence.PersistenceContext; 48 | import javax.transaction.Transactional; 49 | import org.javaee7.movieplex7.entities.Sales; 50 | 51 | /** 52 | * @author Arun Gupta 53 | */ 54 | @Dependent 55 | @Named 56 | public class SalesWriter extends AbstractItemWriter { 57 | 58 | @PersistenceContext EntityManager em; 59 | 60 | @Override 61 | @Transactional 62 | public void writeItems(List list) { 63 | for (Sales s : (List)list) { 64 | System.out.println("SalesWriter.writeItem: " + s); 65 | em.persist(s); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/booking/Booking.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.booking; 41 | 42 | import java.io.Serializable; 43 | import java.util.List; 44 | import java.util.StringTokenizer; 45 | import javax.faces.flow.FlowScoped; 46 | import javax.inject.Named; 47 | import javax.persistence.EntityManager; 48 | import javax.persistence.NoResultException; 49 | import javax.persistence.PersistenceContext; 50 | import org.javaee7.movieplex7.entities.Movie; 51 | import org.javaee7.movieplex7.entities.ShowTiming; 52 | 53 | /** 54 | * @author Arun Gupta 55 | */ 56 | @Named 57 | @FlowScoped("booking") 58 | public class Booking implements Serializable { 59 | 60 | int movieId; 61 | String startTime; 62 | int startTimeId; 63 | 64 | @PersistenceContext 65 | EntityManager em; 66 | 67 | public int getMovieId() { 68 | return movieId; 69 | } 70 | 71 | public void setMovieId(int movieId) { 72 | this.movieId = movieId; 73 | } 74 | 75 | public String getMovieName() { 76 | try { 77 | return em.createNamedQuery("Movie.findById", Movie.class).setParameter("id", movieId).getSingleResult().getName(); 78 | } catch (NoResultException e) { 79 | return ""; 80 | } 81 | } 82 | 83 | public String getStartTime() { 84 | return startTime; 85 | } 86 | 87 | public void setStartTime(String startTime) { 88 | StringTokenizer tokens = new StringTokenizer(startTime, ","); 89 | startTimeId = Integer.parseInt(tokens.nextToken()); 90 | this.startTime = tokens.nextToken(); 91 | } 92 | 93 | public int getStartTimeId() { 94 | return startTimeId; 95 | } 96 | 97 | public String getName() { 98 | return this.getClass().getSimpleName(); 99 | } 100 | 101 | public String getTheater() { 102 | // for a movie and show 103 | try { 104 | // Always return the first theater 105 | List list = em.createNamedQuery("ShowTiming.findByMovieAndTimingId", ShowTiming.class) 106 | .setParameter("movieId", movieId) 107 | .setParameter("timingId", startTimeId) 108 | .getResultList(); 109 | if (list.isEmpty()) 110 | return "none"; 111 | 112 | return list 113 | .get(0) 114 | .getTheaterId() 115 | .getId().toString(); 116 | } catch (NoResultException e) { 117 | return "none"; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/chat/ChatServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.chat; 41 | 42 | import java.io.IOException; 43 | import java.util.Collections; 44 | import java.util.HashSet; 45 | import java.util.Set; 46 | import javax.websocket.EncodeException; 47 | import javax.websocket.OnClose; 48 | import javax.websocket.OnMessage; 49 | import javax.websocket.OnOpen; 50 | import javax.websocket.Session; 51 | import javax.websocket.server.ServerEndpoint; 52 | 53 | /** 54 | * @author Arun Gupta 55 | */ 56 | @ServerEndpoint("/websocket") 57 | public class ChatServer { 58 | 59 | private static final Set peers = Collections.synchronizedSet(new HashSet()); 60 | 61 | @OnOpen 62 | public void onOpen(Session peer) { 63 | peers.add(peer); 64 | } 65 | 66 | @OnClose 67 | public void onClose(Session peer) { 68 | peers.remove(peer); 69 | } 70 | 71 | @OnMessage 72 | public void message(String message, Session client) throws IOException, EncodeException { 73 | for (Session peer : peers) { 74 | peer.getBasicRemote().sendText(message); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/client/MovieBackingBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.client; 41 | 42 | import java.io.Serializable; 43 | import javax.enterprise.context.SessionScoped; 44 | import javax.inject.Named; 45 | 46 | /** 47 | * @author Arun Gupta 48 | */ 49 | @Named 50 | @SessionScoped 51 | public class MovieBackingBean implements Serializable { 52 | 53 | int movieId; 54 | String movieName; 55 | String actors; 56 | 57 | public int getMovieId() { 58 | return movieId; 59 | } 60 | 61 | public void setMovieId(int mid) { 62 | this.movieId = mid; 63 | } 64 | 65 | public String getMovieName() { 66 | return movieName; 67 | } 68 | 69 | public void setMovieName(String movieName) { 70 | this.movieName = movieName; 71 | } 72 | 73 | public String getActors() { 74 | return actors; 75 | } 76 | 77 | public void setActors(String actors) { 78 | this.actors = actors; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/client/MovieClientBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.client; 41 | 42 | import javax.annotation.PostConstruct; 43 | import javax.annotation.PreDestroy; 44 | import javax.enterprise.context.RequestScoped; 45 | import javax.inject.Inject; 46 | import javax.inject.Named; 47 | import javax.servlet.http.HttpServletRequest; 48 | import javax.ws.rs.client.Client; 49 | import javax.ws.rs.client.ClientBuilder; 50 | import javax.ws.rs.client.Entity; 51 | import javax.ws.rs.client.WebTarget; 52 | import javax.ws.rs.core.MediaType; 53 | import org.javaee7.movieplex7.entities.Movie; 54 | import org.javaee7.movieplex7.json.MovieWriter; 55 | 56 | /** 57 | * @author Arun Gupta 58 | */ 59 | @Named 60 | @RequestScoped 61 | public class MovieClientBean { 62 | 63 | @Inject 64 | MovieBackingBean bean; 65 | 66 | Client client; 67 | WebTarget target; 68 | 69 | @Inject HttpServletRequest httpServletRequest; 70 | 71 | @PostConstruct 72 | public void init() { 73 | client = ClientBuilder.newClient(); 74 | target = client 75 | .target("http://" + 76 | httpServletRequest.getLocalName() + 77 | ":" + 78 | httpServletRequest.getLocalPort() + 79 | "/" + 80 | httpServletRequest.getContextPath() + 81 | "/webresources/movie/"); 82 | } 83 | 84 | @PreDestroy 85 | public void destroy() { 86 | client.close(); 87 | } 88 | 89 | public Movie[] getMovies() { 90 | return target 91 | .request() 92 | .get(Movie[].class); 93 | } 94 | 95 | public Movie getMovie() { 96 | Movie m = target 97 | .path("{movie}") 98 | .resolveTemplate("movie", bean.getMovieId()) 99 | .request() 100 | .get(Movie.class); 101 | return m; 102 | } 103 | 104 | public Movie getMovieJson() { 105 | Movie m = target 106 | .path("{movie}") 107 | .resolveTemplate("movie", bean.getMovieId()) 108 | .request(MediaType.APPLICATION_JSON) 109 | .get(Movie.class); 110 | return m; 111 | } 112 | 113 | public void addMovie() { 114 | Movie m = new Movie(); 115 | m.setId(bean.getMovieId()); 116 | m.setName(bean.getMovieName()); 117 | m.setActors(bean.getActors()); 118 | target 119 | .register(MovieWriter.class) 120 | .request() 121 | .post(Entity.entity(m, MediaType.APPLICATION_JSON)); 122 | } 123 | 124 | public void deleteMovie() { 125 | target 126 | .path("{movieId}") 127 | .resolveTemplate("movieId", bean.getMovieId()) 128 | .request() 129 | .delete(); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/json/MovieReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package org.javaee7.movieplex7.json; 42 | 43 | import java.io.IOException; 44 | import java.io.InputStream; 45 | import java.lang.annotation.Annotation; 46 | import java.lang.reflect.Type; 47 | import javax.json.Json; 48 | import javax.json.stream.JsonParser; 49 | import static javax.json.stream.JsonParser.Event.KEY_NAME; 50 | import javax.ws.rs.Consumes; 51 | import javax.ws.rs.WebApplicationException; 52 | import javax.ws.rs.core.MediaType; 53 | import javax.ws.rs.core.MultivaluedMap; 54 | import javax.ws.rs.ext.MessageBodyReader; 55 | import javax.ws.rs.ext.Provider; 56 | import org.javaee7.movieplex7.entities.Movie; 57 | 58 | /** 59 | * @author Arun Gupta 60 | */ 61 | @Provider 62 | @Consumes(MediaType.APPLICATION_JSON) 63 | public class MovieReader implements MessageBodyReader { 64 | 65 | @Override 66 | public boolean isReadable(Class type, Type type1, Annotation[] antns, MediaType mt) { 67 | return Movie.class.isAssignableFrom(type); 68 | } 69 | 70 | @Override 71 | public Movie readFrom(Class type, Type type1, Annotation[] antns, MediaType mt, MultivaluedMap mm, InputStream in) throws IOException, WebApplicationException { 72 | Movie movie = new Movie(); 73 | JsonParser parser = Json.createParser(in); 74 | while (parser.hasNext()) { 75 | switch (parser.next()) { 76 | case KEY_NAME: 77 | String key = parser.getString(); 78 | parser.next(); 79 | switch (key) { 80 | case "id": 81 | movie.setId(parser.getInt()); 82 | break; 83 | case "name": 84 | movie.setName(parser.getString()); 85 | break; 86 | case "actors": 87 | movie.setActors(parser.getString()); 88 | break; 89 | default: 90 | break; 91 | } 92 | break; 93 | default: 94 | break; 95 | } 96 | } 97 | return movie; 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/json/MovieWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package org.javaee7.movieplex7.json; 42 | 43 | import java.io.IOException; 44 | import java.io.OutputStream; 45 | import java.lang.annotation.Annotation; 46 | import java.lang.reflect.Type; 47 | import javax.json.Json; 48 | import javax.json.stream.JsonGenerator; 49 | import javax.ws.rs.Produces; 50 | import javax.ws.rs.WebApplicationException; 51 | import javax.ws.rs.core.MediaType; 52 | import javax.ws.rs.core.MultivaluedMap; 53 | import javax.ws.rs.ext.MessageBodyWriter; 54 | import javax.ws.rs.ext.Provider; 55 | import org.javaee7.movieplex7.entities.Movie; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Provider 61 | @Produces(MediaType.APPLICATION_JSON) 62 | public class MovieWriter implements MessageBodyWriter { 63 | 64 | @Override 65 | public boolean isWriteable(Class type, Type type1, Annotation[] antns, MediaType mt) { 66 | return Movie.class.isAssignableFrom(type); 67 | } 68 | 69 | @Override 70 | public long getSize(Movie t, Class type, Type type1, Annotation[] antns, MediaType mt) { 71 | // As of JAX-RS 2.0, the method has been deprecated and the 72 | // value returned by the method is ignored by a JAX-RS runtime. 73 | // All MessageBodyWriter implementations are advised to return -1 from 74 | // the method. 75 | 76 | return -1; 77 | } 78 | 79 | @Override 80 | public void writeTo(Movie t, Class type, Type type1, Annotation[] antns, MediaType mt, MultivaluedMap mm, OutputStream out) throws IOException, WebApplicationException { 81 | JsonGenerator gen = Json.createGenerator(out); 82 | gen.writeStartObject() 83 | .write("id", t.getId()) 84 | .write("name", t.getName()) 85 | .write("actors", t.getActors()) 86 | .writeEnd(); 87 | gen.flush(); 88 | 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/points/ReceivePointsBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.points; 41 | 42 | import java.util.Enumeration; 43 | import java.util.logging.Level; 44 | import java.util.logging.Logger; 45 | import javax.annotation.Resource; 46 | import javax.enterprise.context.RequestScoped; 47 | import javax.inject.Inject; 48 | import javax.inject.Named; 49 | import javax.jms.JMSConsumer; 50 | import javax.jms.JMSContext; 51 | import javax.jms.JMSDestinationDefinition; 52 | import javax.jms.JMSException; 53 | import javax.jms.Queue; 54 | import javax.jms.QueueBrowser; 55 | 56 | /** 57 | * @author Arun Gupta 58 | */ 59 | @JMSDestinationDefinition(name = "java:global/jms/pointsQueue", 60 | interfaceName = "javax.jms.Queue") 61 | @Named 62 | @RequestScoped 63 | public class ReceivePointsBean { 64 | 65 | @Inject 66 | // @JMSConnectionFactory("java:comp/DefaultJMSConnectionFactory") 67 | JMSContext context; 68 | 69 | @Resource(lookup = "java:global/jms/pointsQueue") 70 | Queue pointsQueue; 71 | 72 | public String receiveMessage() { 73 | try (JMSConsumer consumer = context.createConsumer(pointsQueue)) { 74 | String message = consumer.receiveBody(String.class); 75 | System.out.println("Received message: " + message); 76 | return message; 77 | } 78 | } 79 | 80 | public int getQueueSize() { 81 | int count = 0; 82 | try { 83 | QueueBrowser browser = context.createBrowser(pointsQueue); 84 | Enumeration elems = browser.getEnumeration(); 85 | while (elems.hasMoreElements()) { 86 | elems.nextElement(); 87 | count++; 88 | } 89 | } catch (JMSException ex) { 90 | Logger.getLogger(ReceivePointsBean.class.getName()).log(Level.SEVERE, null, ex); 91 | } 92 | System.out.println("Getting queue size: " + count); 93 | return count; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/points/SendPointsBean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.points; 41 | 42 | import javax.annotation.Resource; 43 | import javax.enterprise.context.RequestScoped; 44 | import javax.inject.Inject; 45 | import javax.inject.Named; 46 | import javax.jms.JMSContext; 47 | import javax.jms.Queue; 48 | import javax.validation.constraints.NotNull; 49 | import javax.validation.constraints.Pattern; 50 | 51 | /** 52 | * @author Arun Gupta 53 | */ 54 | @Named 55 | @RequestScoped 56 | public class SendPointsBean { 57 | 58 | @Inject 59 | // @JMSConnectionFactory("java:comp/DefaultJMSConnectionFactory") 60 | JMSContext context; 61 | 62 | @NotNull 63 | @Pattern(regexp = "^\\d{2},\\d{2}", message = "Message format must be 2 digits, comma, 2 digits, e.g. 12,12") 64 | private String message; 65 | 66 | public String getMessage() { 67 | return message; 68 | } 69 | 70 | public void setMessage(String message) { 71 | this.message = message; 72 | } 73 | 74 | @Resource(lookup = "java:global/jms/pointsQueue") 75 | Queue pointsQueue; 76 | 77 | public void sendMessage() { 78 | System.out.println("Sending message: " + message); 79 | 80 | context.createProducer().send(pointsQueue, message); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/AbstractFacade.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.persistence.EntityManager; 44 | 45 | /** 46 | * @author Arun Gupta 47 | */ 48 | public abstract class AbstractFacade { 49 | private Class entityClass; 50 | 51 | public AbstractFacade(Class entityClass) { 52 | this.entityClass = entityClass; 53 | } 54 | 55 | protected abstract EntityManager getEntityManager(); 56 | 57 | public void create(T entity) { 58 | getEntityManager().persist(entity); 59 | } 60 | 61 | public void edit(Object id) { 62 | T t = getEntityManager().find(entityClass, id); 63 | getEntityManager().merge(t); 64 | } 65 | 66 | public void remove(T entity) { 67 | getEntityManager().remove(getEntityManager().merge(entity)); 68 | } 69 | 70 | public T find(Object id) { 71 | return getEntityManager().find(entityClass, id); 72 | } 73 | 74 | public List getAll() { 75 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 76 | cq.select(cq.from(entityClass)); 77 | return getEntityManager().createQuery(cq).getResultList(); 78 | } 79 | 80 | public List findRange(int[] range) { 81 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 82 | cq.select(cq.from(entityClass)); 83 | javax.persistence.Query q = getEntityManager().createQuery(cq); 84 | q.setMaxResults(range[1] - range[0]); 85 | q.setFirstResult(range[0]); 86 | return q.getResultList(); 87 | } 88 | 89 | public int count() { 90 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 91 | javax.persistence.criteria.Root rt = cq.from(entityClass); 92 | cq.select(getEntityManager().getCriteriaBuilder().count(rt)); 93 | javax.persistence.Query q = getEntityManager().createQuery(cq); 94 | return ((Long) q.getSingleResult()).intValue(); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.Set; 43 | import javax.ws.rs.core.Application; 44 | 45 | /** 46 | * @author Arun Gupta 47 | */ 48 | @javax.ws.rs.ApplicationPath("webresources") 49 | public class ApplicationConfig extends Application { 50 | 51 | @Override 52 | public Set> getClasses() { 53 | Set> resources = new java.util.HashSet<>(); 54 | addRestResourceClasses(resources); 55 | return resources; 56 | } 57 | 58 | /** 59 | * Do not modify addRestResourceClasses() method. 60 | * It is automatically re-generated by NetBeans REST support to populate 61 | * given list with all resources defined in the project. 62 | */ 63 | private void addRestResourceClasses(Set> resources) { 64 | resources.add(org.javaee7.movieplex7.json.MovieReader.class); 65 | resources.add(org.javaee7.movieplex7.json.MovieWriter.class); 66 | resources.add(org.javaee7.movieplex7.rest.MovieFacadeREST.class); 67 | resources.add(org.javaee7.movieplex7.rest.SalesFacadeREST.class); 68 | resources.add(org.javaee7.movieplex7.rest.ShowTimingFacadeREST.class); 69 | resources.add(org.javaee7.movieplex7.rest.TheaterFacadeREST.class); 70 | resources.add(org.javaee7.movieplex7.rest.TimeslotFacadeREST.class); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/MovieFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Movie; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("movie") 63 | public class MovieFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | protected EntityManager em; 66 | 67 | public MovieFacadeREST() { 68 | super(Movie.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Movie entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public Movie find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/SalesFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Sales; 56 | import org.javaee7.movieplex7.entities.Timeslot; 57 | 58 | /** 59 | * @author Arun Gupta 60 | */ 61 | @Named 62 | @Stateless 63 | @Path("sales") 64 | public class SalesFacadeREST extends AbstractFacade { 65 | @PersistenceContext 66 | private EntityManager em; 67 | 68 | public SalesFacadeREST() { 69 | super(Sales.class); 70 | } 71 | 72 | @POST 73 | @Override 74 | @Consumes({"application/xml", "application/json"}) 75 | public void create(Sales entity) { 76 | super.create(entity); 77 | } 78 | 79 | @PUT 80 | @Path("{id}") 81 | public void edit(@PathParam("id") Integer id) { 82 | super.edit(id); 83 | } 84 | 85 | @DELETE 86 | @Path("{id}") 87 | public void remove(@PathParam("id") Integer id) { 88 | super.remove(super.find(id)); 89 | } 90 | 91 | @GET 92 | @Path("{id}") 93 | @Produces({"application/xml", "application/json"}) 94 | public Sales find(@PathParam("id") Integer id) { 95 | return super.find(id); 96 | } 97 | 98 | @GET 99 | @Override 100 | @Produces({"application/xml", "application/json"}) 101 | public List getAll() { 102 | return super.getAll(); 103 | } 104 | 105 | @GET 106 | @Path("{from}/{to}") 107 | @Produces({"application/xml", "application/json"}) 108 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 109 | return super.findRange(new int[]{from, to}); 110 | } 111 | 112 | @GET 113 | @Path("count") 114 | @Produces("text/plain") 115 | public String countREST() { 116 | return String.valueOf(super.count()); 117 | } 118 | 119 | @Override 120 | protected EntityManager getEntityManager() { 121 | return em; 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/ShowTimingFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.ShowTiming; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("showtiming") 63 | public class ShowTimingFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public ShowTimingFacadeREST() { 68 | super(ShowTiming.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(ShowTiming entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public ShowTiming find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/TheaterFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Theater; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("theater") 63 | public class TheaterFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public TheaterFacadeREST() { 68 | super(Theater.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Theater entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public Theater find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/java/org/javaee7/movieplex7/rest/TimeslotFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Timeslot; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("timeslot") 63 | public class TimeslotFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public TimeslotFacadeREST() { 68 | super(Timeslot.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Timeslot entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public Timeslot find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/resources/META-INF/batch-jobs/eod-sales.xml: -------------------------------------------------------------------------------- 1 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/resources/META-INF/create.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE THEATER ("ID" INTEGER not null primary key, "CAPACITY" INTEGER not null) 2 | CREATE TABLE MOVIE("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null, "ACTORS" VARCHAR(200) not null) 3 | CREATE TABLE TIMESLOT("ID" INTEGER not null primary key, "START_TIME" VARCHAR(5) not null, "END_TIME" VARCHAR(5) not null) 4 | CREATE TABLE SHOW_TIMING("ID" INTEGER not null primary key, "DAY" INTEGER not null, "THEATER_ID" INTEGER not null, "MOVIE_ID" INTEGER not null, "TIMING_ID" INTEGER not null) 5 | CREATE TABLE SALES("ID" INTEGER not null primary key, "AMOUNT" FLOAT not null) 6 | CREATE TABLE POINTS("ID" INTEGER not null primary key, "POINTS" INTEGER not null) 7 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT SHOW_THEATER_FK FOREIGN KEY ("THEATER_ID") REFERENCES THEATER ("ID") 8 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT SHOW_MOVIE_FK FOREIGN KEY ("MOVIE_ID") REFERENCES MOVIE ("ID") 9 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT TIMESLOT_FK FOREIGN KEY ("TIMING_ID") REFERENCES TIMESLOT ("ID") 10 | ALTER TABLE SALES ADD CONSTRAINT SHOW_TIMING_ID_FK FOREIGN KEY ("ID") REFERENCES SHOW_TIMING ("ID") -------------------------------------------------------------------------------- /solution/movieplex7/src/main/resources/META-INF/drop.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE SALES 2 | DROP TABLE POINTS 3 | DROP TABLE SHOW_TIMING 4 | DROP TABLE MOVIE 5 | DROP TABLE TIMESLOT 6 | DROP TABLE THEATER -------------------------------------------------------------------------------- /solution/movieplex7/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/resources/META-INF/sales.csv: -------------------------------------------------------------------------------- 1 | 1,500.00 2 | 2,660.00 3 | 3,80.00 4 | 4,470.00 5 | 5,1100.x0 6 | 6,240.00 7 | 7,1000.00 8 | 8,2300.00 9 | 9,230.00 10 | 10,600.00 11 | 11,800.00 12 | 12,1400.00 13 | 13,780.00 14 | 14,890.00 15 | 15,490.00 16 | 16,670.00 17 | 17,450.x0 18 | 18,1230.00 19 | 19,700.00 20 | 20,900.00 -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/WEB-INF/faces-config.xml: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/WEB-INF/template.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | Movieplex 7 54 | 55 | 56 | 57 | 58 | 59 |
60 | 61 | 62 |

63 |
64 | 72 |
73 |
74 |
75 |
76 | 77 | 78 | Book a movie 79 |

Chat Room 80 |

Movies 81 |

Sales 82 |

Points 83 | 84 | 85 |

86 |
87 | Content 88 |
89 |
90 |
91 | 92 | 93 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | javax.faces.PROJECT_STAGE 46 | Development 47 | 48 | 49 | javax.faces.CLIENT_WINDOW_MODE 50 | url 51 | 52 | 53 | Faces Servlet 54 | javax.faces.webapp.FacesServlet 55 | 1 56 | 57 | 58 | Faces Servlet 59 | /faces/* 60 | 61 | 62 | faces/index.xhtml 63 | 64 | 65 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/batch/sales.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |

Movie Sales

55 | 56 | 57 | 58 | 59 | 60 | 61 | #{s.id} 62 | 63 | 64 | 65 | 66 | 67 | #{s.amount} 68 | 69 | 70 | 71 | 72 | 73 | 74 |
75 | 76 |
77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/booking/booking-flow.xml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 49 | 50 | 51 | 52 | /index 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/booking/booking.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |

Pick a movie

56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
67 | 68 |
69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/booking/confirm.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |

No theater found, choose a different time

58 | 59 | Movie name: #{booking.movieName}

60 | Starts at: #{booking.startTime}

61 |

62 | 63 | 64 | 65 |

Confirm ?

66 | 67 | 68 | Movie name: #{booking.movieName}

69 | Starts at: #{booking.startTime}

70 | Theater: #{booking.theater}

71 |

72 |

73 |
74 | 75 |
76 | 77 |
78 | 79 |
80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/booking/print.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |

Reservation Confirmed

55 | 56 | 57 | Movie name: #{booking.movieName}

58 | Starts at: #{booking.startTime}

59 | Theater: #{booking.theater}

60 | 61 |

62 |
63 |
64 | 65 |
66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/booking/showtimes.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Show Timings for #{booking.movieName}

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/chat/chatroom.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | 54 | 55 | 56 | 60 | 64 | 65 | 66 | 72 | 73 |
57 | Chat Log
58 | 59 |
61 | Users
62 | 63 |
67 | 68 | 69 |

70 | 71 |

74 | 75 |
76 |
77 | 78 | 79 |
80 | 81 |
82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/chat/websocket.js: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | var wsUri = 'ws://' + document.location.host 42 | + document.location.pathname.substr(0, document.location.pathname.indexOf("/faces")) 43 | + '/websocket'; 44 | console.log(wsUri); 45 | var websocket = new WebSocket(wsUri); 46 | 47 | var username; 48 | websocket.onopen = function(evt) { onOpen(evt); }; 49 | websocket.onmessage = function(evt) { onMessage(evt); }; 50 | websocket.onerror = function(evt) { onError(evt); }; 51 | websocket.onclose = function(evt) { onClose(evt); }; 52 | var output = document.getElementById("output"); 53 | var textField = document.getElementById("textField"); 54 | var users = document.getElementById("users"); 55 | var chatlog = document.getElementById("chatlog"); 56 | 57 | function join() { 58 | username = textField.value; 59 | websocket.send(username + " joined"); 60 | } 61 | 62 | function send_message() { 63 | websocket.send(username + ": " + textField.value); 64 | } 65 | 66 | function onOpen() { 67 | writeToScreen("CONNECTED"); 68 | } 69 | 70 | function onClose() { 71 | writeToScreen("DISCONNECTED"); 72 | } 73 | 74 | function onMessage(evt) { 75 | writeToScreen("RECEIVED: " + evt.data); 76 | if (evt.data.indexOf("joined") !== -1) { 77 | users.innerHTML += evt.data.substring(0, evt.data.indexOf(" joined")) + "\n"; 78 | } else { 79 | chatlog.innerHTML += evt.data + "\n"; 80 | } 81 | } 82 | 83 | function onError(evt) { 84 | writeToScreen('ERROR: ' + evt.data); 85 | } 86 | 87 | function disconnect() { 88 | websocket.close(); 89 | } 90 | 91 | function writeToScreen(message) { 92 | var pre = document.createElement("p"); 93 | pre.style.wordWrap = "break-word"; 94 | pre.innerHTML = message; 95 | output.appendChild(pre); 96 | } 97 | 98 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/client/addmovie.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |

Add a New Movie

54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
Movie Id:
Movie Name:
Movie Actors:
70 | 71 |
72 |
73 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/client/movie.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |

Movie Details

54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
Movie Id:#{movieClientBean.movie.id}
Movie Name:#{movieClientBean.movie.name}
Movie Actors:#{movieClientBean.movie.actors}
70 | 71 |
72 |
73 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/client/movies.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |

List of Movies

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
69 | 70 |
71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/index.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Showing #{movieFacadeREST.countREST()} movies in #{theaterFacadeREST.countREST()} theaters! 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/points/points.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |

Points

54 | 55 | 56 | Queue size:

57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/resources/css/cssLayout.css: -------------------------------------------------------------------------------- 1 | 2 | #top { 3 | position: relative; 4 | background-color: #036fab; 5 | color: white; 6 | padding: 5px; 7 | margin: 0px 0px 10px 0px; 8 | } 9 | 10 | #bottom { 11 | position: relative; 12 | background-color: #c2dfef; 13 | padding: 5px; 14 | margin: 10px 0px 0px 0px; 15 | } 16 | 17 | #left { 18 | float: left; 19 | background-color: #ece3a5; 20 | padding: 5px; 21 | width: 150px; 22 | } 23 | 24 | #right { 25 | float: right; 26 | background-color: #ece3a5; 27 | padding: 5px; 28 | width: 150px; 29 | } 30 | 31 | .center_content { 32 | position: relative; 33 | background-color: #dddddd; 34 | padding: 5px; 35 | } 36 | 37 | .left_content { 38 | background-color: #dddddd; 39 | padding: 5px; 40 | margin-left: 170px; 41 | } 42 | 43 | .right_content { 44 | background-color: #dddddd; 45 | padding: 5px; 46 | margin: 0px 170px 0px 170px; 47 | } 48 | 49 | #top a:link, #top a:visited { 50 | color: white; 51 | font-weight : bold; 52 | text-decoration: none; 53 | } 54 | 55 | #top a:link:hover, #top a:visited:hover { 56 | color: black; 57 | font-weight : bold; 58 | text-decoration : underline; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /solution/movieplex7/src/main/webapp/resources/css/default.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | font-size: 12px; 4 | font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; 5 | color: #000000; 6 | margin: 10px; 7 | } 8 | 9 | h1 { 10 | font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; 11 | border-bottom: 1px solid #AFAFAF; 12 | font-size: 16px; 13 | font-weight: bold; 14 | margin: 0px; 15 | padding: 0px; 16 | color: #D20005; 17 | } 18 | 19 | a:link, a:visited { 20 | color: #045491; 21 | font-weight : bold; 22 | text-decoration: none; 23 | } 24 | 25 | a:link:hover, a:visited:hover { 26 | color: #045491; 27 | font-weight : bold; 28 | text-decoration : underline; 29 | } 30 | -------------------------------------------------------------------------------- /starting-template/movieplex7-starting-template.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee-samples/javaee7-hol/65c3c4b18de81e69ea88332c9224a0b51bccfa7b/starting-template/movieplex7-starting-template.zip -------------------------------------------------------------------------------- /starting-template/movieplex7/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | org.javaee7 6 | movieplex7 7 | 1.0-SNAPSHOT 8 | war 9 | 10 | Java EE 7 Hands-on Lab 11 | 12 | 13 | 14 | javax 15 | javaee-api 16 | 7.0 17 | provided 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.plugins 25 | maven-compiler-plugin 26 | 2.3.2 27 | 28 | 1.7 29 | 1.7 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-war-plugin 35 | 2.1.1 36 | 37 | false 38 | 39 | 40 | 41 | org.wildfly.plugins 42 | wildfly-maven-plugin 43 | 1.0.2.Final 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/AbstractFacade.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.persistence.EntityManager; 44 | 45 | /** 46 | * @author Arun Gupta 47 | * @param entity class 48 | */ 49 | public abstract class AbstractFacade { 50 | private final Class entityClass; 51 | 52 | public AbstractFacade(Class entityClass) { 53 | this.entityClass = entityClass; 54 | } 55 | 56 | protected abstract EntityManager getEntityManager(); 57 | 58 | public void create(T entity) { 59 | getEntityManager().persist(entity); 60 | } 61 | 62 | public void edit(Object id) { 63 | T t = getEntityManager().find(entityClass, id); 64 | getEntityManager().merge(t); 65 | } 66 | 67 | public void remove(T entity) { 68 | getEntityManager().remove(getEntityManager().merge(entity)); 69 | } 70 | 71 | public T find(Object id) { 72 | return getEntityManager().find(entityClass, id); 73 | } 74 | 75 | public List getAll() { 76 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 77 | cq.select(cq.from(entityClass)); 78 | return getEntityManager().createQuery(cq).getResultList(); 79 | } 80 | 81 | public List findRange(int[] range) { 82 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 83 | cq.select(cq.from(entityClass)); 84 | javax.persistence.Query q = getEntityManager().createQuery(cq); 85 | q.setMaxResults(range[1] - range[0]); 86 | q.setFirstResult(range[0]); 87 | return q.getResultList(); 88 | } 89 | 90 | public int count() { 91 | javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); 92 | javax.persistence.criteria.Root rt = cq.from(entityClass); 93 | cq.select(getEntityManager().getCriteriaBuilder().count(rt)); 94 | javax.persistence.Query q = getEntityManager().createQuery(cq); 95 | return ((Long) q.getSingleResult()).intValue(); 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import javax.ws.rs.core.Application; 43 | 44 | /** 45 | * @author Arun Gupta 46 | */ 47 | @javax.ws.rs.ApplicationPath("webresources") 48 | public class ApplicationConfig extends Application { 49 | } 50 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/MovieFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Movie; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("movie") 63 | public class MovieFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | protected EntityManager em; 66 | 67 | public MovieFacadeREST() { 68 | super(Movie.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Movie entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public Movie find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/ShowTimingFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.ShowTiming; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("showtiming") 63 | public class ShowTimingFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public ShowTimingFacadeREST() { 68 | super(ShowTiming.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(ShowTiming entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Consumes({"application/xml", "application/json"}) 80 | @Path("{id}") 81 | public void edit(@PathParam("id") Integer id) { 82 | super.edit(id); 83 | } 84 | 85 | @DELETE 86 | @Path("{id}") 87 | public void remove(@PathParam("id") Integer id) { 88 | super.remove(super.find(id)); 89 | } 90 | 91 | @GET 92 | @Path("{id}") 93 | public ShowTiming find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/TheaterFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Theater; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("theater") 63 | public class TheaterFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public TheaterFacadeREST() { 68 | super(Theater.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Theater entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Path("{id}") 80 | public void edit(@PathParam("id") Integer id) { 81 | super.edit(id); 82 | } 83 | 84 | @DELETE 85 | @Path("{id}") 86 | public void remove(@PathParam("id") Integer id) { 87 | super.remove(super.find(id)); 88 | } 89 | 90 | @GET 91 | @Path("{id}") 92 | @Produces({"application/xml", "application/json"}) 93 | public Theater find(@PathParam("id") Integer id) { 94 | return super.find(id); 95 | } 96 | 97 | @GET 98 | @Override 99 | @Produces({"application/xml", "application/json"}) 100 | public List getAll() { 101 | return super.getAll(); 102 | } 103 | 104 | @GET 105 | @Path("{from}/{to}") 106 | @Produces({"application/xml", "application/json"}) 107 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 108 | return super.findRange(new int[]{from, to}); 109 | } 110 | 111 | @GET 112 | @Path("count") 113 | @Produces("text/plain") 114 | public String countREST() { 115 | return String.valueOf(super.count()); 116 | } 117 | 118 | @Override 119 | protected EntityManager getEntityManager() { 120 | return em; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/java/org/javaee7/movieplex7/rest/TimeslotFacadeREST.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package org.javaee7.movieplex7.rest; 41 | 42 | import java.util.List; 43 | import javax.ejb.Stateless; 44 | import javax.inject.Named; 45 | import javax.persistence.EntityManager; 46 | import javax.persistence.PersistenceContext; 47 | import javax.ws.rs.Consumes; 48 | import javax.ws.rs.DELETE; 49 | import javax.ws.rs.GET; 50 | import javax.ws.rs.POST; 51 | import javax.ws.rs.PUT; 52 | import javax.ws.rs.Path; 53 | import javax.ws.rs.PathParam; 54 | import javax.ws.rs.Produces; 55 | import org.javaee7.movieplex7.entities.Timeslot; 56 | 57 | /** 58 | * @author Arun Gupta 59 | */ 60 | @Named 61 | @Stateless 62 | @Path("timeslot") 63 | public class TimeslotFacadeREST extends AbstractFacade { 64 | @PersistenceContext 65 | private EntityManager em; 66 | 67 | public TimeslotFacadeREST() { 68 | super(Timeslot.class); 69 | } 70 | 71 | @POST 72 | @Override 73 | @Consumes({"application/xml", "application/json"}) 74 | public void create(Timeslot entity) { 75 | super.create(entity); 76 | } 77 | 78 | @PUT 79 | @Consumes({"application/xml", "application/json"}) 80 | @Path("{id}") 81 | public void edit(@PathParam("id") Integer id) { 82 | super.edit(id); 83 | } 84 | 85 | @DELETE 86 | @Path("{id}") 87 | public void remove(@PathParam("id") Integer id) { 88 | super.remove(super.find(id)); 89 | } 90 | 91 | @GET 92 | @Path("{id}") 93 | @Produces({"application/xml", "application/json"}) 94 | public Timeslot find(@PathParam("id") Integer id) { 95 | return super.find(id); 96 | } 97 | 98 | @GET 99 | @Override 100 | @Produces({"application/xml", "application/json"}) 101 | public List getAll() { 102 | return super.getAll(); 103 | } 104 | 105 | @GET 106 | @Path("{from}/{to}") 107 | @Produces({"application/xml", "application/json"}) 108 | public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) { 109 | return super.findRange(new int[]{from, to}); 110 | } 111 | 112 | @GET 113 | @Path("count") 114 | @Produces("text/plain") 115 | public String countREST() { 116 | return String.valueOf(super.count()); 117 | } 118 | 119 | @Override 120 | protected EntityManager getEntityManager() { 121 | return em; 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/resources/META-INF/create.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE THEATER ("ID" INTEGER not null primary key, "CAPACITY" INTEGER not null) 2 | CREATE TABLE MOVIE("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null, "ACTORS" VARCHAR(200) not null) 3 | CREATE TABLE TIMESLOT("ID" INTEGER not null primary key, "START_TIME" VARCHAR(5) not null, "END_TIME" VARCHAR(5) not null) 4 | CREATE TABLE SHOW_TIMING("ID" INTEGER not null primary key, "DAY" INTEGER not null, "THEATER_ID" INTEGER not null, "MOVIE_ID" INTEGER not null, "TIMING_ID" INTEGER not null) 5 | CREATE TABLE SALES("ID" INTEGER not null primary key, "AMOUNT" FLOAT not null) 6 | CREATE TABLE POINTS("ID" INTEGER not null primary key, "POINTS" INTEGER not null) 7 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT SHOW_THEATER_FK FOREIGN KEY ("THEATER_ID") REFERENCES THEATER ("ID") 8 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT SHOW_MOVIE_FK FOREIGN KEY ("MOVIE_ID") REFERENCES MOVIE ("ID") 9 | ALTER TABLE SHOW_TIMING ADD CONSTRAINT TIMESLOT_FK FOREIGN KEY ("TIMING_ID") REFERENCES TIMESLOT ("ID") 10 | ALTER TABLE SALES ADD CONSTRAINT SHOW_TIMING_ID_FK FOREIGN KEY ("ID") REFERENCES SHOW_TIMING ("ID") -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/resources/META-INF/drop.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE SALES 2 | DROP TABLE POINTS 3 | DROP TABLE SHOW_TIMING 4 | DROP TABLE MOVIE 5 | DROP TABLE TIMESLOT 6 | DROP TABLE THEATER -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/resources/META-INF/sales.csv: -------------------------------------------------------------------------------- 1 | 1,500.00 2 | 2,660.00 3 | 3,80.00 4 | 4,470.00 5 | 5,1100.x0 6 | 6,240.00 7 | 7,1000.00 8 | 8,2300.00 9 | 9,230.00 10 | 10,600.00 11 | 11,800.00 12 | 12,1400.00 13 | 13,780.00 14 | 14,890.00 15 | 15,490.00 16 | 16,670.00 17 | 17,450.x0 18 | 18,1230.00 19 | 19,700.00 20 | 20,900.00 -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/webapp/WEB-INF/template.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | 48 | 49 | 50 | 51 | 52 | 53 | Movieplex 7 54 | 55 | 56 | 57 | 58 | 59 |

60 | 61 | 62 |

63 |
64 | 74 |
75 |
76 |
77 |
78 | 79 | 80 | Item 1 81 |

Item 2 82 | 83 | 84 |

85 |
86 | Content 87 |
88 |
89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 45 | javax.faces.PROJECT_STAGE 46 | Development 47 | 48 | 49 | javax.faces.CLIENT_WINDOW_MODE 50 | url 51 | 52 | 53 | Faces Servlet 54 | javax.faces.webapp.FacesServlet 55 | 1 56 | 57 | 58 | Faces Servlet 59 | /faces/* 60 | 61 | 62 | faces/index.xhtml 63 | 64 | 65 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/webapp/index.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Showing #{movieFacadeREST.countREST()} movies in #{theaterFacadeREST.countREST()} theaters! 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/webapp/resources/css/cssLayout.css: -------------------------------------------------------------------------------- 1 | 2 | #top { 3 | position: relative; 4 | background-color: #036fab; 5 | color: white; 6 | padding: 5px; 7 | margin: 0px 0px 10px 0px; 8 | } 9 | 10 | #bottom { 11 | position: relative; 12 | background-color: #c2dfef; 13 | padding: 5px; 14 | margin: 10px 0px 0px 0px; 15 | } 16 | 17 | #left { 18 | float: left; 19 | background-color: #ece3a5; 20 | padding: 5px; 21 | width: 150px; 22 | } 23 | 24 | #right { 25 | float: right; 26 | background-color: #ece3a5; 27 | padding: 5px; 28 | width: 150px; 29 | } 30 | 31 | .center_content { 32 | position: relative; 33 | background-color: #dddddd; 34 | padding: 5px; 35 | } 36 | 37 | .left_content { 38 | background-color: #dddddd; 39 | padding: 5px; 40 | margin-left: 170px; 41 | } 42 | 43 | .right_content { 44 | background-color: #dddddd; 45 | padding: 5px; 46 | margin: 0px 170px 0px 170px; 47 | } 48 | 49 | #top a:link, #top a:visited { 50 | color: white; 51 | font-weight : bold; 52 | text-decoration: none; 53 | } 54 | 55 | #top a:link:hover, #top a:visited:hover { 56 | color: black; 57 | font-weight : bold; 58 | text-decoration : underline; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /starting-template/movieplex7/src/main/webapp/resources/css/default.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ffffff; 3 | font-size: 12px; 4 | font-family: Verdana, "Verdana CE", Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; 5 | color: #000000; 6 | margin: 10px; 7 | } 8 | 9 | h1 { 10 | font-family: Arial, "Arial CE", "Lucida Grande CE", lucida, "Helvetica CE", sans-serif; 11 | border-bottom: 1px solid #AFAFAF; 12 | font-size: 16px; 13 | font-weight: bold; 14 | margin: 0px; 15 | padding: 0px; 16 | color: #D20005; 17 | } 18 | 19 | a:link, a:visited { 20 | color: #045491; 21 | font-weight : bold; 22 | text-decoration: none; 23 | } 24 | 25 | a:link:hover, a:visited:hover { 26 | color: #045491; 27 | font-weight : bold; 28 | text-decoration : underline; 29 | } 30 | --------------------------------------------------------------------------------