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


Java EqualityNode類代碼示例

本文整理匯總了Java中org.apache.directory.api.ldap.model.filter.EqualityNode的典型用法代碼示例。如果您正苦於以下問題:Java EqualityNode類的具體用法?Java EqualityNode怎麽用?Java EqualityNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EqualityNode類屬於org.apache.directory.api.ldap.model.filter包,在下文中一共展示了EqualityNode類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: useBundleClasses

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
@Override
protected void useBundleClasses() throws Exception
{
    new Dn( "dc=example,dc=com" ); // uses FastDnParser
    new Dn( "cn=a+sn=b,dc=example,dc=com" ); // uses ComplexDnparser (antlr based)
    new Value( "foo" );
    new DefaultAttribute( "cn" );
    new DefaultEntry();

    AttributeUtils.toJndiAttribute( new DefaultAttribute( "cn" ) );
    
    new BindRequestImpl();

    new EqualityNode<String>( "cn", "foo" );

    new LdapUrl( "ldap://ldap.example.com:10389/dc=example,dc=com?objectclass" );

    new ObjectClassDescriptionSchemaParser()
        .parse( "( 2.5.6.0 NAME 'top' DESC 'top of the superclass chain' ABSTRACT MUST objectClass )" );
    
    SchemaObject schemaObject = new LdapSyntax( "1.2.3" );
    new Registries().getGlobalOidRegistry().register( schemaObject );
    new Registries().getLoadedSchemas();
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:25,代碼來源:ApiLdapModelOsgiTest.java

示例2: translate

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Translate filter, also add AND statement for objectClass.
 */
public ScopedFilter translate(Filter icfFilter, ObjectClass ldapObjectClass) {
	ScopedFilter plainScopedFilter = translate(icfFilter);
	EqualityNode<String> objectClassEqFilter = createObjectClassEqFilter(ldapObjectClass);
	if (plainScopedFilter == null) {
		return new ScopedFilter(objectClassEqFilter);
	}
	ExprNode plainFilter = plainScopedFilter.getFilter();
	if (plainFilter == null) {
		return new ScopedFilter(objectClassEqFilter, plainScopedFilter.getBaseDn());
	}
	if (plainFilter instanceof AndNode) {
		((AndNode)plainFilter).addNode(objectClassEqFilter);
		return plainScopedFilter;
	} else {
		return new ScopedFilter(new AndNode(objectClassEqFilter, plainFilter), plainScopedFilter.getBaseDn()); 
	}
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:21,代碼來源:LdapFilterTranslator.java

示例3: translateEqualsFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
protected ScopedFilter translateEqualsFilter(EqualsFilter icfFilter) {
	Attribute icfAttribute = icfFilter.getAttribute();
	String icfAttributeName = icfAttribute.getName();
	List<Object> icfAttributeValue = icfAttribute.getValue();
	if (Name.NAME.equals(icfAttributeName)) {
		Dn dn = schemaTranslator.toDn(icfAttribute);
		return new ScopedFilter(null, dn);
	}
	AttributeType ldapAttributeType = schemaTranslator.toLdapAttribute(ldapObjectClass, icfAttributeName);
	Value<Object> ldapValue;
	if (Uid.NAME.equals(icfAttributeName)) {
		if (icfAttributeValue.size() != 1) {
			throw new InvalidAttributeValueException("Expected single value for UID, but got " + icfAttributeValue);
		}
		ldapValue = schemaTranslator.toLdapIdentifierValue(ldapAttributeType, (String)icfAttributeValue.get(0));
	} else {
		ldapValue = schemaTranslator.toLdapValue(ldapAttributeType, icfAttributeValue);
	}
	return new ScopedFilter(new EqualityNode<Object>(ldapAttributeType, ldapValue));
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:21,代碼來源:LdapFilterTranslator.java

示例4: testRequestWithEqualityMatchFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Test parsing of a request with an Equality Filter
 */
@Test
public void testRequestWithEqualityMatchFilter()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource( "filters/request_with_equalityMatch.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof EqualityNode );

    EqualityNode<?> equalityFilter = ( EqualityNode<?> ) filter;

    assertEquals( "sn", equalityFilter.getAttribute() );
    assertEquals( "foobar", equalityFilter.getValue().getValue() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:33,代碼來源:SearchRequestTest.java

示例5: testRequestWithEqualityMatchFilterBase64Value

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Test parsing of a request with an Equality Filter with base64 value
 */
@Test
public void testRequestWithEqualityMatchFilterBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class
            .getResource( "filters/request_with_equalityMatch_base64_value.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof EqualityNode );

    EqualityNode<?> equalityFilter = ( EqualityNode<?> ) filter;

    assertEquals( "sn", equalityFilter.getAttribute() );

    assertEquals( "DSMLv2.0 rocks!!", equalityFilter.getValue().getValue() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:34,代碼來源:SearchRequestTest.java

示例6: testRequestWithEqualityMatchFilterWithEmptyValue

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Test parsing of a request with an Equality Filter with an empty value
 */
@Test
public void testRequestWithEqualityMatchFilterWithEmptyValue()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( SearchRequestTest.class.getResource(
            "filters/request_with_equalityMatch_with_empty_value.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    SearchRequest searchRequest = ( SearchRequest ) parser.getBatchRequest().getCurrentRequest();

    ExprNode filter = searchRequest.getFilter();

    assertTrue( filter instanceof EqualityNode );

    EqualityNode<?> equalityFilter = ( EqualityNode<?> ) filter;

    assertEquals( "sn", equalityFilter.getAttribute() );

    assertEquals( "", equalityFilter.getValue().getValue() );
}
 
開發者ID:apache,項目名稱:directory-ldap-api,代碼行數:34,代碼來源:SearchRequestTest.java

示例7: newIsReferralEqualityNode

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Constructs a new filter EqualityNode asserting that a candidate
 * objectClass is a referral.
 *
 * @param session the {@link LdapSession} to construct the node for
 * @return the {@link org.apache.directory.api.ldap.model.filter.EqualityNode} (objectClass=referral) non-normalized
 * @throws Exception in the highly unlikely event of schema related failures
 */
private EqualityNode<String> newIsReferralEqualityNode( LdapSession session ) throws Exception
{
    if ( OBJECT_CLASS_AT == null )
    {
        OBJECT_CLASS_AT = session.getCoreSession().getDirectoryService().getSchemaManager().getAttributeType(
            SchemaConstants.OBJECT_CLASS_AT );
    }

    EqualityNode<String> ocIsReferral = new EqualityNode<String>( OBJECT_CLASS_AT,
        new org.apache.directory.api.ldap.model.entry.StringValue( OBJECT_CLASS_AT, SchemaConstants.REFERRAL_OC ) );

    return ocIsReferral;
}
 
開發者ID:TremoloSecurity,項目名稱:MyVirtualDirectory,代碼行數:22,代碼來源:SearchRequestHandler.java

示例8: createLockoutFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
private ExprNode createLockoutFilter() {
	return new AndNode(new EqualityNode<String>(EDirectoryConstants.ATTRIBUTE_LOCKOUT_LOCKED_NAME, 
			new StringValue(AbstractLdapConfiguration.BOOLEAN_TRUE)
		),
		new GreaterEqNode<String>(EDirectoryConstants.ATTRIBUTE_LOCKOUT_RESET_TIME_NAME,
			new StringValue(LdapUtil.toGeneralizedTime(System.currentTimeMillis(), false))
		)
	);
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:10,代碼來源:EDirectoryLdapFilterTranslator.java

示例9: containsFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
public static boolean containsFilter(ExprNode filterNode, String attrName) {
	if (filterNode instanceof EqualityNode<?>) {
		return attrName.equalsIgnoreCase(((EqualityNode<?>)filterNode).getAttribute());
	} else if (filterNode instanceof PresenceNode) {
		return attrName.equalsIgnoreCase(((PresenceNode)filterNode).getAttribute());
	} else if (filterNode instanceof AndNode) {
		for (ExprNode subfilter: ((AndNode)filterNode).getChildren()) {
			if (containsFilter(subfilter, attrName)) {
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:15,代碼來源:LdapUtil.java

示例10: resolveDn

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
/**
 * Very efficient method that translates ICF UID to Dn. In case that the ICF UID is
 * entryUUID we need to make LDAP search to translate it do DN. DN is needed for operations
 * such as modify or delete.
 * 
 * This is different from searchByUid() method in that it returns only the dn. Therefore
 * the search may be optimized. The searchByUid() method has to retrieve a complete object.
 */
protected Dn resolveDn(ObjectClass objectClass, Uid uid, OperationOptions options) {
	Dn dn;
	String uidAttributeName = configuration.getUidAttribute();
	if (LdapUtil.isDnAttribute(uidAttributeName)) {
		dn = getSchemaTranslator().toDn(uid);
	} else {
		Dn baseDn = getBaseDn(options);
		checkBaseDnPresent(baseDn);
		SearchScope scope = getScope(options);
		AttributeType ldapAttributeType = null;
		SchemaManager schemaManager = getSchemaManager();
		try {
			ldapAttributeType = schemaManager.lookupAttributeTypeRegistry(uidAttributeName);
		} catch (LdapException e) {
			// E.g. ancient OpenLDAP does not have entryUUID in schema
			if (!configuration.isAllowUnknownAttributes()) {
				throw new InvalidAttributeValueException("Cannot find schema for UID attribute "+uidAttributeName, e);
			} 
			ldapAttributeType = schemaTranslator.createFauxAttributeType(uidAttributeName);
		}
		Value<Object> ldapValue = getSchemaTranslator().toLdapIdentifierValue(ldapAttributeType, uid.getUidValue());
		ExprNode filterNode = new EqualityNode<Object>(ldapAttributeType, ldapValue);
		LOG.ok("Resolving DN for UID {0}", uid);
		Entry entry = searchSingleEntry(getConnectionManager(), baseDn, filterNode, scope,
				new String[]{uidAttributeName}, "LDAP entry for UID "+uid);
		dn = entry.getDn();
	}
	
	return dn;
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:39,代碼來源:AbstractLdapConnector.java

示例11: createLoginDisabledFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
private ExprNode createLoginDisabledFilter(String value) {
	return new EqualityNode<String>(EDirectoryConstants.ATTRIBUTE_LOGIN_DISABLED_NAME, 
			new StringValue(value));
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:5,代碼來源:EDirectoryLdapFilterTranslator.java

示例12: createObjectClassFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
public static ExprNode createObjectClassFilter(
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass) {
	return new EqualityNode<>(SchemaConstants.OBJECT_CLASS_AT, new StringValue(ldapObjectClass.getName()));
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:5,代碼來源:LdapUtil.java

示例13: createUidSearchFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
public static ExprNode createUidSearchFilter(String uidValue, 
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, AbstractSchemaTranslator schemaTranslator) {
	AttributeType ldapAttributeType = schemaTranslator.toLdapAttribute(ldapObjectClass, Uid.NAME);
	Value<Object> ldapValue = schemaTranslator.toLdapIdentifierValue(ldapAttributeType, uidValue);
	return new EqualityNode<>(ldapAttributeType, ldapValue);
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:7,代碼來源:LdapUtil.java

示例14: createObjectClassEqFilter

import org.apache.directory.api.ldap.model.filter.EqualityNode; //導入依賴的package包/類
private EqualityNode<String> createObjectClassEqFilter(ObjectClass ldapObjectClass) {
	Value<String> ldapValue = new StringValue(ldapObjectClass.getName());
	return new EqualityNode<String>(SchemaConstants.OBJECT_CLASS_AT, ldapValue);
}
 
開發者ID:Evolveum,項目名稱:connector-ldap,代碼行數:5,代碼來源:LdapFilterTranslator.java


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