Exemple #1
0
  private void upgradeZimbraContactHiddenAttributes(Entry entry) throws ServiceException {
    final String attrName = Provisioning.A_zimbraContactHiddenAttributes;
    final String SMIMECertificate = "SMIMECertificate";

    String curValue = entry.getAttr(attrName, false);

    if (curValue == null || !curValue.contains(SMIMECertificate)) {
      return;
    }

    String[] hiddenAttrs = curValue.split(",");

    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (String hiddenAttr : hiddenAttrs) {
      if (!hiddenAttr.equals(SMIMECertificate)) {
        if (!first) {
          sb.append(",");
        } else {
          first = false;
        }
        sb.append(hiddenAttr);
      }
    }

    printer.println(
        "Upgrading " + TargetType.getTargetType(entry).getPrettyName() + " " + entry.getLabel());
    printer.println("    Current value of " + attrName + ": " + curValue);
    printer.println("    New value of " + attrName + ": " + sb.toString());

    Map<String, Object> attrs = new HashMap<String, Object>();
    attrs.put(attrName, sb.toString());
    modifyAttrs(entry, attrs);
  }
Exemple #2
0
 static AttributeClass getAttributeClass(Entry target) throws ServiceException {
   return TargetType.getTargetType(target).getAttributeClass();
 }
Exemple #3
0
 public static boolean canBeInheritedFrom(Entry target) throws ServiceException {
   TargetType targetType = TargetType.getTargetType(target);
   return !targetType.subTargetTypes().isEmpty();
 }