Code Monkey home page Code Monkey logo

tapestry5-hotel-booking's People

Contributors

ccordenier avatar kaosko avatar karesti avatar robink avatar sigbjornt avatar thangamfrm avatar windmueller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tapestry5-hotel-booking's Issues

Secure

The application has a basic user authentication system, so we need

  • A User entity
  • An authentication service (see if tynamo security can suit here)

Search page

We must provide a page that will show the available hotels

  • Use the Grid component
  • Implement and use the Tapestry Hibernate GridDataSource to optimize search requests

Business layer

We will implement everything via Tapestry Services, the seam has a default conversation mechanism, we will have to see if it's worthy or not.

Personally, i prefer the stateless way, let's see !

Testing

Of course we need unit and integration test.

Demonstrate how fun it is to implement test with Tapestry :)

Model

This includes :

  • The design of entities
  • The testing of entities
  • The design of constraints

Setup the environment

This includes :

  • Create application skeleton using maven tapestry archetype plugin
  • Initialize git repository
  • Create and configure hibernate.cfg.xml
  • Create the project structure for model, business and front layer

Web Design

This includes

  • Implementing a Layout component
  • Creating the application design CSS
  • Prepare the index page that describe the purpose of the application

Register page

This includes

  • Implement the form
  • Persist the user once registration process is ok
  • Add the tapx captcha because it's fun and easy to add :)

Conversation handling

A conversation component exists on tynamo and another one Tapestry jumpstart, see which one suits the best :) We need to allow the user to have a state per browser tabs

Upgrade to Tapestry-5.2.4

I get this hibernate / tapestry-hibernate exception when simply switching the tapestry-release-version property to 5.2.4 :

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.annotations.common.reflection.java.JavaReflectionManager
    at org.hibernate.cfg.Configuration.createReflectionManager(Configuration.java:2938)
    at org.hibernate.cfg.Configuration.createReflectionManager(Configuration.java:2934)
    at org.hibernate.cfg.Configuration.reset(Configuration.java:305)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:296)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:300)
    at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:74)
    at org.apache.tapestry5.internal.hibernate.HibernateSessionSourceImpl.<init>(HibernateSessionSourceImpl.java:38)

    at org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(HibernateCoreModule.java:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:64)
    ... 139 more

Perhaps the tapestry-hibernate module needs specific hib version - reporting now / could investigate tomorrow

WebFlow

See if tapestry spring webflow will be useful here

In the ajax method Tapestry.Initializer.initAjaxLoader, the event on which trigger.observeAction operates needs to change

That's the portion I'm talking about:

/**

  • Define JS initializer method for ajaxlaoder component.

  • */
    Tapestry.Initializer.initAjaxLoader = function(params) {

    /** Observe zone-update */
    $(params.zone).observeAction(Tapestry.ZONE_UPDATED_EVENT, function() {
    $(params.loader).hide();
    });

    /**

    • Observe trigger process
      */
      var trigger = $(params.trigger);
      if (trigger.tagName == "FORM") {
      trigger.observeAction(Tapestry.FORM_PROCESS_SUBMIT_EVENT, function() {
      $(params.loader).show();
      });
      } else if (trigger.tagName == "A") {
      trigger.observeAction(Tapestry.ZONE_UPDATED_EVENT, function() {
      $(params.loader).show();
      });
      }
      };

      What used to happen is that when I first click the link, the back end method was called numerous times. Checking the JS console showed a blown stack of recursive calls. Debugging the JS code showed that clicking the link invoked a tapestry method called:
      Tapestry.waitForPage(event);

Which processes the following check:

if (Tapestry.pageLoaded)
return true;

I thought the page isn't loaded yet so this always returns true, which - I suppose - simulates a click on the link, which goes back in the same loop till the stack explodes as the page will never load faster than the JS call ! So I thought to trigger the event after the page is fully loaded. And that's what I have already done in the above code snippet.

Code Review

Why code tests in Java? I now code all my unit and integration tests in Groovy.

com.tap5.hotelbooking.app0.services.AppModule

Why is this named this way? Is it supposed to be under src/test/java?

contributeApplicationDefauls() is incorreclty named; you should use a @Contribute annotation with the @ApplicationDefaults marker annotation.

com.tap5.hotelbooking.app0.services.TestModule

Why does this exist? It doesn't do anything.

BookHotelTest

cleanup(): If this is a test, make it a test. Using @afterclass is sloppy for something that's really a test.
Use test scheduling if order of operations really counts.

Why are you specifying a testName attribute that's identical to the method name? Dont Repeat Yourself.

ConversationModule

I try to have a single Module class per package, so I'd create a com.tap5.conversation.services.conversation
package and refactor the module and services into it.

Is all this conversation stuff appropriate for the application? Seems like overkill!

ConversationWorker

There's a method, ClassTransformation.matchMethodsWithAnnotation(), for this. Less code is good.
Also TransformMethod.addOperationAfter() would be more succinct, though the operation doesn't execute
if the advised method throws an runtime exception, so it may not be appropriate.

AnonymousAccess

The JavaDoc is incorrect; this method enables (not prevents) annonymous access to pages.

HotelBookingConstants

Is the extra level of indirection actually useful? I'd just hard-code the values inside AuthenticationFilter.
Also, this is in a package named "annotations".

HibernateCrudServiceDAO

I have a similar set of DAO's in one of my projects; I tend to use the @Inject annotation, rather
than constructor injection, to simplify life for anyone that extends the class.

CrudServiceDAO

Empty JavaDoc doesn't count and some of these methods, such as create(), do quite a lot that isn't obvious.

HibernateModule

Tapestry would automatically check com.tap5.hotelbooking.entities for Hibernate entities, so if you refactor the domain objects there, it wouldn't be necessary to contribute to HibernateEntityPackageManager.

QueryParameters

Does this class actually help much? Is doesn't seem to be used.

com.tap5.hotelbooking.data.Workspace

Does not appear to be used.

Authenticated

Ok as a component; I really envisioned this kind of functionality as a good example of using a custom type of Binding.
e.g. <t:test if="has-role:admin">

AjaxLoader

Rename field renderSupport to javascriptSupport.

initMoreLink() why is this named this way?

afterRender() why have the @AfterRender annotation if following the naming convention?

HotelClass

Why use Long, not long, for the stars parameter?

IfNotNull

If this needed? The normal Object -> Boolean coercion treats null as false.

Layout

getUser(): Why bother with a temporary variable? Are you that allergic to multiple returns from such a short method?

AuthenticationException

Does this need to be a checked exception? It's never caught by anthing. If it's a runtime exception that's never
specifically caught anywhere, why not just use RuntimeException?

Layout.java / Layout.tml

Remove the sidebarTitle parameter it is not used. Change the page templates to not set it.

Booking page

Implement the booking page to allow authenticated user to book a hotel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.