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.
-
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.
-
- Play 2.2.1
- OrientDB 1.6.6; See:OrientDB 1.7 -> OGraphDatabase will be removed. What ?!?!
-
Install Play framework 2.2.1 and Java 5 or 6, 7
-
Executing the command
% git clone git@github.com:sgougi/play21-origami-plugin.git
-
Publishing Origami to your local repository
% cd play21-origami-plugin % play publish-local
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.
- Annotated model classes
- Customizing id format
- Application configuration: conf/application.conf
- Dependency settings: project/Build.scala
- Controller with transaction
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()
Both classes extends com.wingnest.play2.origami.GraphModel.
####@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.
####@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.
Origami is distributed under the Apache 2 licence.