Example #1
0
  public static Map<String, Object> pagerSettingInfo(DispatchContext ctx, Map<?, ?> context) {
    String id = (String) context.get("id");
    Map<String, Object> map = new HashMap<String, Object>();
    if (id == null || "".equalsIgnoreCase(id)) {
      map.put("_id", "");
      map.put("_name", "");
      map.put("_disabled", "no");
      map.put("_pagerSpeed", "");
      map.put("_pagerAlphaPhone", "");
      map.put("_pagerAlphaPIN", "");
      map.put("_pagerDirectPhone", "");
      map.put("_pagerOptionPhone", "");
      map.put("_pagerCustom", "");
      map.put("_pagerOption", "");
      map.put("_pagerType", "custom");
      Map retMap = ServiceUtil.returnSuccess();
      retMap.put("result", map);
      return retMap;
    } else {
      try {
        Map map1 =
            (Map<String, Object>)
                (ctx.getDispatcher().runSync("pagerSettingInfoValue", UtilMisc.toMap("id", id)))
                    .get("result");

        Map retMap = ServiceUtil.returnSuccess();
        retMap.put("result", map1);
        return retMap;
      } catch (GenericServiceException e) {
        return ServiceUtil.returnFailure(e.getMessage());
      }
    }
  }
Example #2
0
 public static Map<String, Object> saveAbsoluteSchedule(DispatchContext ctx, Map<?, ?> context) {
   try {
     String name = (String) context.get("name");
     String scheduleAt0 = (String) context.get("scheduleAt0");
     String scheduleAt1 = (String) context.get("scheduleAt1");
     String scheduleAt2 = (String) context.get("scheduleAt2");
     String scheduleAt3 = (String) context.get("scheduleAt3");
     String scheduleAt4 = (String) context.get("scheduleAt4");
     String scheduleAt5 = (String) context.get("scheduleAt5");
     String scheduleAt6 = (String) context.get("scheduleAt6");
     String timeV =
         " _name="
             + name
             + " _schedule="
             + "*"
             + scheduleAt0
             + ","
             + scheduleAt1
             + ","
             + scheduleAt2
             + ","
             + scheduleAt3
             + ","
             + scheduleAt4
             + ","
             + scheduleAt5
             + ","
             + scheduleAt6;
     ctx.getDispatcher().runSync("saveAbsoluteScheduleV", UtilMisc.toMap("value", timeV));
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
   return ServiceUtil.returnSuccess();
 }
Example #3
0
  public static Map<String, Object> getPagerPrefefencesList(
      DispatchContext ctx, Map<?, ?> context) {
    try {
      Map<String, Object> map2 = ServiceUtil.returnSuccess();
      List<Map<Object, Object>> list = new ArrayList<Map<Object, Object>>();
      Map<String, Object> retDataMap =
          (Map<String, Object>)
              (ctx.getDispatcher()
                      .runSync("getConfigByName", UtilMisc.toMap("attrName", "_additionalPager")))
                  .get("result");
      if (retDataMap == null || retDataMap.size() == 0 || retDataMap.isEmpty()) {
        Map<Object, Object> map1 = new HashMap<Object, Object>();
        map1.put("_id", "no");
        map1.put("_name", "");
        map1.put("_pagerType", "no additional pager settings");
        map1.put("_pagerAlphaPhone", "");
        map1.put("_disabled", "");
        map1.put("_pagerAlphaPIN", "");

        list.add(map1);
        map2.put("result", list);
      } else {
        map2.put(
            "result",
            (ctx.getDispatcher().runSync("getPagerPrefefencesListValue", new HashMap()))
                .get("result"));
      }
      return map2;
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }
Example #4
0
 public static Map<?, ?> delPagerseting(DispatchContext ctx, Map<?, ?> context) {
   try {
     delPagerseting(context);
     return ServiceUtil.returnSuccess();
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
Example #5
0
 public static Map<String, Object> delSchedule(DispatchContext ctx, Map<?, ?> context) {
   try {
     String id = (String) context.get("id");
     ctx.getDispatcher().runSync("delScheduleV", UtilMisc.toMap("id", id));
     return ServiceUtil.returnSuccess();
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
Example #6
0
 public static Map<?, ?> sendTest(DispatchContext ctx, Map<?, ?> context) {
   try {
     sendTest(context);
     return ServiceUtil.returnSuccess();
   } catch (Exception e) {
     Map map = ServiceUtil.returnFailure(e.getMessage());
     return map;
   }
 }
Example #7
0
  public static Map<String, Object> updatePagersetting(DispatchContext ctx, Map<?, ?> context) {
    try {

      updatePagersetting(context);
      return ServiceUtil.returnSuccess();
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }
Example #8
0
 public static Map<String, Object> getPagerPrefefencesList(
     DispatchContext ctx, Map<?, ?> context) {
   try {
     Map<String, Object> map2 = ServiceUtil.returnSuccess();
     map2.put("result", getPagerPrefefencesList());
     return map2;
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
Example #9
0
  public static Map<String, Object> getScheduleSettingsList(
      DispatchContext ctx, Map<?, ?> context) {
    try {
      List list = (List) ctx.getDispatcher().runSync("getScheduleList", new HashMap()).get("value");
      Map retMap = ServiceUtil.returnSuccess();

      retMap.put("result", list);
      return retMap;
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }
Example #10
0
 public static Map<String, Object> updateRangSchedule(DispatchContext ctx, Map<?, ?> context) {
   try {
     String id = (String) context.get("id");
     String name = (String) context.get("name");
     Map map = Assistant.ScheduleOperate(context);
     String timeV =
         "_id=" + id + " _name=" + name + " _schedule=" + (String) map.get("timeString");
     ctx.getDispatcher()
         .runSync("updateAbsoluteScheduleV", UtilMisc.toMap("value", timeV, "id", id));
     return ServiceUtil.returnSuccess();
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
Example #11
0
 public static Map<String, Object> editAbsoluteSchedule(DispatchContext ctx, Map<?, ?> context) {
   try {
     String id = (String) context.get("id");
     Map map =
         (Map)
             (ctx.getDispatcher()
                 .runSync("editAbsoluteScheduleV", UtilMisc.toMap("id", id))
                 .get("value"));
     Map<String, Object> retMap = ServiceUtil.returnSuccess();
     retMap.put("result", map);
     return retMap;
   } catch (Exception e) {
     return ServiceUtil.returnFailure(e.getMessage());
   }
 }
Example #12
0
  public static Map<String, Object> getPagerPreferenceInfo(DispatchContext ctx, Map<?, ?> context) {
    String id = (String) context.get("id");
    try {
      Map<String, Object> valueMap = new HashMap<String, Object>();
      Map<String, Object> retMap = ServiceUtil.returnSuccess();
      if (id == null) {
        valueMap.put("id", "");
        valueMap.put("value", Assistant.getPagerDial("message"));
        retMap.put("result", valueMap);
        return retMap;
      } else {
        // Map value = (Map) Config.getConfigByName("_additionalPager");

        Map<String, Object> value =
            (Map<String, Object>)
                (ctx.getDispatcher()
                        .runSync("getConfigByName", UtilMisc.toMap("attrName", "_additionalPager")))
                    .get("result");

        Iterator it = value.values().iterator();
        String mapString = "";
        boolean flag = true;
        while (it.hasNext()) {
          String ls = (String) it.next();
          String[] temple = ls.split("_");
          for (int i = 1; i < temple.length; i++) {
            String tem = "id=" + id;
            String tem1 = "id=" + id + " ";
            if (tem.equals(temple[i]) || (tem1.equals(temple[i]))) {
              flag = false;
              break;
            }
          }
          mapString = ls;
          if (flag == false) {
            break;
          }
        }
        Map map = BaseClass.stringToMap(mapString);
        valueMap.put("id", id);
        valueMap.put("value", Assistant.getPagerDial1(map));
        retMap.put("result", valueMap);
        return retMap;
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }
Example #13
0
  public static Map<String, Object> saveRangSchedule(DispatchContext ctx, Map<?, ?> context) {
    try {
      String name = (String) context.get("name");
      Map map = Assistant.ScheduleOperate(context);
      if ((Boolean) map.get("sodier") == false) {
        throw new Exception("ʱ¼ä¸ñʽ´íÎó"); // message.getMessage(??);
      } else {
        Map<String, Object> mapV = new HashMap<String, Object>();
        mapV.put("_name", name);
        mapV.put("_schedule", (String) map.get("timeString"));

        ctx.getDispatcher().runSync("saveRangScheduleV", UtilMisc.toMap("value", mapV));
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
    return ServiceUtil.returnSuccess();
  }
Example #14
0
  public static Map<String, Object> saveAddPagerSetting(DispatchContext ctx, Map<?, ?> context) {
    try {
      String id = (String) context.get("id");
      if (id != null && ("".equals(id) == false)) {
        String _name =
            ((String) context.get("additionalPagerName") == null)
                ? ""
                : (String) context.get("additionalPagerName");
        String _disabled = ((String) context.get("disabled") == null) ? "" : "CHECKED";
        String _pagerAlphaPIN =
            ((String) context.get("pagerAlphaPIN") == null)
                ? ""
                : (String) context.get("pagerAlphaPIN");
        String _pagerAlphaPhone =
            ((String) context.get("pagerAlphaPhone") == null)
                ? ""
                : (String) context.get("pagerAlphaPhone");
        String _pagerCustom =
            ((String) context.get("pagerCustom") == null)
                ? ""
                : (String) context.get("pagerCustom");
        String _pagerDirectPhone =
            ((String) context.get("pagerDirectPhone") == null)
                ? ""
                : (String) context.get("pagerDirectPhone");
        String _pagerOption =
            ((String) context.get("pagerOption") == null)
                ? ""
                : (String) context.get("pagerOption");
        String _pagerOptionPhone =
            ((String) context.get("pagerOptionPhone") == null)
                ? ""
                : (String) context.get("pagerOptionPhone");
        String _pagerSpeed =
            ((String) context.get("pagerSpeed") == null) ? "" : (String) context.get("pagerSpeed");
        String _pagerType =
            ((String) context.get("pagerType") == null) ? "" : (String) context.get("pagerType");
        Map time = Assistant.ScheduleOperate(context);
        String timeValue = (String) time.get("timeString");

        String pagerValue =
            " _id="
                + id
                + " _name="
                + _name
                + " _disabled="
                + _disabled
                + " _pagerAlphaPIN="
                + _pagerAlphaPIN
                + " _pagerAlphaPhone="
                + _pagerAlphaPhone
                + " _pagerCustom="
                + _pagerCustom
                + " _pagerDirectPhone="
                + _pagerDirectPhone
                + " _pagerOption="
                + _pagerOption
                + " _pagerOptionPhone="
                + _pagerOptionPhone
                + " _pagerSpeed="
                + _pagerSpeed
                + " _pagerType="
                + _pagerType
                + " _schedule="
                + timeValue;
        Map value = (Map) Config.getConfigByName("_additionalPager");
        Iterator it = value.values().iterator();
        long idx = 0;
        boolean flag = true;
        while (it.hasNext()) {
          String ls = (String) it.next();
          String[] temple = ls.split("_");
          for (int i = 1; i < temple.length; i++) {
            String tem = "id=" + id;
            String tem1 = "id=" + id + " ";
            if (tem.equals(temple[i]) || (tem1.equals(temple[i]))) {
              flag = false;
              break;
            }
          }
          idx++;
          if (flag == false) {
            break;
          }
        }
        ctx.getDispatcher()
            .runSync("UpdateAddPagerSetting", UtilMisc.toMap("idx", idx, "pagerValue", pagerValue));
        return ServiceUtil.returnSuccess();
      } else {
        Map<String, Object> value = new HashMap<String, Object>();

        value.put(
            "_name",
            ((String) context.get("additionalPagerName") == null)
                ? ""
                : (String) context.get("additionalPagerName"));
        value.put("_disabled", ((String) context.get("disabled") == null) ? "" : "CHECKED");
        value.put(
            "_pagerAlphaPIN",
            ((String) context.get("pagerAlphaPIN") == null)
                ? ""
                : (String) context.get("pagerAlphaPIN"));
        value.put(
            "_pagerAlphaPhone",
            ((String) context.get("pagerAlphaPhone") == null)
                ? ""
                : (String) context.get("pagerAlphaPhone"));
        value.put(
            "_pagerCustom",
            ((String) context.get("pagerCustom") == null)
                ? ""
                : (String) context.get("pagerCustom"));
        value.put(
            "_pagerDirectPhone",
            ((String) context.get("pagerDirectPhone") == null)
                ? ""
                : (String) context.get("pagerDirectPhone"));
        value.put(
            "_pagerOption",
            ((String) context.get("pagerOption") == null)
                ? ""
                : (String) context.get("pagerOption"));
        value.put(
            "_pagerOptionPhone",
            ((String) context.get("pagerOptionPhone") == null)
                ? ""
                : (String) context.get("pagerOptionPhone"));
        value.put(
            "_pagerSpeed",
            ((String) context.get("pagerSpeed") == null) ? "" : (String) context.get("pagerSpeed"));
        value.put(
            "_pagerType",
            ((String) context.get("pagerType") == null) ? "" : (String) context.get("pagerType"));
        Map time = Assistant.ScheduleOperate(context);

        value.put(
            "_schedule",
            ((String) time.get("timeString") == null) ? "" : (String) time.get("timeString"));

        ctx.getDispatcher().runSync("saveAddPagerSettingValue", UtilMisc.toMap("value", value));
        return ServiceUtil.returnSuccess();
      }
    } catch (Exception e) {
      return ServiceUtil.returnFailure(e.getMessage());
    }
  }