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