Skip to content

sgougi/play21-origami-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is Origami?

Origami plugin is a Java O/G mapper for the OrientDB with Play! framework 2. It maps annotated model classes to ODocument classes of the OrientDB with mapping functionality.

Features

  • Object-Graph-Mapping of annotated model classes based on Object Oriented Inheritance(src)

  • Support for both Java and Scala Project (Both Scala models and Java models are supported)

  • Support for both the embedded and remote OrientDB

  • Auto-reloading support

  • Support to enables to customize the format of Model Id (src)

  • On only embedded OrienDB:

    • Support to enables to use the OrientDB Studio

    • Support to enables to make the database directory of the embedded OrientDB a zip file when your application just starts up.

Requirements

Installing

  1. Install Play framework 2.2.1 and Java 5 or 6, 7

  2. Executing the command

    % git clone git@github.com:sgougi/play21-origami-plugin.git

  3. Publishing Origami to your local repository

    % cd play21-origami-plugin % play publish-local

Running sample application and Usage

At a command prompt, type the following commands:

     % cd play21-origami-plugin
     % cd samples
     % cd origami-simple-app
     % play run

There are basic usage in the source code of a sample application.

Facade Class for OrientDB

The com.wingnest.play2.origami.GraphDB class is a Facade class.

  • GraphDB.open()
  • GraphDB.close()
  • GraphDB.begin()
  • GraphDB.commit()
  • GraphDB.rollback()
  • GraphDB.asynchQuery()
  • GraphDB.synchCommand()
  • GraphDB.synchQuery()
  • GraphDB.synchQueryModel()
  • GraphDB.findById()
  • GraphDB.findDocumentById()
  • GraphDB.documentsToModel()
  • GraphDB.documentToModel()
  • GraphDB.getDocumentsByFieldName()

Abstract Model classes

Both classes extends com.wingnest.play2.origami.GraphModel.

Annotatins for O/G mapping

For Models

####@Index Defines one or more indexes.

ex.:

     public class A extends ... {
        ...
        @Index(indexType = OClass.INDEX_TYPE.UNIQUE)
        public String email;     

        @Index(indexType = OClass.INDEX_TYPE.NOTUNIQUE)
        public String name;     
       ...
     }

####@CompositeIndex Defines one or more composite indexes.

ex.:

    public class A extends ... {
        ...
        @CompositeIndex(indexName="ci_1", indexType = OClass.INDEX_TYPE.UNIQUE)
        public String attr1;     

        @CompositeIndex(indexName="ci_1")
        public Integer attr2;
        ...
    }     

####@SmartDate Defines one or more attributes to set the saved time automatically.

ex.:

    @SmartDate(dateType = GraphModel.SMART_DATE_TYPE.CREATED_DATE)	
    @Index()
    public Date createdDate;

ex.:

    @SmartDate(dateType = GraphModel.SMART_DATE_TYPE.UPDATED_DATE)
    @Index()
    public Date updatedDate;    

####@DisupdateFlag If you don't want to update by @SmartDate, set its attribute true.

ex.:

    @DisupdateFlag
    public boolean disupdateFlag =  false;

####@javax.persistence.Transient Defines one or more attributes as transient attribute.

####@javax.persistence.Id Defines one attribute as id attribute.

####@javax.persistence.Version Defines one attribute as version attribute.

For Controllers (Only Java Project)

####@Transactional The @Transactional annotation enables annotated Actions and/or Controllers to rollback and commit by GraphDB.rollback() and GraphDB.commit(). If a controller is annotated by @Transactional, its all actions are turned into transactional.

####@WithGraphDB The @WithGraphDB annotation enables annotated Actions and/or Controllers to use OrientDB implicitly.

Known Issues

Licence

Origami is distributed under the Apache 2 licence.

About

OrientDB Java O/G mapper for play! framework 2.

Resources

Stars

Watchers

Forks

Packages

No packages published