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