Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for making requests on design views for documents.
- Loading branch information
Todd Anderson
committed
Mar 26, 2010
1 parent
4696657
commit 494e78e
Showing
9 changed files
with
122 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/com/custardbelly/as3couchdb/responder/ReadDocumentsFromViewResponder.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.custardbelly.as3couchdb.responder | ||
{ | ||
import com.custardbelly.as3couchdb.core.CouchDocument; | ||
import com.custardbelly.as3couchdb.core.CouchServiceFault; | ||
import com.custardbelly.as3couchdb.core.CouchServiceResult; | ||
import com.custardbelly.as3couchdb.enum.CouchActionType; | ||
|
||
public class ReadDocumentsFromViewResponder extends ReadAllDocumentsResponder | ||
{ | ||
public function ReadDocumentsFromViewResponder(documentClass:String, responder:ICouchServiceResponder) | ||
{ | ||
super(documentClass, responder); | ||
} | ||
|
||
override public function handleResult( value:CouchServiceResult ):void | ||
{ | ||
var result:Object = value.data; | ||
if( _databaseReader.isResultAnError( result ) ) | ||
{ | ||
handleFault( new CouchServiceFault( result["error"], result["reason"] ) ); | ||
} | ||
else | ||
{ | ||
var documents:Array = _databaseReader.getDocumentListFromResult( result ); | ||
|
||
var i:int; | ||
var document:CouchDocument; | ||
var documentList:Array = []; | ||
for( i = 0; i < documents.length; i++ ) | ||
{ | ||
// Documents are assume to be returned from map/reduce as ( key:id, value:doc ). | ||
document = _documentReader.createDocumentFromResult( _documentClass, documents[i].value ); | ||
documentList.push( document ); | ||
} | ||
|
||
if( _responder ) _responder.handleResult( new CouchServiceResult( CouchActionType.READ_DOCUMENTS, documentList ) ); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters