当前位置: 首页>>代码示例>>Java>>正文


Java AttributeType.getSyntax方法代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.schema.AttributeType.getSyntax方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeType.getSyntax方法的具体用法?Java AttributeType.getSyntax怎么用?Java AttributeType.getSyntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.api.ldap.model.schema.AttributeType的用法示例。


在下文中一共展示了AttributeType.getSyntax方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
private void init( AttributeType attributeType )
{
    if ( attributeType != null )
    {
        if ( attributeType.getSyntax() == null )
        {
            // Some broken LDAP servers do not have proper syntax definitions, default to HR
            LOG.info( I18n.err( I18n.ERR_04445_NO_SYNTAX ) );
            isHR = true;
            //throw new IllegalArgumentException( I18n.err( I18n.ERR_04445_NO_SYNTAX ) );
        }
        else
        {
            isHR = attributeType.getSyntax().isHumanReadable();
        }
    }
    else
    {
        LOG.warn( "The attributeType is null" );
    }
    
    this.attributeType = attributeType;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:Value.java

示例2: addAnonAttributeType

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
/**
 * Add an attributeType that has to be anonymized
 *
 * @param attributeType the AttributeType that has to be anonymized
 * @throws LdapException If the attributeType cannot be added
 */
public void addAnonAttributeType( AttributeType attributeType ) throws LdapException
{
    schemaManager.add( attributeType );
    LdapSyntax syntax = attributeType.getSyntax();
    
    if ( syntax.isHumanReadable() )
    {
        if ( syntax.getOid().equals( SchemaConstants.INTEGER_SYNTAX ) )
        {
            attributeAnonymizers.put( attributeType.getOid(), new IntegerAnonymizer() );
        }
        else if ( syntax.getOid().equals( SchemaConstants.DIRECTORY_STRING_SYNTAX ) )
        {
            attributeAnonymizers.put( attributeType.getOid(), new StringAnonymizer() );
        }
        else if ( syntax.getOid().equals( SchemaConstants.TELEPHONE_NUMBER_SYNTAX ) )
        {
            attributeAnonymizers.put( attributeType.getOid(), new TelephoneNumberAnonymizer() );
        }
    }
    else
    {
        attributeAnonymizers.put( attributeType.getOid(), new BinaryAnonymizer() );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:32,代码来源:LdifAnonymizer.java

示例3: addCrossReferences

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
/**
 * Add the SchemaObjectReferences. This method does nothing, it's just
 * a catch all. The other methods will be called for each specific
 * schemaObject
 *
public void addCrossReferences( SchemaObject schemaObject )
{
    // Do nothing : it's a catch all method.
}


/**
 * Delete the AT references (using and usedBy) :
 * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
 * AT -> S
 * AT -> AT
 * 
 * @param attributeType The AttributeType to remove
 */
public void delCrossReferences( AttributeType attributeType )
{
    if ( attributeType.getEquality() != null )
    {
        delReference( attributeType, attributeType.getEquality() );
    }

    if ( attributeType.getOrdering() != null )
    {
        delReference( attributeType, attributeType.getOrdering() );
    }

    if ( attributeType.getSubstring() != null )
    {
        delReference( attributeType, attributeType.getSubstring() );
    }

    if ( attributeType.getSyntax() != null )
    {
        delReference( attributeType, attributeType.getSyntax() );
    }

    if ( attributeType.getSuperior() != null )
    {
        delReference( attributeType, attributeType.getSuperior() );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:47,代码来源:Registries.java

示例4: isBinary

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isBinary( String attributeId )
{
    String attrId = Strings.toLowerCaseAscii( attributeId );

    if ( attrId.endsWith( ";binary" ) )
    {
        return true;
    }

    if ( schemaManager != null )
    {
        AttributeType attributeType =  schemaManager.getAttributeType( attrId );
        
        if ( attributeType == null )
        {
            return false;
        }
        
        LdapSyntax ldapSyntax = attributeType.getSyntax();
        
        return ( ldapSyntax != null ) && !ldapSyntax.isHumanReadable();
    }

    return false;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:SchemaBinaryAttributeDetector.java

示例5: isValid

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean isValid( AttributeType attributeType ) throws LdapInvalidAttributeValueException
{
    LdapSyntax syntax = attributeType.getSyntax();

    if ( syntax == null )
    {
        return false;
    }

    SyntaxChecker syntaxChecker = syntax.getSyntaxChecker();

    if ( syntaxChecker == null )
    {
        return false;
    }

    // Check that we can have no value for this attributeType
    if ( values.isEmpty() )
    {
        return syntaxChecker.isValidSyntax( null );
    }

    // Check that we can't have more than one value if the AT is single-value
    if ( ( attributeType.isSingleValued() ) && ( values.size() > 1 ) )
    {
        return false;
    }

    // Now check the values
    for ( Value value : values )
    {
        try
        {
            if ( !value.isValid( syntaxChecker ) )
            {
                return false;
            }
        }
        catch ( LdapException le )
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:51,代码来源:DefaultAttribute.java

示例6: removeFromRegistries

import org.apache.directory.api.ldap.model.schema.AttributeType; //导入方法依赖的package包/类
/**
 * Remove the AttributeType from the registries, updating the references to
 * other SchemaObject.
 *
 * If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX),
 * an exception is thrown.
 * 
 * @param attributeType The AttributeType to remove from the Registries
 * @param errors The errors we got while removing the AttributeType from the Registries
 * @param registries The Registries
 * @throws LdapException If the AttributeType is not valid
 */
public static void removeFromRegistries( AttributeType attributeType, List<Throwable> errors, Registries registries ) throws LdapException
{
    if ( registries != null )
    {
        AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

        // Remove the attributeType from the oid/normalizer map
        attributeTypeRegistry.removeMappingFor( attributeType );

        // Unregister this AttributeType into the Descendant map
        attributeTypeRegistry.unregisterDescendants( attributeType, attributeType.getSuperior() );

        /**
         * Remove the AT references (using and usedBy) :
         * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
         * AT -> S
         * AT -> AT
         */
        if ( attributeType.getEquality() != null )
        {
            registries.delReference( attributeType, attributeType.getEquality() );
        }

        if ( attributeType.getOrdering() != null )
        {
            registries.delReference( attributeType, attributeType.getOrdering() );
        }

        if ( attributeType.getSubstring() != null )
        {
            registries.delReference( attributeType, attributeType.getSubstring() );
        }

        if ( attributeType.getSyntax() != null )
        {
            registries.delReference( attributeType, attributeType.getSyntax() );
        }

        if ( attributeType.getSuperior() != null )
        {
            registries.delReference( attributeType, attributeType.getSuperior() );
        }
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:57,代码来源:AttributeTypeHelper.java


注:本文中的org.apache.directory.api.ldap.model.schema.AttributeType.getSyntax方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。