/** * 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 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 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 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 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 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 an Attribute, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new ClientValue which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the attributeType ID * @param vals an initial set of values for this attribute */ public DefaultAttribute( String upId, Value... vals ) { // The value can be null, this is a valid value. if ( vals[0] == null ) { add( new Value( ( String ) null ) ); } else { for ( Value val : vals ) { add( val ); } } setUpId( upId ); }
/** * Create a new instance of an Attribute, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new ClientValue which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the attributeType ID * @param vals an initial set of values for this attribute */ public DefaultAttribute( String upId, Value... vals ) { // The value can be null, this is a valid value. if ( vals[0] == null ) { add( new Value( ( String ) null ) ); } else { for ( Value val : vals ) { add( val ); } } setUpId( upId ); }
/** * Create a new instance of an Attribute, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new ClientValue which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the attributeType ID * @param vals an initial set of values for this attribute */ public DefaultAttribute( String upId, Value... vals ) { // The value can be null, this is a valid value. if ( vals[0] == null ) { add( new Value( ( String ) null ) ); } else { for ( Value val : vals ) { add( val ); } } setUpId( upId ); }
/** * 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 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 a schema aware Attribute, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new Value which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the ID of the created attribute * @param attributeType the attribute type according to the schema * @param vals an initial set of values for this attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, Value... 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 ); setUpId( upId, attributeType ); add( vals ); }
/** * 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, 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 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, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new Value which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the ID of the created attribute * @param attributeType the attribute type according to the schema * @param vals an initial set of values for this attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, Value... 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 ); setUpId( upId, attributeType ); add( vals ); }
/** * Create a new instance of a schema aware Attribute, with some values, and a user provided ID.<br> * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new Value which uses the specified * attributeType. * <p> * Otherwise, the value is stored, but as a reference. It's not a copy. * </p> * @param upId the ID of the created attribute * @param attributeType the attribute type according to the schema * @param vals an initial set of values for this attribute * @throws LdapInvalidAttributeValueException If any of the * added values is not valid */ public DefaultAttribute( String upId, AttributeType attributeType, Value... 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 ); setUpId( upId, attributeType ); add( vals ); }
/** * 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 ); }
/** * 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; }