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


Java Modification.setAttribute方法代码示例

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


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

示例1: createContextCsnModList

import org.apache.directory.api.ldap.model.entry.Modification; //导入方法依赖的package包/类
private void createContextCsnModList() throws LdapException
{
    Modification contextCsnMod = new DefaultModification();
    contextCsnMod.setOperation( ModificationOperation.REPLACE_ATTRIBUTE );
    DefaultAttribute contextCsnAt = new DefaultAttribute( schemaManager
        .lookupAttributeTypeRegistry( SchemaConstants.CONTEXT_CSN_AT ) );
    contextCsnMod.setAttribute( contextCsnAt );

    mods.add( contextCsnMod );

    Modification timeStampMod = new DefaultModification();
    timeStampMod.setOperation( ModificationOperation.REPLACE_ATTRIBUTE );
    DefaultAttribute timeStampAt = new DefaultAttribute( schemaManager
        .lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ) );
    timeStampMod.setAttribute( timeStampAt );

    mods.add( timeStampMod );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:19,代码来源:DefaultPartitionNexus.java

示例2: writeBinaryAttribute

import org.apache.directory.api.ldap.model.entry.Modification; //导入方法依赖的package包/类
public void writeBinaryAttribute( final String entryDN, final String attributeName, final byte[][] values, final boolean overwrite )
        throws ChaiUnavailableException, ChaiOperationException
{
    activityPreCheck();
    getInputValidator().writeBinaryAttribute( entryDN, attributeName, values, overwrite );

    try
    {
        final ModifyRequest modifyRequest = new ModifyRequestImpl();
        modifyRequest.setName( new Dn( entryDN ) );
        {
            final Modification modification = new DefaultModification();
            modification.setOperation( overwrite ? ModificationOperation.REPLACE_ATTRIBUTE : ModificationOperation.ADD_ATTRIBUTE );
            modification.setAttribute( new DefaultAttribute( attributeName, values ) );
            modifyRequest.addModification( modification );
        }
        final ModifyResponse response = connection.modify( modifyRequest );
        processResponse( response );
    }
    catch ( LdapException e )
    {
        throw ChaiOperationException.forErrorMessage( e.getMessage() );
    }
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:25,代码来源:ApacheLdapProviderImpl.java

示例3: writeStringAttribute

import org.apache.directory.api.ldap.model.entry.Modification; //导入方法依赖的package包/类
public void writeStringAttribute( final String entryDN, final String attributeName, final Set<String> values, final boolean overwrite )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    activityPreCheck();
    getInputValidator().writeStringAttribute( entryDN, attributeName, values, overwrite );

    try
    {
        final ModifyRequest modifyRequest = new ModifyRequestImpl();
        modifyRequest.setName( new Dn( entryDN ) );
        {
            final Modification modification = new DefaultModification();
            modification.setOperation( overwrite ? ModificationOperation.REPLACE_ATTRIBUTE : ModificationOperation.ADD_ATTRIBUTE );
            modification.setAttribute( new DefaultAttribute( attributeName, values.toArray( new String[values.size()] ) ) );
            modifyRequest.addModification( modification );
        }
        final ModifyResponse response = connection.modify( modifyRequest );
        processResponse( response );
    }
    catch ( LdapException e )
    {
        throw ChaiOperationException.forErrorMessage( e.getMessage() );
    }
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:25,代码来源:ApacheLdapProviderImpl.java

示例4: writeStringAttributes

import org.apache.directory.api.ldap.model.entry.Modification; //导入方法依赖的package包/类
public void writeStringAttributes( final String entryDN, final Map<String, String> attributeValueProps, final boolean overwrite )
        throws ChaiOperationException, ChaiUnavailableException, IllegalStateException
{
    activityPreCheck();
    getInputValidator().writeStringAttributes( entryDN, attributeValueProps, overwrite );

    try
    {
        final ModifyRequest modifyRequest = new ModifyRequestImpl();
        modifyRequest.setName( new Dn( entryDN ) );
        for ( final Map.Entry<String, String> entry : attributeValueProps.entrySet() )
        {
            final String name = entry.getKey();
            final String value = entry.getValue();
            final Modification modification = new DefaultModification();
            modification.setOperation( overwrite ? ModificationOperation.REPLACE_ATTRIBUTE : ModificationOperation.ADD_ATTRIBUTE );
            modification.setAttribute( new DefaultAttribute( name, value ) );
            modifyRequest.addModification( modification );
        }
        final ModifyResponse response = connection.modify( modifyRequest );
        processResponse( response );
    }
    catch ( LdapException e )
    {
        throw ChaiOperationException.forErrorMessage( e.getMessage() );
    }
}
 
开发者ID:ldapchai,项目名称:ldapchai,代码行数:28,代码来源:ApacheLdapProviderImpl.java


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