Time Tracker Sep 2015

Time Tracker is meant for tracking the time you work on a project. There is a rich web application as well as a mobile web application available.

Time Tracker

While I need Time Tracker almost every day, I also created it for realizing an innovative technology stack. The back end side is a typical JEE application using entity and session beans, except that NO Java but Scala has been used. JEE and Scala really integrate very well:

@Entity
@Table(name = "Activity")
class Activity(pDescription: String, pFrom: Date, pTo: Date) extends Persistent {

  var description: String = pDescription

  @Lob
  var longDescription: String = ""

  @NotNull
  @Temporal(TIMESTAMP)
  @Column(name = "fromDate")
  var from: Date = pFrom

  @Temporal(TIMESTAMP)
  @Column(name = "toDate")
  var to: Date = pTo

  @ManyToMany(fetch = FetchType.EAGER)
  val categories: util.Set[Category] = new util.HashSet

  def len = ((to.getTime - from.getTime) / (1000 * 60))
  ...
}


@SessionScoped
@Stateful
@TransactionAttribute(NEVER)
@Interceptors(Array(classOf[ExceptionHandler]))
class TTMgmtGateway extends TTMgmt {

  @Inject
  var dao: TTMgmtSessionDao = null
  ...
}

I used the "perfect anti-facade" pattern, as described by Adam Bien (gateway pattern). The server side is stateful, as you can see above. It uses the EXTENDED entity manager, which keeps all loaded JPA-entities. The user pressing the save button initiates the completion of the technical transaction, which causes the EntityManager flushing all the dirty state down into the database.

On the web front end I used Vaadin, which allows building rich user interfaces quickly without diving into HTML and Javascript. TimeTracker provides a RESTful web service using Jersey, which is used by the mobile web application. The mobile web has been realized with jqm4gwt, which makes the jQuery Mobile widgets available in GWT.

Overall this technology stack provides for great fun and productivity. Especially when using Vaadin the functional programming capabilities of Scala pay off very well.

Souces available on GitHub: https://github.com/micgn/timetracker