本文整理汇总了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();
}
示例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());
}
}
示例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));
}
示例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() );
}
示例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() );
}
示例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() );
}
示例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;
}
示例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))
)
);
}
示例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;
}
示例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;
}
示例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));
}
示例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()));
}
示例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);
}
示例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);
}