public void jsmethod_getUnreadMessageCount(final UZModuleContext moduleContext) { MQManager.getInstance(moduleContext.getContext()) .getUnreadMessages( new OnGetMessageListCallback() { @Override public void onFailure(int arg0, String arg1) { callbackFail(moduleContext, arg0, arg1); } @Override public void onSuccess(List<MQMessage> arg0) { JSONObject result = new JSONObject(); Iterator<MQMessage> messageIterator = arg0.iterator(); while (messageIterator.hasNext()) { MQMessage message = messageIterator.next(); if (MQMessage.TYPE_FROM_CLIENT.equals(message.getFrom_type())) { messageIterator.remove(); } } try { result.put("info", "success"); result.put("count", arg0.size()); moduleContext.success(result, true); } catch (JSONException e) { e.printStackTrace(); } } }); }
public void jsmethod_setScheduledAgentOrAgentGroup(final UZModuleContext moduleContext) { String agentId = moduleContext.optString("agentId"); String agentGroup = moduleContext.optString("agentGroup"); String scheduleRuleStr = moduleContext.optString("scheduleRule"); MQScheduleRule scheduleRule = MQScheduleRule.REDIRECT_ENTERPRISE; if ("none".equals(scheduleRuleStr)) { scheduleRule = MQScheduleRule.REDIRECT_NONE; } else if ("group".equals(scheduleRuleStr)) { scheduleRule = MQScheduleRule.REDIRECT_GROUP; } MQManager.getInstance(moduleContext.getContext()) .setScheduledAgentOrGroupWithId(agentId, agentGroup, scheduleRule); }