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