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