Example usage for com.google.gwt.json.client JSONNumber JSONNumber

List of usage examples for com.google.gwt.json.client JSONNumber JSONNumber

Introduction

In this page you can find the example usage for com.google.gwt.json.client JSONNumber JSONNumber.

Prototype

public JSONNumber(double value) 

Source Link

Document

Creates a new JSONNumber from the double value.

Usage

From source file:org.ednovo.gooru.client.mvp.play.collection.CollectionPlayerPresenter.java

License:Open Source License

public void triggerSaveOeAnswerTextDataEvent(String eventId, String resourceId, Long oeStartTime,
        Long oeEndTime, int score) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(eventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME,
            new JSONString(PlayerDataLogEvents.COLLECTION_RESOURCE_SAVE));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(oeStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(oeEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    //String classpageId=AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId;
    } else {/*from   www . j  av a2 s.c o m*/
        path = collectionDo.getGooruOid() + "/" + resourceId;
    }
    String playerMode = getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(),
                    resourceNewDataLogEventId, "", playerMode, "question", null, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS,
            PlayerDataLogEvents.getDataLogMetricsObject(oeEndTime - oeStartTime, 0));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray,
                    attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject,
                    getAttemptCount()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.CollectionPlayerPresenter.java

License:Open Source License

public void triggerReactiontDataLogEvent(String resourceId, Long reactionStartTime, Long reactionEndTime,
        String reactionType, String eventName) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(GwtUUIDGenerator.uuid()));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(eventName));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(reactionStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(reactionEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String questionTypeString = questionType.equals("RES") ? "resource" : "question";
    //String classpageId=AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId;
    } else {//from  ww  w.j  ava 2  s  .  co  m
        path = collectionDo.getGooruOid() + "/" + resourceId;
    }
    String playerMode = getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(),
                    resourceNewDataLogEventId, "", playerMode, questionTypeString, reactionType, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS,
            PlayerDataLogEvents.getDataLogMetricsObject(reactionEndTime - reactionStartTime, 0));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(reactionType));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.PreviewPlayerPresenter.java

License:Open Source License

public void triggerCollectionNewDataLogStartStopEvent(Long collectionStartTime, Long collectionEndTime,
        String eventType, Integer score) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(collectionNewDataLogEventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(PlayerDataLogEvents.COLLECTION_PLAY));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(collectionStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(collectionEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String classpageId = AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String classpageEventId = AppClientFactory.getPlaceManager().getClasspageEventId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid();
    } else {//  w ww . j av  a2  s .co m
        path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid();
    }
    String playerMode = AppClientFactory.getPlaceManager().getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(collectionDo.getGooruOid(), classpageId,
                    classpageEventId, eventType, playerMode, "", null, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents.getDataLogMetricsObject(
            collectionEndTime - collectionStartTime - totalTimeSpentOnSummaryPage, getCollectionScore()));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, new JSONString(new JSONObject().toString()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.PreviewPlayerPresenter.java

License:Open Source License

public void triggerCollectionItemNewDataLogStartStopEvent(String resourceId, Long resourceStartTime,
        Long resourceEndTime, String eventType, Integer score, String questionType) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(resourceNewDataLogEventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME,
            new JSONString(PlayerDataLogEvents.COLLECTION_RESOURCE_PLAY));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(resourceStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(resourceEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String questionTypeString = questionType.equals("RES") ? "resource" : "question";
    String classpageId = AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId;
    } else {/*from  w ww .j  a va2s . com*/
        path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/"
                + resourceId;
    }
    String playerMode = AppClientFactory.getPlaceManager().getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(),
                    collectionNewDataLogEventId, eventType, playerMode, questionTypeString, null, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents
            .getDataLogMetricsObject(resourceEndTime - resourceStartTime, getResourceScore()));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray,
                    attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject,
                    getAttemptCount()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.PreviewPlayerPresenter.java

License:Open Source License

public void triggerSaveOeAnswerTextDataEvent(String eventId, String resourceId, Long oeStartTime,
        Long oeEndTime, int score) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(eventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME,
            new JSONString(PlayerDataLogEvents.COLLECTION_RESOURCE_SAVE));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(oeStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(oeEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String classpageId = AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId;
    } else {// www  .j av a 2  s .co m
        path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/"
                + resourceId;
    }
    String playerMode = AppClientFactory.getPlaceManager().getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(),
                    resourceNewDataLogEventId, "", playerMode, "question", null, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS,
            PlayerDataLogEvents.getDataLogMetricsObject(oeEndTime - oeStartTime, 0));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray,
                    attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject,
                    getAttemptCount()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.preview.PreviewPlayerPresenter.java

License:Open Source License

public void triggerReactiontDataLogEvent(String resourceId, Long reactionStartTime, Long reactionEndTime,
        String reactionType, String eventName) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(GwtUUIDGenerator.uuid()));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(eventName));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(reactionStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(reactionEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String questionTypeString = questionType.equals("RES") ? "resource" : "question";
    String classpageId = AppClientFactory.getPlaceManager().getDataLogClasspageId();
    String path = "";
    if (classpageId != null && !classpageId.equals("")) {
        path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId;
    } else {/*  w ww .  j a v a  2s  .c  o m*/
        path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/"
                + resourceId;
    }
    String playerMode = AppClientFactory.getPlaceManager().getPlayerMode();
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT,
            PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(),
                    resourceNewDataLogEventId, "", playerMode, questionTypeString, reactionType, path, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS,
            PlayerDataLogEvents.getDataLogMetricsObject(reactionEndTime - reactionStartTime, 0));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(reactionType));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.resource.question.QuestionResourcePresenter.java

License:Open Source License

public void setHintIdWithTime(Integer hintId) {
    if (isCollectionPlayer) {
        collectionPlayerPresenter.getHintIdsObject().put(hintId.toString(), new JSONNumber(getUnixTimeStamp()));
    } else if (isResourcePlayer) {
        resourcePlayerPresenter.getHintIdsObject().put(hintId.toString(), new JSONNumber(getUnixTimeStamp()));
    } else if (isPreviewPlayer) {
        previewPlayerPresenter.getHintIdsObject().put(hintId.toString(), new JSONNumber(getUnixTimeStamp()));
    }/*from   w  w  w.j  av  a 2s .  c  om*/
}

From source file:org.ednovo.gooru.client.mvp.play.resource.question.QuestionResourcePresenter.java

License:Open Source License

public void setAnswerIdWithTime(Integer answerId, Integer attemptStatus, Integer attemptSequence) {
    if (isCollectionPlayer) {
        collectionPlayerPresenter.getAnswerIdsObject().put(answerId.toString(),
                new JSONNumber(getUnixTimeStamp()));
        collectionPlayerPresenter.getAttemptStatusArray().add(attemptStatus);
        collectionPlayerPresenter.getAttemptTrySequenceArray().add(attemptSequence);
    } else if (isResourcePlayer) {
        resourcePlayerPresenter.getAnswerIdsObject().put(answerId.toString(),
                new JSONNumber(getUnixTimeStamp()));
        resourcePlayerPresenter.getAttemptStatusArray().add(attemptStatus);
        resourcePlayerPresenter.getAttemptTrySequenceArray().add(attemptSequence);
    } else if (isPreviewPlayer) {
        previewPlayerPresenter.getAnswerIdsObject().put(answerId.toString(),
                new JSONNumber(getUnixTimeStamp()));
        previewPlayerPresenter.getAttemptStatusArray().add(attemptStatus);
        previewPlayerPresenter.getAttemptTrySequenceArray().add(attemptSequence);
    }/*from   ww w  .  j  ava 2s .c o m*/
}

From source file:org.ednovo.gooru.client.mvp.play.resource.ResourcePlayerPresenter.java

License:Open Source License

public void triggerCollectionItemNewDataLogStartStopEvent(String resourceId, Long resourceStartTime,
        Long resourceEndTime, String eventType, Integer score, String questionType) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(resourceNewDataLogEventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(PlayerDataLogEvents.RESOURCE_PLAY));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(resourceStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(resourceEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    String questionTypeString = questionType.equals("RES") ? "resource" : "question";
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(resourceId,
            "", "", eventType, PlayerDataLogEvents.STUDY, questionTypeString, null, resourceId, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents
            .getDataLogMetricsObject(resourceEndTime - resourceStartTime, getResourceScore()));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray,
                    attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject,
                    getAttemptCount()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}

From source file:org.ednovo.gooru.client.mvp.play.resource.ResourcePlayerPresenter.java

License:Open Source License

public void triggerSaveOeAnswerTextDataEvent(String eventId, String resourceId, Long oeStartTime,
        Long oeEndTime, int score) {
    JSONObject collectionDataLog = new JSONObject();
    collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(eventId));
    collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(PlayerDataLogEvents.RESOURCE_SAVE));
    collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId));
    collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(oeStartTime));
    collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(oeEndTime));
    collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject());
    collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(resourceId,
            "", resourceNewDataLogEventId, "", PlayerDataLogEvents.STUDY, "question", null, resourceId, null));
    collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject());
    collectionDataLog.put(PlayerDataLogEvents.METRICS,
            PlayerDataLogEvents.getDataLogMetricsObject(oeEndTime - oeStartTime, 0));
    collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT,
            PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray,
                    attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject,
                    getAttemptCount()));
    PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog);
}