提交 506a2200 编写于 作者: M MaxKey

log ldap attribute values

上级 d2b6f8a8
......@@ -291,14 +291,14 @@ public class LdapUtils {
}
public static String getAttrStringValue(Attributes attrs, String elem) {
String value = "";
StringBuffer values = new StringBuffer("");
try {
if (attrs.get(elem) != null) {
for (int i = 0; i < attrs.get(elem).size(); i++) {
if(i == 0) {
value += attrs.get(elem).get(i).toString();
values.append(attrs.get(elem).get(i).toString());
}else {
value += "," + attrs.get(elem).get(i).toString();
values.append(" , ").append(attrs.get(elem).get(i).toString());
}
}
}
......@@ -306,7 +306,26 @@ public class LdapUtils {
e.printStackTrace();
_logger.error(e.getMessage());
}
return value;
return values.toString();
}
public static String getAttrStringValue(Attribute attr) {
StringBuffer values = new StringBuffer("");
try {
if (attr != null) {
for (int i = 0; i < attr.size(); i++) {
if(i == 0) {
values.append(attr.get(i).toString());
}else {
values.append(" , ").append(attr.get(i).toString());
}
}
}
} catch (NamingException e) {
e.printStackTrace();
_logger.error(e.getMessage());
}
return values.toString();
}
public static String getAttributeStringValue(String attribute ,HashMap<String,Attribute> attributeMap) throws NamingException {
......
......@@ -76,7 +76,10 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
NamingEnumeration<? extends Attribute> attrs = sr.getAttributes().getAll();
while (null != attrs && attrs.hasMoreElements()) {
Attribute objAttrs = attrs.nextElement();
_logger.trace("attribute {} : {}" ,objAttrs.getID(), objAttrs.get());
_logger.trace("attribute {} : {}" ,
objAttrs.getID(),
ActiveDirectoryUtils.getAttrStringValue(objAttrs)
);
attributeMap.put(objAttrs.getID().toLowerCase(), objAttrs);
}
......
......@@ -72,7 +72,10 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
NamingEnumeration<? extends Attribute> attrs = sr.getAttributes().getAll();
while (null != attrs && attrs.hasMoreElements()) {
Attribute objAttrs = attrs.nextElement();
_logger.trace("attribute {} : {}" ,objAttrs.getID(), objAttrs.get());
_logger.trace("attribute {} : {}" ,
objAttrs.getID(),
ActiveDirectoryUtils.getAttrStringValue(objAttrs)
);
attributeMap.put(objAttrs.getID().toLowerCase(), objAttrs);
}
......
......@@ -71,7 +71,10 @@ public class LdapOrganizationService extends AbstractSynchronizerService implem
NamingEnumeration<? extends Attribute> attrs = sr.getAttributes().getAll();
while (null != attrs && attrs.hasMoreElements()) {
Attribute objAttrs = attrs.nextElement();
_logger.trace("attribute "+objAttrs.getID() + " : " + objAttrs.get());
_logger.trace("attribute {} : {}" ,
objAttrs.getID(),
LdapUtils.getAttrStringValue(objAttrs)
);
attributeMap.put(objAttrs.getID().toLowerCase(), objAttrs);
}
......
......@@ -65,7 +65,10 @@ public class LdapUsersService extends AbstractSynchronizerService implements IS
NamingEnumeration<? extends Attribute> attrs = sr.getAttributes().getAll();
while (null != attrs && attrs.hasMoreElements()) {
Attribute objAttrs = attrs.nextElement();
_logger.trace("attribute "+objAttrs.getID() + " , " + objAttrs.get());
_logger.trace("attribute {} : {}" ,
objAttrs.getID(),
LdapUtils.getAttrStringValue(objAttrs)
);
attributeMap.put(objAttrs.getID(), objAttrs);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册