Example #1
0
  private String doGetProperty(Account acct, OperationContext octxt)
      throws ZimbraTagException, ServiceException {
    if (mName == null) {
      throw ZimbraTagException.MISSING_ATTR("name");
    }
    ZimletUserProperties props = ZimletUserProperties.getProperties(acct);

    StringBuffer ret = new StringBuffer("undefined");
    for (Prop zp : props.getAllProperties()) {
      if (zp.getZimlet().equals(mZimlet) && zp.getName().equals(mName)) {
        return zp.getValue();
      }
    }
    return ret.toString();
  }
Example #2
0
  private String doListProperty(Account acct, OperationContext octxt)
      throws ZimbraTagException, ServiceException {
    if (mVar == null) {
      throw ZimbraTagException.MISSING_ATTR("var");
    }
    ZimletUserProperties props = ZimletUserProperties.getProperties(acct);

    Map<String, String> m = new HashMap<String, String>();
    for (Prop zp : props.getAllProperties()) {
      if (zp.getZimlet().equals(mZimlet)) {
        m.put(zp.getName(), zp.getValue());
      }
    }
    HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
    req.setAttribute(mVar, m);
    return "";
  }