001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *  http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.apache.directory.api.ldap.model.entry;
020
021
022import java.io.Externalizable;
023import java.util.Collection;
024import java.util.Iterator;
025import java.util.List;
026
027import org.apache.directory.api.ldap.model.exception.LdapException;
028import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
029import org.apache.directory.api.ldap.model.name.Dn;
030import org.apache.directory.api.ldap.model.schema.AttributeType;
031
032
033/**
034 * This interface represent a LDAP entry. An LDAP entry contains :
035 * <ul>
036 *   <li> A distinguished name (Dn)</li>
037 *   <li> A list of attributes</li>
038 * </ul>
039 * <p>
040 * The available methods on this object are described in this interface.
041 * <br>
042 * This interface is used by the serverEntry and clientEntry interfaces.
043 * 
044 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
045 */
046public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
047{
048    /**
049     * Remove all the attributes for this entry. The Dn is not reset
050     */
051    void clear();
052
053
054    /**
055     * Clone the current entry
056     * 
057     * @return the cloned entry
058     */
059    Entry clone();
060
061
062    /**
063     * Shallow Clone the current entry. We don't deep clone the attributes
064     * 
065     * @return A shallow clone of this entry
066     */
067    Entry shallowClone();
068
069
070    /**
071     * Get this entry's Dn.
072     *
073     * @return The entry's Dn
074     */
075    Dn getDn();
076
077
078    /**
079     * Tells if an entry as some specific ObjectClasses values
080     * 
081     * @param objectClasses The ObjectClasses we want to check
082     * @return <code>true</code> if all the ObjectClasses value are present 
083     * in the ObjectClass attribute
084     */
085    boolean hasObjectClass( String... objectClasses );
086
087
088    /**
089     * Tells if an entry has some specific ObjectClasses Attributes
090     * 
091     * @param objectClasses The ObjectClasses we want to check
092     * @return <code>true</code> if the ObjectClasses Attribute are present 
093     * in the ObjectClass attribute
094     */
095    boolean hasObjectClass( Attribute... objectClasses );
096
097
098    /**
099     * <p>
100     * Returns the attribute with the specified alias. The return value
101     * is <code>null</code> if no match is found.  
102     * </p>
103     * <p>An Attribute with an id different from the supplied alias may 
104     * be returned: for example a call with 'cn' may in some implementations 
105     * return an Attribute whose getId() field returns 'commonName'.
106     * </p>
107     *
108     * @param alias an aliased name of the attribute identifier
109     * @return the attribute associated with the alias
110     */
111    Attribute get( String alias );
112
113
114    /**
115     * Returns the attribute associated with an AttributeType
116     * 
117     * @param attributeType the AttributeType we are looking for
118     * @return the associated attribute
119     */
120    Attribute get( AttributeType attributeType );
121
122
123    /**
124     * Gets all the attributes
125     *
126     * @return The combined set of all the attributes.
127     */
128    Collection<Attribute> getAttributes();
129
130
131    /**
132     * Set this entry's Dn.
133     *
134     * @param dn The Dn associated with this entry
135     */
136    void setDn( Dn dn );
137
138
139    /**
140     * Set this entry's Dn.
141     *
142     * @param dn The String Dn associated with this entry
143     * @throws LdapInvalidDnException if the provided Dn is invalid
144     */
145    void setDn( String dn ) throws LdapInvalidDnException;
146
147
148    /**
149     * Returns an iterator on the attributes for this entry.
150     *
151     * @return an iterator on top of all contained attributes
152     */
153    Iterator<Attribute> iterator();
154
155
156    /**
157     * Add some Attributes to the current Entry.
158     *
159     * @param attributes The attributes to add
160     * @return the modified entry
161     * @throws LdapException If we can't add any of the attributes
162     */
163    Entry add( Attribute... attributes ) throws LdapException;
164
165
166    /**
167     * <p>
168     * Add an attribute (represented by its AttributeType and some binary values) into an 
169     * entry.
170     * </p>
171     * <p> 
172     * If we already have an attribute with the same values, the duplicated values 
173     * are not added (duplicated values are not allowed)
174     * </p>
175     * <p>
176     * If the value cannot be added, or if the AttributeType is null or invalid, 
177     * a LdapException is thrown.
178     * </p>
179     *
180     * @param attributeType The attribute Type.
181     * @param values The list of binary values to inject. It can be empty.
182     * @return the modified entry
183     * @throws LdapException If the attribute does not exist
184     */
185    Entry add( AttributeType attributeType, byte[]... values ) throws LdapException;
186
187
188    /**
189     * <p>
190     * Add an attribute (represented by its AttributeType and some String values) into an 
191     * entry.
192     * </p>
193     * <p> 
194     * If we already have an attribute with the same values, the duplicated values 
195     * are not added (duplicated values are not allowed)
196     * </p>
197     * <p> 
198     * If the value cannot be added, or if the AttributeType is null or invalid, 
199     * a LdapException is thrown.
200     * </p>
201     * 
202     * @param attributeType The attribute Type
203     * @param values The list of binary values to inject. It can be empty
204     * @return the modified entry
205     * @throws org.apache.directory.api.ldap.model.exception.LdapException If the attribute does not exist
206     */
207    Entry add( AttributeType attributeType, String... values ) throws LdapException;
208
209
210    /**
211     * <p>
212     * Add an attribute (represented by its AttributeType and some values) into an 
213     * entry.
214     * </p>
215     * <p> 
216     * If we already have an attribute with the same values, the duplicated values 
217     * are not added (duplicated values are not allowed)
218     * </p>
219     * <p>
220     * If the value cannot be added, or if the AttributeType is null or invalid, 
221     * a LdapException is thrown.
222     * </p>
223     *
224     * @param attributeType The attribute Type
225     * @param values The list of binary values to inject. It can be empty
226     * @return the modified entry
227     * @throws LdapException If the attribute does not exist
228     */
229    Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException;
230
231
232    /**
233     * <p>
234     * Add an attribute (represented by its AttributeType and some binary values) into an 
235     * entry. Set the User Provider ID at the same time
236     * </p>
237     * <p> 
238     * If we already have an attribute with the same values, the duplicated values 
239     * are not added (duplicated values are not allowed)
240     * </p>
241     * <p>
242     * If the value cannot be added, or if the AttributeType is null or invalid, 
243     * a LdapException is thrown.
244     * </p>
245     *
246     * @param upId The user provided ID for the added AttributeType
247     * @param attributeType The attribute Type.
248     * @param values The list of binary values to add. It can be empty.
249     * @return the modified entry
250     * @throws LdapException If the attribute does not exist
251     */
252    Entry add( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
253
254
255    /**
256     * <p>
257     * Add an attribute (represented by its AttributeType and some String values) into an 
258     * entry. Set the User Provider ID at the same time
259     * </p>
260     * <p> 
261     * If we already have an attribute with the same values, the duplicated values 
262     * are not added (duplicated values are not allowed)
263     * </p>
264     * <p>
265     * If the value cannot be added, or if the AttributeType is null or invalid, 
266     * a LdapException is thrown.
267     * </p>
268     *
269     * @param upId The user provided ID for the added AttributeType
270     * @param attributeType The attribute Type.
271     * @param values The list of String values to add. It can be empty.
272     * @return the modified entry
273     * @throws LdapException If the attribute does not exist
274     */
275    Entry add( String upId, AttributeType attributeType, String... values ) throws LdapException;
276
277
278    /**
279     * <p>
280     * Add an attribute (represented by its AttributeType and some values) into an 
281     * entry. Set the User Provider ID at the same time
282     * </p>
283     * <p> 
284     * If we already have an attribute with the same values, nothing is done 
285     * (duplicated values are not allowed)
286     * </p>
287     * <p>
288     * If the value cannot be added, or if the AttributeType is null or invalid, 
289     * a LdapException is thrown.
290     * </p>
291     *
292     * @param upId The user provided ID for the added AttributeType
293     * @param attributeType The attribute Type.
294     * @param values The list of values to add. It can be empty.
295     * @return the modified entry
296     * @throws LdapException If the attribute does not exist
297     */
298    Entry add( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException;
299
300
301    /**
302     * Add some String values to the current Entry.
303     *
304     * @param upId The user provided ID of the attribute we want to add 
305     * some values to
306     * @param values The list of String values to add
307     * @return the modified entry
308     * @throws LdapException If we can't add any of the values
309     */
310    Entry add( String upId, String... values ) throws LdapException;
311
312
313    /**
314     * Add some binary values to the current Entry.
315     *
316     * @param upId The user provided ID of the attribute we want to add 
317     * some values to
318     * @param values The list of binary values to add
319     * @return the modified entry
320     * @throws LdapException If we can't add any of the values
321     */
322    Entry add( String upId, byte[]... values ) throws LdapException;
323
324
325    /**
326     * Add some Values to the current Entry.
327     *
328     * @param upId The user provided ID of the attribute we want to add 
329     * some values to
330     * @param values The list of Values to add
331     * @return the modified entry
332     * @throws LdapException If we can't add any of the values
333     */
334    Entry add( String upId, Value<?>... values ) throws LdapException;
335
336
337    /**
338     * <p>
339     * Places attributes in the attribute collection. 
340     * </p>
341     * <p>If there is already an attribute with the same ID as any of the 
342     * new attributes, the old ones are removed from the collection and 
343     * are returned by this method. If there was no attribute with the 
344     * same ID the return value is <code>null</code>.
345     *</p>
346     *
347     * @param attributes the attributes to be put
348     * @return the old attributes with the same OID, if exist; otherwise <code>null</code>
349     * @exception LdapException if the operation fails
350     */
351    List<Attribute> put( Attribute... attributes ) throws LdapException;
352
353
354    /**
355     * <p>
356     * Places a new attribute with the supplied AttributeType and binary values 
357     * into the attribute collection. 
358     * </p>
359     * <p>
360     * If there is already an attribute with the same AttributeType, the old
361     * one is removed from the collection and is returned by this method. 
362     * </p>
363     * <p>
364     * This method provides a mechanism to put an attribute with a
365     * <code>null</code> value: the value may be <code>null</code>.
366     *
367     * @param attributeType the type of the new attribute to be put
368     * @param values the binary values of the new attribute to be put
369     * @return the old attribute with the same identifier, if exists; otherwise
370     * <code>null</code>
371     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures
372     */
373    Attribute put( AttributeType attributeType, byte[]... values ) throws LdapException;
374
375
376    /**
377     * <p>
378     * Places a new attribute with the supplied AttributeType and String values 
379     * into the attribute collection. 
380     * </p>
381     * <p>
382     * If there is already an attribute with the same AttributeType, the old
383     * one is removed from the collection and is returned by this method. 
384     * </p>
385     * <p>
386     * This method provides a mechanism to put an attribute with a
387     * <code>null</code> value: the value may be <code>null</code>.
388     *
389     * @param attributeType the type of the new attribute to be put
390     * @param values the String values of the new attribute to be put
391     * @return the old attribute with the same identifier, if exists; otherwise
392     * <code>null</code>
393     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures
394     */
395    Attribute put( AttributeType attributeType, String... values ) throws LdapException;
396
397
398    /**
399     * <p>
400     * Places a new attribute with the supplied AttributeType and some values 
401     * into the attribute collection. 
402     * </p>
403     * <p>
404     * If there is already an attribute with the same AttributeType, the old
405     * one is removed from the collection and is returned by this method. 
406     * </p>
407     * <p>
408     * This method provides a mechanism to put an attribute with a
409     * <code>null</code> value: the value may be <code>null</code>.
410     *
411     * @param attributeType the type of the new attribute to be put
412     * @param values the values of the new attribute to be put
413     * @return the old attribute with the same identifier, if exists; otherwise
414     * <code>null</code>
415     * @throws LdapException if there are failures
416     */
417    Attribute put( AttributeType attributeType, Value<?>... values ) throws LdapException;
418
419
420    /**
421     * <p>
422     * Places a new attribute with the supplied AttributeType and some binary values 
423     * into the attribute collection. 
424     * </p>
425     * <p>
426     * The given User provided ID will be used for this new AttributeEntry.
427     * </p>
428     * <p>
429     * If there is already an attribute with the same AttributeType, the old
430     * one is removed from the collection and is returned by this method. 
431     * </p>
432     * <p>
433     * This method provides a mechanism to put an attribute with a
434     * <code>null</code> value: the value may be <code>null</code>.
435     *
436     * @param upId The User Provided ID to be stored into the AttributeEntry
437     * @param attributeType the type of the new attribute to be put
438     * @param values the binary values of the new attribute to be put
439     * @return the old attribute with the same identifier, if exists; otherwise
440     * <code>null</code>
441     * @throws LdapException if there are failures.
442     */
443    Attribute put( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
444
445
446    /**
447     * <p>
448     * Places a new attribute with the supplied AttributeType and some String values 
449     * into the attribute collection. 
450     * </p>
451     * <p>
452     * The given User provided ID will be used for this new AttributeEntry.
453     * </p>
454     * <p>
455     * If there is already an attribute with the same AttributeType, the old
456     * one is removed from the collection and is returned by this method. 
457     * </p>
458     * <p>
459     * This method provides a mechanism to put an attribute with a
460     * <code>null</code> value: the value may be <code>null</code>.
461     *
462     * @param upId The User Provided ID to be stored into the AttributeEntry
463     * @param attributeType the type of the new attribute to be put
464     * @param values the String values of the new attribute to be put
465     * @return the old attribute with the same identifier, if exists; otherwise
466     * <code>null</code>
467     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures.
468     */
469    Attribute put( String upId, AttributeType attributeType, String... values ) throws LdapException;
470
471
472    /**
473     * <p>
474     * Places a new attribute with the supplied AttributeType and some values 
475     * into the attribute collection. 
476     * </p>
477     * <p>
478     * The given User provided ID will be used for this new AttributeEntry.
479     * </p>
480     * <p>
481     * If there is already an attribute with the same AttributeType, the old
482     * one is removed from the collection and is returned by this method. 
483     * </p>
484     * <p>
485     * This method provides a mechanism to put an attribute with a
486     * <code>null</code> value: the value may be <code>null</code>.
487     *
488     * @param upId The User Provided ID to be stored into the AttributeEntry
489     * @param attributeType the type of the new attribute to be put
490     * @param values the values of the new attribute to be put
491     * @return the old attribute with the same identifier, if exists; otherwise
492     * <code>null</code>
493     * @throws LdapException if there are failures.
494     */
495    Attribute put( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException;
496
497
498    /**
499     * <p>
500     * Put an attribute (represented by its ID and some binary values) into an entry. 
501     * </p>
502     * <p> 
503     * If the attribute already exists, the previous attribute will be 
504     * replaced and returned.
505     * </p>
506     *
507     * @param upId The attribute ID
508     * @param values The list of binary values to put. It can be empty.
509     * @return The replaced attribute
510     */
511    Attribute put( String upId, byte[]... values );
512
513
514    /**
515     * <p>
516     * Put an attribute (represented by its ID and some String values) into an entry. 
517     * </p>
518     * <p> 
519     * If the attribute already exists, the previous attribute will be 
520     * replaced and returned.
521     * </p>
522     *
523     * @param upId The attribute ID
524     * @param values The list of String values to put. It can be empty.
525     * @return The replaced attribute
526     */
527    Attribute put( String upId, String... values );
528
529
530    /**
531     * <p>
532     * Put an attribute (represented by its ID and some values) into an entry. 
533     * </p>
534     * <p> 
535     * If the attribute already exists, the previous attribute will be 
536     * replaced and returned.
537     * </p>
538     *
539     * @param upId The attribute ID
540     * @param values The list of values to put. It can be empty.
541     * @return The replaced attribute
542     */
543    Attribute put( String upId, Value<?>... values );
544
545
546    /**
547     * <p>
548     * Removes the specified binary values from an attribute.
549     * </p>
550     * <p>
551     * If at least one value is removed, this method returns <code>true</code>.
552     * </p>
553     * <p>
554     * If there is no more value after having removed the values, the attribute
555     * will be removed too.
556     * </p>
557     * <p>
558     * If the attribute does not exist, nothing is done and the method returns 
559     * <code>false</code>
560     * </p> 
561     *
562     * @param attributeType The attribute type  
563     * @param values the values to be removed
564     * @return <code>true</code> if at least a value is removed, <code>false</code>
565     * if not all the values have been removed or if the attribute does not exist. 
566     * @throws LdapException If the removal failed 
567     */
568    boolean remove( AttributeType attributeType, byte[]... values ) throws LdapException;
569
570
571    /**
572     * <p>
573     * Removes the specified String values from an attribute.
574     * </p>
575     * <p>
576     * If at least one value is removed, this method returns <code>true</code>.
577     * </p>
578     * <p>
579     * If there is no more value after having removed the values, the attribute
580     * will be removed too.
581     * </p>
582     * <p>
583     * If the attribute does not exist, nothing is done and the method returns 
584     * <code>false</code>
585     * </p> 
586     *
587     * @param attributeType The attribute type  
588     * @param values the values to be removed
589     * @return <code>true</code> if at least a value is removed, <code>false</code>
590     * if not all the values have been removed or if the attribute does not exist. 
591     * @throws LdapException If the removal failed 
592     */
593    boolean remove( AttributeType attributeType, String... values ) throws LdapException;
594
595
596    /**
597     * <p>
598     * Removes the specified values from an attribute.
599     * </p>
600     * <p>
601     * If at least one value is removed, this method returns <code>true</code>.
602     * </p>
603     * <p>
604     * If there is no more value after having removed the values, the attribute
605     * will be removed too.
606     * </p>
607     * <p>
608     * If the attribute does not exist, nothing is done and the method returns 
609     * <code>false</code>
610     * </p> 
611     *
612     * @param attributeType The attribute type  
613     * @param values the values to be removed
614     * @return <code>true</code> if at least a value is removed, <code>false</code>
615     * if not all the values have been removed or if the attribute does not exist. 
616     * @throws LdapException If the removal failed 
617     */
618    boolean remove( AttributeType attributeType, Value<?>... values ) throws LdapException;
619
620
621    /**
622     * Removes the specified attributes. The removed attributes are
623     * returned by this method. If there were no attribute the return value
624     * is <code>null</code>.
625     *
626     * @param attributes the attributes to be removed
627     * @return the removed attribute, if exists; otherwise <code>null</code>
628     * @throws LdapException If the removal failed 
629     */
630    List<Attribute> remove( Attribute... attributes ) throws LdapException;
631
632
633    /**
634     * <p>
635     * Removes the attribute with the specified AttributeTypes. 
636     * </p>
637     * <p>
638     * The removed attribute are returned by this method. 
639     * </p>
640     * <p>
641     * If there is no attribute with the specified AttributeTypes,
642     * the return value is <code>null</code>.
643     * </p>
644     *
645     * @param attributes the AttributeTypes to be removed
646     */
647    void removeAttributes( AttributeType... attributes );
648
649
650    /**
651     * <p>
652     * Removes the specified binary values from an attribute.
653     * </p>
654     * <p>
655     * If at least one value is removed, this method returns <code>true</code>.
656     * </p>
657     * <p>
658     * If there is no more value after having removed the values, the attribute
659     * will be removed too.
660     * </p>
661     * <p>
662     * If the attribute does not exist, nothing is done and the method returns 
663     * <code>false</code>
664     * </p> 
665     *
666     * @param upId The attribute ID  
667     * @param values the attribute's values to be removed
668     * @return <code>true</code> if at least a value is removed, <code>false</code>
669     * if not all the values have been removed or if the attribute does not exist. 
670     * @throws LdapException If the removal failed 
671     */
672    boolean remove( String upId, byte[]... values ) throws LdapException;
673
674
675    /**
676     * <p>
677     * Removes the specified String values from an attribute.
678     * </p>
679     * <p>
680     * If at least one value is removed, this method returns <code>true</code>.
681     * </p>
682     * <p>
683     * If there is no more value after havong removed the values, the attribute
684     * will be removed too.
685     * </p>
686     * <p>
687     * If the attribute does not exist, nothing is done and the method returns 
688     * <code>false</code>
689     * </p> 
690     *
691     * @param upId The attribute ID  
692     * @param values the attribute's values to be removed
693     * @return <code>true</code> if at least a value is removed, <code>false</code>
694     * if no values have been removed or if the attribute does not exist.
695     * @throws LdapException If the removal failed 
696     */
697    boolean remove( String upId, String... values ) throws LdapException;
698
699
700    /**
701     * <p>
702     * Removes the specified values from an attribute.
703     * </p>
704     * <p>
705     * If at least one value is removed, this method returns <code>true</code>.
706     * </p>
707     * <p>
708     * If there is no more value after having removed the values, the attribute
709     * will be removed too.
710     * </p>
711     * <p>
712     * If the attribute does not exist, nothing is done and the method returns 
713     * <code>false</code>
714     * </p> 
715     *
716     * @param upId The attribute ID  
717     * @param values the attribute's values to be removed
718     * @return <code>true</code> if at least a value is removed, <code>false</code>
719     * if not all the values have been removed or if the attribute does not exist. 
720     * @throws LdapException if the attribute does not exists
721     */
722    boolean remove( String upId, Value<?>... values ) throws LdapException;
723
724
725    /**
726      * <p>
727      * Removes the attribute with the specified alias. 
728      * </p>
729      * <p>
730      * The removed attribute are returned by this method. 
731      * </p>
732      * <p>
733      * If there is no attribute with the specified alias,
734      * the return value is <code>null</code>.
735      * </p>
736      *
737      * @param attributes an aliased name of the attribute to be removed
738      */
739    void removeAttributes( String... attributes );
740
741
742    // -----------------------------------------------------------------------
743    // Container (contains/get/put/remove) Methods
744    // -----------------------------------------------------------------------
745    /**
746     * Checks if an entry contains an attribute with some given binary values.
747     *
748     * @param attributeType The Attribute we are looking for.
749     * @param values The searched binary values.
750     * @return <code>true</code> if all the values are found within the attribute,
751     * <code>false</code> otherwise, or if the attributes does not exist.
752     */
753    boolean contains( AttributeType attributeType, byte[]... values );
754
755
756    /**
757     * Checks if an entry contains an attribute with some given String values.
758     *
759     * @param attributeType The Attribute we are looking for.
760     * @param values The searched String values.
761     * @return <code>true</code> if all the values are found within the attribute,
762     * <code>false</code> otherwise, or if the attributes does not exist.
763     */
764    boolean contains( AttributeType attributeType, String... values );
765
766
767    /**
768     * Checks if an entry contains an attribute with some given binary values.
769     *
770     * @param attributeType The Attribute we are looking for.
771     * @param values The searched values.
772     * @return <code>true</code> if all the values are found within the attribute,
773     * <code>false</code> otherwise, or if the attributes does not exist.
774     */
775    boolean contains( AttributeType attributeType, Value<?>... values );
776
777
778    /**
779     * Checks if an entry contains a specific AttributeType.
780     *
781     * @param attributeType The AttributeType to look for.
782     * @return <code>true</code> if the attribute is found within the entry.
783     */
784    boolean containsAttribute( AttributeType attributeType );
785
786
787    /**
788     * <p>
789     * Checks if an entry contains a list of attributes.
790     * </p>
791     * <p>
792     * If the list is null or empty, this method will return <code>true</code>
793     * if the entry has no attribute, <code>false</code> otherwise.
794     * </p>
795     *
796     * @param attributes The Attributes to look for
797     * @return <code>true</code> if all the attributes are found within 
798     * the entry, <code>false</code> if at least one of them is not present.
799     */
800    boolean contains( Attribute... attributes );
801
802
803    /**
804     * Checks if an entry contains an attribute with some binary values.
805     *
806     * @param upId The Attribute we are looking for.
807     * @param values The searched values.
808     * @return <code>true</code> if all the values are found within the attribute,
809     * false if at least one value is not present or if the ID is not valid. 
810     */
811    boolean contains( String upId, byte[]... values );
812
813
814    /**
815     * Checks if an entry contains an attribute with some String values.
816     *
817     * @param upId The Attribute we are looking for.
818     * @param values The searched values.
819     * @return <code>true</code> if all the values are found within the attribute,
820     * false if at least one value is not present or if the ID is not valid. 
821     */
822    boolean contains( String upId, String... values );
823
824
825    /**
826     * Checks if an entry contains an attribute with some values.
827     *
828     * @param upId The Attribute we are looking for.
829     * @param values The searched values.
830     * @return <code>true</code> if all the values are found within the attribute,
831     * false if at least one value is not present or if the ID is not valid. 
832     */
833    boolean contains( String upId, Value<?>... values );
834
835
836    /**
837     * Checks if an entry contains some specific attributes.
838     *
839     * @param attributes The Attributes to look for.
840     * @return <code>true</code> if the attributes are all found within the entry.
841     */
842    boolean containsAttribute( String... attributes );
843
844
845    /**
846     * Returns the number of attributes.
847     *
848     * @return the number of attributes
849     */
850    int size();
851
852
853    /**
854     * Tells if the Entry is schema aware
855     * @return true if the Entry is schema aware
856     */
857    boolean isSchemaAware();
858
859
860    /**
861     * A pretty-pinter for Entries
862     * 
863     * @param tabs The tabs to add before any output
864     * @return The pretty-printed entry
865     */
866    String toString( String tabs );
867}