Difference between revisions of "Opentaps 2 Notes"

From Opentaps Wiki
Jump to navigationJump to search
(The API)
(The API)
 
(24 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
The cool thing is that you can configure up to 10 things to associate with your notes, whatever they maybe.  You can thus associate notes with your customers or tasks and make a CRM system, or associate them with your products or orders and have a product review system.  You can even organize the UI to make your own version of Twitter.
 
The cool thing is that you can configure up to 10 things to associate with your notes, whatever they maybe.  You can thus associate notes with your customers or tasks and make a CRM system, or associate them with your products or orders and have a product review system.  You can even organize the UI to make your own version of Twitter.
 +
 +
The open source version of opentaps 2 Notes will include:
 +
* a server side application built with opentaps 2
 +
* a browser client written in HTML5/CSS/Javascript
 +
* mobile clients for iPhone and Android
 +
* mobile libraries for iPhone and Android for use with your own applications
  
 
==How It Works==
 
==How It Works==
Line 15: Line 21:
 
===The Data Model===
 
===The Data Model===
  
<pre>
+
Note - the notes themselves
NoteData - the notes themselves
 
 
* noteId - unique ID
 
* noteId - unique ID
 
* noteText - text field for the note
 
* noteText - text field for the note
 +
* domain - the domain from which the note was created
 
* createdByUserId - identity of user creating the note
 
* createdByUserId - identity of user creating the note
 
* userIdType - identifies type of user Id (Facebook, twitter, LDAP, email, etc.)
 
* userIdType - identifies type of user Id (Facebook, twitter, LDAP, email, etc.)
 
* dateTimeCreated - date and time when note was created
 
* dateTimeCreated - date and time when note was created
* attribute1..10 - arbitrary attributes associated with note
 
  
NoteAttributeConfig - configures the attributes which are associated with the note  
+
Where a NoSQL database shines is with the attributes of Notes.  We do not have to have a fully normalized model, where a NOTE_DATA table holds the notes themselves and is linked to ORDER_HEADER via ORDER_NOTE, PARTY via PARTY_NOTE, etc. etc.  Nor do we need to use generic attribute fields (attribute1, attribute2, etc.) that could leave the developer confused about what the note actually is: Hmm...is attribute1=12345 referring to product 12345 or order 12345? 
* attributeId - 1..10 identifying which attribute on NoteData
+
 
* fieldName1..N - field name for user's convenience
+
Instead, each Note can have whatever attributes it needs. Notes for orders can have attribute orderId. Notes for blog posts can have page title. Notes for people can have a partyId.  Notes which relate to multiple objects can have multiple IDs, etc.
</pre>
 
  
 
===The API===
 
===The API===
Line 34: Line 38:
 
* Input:
 
* Input:
 
** text
 
** text
** value for field1...10
 
* Output:
 
 
** noteId
 
** noteId
  
Line 43: Line 45:
 
* Output:
 
* Output:
 
** NoteData for noteId
 
** NoteData for noteId
 +
 +
<tt>updateNote</tt>
 +
* Input:
 +
** noteId
 +
** text
 +
 +
<tt>removeNote</tt>
 +
* Input
 +
** noteId
  
 
<tt>getNotes</tt>
 
<tt>getNotes</tt>
Line 48: Line 59:
 
** createdByUserId
 
** createdByUserId
 
** createdByUserType
 
** createdByUserType
** value for field1...10
 
 
* Output
 
* Output
 
** List of NoteData or empty list
 
** List of NoteData or empty list
 +
 +
===Javascript/HTML===
 +
 +
===Mobile API===
 +
 +
===How to Install It===
 +
 +
Follow general installation instructions for Getting opentaps 2.  Then deploy the <tt>org.opentaps.notes.xxx.eba</tt> file from <tt>opentaps-2/notes/modules/eba/target</tt> directory using Geronimo's Deployer.
 +
 +
====Trying it with SSL====
 +
 +
The REST server works with unsecured (http) and secured (https) out of the box.  You will need to import your keystone  in Geronimo.  Then simply change the requests in the <tt>note_app.html</tt> from <tt>http://</tt> to <tt>https://</tt>
 +
 +
If you want to try it without a self signed SSL certificate, you can import the opentaps.cer file into your browser manually.  For Firefox, the steps are:
 +
# Go to Tools (or Preferences) > Advanced Tab
 +
# Click on View Certificates
 +
# Click on the "Server" tab for server certificates
 +
# Click on Import to import your certificate
 +
# Import the <tt>opentaps.cer</tt> file
 +
# Now select the certificate you just imported and click on "Edit Trust"
 +
# Change the trust setting for the certificate from "Do not trust..." to "Trust the authenticity of this certificate."
 +
 +
===Facebook Integration===
 +
 +
By default, your opentaps Notes application is configured to work with Facebook using a "opentaps v2 Notes Local Testing" application.  '''This application will only work if you use http://localhost:8080/ for Geronimo'''.  It will not work if you used another ip address, such as 127.0.0.1  Facebook is very sensitive to the referring URL of each application.
 +
 +
To configure a different facebook application integration, you must:
 +
# Create facebook application. In the "Select how your app integrates with Facebook" section the "App on Facebook" should be marked. The Canvas URL and Secure Canvas URL should be URL of the you server. For example for local testing it can be  http://localhost:8080/ and  https://localhost:8080/
 +
# The App ID from facebook application should set to FB_CLIENT_ID variable from the FacebookResource.java, the App Secret should set to FB_CLIENT_SECRET.
 +
# The FB_REDIRECT_URL from FacebookResource.java should correspond to facebook application Canvas URL. For our example the FB_REDIRECT_URL should be  http://localhost:8080/notes/facebook/callback
 +
# The FB_HTML_CLIENT_CALLBACK from FacebookResource.java should specify html client side URL. For example  http://localhost/note_app.html
 +
 +
===How to Use It===
 +
 +
====Starting the Server====
 +
 +
See instructions from [[Getting_opentaps_2#Setting_Up_and_Running_opentaps_v2|Running opentaps v2]] on how to get opentaps v2 server running in Apache Geronimo.
 +
 +
The first time you start Notes application, you must deploy it into Geronimo.  Click on "Deployer" on left hand of Geronimo console and upload the .eba file from <tt>modules/notes/eba/target/</tt> as the Archive.
 +
 +
Once installed, the Notes application can be found by clicking on "Aries Applications (EBA)" on the left hand side.  It should have a status of "Running".
 +
 +
====The HTML App====
 +
 +
Simply open the file <tt>opentaps-2/clients/html/note_app.html</tt> in any browser.
 +
 +
====The Mobile App====

Latest revision as of 21:02, 7 May 2012

opentaps 2 Notes

What It Does

This is a very simple yet useful application to demonstrate the concepts and technologies behind opentaps 2.

On the server side, there will be a set of API for creating and retrieving notes which can be associated with different things: orders, customers, tasks, products, etc. On the client side, there will be UI tools for working with the server-side notes API to create or retrieve notes. You can write your own UI around these API, using our examples for both web and mobile platforms.

The cool thing is that you can configure up to 10 things to associate with your notes, whatever they maybe. You can thus associate notes with your customers or tasks and make a CRM system, or associate them with your products or orders and have a product review system. You can even organize the UI to make your own version of Twitter.

The open source version of opentaps 2 Notes will include:

  • a server side application built with opentaps 2
  • a browser client written in HTML5/CSS/Javascript
  • mobile clients for iPhone and Android
  • mobile libraries for iPhone and Android for use with your own applications

How It Works

The Data Model

Note - the notes themselves

  • noteId - unique ID
  • noteText - text field for the note
  • domain - the domain from which the note was created
  • createdByUserId - identity of user creating the note
  • userIdType - identifies type of user Id (Facebook, twitter, LDAP, email, etc.)
  • dateTimeCreated - date and time when note was created

Where a NoSQL database shines is with the attributes of Notes. We do not have to have a fully normalized model, where a NOTE_DATA table holds the notes themselves and is linked to ORDER_HEADER via ORDER_NOTE, PARTY via PARTY_NOTE, etc. etc. Nor do we need to use generic attribute fields (attribute1, attribute2, etc.) that could leave the developer confused about what the note actually is: Hmm...is attribute1=12345 referring to product 12345 or order 12345?

Instead, each Note can have whatever attributes it needs. Notes for orders can have attribute orderId. Notes for blog posts can have page title. Notes for people can have a partyId. Notes which relate to multiple objects can have multiple IDs, etc.

The API

createNote

  • Input:
    • text
    • noteId

getNoteById

  • Input:
    • noteId
  • Output:
    • NoteData for noteId

updateNote

  • Input:
    • noteId
    • text

removeNote

  • Input
    • noteId

getNotes

  • Input (any of the following):
    • createdByUserId
    • createdByUserType
  • Output
    • List of NoteData or empty list

Javascript/HTML

Mobile API

How to Install It

Follow general installation instructions for Getting opentaps 2. Then deploy the org.opentaps.notes.xxx.eba file from opentaps-2/notes/modules/eba/target directory using Geronimo's Deployer.

Trying it with SSL

The REST server works with unsecured (http) and secured (https) out of the box. You will need to import your keystone in Geronimo. Then simply change the requests in the note_app.html from http:// to https://

If you want to try it without a self signed SSL certificate, you can import the opentaps.cer file into your browser manually. For Firefox, the steps are:

  1. Go to Tools (or Preferences) > Advanced Tab
  2. Click on View Certificates
  3. Click on the "Server" tab for server certificates
  4. Click on Import to import your certificate
  5. Import the opentaps.cer file
  6. Now select the certificate you just imported and click on "Edit Trust"
  7. Change the trust setting for the certificate from "Do not trust..." to "Trust the authenticity of this certificate."

Facebook Integration

By default, your opentaps Notes application is configured to work with Facebook using a "opentaps v2 Notes Local Testing" application. This application will only work if you use http://localhost:8080/ for Geronimo. It will not work if you used another ip address, such as 127.0.0.1 Facebook is very sensitive to the referring URL of each application.

To configure a different facebook application integration, you must:

  1. Create facebook application. In the "Select how your app integrates with Facebook" section the "App on Facebook" should be marked. The Canvas URL and Secure Canvas URL should be URL of the you server. For example for local testing it can be http://localhost:8080/ and https://localhost:8080/
  2. The App ID from facebook application should set to FB_CLIENT_ID variable from the FacebookResource.java, the App Secret should set to FB_CLIENT_SECRET.
  3. The FB_REDIRECT_URL from FacebookResource.java should correspond to facebook application Canvas URL. For our example the FB_REDIRECT_URL should be http://localhost:8080/notes/facebook/callback
  4. The FB_HTML_CLIENT_CALLBACK from FacebookResource.java should specify html client side URL. For example http://localhost/note_app.html

How to Use It

Starting the Server

See instructions from Running opentaps v2 on how to get opentaps v2 server running in Apache Geronimo.

The first time you start Notes application, you must deploy it into Geronimo. Click on "Deployer" on left hand of Geronimo console and upload the .eba file from modules/notes/eba/target/ as the Archive.

Once installed, the Notes application can be found by clicking on "Aries Applications (EBA)" on the left hand side. It should have a status of "Running".

The HTML App

Simply open the file opentaps-2/clients/html/note_app.html in any browser.

The Mobile App