objectClass.add( TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC );
objectClass.add( TLS_KEY_INFO_OC, SchemaConstants.INET_ORG_PERSON_OC );
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( org.apache.directory.shared.ldap.entry.Value<?> value ) { currentAttribute.add( value ); }
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( String value ) { currentAttribute.add( value ); }
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( byte[] value ) { currentAttribute.add( value ); }
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( byte[] value ) { currentAttribute.add( value ); }
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( org.apache.directory.shared.ldap.entry.Value<?> value ) { currentAttribute.add( value ); }
/** * Add a new value to the current attribute * * @param value The value to add */ public void addAttributeValue( String value ) { currentAttribute.add( value ); }
/** * Return the extensions formated as Ldif lines * @param ID The attributeId : can be m-objectClassExtension or * m-attributeTypeExtension * * @return The extensions formated as ldif lines * @throws NamingException If the conversion goes wrong */ protected String extensionsToLdif( String ID ) throws NamingException { StringBuilder sb = new StringBuilder(); Entry entry = new DefaultClientEntry(); EntryAttribute attribute = new DefaultClientAttribute( ID ); for ( String extension:extensions ) { attribute.add( extension ); } sb.append( LdifUtils.convertAttributesToLdif( entry ) ); return sb.toString(); }
private final void injectNames( List<String> names, ServerEntry entry, SchemaManager schemaManager ) throws LdapException { if ( ( names == null ) || ( names.size() == 0 ) ) { return; } EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_NAME_AT ) ); for ( String name:names ) { attr.add( name ); } entry.put( attr ); }
oldAttribute.add( value );
/** * Add an attribute (represented by its ID and binary values) into an entry. * * @param upId The attribute ID * @param values The list of binary values to inject. It can be empty * @throws LdapException If the attribute does not exist */ public void add( String upId, byte[]... values ) throws LdapException { // First, transform the upID to a valid ID String id = getId( upId ); // Now, check to see if we already have such an attribute EntryAttribute attribute = attributes.get( id ); if ( attribute != null ) { // This Attribute already exist, we add the values // into it. (If the values already exists, they will // not be added, but this is done in the add() method) attribute.add( values ); attribute.setUpId( upId ); } else { // We have to create a new Attribute and set the values // and the upId attributes.put( id, new DefaultClientAttribute( upId, values ) ); } }
/** * Add an attribute (represented by its ID and Value values) into an entry. * * @param upId The attribute ID * @param values The list of Value values to inject. It can be empty * @throws LdapException If the attribute does not exist */ public void add( String upId, Value<?>... values ) throws LdapException { // First, transform the upID to a valid ID String id = getId( upId ); // Now, check to see if we already have such an attribute EntryAttribute attribute = attributes.get( id ); if ( attribute != null ) { // This Attribute already exist, we add the values // into it. (If the values already exists, they will // not be added, but this is done in the add() method) attribute.add( values ); attribute.setUpId( upId ); } else { // We have to create a new Attribute and set the values // and the upId attributes.put( id, new DefaultClientAttribute( upId, values ) ); } }
/** * Add some String values to the current Entry. * * @param upId The user provided ID of the attribute we want to add * some values to * @param values The list of String values to add * @throws LdapException If we can't add any of the values */ public void add( String upId, String... values ) throws LdapException { // First, transform the upID to a valid ID String id = getId( upId ); // Now, check to see if we already have such an attribute EntryAttribute attribute = attributes.get( id ); if ( attribute != null ) { // This Attribute already exist, we add the values // into it. (If the values already exists, they will // not be added, but this is done in the add() method) attribute.add( values ); attribute.setUpId( upId ); } else { // We have to create a new Attribute and set the values // and the upId attributes.put( id, new DefaultClientAttribute( upId, values ) ); } }
attribute.add( values ); attribute.setUpId( upId, attributeType );
/** * @return the Names as Ldif lines */ private String nameToLdif() throws NamingException { if ( names.size() == 0 ) { return ""; } else { Entry entry = new DefaultClientEntry(); EntryAttribute attribute = new DefaultClientAttribute( "m-name" ); for ( String name:names ) { attribute.add( name ); } entry.put( attribute ); return LdifUtils.convertAttributesToLdif( entry ); } }
/** * Add some Attributes to the current Entry. * * @param attributes The attributes to add * @throws LdapException If we can't add any of the attributes */ public void add( EntryAttribute... attributes ) throws LdapException { // Loop on all the added attributes for ( EntryAttribute attribute:attributes ) { // If the attribute already exist, we will add the new values. if ( contains( attribute ) ) { EntryAttribute existingAttr = get( attribute.getId() ); // Loop on all the values, and add them to the existing attribute for ( Value<?> value:attribute ) { existingAttr.add( value ); } } else { // Stores the attribute into the entry this.attributes.put( attribute.getId(), attribute ); } } }
/** * Convert the ServerAttribute to a ClientAttribute * * @return An instance of ClientAttribute */ public EntryAttribute toClientAttribute() { // Create the new EntryAttribute EntryAttribute clientAttribute = new DefaultClientAttribute( upId ); // Copy the values for ( Value<?> value:this ) { Value<?> clientValue = null; if ( value instanceof StringValue ) { clientValue = new StringValue( value.getString() ); } else { clientValue = new BinaryValue( value.getBytes() ); } clientAttribute.add( clientValue ); } return clientAttribute; }
public ServerEntry getAttributes( Schema schema, SchemaManager schemaManager ) throws LdapException { ServerEntry entry = new DefaultServerEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SCHEMA_OC ); entry.put( SchemaConstants.CN_AT, schema.getSchemaName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); if ( schema.isDisabled() ) { entry.put( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ); } String[] dependencies = schema.getDependencies(); if ( dependencies != null && dependencies.length > 0 ) { EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_DEPENDENCIES_AT ) ); for ( String dependency:dependencies ) { attr.add( dependency ); } entry.put( attr ); } return entry; }