text:
/*
 * Reference implementation of UI component.
 *
 * Interface to get or set some essential information sent from SDLCore. UI is
 * responsible for the functionality provided by the application: display
 * graphics and multimedia components, is responsible for the transfer of
 * managed manipulations, generated by the user to the server.
 *
 */

FFW.UI = FFW.RPCObserver.create({

    /**
     * If true then UI is present and ready to communicate with SDL.
     *
     * @type {Boolean}
     */
    isReady: true,

    /**
     * Contains response codes for request that should be processed but there were some kind of errors
     * Error codes will be injected into response.
     */
    errorResponsePull: {},

    /**
     * access to basic RPC functionality
     */
    client: FFW.RPCClient.create({
        componentName: "UI"
    }),

    // temp var for debug
    appID: 1,

    onRecordStartSubscribeRequestID: -1,

    onRecordStartUnsubscribeRequestID: -1,

    // const
    onRecordStartNotification: "UI.OnRecordStart",

    /**
     * ids for requests AudioPassThru
     */
    performAudioPassThruRequestID: -1,
    endAudioPassThruRequestID: -1,

    /**
     * connect to RPC bus
     */
    connect: function () {

        this.client.connect(this, 400); // Magic number is unique identifier
        // for component
    },

    /**
     * disconnect from RPC bus
     */
    disconnect: function () {

        this.onRPCUnregistered();
        this.client.disconnect();
    },

    /**
     * Client is registered - we can send request starting from this point
     * of time
     */
    onRPCRegistered: function () {

        Em.Logger.log("FFW.UI.onRPCRegistered");
        this._super();

        // subscribe to notifications
        this.onRecordStartSubscribeRequestID = this.client.subscribeToNotification(this.onRecordStartNotification);
    },

    /**
     * Client is unregistered - no more requests
     */
    onRPCUnregistered: function () {

        Em.Logger.log("FFW.UI.onRPCUnregistered");
        this._super();

        // unsubscribe from notifications
        this.onRecordStartUnsubscribeRequestID = this.client.unsubscribeFromNotification(this.onRecordStartNotification);
    },

    /**
     * Client disconnected.
     */
    onRPCDisconnected: function () {

    },

    /**
     * when result is received from RPC component this function is called It
     * is the propriate place to check results of request execution Please
     * use previously store reuqestID to determine to which request repsonse
     * belongs to
     */
    onRPCResult: function (response) {

        Em.Logger.log("FFW.UI.onRPCResult");
        this._super();
    },

    /**
     * handle RPC erros here
     */
    onRPCError: function (error) {

        Em.Logger.log("FFW.UI.onRPCError");
        this._super();
    },

    /**
     * handle RPC notifications here
     */
    onRPCNotification: function (notification) {

        Em.Logger.log("FFW.UI.onRPCNotification");
        this._super();

        if (notification.method == this.onRecordStartNotification) {
            SDL.AudioPassThruPopUp.StartAudioPassThruTimer();
        }
    },

    /**
     * handle RPC requests here
     */
    onRPCRequest: function (request) {

        Em.Logger.log("FFW.UI.onRPCRequest");

        if (this.validationCheck(request)) {

            switch (request.method) {
                case "UI.Alert":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if (request.params.alertStrings.length > 0
                            || "softButtons" in request.params) {

                            this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
                        } else {
                            //If no available data sent error response and stop process current request

                            this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
                                    "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    if (SDL.SDLModel.onUIAlert(request.params, request.id)) {
                        SDL.SDLController.onSystemContextChange(request.params.appID);
                    }

                    break;
                }
                case "UI.Show":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if (request.params.showStrings.length > 0
                            || "graphic" in request.params
                            || "secondaryGraphic" in request.params
                            || "softButtons" in request.params
                            || "customPresets" in request.params) {

                            this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
                        } else {
                            //If no available data sent error response and stop process current request

                            this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
                            "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    SDL.TurnByTurnView.deactivate();
                    SDL.SDLController.getApplicationModel(request.params.appID).onSDLUIShow(request.params);
                    this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);

                    break;
                }
                case "UI.SetGlobalProperties":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if ("menuTitle" in request.params
                            || "keyboardProperties" in request.params
                            || "vrHelp" in request.params
                            || "menuIcon" in request.params) {

                            this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
                        } else {
                            //If no available data sent error response and stop process current request

                            this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
                                    "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    SDL.SDLModel.setProperties(request.params);

                    this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);

                    break;
                }
                case "UI.AddCommand":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if ("cmdIcon" in request.params
                            || "menuParams" in request.params) {

                            this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
                        } else {
                            //If no available data sent error response and stop process current request

                            this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
                                    "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    SDL.SDLController.getApplicationModel(request.params.appID).addCommand(request);

                    break;
                }
                case "UI.DeleteCommand":
                {

                    SDL.SDLController.getApplicationModel(request.params.appID).deleteCommand(request.params.cmdID, request.id);

                    break;
                }
                case "UI.AddSubMenu":
                {

                    SDL.SDLController.getApplicationModel(request.params.appID).addSubMenu(request);

                    break;
                }
                case "UI.DeleteSubMenu":
                {

                    var resultCode = SDL.SDLController.getApplicationModel(request.params.appID).deleteSubMenu(request.params.menuID);
                    this.sendUIResult(resultCode, request.id, request.method);

                    break;
                }
                case "UI.PerformInteraction":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if ("choiceSet" in request.params
                            && request.params
                            && request.params.interactionLayout != "KEYBOARD") {

                            this.errorResponsePull[request.id].code = SDL.SDLModel.resultCode["WARNINGS"];
                        } else {
                            //If no available data sent error response and stop process current request

                            this.sendError(this.errorResponsePull[request.id].code,
                                request.id,
                                request.method,
                                "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    if (SDL.SDLModel.uiPerformInteraction(request)) {
                        SDL.SDLController.onSystemContextChange();
                    }

                    break;
                }
                case "UI.SetMediaClockTimer":
                {

                    var resultCode = SDL.SDLController.getApplicationModel(request.params.appID).sdlSetMediaClockTimer(request.params);
                    if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
                        this.sendUIResult(resultCode, request.id, request.method);
                    } else {
                        this.sendError(resultCode,
                            request.id,
                            request.method,
                            'Request is ignored, because the intended result is already in effect.');
                    }

                    break;
                }
                case "UI.Slider":
                {

                    if (SDL.SDLModel.uiSlider(request)) {
                        SDL.SDLController.onSystemContextChange();
                    }

                    break;
                }
                case "UI.ScrollableMessage":
                {

                    if (SDL.SDLModel.onSDLScrolableMessage(request, request.id)) {
                        SDL.SDLController.onSystemContextChange();
                    }

                    break;
                }
                case "UI.ChangeRegistration":
                {

                    if (request.params.appName) {
                        SDL.SDLController.getApplicationModel(request.params.appID).set('appName',
                            request.params.appName);
                    }

                    SDL.SDLModel.changeRegistrationUI(request.params.language,
                        request.params.appID,
                        request.params.appName);
                    this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);

                    break;
                }
                case "UI.SetDisplayLayout":
                {

                    var senResponseFlag = false;

                    switch (request.params.displayLayout){
                        case "MEDIA": {
                            senResponseFlag = true;
                            break;
                        }
                        case "NON-MEDIA": {
                            senResponseFlag = true;
                            break;
                        }
                        case "DEFAULT": {
                            senResponseFlag = true;
                            break;
                        }
                        case "ONSCREEN_PRESETS": {
                            senResponseFlag = true;
                            break;
                        }
                        case "NAV_FULLSCREEN_MAP": {
                            senResponseFlag = true;
                            break;
                        }
                        case "NAV_KEYBOARD": {
                            senResponseFlag = true;
                            break;
                        }
                        case "NAV_LIST": {
                            senResponseFlag = true;
                            break;
                        }
                    }

                    if (senResponseFlag) {

                        Em.Logger.log("FFW." + request.method + "Response");

                        // send repsonse
                        var JSONMessage = {
                            "jsonrpc": "2.0",
                            "id": request.id,
                            "result": {
                                "displayCapabilities": {
                                    "displayType": "GEN2_8_DMA",
                                    "textFields": [{
                                            "name": "mainField1",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "mainField2",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "mainField3",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "mainField4",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "statusBar",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "mediaClock",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "mediaTrack",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "alertText1",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "alertText2",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "alertText3",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "scrollableMessageBody",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "initialInteractionText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "navigationText1",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "navigationText2",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "ETA",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "totalDistance",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "navigationText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "audioPassThruDisplayText1",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "audioPassThruDisplayText2",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "sliderHeader",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "sliderFooter",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "notificationText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "menuName",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "secondaryText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "tertiaryText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "timeToDestination",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "turnText",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "menuTitle",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "locationName",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "locationDescription",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "addressLines",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        },
                                        {
                                            "name": "phoneNumber",
                                            "characterSet": "TYPE2SET",
                                            "width": 500,
                                            "rows": 1
                                        }
                                    ],
                                    "imageFields": [
                                        {
                                            "name": "softButtonImage",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "choiceImage",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "choiceSecondaryImage",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "vrHelpItem",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "turnIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "menuIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "cmdIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "graphic",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "showConstantTBTIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "showConstantTBTNextTurnIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        },
                                        {
                                            "name": "showConstantTBTNextTurnIcon",
                                            "imageTypeSupported":
                                                [
                                                    "GRAPHIC_BMP",
                                                    "GRAPHIC_JPEG",
                                                    "GRAPHIC_PNG"
                                                ],
                                            "imageResolution":
                                            {
                                                "resolutionWidth": 64,
                                                "resolutionHeight": 64
                                            }
                                        }
                                    ],
                                    "mediaClockFormats": [
                                        "CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4"
                                    ],
                                    "graphicSupported": true,
                                    "imageCapabilities": ["DYNAMIC", "STATIC"],
                                    "templatesAvailable": [request.params.displayLayout],
                                    "screenParams": {
                                        "resolution": {
                                            "resolutionWidth": 800,
                                            "resolutionHeight": 480
                                        },
                                        "touchEventAvailable": {
                                            "pressAvailable": true,
                                            "multiTouchAvailable": true,
                                            "doublePressAvailable": false
                                        }
                                    },
                                    "numCustomPresetsAvailable": 10
                                },
                                "buttonCapabilities": [
                                    {
                                        "name": "PRESET_0",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_1",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_2",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_3",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_4",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_5",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_6",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_7",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_8",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "PRESET_9",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "OK",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "SEEKLEFT",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "SEEKRIGHT",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "TUNEUP",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }, {
                                        "name": "TUNEDOWN",
                                        "shortPressAvailable": true,
                                        "longPressAvailable": true,
                                        "upDownAvailable": true
                                    }
                                ],
                                "softButtonCapabilities": [{
                                    "shortPressAvailable": true,
                                    "longPressAvailable": true,
                                    "upDownAvailable": true,
                                    "imageSupported": true
                                }],
                                "presetBankCapabilities": {
                                    "onScreenPresetsAvailable": true
                                },
                                "code": SDL.SDLModel.resultCode["SUCCESS"],
                                "method": "UI.SetDisplayLayout"
                            }
                        };

                        this.client.send(JSONMessage);

                    } else {
                        this.sendError(SDL.SDLModel.resultCode["UNSUPPORTED_RESOURCE"], request.id, request.method, "Unsupported display layout!")
                    }

                    break;
                }
                case "UI.SetAppIcon":
                {

                    // Werify if there is an ansupported data in request
                    if (this.errorResponsePull[request.id] != null) {

                        //Check if there is any available data to  process the request
                        if (!("syncFileName" in request.params)) {

                            this.sendError(this.errorResponsePull[request.id].code, request.id, request.method,
                                    "Unsupported " + this.errorResponsePull[request.id].type + " type. Request was not processed.");
                            this.errorResponsePull[request.id] = null;

                            return;
                        }
                    }

                    SDL.SDLModel.onSDLSetAppIcon(request.params, request.id, request.method);

                    break;
                }
                case "UI.PerformAudioPassThru":
                {

                    if (this.performAudioPassThruRequestID > 0) {
                        this.sendError(
                            SDL.SDLModel.resultCode["REJECTED"],
                            request.id,
                            request.method,
                            'PerformAudioPassThru request aborted!');
                    } else {

                        this.performAudioPassThruRequestID = request.id;
                        SDL.SDLModel.UIPerformAudioPassThru(request.params);

                        SDL.SDLController.onSystemContextChange();
                    }

                    break;
                }
                case "UI.EndAudioPassThru":
                {

                    this.endAudioPassThruRequestID = request.id;

                    SDL.SDLModel.UIEndAudioPassThru();

                    break;
                }
                case "UI.GetSupportedLanguages":
                {

                    Em.Logger.log("FFW." + request.method + "Response");

                    var JSONMessage = {
                        "id": request.id,
                        "jsonrpc": "2.0",
                        "result": {
                            "code": SDL.SDLModel.resultCode["SUCCESS"], // type
                            // (enum)
                            // from
                            // SDL
                            "method": "UI.GetSupportedLanguages",
                            "languages": SDL.SDLModel.sdlLanguagesList
                        }
                    };
                    this.client.send(JSONMessage);

                    break;
                }
                case "UI.GetLanguage":
                {

                    Em.Logger.log("FFW." + request.method + "Response");

                    var JSONMessage = {
                        "jsonrpc": "2.0",
                        "id": request.id,
                        "result": {
                            "code": SDL.SDLModel.resultCode["SUCCESS"], // type
                            // (enum)
                            // from
                            // SDL
                            "method": "UI.GetLanguage",
                            "language": SDL.SDLModel.hmiUILanguage
                        }
                    };
                    this.client.send(JSONMessage);

                    break;
                }
                case "UI.GetCapabilities":
                {

                    Em.Logger.log("FFW." + request.method + "Response");
                    // send repsonse
                    var JSONMessage = {
                        "jsonrpc": "2.0",
                        "id": request.id,
                        "result": {
                            "displayCapabilities": {
                                "displayType": "GEN2_8_DMA",
                                "textFields": [{
                                        "name": "mainField1",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "mainField2",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "mainField3",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "mainField4",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "statusBar",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "mediaClock",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "mediaTrack",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "alertText1",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "alertText2",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "alertText3",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "scrollableMessageBody",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "initialInteractionText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "navigationText1",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "navigationText2",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "ETA",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "totalDistance",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "navigationText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "audioPassThruDisplayText1",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "audioPassThruDisplayText2",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "sliderHeader",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "sliderFooter",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "notificationText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "menuName",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "secondaryText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "tertiaryText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "timeToDestination",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "turnText",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "menuTitle",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "locationName",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "locationDescription",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "addressLines",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    },
                                    {
                                        "name": "phoneNumber",
                                        "characterSet": "TYPE2SET",
                                        "width": 500,
                                        "rows": 1
                                    }
                                ],
                                "imageFields": [
                                    {
                                        "name": "softButtonImage",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "choiceImage",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "choiceSecondaryImage",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "vrHelpItem",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "turnIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "menuIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "cmdIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "graphic",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "showConstantTBTIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "showConstantTBTNextTurnIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    },
                                    {
                                        "name": "showConstantTBTNextTurnIcon",
                                        "imageTypeSupported":
                                            [
                                                "GRAPHIC_BMP",
                                                "GRAPHIC_JPEG",
                                                "GRAPHIC_PNG"
                                            ],
                                        "imageResolution":
                                        {
                                            "resolutionWidth": 64,
                                            "resolutionHeight": 64
                                        }
                                    }
                                ],
                                "mediaClockFormats": [
                                    "CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4"
                                ],
                                "graphicSupported": true,
                                "imageCapabilities": ["DYNAMIC", "STATIC"],
                                "templatesAvailable": ["TEMPLATE"],
                                "screenParams": {
                                    "resolution": {
                                        "resolutionWidth": 800,
                                        "resolutionHeight": 480
                                    },
                                    "touchEventAvailable": {
                                        "pressAvailable": true,
                                        "multiTouchAvailable": true,
                                        "doublePressAvailable": false
                                    }
                                },
                                "numCustomPresetsAvailable": 10
                            },
                            "audioPassThruCapabilities": {
                                "samplingRate": "44KHZ",
                                "bitsPerSample": "8_BIT",
                                "audioType": "PCM"
                            },
                            "hmiZoneCapabilities": "FRONT",
                            "softButtonCapabilities": {
                                "shortPressAvailable": true,
                                "longPressAvailable": true,
                                "upDownAvailable": true,
                                "imageSupported": true
                            },
                            "code": SDL.SDLModel.resultCode["SUCCESS"],
                            "method": "UI.GetCapabilities"
                        }
                    };

                    this.client.send(JSONMessage);

                    break;
                }
                case "UI.IsReady":
                {

                    Em.Logger.log("FFW." + request.method + "Response");
                    // send repsonse
                    var JSONMessage = {
                        "jsonrpc": "2.0",
                        "id": request.id,
                        "result": {
                            "available": this.get('isReady'),
                            "code": SDL.SDLModel.resultCode["SUCCESS"],
                            "method": "UI.IsReady"
                        }
                    };

                    this.client.send(JSONMessage);

                    break;
                }
                case "UI.ClosePopUp":
                {

                    SDL.SDLController.closePopUp(request.params.methodName);

                    Em.Logger.log("FFW." + request.method + "Response");
                    // send repsonse
                    var JSONMessage = {
                        "jsonrpc": "2.0",
                        "id": request.id,
                        "result": {
                            "code": SDL.SDLModel.resultCode["SUCCESS"],
                            "method": "UI.ClosePopUp"
                        }
                    };

                    this.client.send(JSONMessage);

                    break;
                }
                case "UI.ShowVrHelp":
                {

                    //SDL.SDLModel.ShowVrHelp(request.params);

                    this.sendUIResult(SDL.SDLModel.resultCode["SUCCESS"], request.id, request.method);

                    break;
                }
                default:
                {
                    // statements_def
                    break;
                }
            }
        }
    },

    /**
     * Send error response from onRPCRequest
     *
     * @param {Number}
     *            resultCode
     * @param {Number}
     *            id
     * @param {String}
     *            method
     */
    sendError: function (resultCode, id, method, message) {

        Em.Logger.log("FFW." + method + "Response");

        if (resultCode !== 0) {

            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": id,
                "error": {
                    "code": resultCode, // type (enum) from SDL protocol
                    "message": message,
                    "data": {
                        "method": method
                    }
                }
            };
            this.client.send(JSONMessage);
        }
    },

    /**
     * send response from onRPCRequest
     *
     * @param {Number}
     *            resultCode
     * @param {Number}
     *            id
     * @param {String}
     *            method
     */
    sendUIResult: function (resultCode, id, method) {

        if (this.errorResponsePull[id]) {

            this.sendError(this.errorResponsePull[id].code, id, method,
                    "Unsupported " + this.errorResponsePull[id].type + " type. Available data in request was processed.");
            this.errorResponsePull[id] = null;
            return;
        }

        Em.Logger.log("FFW." + method + "Response");

        if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {

            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": id,
                "result": {
                    "code": resultCode, // type (enum) from SDL protocol
                    "method": method
                }
            };
            this.client.send(JSONMessage);
        }
    },

    /**
     * send response from onRPCRequest
     *
     * @param {Number}
     *            resultCode
     * @param {Number}
     *            id
     */
    alertResponse: function (resultCode, id) {

        Em.Logger.log("FFW.UI.AlertResponse");

        switch (resultCode) {
            case SDL.SDLModel.resultCode["SUCCESS"]: {

                this.sendUIResult(resultCode, id, 'UI.Alert');

                break;
            }
            case SDL.SDLModel.resultCode["ABORTED"]: {

                this.sendError(resultCode, id, "UI.Alert", 'Alert request aborted.');
                break;
            }
            case SDL.SDLModel.resultCode["REJECTED"]: {

                this.sendError(resultCode, id, "UI.Alert", 'Another Alert is active.');
                break;
            }
        }
    },

    /**
     * send response from onRPCRequest
     *
     * @param {Number}
     *            resultCode
     * @param {Number}
     *            sliderRequestID
     * @param {Number}
     *            sliderPosition
     */
    sendSliderResult: function (resultCode, sliderRequestID, sliderPosition) {

        Em.Logger.log("FFW.UI.SliderResponse");

        if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {

            //this.sendUIResult(resultCode, id, 'UI.Alert');
            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": sliderRequestID,
                "result": {
                    "code": resultCode, // type (enum) from SDL protocol
                    "method": 'UI.Slider'
                }
            };

            if (sliderPosition) {
                JSONMessage.result.sliderPosition = sliderPosition;
            }
        } else {
            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": sliderRequestID,
                "error": {
                    "code": resultCode, // type (enum) from SDL protocol
                    "message": 'Slider request ABORTED or TIMED OUT.',
                    "data": {
                        "method": 'UI.Slider'
                    }
                }
            };

            if (sliderPosition) {
                JSONMessage.error.data.sliderPosition = sliderPosition;
            }
        }

        this.client.send(JSONMessage);
    },

    /**
     * Notification method to send touch event data to SDLCore
     *
     * @param {Number} appID
     * @param {String} methodName
     */
    onResetTimeout: function (appID, methodName) {

        Em.Logger.log("FFW.UI.OnResetTimeout");

        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnResetTimeout",
            "params": {
                "methodName": methodName,
                "appID": appID
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     * send notification when command was triggered
     *
     * @param {Number}
     *            commandID
     * @param {Number}
     *            appID
     */
    onCommand: function (commandID, appID) {

        Em.Logger.log("FFW.UI.onCommand");

        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnCommand",
            "params": {
                "cmdID": commandID,
                "appID": appID
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     * Notification method to send touch event data to SDLCore
     *
     * @param {String} type
     * @param {Object} touchLists
     * @param {Object} info
     */
    onTouchEvent: function (type, event) {

        Em.Logger.log("FFW.UI.OnTouchEvent");

        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnTouchEvent",
            "params": {
                "type": type,
                "event": event
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     * send notification when command was triggered
     *
     * @param {Number}
     *            softButtonID
     * @param {Number}
     *            appID
     */
    onCommandSoftButton: function (softButtonID, appID) {

        Em.Logger.log("FFW.UI.onCommand");

        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnCommand",
            "params": {
                "commandID": softButtonID,
                "appID": appID
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     * send notification when command was triggered
     *
     * @param {Number} requestID
     * @param {Number} resultCode
     * @param {Number} commandID
     * @param {String} manualTextEntry
     */
    interactionResponse: function (requestID, resultCode, commandID, manualTextEntry) {

        Em.Logger.log("FFW.UI.PerformInteractionResponse");

        if (this.errorResponsePull[requestID]) {

            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": requestID,
                "error": {
                    "code": this.errorResponsePull[requestID].code,
                    "message": "Unsupported " + this.errorResponsePull[requestID].type
                    + " type. Available data in request was processed.",
                    "data": {
                        "method": "UI.PerformInteraction"
                    }
                }
            };

            if (commandID) {
                JSONMessage.error.data.choiceID = commandID;
            }

            if (manualTextEntry != null) {
                JSONMessage.error.data.manualTextEntry = manualTextEntry;
            }

            this.client.send(JSONMessage);
            this.errorResponsePull[requestID] = null;
            return;
        }

        if (resultCode === SDL.SDLModel.resultCode["SUCCESS"]) {
            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": requestID,
                "result": {
                    "code": resultCode,
                    "method": "UI.PerformInteraction"
                }
            };

            if (commandID) {
                JSONMessage.result.choiceID = commandID;
            }

            if (manualTextEntry != null) {
                JSONMessage.result.manualTextEntry = manualTextEntry;
            }
        } else {
            // send repsonse
            var JSONMessage = {
                "jsonrpc": "2.0",
                "id": requestID,
                "error": {
                    "code": resultCode, // type (enum) from SDL protocol
                    "message": "Perform Interaction error response.",
                    "data": {
                        "method": "UI.PerformInteraction"
                    }
                }
            };
        }

        this.client.send(JSONMessage);
    },

    /**
     * send notification when DriverDistraction PopUp is visible
     *
     * @param {String}
     *            driverDistractionState
     */
    onDriverDistraction: function (driverDistractionState) {

        Em.Logger.log("FFW.UI.DriverDistraction");

        // send repsonse
        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnDriverDistraction",
            "params": {
                "state": driverDistractionState
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     * Notifies if system context is changed
     *
     * @param {String}
     *            systemContextValue
     */
    OnSystemContext: function (systemContextValue, appID) {

        Em.Logger.log("FFW.UI.OnSystemContext");

        // send repsonse
        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnSystemContext",
            "params": {
                "systemContext": systemContextValue
            }
        };

        if (appID) {
            JSONMessage.params.appID = appID;
        }

        this.client.send(JSONMessage);
    },

    /**
     * Notifies if sdl UI components language was changed
     *
     * @param {String}
     *            lang
     */
    OnLanguageChange: function (lang) {

        Em.Logger.log("FFW.UI.OnLanguageChange");

        // send repsonse
        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnLanguageChange",
            "params": {
                "language": lang
            }
        };
        this.client.send(JSONMessage);
    },

    /**
     *  Sends notification on SDL Core display keyboard value
     *
     * @param {String}
     *
     */
    OnKeyboardInput: function (value, event) {

        Em.Logger.log("FFW.UI.OnKeyboardInput");

        // send repsonse
        var JSONMessage = {
            "jsonrpc": "2.0",
            "method": "UI.OnKeyboardInput",
            "params": {
                "data": value,
                "event": event
            }
        };
        this.client.send(JSONMessage);
    }
})


text:
package com.example.driverapp.entity;

/**
 *
 * @School驾校
 *
 */
public class School {
	/** 驾校id */
	private int id;
	/** 驾校编号 */
	private String no;
	/** 驾校名称 */
	private String name;
	/** 驾校logo图片 */
	private String logo_url;
	/** 所属地区 */
	private County county;
	/** 驾校地址 */
	private String address;

	public School() {
		// TODO Auto-generated constructor stub
	}

	public School(int id, String no, String name, String logo_url,
			County county, String address) {
		super();
		this.id = id;
		this.no = no;
		this.name = name;
		this.logo_url = logo_url;
		this.county = county;
		this.address = address;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNo() {
		return no;
	}

	public void setNo(String no) {
		this.no = no;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLogo_url() {
		return logo_url;
	}

	public void setLogo_url(String logo_url) {
		this.logo_url = logo_url;
	}

	public County getCounty() {
		return county;
	}

	public void setCounty(County county) {
		this.county = county;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

}

redpajama_set_name: RedPajamaGithub


text: A pure Java WS-Man client implemented using JAX-WS & CXF.


text:
package org.apache.activemq.artemis.tests.integration.amqp;

import javax.jms.Connection;
import javax.jms.DeliveryMode;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Test;

public class JMSTransactedRedeliveryBugTest extends JMSClientTestSupport {

   private static final String INITIAL_QUEUE_NAME = "InitialQueue";
   private static final String FINAL_QUEUE_NAME = "FinalQueue";

   private static final SimpleString INITIAL_QUEUE_SS = new SimpleString(INITIAL_QUEUE_NAME);
   private static final SimpleString FINAL_QUEUE_SS = new SimpleString(FINAL_QUEUE_NAME);

   @Override
   protected void addConfiguration(ActiveMQServer server) {
      server.getAddressSettingsRepository().addMatch(INITIAL_QUEUE_NAME, new AddressSettings().setExpiryAddress(FINAL_QUEUE_SS));
   }

   @Override
   protected void createAddressAndQueues(ActiveMQServer server) throws Exception {
      super.createAddressAndQueues(server);
      server.addAddressInfo(new AddressInfo(INITIAL_QUEUE_SS, RoutingType.ANYCAST));
      server.createQueue(new QueueConfiguration(INITIAL_QUEUE_SS).setRoutingType(RoutingType.ANYCAST));
      server.addAddressInfo(new AddressInfo(FINAL_QUEUE_SS, RoutingType.ANYCAST));
      server.createQueue(new QueueConfiguration(FINAL_QUEUE_SS).setRoutingType(RoutingType.ANYCAST));
   }

   @Override
   protected String getJmsConnectionURIOptions() {
      return "amqp.traceFrames=true";
   }

   @Test
   public void testAMQPProducerAMQPConsumer() throws Exception {
      Connection producerConnection = createConnection();
      Connection consumerConnection = createConnection();

      try {
         Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Queue producerQueue = producerSession.createQueue(INITIAL_QUEUE_NAME);
         MessageProducer producer = producerSession.createProducer(producerQueue);

         TextMessage sentMessage = producerSession.createTextMessage();
         sentMessage.setStringProperty("something", "KEY");
         sentMessage.setText("how are you");
         producer.send(sentMessage, DeliveryMode.PERSISTENT, 4, 10);

         // Simulate a small pause, else both messages could be consumed if
         // consumer is fast enough
         Wait.assertTrue("Message should have expired", () -> getProxyToQueue(FINAL_QUEUE_NAME).getMessageCount() == 1);

         Session consumerSession = consumerConnection.createSession(true, Session.SESSION_TRANSACTED);
         Queue consumerQueue = consumerSession.createQueue(FINAL_QUEUE_NAME);
         MessageConsumer consumer = consumerSession.createConsumer(consumerQueue);

         Message msg = consumer.receive(1_000);
         assertNotNull(msg);
         assertEquals("1", msg.getStringProperty("JMSXDeliveryCount"));
         assertEquals("KEY", msg.getStringProperty("something"));
         assertEquals("how are you", ((TextMessage) msg).getText());

         consumerSession.rollback();

         msg = consumer.receive(1_000);
         assertNotNull(msg);
         assertEquals("2", msg.getStringProperty("JMSXDeliveryCount"));
         assertEquals("KEY", msg.getStringProperty("something"));
         assertEquals("how are you", ((TextMessage) msg).getText());

         consumerSession.rollback();

         msg = consumer.receive(1_000);
         assertNotNull(msg);
         assertEquals("3", msg.getStringProperty("JMSXDeliveryCount"));
         assertEquals("KEY", msg.getStringProperty("something"));
         assertEquals("how are you", ((TextMessage) msg).getText());

         consumerSession.rollback();

         msg = consumer.receive(1_000);
         assertNotNull(msg);
         assertEquals("4", msg.getStringProperty("JMSXDeliveryCount"));
         assertEquals("KEY", msg.getStringProperty("something"));
         assertEquals("how are you", ((TextMessage) msg).getText());

         consumerSession.rollback();

         msg = consumer.receive(1_000);
         assertNotNull(msg);
         assertEquals("5", msg.getStringProperty("JMSXDeliveryCount"));
         assertEquals("KEY", msg.getStringProperty("something"));
         assertEquals("how are you", ((TextMessage) msg).getText());

         consumerSession.commit();

         consumer.close();
      } finally {
         producerConnection.close();
         consumerConnection.close();
      }
   }
}


text:
package org.semanticweb.elk.reasoner.indexing.model;

/**
 * An {@link IndexedAxiom} that can be modified as a result of updating the
 * {@link ModifiableOntologyIndex} where this object is stored.
 *
 * @author "Yevgeny Kazakov"
 *
 */
public interface ModifiableIndexedAxiom
		extends ModifiableIndexedObject, IndexedAxiom {

	/**
	 * Adds this {@link ModifiableIndexedAxiom} once to the given
	 * {@link ModifiableOntologyIndex}
	 *
	 * @param index
	 *            the {@link ModifiableOntologyIndex} to which this
	 *            {@link ModifiableIndexedAxiom} should be added
	 *
	 * @return {@code true} if this operation was successful and {@code false}
	 *         otherwise; if {@code false} is returned, the index should not
	 *         logically change as the result of calling this method
	 */
	boolean addOccurrence(ModifiableOntologyIndex index);

	/**
	 * Removes this {@link ModifiableIndexedAxiom} once from the given
	 * {@link ModifiableOntologyIndex}
	 *
	 * @param index
	 *            the {@link ModifiableOntologyIndex} from which this
	 *            {@link ModifiableIndexedAxiom} should be removed
	 *
	 * @return {@code true} if this operation was successful and {@code false}
	 *         otherwise; if {@code false} is returned, the index should not
	 *         logically change as the result of calling this method
	 */
	boolean removeOccurrence(ModifiableOntologyIndex index);

	/**
	 * A factory for creating instances
	 *
	 * @author Yevgeny Kazakov
	 *
	 */
	/**
	 * A factory for creating instances
	 *
	 * @author Yevgeny Kazakov
	 *
	 */
	interface Factory extends ModifiableIndexedDisjointClassesAxiom.Factory,
			ModifiableIndexedSubClassOfAxiom.Factory,
			ModifiableIndexedEquivalentClassesAxiom.Factory,
			ModifiableIndexedSubObjectPropertyOfAxiom.Factory,
			ModifiableIndexedObjectPropertyRangeAxiom.Factory,
			ModifiableIndexedDeclarationAxiom.Factory {

		// combined interface

	}

	/**
	 * The visitor pattern for instances
	 *
	 * @author Yevgeny Kazakov
	 *
	 * @param <O>
	 *            the type of the output
	 */
	interface Visitor<O>
			extends ModifiableIndexedDisjointClassesAxiom.Visitor<O>,
			ModifiableIndexedSubClassOfAxiom.Visitor<O>,
			ModifiableIndexedEquivalentClassesAxiom.Visitor<O>,
			ModifiableIndexedSubObjectPropertyOfAxiom.Visitor<O>,
			ModifiableIndexedObjectPropertyRangeAxiom.Visitor<O>,
			ModifiableIndexedDeclarationAxiom.Visitor<O> {

		// combined interface

	}

	<O> O accept(Visitor<O> visitor);

}


text:
import React from 'react';
import {Decorator as Cerebral} from 'cerebral-view-react';
import styles from './styles.css';
import icons from 'common/icons.css';
import elements from 'common/elements.css';

@Cerebral({
  tiers: 'techTree.tiers',
  selectedTierIndex: 'techTree.selectedTierIndex',
  showAddNewTierInput: 'techTree.showAddNewTierInput',
  newTierName: 'techTree.newTierName',
  courses: 'techTree.courses',
  user: 'user',
  showMainAssignmentPopup: 'techTree.showMainAssignmentPopup',
  isExistingAssignment: 'mainAssignment.existingAssignment'
})
class Tiers extends React.Component {
  constructor() {
    super();
  }
  getCourse(courseId) {
    return this.props.courses.find((course) => {
      return course.id === courseId;
    });
  }
  tierIsSolved(tier) {
    if (!tier.courseDependencyList.length) {
      return false;
    }

    return tier.courseDependencyList.every((dependencyCourse) => {
      if (!this.props.user.assignmentsSolved[dependencyCourse.courseId] || !this.getCourse(dependencyCourse.courseId)) {
        return false;
      }

      const solvedAssignmentsCount = Object.keys(this.props.user.assignmentsSolved[dependencyCourse.courseId]).reduce((total, key) => {
        return total + this.props.user.assignmentsSolved[dependencyCourse.courseId][key];
      }, 0);

      return solvedAssignmentsCount === this.getTotalAssignments(this.getCourse(dependencyCourse.courseId));
    });
  }
  getTotalAssignments(course) {
    return course.scenes.map((scene) => {
      return scene.assignments.length;
    }).reduce((total, assignments) => {
      return total + assignments;
    });
  }
  tierIsActive(tier, index) {
    if (index === 0) {
      return true;
    }

    if (this.tierIsSolved(this.props.tiers[index - 1])) {
      return true;
    }
  }
  renderTiers() {
    return this.props.tiers.map((tier, index) => {
      return (

 this.props.signals.techTree.tierClicked({tierIndex: index})}
          className={`
            ${this.props.selectedTierIndex === index ? styles.tierSelected : styles.tier}
            ${this.tierIsActive(tier, index) ? styles.tier : styles.tierDisabled}
            ${this.tierIsSolved(tier) ? styles.tierFinished : styles.tier}
        `}>
          <span className={`${icons.thumbDown} ${tier.disabled ? styles.icon : styles.hide}`}>
          {tier.name}

      );
    });
  }
  onAddTierInputKeyDown = (e) => {
    const keyCode = e.keyCode;

    if (keyCode === 27) { // Escape
      this.props.signals.techTree.addTierAborted();
    }
  }
  onNewTierSubmit(e) {
    e.preventDefault();
    this.props.signals.techTree.newTierSubmitted();
  }
  renderAddNewTier() {
    if (!this.props.user.isAdmin) {
      return null;
    }

    if (this.props.showAddNewTierInput) {
      return (
        <form
          onSubmit={(e) => this.onNewTierSubmit(e)}
          className={`${styles.tier} ${styles.tierAddNew}`}>
          <input
            value={this.props.newTierName}
            className={`${styles.inputAddNewTier} ${elements.input}`}
            onBlur={this.props.signals.techTree.addTierAborted}
            onChange={(e) => this.props.signals.techTree.newTierNameUpdated({name: e.target.value})}
            onKeyDown={(e) => this.onAddTierInputKeyDown(e)}
            placeholder = "Navn..."
            autoFocus />
        </form>
      );
    }

    return (

 this.props.signals.techTree.addTierClicked()}
        className={`${styles.tier} ${styles.tierAddNew}`}>
        <span className={`${icons.addAssignment} ${styles.icon}`}>
        Legg til tier

    );
  }
  renderContinueMainAssignmentPopup() {
    return (

 {e.stopPropagation();}}>
        <form onSubmit={(e) => {
          e.preventDefault();
          this.props.signals.techTree.continueMainAssignmentClicked();
        }}>
          <button type="submit" className={`${elements.button} ${styles.startMainAssignmentButton}`}>
            Fortsett
          </button>
        </form>

    );
  }
  renderStartMainAssignmentPopup() {
    return (

 {e.stopPropagation();}}>
        <form onSubmit={(e) => {
          e.preventDefault();
          this.props.signals.techTree.startMainAssignmentClicked();
        }}>
          <input
            className={`${elements.input} ${styles.mainAssignmentNameInput}`}
            placeholder="Ditt navn"
            autoFocus
            onChange={(e) => this.props.signals.techTree.nameInputChanged({value: e.target.value})}/>
          <button type="submit" className={`${elements.button} ${styles.startMainAssignmentButton}`}>
            Start
          </button>
        </form>

    );
  }
  renderMainAssignmentPopup() {
    if (this.props.isExistingAssignment) {
      return this.renderContinueMainAssignmentPopup();
    }

    return this.renderStartMainAssignmentPopup();
  }
  render() {
    return (

          {this.props.showMainAssignmentPopup ?
            this.renderMainAssignmentPopup()
            : null
          }
          <button
            className={`${elements.button} ${styles.mainAssignmentButton}`}
            onClick={(e) => {
              e.stopPropagation();
              this.props.signals.techTree.mainAssignmentButtonClicked();
            }}>
            Hovedoppgave
          </button>

          {this.props.tiers ? this.renderTiers() : null}
          {this.renderAddNewTier()}

    );
  }
}

export default Tiers;