77
88var request = require ( "request" ) ,
99 url = require ( "url" ) ,
10- defaultDataContext = require ( "./dataContext.js" ) ,
1110 concat = require ( 'concat-stream' ) ;
1211
1312module . exports = function ( url , username , password ) {
@@ -18,37 +17,6 @@ var Client = function (url, username, password) {
1817 this . url = url ;
1918 this . username = username ;
2019 this . password = password ;
21- this . entitySets = defaultDataContext ;
22- }
23-
24- /**
25- * Create jaydata entity context able to do quries and CRUD over a remote jsreport server entities
26- * @param cb nodejs style callback
27- */
28- Client . prototype . createDataContext = function ( cb ) {
29-
30- if ( ! this . DataContext ) {
31- this . DataContext = $data . EntityContext . extend ( "entity.Context" , this . entitySets ) ;
32- }
33- var dataContext = new ( this . DataContext ) ( {
34- name : 'oData' ,
35- oDataServiceHost : url . resolve ( this . url , "odata" ) ,
36- user : this . username ,
37- password : this . password
38- } ) ;
39-
40- dataContext . onReady ( function ( context ) {
41- cb ( null , context ) ;
42- } ) ;
43- } ;
44-
45- Client . prototype . registerAdditionalEntitySet = function ( name , type ) {
46- var entitySet = { type : $data . EntitySet , elementType : type } ;
47- this . entitySets [ name ] = entitySet ;
48- }
49-
50- Client . prototype . createEntityType = function ( name , attributes ) {
51- return $data . Class . define ( name , $data . Entity , null , attributes , null ) ;
5220}
5321
5422/**
0 commit comments