function exportCubeMixin(cubeDef) {
        
        var app = this;
        var task = new Task();

        promise().then(function() {

            // Start

            task.running('info', 'Starting!');

        }).then(function(reply) {

            // Create cube

            return app.createSessionObject({
                qHyperCubeDef: cubeDef,
                qInfo: {
                    qType: 'mashup'
                }
            }).then(function(reply) {
                task.running('info', 'Cube generated');
                return reply;
            })

        }).then(function(sessionObject) {

            // Get cube layout

            return promise.all([
                sessionObject,
                sessionObject.getLayout().then(function(reply) {
                    task.running('info', 'Got cube layout');
                    return reply;
                })
            ])

        }).then(function([sessionObject, cubeLayout]) {

            // Get cube pages

            var columns = cubeLayout.qHyperCube.qSize.qcx;
            var totalheight = cubeLayout.qHyperCube.qSize.qcy;
            var pageheight = Math.floor(10000 / columns);
            var numberOfPages = Math.ceil(totalheight / pageheight);

            var pages = Array.apply(null, new Array(numberOfPages)).map(function(data, index) {

                return sessionObject.getHyperCubeData(
                    '/qHyperCubeDef',
                    [{
                        qTop: (pageheight * index),
                        qLeft: 0,
                        qWidth: columns,
                        qHeight: pageheight
                    }]
                ).then((page) => {
                    task.running('page', page);
                    return page;
                });

            }, this);

            return promise.all(pages).then(function(pages) {
                return promise.all([
                    sessionObject,
                    cubeLayout,
                    pages
                ]);
            });

        }).then(function([sessionObject, cubeLayout, pages]) {

            pages = [].concat.apply([], pages.map(function(item) {
                return item[0].qMatrix;
            }));

            task.done(pages);
            return pages;

        }).fail(function(err) {

            task.failed(err);
            return promise.reject(err);

        });
        
        if (returnObservable) {
            return task;
        } else {
            return task.toPromise(extPromise);
        }

    }
function exportCubeMixin(cubeDef) {
        
        var app = this;
        var task = new Task();

        promise().then(function() {

            

            task.running('info', 'Starting!');

        }).then(function(reply) {

            

            return app.createSessionObject({
                qHyperCubeDef: cubeDef,
                qInfo: {
                    qType: 'mashup'
                }
            }).then(function(reply) {
                task.running('info', 'Cube generated');
                return reply;
            })

        }).then(function(sessionObject) {

            

            return promise.all([
                sessionObject,
                sessionObject.getLayout().then(function(reply) {
                    task.running('info', 'Got cube layout');
                    return reply;
                })
            ])

        }).then(function([sessionObject, cubeLayout]) {

            

            var columns = cubeLayout.qHyperCube.qSize.qcx;
            var totalheight = cubeLayout.qHyperCube.qSize.qcy;
            var pageheight = Math.floor(10000 / columns);
            var numberOfPages = Math.ceil(totalheight / pageheight);

            var pages = Array.apply(null, new Array(numberOfPages)).map(function(data, index) {

                return sessionObject.getHyperCubeData(
                    '/qHyperCubeDef',
                    [{
                        qTop: (pageheight * index),
                        qLeft: 0,
                        qWidth: columns,
                        qHeight: pageheight
                    }]
                ).then((page) => {
                    task.running('page', page);
                    return page;
                });

            }, this);

            return promise.all(pages).then(function(pages) {
                return promise.all([
                    sessionObject,
                    cubeLayout,
                    pages
                ]);
            });

        }).then(function([sessionObject, cubeLayout, pages]) {

            pages = [].concat.apply([], pages.map(function(item) {
                return item[0].qMatrix;
            }));

            task.done(pages);
            return pages;

        }).fail(function(err) {

            task.failed(err);
            return promise.reject(err);

        });
        
        if (returnObservable) {
            return task;
        } else {
            return task.toPromise(extPromise);
        }

    }
function exportCubeMixin ( cubeDef ) { var app = this ; var task = new Task ( ) ; promise ( ) . then ( function ( ) { // Start task . running ( 'info' , 'Starting!' ) ; } ) . then ( function ( reply ) { // Create cube return app . createSessionObject ( { qHyperCubeDef : cubeDef , qInfo : { qType : 'mashup' } } ) . then ( function ( reply ) { task . running ( 'info' , 'Cube generated' ) ; return reply ; } ) } ) . then ( function ( sessionObject ) { // Get cube layout return promise . all ( [ sessionObject , sessionObject . getLayout ( ) . then ( function ( reply ) { task . running ( 'info' , 'Got cube layout' ) ; return reply ; } ) ] ) } ) . then ( function ( [ sessionObject , cubeLayout ] ) { // Get cube pages var columns = cubeLayout . qHyperCube . qSize . qcx ; var totalheight = cubeLayout . qHyperCube . qSize . qcy ; var pageheight = Math . floor ( 10000 / columns ) ; var numberOfPages = Math . ceil ( totalheight / pageheight ) ; var pages = Array . apply ( null , new Array ( numberOfPages ) ) . map ( function ( data , index ) { return sessionObject . getHyperCubeData ( '/qHyperCubeDef' , [ { qTop : ( pageheight * index ) , qLeft : 0 , qWidth : columns , qHeight : pageheight } ] ) . then ( ( page ) => { task . running ( 'page' , page ) ; return page ; } ) ; } , this ) ; return promise . all ( pages ) . then ( function ( pages ) { return promise . all ( [ sessionObject , cubeLayout , pages ] ) ; } ) ; } ) . then ( function ( [ sessionObject , cubeLayout , pages ] ) { pages = [ ] . concat . apply ( [ ] , pages . map ( function ( item ) { return item [ 0 ] . qMatrix ; } ) ) ; task . done ( pages ) ; return pages ; } ) . fail ( function ( err ) { task . failed ( err ) ; return promise . reject ( err ) ; } ) ; if ( returnObservable ) { return task ; } else { return task . toPromise ( extPromise ) ; } }
Exports a cube

@param cubeDef the cube definition
@returns {Task.<Array.<Page>>} a task resolving to the cube pages
Exports a cube