Пример #1
0
 private String doSetProperty(Account acct, OperationContext octxt)
     throws ZimbraTagException, ServiceException {
   if (mName == null) {
     throw ZimbraTagException.MISSING_ATTR("name");
   }
   if (mValue == null) {
     throw ZimbraTagException.MISSING_ATTR("value");
   }
   ZimletUserProperties props = ZimletUserProperties.getProperties(acct);
   props.setProperty(mZimlet, mName, mValue);
   props.saveProperties(acct);
   return "";
 }
Пример #2
0
 public String getContentStart(Account acct, OperationContext octxt)
     throws ZimbraTagException, ServiceException {
   if (mZimlet == null) {
     throw ZimbraTagException.MISSING_ATTR("zimlet");
   }
   if (mAction != null && mAction.equals("set")) {
     return doSetProperty(acct, octxt);
   } else if (mAction != null && mAction.equals("list")) {
     return doListProperty(acct, octxt);
   }
   return doGetProperty(acct, octxt);
 }
Пример #3
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();
  }
Пример #4
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 "";
  }