當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributeValueCompleteness類代碼示例

本文整理匯總了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());
		}
	}
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:48,代碼來源:AdAttributeHandler.java

示例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);
	}
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:60,代碼來源:AbstractSchemaTranslator.java


注:本文中的org.identityconnectors.framework.common.objects.AttributeValueCompleteness類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。