on-example-rpm icon indicating copy to clipboard operation
on-example-rpm copied to clipboard

RPM - Rolf's Project Management;Example Lift application

trafficstars

Welcome to RPM - Rolf's Project Management.

This project aims to demonstrate how to use The Lift-framework to implement an application with uses Domain Driven Design and technologies like Spring, Spring Security (with remember-me), JPA (Hibernate), Oval Validation, jQuery-UI and the PostgreSQL RDBMS. It also shows how one can use other frameworks with Lift, example is with JSF, and use Lift-backed AJAX-dialogs and comet on a JSF-page

Features:

  • URI-based locale selection
  • Dynamic, type-safe, form-fields with in-place validation and optional AJAX-callbacks on "field-change"
  • Type-safe i18n
  • Modern (technical, not looks) and responsive GUI for editing entities in a jQuery-dialog
  • AJAX-spinner which follows mouse on AJAX-requests
  • Execute custom JavaScript when different radio-buttons (in same group) are checked ** In this demo it just toggles the value of a text below the radio-buttons
  • Oval integration, http://oval.sf.net
  • Modularize the code into functional domains by having a PersistenceUnit spread across multiple maven-modules and have Spring wire it up correctly
  • Uses scala-jpa
  • JPA-entities written in Scala with Scala-based Enumerations and Option-types in JPA-entities with custom Hibernate-converters
  • Automatic lazy-load lazy-associations without using custom AOP-trickery (new in Hibernate-4.1.7)
  • Automatic registering JodaTime types in Hibernate (note: Doesn't work on Option[DateTime] type where custom user-type is needed)
  • Use Option in (JPA) domain-object's properties and associations to completely avoid null
  • Spring Security with remember me and integration with Lift
  • Blog, with nested comments and comment-votes ** The blog-view is always in sync (using Comet), no need to refresh to see new posts, comments or updated votes

What RPM doesn't want to address and therefore does not implement:

  • Nice GUI
  • Useful functionality
  • Testing

Prerequisites:

  • PostgreSQL 9.0 or later is required to run this application.
  • A Maven-3 installation. You need the oss.sonatype.org repo in order to get lift-2.5-SNAPSHOT, like this example ~/.m2/settings.xml

  
    
      mydefaultprofile
      
        
          oss-sonatype
          https://oss.sonatype.org/content/groups/public/
          
            true
          
          
            true
          
        
      
    
  
  
    mydefaultprofile
  


DB-configuration: Ensure these properties are set to match your DB-settings, configured in /spring/props/infrastructure.properties

infrastructure.datasource.RPM.serverName=localhost
infrastructure.datasource.RPM.port=5432
infrastructure.datasource.RPM.username=your-username
infrastructure.datasource.RPM.password=xxx

Issue the following commands to bootstrap the application:

$ cd 
$ createdb rpm
$ mvn install # have a cup of coffee while downloading the Internet if this is your 1st Maven-project.
$ cd web
$ MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx512m -javaagent:$HOME/.m2/repository/org/springframework/spring-instrument/3.1.2.RELEASE/spring-instrument-3.1.2.RELEASE.jar" mvn tomcat7:run
$ psql -f bootstrap/sampledata.sql rpm

Notes on bootstrapping the application: It's crucial to run the sampledata.sql script after starting tomcat because Hibernate will generate the relevant tables upon boot. The Spring-context needs a loadtime-weaver to be able to inject Spring-beans into non-Spring-managed classes (like snippets), so ensure that spring-instrument gets added as a javaagent.

Open a web-browser on http://localhost:8080/rpm/en/projects or http://localhost:8080/rpm/no/projects (for Norwegian) and login with: username: admin password: Fish123

NB: Testing is completely non-existent, on purpose.