Ejemplo n.º 1
0
  @Override
  public Entry translate(Entry original, long firstLineNumber) throws LDIFException {
    Entry entry = original;
    logger.info("Processing dn {}, line number {}", entry.getDN(), firstLineNumber);

    entry = translateDN.translate(entry, firstLineNumber);

    // Test, remove cn attribute from entry
    if (entry.getAttribute("cn") != null) {
      entry.removeAttribute("cn");
    }

    // Create group modify from memberOf attribute
    if (entry.getAttribute("memberOf") != null) {
      createGroupModify(entry.getDN(), entry.getAttribute("memberOf"));
      entry.removeAttribute("memberOf");
    }

    String pwd = '"' + getStaticPassword() + '"';
    byte[] unicodePwd = null;
    try {
      unicodePwd = pwd.getBytes("UTF-16LE");
    } catch (UnsupportedEncodingException e) {
      throw new AssertionError("Should not occur", e);
    }

    entry.setAttribute("unicodePwd", unicodePwd);

    return entry;
  }
 @Override // ZMutableEntry
 public void setAttr(String attrName, String value) {
   if (hasAttribute(attrName)) {
     entry.removeAttribute(attrName);
   }
   entry.addAttribute(attrName, value);
 }