Namespace Papercube.adaptor

Extends: SC.Server
Defined in: clients/papercube/adaptor.js
Version: 1.0
Author: Peter Bergstrom
Copyright: 2008-2009 Peter Bergström.

Overview

Papercube.adaptor

The adaptor object controls the interaction between Papercube and the server back end.

Desired Actions:

PAPERS searchPapers // summary info only getPaperDetails // returns {Array} paper details with authors getAllDataForPaper // reutnrs {Array} full paper details.

AUTHORS: searchAuthors // summary info only getAuthorDetails // returns {Array} author details

This list of actions will probably be modified, expanded, and reduced as the project develops.

Property Summary

Method Summary

Property Details

_getAuthorDetailsCallBack [R/W]

Call back function for getAuthorDetails.

+   Function _getAuthorDetailsCallBack


_getPaperDetailsCallback [R/W]

Call back function for getPaperDetails.

+   Function _getPaperDetailsCallback


base [R/W]

The base API path is specified here and it will be automatically added to requests.

+   String base

Default Value: '/api/request.php'


prefix [R/W]

This is the application prefix.

+   Array prefix

Default Value: ['Papercube']

Discussion

It is used when loading data into the SC Store.


requestIndex [R/W]

This allows the tracking of which query result should be loaded from the SC Store.

+   Integer requestIndex

Default Value: 0

Discussion

Many requests could be in flight and you may want to match the latest request easily.


requests [R/W]

List of requests.

+   Object requests


Method Detail

_handleMult()

Converts an array of guids to a comma separated string of guids, if it is not an array, it is just return as is.

+   (String) _handleMult (object)

Parameters

(Object|String)object The potential array of guids.

Returns

(String) The guids string.


evaluateStatus()

Evaluate status of the response.

+   (Boolean) evaluateStatus (json)

Parameters

json {Object} The request response JSON object.

Returns

(Boolean) Returns YES if NO error or returns NO if there is an error.


getAllDataForPaper()

Get the ALL details of a given paper.

+   (void) getAllDataForPaper (guid, callBack)

Parameters

guid {string} The guid parameter could also be an array of guids if desired.

callBack {Function} The callBack function is called when the request is successful.


getAuthorDetails()

Get the details of a given author.

+   (void) getAuthorDetails (guid, callBack)

Parameters

guid {string} The guid parameter could also be an array of guids if desired.

callBack {Function} The callBack function is called when the request is successful.


getAuthorDetailsSuccess()

When the getAuthorDetails action is successful, you want to display the results in the search list.

+   (void) getAuthorDetailsSuccess (response)

Parameters

response {Object} The response object from the AJAX request.


getPaperDetails()

Get the details of a given paper.

+   (void) getPaperDetails (guid, callBack)

Parameters

guid {string} The guid parameter could also be an array of guids if desired.

callBack {Function} The callBack function is called when the request is successful.


getPaperDetailsSuccess()

When the getPaperDetails action is successful, you want to display the results in the search list.

+   (void) getPaperDetailsSuccess (response)

Parameters

response {Object} The response object from the AJAX request.


handleError()

Generic error handler.

+   (void) handleError (response, transport)

Parameters

response {Object} The request response.

transport {Object} The AJAX request object.


handleFailure()

Generic failure handler.

+   (void) handleFailure (response, transport)

Parameters

response {Object} The request response.

transport {Object} The AJAX request object.


importRecords()

Import records into the SC Store.

+   (void) importRecords (clientData)

Parameters

clientData {Object} Data that can be imported to the store.


request()

Create the request and call the server.

+   (void) request (requestHash, url, params)

Parameters

requestHash {Object} The request parameters.

url {string} The url for the request.

params {Object} The parameters for the request.


requestError()

Generic error, then pass it along to the generic error handler for the request.

+   (Boolean) requestError (requestHash, transport)

Parameters

requestHash {Object} The request parameters.

transport {Object} The AJAX request object.

Returns

(Boolean) Returns NO if there is an error.


requestFailure()

Generic failure, then pass it along to the generic failure handler for the request.

+   (Boolean) requestFailure (requestHash, transport)

Parameters

requestHash {Object} The request parameters.

transport {Object} The AJAX request object.

Returns

(Boolean) Returns NO if there is an error.


requestSuccess()

Generic success, parse the JSON and insert it into the SC Store, then pass it along to the custom success handler for the request.

+   (Boolean) requestSuccess (requestHash, transport)

Parameters

requestHash {Object} The request parameters.

transport {Object} The AJAX request object.

Returns

(Boolean) Returns NO if there is an error.


searchAuthors()

Searches against a key and value in the database for authors.

+   (Boolean) searchAuthors (searchKey, searchValue, sc, start, limit)

Parameters

searchKey {string} The field key that is searched against.

searchValue {string} The field value that is search against.

sc {Integer} The searchCount parameter. Used for determining what is shown in search list.

start {Integer} The start index.

limit {Integer} The limit.

Returns

(Boolean) Returns NO if there is an error.


searchAuthorsSuccess()

When the searchAuthors action is successful, you want to display the results in the search list.

+   (void) searchAuthorsSuccess (response)

Parameters

response {Object} The response object from the AJAX request.


searchPapers()

Searches against a key and value in the database for papers.

+   (Boolean) searchPapers (searchKey, searchValue, sc, start, limit)

Parameters

searchKey {string} The field key that is searched against.

searchValue {string} The field value that is search against.

sc {Integer} The searchCount parameter, it is used for determining what is shown in search list.

start {Integer} The start index.

limit {Integer} The limit.

Returns

(Boolean) Returns NO if there is an error.


searchPapersSuccess()

When the searchPapers action is successful, you want to display the results in the search list.

+   (void) searchPapersSuccess (response)

Parameters

response {Object} The response object from the AJAX request.


Documentation generated by JsDoc Toolkit 2.0.2 on Sat Nov 21 2009 21:24:35 GMT-0800 (PST)