Git Product home page Git Product logo

spring-roo-addon-timestamp's Introduction

#Spring Roo Timestamp Add-on

This Spring Roo timestamp add-on allows you to easily add timestamp fields for 'created' and 'updated' to your JPA entities. It provides an @RooTimestamp annotation.

##Quick start to using the timestamp add-on

Download the latest snapshot located in downloads here com.rcaloras.roo.addon.timestamp-0.1.3-SNAPSHOT.jar Or you can grab releases from the Maven Repo

From a Roo shell:

osgi start --url file://$PATH_TO_DOWNLOAD/com.rcaloras.roo.addon.timestamp-0.1.3-SNAPSHOT.jar
timestamp setup
timestamp all

###Annotate your entities with @RooTimestamp

@RooJavaBean
@RooToString
@RooJpaActiveRecord
@RooTimestamp
public class Location  {
	
	String name;

	String address;

	String city;

	....
}

ITDs are then created for each entity marked

privileged aspect Location_Roo_Timestamp {
    
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date Location.created;
    
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date Location.updated;
    
    @PrePersist
    public void Location.onCreate() {
        this.created=new java.util.Date();
    }
    
    @PreUpdate
    public void Location.onUpdate() {
        this.updated=new java.util.Date();
    }

    //Also adds Mutators and Accessors for created and updated
    public Date Location.getCreated() {
        return this.created;
    }
    
    public void Location.setCreated(Date created) {
        this.created = created;
    }

    ....
    
}

##Timestamp Add-on Commands (Displayed with help timestamp from a Roo shell)

* timestamp add - Adds @RooTimestamp to target type
* timestamp all - Adds @RooTimestamp to all types annotated with @RooJavaBean
* timestamp remove - Remove all dependencies and removes all annotations of @RooTimestamp
* timestamp setup - Setup Timestamp addon

Any issues or questions are more than welcome. More documentaion to come.

spring-roo-addon-timestamp's People

Contributors

rcaloras avatar

Watchers

Mario Jauvin avatar

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.