• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ModifyRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ModifyRequest类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了ModifyRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testRequestWithRequestId

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * Test parsing of a request with the (optional) requestID attribute
 */
@Test
public void testRequestWithRequestId()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput(
            ModifyRequestTest.class.getResource( "request_with_requestID_attribute.xml" ).openStream(), "UTF-8" );

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

    ModifyRequest modifyRequest = ( ModifyRequest ) parser.getBatchRequest().getCurrentRequest();

    assertEquals( 456, modifyRequest.getMessageId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:ModifyRequestTest.java


示例2: modify

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void modify( Entry entry, ModificationOperation modOp ) throws LdapException
{
    if ( entry == null )
    {
        LOG.debug( "received a null entry for modification" );
        throw new IllegalArgumentException( "Entry to be modified cannot be null" );
    }

    ModifyRequest modReq = new ModifyRequestImpl();
    modReq.setName( entry.getDn() );

    Iterator<Attribute> itr = entry.iterator();

    while ( itr.hasNext() )
    {
        modReq.addModification( itr.next(), modOp );
    }

    ModifyResponse modifyResponse = modify( modReq );

    processResponse( modifyResponse );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:LdapNetworkConnection.java


示例3: modify

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyResponse modify( ModifyRequest modifyRequest )
{
    LdapConnection connection = null;
    try
    {
        connection = connectionPool.getConnection();
        return connection.modify( modifyRequest );
    }
    catch ( LdapException e )
    {
        throw new LdapRuntimeException( e );
    }
    finally
    {
        returnLdapConnection( connection );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:22,代码来源:LdapConnectionTemplate.java


示例4: modifyEntry

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * 修改条目(准确是修改条目的属性)。可包括如下操作。
 *   1. ModificationOperation.ADD_ATTRIBUTE:    添加属性  
 *   2. ModificationOperation.REMOVE_ATTRIBUTE: 删除属性
 *   3. ModificationOperation.REPLACE_ATTRIBUTE:替换属性值
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-02-16
 * @version     v1.0
 *
 * @param i_Operation       操作类型
 * @param i_DN              DN标识
 * @param i_AttributeName   属性名称
 * @param i_AttributeValue  属性值(可为多个)
 * @return
 */
private boolean modifyEntry(ModificationOperation i_Operation ,String i_DN ,String i_AttributeName ,String ... i_AttributeValue)
{
    LdapConnection v_Conn     = null;
    ModifyRequest  v_Request  = new ModifyRequestImpl();
    ModifyResponse v_Response = null;
    
    try
    {
        v_Request.setName(new Dn(i_DN));
        v_Request.addModification(new DefaultModification(i_Operation ,i_AttributeName ,i_AttributeValue));
        
        v_Conn = this.getConnection();
        v_Response = v_Conn.modify(v_Request);
    }
    catch (Exception exce)
    {
        exce.printStackTrace();
    }
    finally
    {
        this.closeConnection(v_Conn);
    }
    
    return LDAP.isSuccess(v_Response);
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.ldap,代码行数:42,代码来源:LDAP.java


示例5: modify

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void modify( ModifyRequest modifyRequest, LogChange log ) throws LdapException
{
    ModifyOperationContext modifyContext = new ModifyOperationContext( this, modifyRequest );

    modifyContext.setLogChange( log );

    OperationManager operationManager = directoryService.getOperationManager();

    try
    {
        operationManager.modify( modifyContext );
    }
    catch ( LdapException e )
    {
        modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
        throw e;
    }

    modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:24,代码来源:DefaultCoreSession.java


示例6: updateEntryAddAtribute

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
@Override
public void updateEntryAddAtribute(String entryDn, String attribute, String value) throws LdapException {
	logger.info("Adding attribute " + attribute + " value " + value);
	LdapConnection connection = null;

	connection = getConnection();
	Entry entry = null;
	try {
		entry = connection.lookup(entryDn);
		if (entry != null) {
			entry.put(attribute, value);

			ModifyRequest mr = new ModifyRequestImpl();
			mr.setName(new Dn(entryDn));
			mr.add(attribute, value);

			connection.modify(mr);
		}
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
		throw new LdapException(e);
	} finally {
		releaseConnection(connection);
	}
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider,代码行数:26,代码来源:LDAPServiceImpl.java


示例7: updateEntryAddAtribute

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
public void updateEntryAddAtribute(String entryDn, String attribute, String value) throws Exception {
	logger.info("Adding attribute " + attribute + " value " + value);
	LdapConnection connection = null;

	connection = getConnection();
	Entry entry = null;
	try {
		entry = connection.lookup(entryDn);
		if (entry != null) {
			entry.put(attribute, value);

			ModifyRequest mr = new ModifyRequestImpl();
			mr.setName(new Dn(entryDn));
			mr.add(attribute, value);

			connection.modify(mr);
		}
	} finally {
		releaseConnection(connection);
	}
}
 
开发者ID:Pardus-LiderAhenk,项目名称:lider-ahenk-installer,代码行数:22,代码来源:LdapUtils.java


示例8: writeBinaryAttribute

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的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


示例9: writeStringAttribute

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的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


示例10: setName

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest setName( Dn name )
{
    getDecorated().setName( name );

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


示例11: addModification

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest addModification( Modification mod )
{
    getDecorated().addModification( mod );

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


示例12: removeModification

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest removeModification( Modification mod )
{
    getDecorated().removeModification( mod );

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


示例13: remove

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest remove( String attributeName, String... attributeValue )
{
    getDecorated().remove( attributeName, attributeValue );

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


示例14: add

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest add( String attributeName, String... attributeValue )
{
    getDecorated().add( attributeName, attributeValue );

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


示例15: replace

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest replace( String attributeName )
{
    getDecorated().replace( attributeName );

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


示例16: setMessageId

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public ModifyRequest setMessageId( int messageId )
{
    super.setMessageId( messageId );

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


示例17: testResponseWith1ModifyRequest

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * Test parsing of a Request with 1 ModifyRequest
 */
@Test
public void testResponseWith1ModifyRequest()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( BatchRequestTest.class.getResource( "request_with_1_ModifyRequest.xml" ).openStream(),
            "UTF-8" );

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

    BatchRequestDsml batchRequest = parser.getBatchRequest();

    assertEquals( 1, batchRequest.getRequests().size() );

    if ( batchRequest.getCurrentRequest() instanceof ModifyRequest )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:BatchRequestTest.java


示例18: testResponseWith2ModifyRequest

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * Test parsing of a Request with 2 ModifyRequest
 */
@Test
public void testResponseWith2ModifyRequest()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( BatchRequestTest.class.getResource( "request_with_2_ModifyRequest.xml" ).openStream(),
            "UTF-8" );

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

    BatchRequestDsml batchRequest = parser.getBatchRequest();

    assertEquals( 2, batchRequest.getRequests().size() );

    if ( batchRequest.getCurrentRequest() instanceof ModifyRequest )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:BatchRequestTest.java


示例19: testRequestWith1Control

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * Test parsing of a request with a (optional) Control element
 */
@Test
public void testRequestWith1Control()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( ModifyRequestTest.class.getResource( "request_with_1_control.xml" ).openStream(), "UTF-8" );

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

    ModifyRequest modifyRequest = ( ModifyRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = modifyRequest.getControls();

    assertEquals( 1, modifyRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:ModifyRequestTest.java


示例20: testRequestWith1ControlBase64Value

import org.apache.directory.api.ldap.model.message.ModifyRequest; //导入依赖的package包/类
/**
 * Test parsing of a request with a (optional) Control element with Base64 Value
 */
@Test
public void testRequestWith1ControlBase64Value()
{
    Dsmlv2Parser parser = null;
    try
    {
        parser = newParser();

        parser.setInput( ModifyRequestTest.class.getResource( "request_with_1_control_base64_value.xml" )
            .openStream(), "UTF-8" );

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

    ModifyRequest modifyRequest = ( ModifyRequest ) parser.getBatchRequest().getCurrentRequest();
    Map<String, Control> controls = modifyRequest.getControls();

    assertEquals( 1, modifyRequest.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "DSMLv2.0 rocks!!", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:ModifyRequestTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GsonRequest类代码示例发布时间:2022-05-23
下一篇:
Java MonitorRegistryMetricPoller类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap