/**
  * 处理发送消息
  *
  * @param message
  */
 private static void sendMessage(InfoMessage message) {
   message.setStatus(MessageStatus.READED.ordinal());
   message.setReadTime(new Date());
   if (!MessageType.success.name().equals(message.getType())) {
     messageService.save(message);
   }
   // Loop over all the users on the current page
   Collection<ScriptSession> pages = loadScriptPages();
   Department msgDepartment = message.getDepartment();
   String msgDepartId = null;
   if (msgDepartment != null) {
     msgDepartId = msgDepartment.getId();
   }
   for (Iterator<ScriptSession> it = pages.iterator(); it.hasNext(); ) {
     ScriptSession otherSession = it.next();
     if (msgDepartId != null) {
       String sessionDepartId = (String) otherSession.getAttribute(DEPART_ID);
       if (!msgDepartId.equals(sessionDepartId)) {
         continue;
       }
     }
     Util util = new Util(otherSession);
     util.addFunctionCall("showAppMessage", message);
   }
 }
 /**
  * 处理发布系统广播
  *
  * @param broadcast
  */
 private static void publishBroadcast(Broadcast broadcast) {
   // broadcast.setStatus(BroadcastStatus.PUBLISH);
   broadcastService.save(broadcast);
   Collection<ScriptSession> pages = loadScriptPages();
   for (Iterator<ScriptSession> it = pages.iterator(); it.hasNext(); ) {
     ScriptSession otherSession = it.next();
     Util util = new Util(otherSession);
     util.addFunctionCall("showAppBroadcast", broadcast);
   }
 }
Exemple #3
0
 @RemoteMethod
 public void showPerson(Long id) {
   WebContext wctx = WebContextFactory.get();
   ScriptSession session = wctx.getScriptSession();
   Util util = new Util(session);
   Person p = dao.read(id);
   util.setValue("firstName", p.getFirstName());
   util.setValue("lastName", p.getLastName());
   util.setValue("birthDate", p.getBirthDate().toString());
   util.setStyle("personData", "display", "block");
   Effect effect = new Effect(session);
   effect.highlight("personData");
 }