Package org.apache.directory.shared.ldap.entry.client

Examples of org.apache.directory.shared.ldap.entry.client.ClientStringValue


        RestrictedByFilter filter = new RestrictedByFilter();
        Collection<ACITuple> tuples = new ArrayList<ACITuple>();
        tuples.add( new ACITuple( UC_EMPTY_COLLECTION, AuthenticationLevel.NONE, PROTECTED_ITEMS, MO_EMPTY_SET, true, 0 ) );

        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
            null, null, "sn", new ClientStringValue( "1" ), ENTRY, null, null ).size() );

        assertEquals( 1, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
            null, null, "sn", new ClientStringValue( "2" ), ENTRY, null, null ).size() );

        assertEquals( 0, filter.filter( null, tuples, OperationScope.ATTRIBUTE_TYPE_AND_VALUE, null, null, null, null,
            null, null, "sn", new ClientStringValue( "3" ), ENTRY, null, null ).size() );
    }
View Full Code Here


    {
        ServerEntry entry = new DefaultServerEntry( registries, EXAMPLE_DN );
       
        assertEquals( "ServerEntry\n    dn[]: dc=example,dc=com\n", entry.toString() );
       
        Value<String> strValueTop = new ClientStringValue( "top" );
        Value<String> strValuePerson = new ClientStringValue( "person" );
        Value<String> strNullValue = new ClientStringValue( null);

        Value<byte[]> binValue1 = new ClientBinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new ClientBinaryValue( BYTES2 );
        Value<byte[]> binNullValue = new ClientBinaryValue( null );
       
View Full Code Here

                            {
                                private static final long serialVersionUID = 1L;

                                public Value<?> normalize( Value<?> value ) throws NamingException
                                {
                                    return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
                                }
                               
                                public String normalize( String value ) throws NamingException
                                {
                                    return StringTools.deepTrimToLower( value );
                                }
                            };
                        }

                        public boolean isObsolete()
                        {
                            return false;
                        }

                        public String getOid()
                        {
                            return null;
                        }

                        public String[] getNamesRef()
                        {
                            return null;
                        }

                        public String getName()
                        {
                            return null;
                        }

                        public String getDescription()
                        {
                            return null;
                        }

                        public String getSchema()
                        {
                            return null;
                        }

                        public void setSchema( String schemaName )
                        {
                        }
                    };
                }


                public MatchingRule getOrdering() throws NamingException
                {
                    return null;
                }


                public MatchingRule getSubstr() throws NamingException
                {
                    return null;
                }


                public boolean isAncestorOf( AttributeType descendant ) throws NamingException
                {
                    return false;
                }


                public boolean isDescendantOf( AttributeType ancestor ) throws NamingException
                {
                    return false;
                }


                public boolean isObsolete()
                {
                    return false;
                }


                public String getOid()
                {
                    return String.valueOf( id.hashCode() );
                }


                public String[] getNamesRef()
                {
                    return new String[]
                        { id };
                }


                public String getName()
                {
                    return id;
                }


                public String getDescription()
                {
                    return id;
                }


                public String getSchema()
                {
                    return null;
                }


                public void setSchema( String schemaName )
                {
                }
            };
        }
        else
        {
            return new AttributeType()
            {
                private static final long serialVersionUID = 1L;

                public boolean isSingleValue()
                {
                    return false;
                }


                public boolean isCanUserModify()
                {
                    return true;
                }


                public boolean isCollective()
                {
                    return false;
                }


                public UsageEnum getUsage()
                {
                    return null;
                }


                public AttributeType getSuperior() throws NamingException
                {
                    return null;
                }


                public Syntax getSyntax() throws NamingException
                {
                    return new Syntax()
                    {

                        private static final long serialVersionUID = 1L;

                        public boolean isHumanReadable()
                        {
                            return true;
                        }

                        public SyntaxChecker getSyntaxChecker() throws NamingException
                        {
                            return null;
                        }

                        public boolean isObsolete()
                        {
                            return false;
                        }

                        public String getOid()
                        {
                            return null;
                        }

                        public String[] getNamesRef()
                        {
                            return null;
                        }

                        public String getName()
                        {
                            return null;
                        }

                        public String getDescription()
                        {
                            return null;
                        }

                        public String getSchema()
                        {
                            return null;
                        }

                        public void setSchema( String schemaName )
                        {
                        }
                    };
                }


                public int getLength()
                {
                    return 0;
                }


                public MatchingRule getEquality() throws NamingException
                {
                    return new MatchingRule()
                    {
                        private static final long serialVersionUID = 1L;

                        public Syntax getSyntax() throws NamingException
                        {
                            return new Syntax()
                            {
                                private static final long serialVersionUID = 1L;


                                public boolean isHumanReadable()
                                {
                                    return true;
                                }

                                public SyntaxChecker getSyntaxChecker() throws NamingException
                                {
                                    return null;
                                }

                                public boolean isObsolete()
                                {
                                    return false;
                                }

                                public String getOid()
                                {
                                    return null;
                                }

                                public String[] getNamesRef()
                                {
                                    return null;
                                }

                                public String getName()
                                {
                                    return null;
                                }

                                public String getDescription()
                                {
                                    return null;
                                }

                                public String getSchema()
                                {
                                    return null;
                                }

                                public void setSchema( String schemaName )
                                {
                                }
                            };
                        }

                        public Comparator getComparator() throws NamingException
                        {
                            return null;
                        }

                        public Normalizer getNormalizer() throws NamingException
                        {
                            return new Normalizer()
                            {
                                private static final long serialVersionUID = 1L;

                                public Value<?> normalize( Value<?> value ) throws NamingException
                                {
                                    return new ClientStringValue( StringTools.deepTrimToLower( value.getString() ) );
                                }

                                public String normalize( String value ) throws NamingException
                                {
                                    return StringTools.deepTrimToLower( value );
View Full Code Here

        }, atRegistry.getNormalizerMapping() );
        evaluator = new SubtreeEvaluator( oidRegistry, atRegistry );

        // prepare to find all subentries in all namingContexts
        Set<String> suffixes = this.nexus.listSuffixes( null );
        ExprNode filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue(
            SchemaConstants.SUBENTRY_OC ) );
        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
        controls.setReturningAttributes( new String[]
            { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );
View Full Code Here

    {
        // search all naming contexts for static groups and generate
        // normalized sets of members to cache within the map

        BranchNode filter = new OrNode();
        filter.addNode( new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue(
            SchemaConstants.GROUP_OF_NAMES_OC ) ) );
        filter.addNode( new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue(
            SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ) );

        Set<String> suffixes = nexus.listSuffixes( null );

        for ( String suffix:suffixes )
View Full Code Here

     * {@inheritDoc}
     */
    public void init( DirectoryService directoryService, String... suffixes ) throws Exception
    {
        ExprNode referralFilter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT,
            new ClientStringValue( SchemaConstants.REFERRAL_OC ) );

        // Lookup for each entry with the ObjectClass = Referral value
        SearchControls searchControl = new SearchControls();
        searchControl.setReturningObjFlag( false );
        searchControl.setSearchScope( SearchControls.SUBTREE_SCOPE );
View Full Code Here

     * {@inheritDoc}
     */
    public void remove( DirectoryService directoryService, LdapDN suffix ) throws Exception
    {
        ExprNode referralFilter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT,
            new ClientStringValue( SchemaConstants.REFERRAL_OC ) );

        // Lookup for each entry with the ObjectClass = Referral value
        SearchControls searchControl = new SearchControls();
        searchControl.setReturningObjFlag( false );
        searchControl.setSearchScope( SearchControls.SUBTREE_SCOPE );
View Full Code Here

            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( attribute );

            if ( attributeType.getSyntax().isHumanReadable() )
            {
                normalized = new ClientStringValue( ( String ) ncn.normalizeByName( attribute, value.getString() ) );
            }
            else
            {
                normalized = new ClientBinaryValue( ( byte[] ) ncn.normalizeByName( attribute, value.getBytes() ) );
            }
View Full Code Here

        Value<?> normInitial = null;

        if ( node.getInitial() != null )
        {
            normInitial = normalizeValue( node.getAttribute(), new ClientStringValue( node.getInitial() ) );

            if ( normInitial == null )
            {
                return null;
            }
        }

        List<String> normAnys = null;

        if ( ( node.getAny() != null ) && ( node.getAny().size() != 0 ) )
        {
            normAnys = new ArrayList<String>( node.getAny().size() );

            for ( String any : node.getAny() )
            {
                Value<?> normAny = normalizeValue( node.getAttribute(), new ClientStringValue( any ) );

                if ( normAny != null )
                {
                    normAnys.add( normAny.getString() );
                }
            }

            if ( normAnys.size() == 0 )
            {
                return null;
            }
        }

        Value<?> normFinal = null;

        if ( node.getFinal() != null )
        {
            normFinal = normalizeValue( node.getAttribute(), new ClientStringValue( node.getFinal() ) );

            if ( normFinal == null )
            {
                return null;
            }
View Full Code Here

        assertFalse( attr8.contains( "ab" ) );

   
        ServerAttribute attr9 = new DefaultServerAttribute( atCN );
       
        nbAdded = attr9.add( new ClientStringValue( null ), new ClientStringValue( "ab" ) );
        assertEquals( 2, nbAdded );
        assertTrue( attr9.isHR() );
        assertTrue( attr9.contains( NULL_STRING_VALUE ) );
        assertTrue( attr9.contains( "ab" ) );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.client.ClientStringValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.