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    @Override
154    Iterator<Attribute> iterator();
155
156
157    /**
158     * Add some Attributes to the current Entry.
159     *
160     * @param attributes The attributes to add
161     * @return the modified entry
162     * @throws LdapException If we can't add any of the attributes
163     */
164    Entry add( Attribute... attributes ) throws LdapException;
165
166
167    /**
168     * <p>
169     * Add an attribute (represented by its AttributeType and some binary values) into an 
170     * entry.
171     * </p>
172     * <p> 
173     * If we already have an attribute with the same values, the duplicated values 
174     * are not added (duplicated values are not allowed)
175     * </p>
176     * <p>
177     * If the value cannot be added, or if the AttributeType is null or invalid, 
178     * a LdapException is thrown.
179     * </p>
180     *
181     * @param attributeType The attribute Type.
182     * @param values The list of binary values to inject. It can be empty.
183     * @return the modified entry
184     * @throws LdapException If the attribute does not exist
185     */
186    Entry add( AttributeType attributeType, byte[]... values ) throws LdapException;
187
188
189    /**
190     * <p>
191     * Add an attribute (represented by its AttributeType and some String values) into an 
192     * entry.
193     * </p>
194     * <p> 
195     * If we already have an attribute with the same values, the duplicated values 
196     * are not added (duplicated values are not allowed)
197     * </p>
198     * <p> 
199     * If the value cannot be added, or if the AttributeType is null or invalid, 
200     * a LdapException is thrown.
201     * </p>
202     * 
203     * @param attributeType The attribute Type
204     * @param values The list of binary values to inject. It can be empty
205     * @return the modified entry
206     * @throws org.apache.directory.api.ldap.model.exception.LdapException If the attribute does not exist
207     */
208    Entry add( AttributeType attributeType, String... values ) throws LdapException;
209
210
211    /**
212     * <p>
213     * Add an attribute (represented by its AttributeType and some values) into an 
214     * entry.
215     * </p>
216     * <p> 
217     * If we already have an attribute with the same values, the duplicated values 
218     * are not added (duplicated values are not allowed)
219     * </p>
220     * <p>
221     * If the value cannot be added, or if the AttributeType is null or invalid, 
222     * a LdapException is thrown.
223     * </p>
224     *
225     * @param attributeType The attribute Type
226     * @param values The list of binary values to inject. It can be empty
227     * @return the modified entry
228     * @throws LdapException If the attribute does not exist
229     */
230    Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException;
231
232
233    /**
234     * <p>
235     * Add an attribute (represented by its AttributeType and some binary values) into an 
236     * entry. Set the User Provider ID at the same time
237     * </p>
238     * <p> 
239     * If we already have an attribute with the same values, the duplicated values 
240     * are not added (duplicated values are not allowed)
241     * </p>
242     * <p>
243     * If the value cannot be added, or if the AttributeType is null or invalid, 
244     * a LdapException is thrown.
245     * </p>
246     *
247     * @param upId The user provided ID for the added AttributeType
248     * @param attributeType The attribute Type.
249     * @param values The list of binary values to add. It can be empty.
250     * @return the modified entry
251     * @throws LdapException If the attribute does not exist
252     */
253    Entry add( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
254
255
256    /**
257     * <p>
258     * Add an attribute (represented by its AttributeType and some String values) into an 
259     * entry. Set the User Provider ID at the same time
260     * </p>
261     * <p> 
262     * If we already have an attribute with the same values, the duplicated values 
263     * are not added (duplicated values are not allowed)
264     * </p>
265     * <p>
266     * If the value cannot be added, or if the AttributeType is null or invalid, 
267     * a LdapException is thrown.
268     * </p>
269     *
270     * @param upId The user provided ID for the added AttributeType
271     * @param attributeType The attribute Type.
272     * @param values The list of String values to add. It can be empty.
273     * @return the modified entry
274     * @throws LdapException If the attribute does not exist
275     */
276    Entry add( String upId, AttributeType attributeType, String... values ) throws LdapException;
277
278
279    /**
280     * <p>
281     * Add an attribute (represented by its AttributeType and some values) into an 
282     * entry. Set the User Provider ID at the same time
283     * </p>
284     * <p> 
285     * If we already have an attribute with the same values, nothing is done 
286     * (duplicated values are not allowed)
287     * </p>
288     * <p>
289     * If the value cannot be added, or if the AttributeType is null or invalid, 
290     * a LdapException is thrown.
291     * </p>
292     *
293     * @param upId The user provided ID for the added AttributeType
294     * @param attributeType The attribute Type.
295     * @param values The list of values to add. It can be empty.
296     * @return the modified entry
297     * @throws LdapException If the attribute does not exist
298     */
299    Entry add( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException;
300
301
302    /**
303     * Add some String values to the current Entry.
304     *
305     * @param upId The user provided ID of the attribute we want to add 
306     * some values to
307     * @param values The list of String values to add
308     * @return the modified entry
309     * @throws LdapException If we can't add any of the values
310     */
311    Entry add( String upId, String... values ) throws LdapException;
312
313
314    /**
315     * Add some binary values to the current Entry.
316     *
317     * @param upId The user provided ID of the attribute we want to add 
318     * some values to
319     * @param values The list of binary values to add
320     * @return the modified entry
321     * @throws LdapException If we can't add any of the values
322     */
323    Entry add( String upId, byte[]... values ) throws LdapException;
324
325
326    /**
327     * Add some Values to the current Entry.
328     *
329     * @param upId The user provided ID of the attribute we want to add 
330     * some values to
331     * @param values The list of Values to add
332     * @return the modified entry
333     * @throws LdapException If we can't add any of the values
334     */
335    Entry add( String upId, Value<?>... values ) throws LdapException;
336
337
338    /**
339     * <p>
340     * Places attributes in the attribute collection. 
341     * </p>
342     * <p>If there is already an attribute with the same ID as any of the 
343     * new attributes, the old ones are removed from the collection and 
344     * are returned by this method. If there was no attribute with the 
345     * same ID the return value is <code>null</code>.
346     *</p>
347     *
348     * @param attributes the attributes to be put
349     * @return the old attributes with the same OID, if exist; otherwise <code>null</code>
350     * @exception LdapException if the operation fails
351     */
352    List<Attribute> put( Attribute... attributes ) throws LdapException;
353
354
355    /**
356     * <p>
357     * Places a new attribute with the supplied AttributeType and binary values 
358     * into the attribute collection. 
359     * </p>
360     * <p>
361     * If there is already an attribute with the same AttributeType, the old
362     * one is removed from the collection and is returned by this method. 
363     * </p>
364     * <p>
365     * This method provides a mechanism to put an attribute with a
366     * <code>null</code> value: the value may be <code>null</code>.
367     *
368     * @param attributeType the type of the new attribute to be put
369     * @param values the binary values of the new attribute to be put
370     * @return the old attribute with the same identifier, if exists; otherwise
371     * <code>null</code>
372     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures
373     */
374    Attribute put( AttributeType attributeType, byte[]... values ) throws LdapException;
375
376
377    /**
378     * <p>
379     * Places a new attribute with the supplied AttributeType and String values 
380     * into the attribute collection. 
381     * </p>
382     * <p>
383     * If there is already an attribute with the same AttributeType, the old
384     * one is removed from the collection and is returned by this method. 
385     * </p>
386     * <p>
387     * This method provides a mechanism to put an attribute with a
388     * <code>null</code> value: the value may be <code>null</code>.
389     *
390     * @param attributeType the type of the new attribute to be put
391     * @param values the String values of the new attribute to be put
392     * @return the old attribute with the same identifier, if exists; otherwise
393     * <code>null</code>
394     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures
395     */
396    Attribute put( AttributeType attributeType, String... values ) throws LdapException;
397
398
399    /**
400     * <p>
401     * Places a new attribute with the supplied AttributeType and some values 
402     * into the attribute collection. 
403     * </p>
404     * <p>
405     * If there is already an attribute with the same AttributeType, the old
406     * one is removed from the collection and is returned by this method. 
407     * </p>
408     * <p>
409     * This method provides a mechanism to put an attribute with a
410     * <code>null</code> value: the value may be <code>null</code>.
411     *
412     * @param attributeType the type of the new attribute to be put
413     * @param values the values of the new attribute to be put
414     * @return the old attribute with the same identifier, if exists; otherwise
415     * <code>null</code>
416     * @throws LdapException if there are failures
417     */
418    Attribute put( AttributeType attributeType, Value<?>... values ) throws LdapException;
419
420
421    /**
422     * <p>
423     * Places a new attribute with the supplied AttributeType and some binary values 
424     * into the attribute collection. 
425     * </p>
426     * <p>
427     * The given User provided ID will be used for this new AttributeEntry.
428     * </p>
429     * <p>
430     * If there is already an attribute with the same AttributeType, the old
431     * one is removed from the collection and is returned by this method. 
432     * </p>
433     * <p>
434     * This method provides a mechanism to put an attribute with a
435     * <code>null</code> value: the value may be <code>null</code>.
436     *
437     * @param upId The User Provided ID to be stored into the AttributeEntry
438     * @param attributeType the type of the new attribute to be put
439     * @param values the binary values of the new attribute to be put
440     * @return the old attribute with the same identifier, if exists; otherwise
441     * <code>null</code>
442     * @throws LdapException if there are failures.
443     */
444    Attribute put( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
445
446
447    /**
448     * <p>
449     * Places a new attribute with the supplied AttributeType and some String values 
450     * into the attribute collection. 
451     * </p>
452     * <p>
453     * The given User provided ID will be used for this new AttributeEntry.
454     * </p>
455     * <p>
456     * If there is already an attribute with the same AttributeType, the old
457     * one is removed from the collection and is returned by this method. 
458     * </p>
459     * <p>
460     * This method provides a mechanism to put an attribute with a
461     * <code>null</code> value: the value may be <code>null</code>.
462     *
463     * @param upId The User Provided ID to be stored into the AttributeEntry
464     * @param attributeType the type of the new attribute to be put
465     * @param values the String values of the new attribute to be put
466     * @return the old attribute with the same identifier, if exists; otherwise
467     * <code>null</code>
468     * @throws org.apache.directory.api.ldap.model.exception.LdapException if there are failures.
469     */
470    Attribute put( String upId, AttributeType attributeType, String... values ) throws LdapException;
471
472
473    /**
474     * <p>
475     * Places a new attribute with the supplied AttributeType and some values 
476     * into the attribute collection. 
477     * </p>
478     * <p>
479     * The given User provided ID will be used for this new AttributeEntry.
480     * </p>
481     * <p>
482     * If there is already an attribute with the same AttributeType, the old
483     * one is removed from the collection and is returned by this method. 
484     * </p>
485     * <p>
486     * This method provides a mechanism to put an attribute with a
487     * <code>null</code> value: the value may be <code>null</code>.
488     *
489     * @param upId The User Provided ID to be stored into the AttributeEntry
490     * @param attributeType the type of the new attribute to be put
491     * @param values the values of the new attribute to be put
492     * @return the old attribute with the same identifier, if exists; otherwise
493     * <code>null</code>
494     * @throws LdapException if there are failures.
495     */
496    Attribute put( String upId, AttributeType attributeType, Value<?>... values ) throws LdapException;
497
498
499    /**
500     * <p>
501     * Put an attribute (represented by its ID and some binary values) into an entry. 
502     * </p>
503     * <p> 
504     * If the attribute already exists, the previous attribute will be 
505     * replaced and returned.
506     * </p>
507     *
508     * @param upId The attribute ID
509     * @param values The list of binary values to put. It can be empty.
510     * @return The replaced attribute
511     */
512    Attribute put( String upId, byte[]... values );
513
514
515    /**
516     * <p>
517     * Put an attribute (represented by its ID and some String values) into an entry. 
518     * </p>
519     * <p> 
520     * If the attribute already exists, the previous attribute will be 
521     * replaced and returned.
522     * </p>
523     *
524     * @param upId The attribute ID
525     * @param values The list of String values to put. It can be empty.
526     * @return The replaced attribute
527     */
528    Attribute put( String upId, String... values );
529
530
531    /**
532     * <p>
533     * Put an attribute (represented by its ID and some values) into an entry. 
534     * </p>
535     * <p> 
536     * If the attribute already exists, the previous attribute will be 
537     * replaced and returned.
538     * </p>
539     *
540     * @param upId The attribute ID
541     * @param values The list of values to put. It can be empty.
542     * @return The replaced attribute
543     */
544    Attribute put( String upId, Value<?>... values );
545
546
547    /**
548     * <p>
549     * Removes the specified binary values from an attribute.
550     * </p>
551     * <p>
552     * If at least one value is removed, this method returns <code>true</code>.
553     * </p>
554     * <p>
555     * If there is no more value after having removed the values, the attribute
556     * will be removed too.
557     * </p>
558     * <p>
559     * If the attribute does not exist, nothing is done and the method returns 
560     * <code>false</code>
561     * </p> 
562     *
563     * @param attributeType The attribute type  
564     * @param values the values to be removed
565     * @return <code>true</code> if at least a value is removed, <code>false</code>
566     * if not all the values have been removed or if the attribute does not exist. 
567     * @throws LdapException If the removal failed 
568     */
569    boolean remove( AttributeType attributeType, byte[]... values ) throws LdapException;
570
571
572    /**
573     * <p>
574     * Removes the specified String values from an attribute.
575     * </p>
576     * <p>
577     * If at least one value is removed, this method returns <code>true</code>.
578     * </p>
579     * <p>
580     * If there is no more value after having removed the values, the attribute
581     * will be removed too.
582     * </p>
583     * <p>
584     * If the attribute does not exist, nothing is done and the method returns 
585     * <code>false</code>
586     * </p> 
587     *
588     * @param attributeType The attribute type  
589     * @param values the values to be removed
590     * @return <code>true</code> if at least a value is removed, <code>false</code>
591     * if not all the values have been removed or if the attribute does not exist. 
592     * @throws LdapException If the removal failed 
593     */
594    boolean remove( AttributeType attributeType, String... values ) throws LdapException;
595
596
597    /**
598     * <p>
599     * Removes the specified values from an attribute.
600     * </p>
601     * <p>
602     * If at least one value is removed, this method returns <code>true</code>.
603     * </p>
604     * <p>
605     * If there is no more value after having removed the values, the attribute
606     * will be removed too.
607     * </p>
608     * <p>
609     * If the attribute does not exist, nothing is done and the method returns 
610     * <code>false</code>
611     * </p> 
612     *
613     * @param attributeType The attribute type  
614     * @param values the values to be removed
615     * @return <code>true</code> if at least a value is removed, <code>false</code>
616     * if not all the values have been removed or if the attribute does not exist. 
617     * @throws LdapException If the removal failed 
618     */
619    boolean remove( AttributeType attributeType, Value<?>... values ) throws LdapException;
620
621
622    /**
623     * Removes the specified attributes. The removed attributes are
624     * returned by this method. If there were no attribute the return value
625     * is <code>null</code>.
626     *
627     * @param attributes the attributes to be removed
628     * @return the removed attribute, if exists; otherwise <code>null</code>
629     * @throws LdapException If the removal failed 
630     */
631    List<Attribute> remove( Attribute... attributes ) throws LdapException;
632
633
634    /**
635     * <p>
636     * Removes the attribute with the specified AttributeTypes. 
637     * </p>
638     * <p>
639     * The removed attribute are returned by this method. 
640     * </p>
641     * <p>
642     * If there is no attribute with the specified AttributeTypes,
643     * the return value is <code>null</code>.
644     * </p>
645     *
646     * @param attributes the AttributeTypes to be removed
647     */
648    void removeAttributes( AttributeType... attributes );
649
650
651    /**
652     * <p>
653     * Removes the specified binary values from an attribute.
654     * </p>
655     * <p>
656     * If at least one value is removed, this method returns <code>true</code>.
657     * </p>
658     * <p>
659     * If there is no more value after having removed the values, the attribute
660     * will be removed too.
661     * </p>
662     * <p>
663     * If the attribute does not exist, nothing is done and the method returns 
664     * <code>false</code>
665     * </p> 
666     *
667     * @param upId The attribute ID  
668     * @param values the attribute's values to be removed
669     * @return <code>true</code> if at least a value is removed, <code>false</code>
670     * if not all the values have been removed or if the attribute does not exist. 
671     * @throws LdapException If the removal failed 
672     */
673    boolean remove( String upId, byte[]... values ) throws LdapException;
674
675
676    /**
677     * <p>
678     * Removes the specified String values from an attribute.
679     * </p>
680     * <p>
681     * If at least one value is removed, this method returns <code>true</code>.
682     * </p>
683     * <p>
684     * If there is no more value after havong removed the values, the attribute
685     * will be removed too.
686     * </p>
687     * <p>
688     * If the attribute does not exist, nothing is done and the method returns 
689     * <code>false</code>
690     * </p> 
691     *
692     * @param upId The attribute ID  
693     * @param values the attribute's values to be removed
694     * @return <code>true</code> if at least a value is removed, <code>false</code>
695     * if no values have been removed or if the attribute does not exist.
696     * @throws LdapException If the removal failed 
697     */
698    boolean remove( String upId, String... values ) throws LdapException;
699
700
701    /**
702     * <p>
703     * Removes the specified values from an attribute.
704     * </p>
705     * <p>
706     * If at least one value is removed, this method returns <code>true</code>.
707     * </p>
708     * <p>
709     * If there is no more value after having removed the values, the attribute
710     * will be removed too.
711     * </p>
712     * <p>
713     * If the attribute does not exist, nothing is done and the method returns 
714     * <code>false</code>
715     * </p> 
716     *
717     * @param upId The attribute ID  
718     * @param values the attribute's values to be removed
719     * @return <code>true</code> if at least a value is removed, <code>false</code>
720     * if not all the values have been removed or if the attribute does not exist. 
721     * @throws LdapException if the attribute does not exists
722     */
723    boolean remove( String upId, Value<?>... values ) throws LdapException;
724
725
726    /**
727      * <p>
728      * Removes the attribute with the specified alias. 
729      * </p>
730      * <p>
731      * The removed attribute are returned by this method. 
732      * </p>
733      * <p>
734      * If there is no attribute with the specified alias,
735      * the return value is <code>null</code>.
736      * </p>
737      *
738      * @param attributes an aliased name of the attribute to be removed
739      */
740    void removeAttributes( String... attributes );
741
742
743    // -----------------------------------------------------------------------
744    // Container (contains/get/put/remove) Methods
745    // -----------------------------------------------------------------------
746    /**
747     * Checks if an entry contains an attribute with some given binary values.
748     *
749     * @param attributeType The Attribute we are looking for.
750     * @param values The searched binary values.
751     * @return <code>true</code> if all the values are found within the attribute,
752     * <code>false</code> otherwise, or if the attributes does not exist.
753     */
754    boolean contains( AttributeType attributeType, byte[]... values );
755
756
757    /**
758     * Checks if an entry contains an attribute with some given String values.
759     *
760     * @param attributeType The Attribute we are looking for.
761     * @param values The searched String values.
762     * @return <code>true</code> if all the values are found within the attribute,
763     * <code>false</code> otherwise, or if the attributes does not exist.
764     */
765    boolean contains( AttributeType attributeType, String... values );
766
767
768    /**
769     * Checks if an entry contains an attribute with some given binary values.
770     *
771     * @param attributeType The Attribute we are looking for.
772     * @param values The searched values.
773     * @return <code>true</code> if all the values are found within the attribute,
774     * <code>false</code> otherwise, or if the attributes does not exist.
775     */
776    boolean contains( AttributeType attributeType, Value<?>... values );
777
778
779    /**
780     * Checks if an entry contains a specific AttributeType.
781     *
782     * @param attributeType The AttributeType to look for.
783     * @return <code>true</code> if the attribute is found within the entry.
784     */
785    boolean containsAttribute( AttributeType attributeType );
786
787
788    /**
789     * <p>
790     * Checks if an entry contains a list of attributes.
791     * </p>
792     * <p>
793     * If the list is null or empty, this method will return <code>true</code>
794     * if the entry has no attribute, <code>false</code> otherwise.
795     * </p>
796     *
797     * @param attributes The Attributes to look for
798     * @return <code>true</code> if all the attributes are found within 
799     * the entry, <code>false</code> if at least one of them is not present.
800     */
801    boolean contains( Attribute... attributes );
802
803
804    /**
805     * Checks if an entry contains an attribute with some binary values.
806     *
807     * @param upId The Attribute we are looking for.
808     * @param values The searched values.
809     * @return <code>true</code> if all the values are found within the attribute,
810     * false if at least one value is not present or if the ID is not valid. 
811     */
812    boolean contains( String upId, byte[]... values );
813
814
815    /**
816     * Checks if an entry contains an attribute with some String values.
817     *
818     * @param upId The Attribute we are looking for.
819     * @param values The searched values.
820     * @return <code>true</code> if all the values are found within the attribute,
821     * false if at least one value is not present or if the ID is not valid. 
822     */
823    boolean contains( String upId, String... values );
824
825
826    /**
827     * Checks if an entry contains an attribute with some values.
828     *
829     * @param upId The Attribute we are looking for.
830     * @param values The searched values.
831     * @return <code>true</code> if all the values are found within the attribute,
832     * false if at least one value is not present or if the ID is not valid. 
833     */
834    boolean contains( String upId, Value<?>... values );
835
836
837    /**
838     * Checks if an entry contains some specific attributes.
839     *
840     * @param attributes The Attributes to look for.
841     * @return <code>true</code> if the attributes are all found within the entry.
842     */
843    boolean containsAttribute( String... attributes );
844
845
846    /**
847     * Returns the number of attributes.
848     *
849     * @return the number of attributes
850     */
851    int size();
852
853
854    /**
855     * Tells if the Entry is schema aware
856     * @return true if the Entry is schema aware
857     */
858    boolean isSchemaAware();
859
860
861    /**
862     * A pretty-pinter for Entries
863     * 
864     * @param tabs The tabs to add before any output
865     * @return The pretty-printed entry
866     */
867    String toString( String tabs );
868}