GithubHelp home page GithubHelp logo

math85360 / play21-origami-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sgougi/play21-origami-plugin

0.0 2.0 0.0 16.67 MB

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

Java 97.34% Scala 2.66%

play21-origami-plugin's Introduction

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 [email protected]: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.

play21-origami-plugin's People

Contributors

sgougi avatar dontrelax avatar

Watchers

James Cloos avatar  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.