Esempio n. 1
0
  public void setState(Workgroup workgroup, WorkgroupSettings workgroupSettings, QName namespace) {
    this.workgroupSettings = workgroupSettings;
    this.workgroup = workgroup;
    this.namespace = namespace;

    try {
      final Element element =
          workgroupSettings.get(
              workgroup.getJID().toBareJID(), DocumentHelper.createElement(namespace));
      final List list = element.elements();

      final Iterator iter = list.iterator();
      while (iter.hasNext()) {
        Element el = (Element) iter.next();
        addToSettings(el);
      }
    } catch (Exception ex) {
      Log.error(ex.getMessage(), ex);
    }
  }
Esempio n. 2
0
  public void setMap(Map map) {
    Element element = DocumentHelper.createElement(namespace);
    final Iterator i = element.elementIterator();
    while (i.hasNext()) {
      element.remove((Element) i.next());
    }
    final Iterator iter = map.keySet().iterator();
    while (iter.hasNext()) {
      String key = (String) iter.next();
      String value = (String) map.get(key);

      Element elem = DocumentHelper.createElement("entry");
      elem.addElement(key).setText(value);
      element.add(elem);
    }

    try {
      workgroupSettings.add(workgroup.getJID().toBareJID(), element);
    } catch (Exception ex) {
      Log.error(ex.getMessage(), ex);
    }
  }