List of usage examples for com.google.gwt.json.client JSONNumber JSONNumber
public JSONNumber(double value)
From source file:org.ednovo.gooru.application.shared.util.DataLogEvents.java
License:Open Source License
/** * * @function createJsniIntArray//from w w w . jav a 2 s . co m * * @created_date : Oct 30, 2013 * * @description * * * @parm(s) : @param attemptTrySequence * @parm(s) : @return * * @return : JSONArray * * @throws : <Mentioned if any exceptions> * * * * */ public static JSONArray createJsniIntArray(List<Integer> attemptTrySequence) { JSONArray attemptTrySequenceArray = new JSONArray(); if (attemptTrySequence != null && attemptTrySequence.size() > 0) { for (int i = 0; i < attemptTrySequence.size(); i++) { attemptTrySequenceArray.set(i, new JSONNumber(attemptTrySequence.get(i))); } } return attemptTrySequenceArray; }
From source file:org.ednovo.gooru.application.shared.util.DataLogEvents.java
License:Open Source License
/** * * @function signUp//from w ww. ja v a 2s . com * * @created_date : Oct 30, 2013 * * @description * * * @parm(s) : @param eventId * @parm(s) : @param eventName * @parm(s) : @param startTime * @parm(s) : @param endTime * @parm(s) : @param organizationUid * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ public static void signUp(String eventId, String eventName, Long startTime, Long endTime, String organizationUid) { JSONObject eventJsonObject = new JSONObject(); eventJsonObject.put("eventId", new JSONString(eventId)); eventJsonObject.put("eventName", new JSONString(SIGN_UP + eventName)); eventJsonObject.put("startTime", new JSONNumber(startTime)); eventJsonObject.put("endTime", new JSONNumber(endTime)); eventJsonObject.put("organizationUid", new JSONString(organizationUid)); eventJsonObject.put("apiKey", new JSONString(getAPIKey())); triggerDataLogCall(eventJsonObject); }
From source file:org.ednovo.gooru.application.shared.util.DataLogEvents.java
License:Open Source License
/** * * @function signIn/*from w w w .java2s . c o m*/ * * @created_date : Oct 30, 2013 * * @description * * * @parm(s) : @param eventId * @parm(s) : @param eventName * @parm(s) : @param startTime * @parm(s) : @param endTime * @parm(s) : @param organizationUid * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ public static void signIn(String eventId, String eventName, Long startTime, Long endTime, String organizationUid, String sessionToken) { JSONObject eventJsonObject = new JSONObject(); eventJsonObject.put("eventId", new JSONString(eventId)); eventJsonObject.put("eventName", new JSONString(SIGN_IN_GOOGLE + eventName)); eventJsonObject.put("startTime", new JSONNumber(startTime)); eventJsonObject.put("endTime", new JSONNumber(endTime)); eventJsonObject.put("organizationUid", new JSONString(organizationUid)); eventJsonObject.put("sessionToken", new JSONString(sessionToken)); eventJsonObject.put("apiKey", new JSONString(getAPIKey())); triggerDataLogCall(eventJsonObject); }
From source file:org.ednovo.gooru.application.shared.util.DataLogEvents.java
License:Open Source License
/** * * @function classpageView/*from w ww .java 2 s . c o m*/ * * @created_date : Oct 30, 2013 * * @description * * * @parm(s) : @param eventId * @parm(s) : @param eventName * @parm(s) : @param contentGooruId * @parm(s) : @param gooruUId * @parm(s) : @param startTime * @parm(s) : @param endTime * @parm(s) : @param organizationUid * @parm(s) : @param timeSpentInMs * @parm(s) : @param sessionToken * @parm(s) : @param type * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ public static void classpageView(String eventId, String eventName, String contentGooruId, String gooruUId, Long startTime, Long endTime, String organizationUid, Long timeSpentInMs, String sessionToken, String type) { JSONObject eventJsonObject = new JSONObject(); eventJsonObject.put("eventId", new JSONString(eventId)); eventJsonObject.put("eventName", new JSONString(eventName)); eventJsonObject.put("contentGooruId", new JSONString(contentGooruId)); eventJsonObject.put("gooruUId", new JSONString(gooruUId)); eventJsonObject.put("startTime", new JSONNumber(startTime)); eventJsonObject.put("endTime", new JSONNumber(endTime)); eventJsonObject.put("organizationUid", new JSONString(organizationUid)); eventJsonObject.put("timeSpentInMs", new JSONNumber(timeSpentInMs)); eventJsonObject.put("sessionToken", new JSONString(sessionToken)); eventJsonObject.put("type", new JSONString(type)); eventJsonObject.put("apiKey", new JSONString(getAPIKey())); triggerDataLogCall(eventJsonObject); }
From source file:org.ednovo.gooru.application.shared.util.DataLogEvents.java
License:Open Source License
/** * * @function assignmentView/*from w w w . j av a2s . c om*/ * * @created_date : Oct 30, 2013 * * @description * * * @parm(s) : @param eventId * @parm(s) : @param eventName * @parm(s) : @param contentGooruId * @parm(s) : @param gooruUId * @parm(s) : @param startTime * @parm(s) : @param endTime * @parm(s) : @param organizationUid * @parm(s) : @param timeSpentInMs * @parm(s) : @param sessionToken * @parm(s) : @param type * * @return : void * * @throws : <Mentioned if any exceptions> * * * * */ public static void assignmentView(String eventId, String eventName, String contentGooruId, String gooruUId, Long startTime, Long endTime, String organizationUid, Long timeSpentInMs, String sessionToken, String type) { JSONObject eventJsonObject = new JSONObject(); eventJsonObject.put("eventId", new JSONString(eventId)); eventJsonObject.put("eventName", new JSONString(eventName)); eventJsonObject.put("contentGooruId", new JSONString(contentGooruId)); eventJsonObject.put("gooruUId", new JSONString(gooruUId)); eventJsonObject.put("startTime", new JSONNumber(startTime)); eventJsonObject.put("endTime", new JSONNumber(endTime)); eventJsonObject.put("organizationUid", new JSONString(organizationUid)); eventJsonObject.put("timeSpentInMs", new JSONNumber(timeSpentInMs)); eventJsonObject.put("sessionToken", new JSONString(sessionToken)); eventJsonObject.put("type", new JSONString(type)); eventJsonObject.put("apiKey", new JSONString(getAPIKey())); triggerDataLogCall(eventJsonObject); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java
License:Open Source License
/** * Triggers Collection start and stop events. * * @param collectionStartTime//www . ja v a2 s.co m * @param collectionEndTime * @param eventType * @param score */ public void triggerCollectionNewDataLogStartStopEvent(Long collectionStartTime, Long collectionEndTime, String eventType, Integer score) { try { 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)); PlayerDataLogEvents.printLogs("triggerCollectionNewDataLogStartStopEvent", sessionId, collectionNewDataLogEventId); collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(collectionStartTime)); collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(collectionEndTime)); collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject()); String playerMode = getPlayerMode(); String classpageEventId = AppClientFactory.getPlaceManager().getClasspageEventId(); String path = ""; String gooruOid = collectionDo != null && collectionDo.getGooruOid() != null ? collectionDo.getGooruOid() : ""; int totalQuestionsCount = "start".equalsIgnoreCase(eventType) ? 0 : collectionDo.getCollectionItems().size(); if (classpageId != null && !classpageId.equals("")) { path = classpageId + "/" + collectionDo.getGooruOid(); if (classpageEventId == null || classpageEventId.equals("")) { classpageEventId = AppClientFactory.getPlaceManager().getRequestParameter("eventid"); } collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(collectionDo.getGooruOid(), classpageId, classpageEventId, eventType, playerMode, "", null, path, null, totalQuestionsCount)); } else if (AppClientFactory.getPlaceManager().getRequestParameter("lid") != null) { classpageEventId = AppClientFactory.getPlaceManager().getLibaryEventId(); if (classpageEventId == null || classpageEventId.equals("")) { classpageEventId = AppClientFactory.getPlaceManager().getRequestParameter("eventid"); } String libraryId = AppClientFactory.getPlaceManager().getRequestParameter("lid"); path = libraryId + "/" + collectionDo.getGooruOid(); collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(collectionDo.getGooruOid(), libraryId, classpageEventId, eventType, playerMode, "", null, path, null, totalQuestionsCount)); } else { String parentGooruOid = AppClientFactory.getPlaceManager().getShelfParentGooruOid(); path = AppClientFactory.getPlaceManager().getFolderIds() + gooruOid; collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(gooruOid, parentGooruOid, classpageEventId, eventType, playerMode, "", null, path, null, totalQuestionsCount)); } collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject()); totalTimeSpendInMs = collectionEndTime - newCollectionStartTime; int viewCount = "start".equalsIgnoreCase(eventType) ? 0 : 1; collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents.getDataLogMetricsObject( collectionEndTime - newCollectionStartTime, getCollectionScore(), viewCount)); JSONObject playLoad = new JSONObject(); if (eventType.equals(PlayerDataLogEvents.START_EVENT_TYPE)) { String searchTerm = getSearchKeyword(); if (searchTerm != null) { playLoad.put(PlayerDataLogEvents.SEARCHTERM, new JSONString(searchTerm)); } } collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, new JSONString(playLoad.toString())); PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog); AppClientFactory.printInfoLogger("--- Triggering collection start/stop event --- "); if (eventType.equals(PlayerDataLogEvents.START_EVENT_TYPE)) { String views = collectionDo != null && collectionDo.getViews() != null ? collectionDo.getViews() : ""; updateResourceViewCount(gooruOid, views, RESOURCE); } } catch (Exception ex) { // ex.printStackTrace(); AppClientFactory.printSevereLogger( "AssessmentsPlayerPersenter : triggerCollectionNewDataLogStartStopEvent :" + ex.getMessage()); } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java
License:Open Source License
public void triggerCollectionItemNewDataLogStartStopEvent(String resourceId, Long resourceStartTime, Long resourceEndTime, String eventType, Integer score, String questionType) { try {/*from w w w .j a v a 2 s . c o m*/ 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)); PlayerDataLogEvents.printLogs("triggerCollectionItemNewDataLogStartStopEvent", sessionId, resourceNewDataLogEventId); collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(resourceStartTime)); collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(resourceEndTime)); collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject()); String questionTypeString = questionType.equals(RESULT.toUpperCase()) ? "resource" : "question"; String path = ""; if (classpageId != null && !classpageId.equals("")) { path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else if (AppClientFactory.getPlaceManager().getRequestParameter("lid") != null) { String libraryId = AppClientFactory.getPlaceManager().getRequestParameter("lid"); path = libraryId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else { path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/" + resourceId; } String playerMode = getPlayerMode(); int totalQuestionsCount = "start".equalsIgnoreCase(eventType) ? 0 : collectionDo.getCollectionItems().size(); collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(), collectionNewDataLogEventId, eventType, playerMode, questionTypeString, null, path, null, totalQuestionsCount)); collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject()); int viewCount1 = "start".equalsIgnoreCase(eventType) ? 0 : 1; collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents .getDataLogMetricsObject(resourceEndTime - resourceStartTime, getResourceScore(), viewCount1)); collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray, attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject, getAttemptCount(), answerObjectArray, null)); PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog); if (eventType.equals(PlayerDataLogEvents.START_EVENT_TYPE)) { String viewCount = collectionItemDo.getViews() != null ? collectionItemDo.getViews().toString() : "0"; updateResourceViewCount(collectionItemDo.getResource().getGooruOid(), viewCount, RESOURCE, collectionItemDo.getCollectionItemId()); } } catch (Exception ex) { AppClientFactory.printSevereLogger( "AssessmentsPlayerPresenter : triggerCollectionItemNewDataLogStartStopEvent : " + ex.getMessage()); } }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.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)); PlayerDataLogEvents.printLogs("triggerSaveOeAnswerTextDataEvent", sessionId, eventId); collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(oeStartTime)); collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(oeEndTime)); collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject()); String path = ""; if (!StringUtil.isEmpty(classpageId)) { path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else if (AppClientFactory.getPlaceManager().getRequestParameter("lid") != null) { String libraryId = AppClientFactory.getPlaceManager().getRequestParameter("lid"); path = libraryId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else {/*www . ja v a 2s . c o m*/ path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/" + resourceId; } String playerMode = getPlayerMode(); collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(), resourceNewDataLogEventId, "", playerMode, "question", null, path, null, 0)); collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject()); collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents.getDataLogMetricsObject(oeEndTime - oeStartTime, 0, 0)); collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, PlayerDataLogEvents.getDataLogPayLoadObject(questionType, oeQuestionAnswerText, attemptStatusArray, attemptTrySequenceArray, answerIdsObject, hintIdsObject, explanationIdsObject, getAttemptCount(), answerObjectArray, null)); PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.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)); PlayerDataLogEvents.printLogs("triggerReactiontDataLogEvent", sessionId, "Generating newly for reactions"); collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(reactionStartTime)); collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(reactionEndTime)); collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject()); String questionTypeString = questionType.equals(RESULT.toUpperCase()) ? "resource" : "question"; String path = ""; if (!StringUtil.isEmpty(classpageId)) { path = classpageId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else if (AppClientFactory.getPlaceManager().getRequestParameter("lid") != null) { String libraryId = AppClientFactory.getPlaceManager().getRequestParameter("lid"); path = libraryId + "/" + collectionDo.getGooruOid() + "/" + resourceId; } else {/*from w w w .j a v a 2 s . c o m*/ path = AppClientFactory.getPlaceManager().getFolderIds() + collectionDo.getGooruOid() + "/" + resourceId; } String playerMode = getPlayerMode(); collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObject(resourceId, collectionDo.getGooruOid(), resourceNewDataLogEventId, "", playerMode, questionTypeString, reactionType, path, null, 0)); collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject()); collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents.getDataLogMetricsObject(reactionEndTime - reactionStartTime, 0, 0)); collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, PlayerDataLogEvents.getDataLogPayLoadObject(reactionType)); PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog); }
From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java
License:Open Source License
public void triggerItemLoadDataLogEvent(Long startTime, String itemType, String collectionId) { JSONObject collectionDataLog = new JSONObject(); collectionDataLog.put(PlayerDataLogEvents.EVENTID, new JSONString(GwtUUIDGenerator.uuid())); collectionDataLog.put(PlayerDataLogEvents.EVENTNAME, new JSONString(PlayerDataLogEvents.ITEM_LOAD)); collectionDataLog.put(PlayerDataLogEvents.SESSION, PlayerDataLogEvents.getDataLogSessionObject(sessionId)); PlayerDataLogEvents.printLogs("triggerItemLoadDataLogEvent", sessionId, "Generation Newly for item load"); collectionDataLog.put(PlayerDataLogEvents.STARTTIME, new JSONNumber(startTime)); collectionDataLog.put(PlayerDataLogEvents.ENDTIME, new JSONNumber(startTime)); collectionDataLog.put(PlayerDataLogEvents.METRICS, PlayerDataLogEvents.getDataLogMetricsObject(startTime - startTime)); collectionDataLog.put(PlayerDataLogEvents.VERSION, PlayerDataLogEvents.getDataLogVersionObject()); collectionDataLog.put(PlayerDataLogEvents.USER, PlayerDataLogEvents.getDataLogUserObject()); collectionDataLog.put(PlayerDataLogEvents.PAYLOADOBJECT, PlayerDataLogEvents.getItemLoadDataLogPayLoadObject(itemType)); String classpageId = AppClientFactory.getPlaceManager().getDataLogClasspageId(); String classpageEventId = AppClientFactory.getPlaceManager().getClasspageEventId(); String path = ""; if (classpageId != null && !classpageId.equals("")) { path = classpageId + "/" + collectionId; if (classpageEventId == null || classpageEventId.equals("")) { classpageEventId = AppClientFactory.getPlaceManager().getRequestParameter("eventid"); }//from ww w . j av a 2 s . c o m } else if (AppClientFactory.getPlaceManager().getRequestParameter("lid") != null) { classpageEventId = AppClientFactory.getPlaceManager().getLibaryEventId(); if (classpageEventId == null || classpageEventId.equals("")) { classpageEventId = AppClientFactory.getPlaceManager().getRequestParameter("eventid"); } String libraryId = AppClientFactory.getPlaceManager().getRequestParameter("lid"); classpageId = libraryId; path = classpageId + "/" + collectionId; } else { classpageId = AppClientFactory.getPlaceManager().getShelfParentGooruOid(); path = AppClientFactory.getPlaceManager().getFolderIds() + collectionId; } String playerMode = getPlayerMode(); collectionDataLog.put(PlayerDataLogEvents.CONTEXT, PlayerDataLogEvents.getDataLogContextObjectForItemLoad(collectionId, "", classpageEventId, classpageId, "", playerMode, path, null, PlayerDataLogEvents.COLLECTION_LOAD_URL)); PlayerDataLogEvents.collectionStartStopEvent(collectionDataLog); }