My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
GettingStarted  
Getting Started
Updated Jul 7, 2011 by rutvijku...@gmail.com

Introduction

Spring roo enables rapid development for Java projects. This addon provides audit timestamp features for JPA entities created by Spring roo.

It will add "created" and "lastUpdated" timestamp fields to entities.

Prerequisite

  • Spring Roo 1.1.4

Install

Addon can be installed to Spring roo by following ways:

1. Install released version from Spring RooBot

start roo prompt

pgp trust --keyId 0x5328FE21
addon install bundle --bundleSymbolicName addon.roo.audittimestamp

2.Install latest version from project Repo start roo prompt

Install jar using osgi url

osgi start --url https://spring-roo-addon-audit-timestamp.googlecode.com/svn/repo/addon/roo/audittimestamp/addon.roo.audittimestamp/0.1.1.BUILD/addon.roo.audittimestamp-0.1.1.BUILD.jar

3. Using Downloaded JAR

Download addon.roo.audittimestamp-0.1.1.BUILD.jar from Downloads section.

Install jar file to local maven repo

mvn install:install-file -Dfile=$DOWNLOADED_DIR/addon.roo.audittimestamp-0.1.1.BUILD.jar -DgroupId=addon.roo.audittimestamp  -DartifactId=addon.roo.audittimestamp -Dversion=0.1.1.BUILD -Dpackaging=jar

start roo prompt

install osgi bundle using file://

roo> osgi start --url file:$DOWNLOADED_DIR/addon.roo.audittimestamp-0.1.1.BUILD.jar  

Create Project

project --topLevelPackage com.mycompany.base --projectName MyProject

//Addon requires persistence, other wise it does not accessible/display

persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

//Create Entity Class

entity --class ~.domain.Person
field string --fieldName firstName
field string --fieldName lastName
field string --fieldName emailAddress

Usage

//setup maven dependency (spring-roo-addon-audit-timestamp)

audittimestamp setup

//Adds @RooAuditTimeStamp to specified Entity

audittimestamp add --type ~.domain.Person

//Adds @RooAuditTimeStamp to all Entities

audittimestamp all

Behind the Scene

Adds $EntityName_Roo_Audittimestamp.aj file $EntityName_Roo_Audittimestamp.aj aspect will contain following fields

private Date Person.created; private Date Person.lastUpdated;

So entity table will have these audit columns in database.

When Entity will be created/updated current time stamp will be assigned to this fields and persisted in database.

Uninstall

To uninstall this addon from Spring roo run following roo command.

addon remove --bundleSymbolicName addon.roo.audittimestamp

Please note that this will not remove @RooAuditTimeStamp from Entities and will not remove dependency from pom.xml.

To remove this addon from applied project :

1. Manually remove @RooAuditTimeStamp annotation from each entity

2. Remove dependency of 'spring-roo-addon-audit-timestamp' from pom.xml

Comment by 2sdevt...@gmail.com, Jul 8, 2012

Its a very useful plugin, can you please also migrate to Roo 1.2.1

Comment by eleme...@gmail.com, Oct 7, 2012

Hi, I recently created an updated version of this project compatible with the latest version of Spring Roo. It can be found on github at https://github.com/rcaloras/spring-roo-addon-timestamp.

Powered by Google Project Hosting