本文整理汇总了Java中org.identityconnectors.framework.common.objects.AttributeValueCompleteness类的典型用法代码示例。如果您正苦于以下问题:Java AttributeValueCompleteness类的具体用法?Java AttributeValueCompleteness怎么用?Java AttributeValueCompleteness使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttributeValueCompleteness类属于org.identityconnectors.framework.common.objects包,在下文中一共展示了AttributeValueCompleteness类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.identityconnectors.framework.common.objects.AttributeValueCompleteness; //导入依赖的package包/类
@Override
public void handle(LdapNetworkConnection connection, Entry entry, Attribute ldapAttribute, AttributeBuilder ab) {
int semicolonIndex = ldapAttribute.getId().indexOf(';');
if (semicolonIndex >= 0) {
String attrName = ldapAttribute.getId().substring(0, semicolonIndex);
String attrOption = ldapAttribute.getId().substring(semicolonIndex+1);
if (attrOption.startsWith("range=")) {
if (searchStrategy.allowPartialAttributeValues()) {
LOG.ok("Got attribute {0} with range option {1}, do NOT following as partial values are allowed",
attrName, attrOption);
ab.setAttributeValueCompleteness(AttributeValueCompleteness.INCOMPLETE);
} else {
LOG.ok("Got attribute {0} with range option {1}, following as partial values are not allowed",
attrName, attrOption);
while (true) {
Range range = parseRange(attrOption);
if (range.top) {
LOG.ok("reached the top ({0}), breaking", attrOption);
break;
}
Attribute rangeAttribute = rangeSearch(connection, entry, attrName, range.high);
if (rangeAttribute == null) {
LOG.ok("no range attribute returned in response, breaking", attrOption);
break;
}
for (Value<?> rangeValue: rangeAttribute) {
try {
ldapAttribute.add(rangeValue);
} catch (LdapInvalidAttributeValueException e) {
throw new IllegalStateException("Error adding value "+rangeValue+" to attribute "+ldapAttribute+": "+e.getMessage(), e);
}
}
semicolonIndex = ldapAttribute.getId().indexOf(';');
if (semicolonIndex < 0) {
// Strange. but it looks like we have all the values now
LOG.ok("reached no option, breaking", attrOption);
break;
} else {
attrOption = ldapAttribute.getId().substring(semicolonIndex+1);
}
}
}
} else {
LOG.ok("Unknown attribute option: {0}", ldapAttribute.getId());
}
}
}
示例2: toIcfAttribute
import org.identityconnectors.framework.common.objects.AttributeValueCompleteness; //导入依赖的package包/类
private Attribute toIcfAttribute(LdapNetworkConnection connection, Entry entry, org.apache.directory.api.ldap.model.entry.Attribute ldapAttribute, AttributeHandler attributeHandler) {
AttributeBuilder ab = new AttributeBuilder();
String ldapAttributeName = getLdapAttributeName(ldapAttribute);
AttributeType ldapAttributeType = schemaManager.getAttributeType(ldapAttributeName);
String ldapAttributeNameFromSchema;
if (ldapAttributeType == null) {
if (configuration.isAllowUnknownAttributes()) {
ldapAttributeNameFromSchema = ldapAttributeName;
} else {
throw new InvalidAttributeValueException("Unknown LDAP attribute " + ldapAttributeName + " (not present in LDAP schema)");
}
} else {
ldapAttributeNameFromSchema = ldapAttributeType.getName();
}
String icfAttributeName = toIcfAttributeName(ldapAttributeNameFromSchema);
ab.setName(icfAttributeName);
if (attributeHandler != null) {
attributeHandler.handle(connection, entry, ldapAttribute, ab);
}
boolean incompleteRead = false;
if (OperationalAttributeInfos.PASSWORD.is(icfAttributeName)) {
switch (configuration.getPasswordReadStrategy()) {
case AbstractLdapConfiguration.PASSWORD_READ_STRATEGY_READABLE:
// Nothing to do. Proceed with ordinary read.
break;
case AbstractLdapConfiguration.PASSWORD_READ_STRATEGY_INCOMPLETE_READ:
incompleteRead = true;
break;
case AbstractLdapConfiguration.PASSWORD_READ_STRATEGY_UNREADABLE:
return null;
default:
throw new ConfigurationException("Unknown passoword read strategy "+configuration.getPasswordReadStrategy());
}
}
Iterator<Value<?>> iterator = ldapAttribute.iterator();
boolean hasValidValue = false;
while (iterator.hasNext()) {
Value<?> ldapValue = iterator.next();
Object icfValue = toIcfValue(icfAttributeName, ldapValue, ldapAttributeNameFromSchema, ldapAttributeType);
if (icfValue != null) {
if (!incompleteRead) {
ab.addValue(icfValue);
}
hasValidValue = true;
}
}
if (!hasValidValue) {
// Do not even try to build. The build will fail.
return null;
}
if (incompleteRead) {
ab.setAttributeValueCompleteness(AttributeValueCompleteness.INCOMPLETE);
}
try {
return ab.build();
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(e.getMessage() + ", attribute "+icfAttributeName+" (ldap: "+ldapAttributeName+")", e);
}
}