Beispiel #1
0
 public void reload(SoapProvisioning prov) throws ServiceException {
   XMLElement req = new XMLElement(AdminConstants.GET_DOMAIN_REQUEST);
   Element a = req.addElement(AdminConstants.E_DOMAIN);
   a.setText(getId());
   a.addAttribute(AdminConstants.A_BY, Key.DomainBy.id.name());
   setAttrs(SoapProvisioning.getAttrs(prov.invoke(req).getElement(AdminConstants.E_DOMAIN)));
 }
Beispiel #2
0
 public void modifyAttrs(
     SoapProvisioning prov, Map<String, ? extends Object> attrs, boolean checkImmutable)
     throws ServiceException {
   XMLElement req = new XMLElement(AdminConstants.MODIFY_DOMAIN_REQUEST);
   req.addElement(AdminConstants.E_ID).setText(getId());
   SoapProvisioning.addAttrElements(req, attrs);
   setAttrs(SoapProvisioning.getAttrs(prov.invoke(req).getElement(AdminConstants.E_DOMAIN)));
 }
  private List<Appointement> getSortedRdv() {
    try {
      client = ZMailbox.getByName(login, pass, "https://zimbra.inria.fr/service/soap/");
      XMLElement req = new XMLElement(ZimbraNamespace.E_BATCH_REQUEST);
      Element gas = req.addElement(MailConstants.GET_APPT_SUMMARIES_REQUEST);

      Calendar cal = Calendar.getInstance();
      Date today = cal.getTime();
      //		cal.add(Calendar.HOUR, -1); // to get previous year add -1
      gas.addAttribute(MailConstants.A_CAL_START_TIME, today.getTime());

      cal.add(Calendar.MONTH, 1); // to get previous year add -1
      Date nextYear = cal.getTime();

      gas.addAttribute(MailConstants.A_CAL_END_TIME, nextYear.getTime());
      gas.addAttribute(MailConstants.A_FOLDER, zimbraFolderId);
      Element resp = client.invoke(req);
      List<Appointement> lists = new ArrayList<Appointement>();

      for (Element e : resp.listElements()) {
        for (Element appt : e.listElements(MailConstants.E_APPOINTMENT)) {
          Appointement a = new Appointement();
          a.setLabel("" + appt.toXML().attribute("name").getData());
          a.setLocation("" + appt.toXML().attribute("loc").getData());
          String duration = "" + appt.toXML().attribute("d").getData();
          a.setDuration(Long.parseLong(duration) / 1000);
          ZDateTime dated =
              new ZDateTime("" + appt.toXML().element("inst").attribute("ridZ").getData());
          a.setDate(dated.getDate());
          lists.add(a);
        }
      }
      Collections.sort(
          lists,
          new Comparator<Appointement>() {

            public int compare(Appointement appt1, Appointement appt2) {
              return appt1.getDate().compareTo(appt2.getDate());
            }
          });

      return lists;
    } catch (ServiceException e) {
      e.printStackTrace();
    }
    return new ArrayList<Appointement>();
  }