/** * {@inheritDoc} */ @Override public Attribute newAttribute( String name ) { return new DefaultAttribute( name ); }
/** * Create a new instance of an Attribute, with some String values, and a user provided ID. * * @param upId the ID of the created attribute * @param vals an initial set of String values for this attribute */ public DefaultAttribute( String upId, String... vals ) { try { add( vals ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen } setUpId( upId ); }
/** * Create a new instance of a schema aware Attribute, without ID nor value. * * @param attributeType the attributeType for the empty attribute added into the entry */ public DefaultAttribute( AttributeType attributeType ) { if ( attributeType != null ) { try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } } }
/** * Returns an apache ldap attribute that represents the values in the supplied ldap attribute. * * @param la ldap attribute * * @return apache ldap attribute */ public Attribute fromLdapAttribute(final LdapAttribute la) { final DefaultAttribute attribute = new DefaultAttribute(la.getName()); if (la.isBinary()) { for (byte[] value : la.getBinaryValues()) { attribute.add(createValue(value)); } } else { for (String value : la.getStringValues()) { attribute.add(createValue(value)); } } return attribute; }
/** * Create a new instance of a schema aware Attribute, with some byte[] values, and * a user provided ID. * * @param upId the ID for the added attribute * @param attributeType the AttributeType to be added * @param vals the binary values for the added attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, byte[]... vals ) throws LdapInvalidAttributeValueException { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ) ); } apply( attributeType ); add( vals ); setUpId( upId, attributeType ); }
/** * Create a new instance of a schema aware Attribute, without value. * * @param upId the ID for the added attributeType * @param attributeType the added AttributeType */ public DefaultAttribute( String upId, AttributeType attributeType ) { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ); LOG.error( message ); throw new IllegalArgumentException( message ); } try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } setUpId( upId, attributeType ); }
/** * Create a new instance of a schema aware Attribute, with some byte[] values, and * a user provided ID. * * @param upId the ID for the added attribute * @param attributeType the AttributeType to be added * @param vals the binary values for the added attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, byte[]... vals ) throws LdapInvalidAttributeValueException { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ) ); } apply( attributeType ); add( vals ); setUpId( upId, attributeType ); }
/** * Create a new instance of a schema aware Attribute, without value. * * @param upId the ID for the added attributeType * @param attributeType the added AttributeType */ public DefaultAttribute( String upId, AttributeType attributeType ) { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ); LOG.error( message ); throw new IllegalArgumentException( message ); } try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } setUpId( upId, attributeType ); }
/** * {@inheritDoc} */ @Override public Attribute newAttribute( String name, String... values ) { return new DefaultAttribute( name, values ); }
/** * Create a new instance of a schema aware Attribute, with some byte[] values, and * a user provided ID. * * @param upId the ID for the added attribute * @param attributeType the AttributeType to be added * @param vals the binary values for the added attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, byte[]... vals ) throws LdapInvalidAttributeValueException { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ) ); } apply( attributeType ); add( vals ); setUpId( upId, attributeType ); }
/** * Create a new instance of an Attribute, with some binary values, and a user provided ID. * * @param upId the ID of the created attribute * @param vals an initial set of binary values for this attribute */ public DefaultAttribute( String upId, byte[]... vals ) { try { add( vals ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, this can't happen } setUpId( upId ); }
/** * Create a new instance of a schema aware Attribute, without value. * * @param upId the ID for the added attributeType * @param attributeType the added AttributeType */ public DefaultAttribute( String upId, AttributeType attributeType ) { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ); LOG.error( message ); throw new IllegalArgumentException( message ); } try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } setUpId( upId, attributeType ); }
/** * Create a new instance of a schema aware Attribute, without ID nor value. * * @param attributeType the attributeType for the empty attribute added into the entry */ public DefaultAttribute( AttributeType attributeType ) { if ( attributeType != null ) { try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } } }
/** * Create multi-occurring ldap attribute given array of strings and attribute name. * * @param name contains attribute name to create. * @param values array of string that contains attribute values. * @return Attribute containing multi-occurring attribute set. * @throws LdapException in the event of ldap client error. */ protected Attribute createAttributes( String name, String values[] ) throws LdapException { return new DefaultAttribute( name, values ); }
/** * Create a new instance of a schema aware Attribute, with some values, and a user provided ID. * * @param upId the ID for the created attribute * @param attributeType The attributeType added on creation * @param vals the added values for this attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, String... vals ) throws LdapInvalidAttributeValueException { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ); LOG.error( message ); throw new IllegalArgumentException( message ); } apply( attributeType ); if ( ( vals != null ) && ( vals.length > 0 ) ) { add( vals ); } setUpId( upId, attributeType ); }
/** * Create a new instance of an Attribute, with some String values, and a user provided ID. * * @param upId the ID of the created attribute * @param vals an initial set of String values for this attribute */ public DefaultAttribute( String upId, String... vals ) { try { add( vals ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen } setUpId( upId ); }
/** * Create a new instance of a schema aware Attribute, without ID nor value. * * @param attributeType the attributeType for the empty attribute added into the entry */ public DefaultAttribute( AttributeType attributeType ) { if ( attributeType != null ) { try { apply( attributeType ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, it can't happen, there is no value } } }
/** * Creates a new instance of DefaultModification with no value * * @param operation The modification operation * @param attributeId The associated attribute ID */ public DefaultModification( ModificationOperation operation, String attributeId ) { this.operation = operation; this.attribute = new DefaultAttribute( attributeId ); }
/** * Create a new instance of a schema aware Attribute, with some values, and a user provided ID. * * @param upId the ID for the created attribute * @param attributeType The attributeType added on creation * @param vals the added values for this attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, String... vals ) throws LdapInvalidAttributeValueException { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_13203_ATTRIBUTE_TYPE_NULL_NOT_ALLOWED ); LOG.error( message ); throw new IllegalArgumentException( message ); } apply( attributeType ); if ( ( vals != null ) && ( vals.length > 0 ) ) { add( vals ); } setUpId( upId, attributeType ); }
/** * Create a new instance of an Attribute, with some binary values, and a user provided ID. * * @param upId the ID of the created attribute * @param vals an initial set of binary values for this attribute */ public DefaultAttribute( String upId, byte[]... vals ) { try { add( vals ); } catch ( LdapInvalidAttributeValueException liave ) { // Do nothing, this can't happen } setUpId( upId ); }