001/* 002 * The MIT License 003 * Copyright (c) 2012 Microsoft Corporation 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a copy 006 * of this software and associated documentation files (the "Software"), to deal 007 * in the Software without restriction, including without limitation the rights 008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 009 * copies of the Software, and to permit persons to whom the Software is 010 * furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 021 * THE SOFTWARE. 022 */ 023 024package microsoft.exchange.webservices.data.property.complex; 025 026import microsoft.exchange.webservices.data.core.EwsServiceXmlReader; 027import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter; 028import microsoft.exchange.webservices.data.core.EwsUtilities; 029import microsoft.exchange.webservices.data.core.XmlElementNames; 030import microsoft.exchange.webservices.data.core.enumeration.misc.FlaggedForAction; 031import microsoft.exchange.webservices.data.core.enumeration.property.Importance; 032import microsoft.exchange.webservices.data.core.enumeration.property.Sensitivity; 033import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace; 034 035/** 036 * Represents the set of conditions and exception available for a rule. 037 */ 038public final class RulePredicates extends ComplexProperty { 039 040 /** 041 * The HasCategories predicate. 042 */ 043 private StringList categories; 044 045 /** 046 * The ContainsBodyStrings predicate. 047 */ 048 private StringList containsBodyStrings; 049 /** 050 * The ContainsHeaderStrings predicate. 051 */ 052 private StringList containsHeaderStrings; 053 054 /** 055 * The ContainsRecipientStrings predicate. 056 */ 057 private StringList containsRecipientStrings; 058 059 /** 060 * The ContainsSenderStrings predicate. 061 */ 062 private StringList containsSenderStrings; 063 064 /** 065 * The ContainsSubjectOrBodyStrings predicate. 066 */ 067 private StringList containsSubjectOrBodyStrings; 068 069 /** 070 * The ContainsSubjectStrings predicate. 071 */ 072 private StringList containsSubjectStrings; 073 074 /** 075 * The FlaggedForAction predicate. 076 */ 077 private FlaggedForAction flaggedForAction; 078 079 /** 080 * The FromAddresses predicate. 081 */ 082 private EmailAddressCollection fromAddresses; 083 084 /** 085 * The FromConnectedAccounts predicate. 086 */ 087 private StringList fromConnectedAccounts; 088 089 /** 090 * The HasAttachments predicate. 091 */ 092 private boolean hasAttachments; 093 094 /** 095 * The Importance predicate. 096 */ 097 private Importance importance; 098 099 /** 100 * The IsApprovalRequest predicate. 101 */ 102 private boolean isApprovalRequest; 103 104 /** 105 * The IsAutomaticForward predicate. 106 */ 107 private boolean isAutomaticForward; 108 109 /** 110 * The IsAutomaticReply predicate. 111 */ 112 private boolean isAutomaticReply; 113 114 /** 115 * The IsEncrypted predicate. 116 */ 117 private boolean isEncrypted; 118 119 /** 120 * The IsMeetingRequest predicate. 121 */ 122 private boolean isMeetingRequest; 123 124 /** 125 * The IsMeetingResponse predicate. 126 */ 127 private boolean isMeetingResponse; 128 129 /** 130 * The IsNDR predicate. 131 */ 132 private boolean isNonDeliveryReport; 133 134 /** 135 * The IsPermissionControlled predicate. 136 */ 137 private boolean isPermissionControlled; 138 139 /** 140 * The IsSigned predicate. 141 */ 142 private boolean isSigned; 143 144 /** 145 * The IsVoicemail predicate. 146 */ 147 private boolean isVoicemail; 148 149 /** 150 * The IsReadReceipt predicate. 151 */ 152 private boolean isReadReceipt; 153 154 /** 155 * ItemClasses predicate. 156 */ 157 private StringList itemClasses; 158 159 /** 160 * The MessageClassifications predicate. 161 */ 162 private StringList messageClassifications; 163 164 /** 165 * The NotSentToMe predicate. 166 */ 167 private boolean notSentToMe; 168 169 /** 170 * SentCcMe predicate. 171 */ 172 private boolean sentCcMe; 173 174 /** 175 * The SentOnlyToMe predicate. 176 */ 177 private boolean sentOnlyToMe; 178 179 /** 180 * The SentToAddresses predicate. 181 */ 182 private EmailAddressCollection sentToAddresses; 183 184 /** 185 * The SentToMe predicate. 186 */ 187 private boolean sentToMe; 188 189 /** 190 * The SentToOrCcMe predicate. 191 */ 192 private boolean sentToOrCcMe; 193 194 /** 195 * The Sensitivity predicate. 196 */ 197 private Sensitivity sensitivity; 198 199 /** 200 * The Sensitivity predicate. 201 */ 202 private RulePredicateDateRange withinDateRange; 203 204 /** 205 * The Sensitivity predicate. 206 */ 207 private RulePredicateSizeRange withinSizeRange; 208 209 /** 210 * Initializes a new instance of the RulePredicates class. 211 */ 212 protected RulePredicates() { 213 super(); 214 this.categories = new StringList(); 215 this.containsBodyStrings = new StringList(); 216 this.containsHeaderStrings = new StringList(); 217 this.containsRecipientStrings = new StringList(); 218 this.containsSenderStrings = new StringList(); 219 this.containsSubjectOrBodyStrings = new StringList(); 220 this.containsSubjectStrings = new StringList(); 221 this.fromAddresses = 222 new EmailAddressCollection(XmlElementNames.Address); 223 this.fromConnectedAccounts = new StringList(); 224 this.itemClasses = new StringList(); 225 this.messageClassifications = new StringList(); 226 this.sentToAddresses = 227 new EmailAddressCollection(XmlElementNames.Address); 228 this.withinDateRange = new RulePredicateDateRange(); 229 this.withinSizeRange = new RulePredicateSizeRange(); 230 } 231 232 /** 233 * Gets the categories that an incoming message 234 * should be stamped with for the condition or exception to apply. 235 * To disable this predicate, empty the list. 236 */ 237 public StringList getCategories() { 238 return this.categories; 239 } 240 241 /** 242 * Gets the strings that should appear in the body of 243 * incoming messages for the condition or exception to apply. 244 * To disable this predicate, empty the list. 245 */ 246 public StringList getContainsBodyStrings() { 247 return this.containsBodyStrings; 248 } 249 250 /** 251 * Gets the strings that should appear in the 252 * headers of incoming messages for the condition or 253 * exception to apply. To disable this predicate, empty the list. 254 */ 255 public StringList getContainsHeaderStrings() { 256 return this.containsHeaderStrings; 257 } 258 259 /** 260 * Gets the strings that should appear in either the 261 * To or Cc fields of incoming messages for the condition 262 * or exception to apply. To disable this predicate, empty the list. 263 */ 264 public StringList getContainsRecipientStrings() { 265 return this.containsRecipientStrings; 266 } 267 268 /** 269 * Gets the strings that should appear 270 * in the From field of incoming messages 271 * for the condition or exception to apply. 272 * To disable this predicate, empty the list. 273 */ 274 public StringList getContainsSenderStrings() { 275 return this.containsSenderStrings; 276 } 277 278 /** 279 * Gets the strings that should appear in either 280 * the body or the subject of incoming messages for the 281 * condition or exception to apply. 282 * To disable this predicate, empty the list. 283 */ 284 public StringList getContainsSubjectOrBodyStrings() { 285 return this.containsSubjectOrBodyStrings; 286 } 287 288 /** 289 * Gets the strings that should appear in the subject 290 * of incoming messages for the condition or exception 291 * to apply. To disable this predicate, empty the list. 292 */ 293 public StringList getContainsSubjectStrings() { 294 return this.containsSubjectStrings; 295 } 296 297 /** 298 * Gets or sets the flag for action value that should 299 * appear on incoming messages for the condition or execption to apply. 300 * To disable this predicate, set it to null. 301 */ 302 public FlaggedForAction getFlaggedForAction() { 303 304 return this.flaggedForAction; 305 } 306 307 public void setFlaggedForAction(FlaggedForAction value) { 308 if (this.canSetFieldValue(this.flaggedForAction, value)) { 309 this.flaggedForAction = value; 310 this.changed(); 311 } 312 } 313 314 /** 315 * Gets the e-mail addresses of the senders of incoming 316 * messages for the condition or exception to apply. 317 * To disable this predicate, empty the list. 318 */ 319 public EmailAddressCollection getFromAddresses() { 320 return this.fromAddresses; 321 } 322 323 /** 324 * Gets or sets a value indicating whether incoming messages must have 325 * attachments for the condition or exception to apply. 326 */ 327 public boolean getHasAttachments() { 328 return this.hasAttachments; 329 } 330 331 public void setHasAttachments(boolean value) { 332 if (this.canSetFieldValue(this.hasAttachments, value)) { 333 this.hasAttachments = value; 334 this.changed(); 335 } 336 } 337 338 /** 339 * Gets or sets the importance that should be stamped on incoming messages 340 * for the condition or exception to apply. 341 * To disable this predicate, set it to null. 342 */ 343 public Importance getImportance() { 344 return this.importance; 345 } 346 347 public void setImportance(Importance value) { 348 if (this.canSetFieldValue(this.importance, value)) { 349 this.importance = value; 350 this.changed(); 351 } 352 } 353 354 /** 355 * Gets or sets a value indicating whether incoming messages must be 356 * approval request for the condition or exception to apply. 357 */ 358 public boolean getIsApprovalRequest() { 359 return this.isApprovalRequest; 360 } 361 362 public void setIsApprovalRequest(boolean value) { 363 if (this.canSetFieldValue(this.isApprovalRequest, value)) { 364 365 this.isApprovalRequest = value; 366 this.changed(); 367 } 368 } 369 370 /** 371 * Gets or sets a value indicating whether incoming messages must be 372 * automatic forwards for the condition or exception to apply. 373 */ 374 public boolean getIsAutomaticForward() { 375 return this.isAutomaticForward; 376 } 377 378 public void setIsAutomaticForward(boolean value) { 379 if (this.canSetFieldValue(this.isAutomaticForward, value)) { 380 this.isAutomaticForward = value; 381 this.changed(); 382 } 383 } 384 385 /** 386 * Gets or sets a value indicating whether incoming messages must be 387 * automatic replies for the condition or exception to apply. 388 */ 389 public boolean getIsAutomaticReply() { 390 return this.isAutomaticReply; 391 } 392 393 public void setIsAutomaticReply(boolean value) { 394 if (this.canSetFieldValue(this.isAutomaticReply, value)) { 395 this.isAutomaticReply = value; 396 this.changed(); 397 } 398 } 399 400 401 /** 402 * Gets or sets a value indicating whether incoming messages must be 403 * S/MIME encrypted for the condition or exception to apply. 404 */ 405 public boolean getIsEncrypted() { 406 return this.isEncrypted; 407 } 408 409 public void setIsEncrypted(boolean value) { 410 if (this.canSetFieldValue(this.isEncrypted, value)) { 411 this.isEncrypted = value; 412 this.changed(); 413 } 414 } 415 416 /** 417 * Gets or sets a value indicating whether incoming messages must be 418 * meeting request for the condition or exception to apply. 419 */ 420 public boolean getIsMeetingRequest() { 421 return this.isMeetingRequest; 422 } 423 424 public void setIsMeetingRequest(boolean value) { 425 if (this.canSetFieldValue(this.isEncrypted, value)) { 426 427 this.isEncrypted = value; 428 this.changed(); 429 } 430 431 } 432 433 434 /** 435 * Gets or sets a value indicating whether incoming messages must be 436 * meeting response for the condition or exception to apply. 437 */ 438 public boolean getIsMeetingResponse() { 439 440 return this.isMeetingResponse; 441 } 442 443 public void setIsMeetingResponse(boolean value) { 444 if (this.canSetFieldValue(this.isMeetingResponse, value)) { 445 this.isMeetingResponse = value; 446 this.changed(); 447 } 448 } 449 450 /** 451 * Gets or sets a value indicating whether incoming messages must be 452 * non-delivery reports (NDR) for the condition or exception to apply. 453 */ 454 public boolean getIsNonDeliveryReport() { 455 return this.isNonDeliveryReport; 456 } 457 458 public void setIsNonDeliveryReport(boolean value) { 459 if (this.canSetFieldValue(this.isNonDeliveryReport, value)) { 460 this.isNonDeliveryReport = value; 461 this.changed(); 462 } 463 } 464 465 /** 466 * Gets or sets a value indicating whether incoming messages must be 467 * permission controlled (RMS protected) for the condition or exception 468 * to apply. 469 */ 470 public boolean getIsPermissionControlled() { 471 return this.isPermissionControlled; 472 } 473 474 public void setIsPermissionControlled(boolean value) { 475 if (this.canSetFieldValue(this.isPermissionControlled, value)) { 476 this.isPermissionControlled = value; 477 this.changed(); 478 } 479 } 480 481 482 /** 483 * Gets or sets a value indicating whether incoming messages must be 484 * S/MIME signed for the condition or exception to apply. 485 */ 486 public boolean getIsSigned() { 487 return this.isSigned; 488 } 489 490 public void setIsSigned(boolean value) { 491 if (this.canSetFieldValue(this.isSigned, value)) { 492 this.isSigned = value; 493 this.changed(); 494 } 495 } 496 497 498 /** 499 * Gets or sets a value indicating whether incoming messages must be 500 * voice mails for the condition or exception to apply. 501 */ 502 public boolean getIsVoicemail() { 503 return this.isVoicemail; 504 } 505 506 public void setIsVoicemail(boolean value) { 507 if (this.canSetFieldValue(this.isVoicemail, value)) { 508 this.isVoicemail = value; 509 this.changed(); 510 } 511 } 512 513 514 /** 515 * Gets or sets a value indicating whether incoming messages must be 516 * read receipts for the condition or exception to apply. 517 */ 518 public boolean getIsReadReceipt() { 519 return this.isReadReceipt; 520 } 521 522 public void setIsReadReceipt(boolean value) { 523 if (this.canSetFieldValue(this.isReadReceipt, value)) { 524 this.isReadReceipt = value; 525 this.changed(); 526 } 527 } 528 529 /** 530 * Gets the e-mail account names from which incoming messages must have 531 * been aggregated for the condition or exception to apply. To disable 532 * this predicate, empty the list. 533 */ 534 public StringList getFromConnectedAccounts() { 535 return this.fromConnectedAccounts; 536 } 537 538 /** 539 * Gets the item classes that must be stamped on incoming messages for 540 * the condition or exception to apply. To disable this predicate, 541 * empty the list. 542 */ 543 public StringList getItemClasses() { 544 return this.itemClasses; 545 } 546 547 /** 548 * Gets the message classifications that 549 * must be stamped on incoming messages 550 * for the condition or exception to apply. To disable this predicate, 551 * empty the list. 552 */ 553 public StringList getMessageClassifications() { 554 555 return this.messageClassifications; 556 557 } 558 559 /** 560 * Gets or sets a value indicating whether the owner of the mailbox must 561 * NOT be a To recipient of the incoming messages for the condition or 562 * exception to apply. 563 */ 564 565 public boolean getNotSentToMe() { 566 return this.notSentToMe; 567 } 568 569 public void setNotSentToMe(boolean value) { 570 if (this.canSetFieldValue(this.notSentToMe, value)) { 571 this.notSentToMe = value; 572 this.changed(); 573 } 574 } 575 576 577 /** 578 * Gets or sets a value indicating whether the owner of the mailbox must be 579 * a Cc recipient of incoming messages 580 * for the condition or exception to apply. 581 */ 582 public boolean getSentCcMe() { 583 return this.sentCcMe; 584 } 585 586 public void setSentCcMe(boolean value) { 587 if (this.canSetFieldValue(this.sentCcMe, value)) { 588 this.sentCcMe = value; 589 this.changed(); 590 } 591 } 592 593 594 /** 595 * Gets or sets a value indicating whether the owner of the mailbox must be 596 * the only To recipient of incoming 597 * messages for the condition or exception 598 * to apply. 599 */ 600 public boolean getSentOnlyToMe() { 601 return this.sentOnlyToMe; 602 } 603 604 public void setSentOnlyToMe(boolean value) { 605 if (this.canSetFieldValue(this.sentOnlyToMe, value)) { 606 this.sentOnlyToMe = value; 607 this.changed(); 608 } 609 } 610 611 612 /** 613 * Gets the e-mail addresses incoming messages must have been sent to for 614 * the condition or exception to apply. To disable this predicate, empty 615 * the list. 616 */ 617 public EmailAddressCollection getSentToAddresses() { 618 return this.sentToAddresses; 619 620 } 621 622 /** 623 * Gets or sets a value indicating whether the owner of the mailbox must be 624 * a To recipient of incoming messages 625 * for the condition or exception to apply. 626 */ 627 public boolean getSentToMe() { 628 return this.sentToMe; 629 } 630 631 public void setSentToMe(boolean value) { 632 if (this.canSetFieldValue(this.sentToMe, value)) { 633 this.sentToMe = value; 634 this.changed(); 635 } 636 } 637 638 639 /** 640 * Gets or sets a value indicating whether the owner of the mailbox must be 641 * either a To or Cc recipient of incoming messages for the condition or 642 * exception to apply. 643 */ 644 public boolean getSentToOrCcMe() { 645 return this.sentToOrCcMe; 646 } 647 648 public void setSentToOrCcMe(boolean value) { 649 if (this.canSetFieldValue(this.sentToOrCcMe, value)) { 650 this.sentToOrCcMe = value; 651 this.changed(); 652 } 653 } 654 655 656 /** 657 * Gets or sets the sensitivity that must be stamped on incoming messages 658 * for the condition or exception to apply. 659 * To disable this predicate, set it 660 * to null. 661 */ 662 public Sensitivity getSensitivity() { 663 return this.sensitivity; 664 } 665 666 public void setSensitivity(Sensitivity value) { 667 if (this.canSetFieldValue(this.sensitivity, value)) { 668 this.sensitivity = value; 669 this.changed(); 670 } 671 } 672 673 /** 674 * Gets the date range within which 675 * incoming messages must have been received 676 * for the condition or exception to apply. 677 * To disable this predicate, set both 678 * its Start and End property to null. 679 */ 680 public RulePredicateDateRange getWithinDateRange() { 681 return this.withinDateRange; 682 683 } 684 685 /** 686 * Gets the minimum and maximum sizes incoming messages must have for the 687 * condition or exception to apply. To disable this predicate, set both its 688 * MinimumSize and MaximumSize property to null. 689 */ 690 public RulePredicateSizeRange getWithinSizeRange() { 691 return this.withinSizeRange; 692 693 } 694 695 /** 696 * Tries to read element from XML. 697 * 698 * @param reader The reader 699 * @return True if element was read. 700 * @throws Exception 701 */ 702 @Override 703 public boolean tryReadElementFromXml(EwsServiceXmlReader 704 reader) throws Exception { 705 706 if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Categories)) { 707 this.categories.loadFromXml(reader, reader.getLocalName()); 708 return true; 709 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsBodyStrings)) { 710 this.containsBodyStrings.loadFromXml(reader, reader.getLocalName()); 711 return true; 712 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsHeaderStrings)) { 713 this.containsHeaderStrings.loadFromXml(reader, 714 reader.getLocalName()); 715 return true; 716 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsRecipientStrings)) { 717 this.containsRecipientStrings.loadFromXml(reader, 718 reader.getLocalName()); 719 return true; 720 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsSenderStrings)) { 721 this.containsSenderStrings.loadFromXml(reader, 722 reader.getLocalName()); 723 return true; 724 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsSubjectOrBodyStrings)) { 725 this.containsSubjectOrBodyStrings.loadFromXml(reader, 726 reader.getLocalName()); 727 return true; 728 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ContainsSubjectStrings)) { 729 this.containsSubjectStrings.loadFromXml(reader, 730 reader.getLocalName()); 731 return true; 732 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FlaggedForAction)) { 733 this.flaggedForAction = reader. 734 readElementValue(FlaggedForAction.class); 735 return true; 736 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FromAddresses)) { 737 this.fromAddresses.loadFromXml(reader, reader.getLocalName()); 738 return true; 739 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.FromConnectedAccounts)) { 740 this.fromConnectedAccounts.loadFromXml(reader, 741 reader.getLocalName()); 742 return true; 743 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.HasAttachments)) { 744 this.hasAttachments = reader.readElementValue(Boolean.class); 745 return true; 746 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Importance)) { 747 this.importance = reader.readElementValue(Importance.class); 748 return true; 749 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsApprovalRequest)) { 750 this.isApprovalRequest = reader.readElementValue(Boolean.class); 751 return true; 752 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsAutomaticForward)) { 753 this.isAutomaticForward = reader.readElementValue(Boolean.class); 754 return true; 755 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsAutomaticReply)) { 756 this.isAutomaticReply = reader.readElementValue(Boolean.class); 757 return true; 758 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsEncrypted)) { 759 this.isEncrypted = reader.readElementValue(Boolean.class); 760 return true; 761 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsMeetingRequest)) { 762 this.isMeetingRequest = reader.readElementValue(Boolean.class); 763 return true; 764 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsMeetingResponse)) { 765 this.isMeetingResponse = reader.readElementValue(Boolean.class); 766 return true; 767 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsNDR)) { 768 this.isNonDeliveryReport = reader.readElementValue(Boolean.class); 769 return true; 770 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsPermissionControlled)) { 771 this.isPermissionControlled = reader. 772 readElementValue(Boolean.class); 773 return true; 774 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsSigned)) { 775 this.isSigned = reader.readElementValue(Boolean.class); 776 return true; 777 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsVoicemail)) { 778 this.isVoicemail = reader.readElementValue(Boolean.class); 779 return true; 780 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.IsReadReceipt)) { 781 this.isReadReceipt = reader.readElementValue(Boolean.class); 782 return true; 783 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.ItemClasses)) { 784 this.itemClasses.loadFromXml(reader, reader.getLocalName()); 785 return true; 786 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.MessageClassifications)) { 787 this.messageClassifications.loadFromXml(reader, 788 reader.getLocalName()); 789 return true; 790 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.NotSentToMe)) { 791 this.notSentToMe = reader.readElementValue(Boolean.class); 792 return true; 793 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentCcMe)) { 794 this.sentCcMe = reader.readElementValue(Boolean.class); 795 return true; 796 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentOnlyToMe)) { 797 this.sentOnlyToMe = reader.readElementValue(Boolean.class); 798 return true; 799 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToAddresses)) { 800 this.sentToAddresses.loadFromXml(reader, reader.getLocalName()); 801 return true; 802 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToMe)) { 803 this.sentToMe = reader.readElementValue(Boolean.class); 804 return true; 805 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SentToOrCcMe)) { 806 this.sentToOrCcMe = reader.readElementValue(Boolean.class); 807 return true; 808 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Sensitivity)) { 809 this.sensitivity = reader.readElementValue(Sensitivity.class); 810 return true; 811 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.WithinDateRange)) { 812 this.withinDateRange.loadFromXml(reader, reader.getLocalName()); 813 return true; 814 } else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.WithinSizeRange)) { 815 this.withinSizeRange.loadFromXml(reader, reader.getLocalName()); 816 return true; 817 } else { 818 return false; 819 } 820 } 821 822 /** 823 * Writes elements to XML. 824 * 825 * @param writer The writer. 826 * @throws Exception 827 */ 828 @Override 829 public void writeElementsToXml(EwsServiceXmlWriter writer) 830 throws Exception { 831 if (this.getCategories().getSize() > 0) { 832 this.getCategories().writeToXml(writer, XmlElementNames.Categories); 833 } 834 835 if (this.getContainsBodyStrings().getSize() > 0) { 836 this.getContainsBodyStrings().writeToXml(writer, 837 XmlElementNames.ContainsBodyStrings); 838 } 839 840 if (this.getContainsHeaderStrings().getSize() > 0) { 841 this.getContainsHeaderStrings().writeToXml(writer, 842 XmlElementNames.ContainsHeaderStrings); 843 } 844 845 if (this.getContainsRecipientStrings().getSize() > 0) { 846 this.getContainsRecipientStrings().writeToXml(writer, 847 XmlElementNames.ContainsRecipientStrings); 848 } 849 850 if (this.getContainsSenderStrings().getSize() > 0) { 851 this.getContainsSenderStrings().writeToXml(writer, 852 XmlElementNames.ContainsSenderStrings); 853 } 854 855 if (this.getContainsSubjectOrBodyStrings().getSize() > 0) { 856 this.getContainsSubjectOrBodyStrings().writeToXml(writer, 857 XmlElementNames.ContainsSubjectOrBodyStrings); 858 } 859 860 if (this.getContainsSubjectStrings().getSize() > 0) { 861 this.getContainsSubjectStrings().writeToXml(writer, 862 XmlElementNames.ContainsSubjectStrings); 863 } 864 865 if (this.getFlaggedForAction() != null) { 866 writer.writeElementValue( 867 XmlNamespace.Types, 868 XmlElementNames.FlaggedForAction, 869 this.getFlaggedForAction().values()); 870 } 871 872 if (this.getFromAddresses().getCount() > 0) { 873 this.getFromAddresses().writeToXml(writer, 874 XmlElementNames.FromAddresses); 875 } 876 877 if (this.getFromConnectedAccounts().getSize() > 0) { 878 this.getFromConnectedAccounts().writeToXml(writer, 879 XmlElementNames.FromConnectedAccounts); 880 } 881 882 if (this.getHasAttachments() != false) { 883 writer.writeElementValue( 884 XmlNamespace.Types, 885 XmlElementNames.HasAttachments, 886 this.getHasAttachments()); 887 } 888 889 if (this.getImportance() != null) { 890 writer.writeElementValue( 891 XmlNamespace.Types, 892 XmlElementNames.Importance, 893 this.getImportance()); 894 } 895 896 if (this.getIsApprovalRequest() != false) { 897 writer.writeElementValue( 898 XmlNamespace.Types, 899 XmlElementNames.IsApprovalRequest, 900 this.getIsApprovalRequest()); 901 } 902 903 if (this.getIsAutomaticForward() != false) { 904 writer.writeElementValue( 905 XmlNamespace.Types, 906 XmlElementNames.IsAutomaticForward, 907 this.getIsAutomaticForward()); 908 } 909 910 if (this.getIsAutomaticReply() != false) { 911 writer.writeElementValue( 912 XmlNamespace.Types, 913 XmlElementNames.IsAutomaticReply, 914 this.getIsAutomaticReply()); 915 } 916 917 if (this.getIsEncrypted() != false) { 918 writer.writeElementValue( 919 XmlNamespace.Types, 920 XmlElementNames.IsEncrypted, 921 this.getIsEncrypted()); 922 } 923 924 if (this.getIsMeetingRequest() != false) { 925 writer.writeElementValue( 926 XmlNamespace.Types, 927 XmlElementNames.IsMeetingRequest, 928 this.getIsMeetingRequest()); 929 } 930 931 if (this.getIsMeetingResponse() != false) { 932 writer.writeElementValue( 933 XmlNamespace.Types, 934 XmlElementNames.IsMeetingResponse, 935 this.getIsMeetingResponse()); 936 } 937 938 if (this.getIsNonDeliveryReport() != false) { 939 writer.writeElementValue( 940 XmlNamespace.Types, 941 XmlElementNames.IsNDR, 942 this.getIsNonDeliveryReport()); 943 } 944 945 if (this.getIsPermissionControlled() != false) { 946 writer.writeElementValue( 947 XmlNamespace.Types, 948 XmlElementNames.IsPermissionControlled, 949 this.getIsPermissionControlled()); 950 } 951 952 if (this.getIsReadReceipt() != false) { 953 writer.writeElementValue( 954 XmlNamespace.Types, 955 XmlElementNames.IsReadReceipt, 956 this.getIsReadReceipt()); 957 } 958 959 if (this.getIsSigned() != false) { 960 writer.writeElementValue( 961 XmlNamespace.Types, 962 XmlElementNames.IsSigned, 963 this.getIsSigned()); 964 } 965 966 if (this.getIsVoicemail() != false) { 967 writer.writeElementValue( 968 XmlNamespace.Types, 969 XmlElementNames.IsVoicemail, 970 this.getIsVoicemail()); 971 } 972 973 if (this.getItemClasses().getSize() > 0) { 974 this.getItemClasses().writeToXml(writer, 975 XmlElementNames.ItemClasses); 976 } 977 978 if (this.getMessageClassifications().getSize() > 0) { 979 this.getMessageClassifications().writeToXml(writer, 980 XmlElementNames.MessageClassifications); 981 } 982 983 if (this.getNotSentToMe() != false) { 984 writer.writeElementValue( 985 XmlNamespace.Types, 986 XmlElementNames.NotSentToMe, 987 this.getNotSentToMe()); 988 } 989 990 if (this.getSentCcMe() != false) { 991 writer.writeElementValue( 992 XmlNamespace.Types, 993 XmlElementNames.SentCcMe, 994 this.getSentCcMe()); 995 } 996 997 if (this.getSentOnlyToMe() != false) { 998 writer.writeElementValue( 999 XmlNamespace.Types, 1000 XmlElementNames.SentOnlyToMe, 1001 this.getSentOnlyToMe()); 1002 } 1003 1004 if (this.getSentToAddresses().getCount() > 0) { 1005 this.getSentToAddresses().writeToXml(writer, 1006 XmlElementNames.SentToAddresses); 1007 } 1008 1009 if (this.getSentToMe() != false) { 1010 writer.writeElementValue( 1011 XmlNamespace.Types, 1012 XmlElementNames.SentToMe, 1013 this.getSentToMe()); 1014 } 1015 1016 if (this.getSentToOrCcMe() != false) { 1017 writer.writeElementValue( 1018 XmlNamespace.Types, 1019 XmlElementNames.SentToOrCcMe, 1020 this.getSentToOrCcMe()); 1021 } 1022 1023 if (this.getSensitivity() != null) { 1024 writer.writeElementValue( 1025 XmlNamespace.Types, 1026 XmlElementNames.Sensitivity, 1027 this.getSensitivity().values()); 1028 } 1029 1030 if (this.getWithinDateRange().getStart() != null || this.getWithinDateRange().getEnd() != null) { 1031 this.getWithinDateRange().writeToXml(writer, 1032 XmlElementNames.WithinDateRange); 1033 } 1034 1035 if (this.getWithinSizeRange().getMaximumSize() != null 1036 || this.getWithinSizeRange().getMinimumSize() != null) { 1037 this.getWithinSizeRange().writeToXml(writer, 1038 XmlElementNames.WithinSizeRange); 1039 } 1040 } 1041 1042 /** 1043 * Validates this instance. 1044 */ 1045 @Override 1046 protected void internalValidate() throws Exception { 1047 super.internalValidate(); 1048 EwsUtilities.validateParam(this.fromAddresses, "FromAddresses"); 1049 EwsUtilities.validateParam(this.sentToAddresses, "SentToAddresses"); 1050 EwsUtilities.validateParam(this.withinDateRange, "WithinDateRange"); 1051 EwsUtilities.validateParam(this.withinSizeRange, "WithinSizeRange"); 1052 } 1053}