Examples: Running a Java program. . . . . . 5. Accessing databases . . . . . . . . . . .
12. Accessing database properties . . . . . . . 12. Locating a database on a server ...
Lotus Domino Designer ®
Version7
Programming Guide, Volume 3: Java/CORBA Classes
G210-2372-00
Note: Before using this information and the product it supports, read the information in "Notices" at the end of this document.
First Edition (December, 2005) This edition applies to IBM® Lotus® Domino® Designer 7 (product number L-GHUS-5RWNHM), and to all subsequent releases and modifications, until otherwise indicated in new editions. © Copyright International Business Machines Corporation 1994, 2005. All rights reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
Contents Chapter 1. Java Classes Coding Guidelines . . . . . . . . . . . . . . 1 Running a Java program . . . . . . . . . . 1 Requirements . . . . . . . . . . . . . 1 Server requirements . . . . . . . . . . . 1 Designer requirements . . . . . . . . . . 2 Run-time requirements . . . . . . . . . . 2 Calling the lotus.domino package . . . . . . 3 Using the lotus.domino classes . . . . . . . 4 Examples: Running a Java program . . . . . . 5 Accessing databases . . . . . . . . . . . 12 Accessing database properties . . . . . . . 12 Locating a database on a server or the local directory . . . . . . . . . . . . . . 16 Opening a database . . . . . . . . . . 17 Creating, compacting, removing, and replicating a database . . . . . . . . . . . . . . 20 Examining and adjusting an access control list . . 22 Examining and adjusting database replication settings . . . . . . . . . . . . . . . 24 Accessing a form . . . . . . . . . . . 25 Accessing an outline . . . . . . . . . . 25 Accessing views and folders . . . . . . . . . 26 Accessing view properties . . . . . . . . 26 Locating a view . . . . . . . . . . . . 29 Accessing view columns . . . . . . . . . 30 Working with view entries and navigators . . . 32 Refreshing a view . . . . . . . . . . . 34 Removing a view . . . . . . . . . . . 35 Accessing documents in Java classes . . . . . . 35 Accessing document properties in Java classes . . 35 Collecting all documents and all unprocessed documents. . . . . . . . . . . . . . 37 Collecting documents by searching in Java classes . . . . . . . . . . . . . . . 38 Locating a document by ID in Java classes . . . 39 Creating a document in Java classes . . . . . 40 Removing a document in Java classes . . . . 40 Copying a document in Java classes . . . . . 40 Mailing a document in Java classes . . . . . 41 Generating XML in Java classes. . . . . . . 41 Accessing items in Java classes . . . . . . . . 41 Accessing item properties in Java classes . . . 41 Getting an item and its values in Java classes . . 43 Creating an item and assigning values in Java classes . . . . . . . . . . . . . . . 44 Copying an item in Java classes . . . . . . 44 Removing an item in Java classes . . . . . . 44 Parsing and transforming an item in Java classes 45 Working with a MIME entity in Java classes . . 45 Working with an embedded object in Java classes 46 Working with custom data . . . . . . . . 47 Accessing rich text items in Java classes . . . . . 48 Getting text renditions of rich text items in Java classes . . . . . . . . . . . . . . . 48
Navigating in rich text items in Java classes . . Writing in rich text items in Java classes . . . . Working with text in Java classes . . . . . . Working with attachments and embedded objects in Java classes . . . . . . . . . . . . Working with tables in Java classes . . . . . Working with doclinks in Java classes . . . . Working with sections in Java classes . . . . . Accessing Domino sessions . . . . . . . . . Accessing session properties . . . . . . . . Using environment variables . . . . . . . Accessing agents . . . . . . . . . . . Accessing international settings . . . . . . . Hashing passwords . . . . . . . . . . . Locking documents and design elements . . . Working with time . . . . . . . . . . . Making a log . . . . . . . . . . . . . Making a newsletter . . . . . . . . . . Representing a name . . . . . . . . . . Representing a color . . . . . . . . . . Working with streams of data . . . . . . . Building a note collection . . . . . . . . .
50 52 53 59 62 64 65 66 67 67 68 71 71 72 72 74 75 75 76 77 77
Chapter 2. Java Classes A-Z . . . . . 81 Properties and methods with ECL security . . Java constants . . . . . . . . . . . Java constants: ACL level . . . . . . . Java constants: ACL maximum roles . . . Java constants: ACL type . . . . . . . Java constants: align . . . . . . . . Java constants: color . . . . . . . . Java constants: compact . . . . . . . Java constants: database access privileges . Java constants: database directory . . . . Java constants: database option . . . . . Java constants: database modified documents Java constants: database replication priority Java constants: database sign . . . . . Java constants: database type . . . . . Java constants: DXL import option. . . . Java constants: DXL log option . . . . . Java constants: DXL validate . . . . . . Java constants: effects . . . . . . . . Java constants: embedded object type . . . Java constants: encoding . . . . . . . Java constants: end of line . . . . . . Java constants: event . . . . . . . . Java constants: fixup . . . . . . . . Java constants: font . . . . . . . . . Java constants: full-text index create . . . Java constants: full-text index frequency . . Java constants: full-text search . . . . . Java constants: ID type . . . . . . . Java constants: item type . . . . . . . Java constants: mail file . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81 86 86 86 87 87 87 88 88 89 89 89 90 90 90 91 91 92 92 92 92 93 93 93 94 94 94 94 95 95 96
iii
Java constants: Notes client . . . . . . . Java constants: outline entry class . . . . . Java constants: outline entry type . . . . . Java constants: paginate . . . . . . . . Java constants: password check . . . . . . Java constants: policy settings . . . . . . Java constants: register mail owner ACL . . . Java constants: register mail system . . . . Java constants: rich text element . . . . . Java constants: rich text find . . . . . . . Java constants: rich text replace . . . . . . Java constants: roaming cleanup . . . . . Java constants: ruler . . . . . . . . . Java constants: search . . . . . . . . Java constants: severity . . . . . . . . Java constants: spacing . . . . . . . . Java constants: stream read . . . . . . . Java constants: style no change . . . . . Java constants: style no or yes . . . . . . Java constants: tab . . . . . . . . . . Java constants: table style . . . . . . . Java constants: target . . . . . . . . . Java constants: trigger . . . . . . . . Java constants: view column attribute . . . Java constants: view column date format . . Java constants: view column font . . . . . Java constants: view column number format . Java constants: view column separator . . . Java constants: view column time date format Java constants: view column time format . . Java constants: view column time zone format Java constants: view entry type . . . . . Supporting components . . . . . . . . . AgentBase class . . . . . . . . . . AppletBase and JAppletBase classes . . . . Base class . . . . . . . . . . . . NotesAppletContext class . . . . . . . NotesError and NotesException classes . . . NotesFactory class . . . . . . . . . . NotesThread class . . . . . . . . . . XSLTResultTarget class . . . . . . . . InputSource property . . . . . . . . . InputStream property. . . . . . . . . Reader property . . . . . . . . . . getURL method . . . . . . . . . . parseXML method . . . . . . . . . . recycle method . . . . . . . . . . . toString method . . . . . . . . . . transformXML method . . . . . . . . Visibility interface . . . . . . . . . . ACL class . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Methods . . . . . . . . . . . . . Access . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: ACL class . . . . . . . . . AdministrationServer property . . . . . InternetLevel property . . . . . . . . IsAdminNames property . . . . . . .
iv
. 96 . 96 . 96 . 97 . 97 . 97 . 97 . 98 . 98 . 98 . 99 . 99 . 99 . 100 . 100 . 100 . 101 . 101 . 101 . 101 . 102 . 102 . 102 . 103 . 103 . 103 . 103 . 103 104 . 104 104 . 104 . 104 . 105 . 106 . 108 . 108 . 109 . 125 . 128 . 130 . 130 . 131 . 131 . 132 . 132 . 133 . 134 . 134 . 135 . 135 . 135 . 135 . 135 . 135 . 136 . 136 . 136 . 136 . 137 . 139
Programming Guide, Volume 3: Java/CORBA Classes
IsAdminReaderAuthor property . . . . IsExtendedAccess property . . . . . . IsUniformAccess property . . . . . . Parent property . . . . . . . . . Roles property . . . . . . . . . . addRole method . . . . . . . . . createACLEntry method . . . . . . . deleteRole method. . . . . . . . . getEntry method . . . . . . . . . getFirstEntry method . . . . . . . getNextEntry method . . . . . . . removeACLEntry method . . . . . . renameRole method . . . . . . . . save method. . . . . . . . . . . ACLEntry class . . . . . . . . . . Syntax . . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods . . . . . . . . . . . . Creation and access . . . . . . . . Language cross-reference . . . . . . Examples: ACLEntry class . . . . . . IsAdminReaderAuthor property . . . . IsAdminServer property . . . . . . . IsCanCreateDocuments property . . . IsCanCreateLSOrJavaAgent property . . IsCanCreatePersonalAgent property . . IsCanCreatePersonalFolder property . . . IsCanCreateSharedFolder property . . . IsCanDeleteDocuments property . . . IsCanReplicateOrCopyDocuments property IsGroup property . . . . . . . . . IsPerson property . . . . . . . . . IsPublicReader property . . . . . . . IsPublicWriter property . . . . . . . IsServer property . . . . . . . . . Level property . . . . . . . . . . Name property . . . . . . . . . . NameObject property . . . . . . . Parent property . . . . . . . . . Roles property . . . . . . . . . . UserType property . . . . . . . . disableRole method . . . . . . . . enableRole method . . . . . . . . isRoleEnabled method . . . . . . . remove method . . . . . . . . . AdministrationProcess class . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods . . . . . . . . . . . . Creation and access . . . . . . . . Usage . . . . . . . . . . . . . Examples: AdministrationProcess class . . CertificateAuthorityOrg property . . . . CertificateExpiration property . . . . . CertifierFile property . . . . . . . . CertifierPassword property . . . . . . IsCertificateAuthorityAvailable property . IsUseCertificateAuthority property . . . Parent property . . . . . . . . . addGroupMembers method . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
140 141 142 143 143 144 145 146 147 148 149 149 150 151 151 151 151 151 152 152 152 153 153 153 154 155 156 157 158 158 159 160 160 161 162 162 163 164 165 166 166 167 169 170 170 171 172 172 172 173 174 174 174 174 175 175 176 176 176 177 177
addInternetCertificateToUser method . . . addServerToCluster method . . . . . . approveDeletePersonInDirectory method . . approveDeleteServerInDirectory method . . approveDesignElementDeletion method . . approveHostedOrgStorageDeletion method . approveMailFileDeletion method . . . . . approveMovedReplicaDeletion method . . . approveNameChangeRetraction method . . approveRenamePersonInDirectory method . approveRenameServerInDirectory method . . approveReplicaDeletion method . . . . . approveResourceDeletion method . . . . changeHTTPPassword method . . . . . configureMailAgent method . . . . . . createReplica method . . . . . . . . . deleteGroup method . . . . . . . . . deleteReplicas method . . . . . . . . deleteServer method . . . . . . . . . deleteUser method . . . . . . . . . findGroupInDomain method . . . . . . findServerInDomain method . . . . . . findUserInDomain method . . . . . . . moveMailUser method . . . . . . . . moveReplica method . . . . . . . . . moveRoamingUser method . . . . . . . moveUserInHierarchyComplete method . . moveUserInHierarchyRequest method . . . recertifyServer method . . . . . . . . recertifyUser method . . . . . . . . . removeServerFromCluster method . . . . renameGroup method . . . . . . . . renameNotesUser method . . . . . . . renameWebUser method. . . . . . . . setServerDirectoryAssistanceSettings method setUserPasswordSettings method . . . . . signDatabaseWithServerID method . . . . upgradeUserToHierarchical method . . . . Agent class . . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Method . . . . . . . . . . . . . Access . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: Agent class . . . . . . . . Comment property . . . . . . . . . CommonOwner property . . . . . . . HttpURL property . . . . . . . . . . IsActivatable property . . . . . . . . IsEnabled property . . . . . . . . . IsNotesAgent property . . . . . . . . IsPublic property . . . . . . . . . . IsWebAgent property . . . . . . . . . LastRun property . . . . . . . . . . LockHolders property . . . . . . . . Name property . . . . . . . . . . . NotesURL property . . . . . . . . . OnBehalfOf property . . . . . . . . . Owner property . . . . . . . . . . ParameterDocID property . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
178 179 179 180 180 181 181 182 182 183 183 184 184 185 185 186 187 188 189 189 190 191 191 192 193 194 195 196 197 197 198 198 199 200 201 201 202 203 204 204 204 204 205 205 205 205 206 207 207 208 210 211 212 213 213 214 215 216 217 218 218
Parent property. . . . . . . . Query property . . . . . . . . ServerName property. . . . . . Target property . . . . . . . . Trigger property . . . . . . . lock method . . . . . . . . . lockProvisional method . . . . . remove method . . . . . . . run method . . . . . . . . . runOnServer method . . . . . . save method. . . . . . . . . unlock method . . . . . . . . AgentContext class . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Usage . . . . . . . . . . . Examples: AgentContext class . . . CurrentAgent property . . . . . CurrentDatabase property . . . . DocumentContext property . . . . EffectiveUserName property . . . LastExitStatus property . . . . . LastRun property . . . . . . . SavedData property . . . . . . UnprocessedDocuments property . . unprocessedFTSearch method . . . unprocessedFTSearchRange method . unprocessedSearch method . . . . updateProcessedDoc method . . . ColorObject class . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation . . . . . . . . . . Usage . . . . . . . . . . . Examples: ColorObject class . . . Blue property . . . . . . . . Green property . . . . . . . . Hue property . . . . . . . . Luminance property . . . . . . NotesColor property . . . . . . Red property . . . . . . . . Saturation property . . . . . . setHSL method . . . . . . . . setRGB method . . . . . . . . Database class . . . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Usage . . . . . . . . . . . Access levels . . . . . . . . Language cross-reference . . . . Examples: Database class . . . . ACL property . . . . . . . . ACLActivityLog property . . . . Agents property . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
219 219 220 222 223 224 226 227 228 230 233 234 234 235 235 235 235 235 235 236 236 237 237 240 241 241 242 243 245 248 251 253 255 255 255 255 255 255 256 257 258 258 259 260 261 262 262 264 265 265 265 266 268 269 270 270 270 270 272 273 274
Contents
v
AllDocuments property . . . . . Categories property . . . . . . Created property . . . . . . . CurrentAccessLevel property . . . DesignTemplateName property . . FileFormat property . . . . . . FileName property . . . . . . FilePath property . . . . . . . FolderReferencesEnabled property . Forms property . . . . . . . . FTIndexFrequency property . . . HttpURL property . . . . . . . IsClusterReplication property . . . IsConfigurationDirectory property . IsCurrentAccessPublicReader property IsCurrentAccessPublicWriter property IsDelayUpdates property . . . . IsDesignLockingEnabled property . IsDirectoryCatalog property . . . IsDocumentLockingEnabled property IsFTIndexed property . . . . . IsInMultiDbIndexing property . . . IsInService property . . . . . . IsLink property . . . . . . . . IsMultiDbSearch property . . . . IsOpen property . . . . . . . IsPendingDelete property . . . . IsPrivateAddressBook property . . IsPublicAddressBook property . . . LastFixup property . . . . . . LastFTIndexed property . . . . . LastModified property . . . . . LimitRevisions property . . . . . LimitUpdatedBy property . . . . ListInDbCatalog property . . . . Managers property . . . . . . MaxSize property . . . . . . . NotesURL property . . . . . . Parent property . . . . . . . . PercentUsed property . . . . . ReplicaID property . . . . . . ReplicationInfo property . . . . . Server property . . . . . . . . Size property . . . . . . . . SizeQuota property . . . . . . SizeWarning property . . . . . TemplateName property . . . . . Title property . . . . . . . . Type property . . . . . . . . UndeleteExpireTime property . . . Views property . . . . . . . . compact method . . . . . . . compactWithOptions method . . . createCopy method . . . . . . createDocument method . . . . . createFromTemplate method . . . createFTIndex method . . . . . createNoteCollection method . . . createOutline method . . . . . . createReplica method . . . . . . createView method . . . . . .
vi
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
274 275 276 277 278 279 280 281 282 283 283 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 310 311 312 312 313 313 314 315 316 317 318 319 320 321 322 323 325 327 328 329 331 332 333 334
Programming Guide, Volume 3: Java/CORBA Classes
enableFolder method . . . . fixup method . . . . . . FTDomainSearch method . . FTSearch method . . . . . FTSearchRange method . . . getAgent method . . . . . getDocumentByID method . . getDocumentByUNID method . getDocumentByURL method . getForm method . . . . . getModifiedDocuments method getOption method . . . . . getOutline method . . . . getProfileDocCollection method getProfileDocument method . getURLHeaderInfo method . . getView method . . . . . grantAccess method . . . . markForDelete method . . . open method . . . . . . openByReplicaID method . . openIfModified method . . . openWithFailover method . . queryAccess method . . . . queryAccessPrivileges method . queryAccessRoles method . . remove method . . . . . removeFTIndex method . . . replicate method . . . . . revokeAccess method . . . search method . . . . . . setOption method . . . . . sign method . . . . . . . updateFTIndex method . . . DateRange class . . . . . . Syntax . . . . . . . . . Containment . . . . . . Properties . . . . . . . Methods . . . . . . . . Creation . . . . . . . . Usage . . . . . . . . . Examples: DateRange class . . EndDateTime property . . . Parent property. . . . . . StartDateTime property . . . Text property . . . . . . DateTime class . . . . . . . Syntax . . . . . . . . . Containment . . . . . . Properties . . . . . . . Methods . . . . . . . . Creation . . . . . . . . Usage . . . . . . . . . Time zones . . . . . . . Today, Tomorrow, and Yesterday Access . . . . . . . . . Examples: DateTime class . . DateOnly property . . . . GMTTime property . . . . IsDST property . . . . . . LocalTime property . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
335 336 337 338 340 342 343 344 346 348 349 351 352 352 353 354 355 356 357 359 359 360 361 362 364 365 367 367 368 369 370 371 373 374 375 375 375 376 376 376 376 376 378 378 378 379 379 379 379 379 380 380 380 381 381 381 381 383 383 384 385
Parent property. . . . . . . TimeOnly property . . . . . TimeZone property . . . . . ZoneTime property . . . . . adjustDay method . . . . . . adjustHour method . . . . . adjustMinute method . . . . . adjustMonth method . . . . . adjustSecond method . . . . . adjustYear method. . . . . . convertToZone method . . . . setAnyDate method . . . . . setAnyTime method . . . . . setNow method . . . . . . timeDifference method . . . . toJavaDate method . . . . . DbDirectory class . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . . Examples: DbDirectory class . . Name property . . . . . . . Parent property. . . . . . . createDatabase method . . . . getFirstDatabase method . . . getNextDatabase method . . . openDatabase method . . . . openDatabaseByReplicaID method openDatabaseIfModified method . openMailDatabase method . . . Document class . . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . . Access . . . . . . . . . . Saving changes . . . . . . . Encryption . . . . . . . . Language cross-reference . . . Examples: Document class . . . Authors property . . . . . . ColumnValues property . . . . Created property . . . . . . EmbeddedObjects property . . . EncryptionKeys property . . . FolderReferences property . . . FTSearchScore property . . . . HasEmbedded property . . . . HttpURL property . . . . . . IsDeleted property. . . . . . IsEncrypted property . . . . . IsEncryptOnSend property . . . IsNewNote property . . . . . IsProfile property . . . . . . IsResponse property . . . . . IsSaveMessageOnSend property . IsSentByAgent property . . . . IsSigned property . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
387 387 388 389 389 390 391 392 393 394 395 396 396 397 397 398 399 399 399 399 399 399 399 400 401 401 402 403 403 404 405 406 407 407 407 407 408 410 410 410 410 410 411 411 412 414 414 415 416 417 418 419 420 420 421 421 422 423 424 424 425
IsSignOnSend property . . . . . . . IsValid property . . . . . . . . . Items property . . . . . . . . . . Key property . . . . . . . . . . LastAccessed property . . . . . . . LastModified property . . . . . . . LockHolders property . . . . . . . NameOfProfile property . . . . . . . NoteID property . . . . . . . . . NotesURL property . . . . . . . . ParentDatabase property . . . . . . ParentDocumentUNID property . . . . ParentView property . . . . . . . . Responses property . . . . . . . . Signer property . . . . . . . . . . Size property . . . . . . . . . . UniversalID property . . . . . . . . Verifier property . . . . . . . . . appendItemValue method . . . . . . closeMIMEEntities method . . . . . . computeWithForm method . . . . . . copyAllItems method . . . . . . . . copyItem method . . . . . . . . . copyToDatabase method . . . . . . . createMIMEEntity method . . . . . . createReplyMessage method . . . . . createRichTextItem method . . . . . . encrypt method . . . . . . . . . generateXML method. . . . . . . . getAttachment method . . . . . . . getFirstItem method . . . . . . . . getItemValue method . . . . . . . . getItemValueCustomData method . . . getItemValueCustomDataBytes method . . getItemValueDateTimeArray method . . getItemValueDouble method . . . . . getItemValueInteger method . . . . . getItemValueString method . . . . . . getMIMEEntity method . . . . . . . getReceivedItemText method . . . . . hasItem method . . . . . . . . . lock method . . . . . . . . . . . lockProvisional method . . . . . . . makeResponse method . . . . . . . putInFolder method . . . . . . . . remove method . . . . . . . . . removeFromFolder method . . . . . . removeItem method . . . . . . . . removePermanently method . . . . . renderToRTItem method . . . . . . replaceItemValue method . . . . . . replaceItemValueCustomData method . . replaceItemValueCustomDataBytes method save method. . . . . . . . . . . send method . . . . . . . . . . sign method . . . . . . . . . . . unlock method . . . . . . . . . . DocumentCollection class . . . . . . . Syntax . . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
426 427 427 428 429 429 429 430 431 431 432 433 434 435 436 436 437 438 439 441 442 443 444 445 446 447 448 449 450 452 453 454 456 458 459 460 461 461 462 463 464 465 466 468 469 470 471 472 473 474 475 477 479 480 481 483 483 484 484 484 485
vii
Methods . . . . . . . . . . Access . . . . . . . . . . . Usage . . . . . . . . . . . Sorted collections . . . . . . . Current pointer . . . . . . . . Deletion stubs . . . . . . . . Examples: DocumentCollection class Count property . . . . . . . . IsSorted property . . . . . . . Parent property. . . . . . . . Query property . . . . . . . UntilTime property . . . . . . addDocument method . . . . . deleteDocument method. . . . . FTSearch method . . . . . . . getDocument method . . . . . getFirstDocument method . . . . getLastDocument method . . . . getNextDocument method . . . . getNthDocument method . . . . getPrevDocument method . . . . putAllInFolder method . . . . . removeAll method . . . . . . removeAllFromFolder method . . . stampAll method . . . . . . . updateAll method . . . . . . . DxlExporter class . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Example: DxlExporter class . . . . ConvertNotesBitmapsToGIF property DoctypeSYSTEM property . . . . ExitOnFirstFatalError property . . ForceNoteFormat property . . . . Log property . . . . . . . . LogComment property . . . . . OutputDOCTYPE property . . . . exportDxl method . . . . . . . DxlImporter class . . . . . . . . Containment. . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Example: DxlImporter class . . . AclImportOption property . . . . CreateFTIndex property . . . . . DesignImportOption property . . . DocumentImportOption property. . ExitOnFirstFatalError property . . ImportedNoteCount property . . . InputValidationOption property . . Log property . . . . . . . . LogComment property . . . . . ReplaceDbProperties property . . . ReplicaRequiredForReplaceOrUpdate UnknownTokenLogOption property . getFirstImportedNoteID method . . getNextImportedNoteID method . . importDxl method . . . . . . .
viii
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . property . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
485 485 486 486 486 486 486 487 487 488 489 490 491 492 493 494 495 496 497 498 499 500 500 501 502 503 504 504 504 504 504 504 505 506 507 507 508 508 509 510 511 511 511 512 512 512 514 514 515 515 516 516 517 517 518 518 518 519 520 520 520
Programming Guide, Volume 3: Java/CORBA Classes
EmbeddedObject class . . . . . . . . Syntax . . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods . . . . . . . . . . . . Creation . . . . . . . . . . . . Access . . . . . . . . . . . . . Language cross-reference . . . . . . Examples: EmbeddedObject class and ClassName, FileSize, Name, Object, Parent, Source, Type, and Verbs properties . . . ClassName property . . . . . . . . FileSize property . . . . . . . . . Name property . . . . . . . . . . Object property . . . . . . . . . . Parent property. . . . . . . . . . Source property . . . . . . . . . Type property . . . . . . . . . . Verbs property . . . . . . . . . . activate method . . . . . . . . . doVerb method . . . . . . . . . . extractFile method . . . . . . . . . remove method . . . . . . . . . Form class . . . . . . . . . . . . Syntax . . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods . . . . . . . . . . . . Access . . . . . . . . . . . . . Examples: Form class . . . . . . . . Aliases property . . . . . . . . . Fields property . . . . . . . . . . FormUsers property . . . . . . . . HttpURL property . . . . . . . . . IsProtectReaders property . . . . . . IsProtectUsers property . . . . . . . IsSubForm property . . . . . . . . LockHolders property . . . . . . . Name property . . . . . . . . . . NotesURL property . . . . . . . . Parent property. . . . . . . . . . Readers property . . . . . . . . . getFieldType method . . . . . . . . lock method . . . . . . . . . . . lockProvisional method . . . . . . . remove method . . . . . . . . . unlock method . . . . . . . . . . International class . . . . . . . . . . Syntax . . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods . . . . . . . . . . . . Access . . . . . . . . . . . . . Examples: International class . . . . . AMString property . . . . . . . . CurrencyDigits property . . . . . . CurrencySymbol property . . . . . . DateSep property . . . . . . . . . DecimalSep property . . . . . . . IsCurrencySpace property . . . . . . IsCurrencySuffix property . . . . . .
. . . . . . . .
. . . . . . . .
521 521 521 521 522 522 522 522
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
523 523 524 524 525 525 525 526 526 526 528 528 529 529 530 530 530 530 530 531 531 532 533 534 535 536 537 537 538 539 540 540 541 542 544 545 546 547 547 547 547 548 548 548 548 549 550 550 551 552 552
IsCurrencyZero property . . . IsDateDMY property . . . . . IsDateMDY property . . . . . IsDateYMD property . . . . . IsDST property . . . . . . . IsTime24Hour property . . . . Parent property. . . . . . . PMString property . . . . . ThousandsSep property . . . . TimeSep property . . . . . . TimeZone property . . . . . Today property. . . . . . . Tomorrow property . . . . . Yesterday property . . . . . Item class . . . . . . . . . Syntax . . . . . . . . . . Derived Classes . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . . Access . . . . . . . . . . Rich-text items . . . . . . . Saving Changes . . . . . . Examples: Item class . . . . . DateTimeValue property . . . IsAuthors property . . . . . IsEncrypted property . . . . . IsNames property . . . . . . IsProtected property . . . . . IsReaders property . . . . . IsSaveToDisk property . . . . IsSigned property . . . . . . IsSummary property . . . . . LastModified property . . . . Name property . . . . . . . Parent property. . . . . . . Text property . . . . . . . Type property . . . . . . . ValueDouble property . . . . ValueInteger property . . . . ValueLength property . . . . Values property . . . . . . ValueString property . . . . . abstractText method . . . . . appendToTextList method . . . containsValue method . . . . copyItemToDocument method . . getMIMEEntity method . . . . getValueCustomData method . . getValueCustomDataBytes method getValueDateTimeArray method . remove method . . . . . . setValueCustomData method . . setValueCustomDataBytes method Log class . . . . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
553 553 554 554 554 555 555 556 556 556 557 557 557 558 558 558 558 558 558 559 560 560 560 560 560 561 562 563 565 565 565 566 566 567 568 568 568 569 570 572 572 573 573 575 575 576 577 578 579 580 581 583 584 585 586 588 588 588 588 589 589
Usage . . . . . . . . Examples: Log class . . . IsLogActions property . . IsLogErrors property . . . IsOverwriteFile property . NumActions property . . NumErrors property . . . Parent property. . . . . ProgramName property . . close method . . . . . logAction method . . . . logError method . . . . logEvent method . . . . openAgentLog method . . openFileLog method . . . openMailLog method . . . openNotesLog method . . MIMEEntity class . . . . . Syntax . . . . . . . . Containment . . . . . Properties . . . . . . Methods . . . . . . . Access . . . . . . . . Usage . . . . . . . . Language cross-reference . Examples: MIMEEntity class BoundaryEnd property . . BoundaryStart property . . Charset property . . . . ContentAsText property . . ContentSubType property . ContentType property . . Encoding property . . . HeaderObjects property . . Headers property . . . . Preamble property . . . . createChildEntity method . createHeader method . . . createParentEntity method . decodeContent method . . encodeContent method . . getContentAsBytes method . getContentAsText method . getEntityAsText method . . getFirstChildEntity method . getNextEntity method . . getNextSibling method . . getNthHeader method . . getParentEntity method . . getPrevEntity method . . getPrevSibling method . . getSomeHeaders method . remove method . . . . setContentFromBytes method setContentFromText method MIMEHeader class . . . . Syntax . . . . . . . . Containment . . . . . Properties . . . . . . Methods . . . . . . . Access . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
589 589 590 591 592 593 594 595 595 596 596 598 599 600 600 602 603 604 604 604 604 605 605 606 606 606 608 609 611 612 613 614 615 616 617 618 620 623 624 625 626 628 629 630 633 634 635 636 638 639 641 642 643 644 645 647 647 647 647 647 647
ix
Usage . . . . . . . . . . Examples: MIMEHeader class . . HeaderName property . . . . addValText method . . . . . getHeaderVal method . . . . getHeaderValAndParams method getParamVal method . . . . . remove method . . . . . . setHeaderVal method . . . . . setHeaderValAndParams method . setParamVal method . . . . . Name class . . . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . . Usage . . . . . . . . . . Language cross-reference . . . Examples: Name class . . . . Abbreviated property. . . . . Addr821 property . . . . . . Addr822Comment1 property . . Addr822Comment2 property . . Addr822Comment3 property . . Addr822LocalPart property . . . Addr822Phrase property . . . ADMD property . . . . . . Canonical property . . . . . Common property . . . . . . Country property . . . . . . Generation property . . . . . Given property . . . . . . . Initials property . . . . . . IsHierarchical property . . . . Keyword property . . . . . . Language property . . . . . Organization property . . . . OrgUnit1 property. . . . . . OrgUnit2 property. . . . . . OrgUnit3 property. . . . . . OrgUnit4 property. . . . . . Parent property. . . . . . . PRMD property . . . . . . Surname property . . . . . . Newsletter class . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation . . . . . . . . . Usage . . . . . . . . . . Examples: Newsletter class . . . IsDoScore property . . . . . IsDoSubject property . . . . . Parent property. . . . . . . SubjectItemName property . . . formatDocument method . . . formatMsgWithDoclinks method . NoteCollection class . . . . . . Containment . . . . . . .
x
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Programming Guide, Volume 3: Java/CORBA Classes
648 648 649 650 651 653 654 655 656 657 659 660 660 660 660 661 661 661 662 662 664 665 666 666 667 668 669 670 671 671 673 673 674 675 676 677 678 679 680 681 682 683 684 684 685 686 686 686 687 687 687 687 687 688 689 689 689 690 691 692 692
Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Usage . . . . . . . . . . . Examples: NoteCollection class . . Count property . . . . . . . . LastBuildTime property . . . . . Parent property. . . . . . . . SelectAcl property . . . . . . . SelectActions property . . . . . SelectAgents property . . . . . SelectDatabaseScript property . . . SelectDataConnections property . . SelectDocuments property . . . . SelectFolders property . . . . . SelectForms property . . . . . . SelectFramesets property . . . . SelectHelpAbout property . . . . SelectHelpIndex property . . . . SelectHelpUsing property . . . . SelectIcon property . . . . . . SelectImageResources property . . SelectionFormula property . . . . SelectJavaResources property . . . SelectMiscCodeElements property . SelectMiscFormatElements property . SelectMiscIndexElements property . SelectNavigators property . . . . SelectOutlines property . . . . . SelectPages property . . . . . . SelectProfiles property . . . . . SelectReplicationFormulas property . SelectScriptLibraries property . . . SelectSharedFields property . . . SelectStylesheetResources property . SelectSubforms property . . . . . SelectViews property . . . . . . SinceTime property . . . . . . add method . . . . . . . . . buildCollection method . . . . . clearCollection method . . . . . getFirstNoteID method . . . . . getNextNoteID method . . . . . intersect method . . . . . . . remove method . . . . . . . selectAllAdminNotes method . . . selectAllCodeElements method . . selectAllDataNotes method . . . . selectAllDesignElements method . . selectAllFormatElements method . . selectAllIndexElements method . . selectAllNotes method . . . . . Outline class . . . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Usage . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
693 694 694 695 695 695 696 697 697 698 700 701 702 703 704 705 706 708 709 710 711 712 714 715 716 717 719 720 721 722 724 724 725 727 728 729 730 732 733 735 737 738 738 739 741 743 744 745 746 748 749 751 752 752 752 752 752 752 753
Examples: Outline class, Alias, Comment, and Name properties, getFirst and getNext methods, OutlineEntry class, Alias, EntryClass, IsInThisDB, IsPrivate, Label, Level, and Type properties . . . . . . . . . . . . . Alias property . . . . . . . . . . . . Comment property . . . . . . . . . . Name property . . . . . . . . . . . . ParentDatabase property . . . . . . . . addEntry method . . . . . . . . . . . createEntry method . . . . . . . . . . getChild method . . . . . . . . . . . getFirst method . . . . . . . . . . . getLast method . . . . . . . . . . . . getNext method . . . . . . . . . . . getNextSibling method . . . . . . . . . getParent method . . . . . . . . . . . getPrev method . . . . . . . . . . . getPrevSibling method . . . . . . . . . moveEntry method . . . . . . . . . . removeEntry method . . . . . . . . . . save method. . . . . . . . . . . . . OutlineEntry class . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Containment . . . . . . . . . . . . Properties . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . Creation and access . . . . . . . . . . Alias property . . . . . . . . . . . . Database property . . . . . . . . . . . Document property . . . . . . . . . . EntryClass property . . . . . . . . . . Formula property . . . . . . . . . . . FrameText property . . . . . . . . . . HasChildren property . . . . . . . . . HideFormula property . . . . . . . . . ImagesText property . . . . . . . . . . IsHidden property . . . . . . . . . . . IsHiddenFromNotes property . . . . . . . IsHiddenFromWeb property . . . . . . . IsInThisDB property . . . . . . . . . . IsPrivate property . . . . . . . . . . . KeepSelectionFocus property . . . . . . . Label property . . . . . . . . . . . . Level property . . . . . . . . . . . . NamedElement property . . . . . . . . Parent property. . . . . . . . . . . . Type property . . . . . . . . . . . . URL property . . . . . . . . . . . . UseHideFormula property . . . . . . . . View property . . . . . . . . . . . . setAction method . . . . . . . . . . . setNamedElement method . . . . . . . . setNoteLink method . . . . . . . . . . setURL method . . . . . . . . . . . . Registration class . . . . . . . . . . . . Syntax . . . . . . . . . . . . . . . Containment . . . . . . . . . . . . Properties . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . Creation . . . . . . . . . . . . . .
753 754 755 755 755 756 758 759 759 760 760 761 762 762 762 763 764 765 766 766 766 766 767 767 767 767 768 768 769 769 769 770 771 771 772 773 773 773 774 774 775 775 775 776 776 777 777 778 778 779 779 780 780 780 780 781 782
Usage . . . . . . . . . . . Language cross-reference . . . . AltOrgUnit property . . . . . . AltOrgUnitLang property . . . . CertifierIDFile property . . . . . CertifierName property . . . . . CreateMailDb property . . . . . Expiration property . . . . . . GroupList property . . . . . . IDType property . . . . . . . IsEnforceUniqueShortName property IsMailCreateFTIndex property . . . IsNoIDFile property . . . . . . IsNorthAmerican property . . . . IsRoamingUser property. . . . . IsStoreIDInMailfile property . . . IsSynchInternetPassword property . IsUseCertificateAuthority property . MailACLManager property . . . . MailInternetAddress property . . . MailOwnerAccess property . . . . MailQuotaSizeLimit property . . . MailQuotaWarningThreshold property MailReplicaServers property . . . MailSystem property . . . . . . MailTemplateName property . . . MinPasswordLength property . . . OrgUnit property . . . . . . . Parent property. . . . . . . . PolicyName property . . . . . . RegistrationLog property . . . . RegistrationServer property . . . RoamingCleanupPeriod property . . RoamingCleanupSetting property . RoamingServer property. . . . . RoamingSubdir property . . . . ShortName property . . . . . . StoreIDInAddressBook property . . UpdateAddressBook property . . . addCertifierToAddressBook method . addServerToAddressBook method . addUserProfile method . . . . . addUserToAddressBook method . . crossCertify method . . . . . . deleteIDOnServer method . . . . getIDFromServer method . . . . getUserInfo method . . . . . . recertify method . . . . . . . registerNewCertifier method . . . registerNewServer method . . . . registerNewUser method . . . . switchToID method . . . . . . Replication class . . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation . . . . . . . . . . Usage . . . . . . . . . . . Examples: Replication class . . . . CutoffDate property . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
782 782 782 783 783 784 784 785 785 785 786 786 787 787 788 788 789 790 790 791 791 792 792 792 793 794 794 795 795 796 796 797 797 798 798 799 799 800 800 801 802 804 804 806 808 809 810 811 812 814 816 820 821 821 821 821 821 822 822 822 823
xi
CutoffInterval property . . . . . . DontSendLocalSecurityUpdates property IsAbstract property . . . . . . . IsCutoffDelete property . . . . . . IsDisabled property . . . . . . . IsIgnoreDeletes property . . . . . IsIgnoreDestDeletes property . . . . Priority property . . . . . . . . clearHistory method . . . . . . . getEntry method . . . . . . . . reset method . . . . . . . . . save method. . . . . . . . . . ReplicationEntry class . . . . . . . Containment . . . . . . . . . Properties . . . . . . . . . . Methods . . . . . . . . . . . Creation . . . . . . . . . . . Usage . . . . . . . . . . . . Examples: ReplicationEntry class . . . Destination property . . . . . . . Formula property . . . . . . . . IsIncludeACL property . . . . . . IsIncludeAgents property . . . . . IsIncludeDocuments property . . . . IsIncludeForms property . . . . . IsIncludeFormulas property . . . . Source property . . . . . . . . Views property . . . . . . . . . remove method . . . . . . . . save method. . . . . . . . . . RichTextDoclink class. . . . . . . . Containment . . . . . . . . . Properties . . . . . . . . . . Methods . . . . . . . . . . . Access . . . . . . . . . . . . Usage . . . . . . . . . . . . Examples: RichTextDoclink class . . . DBReplicaID property . . . . . . DisplayComment property . . . . . DocUnID property . . . . . . . HotSpotText property . . . . . . HotSpotTextStyle property . . . . . ServerHint property . . . . . . . ViewUnID property . . . . . . . remove method . . . . . . . . setHotSpotTextStyle method . . . . RichTextItem class . . . . . . . . . Syntax . . . . . . . . . . . . Base class . . . . . . . . . . Containment . . . . . . . . . Property . . . . . . . . . . . Methods . . . . . . . . . . . Creation . . . . . . . . . . . Access . . . . . . . . . . . . Examples: RichTextItem class . . . . EmbeddedObjects property . . . . . addNewLine method . . . . . . . addPageBreak method . . . . . . addTab method. . . . . . . . . appendDocLink method . . . . . . appendParagraphStyle method . . .
xii
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
823 824 825 826 826 827 828 829 830 830 831 831 831 832 832 832 832 832 832 834 835 836 837 838 839 840 841 842 843 844 845 845 845 845 846 846 846 846 847 848 849 851 852 853 854 855 856 856 856 856 856 857 858 859 859 860 861 862 862 863 864
Programming Guide, Volume 3: Java/CORBA Classes
appendRTItem method . . . . . . appendStyle method . . . . . . . appendTable method . . . . . . . appendText method . . . . . . . beginInsert method . . . . . . . beginSection method . . . . . . . compact method . . . . . . . . createNavigator method . . . . . . createRange method . . . . . . . embedObject method . . . . . . . endInsert method . . . . . . . . endSection method . . . . . . . getEmbeddedObject method . . . . getFormattedText method . . . . . getNotesFont method. . . . . . . getUnformattedText method . . . . update method . . . . . . . . . RichTextNavigator class . . . . . . . Containment . . . . . . . . . Methods . . . . . . . . . . . Creation . . . . . . . . . . . Usage . . . . . . . . . . . . Examples: RichTextNavigator class . . Clone method . . . . . . . . . findFirstElement method . . . . . findFirstString method . . . . . . findLastElement method . . . . . findNextElement method . . . . . findNextString method . . . . . . findNthElement method . . . . . . getElement method . . . . . . . getFirstElement method . . . . . . getLastElement method . . . . . . getNextElement method . . . . . . getNthElement method . . . . . . setCharOffset method . . . . . . setPosition method . . . . . . . setPositionAtEnd method . . . . . RichTextParagraphStyle class . . . . . Syntax . . . . . . . . . . . . Containment . . . . . . . . . Properties . . . . . . . . . . Methods . . . . . . . . . . . Creation and access . . . . . . . Examples: RichTextParagraphStyle class Alignment property . . . . . . . FirstLineLeftMargin property . . . . InterLineSpacing property . . . . . LeftMargin property . . . . . . . Pagination property . . . . . . . RightMargin property . . . . . . SpacingAbove property . . . . . . SpacingBelow property . . . . . . Tabs property . . . . . . . . . clearAllTabs method . . . . . . . setTab method . . . . . . . . . setTabs method . . . . . . . . . RichTextRange class . . . . . . . . Containment . . . . . . . . . Properties . . . . . . . . . . Methods . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
865 866 866 870 870 872 873 874 875 876 878 879 879 880 882 883 884 885 885 885 885 886 886 887 887 889 890 891 892 893 895 896 897 898 900 901 902 903 903 903 903 903 904 904 904 905 906 906 907 907 908 908 909 909 910 910 911 912 912 912 912
Creation . . . . . . . . . . . . . Examples: RichTextRange class . . . . . Navigator property . . . . . . . . . Style property . . . . . . . . . . . TextParagraph property . . . . . . . . TextRun property . . . . . . . . . . Type property . . . . . . . . . . . Clone method . . . . . . . . . . . findandReplace method . . . . . . . . remove method . . . . . . . . . . reset method . . . . . . . . . . . setBegin method . . . . . . . . . . setEnd method . . . . . . . . . . . setStyle method . . . . . . . . . . RichTextSection class . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Methods . . . . . . . . . . . . . Access . . . . . . . . . . . . . . Examples: RichTextSection class . . . . . BarColor property . . . . . . . . . . IsExpanded property . . . . . . . . . Title property . . . . . . . . . . . TitleStyle property . . . . . . . . . . remove method . . . . . . . . . . setBarColor method . . . . . . . . . setTitleStyle method . . . . . . . . . RichTextStyle class . . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Methods . . . . . . . . . . . . . Creation and access . . . . . . . . . Examples: RichTextStyle class, and Bold, Color, Effects, Font, FontSize, Italic, Parent, StrikeThrough, and Underline properties . . Bold property . . . . . . . . . . . Color property . . . . . . . . . . . Effects property . . . . . . . . . . Font property . . . . . . . . . . . FontSize property . . . . . . . . . . IsDefault property . . . . . . . . . . Italic property . . . . . . . . . . . Parent property. . . . . . . . . . . PassThruHTML property . . . . . . . StrikeThrough property . . . . . . . . Underline property . . . . . . . . . RichTextTab class . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Methods . . . . . . . . . . . . . Creation and access . . . . . . . . . Examples: RichTextTab class . . . . . . Position property . . . . . . . . . . Type property . . . . . . . . . . . clear method . . . . . . . . . . . RichTextTable class . . . . . . . . . . Containment . . . . . . . . . . . Properties . . . . . . . . . . . . Methods . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
912 912 914 915 916 917 918 920 921 923 924 924 925 926 927 927 927 928 928 928 928 930 931 932 933 934 935 936 936 936 936 936 936
. . . . . . . . . . . . . . . . . . . . . . . . . .
937 938 938 939 939 940 940 942 942 942 943 943 944 944 944 944 944 944 944 945 946 946 947 947 947 947
Creation and access . . . . . . Examples: RichTextTable class . . . AlternateColor property . . . . . Color property . . . . . . . . ColumnCount property . . . . . IsRightToLeft property . . . . . RowCount property . . . . . . RowLabels property . . . . . . Style property . . . . . . . . addRow method . . . . . . . remove method . . . . . . . removeRow method . . . . . . setAlternateColor method . . . . setColor method . . . . . . . Session class . . . . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . Properties . . . . . . . . . Methods . . . . . . . . . . Creation and access . . . . . . Usage . . . . . . . . . . . Examples: Session class . . . . . AddressBooks property . . . . . AgentContext property . . . . . CommonUserName property . . . HttpURL property . . . . . . . International property . . . . . IsConvertMIME property . . . . IsOnServer property . . . . . . IsValid property . . . . . . . NotesVersion property . . . . . OrgDirectoryPath property . . . . Platform property . . . . . . . ServerName property. . . . . . UserGroupNameList property . . . UserName property . . . . . . UserNameList property . . . . . UserNameObject property . . . . createAdministrationProcess method createColorObject method . . . . createDateRange method . . . . createDateTime method . . . . . createDxlExporter method . . . . createDxlImporter method . . . . createLog method . . . . . . . createName method . . . . . . createNewsletter method . . . . createRegistration method . . . . createRichTextParagraphStyle method createRichTextStyle method . . . . createStream method . . . . . . evaluate method . . . . . . . freeTimeSearch method . . . . . getDatabase method . . . . . . getDbDirectory method . . . . . getEnvironmentString method . . . getEnvironmentValue method . . . getSessionToken method. . . . . getURLDatabase method . . . . getUserPolicySettings method . . . hashPassword method . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
947 948 949 949 950 950 951 951 951 952 953 953 954 954 955 955 955 955 955 957 957 957 958 959 959 960 961 961 962 963 963 964 965 966 966 967 968 969 969 970 970 971 972 972 973 973 974 974 975 975 975 976 977 979 980 981 982 984 984 985 986
xiii
resolve method . . . . . . . sendConsoleCommand method . setEnvironmentVar method . . . verifyPassword method . . . . Stream class . . . . . . . . . Syntax . . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods . . . . . . . . . Creation and access . . . . . Usage . . . . . . . . . . Examples: Stream class . . . . Bytes property . . . . . . . Charset property . . . . . . IsEOS property . . . . . . . IsReadOnly property . . . . . Position property . . . . . . close method . . . . . . . getContents method . . . . . open method . . . . . . . read method . . . . . . . readText method . . . . . . setContents method . . . . . truncate method . . . . . . write method . . . . . . . writeText method . . . . . View class . . . . . . . . . Syntax . . . . . . . . . Containment . . . . . . . Properties . . . . . . . . Methods. . . . . . . . . Access . . . . . . . . . Usage . . . . . . . . . Language cross-reference . . . Examples: View class . . . . Aliases property . . . . . . AllEntries property . . . . . BackgroundColor property . . ColumnCount property . . . ColumnNames property . . . Columns property . . . . . Created property . . . . . . EntryCount property . . . . HeaderLines property . . . . HttpURL property . . . . . IsAutoUpdate property . . . . IsCalendar property . . . . . IsCategorized property . . . . IsConflict property . . . . . IsDefaultView property . . . . IsFolder property . . . . . . IsHierarchical property . . . . IsModified property . . . . . IsPrivate property . . . . . IsProhibitDesignRefresh property IsProtectReaders property . . . LastModified property . . . . LockHolders property . . . . Name property . . . . . . NotesURL property . . . . . Parent property . . . . . .
xiv
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. 988 . 990 . 991 . 993 . 994 . 994 . 994 . 994 . 994 . 995 . 995 . 995 . 996 . 997 . 998 . 999 . 1000 . 1001 . 1002 . 1003 . 1006 . 1008 . 1010 . 1011 . 1012 . 1013 . 1015 . 1015 . 1015 . 1015 . 1016 . 1017 . 1017 . 1018 . 1018 . 1019 . 1020 . 1021 . 1023 . 1024 . 1024 . 1025 . 1026 . 1026 . 1027 . 1028 . 1030 . 1031 . 1031 . 1032 . 1033 . 1034 . 1034 . 1035 . 1036 . 1036 . 1037 . 1038 . 1039 . 1040 . 1041
Programming Guide, Volume 3: Java/CORBA Classes
Readers property . . . . . . . . . RowLines property . . . . . . . . SelectionFormula property . . . . . Spacing property . . . . . . . . . TopLevelEntryCount property . . . . UniversalID property . . . . . . . ViewInheritedName property . . . . clear method . . . . . . . . . . copyColumn method . . . . . . . createColumn method . . . . . . . createViewNav method . . . . . . . createViewNavFrom method . . . . . createViewNavFromCategory method . . createViewNavFromChildren method . . createViewNavFromDescendants method . createViewNavMaxLevel method . . . FTSearch method . . . . . . . . . getAllDocumentsByKey method . . . . getAllEntriesByKey method . . . . . getChild method . . . . . . . . . getColumn method . . . . . . . . getDocumentByKey method . . . . . getEntryByKey method . . . . . . . getFirstDocument method . . . . . . getLastDocument method . . . . . . getNextDocument method. . . . . . getNextSibling method . . . . . . . getNthDocument method . . . . . . getParentDocument method . . . . . getPrevDocument method . . . . . . getPrevSibling method . . . . . . . lock method . . . . . . . . . . lockProvisional method . . . . . . refresh method . . . . . . . . . remove method . . . . . . . . . removeColumn method . . . . . . setAliases method . . . . . . . . unlock method . . . . . . . . . ViewColumn class . . . . . . . . . Syntax . . . . . . . . . . . . Containment . . . . . . . . . . Properties . . . . . . . . . . . Methods. . . . . . . . . . . . Access . . . . . . . . . . . . Examples: ViewColumn class . . . . . Alignment property . . . . . . . . DateFmt property . . . . . . . . FontColor property . . . . . . . . FontFace property . . . . . . . . FontPointSize property . . . . . . . FontStyle property . . . . . . . . Formula property . . . . . . . . HeaderAlignment property . . . . . HeaderFontColor property . . . . . HeaderFontFace property . . . . . . HeaderFontPointSize property . . . . HeaderFontStyle property . . . . . . IsAccentSensitiveSort property . . . . IsCaseSensitiveSort property . . . . . IsCategory property . . . . . . . . IsField property . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1042 1043 1043 1044 1045 1046 1046 1047 1048 1049 1050 1051 1052 1054 1055 1056 1057 1059 1061 1063 1064 1065 1066 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1079 1080 1081 1082 1083 1084 1084 1084 1084 1086 1086 1086 1087 1088 1089 1091 1092 1093 1095 1096 1097 1098 1099 1100 1102 1103 1104 1105
IsFontBold property . . . . . . . IsFontItalic property . . . . . . . IsFontStrikethrough property . . . . IsFontUnderline property . . . . . IsFormula property . . . . . . . IsHeaderFontBold property . . . . IsHeaderFontItalic property . . . . IsHeaderFontStrikethrough property . IsHeaderFontUnderline property . . IsHidden property . . . . . . . IsHideDetail property . . . . . . IsIcon property . . . . . . . . IsNumberAttribParens property . . . IsNumberAttribPercent property. . . IsNumberAttribPunctuated property . IsResize property . . . . . . . . IsResortAscending property . . . . IsResortDescending property . . . . IsResortToView property . . . . . IsResponse property . . . . . . . IsSecondaryResort property . . . . IsSecondaryResortDescending property IsShowTwistie property. . . . . . IsSortDescending property . . . . IsSorted property . . . . . . . . ItemName property . . . . . . . ListSep property . . . . . . . . NumberAttrib property. . . . . . NumberDigits property. . . . . . NumberFormat property . . . . . Parent property . . . . . . . . Position property . . . . . . . ResortToViewName property . . . . SecondaryResortColumnIndex property TimeDateFmt property . . . . . . TimeFmt property . . . . . . . TimeZoneFmt property . . . . . . Title property . . . . . . . . . Width property . . . . . . . . ViewEntry class . . . . . . . . . Syntax . . . . . . . . . . . Containment . . . . . . . . . Properties . . . . . . . . . . Methods . . . . . . . . . . . Access . . . . . . . . . . . Usage . . . . . . . . . . . Examples: ViewEntry class . . . . ChildCount property . . . . . . ColumnIndentLevel property . . . . ColumnValues property . . . . . DescendantCount property . . . . Document property . . . . . . . FTSearchScore property . . . . . IndentLevel property . . . . . . IsCategory property . . . . . . . IsConflict property . . . . . . . IsDocument property . . . . . . IsTotal property . . . . . . . . IsValid property . . . . . . . . NoteID property . . . . . . . . Parent property . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1106 1107 1108 1108 1109 1110 1111 1112 1113 1114 1115 1116 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1133 1134 1135 1135 1136 1137 1139 1140 1141 1142 1143 1144 1144 1144 1144 1144 1145 1145 1145 1146 1146 1146 1147 1148 1148 1148 1149 1149 1150 1150 1150 1151 1151
SiblingCount property . . . . . . . . . UniversalID property . . . . . . . . . getPosition method . . . . . . . . . . ViewEntryCollection class . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . . Properties . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . Access . . . . . . . . . . . . . . Examples: ViewEntryCollection class, and Count and Parent properties . . . . . . . Count property . . . . . . . . . . . Parent property . . . . . . . . . . . Query property . . . . . . . . . . . addEntry method. . . . . . . . . . . deleteEntry method . . . . . . . . . . FTSearch method . . . . . . . . . . . getEntry method . . . . . . . . . . . getFirstEntry method . . . . . . . . . getLastEntry method . . . . . . . . . getNextEntry method . . . . . . . . . getNthEntry method . . . . . . . . . getPrevEntry method . . . . . . . . . putAllInFolder method . . . . . . . . . removeAll method . . . . . . . . . . removeAllFromFolder method . . . . . . stampAll method . . . . . . . . . . . updateAll method . . . . . . . . . . ViewNavigator class . . . . . . . . . . . Syntax . . . . . . . . . . . . . . Containment . . . . . . . . . . . . Properties . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . Creation . . . . . . . . . . . . . . Usage . . . . . . . . . . . . . . Examples: ViewNavigator class and CacheSize, MaxLevel, and ParentView properties . . . . CacheSize property . . . . . . . . . . Count property . . . . . . . . . . . MaxLevel property . . . . . . . . . . ParentView property . . . . . . . . . getChild method . . . . . . . . . . . getCurrent method . . . . . . . . . . getFirst method . . . . . . . . . . . getFirstDocument method . . . . . . . . getLast method . . . . . . . . . . . getLastDocument method . . . . . . . . getNext method . . . . . . . . . . . getNextCategory method . . . . . . . . getNextDocument method . . . . . . . . getNextSibling method . . . . . . . . . getNth method . . . . . . . . . . . getParent method . . . . . . . . . . getPos method . . . . . . . . . . . getPrev method . . . . . . . . . . . getPrevCategory method . . . . . . . . getPrevDocument method . . . . . . . . getPrevSibling method . . . . . . . . . gotoChild method . . . . . . . . . . gotoEntry method . . . . . . . . . . gotoFirst method . . . . . . . . . . . Contents
1151 1152 1152 1153 1153 1153 1153 1153 1154 1154 1154 1155 1155 1155 1156 1157 1159 1159 1161 1162 1162 1163 1163 1164 1165 1166 1167 1167 1167 1167 1168 1168 1169 1169 1170 1170 1171 1172 1172 1172 1174 1175 1176 1177 1178 1179 1179 1180 1181 1181 1182 1183 1184 1184 1185 1185 1186 1188 1189
xv
gotoFirstDocument method gotoLast method . . . . gotoLastDocument method gotoNext method . . . . gotoNextCategory method. gotoNextDocument method gotoNextSibling method . gotoParent method . . .
xvi
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
1190 1190 1191 1192 1193 1193 1194 1194
Programming Guide, Volume 3: Java/CORBA Classes
gotoPos method . . . . gotoPrev method . . . . gotoPrevCategory method . gotoPrevDocument method gotoPrevSibling method .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
1195 1195 1196 1196 1197
Index . . . . . . . . . . . . . . 1199
Chapter 1. Java Classes Coding Guidelines These are guidelines for writing Java programs using the Domino Objects. See ″Java Classes A-Z″ for a reference.
Running a Java program You can call the Domino Objects from a Java program by importing the lotus.domino package. The program can be coded as an application, a Domino agent, an applet, or a servlet. Local calls access run-time code on the local computer, which must have Domino installed. CORBA-based remote (IIOP) calls access run-time code from a remote Domino server; in this case, the local computer need not have Domino installed. Compilation must be on a computer with Domino Designer installed. Note: Notes/Domino Release 7 supports the Sun Java(TM) 2 Platform, Technology Edition, v 1.4.2. To avoid incompatibilities: do not run Java agents compiled under Release 7 on earlier Domino servers or Notes clients; do not use Release 7 Java archives (Notes.jar, NCSO.jar, domtags.jar) on Java platforms earler than v. 1.4.2. Note: The lotus.domino package has the same content as the Release 4.6 lotus.notes package plus new classes, methods, and other enhancements. The Release 4.6 lotus.notes package continues to be supported for backward compatibility only; it does not contain the new classes, methods, and other enhancements.
Requirements Server requirements CORBA-based remote (IIOP) calls require access to a Domino server. The server tasks HTTP and DIIOP must be running. Ensure that the server notes.ini file contains the following line: ServerTasks=,http,diiop
Or you can start the tasks later with the load console command. Note: The JavaMaxHeapsize should not be decreased below a value of 64M, or a runtime error will occur when attempting to execute nhttp.exe. If a value for JavaMaxHeapsize is not set in the server notes.ini file, a value of 64M will be used. The server document in the Domino Directory (under Server\Servers) must permit and restrict remote calls as desired. Right-click on a field description to display an extended description. v Under Security: – Under Server Access, fill in ″Access server,″ ″Not access server,″ ″Create new databases,″ and ″Create replica databases″ as desired. – Under Programmability Restrictions, fill in ″Run unrestricted methods and operations″ and ″Run restricted LotusScript Java agents″ as desired. These fields apply to all programmable interfaces and must be filled in for remote access. Note: These settings are new with Release 6. – Under Internet Access - For ″Internet authentication,″ specify a more inclusive or less inclusive view for validating user names. Note: This verification is new for Release 5.0.1.
1
v Under Ports: – Under Internet Ports - For ″IIOP,″ indicate whether access is permitted by name and password, and whether anonymous access is allowed. v Under Internet Protocols: – Under HTTP R5 - For ″Basics,″ indicate whether HTTP clients can browse databases. A ″no″ specification disallows DbDirectory.getFirstDatabase for the database. Note: This verification is new for Release 5.0.1. – Under IIOP, specify the number of threads to be allocated for handling remote calls. Note: This restriction does not apply as of Release 6. A server refreshes its cache of security options approximately every half hour. The console command ″tell diiop refresh″ forces an immediate refresh. SSL security for CORBA-based Domino Object applications/applets builds on the Web Server SSL security. You must first set up the Web server security using the ″Domino R5 Certificate Authority″ application.
Designer requirements Compilation of a Java program using the lotus.domino package requires installation of Domino Designer Release 5 or greater. For stand-alone applications, include Notes.jar from the Notes program directory and domino\java\NCSO.jar or domino\java\NCSO.cab from the Notes data directory in the classpath. For example: set CLASSPATH=.;c:\notes\data\domino\java\NCSO.jar;c:\notes\Notes.jar
Notes.jar contains the high-level lotus.domino package, the lotus.domino.local package for local calls, and the old lotus.notes package. The NCSO archive contains the high-level lotus.domino package and the lotus.domino.cso package for remote calls. Strictly, you do not need the NCSO archive if you are not compiling remote calls and you do not need Notes.jar if you are not compiling local calls or old calls. The two NCSO archives have identical content but differ in the archiving technique: v NCSO.jar uses the JDK JAR utility with compression. v NCSO.cab uses the Microsoft CABARC utility. Note: Earlier releases used NCSO.jar (uncompressed) and NCSOC.jar (compressed). Your class code must import the high-level lotus.domino package: import lotus.domino.*;
Run-time requirements A computer running a Java application that makes local Domino calls must contain Domino Server, Domino Designer, or Notes Client, and must include Notes.jar in the classpath. A computer running a Java application that makes remote Domino calls need not contain Domino or Notes, but must contain one of the NCSO archives and must include it in the classpath. A computer running a Domino agent that makes Domino calls must include Notes.jar in the classpath. A computer running an applet that makes Domino calls needs no Domino software or classpath assignments. The applet must be loaded from a computer containing a Domino server.
2
Programming Guide, Volume 3: Java/CORBA Classes
Note: Do not use NCSOW.jar in the classpath for executing remote (IIOP) calls in a WebSphere® environment. NCSOW.jar is no longer kitted as it was starting with Release 5.0.4. You can continue to run programs that use NCSOW.jar on R5 servers, but not on Release 6 servers. The NCSO archives work with both R5 and Release 6 servers.
Calling the lotus.domino package The following guidelines apply to Java programs calling into the lotus.domino package: v An application or servlet that makes local calls uses the NotesThread class, which extends java.lang.Thread. You can extend NotesThread, implement the Runnable interface, or use the static NotesThread methods sinitThread() and stermThread(). If you extend NotesThread, the entry point to the functional code must be public void runNotes(). If you implement Runnable, the entry point must be public void run(). If you use the static NotesThread methods, be sure to call stermThread exactly one time for each call to sinitThread. An application that makes remote calls does not use the NotesThread class. See the examples for clarification. Each thread of an application making local calls must initialize a NotesThread object. This includes AWT threads that access the Domino Objects. Listener threads must use the static methods because they cannot inherit from NotesThread. Memory management is a consideration for long running programs and programs that create a large number of objects. See the recycle method and ″Multithreading issues″ under the NotesThread class. v An agent extends the AgentBase class, which extends the NotesThread class. The class that contains the agent code must be public. The entry point to the functional code must be public void NotesMain(). See the examples for clarification. v An applet extends AppletBase and puts its functional code in the methods notesAppletInit(), notesAppletStart(), and notesAppletStop(). You do not have to distinguish between local and remote access in the main code. AppletBase makes local calls if the applet is running through the Notes client and remote calls if it is running through a browser. Remote calls go to the Domino server on the computer that loaded the applet. If an applet creates a thread containing Domino calls, the thread code must use NotesThread for local Domino calls but not remote (IIOP) calls. Use AppletBase.isLocal() to determine the environment. Use NotesThread.sinitThread for initialization and NotesThread.stermThread for termination. Thread creation includes handling AWT events. See the examples for clarification. For applets stored in a Domino database, ″Applet uses Notes CORBA classes″ under Java Applet - Java Applet Properties must be checked. v The Session class is the root of the Domino back-end object containment hierarchy. For applications making local calls, use the method NotesFactory createSession(), createSessionWithFullAccess(), createSession(null, null, String pwd), createSessionWithFullAccess(String pwd), createSession(null, String user, String pwd), or createSession(null, ″″, ″″) to create a Session object. For applications making remote calls, use the method createSession(String host, ″″, ″″) or createSession(String host, String user, String pwd). For agents, use the method AgentBase.getSession(). For applets, use the method AppletBase.openSession() or openSession(String user, String pwd) and closeSession(Session session). See the examples for clarification. The user and pwd parameters of NotesFactory.createSession and AppletBase.openSession must be a user name and Internet password in the Domino Directory on the server being accessed. If a name and password are not specified, anonymous access must be permitted by the server. For Single Sign-on to a Domino or WebSphere server, use createSession(String host, String token), createSession(String host, org.omg.SecurityLevel2.Credentials token), createSession(String host, null), or createSession(String host, HttpServletRequest request). Note: Single Sign-on is new with Release 5.0.5. To enable SSL (Secure Sockets Layer), use NotesFactory.createSession(String host, String args[], String user, String pwd) and specify ″-ORBEnableSSLSecurity″ for args(0). Chapter 1. Java Classes Coding Guidelines
3
v For foreground agents, System.out and System.err output goes to the Java debug console. For locally scheduled agents, System.out and System.err output goes to the Domino log. v For output to Web browsers from agents (but not applets), you must assign a java.io.PrintWriter object with the getAgentOutput() method of AgentBase, and write using the println method of the PrintWriter object. This method works for output to Notes clients as well. See the examples for clarification. v System.exit must not be used to terminate a program using the NotesThread class (and by extension the AgentBase class). In an agent, System.exit throws SecurityException. In an application, System.exit may cause corruption problems.
Using the lotus.domino classes The lotus.domino classes allow you to access named databases, views, documents, and other back-end objects. The following lotus.domino classes are for direct, public use: v ACL represents a collection of all the access control list entries for a database. v ACLEntry represents a single entry in an access control list. v AdministrationProcess represents the administration process. v Agent represents the attributes of an agent. v AgentContext represents the context of the current agent if the program is running as an agent. v ColorObject represents a color. Database represents a Domino database. DateRange represents a range of dates and times. DateTime represents a Domino date-time. DbDirectory represents the database files on a server or the local computer. Document represents a document in a database. DocumentCollection represents a collection of documents. DXLExporter represents the conversion of Domino data to DXL (Domino XML). DXLImporter represents the conversion of DXL (Domino XML) to Domino data. EmbeddedObject represents embedded objects, links, and file attachments. Form represents a form in a database. International represents the international settings in the operating system. Item represents an item of data in a document. Log represents actions and errors that occur during execution of a script. MIMEEntity represents an item of type MIME (Multipurpose Internet Mail Extensions). MIMEHeader represents a MIME header. Name represents a user or server name. Newsletter represents a summary document that contains information from, or links to, several other documents. v NoteCollection represents a collection of Domino design and data elements in a database. v Outline represents an outline. v v v v v v v v v v v v v v v v v
v v v v
OutlineEntry represents an entry in an outline. Registration represents the creation or administration of an ID file. Replication represents the replication attributes of a Domino database. ReplicationEntry represents the replication settings for a pair of servers in a database.
v v v v
RichTextDoclink represents a doclink in a rich text item. RichTextItem represents items that contain rich text. RichTextNavigator represents a means of navigation in a rich text item. RichTextParagraphStyle represents rich text paragraph style attributes.
4
Programming Guide, Volume 3: Java/CORBA Classes
v v v v v v v v v v v v
RichTextRange represents a range of elements in a rich text item. RichTextSection represents a collapsible section in a rich text item. RichTextStyle represents rich text style attributes. RichTextTab represents rich text tab attributes. RichTextTable represents a table in a rich text item. Session represents the context of the current program. This class is the root of the Domino database objects. Stream represents a stream of binary or character data. View represents a view or folder in a database. ViewColumn represents a column of a view. ViewEntry represents an entry in a view. ViewEntryCollection represents a collection of view entries. ViewNavigator represents a view navigator.
Examples: Running a Java program The following examples demonstrate the minimal code needed for a Java program that uses the Domino classes. The examples instantiate a Session object and print the String output of its getPlatform method (Platform property). 1. This is an application that makes local calls and extends the NotesThread class: import lotus.domino.*; public class platform1 extends NotesThread { public static void main(String argv[]) { platform1 t = new platform1(); t.start(); } public void runNotes() { try { Session s = NotesFactory.createSession(); // To bypass Readers fields restrictions // Session s = NotesFactory.createSessionWithFullAccess(); String p = s.getPlatform(); System.out.println("Platform = " + p); } catch (Exception e) { e.printStackTrace(); } } }
2. This is an application that makes local calls and implements the Runnable interface: import lotus.domino.*; public class platform2 implements Runnable { public static void main(String argv[]) { platform2 t = new platform2(); NotesThread nt = new NotesThread((Runnable)t); nt.start(); } public void run() { try { Session s = NotesFactory.createSession(); Chapter 1. Java Classes Coding Guidelines
5
String p = s.getPlatform(); System.out.println("Platform = " + p); } catch (Exception e) { e.printStackTrace(); } } }
3. This is an application that makes local calls and uses the static NotesThread methods: import lotus.domino.*; public class platform3 { public static void main(String argv[]) { try { NotesThread.sinitThread(); Session s = NotesFactory.createSession(); String p = s.getPlatform(); System.out.println("Platform = " + p); } catch(Exception e) { e.printStackTrace(); } finally { NotesThread.stermThread(); } } }
4. This is an agent program where the code is entered through the Domino Designer UI. The UI generates everything in the example except the two lines following // (Your code goes here). import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String p = session.getPlatform(); System.out.println("Platform = " + p); } catch(Exception e) { e.printStackTrace(); } } }
5. This is an agent program where the code is imported into Domino Designer: import lotus.domino.*; public class platform4 extends AgentBase { public void NotesMain() { try { Session s = getSession(); String p = s.getPlatform(); System.out.println("Platform =" + p); } catch (Exception e) {
6
Programming Guide, Volume 3: Java/CORBA Classes
e.printStackTrace(); } } }
6. This is an agent program with print output that can be seen by a browser: import lotus.domino.*; import java.io.PrintWriter; public class platform5 extends AgentBase { public void NotesMain() { try { Session s = getSession(); String p = s.getPlatform(); PrintWriter pw = getAgentOutput(); pw.println("Platform = " + p); } catch (Exception e) { e.printStackTrace(); } } }
7. This example demonstrates an application that makes remote (IIOP) calls. The example requires the user to enter the name of the host Domino server and optionally a user name and password. If a user name and password are not supplied, the server must allow anonymous access. import lotus.domino.*; public class platform6 implements Runnable { String host=null, user="", pwd=""; public static void main(String argv[]) { if(argv.length= 2) user = argv[1]; if(argv.length >= 3) pwd = argv[2]; } public void run() { try { Session s = NotesFactory.createSession( host, user, pwd); String p = s.getPlatform(); System.out.println("Platform = " + p); } catch (Exception e) { e.printStackTrace(); } } }
Chapter 1. Java Classes Coding Guidelines
7
8. To enable SSL in the previous application example, replace: Session s = NotesFactory.createSession( host, user, pwd);
With: String args[] = new String[1]; args[0] = "-ORBEnableSSLSecurity"; Session s = NotesFactory.createSession( host, args, user, pwd);
TrustedCerts.class (typically in domino\java in the data directory of the server) must be on the classpath. This file is generated by the DIIOP task when it starts. In order to enable SSL for an applet, you should also enable the attribute ″Applet uses CORBA SSL Security″ in the ″Java Applet Properties″ dialog. 9. This example demonstrates an applet that makes Domino calls. AppletBase makes the calls locally if possible, remotely otherwise. import lotus.domino.*; public class foo extends AppletBase { java.awt.TextArea ta; public void notesAppletInit() { setLayout(null); setSize(100,100); ta = new java.awt.TextArea(); ta.setBounds(0,0,98,98); add(ta); ta.setEditable(false); setVisible(true); } public void notesAppletStart() { Session s = null; try { // Can also do openSession(user, pwd) s = this.openSession(); if (s == null) { //not able to make connection, warn user ta.append("Unable to create a session with the server"); return; } String p = s.getPlatform(); ta.append("Platform = " + p); } catch(Exception e) { e.printStackTrace(); } finally { try {this.closeSession(s);} catch(NotesException e) {e.printStackTrace();} } } }
10. This example demonstrates an applet that makes Domino calls in code that responds to an AWT event. Because the AWT event handler is a separate thread, you must explicitly initialize and terminate a Domino session if the code is running locally, and must not if the code is running remotely (IIOP). import lotus.domino.*; import java.awt.*; import java.awt.event.*; public class awt extends AppletBase implements ActionListener
8
Programming Guide, Volume 3: Java/CORBA Classes
{ private Button b; private String text = ""; Graphics g; public java.awt.TextArea ta; public Session s; public void notesAppletInit() { g = getGraphics(); b = new Button("Get user common name"); add(b); ta = new java.awt.TextArea(15, 30); add(ta); setVisible(true); } public void paint(Graphics g) { b.setLocation(0, 0); ta.setLocation(200, 0); } public void notesAppletStart() { try { s = this.getSession(); b.addActionListener(this); } catch(NotesException e) { text = e.id + " " + e.text; } catch(Exception e) { e.printStackTrace(); } } public void actionPerformed(ActionEvent e) { text = ""; getTheName(); ta.append(text + "\n"); } public void getTheName() { try { if (isNotesLocal()) { NotesThread.sinitThread(); } text = "User " + s.getCommonUserName(); } catch(NotesException e) { text = e.id + " " + e.text; } catch(Exception e) { e.printStackTrace(); } finally { Chapter 1. Java Classes Coding Guidelines
9
if (isNotesLocal()) { NotesThread.stermThread(); } } } }
11. This Domino agent gets a token for Single Sign-on and creates a remote (IIOP) session to another server based on the token. The agent runs on the server containing the token. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Session s2 = NotesFactory.createSession("test5.irish.com", session.getSessionToken()); System.out.println("remote session name = " + s2.getUserName()); } catch(Exception e) { e.printStackTrace(); } } }
12. This Domino agent gets a token for Single Sign-on and creates a remote (IIOP) session to a server based on the token. The agent runs a Notes client. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Session s2 = NotesFactory.createSession("test5.irish.com", session.getSessionToken("test5.irish.com")); System.out.println("remote session name = " + s2.getUserName()); } catch(Exception e) { e.printStackTrace(); } } }
13. This servlet gets a token for Single Sign-on from the LtpaToken cookie through HttpServletRequest and creates a session based on the token. import import import import import import import
java.lang.*; java.lang.reflect.*; java.util.*; java.io.*; javax.servlet.*; javax.servlet.http.*; lotus.domino.*;
public class Cookies extends HttpServlet { private void respond(HttpServletResponse response, String entity) throws IOException { response.setContentType("text/plain"); if (entity == null) { response.setContentLength(0);} else { response.setContentLength(entity.length() + 1);
10
Programming Guide, Volume 3: Java/CORBA Classes
ServletOutputStream out = response.getOutputStream(); out.println(entity); } } public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String s1 = ""; Cookie[] cookies = null; String sessionToken = null; try { cookies = request.getCookies(); } catch (Exception e) { respond(response,"Exception from request.getCookies(): " + e.toString()); return; } if (cookies == null) { s1 = "No cookies received"; } else { for (int i = 0; i < cookies.length; i++) { if (cookies[i].getName().equals("LtpaToken")) { sessionToken = cookies[i].getValue(); } } } if (sessionToken != null) { try { NotesThread.sinitThread(); Session session = NotesFactory.createSession(null, sessionToken); s1 += "\n" + "Server: " + session.getServerName(); s1 += "\n" + "IsOnServer: " + session.isOnServer(); s1 += "\n" + "CommonUserName: " + session.getCommonUserName(); s1 += "\n" + "UserName: " + session.getUserName(); s1 += "\n" + "NotesVersion: " + session.getNotesVersion(); s1 += "\n" + "Platform: " + session.getPlatform(); NotesThread.stermThread(); } catch (NotesException e) { s1 += "\n" + e.id + e.text; e.printStackTrace(); } } respond(response,s1); } }
14. This application snippet creates a session based on a Credentials object obtained from the WebSphere loginHelper. org.omg.SecurityLevel2.Credentials credentials = loginHelper.request_login("Jane Doe", "", "password", new org.omg.SecurityLevel2.CredentialsHolder(),
Chapter 1. Java Classes Coding Guidelines
11
new org.omg.Security.OpaqueHolder()); Session s = NotesFactory.createSession("test5.iris.com", credentials); System.out.println("Got Session for " + s.getUserName());
15. This WebSphere Enterprise JavaBeans (ERB) application creates a session based on the current Credentials object in the WebSphere environment. import lotus.domino.*; public class HelloBean extends Object implements SessionBean { ... /* See HelloBean.java from Websphere for the complete class code */ /** Returns the greeting. But has been modified to create a remote session to the Domino server. @return The greeting. @exception RemoteException Thrown if the remote method call fails. */ public String getMessage () throws RemoteException { String result = "hello bean "; try { Session s = NotesFactory.createSession("test5.iris.com", null); result = result + " -- Got Session for " + s.getUserName(); } catch (NotesException ne) { result = result + "-- " + ne.text; result = result + "-- failed to get session for user"; } return (String) result + " -- done"; } }
Accessing databases The Database class represents a Domino database and provides access to the constituent views, documents, forms, access control list, and properties. You can: v Access database properties v Locate a database on a server or the local directory v Open a database v Create, compact, remove, and replicate a database v Examine and adjust an access control list v Examine and adjust database replication settings v Access a form v Access an outline
Accessing database properties The following methods access the Database properties: v getACL returns an ACL object representing the access control list of the database. See ″Examining and adjusting an access control list.″ v getACLActivityList returns a Vector of String objects containing the log from the access control list. v getAgents (database must be open) returns a java.util.Vector of Agent objects representing all the agents in the database. See ″Accessing agents.″ v getAllDocuments (database must be open) returns a DocumentCollection object representing all the documents in the database. See ″Collecting all documents and unprocessed documents.″
12
Programming Guide, Volume 3: Java/CORBA Classes
v getCategories returns a String value containing the categories in the database; setCategories (database must be open) sets the database categories to a String value. v getCreated returns a DateTime object representing the date and time the database was created. v getCurrentAccessLevel returns an int value containing the user’s access level to the database. See ″Examining and adjusting an access control list.″ v getDesignTemplateName returns a String value containing the name of the design template, if any. v getFileFormat returns an int value containing the ODS (on-disk structure) version of the database. v getFileName returns a String value containing the database file name. v getFilePath returns a String value containing the database file path. v getFolderRefsEnabled returns true if this database maintains folder references. v getForms returns a java.util.Vector of Form objects representing the forms in the database. See ″Accessing a form.″ v getFTIndexFrequency returns an int value containing the update frequency of a database’s full-text index; setFTIndexFrequency (database must be open) sets the update frequency. v getHTTPURL returns a String value containing the HTTP URL of the database. v isClusterReplication property returns true if cluster replication is in effect for a database on a server in a cluster;setClusterReplication property (database must be open) sets cluster replication. v isConfigurationDirectory property is true if the database is a Configuration Directory database. v isCurrentAccessPublicReader property returns true if the current user has public reader access in the database. v isCurrentAccessPublicWriter property returns true if the current user has public writer access in the database. v isDelayUpdates returns true if server updates are delayed (batched) for better performance; setDelayUpdates (database must be open) batches updates if set to true. v isDirectoryCatalog property returns true if the database is a Directory Catalog. v isFTIndexed returns true if the database is full-text indexed. v isInMultiDbIndexing returns true if a database is set for ″Include in multi-database indexing″; setInMultiDbIndexing (database must be open) sets the database for ″Include in multi-database indexing.″ v isInService returns true if a database on a server in a cluster is accessible; setInService (database must be open) makes the database accessible. v isLink returns true if a database is the target of a link. v isMultiDbSearch returns true if the search index is multi-database. v isOpen returns true if the database is open. v isPendingDelete returns true if a database on a server in a cluster is marked for deletion. v isPrivateAddressBook returns true if the database is a Personal Address Book; valid only through getAddressBooks in Session. v isPublicAddressBook returns true if the database is a Domino Directory; valid only through getAddressBooks in Session. v getLastFixup (database must be open) returns a DateTime object representing the date and time the database was last checked by the Fixup task. v getLastFTIndexed (database must be open) returns a DateTime object representing the date and time the full-text index, if any, was last modified. v getLastModified (database must be open) returns a DateTime object representing the date and time the database was last modified. v getLimitRevisions (database must be open) returns a double value containing the maximum number of entries allowed in the $Revisions field;setLimitRevisions sets the maximum number.
Chapter 1. Java Classes Coding Guidelines
13
v getLimitUpdatedBy (database must be open) returns a double value containing the maximum number of entries allowed in the $UpdatedBy field;setLimitUpdatedBy sets the maximum number. v getListInDbCatalog returns true if the database appears in database catalogs;setListInDbCatalog (database must be open) sets whether the database appears in database catalogs. v getManagers returns a java.util.Vector of String values that contain the names of users that have Manager access to the database. v getMaxSize returns a long value containing the maximum size assigned to a database. v getNotesURL returns a String value containing the Notes URL of a database. v getParent returns a Session object representing the current Domino session. v getPercentUsed (database must be open to get the correct value) returns a double value that contains the percent of the total size of a database that is occupied by real data. v getReplicaID returns a String value containing the database replica ID in hexadecimal. v getReplication returns a Replication object representing the replication information for this database. See below. v getServer returns a String value containing the name of the server on which the database resides, or null for the local directory. v getSize (the database must be open) returns a double value containing the database size, in bytes. v getSizeQuota returns an int value containing the database size quota, if any; setSizeQuota (the database must be open) sets the database size quota to an int value. You must be an administrator to use setSizeQuota. v getSizeWarning returns a long value containing the size warning threshold of the database; setSizeWarning sets the threshold. v getTemplateName returns a String value containing the template name of the database if it is a template. v getTitle returns a String value containing the database title; setTitle (database must be open) sets the title. v getType (database must be open) returns an int value containing the database type. v getUndeleteExpireTime returns an int value containing the number of hours before soft deletions become hard deletions; setUndeleteExpireTime sets the number of hours. v getViews returns a java.util.Vector of View objects representing the named views in the database. See ″Locating a view or folder.″ Use fixup to run the Fixup task on a database. Use createFTIndex and removeFTIndex to create and remove full-text indexes.
Examples: Accessing database properties This application gets the first database in the local directory and prints its database properties. The example demonstrates which properties require that the database be open. import lotus.domino.*; import java.util.Vector; public class accessing extends NotesThread { public static void main(String argv[]) { accessing t = new accessing(); t.start(); } public void runNotes() { try { Session s = NotesFactory.createSession(); DbDirectory Dir = s.getDbDirectory(null);
14
Programming Guide, Volume 3: Java/CORBA Classes
Database db = Dir.getFirstDatabase(Dir.DATABASE); // Database does not have to be open System.out.println ("DATABASE NOT OPEN"); System.out.println ("Title:\t\t\t\t" + db.getTitle()); System.out.println ("FileName:\t\t\t" + db.getFileName()); System.out.println ("FilePath:\t\t\t" + db.getFilePath()); System.out.println ("Server:\t\t\t\t" + db.getServer()); System.out.println ("ReplicaID:\t\t\t" + db.getReplicaID()); System.out.println ("DesignTemplateName:\t\t" + db.getDesignTemplateName()); System.out.println ("TemplateName:\t\t\t" + db.getTemplateName()); System.out.println ("Categories:\t\t\t" + db.getCategories()); System.out.println ("IsOpen:\t\t\t\t" + db.isOpen()); System.out.println ("IsFTIndexed:\t\t\t" + db.isFTIndexed()); System.out.println ("FTIndexFrequencey:\t\t" + db.getFTIndexFrequency()); System.out.println ("IsInMultiDbIndexing:\t\t" + db.isInMultiDbIndexing()); System.out.println ("IsPublicAddressBook:\t\t" + db.isPublicAddressBook()); System.out.println ("IsPrivateAddressBook:\t\t" + db.isPrivateAddressBook()); System.out.println ("IsInService:\t\t\t" + db.isInService()); System.out.println ("IsPendingDelete:\t\t" + db.isPendingDelete()); System.out.println ("DelayUpdates:\t\t\t" + db.isDelayUpdates()); System.out.println ("SizeQuota:\t\t\t" + db.getSizeQuota()); System.out.println ("MaxSize:\t\t\t" + db.getMaxSize()); Session ps = db.getParent(); System.out.println ("Parent platform:\t\t" + ps.getPlatform()); System.out.println ("NotesURL\t\t\t" + db.getNotesURL()); System.out.println ("HTTPURL\t\t\t" + db.getHTTPURL()); // Database must be open ... System.out.println("DATABASE OPEN"); db.open(); // ... to set properties db.setTitle(db.getTitle() + " Redux System.out.println ("Title set to:\t\t\t" + db.getTitle()); if (db.getCategories() == null) db.setCategories("Example databases"); else db.setCategories(db.getCategories() + ";Example databases"); System.out.println ("Categories set to:\t\t" + db.getCategories()); db.setDelayUpdates(true); Chapter 1. Java Classes Coding Guidelines
15
System.out.println ("DelayUpdates set to:\t\t" + db.isDelayUpdates()); db.setSizeQuota(20000000); System.out.println ("SizeQuota set to:\t\t" + db.getSizeQuota()); // ... and to get these properties System.out.println ("Type:\t\t\t\t" + db.getType()); System.out.println ("Created:\t\t\t" + db.getCreated().getLocalTime()); System.out.println ("LastModified:\t\t\t" + db.getLastModified().getLocalTime()); System.out.println ("LastFTIndexed:\t\t\t" + db.getLastFTIndexed().getLocalTime()); System.out.println ("IsMultiDbSearch:\t\t" + db.isMultiDbSearch()); System.out.println ("Size:\t\t\t\t" + (int)db.getSize() + " bytes"); System.out.println ("PercentUsed:\t\t\t" + db.getPercentUsed()); ACL acl = db.getACL(); System.out.println ("ACL UniformAccess:\t\t" + acl.isUniformAccess()); System.out.println ("CurrentAccessLevel:\t\t" + db.getCurrentAccessLevel()); System.out.println ("FolderReferencessEnabled:\t" + db.getFolderReferencesEnabled()); Vector managers = db.getManagers(); System.out.print("Managers:\t\t\t"); for (int i=0; i 0) { System.out.println("Documents " + start + " though " + (start + dc.getCount() - 1)); Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println( "\t" + doc.getItemValueString("Subject")); doc = dc.getNextDocument(doc); } // Get next 8 documents that match query start = start + 8; dc = agentContext.unprocessedFTSearchRange( query, 8, Database.FT_SCORES, Database.FT_FUZZY, start); } } catch(Exception e) { e.printStackTrace(); } } }
unprocessedSearch method Given selection criteria, returns documents in a database that: v The current agent considers to be unprocessed v Meet the selection criteria v Were created or modified since the cutoff date
Defined in AgentContext
Syntax public DocumentCollection unprocessedSearch(String formula, DateTime limit, int maxdocs) throws NotesException
Parameters String formula
A Lotus Domino formula that defines the selection criteria. DateTime limit
A cutoff date. int maxdocs
The maximum number of documents you want returned; 0 means all matching documents.
Chapter 2. Java Classes A-Z
251
Return value DocumentCollection
A collection of documents that are not yet processed, match the selection criteria, and were created or modified after the cutoff date. The collection is sorted by relevance with highest relevance first.
Usage This method is valid only for agents.
How does it work? This method works in two parts: v First, it finds a collection of documents that the agent considers to be ″unprocessed.″ The type of agent determines which documents are considered to be unprocessed. This document collection is identical to that returned by getUnprocessedDocuments. v Second, it conducts a search on the unprocessed documents, and returns a collection of those documents that match the selection criteria and were created or modified since the cutoff date. For example, in an agent that runs on all selected documents in the view, unprocessedSearch searches only the selected documents and returns those that match the selection criteria. In an agent that runs on all new and modified documents since the last run, unprocessedSearch searches only the documents that were not marked by updateProcessedDoc, and returns those that match the selection criteria.
What documents are returned? The following table describes the documents that are returned by unprocessedSearch. Document selection occurs once, before the agent runs. Agent runs on:
unprocessedSearch returns documents that meet all of these requirements:
All documents in database
Meet the search criteria specified in Agent Properties box Meet the formula search critieria specified in this method Meet the cutoff date specified in this method
All new & modified documents
Not processed by this agent with updateProcessedDoc Created or modified since the agent last ran Meet the search criteria specified in Agent Properties box Meet the formula search critieria specified in this method Meet the cutoff date specified in this method
All unread documents in view
Are unread and in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method
All documents in view
Are in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method
252
Programming Guide, Volume 3: Java/CORBA Classes
Agent runs on:
unprocessedSearch returns documents that meet all of these requirements:
All selected documents
Are selected in the view Meet the search criteria specified in Agent Properties box Meet the formula search criteria specified in this method Meet the cutoff date specified in this method
None
Is the current document only
Using updateProcessedDoc For agents that run on new and modified documents, you must use updateProcessedDoc to mark each document as ″processed,″ which ensures that a document gets processed by the agent only once (unless it’s modified again). If you do not call this method for each document, the agent processes the same documents the next time it runs. The updateProcessedDoc method marks a document as processed only for the particular agent from which it is called. Using updateProcessedDoc in one agent has no effect on the documents that another agent processes. In all other agents and view actions, UpdateProcessedDoc has no effect.
Language cross-reference UnprocessedSearch method in LotusScript NotesDatabase class EditSelectByDate @command function in formula language
Examples: unprocessedSearch method This agent searches all or selected documents for documents created after January 1, 1999 that contain ″botany″ in the Subject field, and places them in the ″Botanist’s Delight″ folder. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime date = session.createDateTime("01/01/99"); DocumentCollection dc = agentContext.unprocessedSearch ("@Contains(Subject; \"botany\")", date, 0); Document doc = dc.getFirstDocument(); while (doc != null) { doc.putInFolder("Botanist’s Delight"); agentContext.updateProcessedDoc(doc); System.out.println( doc.getItemValueString("Subject")); doc = dc.getNextDocument(); } } catch(Exception e) { e.printStackTrace(); } } }
updateProcessedDoc method Marks a document as processed by an agent. Chapter 2. Java Classes A-Z
253
Defined in AgentContext
Syntax public void updateProcessedDoc(Document doc) throws NotesException
Parameters Document doc
The document to be marked as processed. Cannot be null.
Usage Use this method in conjunction with getUnprocessedDocuments, unprocessedFTSearch, and unprocessedSearch in an agent that runs on all new and modified documents. This method marks a document so subsequent invocations of the same agent recognize the document as processed. You must explicitly mark a document with this method. No implicit marking occurs in a Java agent. If a marked document is modified, it is unmarked and will be processed by the next invocation of the agent. This method marks a document as processed only for the particular agent from which it is called. Using this method in one agent has no effect on the documents that another agent processes.
Language cross-reference UpdateProcessedDoc method in LotusScript NotesSession class
Examples: updateProcessedDoc method This program is for an agent that runs on newly created and modified documents since the last run. The program gets the unprocessed documents, prints each Subject item, and marks each document as processed. The first time the agent runs, getUnprocessedDocuments returns all of the documents in the database. Thereafter, getUnprocessedDocuments returns those documents that updateProcessedDoc has not touched. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println( doc.getItemValueString("Subject")); agentContext.updateProcessedDoc(doc); doc = dc.getNextDocument(); } } catch(Exception e) { e.printStackTrace(); } } }
254
Programming Guide, Volume 3: Java/CORBA Classes
ColorObject class Represents a color. Note: This class is new with Release 6.5.
Containment Contained by: RichTextSection, RichTextTable, Session
Properties Blue through getBlue Green through getGreen Hue through getHue Luminance through getLuminance NotesColor through getNotesColor and setNotesColor Red through getRed Saturation through getSaturation
Methods setHSL setRGB
Creation To create a ColorObject object, use the createColorObject method of Session.
Usage Domino defines colors numbered 0 through 240, as reflected in the read-write property NotesColor. Each Domino color maps to RGB (red, green, and blue) values in the range 0-255 and HSL (hue, saturation, and luminance) values in the range 0-240, as reflected in the remaining, read-only properties. NotesColor can be used as the value for the following properties: Color in RichTextStyle; BackgroundColor in View; FontColor and HeaderFontColor in ViewColumn. The following table lists the values for the first 16 Domino colors, which are defined by Java constants. See the example for code to generate the values for all 241 colors. Notes
Red
Grn
Blue
Hue
Sat
Lum
Constant
0.00
0.00
0.00
0.00
160.00
0.00
0.00
RichTextStyle.COLOR_BLACK
1.00
255.00
255.00
255.00
160.00
0.00
240.00
RichTextStyle.COLOR_WHITE
2.00
255.00
0.00
0.00
0.00
240.00
120.00
RichTextStyle.COLOR_RED
3.00
0.00
255.00
0.00
80.00
240.00
120.00
RichTextStyle.COLOR_GREEN
4.00
0.00
0.00
255.00
160.00
240.00
120.00
RichTextStyle.COLOR_BLUE
5.00
255.00
0.00
255.00
200.00
240.00
120.00
RichTextStyle.COLOR_MAGENTA
6.00
255.00
255.00
0.00
40.00
240.00
120.00
RichTextStyle.COLOR_YELLOW Chapter 2. Java Classes A-Z
255
Notes
Red
Grn
Blue
Hue
Sat
Lum
Constant
7.00
0.00
255.00
255.00
120.00
240.00
120.00
RichTextStyle.COLOR_CYAN
8.00
128.00
0.00
0.00
0.00
240.00
60.00
RichTextStyle.COLOR_DARK_RED
9.00
0.00
128.00
0.00
80.00
240.00
60.00
RichTextStyle.COLOR_DARK_GREEN
10.00
0.00
0.00
128.00
160.00
240.00
60.00
RichTextStyle.COLOR_DARK_BLUE
11.00
128.00
0.00
128.00
200.00
240.00
60.00
RichTextStyle.COLOR_DARK_MAGENTA
12.00
128.00
128.00
0.00
40.00
240.00
60.00
RichTextStyle.COLOR_DARK_YELLOW
13.00
0.00
128.00
128.00
120.00
240.00
60.00
RichTextStyle.COLOR_DARK_CYAN
14.00
128.00
128.00
128.00
160.00
0.00
120.00
RichTextStyle.COLOR_GRAY
15.00
192.00
192.00
192.00
160.00
0.00
181.00
RichTextStyle.COLOR_LIGHT_GRAY
Examples: ColorObject class This agent builds a rich text item that contains one line for each Domino color. The line identifies the Domino color, the RGB values, and the HSL values. The line displays in the color being represented so some lines are not visible depending on the background color of the form. The form, named Colors, has two fields named Subject (text) and Body (rich text). import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Colors"); doc.replaceItemValue("Subject", "Colors"); ColorObject color = session.createColorObject(); RichTextItem rti = doc.createRichTextItem("Body"); RichTextStyle rts = session.createRichTextStyle(); rts.setFontSize(12); rts.setBold(RichTextStyle.YES); for (int i=0; i= 0 & nc.intValue() = 1000) db.setLimitRevisions(0); else db.setLimitRevisions(lr + 100); System.out.println("Limit for $Revisions is " + db.getLimitRevisions()); } catch(Exception e) { e.printStackTrace(); } } }
LimitUpdatedBy property Read-write. The maximum number of entries allowed in the $UpdatedBy field. Note: This property is new with Release 6.5.
Defined in Database
Data type double
Syntax public double getLimitUpdatedBy() throws NotesException public void setLimitUpdatedBy(double updatedbys) throws NotesException
Usage This property corresponds to ″Limit entries in $UpdatedBy fields″ in the database advanced properties of the UI. This property must be an integer in the range 0 - 2147483647. When setting it: v Any fraction is truncated. v A value less than 0 throws NotesError.NOTES_ERR_NEGATIVE_VALUE (4631) ″Value can not be negative.″ v A value greater than 2147483647 throws NotesError.NOTES_ERR_LONG_OVERFLOW (4673) ″Value must be positive and less than 2147483648.″ A value of 0 means no limit. When $UpdatedBy reaches the limit, a new entry results in deletion of the oldest entry. The database must be open to use this property.
Language cross-reference LimitUpdatedBy property in LotusScript NotesDatabase class
Examples: LimitUpdatedBy property This agent cycles the updated-by limit from 0 to 1000 in increments of 100. import lotus.domino.*; public class JavaAgent extends AgentBase {
Chapter 2. Java Classes A-Z
307
public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); double lu = db.getLimitUpdatedBy(); if (lu > 1000) db.setLimitUpdatedBy(0); else db.setLimitUpdatedBy(lu + 100); System.out.println("LimitUpdatedBy = " + db.getLimitUpdatedBy()); } catch(Exception e) { e.printStackTrace(); } } }
ListInDbCatalog property Read-write. Indicates whether a database appears in database catalogs. Note: This property is new with Release 6.5.
Defined in Database
Data type boolean
Syntax public boolean getListInDbCatalog() throws NotesException public void setListInDbCatalog(boolean flag) throws NotesException
Legal values v true if the database appears in database catalogs v false if the database does not appear in database catalogs
Usage This property corresponds to ″List in Database Catalog″ in the database design properties of the UI. Categories determines the categories under which the database is listed. The database must be open to use this property.
Language cross-reference ListInDbCatalog property in LotusScript NotesDatabase class
Examples: ListInDbCatalog property This agent toggles whether the current database is listed in a database catalog. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() {
308
Programming Guide, Volume 3: Java/CORBA Classes
try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); db.setListInDbCatalog(!db.getListInDbCatalog()); System.out.println("ListInDbCatalog = " + db.getListInDbCatalog()); } catch(Exception e) { e.printStackTrace(); } } }
Managers property Read-only. People, servers, and groups that have Manager access to a database.
Defined in Database
Data type java.util.Vector; elements are String
Syntax public java.util.Vector getManagers() throws NotesException
Usage Each element in the vector is the name of a person, server, or group with Manager access to the database. The database must be open to use this property.
Language cross-reference Managers property in LotusScript NotesDatabase class @DbManager function in formula language
Examples: Managers property This agent displays the number of managers in the current database and the name of each. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); Vector managers = db.getManagers(); int size = managers.size(); if (size == 1) { System.out.println("Database \"" + title + "\" has 1 manager"); } else { System.out.println("Database \"" + title + "\" has " + size + " managers"); } for (int i=0; i 71) db.setUndeleteExpireTime(24); else db.setUndeleteExpireTime(uet + 24); System.out.println( "UndeleteExpireTime = " + db.getUndeleteExpireTime()); } catch(Exception e) { e.printStackTrace(); } } }
Views property Read-only. The views and folders in a database.
Defined in Database
Data type java.util.Vector; elements are View
Syntax public java.util.Vector getViews() throws NotesException
Usage Each element of the vector represents a public view or folder in the database, or a private view or folder owned by the effective id running the agent and stored in the database. Private views or folders stored in the desktop are not included. The database must be open to use this property.
Language cross-reference Views property in LotusScript NotesDatabase class
Examples: Views property This agent displays the names of all the views and folders in the current database.
Chapter 2. Java Classes A-Z
321
import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); Vector views = db.getViews(); int size = views.size(); System.out.println("Database \"" + title + "\" has " + size + " views"); for (int i = 0; i 0) { // Display subject for documents matching query System.out.println("Search results " + start + " - " + (start - 1 + dc.getCount())); Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println ("\t" + doc.getItemValueString("Subject")); doc = dc.getNextDocument(doc); } // Get next 8 documents that match the query start = start + 8; dc = db.FTSearchRange(query, 8, Database.FT_SCORES, Database.FT_STEMS, start); } } } catch(Exception e) { e.printStackTrace(); } } }
getAgent method Finds an agent in a database, given the agent name.
Defined in Database
Syntax public Agent getAgent(String name) throws NotesException
Parameters String name
The name of the agent.
342
Programming Guide, Volume 3: Java/CORBA Classes
Return value Agent
The agent whose name matches the parameter.
Usage The return value is null if the current user (as obtained by Session.getUserName) is not the owner of the private agent.
Language cross-reference GetAgent method in LotusScript NotesDatabase class AgentEdit @command of formula language
Examples: getAgent method This agent prints the owner, last run date, and query for the agent named ″Update Thread Maps.″ import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Agent agent = db.getAgent("My Agent"); System.out.println("Agent:\t" + agent.getName()); System.out.println("Owner:\t" + agent.getOwner()); System.out.println( "Last run:\t" + agent.getLastRun()); System.out.println("Query:\t" + agent.getQuery()); } catch(Exception e) { e.printStackTrace(); } } }
getDocumentByID method Finds a document in a database, given the document note ID.
Defined in Database
Syntax public Document getDocumentByID(String noteid) throws NotesException
Parameters String noteid
The note ID of a document.
Return value Document
The document whose note ID matches the parameter.
Chapter 2. Java Classes A-Z
343
Usage For an explanation of note IDs, see the NoteID property in Document. If you get a note ID from @NoteID, delete the ″NT″ prefix.
Language cross-reference GetDocumentByID method in LotusScript NotesDatabase class
Examples: getDocumentByID method This agent gets the document in the current database whose note ID is the agent comment, if such a document exists, and prints the value of the Subject item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = agentContext.getCurrentDatabase(); Document doc = db.getDocumentByID (agent.getComment()); System.out.println ("Document " + agent.getComment() + " has the subject: " + doc.getItemValueString("Subject")); } catch(Exception e) { e.printStackTrace(); } } }
getDocumentByUNID method Finds a document in a database, given the document universal ID (UNID).
Defined in Database
Syntax public Document getDocumentByUNID(String unid) throws NotesException
Parameters String unid
The universal ID of a document.
Return Values Document
The document whose universal ID matches the parameter.
Usage For an explanation of universal IDs, see getUniversalID in Document. You can obtain the universal ID from getUniversalID or getParentDocumentUNID in Document. Not matching the UNID to a document in the database throws NotesError.NOTES_ERR_BAD_UNID (4091).
344
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference GetDocumentByUNID method in LotusScript NotesDatabase class @SetDocField function in formula language OpenDocument @command in formula language
Examples: getDocumentByUNID method 1. This agent gets the parents of all the response documents in the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { if (doc.isResponse()) { Document pdoc = db.getDocumentByUNID(doc.getParentDocumentUNID()); String docSubj = doc.getItemValueString("Subject"); String pdocSubj = pdoc.getItemValueString("Subject"); System.out.println("\"" + pdocSubj + "\" has the response \"" + docSubj + "\""); } doc = dc.getNextDocument(doc); } } catch(Exception e) { e.printStackTrace(); } } }
2. This agent demonstrates catching NotesError.NOTES_ERR_BAD_UNID. The UNID is deliberately altered to cause the error. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { if (doc.isResponse()) { String docSubj = ""; try { docSubj = doc.getItemValueString("Subject"); // Deliberately munge UNID String badUNID = "Z" + doc.getParentDocumentUNID().substring(1); Chapter 2. Java Classes A-Z
345
Document pdoc = db.getDocumentByUNID(badUNID); String pdocSubj = pdoc.getItemValueString("Subject"); System.out.println("\"" + pdocSubj + "\" has the response \"" + docSubj + "\""); } catch(NotesException ne) { if (ne.id == NotesError.NOTES_ERR_BAD_UNID) System.out.println("Bad UNID for \"" + docSubj + "\""); else throw ne; } } doc = dc.getNextDocument(doc); } } catch(NotesException ne) { System.out.println(ne.id + " " + ne.text); } catch(Exception e) { e.printStackTrace(); } } }
getDocumentByURL method Instantiates a document in the database on which it is called and returns a Document object for it. This method is typically used for either the Server Web Navigator or Personal Web Navigator database, but can be called on any Database object.
Defined in Database
Syntax public Document getDocumentByURL(String url, boolean reload) throws NotesException
public Document getDocumentByURL(String url, boolean reload, boolean relifmod, boolean urllist, String charset, String webu throws NotesException
Parameters String url
The desired uniform resource locator (URL), for example, http://www.acme.com. Specify the entire URL starting with http. You can enter a maximum string length of 15K. boolean reload
Specify true to reload the page from its Internet server. Specify false to load the page from the Internet only if it is not already in the Web Navigator database. boolean relifmod
(Defaults to the specification for the second parameter) Specify true to reload the page only if it has been modified on its Internet server, false to load the page from the Internet only if it is not already in the Web Navigator database. boolean urllist
(Defaults to false) Web pages can contain URL links to other Web pages. You can specify whether to save the URLs in a field called URLLinksn in the Notes document. (The Web Navigator creates a new URLLinksn field each time the field size reaches 64K. For example, the first URLLinks field is URLLinks1, the second is URLLinks2, and so on.)
346
Programming Guide, Volume 3: Java/CORBA Classes
Specify true if you want to save the URLs in the URLLinksn field(s). Specify false if you do not want to save the URLs in the URLLinksn field(s). If you save the URLs, you can use them in agents. For example, you can create an agent that opens Web pages in the Web Navigator database and then loads all the Web pages saved in each of the URLLinksn field(s). CAUTION: Saving URLs in the URLLinksn field(s) may affect performance. String charset
(Defaults to null) Enter the MIME character set (for example, ISO-2022-JP for Japanese or ISO-8859-1 for United States) that you want the Web Navigator to use when processing the Web page. String webuser
(Defaults to null.) Some Internet servers require you to obtain a username before you can access their pages. This parameter allows you to enter the username that you previously obtained from the Full-text server. String webpasswd
(Defaults to null) Some full-text servers require you to obtain a password before you can access their pages. This parameter allows you to enter the password that you previously obtained from the Internet server. String proxyuser
(Defaults to null) Some proxy servers require that you specify a username in order to connect through them. This parameter allows you to enter the username for the proxy server. See your administrator for the username required by the proxy. String proxypasswd
(Defaults to null) Some proxy servers require that you specify a password in order to connect through them. This parameter allows you to enter the password for the proxy server. See your administrator for the password required by the proxy. boolean returnimmediately
(Defaults to false) Specify true to return immediately and not wait for completion of the retrieval. If you specify true, getDocumentByURL does not return the Document object representing the URL document. This parameter is useful for offline storage purposes; in this case, you do not need the Document object and do not have to wait for completion of the operation. This parameter is ignored and false is forced if the database being opened is not local to the execution context.
Return value Document
The Notes document that represents the URL document you specified.
Language cross-reference GetDocumentByURL method in LotusScript NotesDatabase class @URLOpen function in formula language
Examples: getDocumentByURL method This agent prints the value of the Subject item for the Lotus home page. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); Chapter 2. Java Classes A-Z
347
AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.getDocumentByURL ("http://www.lotus.com", false); System.out.println( doc.getItemValueString("Subject")); } catch(Exception e) { e.printStackTrace(); } } }
getForm method Finds a form in a database, given the form name.
Defined in Database
Syntax public Form getForm(String name) throws NotesException
Parameters String name
The name or an alias of the form.
Return value Form
The form whose name or alias matches the parameter.
Language cross-reference GetForm method in LotusScript NotesDatabase class
Examples: getForm method This agent prints the names and aliases of the form named ″Author Profile.″ import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Form form = db.getForm("Author Profile"); System.out.println(form.getName()); Vector aliases = form.getAliases(); for (int i=0; i 0) { // Display LastModified and Subject from each document Document doc = dc.getFirstDocument(); while(doc != null) { System.out.println( doc.getLastModified() + " " + doc.getItemValueString("Subject")); doc = dc.getNextDocument(doc); } } else { // If nothing modified since last time if (profile.hasItem("UntilTime")) System.out.println("No documents modified since " + untilTime.getLocalTime()); else System.out.println("No documents modified since beginning"); } // Write UntilTime back to profile document profile.replaceItemValue("UntilTime", dc.getUntilTime()); profile.save(true, true, true); } catch(Exception e) { e.printStackTrace(); } } }
350
Programming Guide, Volume 3: Java/CORBA Classes
getOption method Gets the value of a database option. Note: This method is new with Release 6.5.
Defined in Database
Syntax public boolean getOption(int optionname) throws NotesException
Parameters int optionname
One of the following: v Database.DBOPT_LZ1 uses LZ1 compression for attachments v Database.DBOPT_LZCOMPRESSION uses LZ1 compression for attachments v Database.DBOPT_MAINTAINLASTACCESSED maintains LastAcessed property v Database.DBOPT_MOREFIELDS allows more fields in database v Database.DBOPT_NOHEADLINEMONITORS doesn’t allow headline monitoring v Database.DBOPT_NOOVERWRITE doesn’t overwrite free space v Database.DBOPT_NORESPONSEINFO doesn’t support specialized response hierarchy v Database.DBOPT_NOTRANSACTIONLOGGING disables transaction logging v Database.DBOPT_NOUNREAD doesn’t maintain unread marks v Database.DBOPT_OPTIMIZATION enables document table bitmap optimization v Database.DBOPT_REPLICATEUNREADMARKSTOANY replicates unread marks to all servers v Database.DBOPT_REPLICATEUNREADMARKSTOCLUSTER replicates unread marks to clustered servers only v Database.DBOPT_SOFTDELETE allows soft deletions
Return value boolean
v true if the option is enabled v false if the option is disabled
Usage See setOption for setting a database option.
Language cross-reference GetOption method in LotusScript NotesDatabase class
Examples: getOption method This agent gets the value of a database option. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Chapter 2. Java Classes A-Z
351
// (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.getOption(Database.DBOPT_SOFTDELETE)) System.out.println("Soft deletes enabled"); else System.out.println("Soft deletes not enabled"); } catch(Exception e) { e.printStackTrace(); } } }
getOutline method Gets an outline in the current database.
Defined in Database
Syntax public Outline getOutline(String outlinename) throws NotesException
Parameters String outlinename
The name of the outline.
Return value Outline
The outline.
Language cross-reference GetOutline method in LotusScript NotesDatabase class
getProfileDocCollection method Retrieves the profile documents associated with a profile form.
Defined in Database
Syntax public DocumentCollection getProfileDocCollection(String profileName) throws NotesException
Parameters String profileName
The name or an alias of the profile form.
Return value DocumentCollection
The profile documents. No profile documents results in an empty collection.
352
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference GetProfileDocCollection method in LotusScript NotesDatabase class
Examples: getProfileDocCollection method This agent gets all the profile documents for the form ″Author Profile.″ import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getProfileDocCollection("Author Profile"); Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println(doc.getItemValueString("Who")); doc = dc.getNextDocument(); } } catch(Exception e) { e.printStackTrace(); } } }
getProfileDocument method Retrieves or creates a profile document.
Defined in Database
Syntax public Document getProfileDocument(String profile, String profilekey) throws NotesException
Parameters String profile
The name or an alias of the profile form. String profilekey
The unique key associated with the profile document.
Return value Document
The profile document for the specified key, or a new profile document if the document with the key does not exist.
Language cross-reference GetProfileDocument method in LotusScript NotesDatabase class
Examples: getProfileDocument method This agent gets the profile document for the current user based on the ″Author Profile″ form. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Chapter 2. Java Classes A-Z
353
Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.getProfileDocument ("Author Profile", session.getUserName()); String who = doc.getItemValueString("Who"); String email = doc.getItemValueString("Email"); String phone = doc.getItemValueString("Phone"); System.out.println("Who: " + who); System.out.println("Email: " + email); System.out.println("Phone: " + phone); } catch(Exception e) { e.printStackTrace(); } } }
getURLHeaderInfo method Gets the specific Hypertext Transfer Protocol (HTTP) header information from the Uniform Resource Locator (URL). A URL is a text string used for identifying and addressing a Web resource. Note: This method is obsolete in Release 6.
Defined in Database
Syntax
public String getURLHeaderInfo(String url, String header, String webuser, String webpasswd, String proxyuser, String proxyp throws NotesException
Parameters String url
The URL for the Web page you want information on, for example, http://www.acme.com/. Specify the entire URL starting with http. You can enter a maximum string length of 15K. String header
Enter a header string of the URL header value you want returned. The acceptable header strings are documented in the HTTP specification (available at various locations on the Internet, such as http://www.w3.org/) and are subject to change based on updated versions of the specification. webuser
String. Some Internet servers require you to obtain a username before you can access their pages. This parameter allows you to enter the username that you previously obtained from the Internet server. Specify null if you don’t need this parameter. webpasswd
String. Some Internet servers require you to obtain a password before you can access their pages. This parameter allows you to enter the password that you previously obtained from the Internet server. Specify null if you don’t need this parameter. proxyuser
String. Some proxy servers require that you specify a username in order to connect through them. This parameter allows you to enter the username for the proxy server. See your administrator for the username required by the proxy. Specify null if you don’t need this parameter. proxypasswd
354
Programming Guide, Volume 3: Java/CORBA Classes
String. Some proxy servers require that you specify a password in order to connect through them. This parameter allows you to enter the password for the proxy server. See your administrator for the password required by the proxy. Specify null if you don’t need this parameter.
Return value String
The requested header, or null if the URL or the requested header value is not found. Any dashes are converted to underscores.
Language cross-reference GetURLHeaderInfo method in LotusScript NotesDatabase class @URLGetHeader function in formula language @GetHTTPHeader function in formula language @WebDbName function in formula language
Examples: getURLHeaderInfo method This agent gets the ″Last-modified″ header string for the URL specified in the agent comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String hinfo = db.getURLHeaderInfo ("http://www.lotus.com", "Last-modified", null, null, null, null); System.out.println ("www.lotus.com was last modified on " + hinfo); } catch(Exception e) { e.printStackTrace(); } } }
getView method Finds a view or folder in a database, given the name or alias of the view or folder.
Defined in Database
Syntax public View getView(String name) throws NotesException
Parameters String name
The case-insensitive name of a view or folder in a database. Use either the entire name of the view or folder (including backslashes for cascading views and folders), or an alias.
Chapter 2. Java Classes A-Z
355
Return Values View
The view or folder whose name or alias matches the parameter.
Usage Using getView returns public views and folders and private views and folders that are owned by the effective id running the agent. Private views stored in the desktop are not returned. When specifying the parameter, do not combine the view name and an alias. For example, specifying ″By Author|AuthorView″ does not work. Use either the view name (″By Author″) or its alias (″AuthorView″). When the view or folder name contains underscores to indicate menu accelerators, you have the option of including or excluding the underscores. The method works more efficiently, however, if you include the underscores.
Language cross-reference GetView method in LotusScript NotesDatabase class
Examples: getView method This agent gets the view named ″(Default View)″ in the current database and prints the number of columns in the view. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); View view = db.getView("($All)"); System.out.println("($All) has " + view.getColumns().size() + " columns"); } catch(Exception e) { e.printStackTrace(); } } }
grantAccess method Modifies a database access control list to provide a specified level of access to a person, group, or server. Note: Using this method at the same time an ACL object is in use may produce inconsistent results.
Defined in Database
Syntax public void grantAccess(String name, int level) throws NotesException
Parameters String name
The name of the person, group, or server whose access level you want to provide or change. For a hierarchical name, the full name must be specified but can be in abbreviated format. int level
356
Programming Guide, Volume 3: Java/CORBA Classes
The level of access you’re granting. Specify one of the following constants: v ACL.LEVEL_AUTHOR v ACL.LEVEL_DEPOSITOR v ACL.LEVEL_DESIGNER v ACL.LEVEL_EDITOR v ACL.LEVEL_MANAGER v ACL.LEVEL_NOACCESS v ACL.LEVEL_READER
Usage If the name already exists in the ACL, this method updates it with the access. Otherwise, the name is added to the ACL with the level. You can also use this method to deny access to a person, group, or server by assigning LEVEL_NOACCESS. This method sets ACL roles to their default values.
Language cross-reference GrantAccess method in LotusScript NotesDatabase class
Examples: grantAccess method This agent grants manager access to the user specified in the agent comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = agentContext.getCurrentDatabase(); db.grantAccess(agent.getComment(), ACL.LEVEL_MANAGER); System.out.println(agent.getComment() + " has been granted manager access"); } catch(Exception e) { e.printStackTrace(); } } }
markForDelete method Marks a database for deletion from a server in a cluster. Note: This method is new with Release 6.5.
Defined in Database
Syntax public void markForDelete() throws NotesException
Chapter 2. Java Classes A-Z
357
Usage Once a database is marked for deletion, it does not accept any new database open requests. After all active users are finished with it, the Cluster Manager pushes all changes to another replica (if there is another replica) and then deletes the database. Use this method if you want to remove a database that is obsolete or if you are copying a database from one server to another and want to delete the database from the original server. If you want to delete a database and all its replicas from a cluster, each database on each server must be marked for deletion. This method cannot be undone. You cannot remove a mark for deletion from a database once this method is used. This method sets isPendingDelete to true and isInService to false. This method differs from the remove method in that the database must be in a cluster. If the database is not on a server in a cluster, this method does not return an error, but the database is not deleted. Additionally, the remove method fails if the database is in use. The markForDelete method waits for all current users to finish, then deletes the database. The Cluster Manager is responsible for deleting databases marked for deletion in the cluster; the Adminp task is not called. You can programmatically determine if a database is available on other servers in a cluster by querying the cldbdir.nsf database, which exists on every cluster and holds an up-to-date list of all the databases in the cluster and their replicas. The cldbdir.nsf database also tracks each database’s enabled or disabled status. Use the deleteReplicas method of the AdministrationProcess class if you want to delete a database and all replicas of it from the entire domain. This method requires Manager access privileges.
Language cross-reference MarkForDelete method in NotesDatabase class
Examples: markForDelete method This agent marks a database for deletion. It is effective if the database is on a server on a cluster with the Cluster Manager running. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase("Cathy/Otus", "Test\\MarkForDelete"); if (db.isOpen()) { db.markForDelete(); System.out.println("Is in service = " + db.isInService()); System.out.println("Is pending delete " + db.isPendingDelete()); } else { System.out.println("Could not open Test\\MarkForDelete"); } } catch(Exception e) {
358
Programming Guide, Volume 3: Java/CORBA Classes
e.printStackTrace(); } } }
open method Opens a database.
Defined in Database
Syntax public boolean open() throws NotesException
Return value boolean
v true if the database exists and is opened v false if no database with this name exists
Usage A database must be open to use the Database properties and methods with some exceptions. Most methods that access a database open it, but some do not. See isOpen for details.
Usage An error is returned if the user does not have access rights to the database or server.
Language cross-reference Open method in LotusScript NotesDatabase class @DbExists function in formula language
openByReplicaID method Given a server name and a replica ID, opens the specified database, if it exists. Note: This method is new with Release 6.5.
Defined in Database
Syntax public boolean openByReplicaID(String server, String replicaid) throws NotesException
Parameters String server
The name of the server on which the database resides. Use null to indicate a database on the current computer. String replicaid
The replica ID of the database that you want to open.
Return value v true indicates that the replica was found and opened v false indicates that the replica was not found on the server, or could not be opened Chapter 2. Java Classes A-Z
359
Usage Use Session.getDatabase(null, null) to instantiate an empty Database object.
Language cross-reference OpenByReplicaID method in LotusScript NotesDatabase class @Command([RenameDatabase]) function in formula language
Examples: openByReplicaID method This agent attempts to open a replica of the current database on a particular server. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String id = agentContext.getCurrentDatabase().getReplicaID(); String server = "Slapper/East/Acme"; Database db = session.getDatabase(null, null); if (db.openByReplicaID(server, id)) { System.out.println("Replica of current database on Slapper"); System.out.println("Server = " + db.getServer()); System.out.println("Filepath = " + db.getFilePath()); System.out.println("Title = " + db.getTitle()); } else System.out.println("No replica of current database on Slapper"); } catch(Exception e) { e.printStackTrace(); } } }
openIfModified method Given a date, opens the specified database if it has been modified since that date. Note: This method is new with Release 6.5.
Defined in Database
Syntax public boolean openIfModified(String server, String dbfile, DateTime modifiedsince) throws NotesException
Parameters String server
The name of the server on which the database resides. Use null to indicate a database on the current computer. String dbfile
The file name of the database.
360
Programming Guide, Volume 3: Java/CORBA Classes
DateTime modifiedsince
A cutoff date. If one or more documents in the database has been modified since this date, the database is opened; if not, it is not opened.
Return value v true indicates that the database was opened v false indicates that the database was not opened
Usage Use Session.getDatabase(null, null) to instantiate an empty Database object.
Language cross-reference OpenIfModified method in LotusScript NotesDatabase class
Examples: openIfModified method This agent opens the local names.nsf only if it was modified in the past day. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); dt.adjustHour(-1); Database db = session.getDatabase("", ""); if (db.openIfModified(null, "names", dt)) System.out.println("Names.nsf opened"); else System.out.println("Names.nsf not opened"); } catch(Exception e) { e.printStackTrace(); } } }
openWithFailover method Opens a database on a server. Note: This method is new with Release 6.5.
Defined in Database
Syntax public boolean openWithFailover(String server, String dbfile) throws NotesException
Parameters String server
The name of the primary server on which the database resides. String dbfile Chapter 2. Java Classes A-Z
361
The file name of the database to open.
Return value v true indicates that the database exists and was opened. v false indicates that there is no database with this name in the cluster.
Usage The object Server and FilePath properties reflect the actual server on which the database is opened. If the database can’t be opened on the specific server but the server belongs to a cluster, openWithFailover automatically looks for a replica of the specified server on the same cluster. If the method finds a replica, that database is opened instead, and the Server property adjusts accordingly.
Language cross-reference OpenWithFailover method in LotusScript NotesDatabase class FileDatabaseUseServer @command in formula language
Examples: openWithFailover method This agent opens names.nsf on a server, but fails over if the server is in a cluster and another server contains the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase("", ""); if (db.openWithFailover("Slapper/East/Acme", "names")) System.out.println("Names.nsf opened on " + db.getServer()); else System.out.println("Names.nsf not opened"); } catch(Exception e) { e.printStackTrace(); } } }
queryAccess method Returns a person’s, group’s, or server’s current access level to a database. Note: Using this method at the same time an ACL object is in use may produce inconsistent results.
Defined in Database
Syntax public int queryAccess(String name) throws NotesException
Parameters String name
362
Programming Guide, Volume 3: Java/CORBA Classes
The name of the person, group, or server. For a hierarchical name, the full name must be specified but can be in abbreviated format.
Return value int
The current access level, which is one of the following: v ACL.LEVEL_AUTHOR v ACL.LEVEL_DEPOSITOR v v v v v
ACL.LEVEL_DESIGNER ACL.LEVEL_EDITOR ACL.LEVEL_MANAGER ACL.LEVEL_NOACCESS ACL.LEVEL_READER
Usage If the name$ you specify is listed explicitly in the ACL, then queryAccess returns the access level for that ACL entry and does not check the groups. If the name$ you specify is not listed explicitly in the ACL, queryAccess checks if the name$ is a member of a group in the Primary Address Book known to the computer on which the script is running. On a local workstation, that address book is the Personal Address Book. On a server, that address book is the Domino Directory. If the queryAccess method finds name$ in one or more groups, then it returns the highest access level among those groups. If the name$ you specify is not listed in the ACL either individually or as part of a group, queryAccess returns the default access level for the ACL.
Language cross-reference QueryAccess method in LotusScript NotesDatabase class @UserAccess function in formula language @V4UserAccess function in formula language
Examples: queryAccess method This agent prints the access level for the current user. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); int accLevel = db.queryAccess(session.getUserName()); System.out.print ("For database \"" + title + "\" you have "); switch (accLevel) { case(ACL.LEVEL_NOACCESS) : System.out.println("no access"); break; case(ACL.LEVEL_DEPOSITOR) : System.out.println("depositor access"); break; Chapter 2. Java Classes A-Z
363
case(ACL.LEVEL_READER) : System.out.println("reader access"); break; case(ACL.LEVEL_AUTHOR) : System.out.println("author access"); break; case(ACL.LEVEL_EDITOR) : System.out.println("editor access"); break; case(ACL.LEVEL_DESIGNER) : System.out.println("designer access"); break; case(ACL.LEVEL_MANAGER) : System.out.println("manager access"); break; default: System.out.println("unknown access"); break; } } catch(Exception e) { e.printStackTrace(); } } }
queryAccessPrivileges method Returns the privileges of a person, group, or server in a database. Note: This method is new with Release 6.5.
Defined in Database
Syntax public int queryAccessPrivileges(String name) throws NotesException
Parameters String name
The name of the person, group, or server. For a hierarchical name, the full name must be specified but can be in abbreviated format.
Return value int
The current access privileges, a combination of the following: v Database.DBACL_CREATE_DOCS (1) v v v v v v v v
Database.DBACL_DELETE_DOCS (2) Database.DBACL_CREATE_PRIV_AGENTS (4) Database.DBACL_CREATE_PRIV_FOLDERS_VIEWS (8) Database.DBACL_CREATE_SHARED_FOLDERS_VIEWS (16) Database.DBACL_CREATE_SCRIPT_AGENTS (32) Database.DBACL_READ_PUBLIC_DOCS (64) Database.DBACL_WRITE_PUBLIC_DOCS (128) Database.DBACL_REPLICATE_COPY_DOCS (256)
Individual privileges can be discerned through bitwise operations.
364
Programming Guide, Volume 3: Java/CORBA Classes
Usage If the name you specify is listed explicitly in the ACL, then queryAccessPrivileges returns the privileges for that ACL entry and does not check groups. If the name you specify is not listed explicitly in the ACL, queryAccessPrivileges checks to see if the name is a member of a group in the primary address book where the program is running: on a workstation the Personal Address Book; on a server the Domino Directory.
Language cross-reference QueryAccessPrivileges method in LotusScript NotesDatabase class @UserAccess function in formula language
Examples: queryAccessPrivileges method This agent gets the privileges for the current user in the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); String user = session.getUserName(); int accPriv = db.queryAccessPrivileges(user); System.out.println("Privileges for " + user + " in " + title); // Check each privilege bit to see if it is 0 or 1 if ((accPriv & Database.DBACL_CREATE_DOCS) > 0) System.out.println("\tCreate documents"); if ((accPriv & Database.DBACL_DELETE_DOCS) > 0) System.out.println("\tDelete documents"); if ((accPriv & Database.DBACL_CREATE_PRIV_AGENTS) > 0) System.out.println("\tCreate private agents"); if ((accPriv & Database.DBACL_CREATE_PRIV_FOLDERS_VIEWS) > 0) System.out.println("\tCreate private folders/views"); if ((accPriv & Database.DBACL_CREATE_SHARED_FOLDERS_VIEWS) > 0) System.out.println("\tCreate shared folders/views"); if ((accPriv & Database.DBACL_CREATE_SCRIPT_AGENTS) > 0) System.out.println("\tCreate LotusScript/Java agents"); if ((accPriv & Database.DBACL_READ_PUBLIC_DOCS) > 0) System.out.println("\tRead public documents"); if ((accPriv & Database.DBACL_WRITE_PUBLIC_DOCS) > 0) System.out.println("\tWrite public documents"); if ((accPriv & Database.DBACL_REPLICATE_COPY_DOCS) > 0) System.out.println("\tReplicate or copy documents"); } catch(Exception e) { e.printStackTrace(); } } }
queryAccessRoles method Returns the roles of a person, group, or server in a database. Note: This method is new with Release 6.
Chapter 2. Java Classes A-Z
365
Defined in Database
Syntax public java.util.Vector queryAccessRoles(String name) throws NotesException
Parameters String name
The name of the person, group, or server. For a hierarchical name, the full name must be specified but can be in abbreviated format.
Return value Vector
A vector with elements of type String. v If the name has roles, each element of the vector contains one role. v If the name has no roles, the vector has a size of 0.
Usage If the name you specify is listed explicitly in the ACL, then queryAccessRoles returns the roles for that ACL entry and does not check groups. If the name you specify is not listed explicitly in the ACL, queryAccessRoles checks to see if the name is a member of a group in the primary address book where the program is running: on a workstation the Personal Address Book; on a server the Domino Directory.
Language cross-reference QueryAccessRoles method in LotusScript NotesDatabase class @UserRoles function in formula language @UserNamesList function in formula language
Examples: queryAccessRoles method This agent gets the roles for the current user in the current database. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Vector roles = db.queryAccessRoles(session.getUserName()); if (roles.size() == 0) System.out.println("No roles for current user"); else { System.out.println("Roles for current user:"); for (int i = 0; i < roles.size(); i++) { System.out.println(" " + roles.elementAt(i)); } }
366
Programming Guide, Volume 3: Java/CORBA Classes
} catch(Exception e) { e.printStackTrace(); } } }
remove method Permanently deletes a database.
Defined in Database
Syntax public void remove() throws NotesException
Language cross-reference Remove method in LotusScript NotesDatabase class FileDatabaseDelete @command of formula language DatabaseDelete @command in formula language
Examples: remove method This agent removes the local database whose name is in the agent’s comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = session.getDatabase(null, agent.getComment()); db.remove(); System.out.println("Database " + agent.getComment() + " has been removed"); } catch(Exception e) { e.printStackTrace(); } } }
removeFTIndex method Removes a full-text index from a database. Note: This method is new with Release 6.5.
Defined in Database
Syntax public void removeFTIndex() throws NotesException
Chapter 2. Java Classes A-Z
367
Usage No error occurs if the database does not have a full-text index. This method works only for local databases.
Language cross-reference RemoveFTIndex method in LotusScript NotesDatabase class
Examples: removeFTIndex method This agent removes a full-text index from the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.isFTIndexed()) { db.removeFTIndex(); System.out.println("Database index removed"); } else { System.out.println("Database is not indexed"); } } catch(Exception e) { e.printStackTrace(); } } }
replicate method Replicates a local database with its replica(s) on a server.
Defined in Database
Syntax public boolean replicate(String server) throws NotesException
Parameters String server
The name of the server with which you want to replicate. Any replica of the source database that exists on the server will replicate.
Return value boolean
v true if the replication task runs without error v false if replication errors occur
368
Programming Guide, Volume 3: Java/CORBA Classes
Usage Successful replication does not necessarily mean that documents replicate. The replication settings are honored. For example, if replication is temporarily disabled on one of the databases, the replication task runs without error but no documents actually replicate. The source database must be local or an exception is thrown.
Language cross-reference Replicate method in LotusScript NotesDatabase class ReplicatorReplicateWithServer @command of formula language ReplicatorStart @command of formula language ToolsReplicate @command of formula language
Examples: replicate method This agent replicates the local database dbexamples.nsf with its replica on notesua1. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase(null, "dbexamples"); if (db.isOpen()) { String title = db.getTitle(); if (db.replicate("notesua1")) System.out.println ("\"" + title + "\" has replicated"); else System.out.println ("Error replicating \"" + title + "\""); } else System.out.println("No such database"); } catch(Exception e) { e.printStackTrace(); } } }
revokeAccess method Removes a person, group, or server from a database access control list. This resets the access level for that person, group, or server to the Default setting for the database. Note: Using this method at the same time an ACL object is in use may produce inconsistent results.
Defined in Database
Syntax public void revokeAccess(String name) throws NotesException
Parameters String name Chapter 2. Java Classes A-Z
369
The name of the person, group, or server whose access you want to revoke. For a hierarchical name, the full name must be specified but can be in abbreviated format.
Usage Revoking access is different than assigning No Access (which you can do with the grantAccess method). When you revoke access, you remove the name from the ACL, but the person, group, or server can still access the database at the level specified for Default. When you use the grantAccess method to assign No Access, the name remains in the ACL, and the person, group, or server cannot access the database, regardless of the Default setting.
Errors The name must be explicitly listed in the database ACL. If it isn’t, revokeAccess throws an exception, even if the name is a member of a group that is listed in the ACL.
Language cross-reference RevokeAccess method in LotusScript NotesDatabase class
Examples: revokeAccess method This agent revokes access to the current database for the user whose name is the agent comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = agentContext.getCurrentDatabase(); db.revokeAccess(agent.getComment()); System.out.println (agent.getComment() + "’s access is revoked"); } catch(Exception e) { e.printStackTrace(); } } }
search method Given selection criteria for a document, returns all documents in a database that meet the criteria.
Defined in Database
Syntax public DocumentCollection search(String formula) throws NotesException public DocumentCollection search(String formula, DateTime dt) throws NotesException public DocumentCollection search(String formula, DateTime dt, int max) throws NotesException
Parameters String formula
A Notes @function formula that specifies the selection criteria. DateTime dt
370
Programming Guide, Volume 3: Java/CORBA Classes
A cutoff date. The method searches only documents created or modified since the cutoff date. Can be null to indicate no cutoff date. int max
The maximum number of documents you want returned. Specify 0 to receive all matching documents (up to 5,000. See Usage section.).
Return value DocumentCollection
An unsorted collection of documents that match the selection criteria.
Usage This method returns a maximum of 5,000 documents by default. The Notes.ini variable FT_MAX_SEARCH_RESULTS overrides this limit for indexed databases or databases that are not indexed but that are running an agent on the client. For a database that is not indexed and is running in an agent on the server, you must set the TEMP_INDEX_MAX_DOC Notes.ini variable as well. The absolute maximum is 2,147,483,647.
Language cross-reference Search method in LotusScript NotesDatabase class EditSelectByDate @command of formula language
Examples: search method This agent searches the current database for all documents whose Subject field equals the value of the agent’s comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); DocumentCollection dc = db.search ("Subject = \"" + agent.getComment() + "\""); int matches = dc.getCount(); System.out.println ("Search of \"" + title + "\" found " + matches + " document(s) with Subject = \"" + agent.getComment() + "\""); } catch(Exception e) { e.printStackTrace(); } } }
setOption method Sets the value of a database option. Note: This method is new with Release 6.5.
Defined in Database
Chapter 2. Java Classes A-Z
371
Syntax public void setOption(int optionname, boolean flag) throws NotesException
Parameters int optionname
One of the following: v Database.DBOPT_LZ1 uses LZ1 compression for attachments v Database.DBOPT_LZCOMPRESSION uses LZ1 compression for attachments v Database.DBOPT_MAINTAINLASTACCESSED maintains LastAccessed property v Database.DBOPT_MOREFIELDS allows more fields in database v Database.DBOPT_NOHEADLINEMONITORS doesn’t allow headline monitoring v Database.DBOPT_NOOVERWRITE doesn’t overwrite free space v Database.DBOPT_NORESPONSEINFO doesn’t support specialized response hierarchy v Database.DBOPT_NOTRANSACTIONLOGGING disables transaction logging v Database.DBOPT_NOUNREAD doesn’t maintain unread marks v Database.DBOPT_OPTIMIZATION enables document table bitmap optimization v Database.DBOPT_REPLICATEUNREADMARKSTOANY replicates unread marks to all servers v Database.DBOPT_REPLICATEUNREADMARKSTOCLUSTER replicates unread marks to clustered servers only v Database.DBOPT_SOFTDELETE allows soft deletions boolean flag
v true to enable the option v false to disable the option
Usage Compact the database to ensure that the option takes effect. See compact. See getOption for getting a database option. Setting DBOPT_REPLICATEUNREADMARKSTOANY true also sets DBOPT_REPLICATEUNREADMARKSTOCLUSTER true. Setting DBOPT_REPLICATEUNREADMARKSTOCLUSTER true sets DBOPT_REPLICATEUNREADMARKSTOANY false. Setting both options false means unread marks are never replicated. The database must be open. Otherwise this method throws NOTES_ERR_DATABASE_NOTOPEN (4063).
Language cross-reference SetOption method in LotusScript NotesDatabase class
Examples: setOption method This agent toggles the value of a database option. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext();
372
Programming Guide, Volume 3: Java/CORBA Classes
// (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.getOption(Database.DBOPT_SOFTDELETE)) { db.setOption(Database.DBOPT_SOFTDELETE, false); System.out.println("Soft deletes turned off"); } else { db.setOption(Database.DBOPT_SOFTDELETE, true); System.out.println("Soft deletes turned on"); } } catch(Exception e) { e.printStackTrace(); } } }
sign method Signs elements in a database with the signature of the current user. Note: This method is new with Release 6.5.
Defined in Database
Syntax public void sign() throws NotesException public void sign(int documenttype) throws NotesException public void sign(int documenttype, boolean existingsigsonly) throws NotesException public void sign(int documenttype, boolean existingsigsonly, String namestr) throws NotesException public void sign(int documenttype, boolean existingsigsonly, String namestr, boolean namestrisnoteid) throws NotesException
Parameters int documenttype
One of the following constants. v v v v
Database.DBSIGN_DOC_ACL (64) signs the ACL Database.DBSIGN_DOC_AGENT (512) signs all agents Database.DBSIGN_DOC_ALL (32767) signs all elements Database.DBSIGN_DOC_DATA (1) signs all data documents’ active content (hotspots)
v v v v v v
Database.DBSIGN_DOC_FORM (4) signs all forms Database.DBSIGN_DOC_HELP (256) signs the ″About Database″ and ″Using Database″ documents Database.DBSIGN_DOC_ICON (16) signs the icon Database.DBSIGN_DOC_REPLFORMULA (2048) signs the replication formula Database.DBSIGN_DOC_SHAREDFIELD (1024) signs all shared fields Database.DBSIGN_DOC_VIEW (8) signs all views
boolean existingsigsonly)
v true to sign only elements with existing signatures v false (default) to sign all elements Chapter 2. Java Classes A-Z
373
String namestr
Programmatic name or note ID of a single design element. boolean namestrisnoteid
v true if parameter 3 represents a note ID. v false (default) if parameter 3 represents a programmatic name.
Usage This method signs all design elements of the specified type if you specify parameter 1 and do not specify parameter 3. If you specify parameter 3, this method signs one design element. You can also specify parameter 1 to positively define the design element. If more than one design element has the same name and parameter 1 is not specified, this method signs the first design element with the specified name. This method executes only on a workstation.
Language cross-reference Sign method in LotusScript NotesDatabase class
Examples: sign method This agent signs the forms in the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); db.sign(Database.DBSIGN_DOC_FORM); } catch(Exception e) { e.printStackTrace(); } } }
updateFTIndex method Updates the full-text index of a database.
Defined in Database
Syntax public void updateFTIndex(boolean create) throws NotesException
Parameters boolean create
Specify true if you want to create an index if none exists (valid only for local databases). Otherwise, specify false.
374
Programming Guide, Volume 3: Java/CORBA Classes
Usage An exception is thrown if you attempt to create a full-text index on a database that is not local. A database must contain at least one document in order for an index to be created, even if the create parameter is set to true.
Language cross-reference UpdateFTIndex method in LotusScript NotesDatabase class FileFullTextCreate @command of formula language FileFullTextUpdate @command of formula language
Examples: updateFTIndex method This agent updates the full-text index of the current database if the index has not been updated in the last two days. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); String title = db.getTitle(); DateTime lastDT = db.getLastFTIndexed(); DateTime nowDT = session.createDateTime("Today"); nowDT.setNow(); int daysSince = nowDT.timeDifference(lastDT) / 86400; if (daysSince > 2) { System.out.println("Database \"" + title + "\" was last full-text indexed " + daysSince + " days ago"); System.out.println("Updating"); db.updateFTIndex(true); } else System.out.println("Database \"" + title + "\" was full-text indexed less than two days ago"); } catch(Exception e) { e.printStackTrace(); } } }
DateRange class Represents a range of dates and times.
Syntax public class DateRange extends Base
Containment Contained by: Session Contains: DateTime Chapter 2. Java Classes A-Z
375
Properties EndDateTime through getEndDateTime and setEndDateTime Parent through getParent StartDateTime through getStartDateTime and setStartDateTime Text through getText and setText
Methods recycle toString
Creation To create a new DateRange object, use createDateRange in Session. To initialize the object, you can do one of the following: v Assign values to the createDateRange parameters. v Assign to StartDateTime and EndDateTime DateTime values. v Assign to Text a string value that represents a date range. This consists of two string representations of Domino-formatted date-time values separated by a hyphen (for example, ″01/01/97 - 01/02/97″).
Usage When you assign StartDateTime or EndDateTime, its value replaces the corresponding value in Text, and vice versa.
Examples: DateRange class 1. This example sets the StartDateTime and EndDateTime properties of a DateRange object through the createDateRange parameters, then displays the value of the Text property. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime dtdb = db.getCreated(); DateTime dtnow = session.createDateTime("Today"); dtnow.setNow(); DateRange dr = session.createDateRange(dtdb, dtnow); System.out.println("Creation date - now:"); System.out.println(" " + dr.getText()); } catch(Exception e) { e.printStackTrace(); } } }
2. This example sets the StartDateTime and EndDateTime properties of a DateRange object through the property methods, then displays the value of the Text property. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession();
376
Programming Guide, Volume 3: Java/CORBA Classes
AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime dtdb = db.getCreated(); DateTime dtnow = session.createDateTime("Today"); dtnow.setNow(); DateRange dr = session.createDateRange(); dr.setStartDateTime(dtdb); dr.setEndDateTime(dtnow); System.out.println("Creation date - now:"); System.out.println(" " + dr.getText()); } catch(Exception e) { e.printStackTrace(); } } }
3. This example writes a value to the Text property, then displays the LocalTime property of the StartDateTime and EndDateTime properties (which are DateTime objects). import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime dtdb = db.getCreated(); DateTime dtnow = session.createDateTime("Today"); dtnow.setNow(); DateRange dr = session.createDateRange(); dr.setText (dtdb.getLocalTime() + " - " + dtnow.getLocalTime()); System.out.println("Start date = " + dr.getStartDateTime().getLocalTime()); System.out.println("End date = " + dr.getEndDateTime().getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
4. This example sets a value for a DateRange object, then changes the DateTime object that the EndDateTime property is based on. This implicitly changes the EndDateTime property. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime dtdb = db.getCreated(); DateTime dtplus = session.createDateTime("Today"); dtplus.setNow(); DateRange dr = session.createDateRange(dtdb, dtplus); dtplus.adjustMonth(2); System.out.println ("Creation date - 2 months from now:"); System.out.println (" " + dr.getText()); } catch(Exception e) { Chapter 2. Java Classes A-Z
377
e.printStackTrace(); } } }
EndDateTime property Read-Write. The ending date-time of a range.
Defined in DateRange
Data type DateTime
Syntax public DateTime getEndDateTime() throws NotesException public void setEndDateTime(DateTime end) throws NotesException
Usage Modifying the DateTime object on which EndDateTime is based implicitly modifies EndDateTime. This does not apply if EndDateTime is based on a java.util.Date object. The DateTime object in setEndDateTime cannot be null.
Language cross-reference EndDateTime property in LotusScript NotesDateRange class
Parent property Read-only. The session that contains a DateRange object.
Defined in DateRange
Data type Session
Syntax public Session getParent() throws NotesException
Language cross-reference Parent property in LotusScript NotesDateRange class
StartDateTime property Read-Write. The starting date-time of a range.
Defined in DateRange
Data type DateTime
Syntax public DateTime getStartDateTime() throws NotesException
378
Programming Guide, Volume 3: Java/CORBA Classes
public void setStartDateTime(DateTime start) throws NotesException
Usage Modifying the DateTime object on which StartDateTime is based implicitly modifies StartDateTime. This does not apply if StartDateTime is based on a java.util.Date object. The DateTime object in setStartDateTime cannot be null.
Language cross-reference StartDateTime property in LotusScript NotesDateRange class
Text property Read-Write. The text associated with a range formatted as Domino date-time text.
Defined in DateRange
Data type Object of type java.lang.String
Syntax public String getText() throws NotesException public void setText(String text) throws NotesException
Language cross-reference Text property in LotusScript NotesDateRange class
DateTime class Represents a date and time.
Syntax public class DateTime extends Base
Containment Contained by: AgentContext, Database, DateRange, DateTime, Document, Session, and View
Properties DateOnly through getDateOnly GMTTime through getGMTTime IsDST through isDST LocalTime through getLocalTime, setLocalTime, and setLocalDate Parent through getParent TimeOnly through getTimeOnly TimeZone through getTimeZone
Chapter 2. Java Classes A-Z
379
ZoneTime through getZoneTime
Methods adjustDay adjustHour adjustMinute adjustMonth adjustSecond adjustYear convertToZone recycle setAnyDate setAnyTime setNow timeDifference toJavaDate toString
Creation To create a new DateTime object, use createDateTime in Session.
Usage After creating a DateTime object with createDateTime, you can reset the date and time with setLocalTime and setLocalDate. The createDateTime method takes a String, java.util.Date, or java.util.Calendar parameter. One form of setLocalTime takes a String parameter, another form takes a java.util.Date parameter, and a third form takes a java.util.Calendar parameter. Other forms of setLocalTime and setLocalDate take multiple int parameters. The String form of the date parameter is a date, followed by a space, followed by a time. You can specify a date without a time, and a time without a date, but the time zone will not be set (see ″Time zones″ below). The following applies when setting a date and time from a String value: v The date and time components are interpreted according to the regional settings of the operating system if possible. For example, if the regional setting for dates is M/d/yy, then ″3/4/05″ means 4 March 2005. v If the date or time cannot be interpreted using the regional setting, alternate settings are tried until one works. For example, if the regional setting for dates is M/d/yy, then ″13/4/05″ means 13 April 2005 (using d/M/yy as the alternate setting) and ″13/33/05″ means 13 May 2033 (using d/yy/M as the alternate setting).
380
Programming Guide, Volume 3: Java/CORBA Classes
v If the date or time cannot be interpreted using any setting, the following exception is thrown: NOTES_ERR_INVALID_DATE (4045). The java.util.Calendar class can be used to avoid dependencies on regional settings. For example, you can use getInstance and one of the set methods to create the parameter for createDateTime.
Time zones When you create a new DateTime object, the time zone setting in Domino determines the TimeZone property. For example, if the code runs on a computer where the Domino time zone is set to Eastern Standard Time, the TimeZone property of any new DateTime object is automatically set to 5. The time zone setting also affects the GMTTime and LSGMTTime properties. If you create a date without a time component or without a date component, the time zone is invalid and the TimeZone property returns 0. In this case, both LocalTime and GMTTime return the same time value without a time zone appended. If you apply convertToZone, the time zone remains invalid and TimeZone remains 0; no error occurs.
Today, Tomorrow, and Yesterday When you create a new DateTime object using an expression such as ″Today,″ ″Tommorow,″ or ″Yesterday,″ the value of the date is determined using the current date setting in Domino. These expressions have no effect on the time component of a DateTime object. To set a DateTime to the current date and time, specify the time after ″Today″ or ″Yesterday″ (for example, ″Today 12:00:00 AM″) or use setNow.
Access To access a date-time value stored in an item in a Domino document, use getDateTimeValue in Item. You can get the operating system date and time separators, and time zone settings through the International class.
Examples: DateTime class 1. This agent creates a DateTime object that represents 4 March 2005 at 6:07:08 AM. The use of java.util.Calendar eliminates dependencies on regional settings. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) java.util.Calendar jdt = java.util.Calendar.getInstance(); jdt.set(2005, 2, 4, 6, 7, 8); DateTime dt = session.createDateTime(jdt); System.out.println("Local time = " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent creates a NotesDateTime object that represents 4 March 2005 at 6:07:08 if the regional setting is appropriate, for example, M/d/yy h:mm:ss. When you set the date from a String, you must be sure that the regional settings of the user’s computer are appropriate to the String value. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Chapter 2. Java Classes A-Z
381
Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) if ((session.getInternational().isDateMDY()) && (session.getInternational().getDateSep().equals("/")) && (session.getInternational().getTimeSep().equals(":"))) { DateTime dt = session.createDateTime("3/4/05 6:07:08"); System.out.println("Local time = " + dt.getLocalTime()); } else System.out.println("Date format not MDY with / and :"); } catch(Exception e) { e.printStackTrace(); } } }
3. This agent creates a new DateTime object that represents today’s date. The time component of the DateTime object is not set. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); System.out.println(dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
4. This agent creates a new DateTime object that represents the current date and time. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println(dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
5. This agent gets the value of the PurgeDate item in a document and places it into a DateTime object. The time zone setting of PurgeDate is preserved. For example, if PurgeDate has a value of 03/21/96 04:54:33 PM in Eastern Standard Time, the DateTime object represents 03/21/96 04:54:33 PM and its TimeZone property equals 5. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Document doc = agentContext.getDocumentContext(); Item item = doc.getFirstItem("PurgeDate"); DateTime dt = item.getDateTimeValue();
382
Programming Guide, Volume 3: Java/CORBA Classes
System.out.println("Local time = " + dt.getLocalTime() + " TZ" + dt.getTimeZone()); } catch(Exception e) { e.printStackTrace(); } } }
DateOnly property Read-only. A string representation of the date part of the time-date.
Defined in DateTime
Data type String
Syntax public String getDateOnly() throws NotesException
Language cross-reference DateOnly property in LotusScript NotesDateTime class @Date function in formula language
Examples: DateOnly property This agent prints the creation date of the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime createdDateTime = db.getCreated(); String sCreatedDate = createdDateTime.getDateOnly(); System.out.println ("Database \"" + db.getTitle() + "\" was created on " + sCreatedDate + "."); } catch(Exception e) { e.printStackTrace(); } } }
GMTTime property Read-only. A string representing a date-time, converted to Greenwich Mean Time (timezone 0).
Defined in DateTime
Data type String
Syntax public String getGMTTime() throws NotesException
Chapter 2. Java Classes A-Z
383
Usage The GMT time for a date created from a string is determined using the operating system time zone setting, unless the date string specifies a time zone.
Language cross-reference GMTTime property in LotusScript NotesDateTime class
Examples: GMTTime property This agent prints the creation date and time of the current database in GMT. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime createdDateTime = db.getCreated(); String sGMTTime = createdDateTime.getGMTTime(); System.out.println ("Database \"" + db.getTitle() + "\" was created on " + sGMTTime + "."); } catch(Exception e) { e.printStackTrace(); } } }
IsDST property Read-only. Indicates whether the time reflects daylight-saving time.
Defined in DateTime
Data type boolean
Syntax public boolean isDST() throws NotesException
Legal values v true if the current computer is set to observe daylight-saving time, and daylight-saving time is currently in effect (for example, from mid-April to mid-October) v false if the current computer is set to observe daylight-saving time, but daylight-saving time is not currently in effect (for example, from mid-October to mid-April); the current computer is not set to observe daylight-saving time; the DateTime object has no date component; or the DateTime object has no time component
Usage For remote (IIOP) operations, the current computer is the Domino server. For local operations, the current computer is the computer on which the program is running. The convertToZone method and LocalTime property may modify the value of this property.
384
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference IsDST property in LotusScript NotesDateTime class @Zone function in formula language
Examples: IsDST property This agent prints one message or another depending on whether daylight-saving time is in effect. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); if (dt.isDST()) System.out.println("Enjoy the long days"); else System.out.println("Endure the darkness"); } catch(Exception e) { e.printStackTrace(); } } }
LocalTime property Read-Write. A string representing a date-time in the local time zone. Additional methods let you set the local time with Date, integer, and Boolean values.
Defined in DateTime
Data type String
Syntax public String getLocalTime() throws NotesException public void setLocalTime(String dt) throws NotesException public void setLocalTime(java.util.Date dt) throws NotesException public void setLocalTime(java.util.Calendar dt) throws NotesException
Note: This signature is new with Release 6. public void setLocalDate(int year, int month, int day) throws NotesException public void setLocalDate(int year, int month, int day, boolean preserveLocalTime) throws NotesException public void setLocalTime(int hour, int minute, int second, int hundredth) throws NotesException
Usage When you set this property, it changes the value of the date-time that the object represents, and therefore affects the GMTTime property.
Chapter 2. Java Classes A-Z
385
The dt, year, month, day, hour, minute, second, and hundredth parameters specify the new time. The preserveLocalTime parameter affects adjustments from the existing date that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour so that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour. Setting this property with a java.util.Calendar object may also change the time zone.
Language cross-reference LocalTime property in LotusScript NotesDateTime class
Examples: LocalTime property 1. This agent prints the creation date and time of the current database in local time. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime createdDateTime = db.getCreated(); String sLocalTime = createdDateTime.getLocalTime(); System.out.println ("Database \"" + db.getTitle() + "\" was created on " + sLocalTime + "."); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent sets the local date and time, then prints the date and time in local time and GMT. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setLocalTime("12/12/97 04:30:00 PM"); System.out.println(dt.getLocalTime()); System.out.println(dt.getGMTTime()); } catch(Exception e) { e.printStackTrace(); } } }
3. This agent is the same as above but passes the date and time as integer values to setLocalDate and setLocalTime, rather than as a string to setLocalTime. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setLocalDate(1997, 12, 12, true);
386
Programming Guide, Volume 3: Java/CORBA Classes
dt.setLocalTime(1, 30, 0, 0); System.out.println(dt.getLocalTime()); System.out.println(dt.getGMTTime()); } catch(Exception e) { e.printStackTrace(); } } }
Parent property Read-only. The Notes session that contains a DateTime object.
Defined in DateTime
Data type Session
Syntax public Session getParent() throws NotesException
Language cross-reference Parent property in LotusScript NotesDateTime class
TimeOnly property Read-only. A string representation of the time part of the date-time.
Defined in DateTime
Data type String
Syntax public String getTimeOnly() throws NotesException
Language cross-reference TimeOnly property in LotusScript NotesDateTime class
Examples: TimeOnly property This agent prints the creation time of the current database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DateTime createdDateTime = db.getCreated(); String sCreatedTime = createdDateTime.getTimeOnly(); System.out.println ("Database \"" + db.getTitle() + "\" was created at " + sCreatedTime + "."); } catch(Exception e) {
Chapter 2. Java Classes A-Z
387
e.printStackTrace(); } } }
TimeZone property Read-only. An integer representing the time zone of a date-time. This integer indicates the number of hours that must be added to the time to get Greenwich Mean Time when daylight-saving time is not in effect. May be positive or negative.
Defined in DateTime
Data type Integer
Syntax public int getTimeZone() throws NotesException
Usage When you create a new DateTime object, this property is set according to the time zone setting of the computer on which the program runs or, for remote (IIOP) operations, the Domino server. This property is not set and returns 0 if the DateTime object does not include both a time and a date. When you access a date-time value from an item in a document using the DateTimeValue property in Item, this property is set according to the time zone stored in the item. The convertToZone method and LocalTime property may modify the value of this property.
Language cross-reference TimeZone property in LotusScript NotesDateTime class @Zone function in formula language
Examples: TimeZone property This agent prints the time zone in the CreationDateSaved item of each document in the current database. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { Vector dtv = doc.getItemValue("CreationDateSaved"); DateTime cds = (DateTime)dtv.firstElement(); int zone = cds.getTimeZone(); System.out.println (doc.getItemValueString("Subject") + " was created in time zone " + zone); doc = dc.getNextDocument(); } } catch(Exception e) {
388
Programming Guide, Volume 3: Java/CORBA Classes
e.printStackTrace(); } } }
ZoneTime property Read-only. A string representation of the time adjusted for the TimeZone and IsDST properties.
Defined in DateTime
Data type String
Syntax public String getZoneTime() throws NotesException
Usage Initially ZoneTime is the same as LocalTime. If you use the convertToZone method or LocalTime, changes to TimeZone and IsDST are reflected in ZoneTime, but LocalTime stays the same.
Language cross-reference ZoneTime property in LotusScript NotesDateTime class @Zone function in formula language
adjustDay method Increments a date-time by the number of days you specify.
Defined in DateTime
Syntax public void adjustDay(int n) throws NotesException public void adjustDay(int n, boolean preserveLocalTime) throws NotesException
Parameters int n
The number of days by which to increment the date-time. Can be positive or negative. boolean preserveLocalTime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a time component, this method has no effect. The number of days by which you increment a DateTime object can cause the month to be incremented.
Chapter 2. Java Classes A-Z
389
Language cross-reference AdjustDay method in LotusScript NotesDateTime class @Adjust function in formula language
Examples: adjustDay method This agent decrements the date by 10 days. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Today: " + dt.getLocalTime()); dt.adjustDay(-10, true); System.out.println("Ten days ago: " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
adjustHour method Increments a date-time by the number of hours you specify.
Defined in DateTime
Syntax public void adjustHour(int n) throws NotesException public void adjustHour(int n, boolean preservelocaltime) throws NotesException
Parameters int n
The number of hours by which to increment the date-time. Can be positive or negative. boolean preservelocaltime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a date component, this method has no effect. The number of hours by which you increment a DateTime object can cause the date component to be adjusted, too. For example, if the adjustment is +24, the date component changes to the next calendar day.
390
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference AdjustHour method in LotusScript NotesDateTime class @Adjust function in formula language
Examples: adjustHour method This agent decrements the time by 10 hours. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Now: " + dt.getLocalTime()); dt.adjustHour(-10, true); System.out.println("Ten hours ago: " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
adjustMinute method Increments a date-time by the number of minutes you specify.
Defined in DateTime
Syntax public void adjustMinute(int n) throws NotesException public void adjustMinute(int n, boolean preservelocaltime) throws NotesException
Parameters int n
The number of minutes by which to increment the date-time. Can be positive or negative. boolean preservelocaltime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a date component, this method has no effect. The number of minutes by which you increment a DateTime object can cause the date component to be adjusted, too. For example, if the adjustment is +1440, the date component changes to the next calendar day.
Chapter 2. Java Classes A-Z
391
Language cross-reference AdjustMinute method in LotusScript NotesDateTime class @Adjust function in formula language
Examples: adjustMinute method This agent decrements the time by 10 minutes. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Now: " + dt.getLocalTime()); dt.adjustMinute(-10, true); System.out.println("Ten minutes ago: " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
adjustMonth method Increments a date-time by the number of months you specify.
Defined in DateTime
Syntax public void adjustMonth(int n) throws NotesException public void adjustMonth(int n, boolean preservelocaltime) throws NotesException
Parameters int n
The number of months by which to increment the date-time. Can be positive or negative. boolean preservelocaltime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a time component, this method has no effect. The number of months by which you increment a DateTime object can cause the year to be incremented. For example, if the adjustment is +12, the date component changes to the next calendar year.
Language cross-reference AdjustMonth method in LotusScript NotesDateTime class @Adjust function in formula language
392
Programming Guide, Volume 3: Java/CORBA Classes
Examples: adjustMonth method This agent decrements the date by 10 months. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Today: " + dt.getLocalTime()); dt.adjustMonth(-10, true); System.out.println("Ten months ago: " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
adjustSecond method Increments a date-time by the number of seconds you specify.
Defined in DateTime
Syntax public void adjustSecond(int n) throws NotesException public void adjustSecond(int n, boolean preservelocaltime) throws NotesException
Parameters int n
The number of seconds by which to increment the date-time. Can be positive or negative. boolean preservelocaltime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a date component, this method has no effect.
Language cross-reference AdjustSecond method in LotusScript NotesDateTime class @Adjust function in formula language
Examples: adjustSecond method This agent decrements the time by 10 seconds. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Chapter 2. Java Classes A-Z
393
// (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Now: " + dt.getLocalTime()); dt.adjustSecond(-10, true); System.out.println("Ten seconds ago: " + dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
adjustYear method Increments a date-time by the number of years you specify.
Defined in DateTime
Syntax public void adjustYear(int n) throws NotesException public void adjustYear(int n, boolean preservelocaltime) throws NotesException
Parameters int n
The number of years by which to increment the date-time. Can be positive or negative. boolean preservelocaltime
Affects adjustments that cross a daylight-saving time boundary. Specify true to increment or decrement the GMT time by one hour such that a 24-hour adjustment yields the same local time in the new day. If this parameter is false or omitted, GMT time remains as adjusted and local time gains or loses an hour.
Usage If the DateTime object consists of only a time component, this method has no effect. The number of years by which you increment a DateTime object can cause the century to change. If this happens, the year is represented as a string with four digits instead of two, such as 08/18/2001.
Language cross-reference AdjustYear method in LotusScript NotesDateTime class @Adjust function in formula language
Examples: adjustYear method This agent decrements the date by 10 years. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today"); dt.setNow(); System.out.println("Today: " + dt.getLocalTime()); dt.adjustYear(-10, true); System.out.println("Ten years ago: " +
394
Programming Guide, Volume 3: Java/CORBA Classes
dt.getLocalTime()); } catch(Exception e) { e.printStackTrace(); } } }
convertToZone method Changes the TimeZone and IsDST properties as specified.
Defined in DateTime
Syntax public void convertToZone(int zone, boolean isDST) throws NotesException
Parameters int zone
A time zone -12 through 12. boolean isDST
Indicates whether daylight-saving time is in effect (true) or not (false).
Usage These changes also affect the ZoneTime property. These changes do not affect the GMTTime and the LocalTime properties. This method has no effect on an invalid TimeZone (because the DateTime object lacks the date or the time). TimeZone continues to return 0.
Language cross-reference ConvertToZone method in LotusScript NotesDateTime class
Examples: convertToZone method and ZoneTime property This agent converts today at 6:00 AM to all the time zones using daylight-saving time. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DateTime dt = session.createDateTime("Today 06:00"); System.out.println("Zone\tTime"); for(int i=-12; i 0) printResponses(responses, "\t"); doc = view.getNextSibling(doc); } } catch(Exception e) { e.printStackTrace(); } }
Chapter 2. Java Classes A-Z
435
public void printResponses(DocumentCollection dc, String tabs) { try { Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println(tabs + doc.getItemValueString("Subject")); DocumentCollection dc2 = doc.getResponses(); if (dc2.getCount() > 0) printResponses(dc2, tabs + "\t"); doc = dc.getNextDocument(doc); } } catch(Exception e) { e.printStackTrace(); } } }
Signer property Read-only. The name of the person who created the signature, if a document is signed.
Defined in Document
Data type String
Syntax public String getSigner() throws NotesException
Usage If a document is not signed, returns an empty string. If the signer is not trusted, returns an empty string.
Language cross-reference Signer property in LotusScript NotesDocument class @Certificate function in formula language
Size property Read-only. The size of a document in bytes, which includes the size of any file attachments to the document.
Defined in Document
Data type int
Syntax public int getSize() throws NotesException
436
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference Size property in LotusScript NotesDocument class @DocLength function in formula language
Examples: Size property This agent gets the size of every document in a database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); View view = db.getView("All Documents"); Document doc = view.getFirstDocument(); while (doc != null) { System.out.println("\"" + doc.getItemValueString("Subject") + "\" consumes " + doc.getSize() + " bytes."); doc = view.getNextSibling(doc); } } catch(Exception e) { e.printStackTrace(); } } }
UniversalID property Read-Write. The universal ID, which uniquely identifies a document across all replicas of a database. In character format, the universal ID is a 32-character combination of hexadecimal digits (0-9, A-F). The universal ID is also known as the unique ID or UNID.
Defined in Document
Data type String
Syntax public String getUniversalID() throws NotesException public void setUniversalID(String unid) throws NotesException
Usage If two documents in replica databases share the same universal ID, the documents are replicas. If you modify the UNID of an existing document, it becomes a new document. Saving a document with the same UNID as an existing document throws NotesError.NOTES_MIN_ERROR_CODE (4000). See @DocumentUniqueID for another way to get the Universal ID of a document and more information.
Chapter 2. Java Classes A-Z
437
Language cross-reference UniversalID property in LotusScript NotesDocument class @DocumentUniqueID function in formula language
Examples: UniversalID property This agent constructs a universal ID for a new document from the agent comment. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Agent agent = agentContext.getCurrentAgent(); String topicID = agent.getComment(); if (topicID != null && topicID.length() == 8) { Document doc = db.createDocument(); doc.appendItemValue("Form", "Main Topic"); doc.appendItemValue("Subject", "Topic # " + topicID); doc.appendItemValue("Categories", "Numbered topics"); doc.setUniversalID("AAAABBBBCCCCDDDDEEEEFFFF" + topicID); doc.save(); System.out.println("Universal ID for new topic is " + doc.getUniversalID()); } else System.out.println("TopicID must be 8 characters"); } catch(NotesException e) { if (e.id == NotesError.NOTES_MIN_ERROR_CODE) System.out.println("TopicID is not unique"); else System.out.println(e.id + " " + e.text); } catch(Exception e) { e.printStackTrace(); } } }
Verifier property Read-only. The name of the certificate that verified a signature, if a document is signed.
Defined in Document
Data type String
Syntax public String getVerifier() throws NotesException
Usage This property is an empty string if the document is not signed. This property is an empty string if the signer is not trusted.
438
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference Verifier property in LotusScript NotesDocument class
appendItemValue method Creates a new item in a document and optionally sets the item value. Note: In general, replaceItemValue is favored over appendItemValue. If an item of the same name already exists in a document, appendItemValue creates a second item of the same name, and the duplicate items are not accessible except through a work-around. If you are creating a new document, appendItemValue is safe.
Defined in Document
Syntax public Item appendItemValue(String name) throws NotesException public Item appendItemValue(String name, int value) throws NotesException public Item appendItemValue(String name, double value) throws NotesException public Item appendItemValue(String name, Object value) throws NotesException
Parameters String name
The name of the new item. int value
The value of the new item. double value
The value of the new item. Object value
The value of the new item. The data type of the new item depends upon the data type of the value that you place in it. Data type of value
Resulting item
String
Text
Integer
Number
Double
Number
DateTime
Date-time item
java.util.Vector with String, Integer, Double, or DateTime elements
Multi-value text, number, or date-time item
Item
Same data type as the Item
Return value Item
The new item. Chapter 2. Java Classes A-Z
439
Usage To keep the new item, you call save after calling appendItemValue. If the document already has an item called name, appendItemValue does not replace it. Instead, it creates another item of the same name and gives it the value you specify.
Language cross-reference AppendItemValue method in LotusScript NotesDocument class
Examples: appendItemValue method This agent creates text, multi-value text, numeric (from int), numeric (from double), multi-value numeric (from Vector of Integer values), and date-time items. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "Main Topic"); // Create text item with one String value doc.appendItemValue("Subject", "Test appendItemValue"); // Create text item with multiple String values Vector stringMultiple = new Vector(); stringMultiple.addElement("String one"); stringMultiple.addElement("String two"); stringMultiple.addElement("String three"); doc.appendItemValue("stringMultiple", stringMultiple); // Create numeric item with one int value doc.appendItemValue("integer", 101); // Create numeric item with one double value doc.appendItemValue("double", 1.01); // Create numeric item with multiple Integer values Vector integerMultiple = new Vector(); Integer one = new Integer(1); integerMultiple.addElement(one); Integer two = new Integer(2); integerMultiple.addElement(two); Integer three = new Integer(3); integerMultiple.addElement(three); doc.appendItemValue("integerMultiple", integerMultiple); // Create time item with one DateTime value DateTime timenow = session.createDateTime("Today"); timenow.setNow(); doc.appendItemValue("dateTime", timenow); if (doc.save()) System.out.println("Document created and saved"); else System.out.println("Something went wrong"); } catch(Exception e) { e.printStackTrace(); } } }
440
Programming Guide, Volume 3: Java/CORBA Classes
closeMIMEEntities method Closes MIME processing associated with items of a specified name. Note: This method is new with Release 6.
Defined in Document
Syntax public boolean closeMIMEEntities() throws NotesException public boolean closeMIMEEntities(boolean savechanges) throws NotesException public boolean closeMIMEEntities(boolean savechanges, String entityitemname) throws NotesException
Parameters boolean savechanges
Whether MIME entity content and header changes are saved in the associated in-memory items. v true retains changes to MIME entity content and headers. v false (default) discards changes to MIME entity content and headers. String entityitemname
The name of the item or items associated with the MIME processing. ″Body″ is the default.
Return value v true if MIME processing for the items closes successfully v false if MIME processing for the items does not close successfully
Usage This method allows you terminate the scope of MIME processing so you can safely work on items through the item interface. Do not work on items directly without first closing MIME processing. Saving the MIME entity content and headers with this method is an in-memory process. To save document content permanently, you must call save in NotesDocument. This method returns false if no MIME processing is associated with items of the specified name.
Language cross-reference CloseMIMEEntities method in LotusScript NotesDocument class
Examples: closeMIMEEntities method This agent changes a MIME header, closes MIME processing, and deletes the associated ″Body″ items. Closing MIME processing with the save option pushes the header change to the ″Subject″ item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Do not convert MIME to rich text Chapter 2. Java Classes A-Z
441
session.setConvertMIME(false); DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { MIMEEntity mime = doc.getMIMEEntity(); if (mime != null) { MIMEHeader header = mime.getNthHeader("Subject"); if (header != null) { header.setHeaderVal (header.getHeaderVal() + " - Body removed"); if (doc.closeMIMEEntities(true, "Body")) { doc.removeItem("Body"); } } else { System.out.println ("No Subject header - " + doc.getItemValueString("Subject")); } } else { System.out.println ("Not MIME - " + doc.getItemValueString("Subject")); } doc.save(true, true); doc = dc.getNextDocument(doc); } // Restore MIME conversion session.setConvertMIME(true); } catch(Exception e) { e.printStackTrace(); } } }
computeWithForm method Validates a document by executing the default value, translation, and validation formulas, if any are defined in the document form.
Defined in Document
Syntax public boolean computeWithForm(boolean dodatatypes, boolean raiseerror) throws NotesException
Parameters boolean dodatatypes
The method ignores this parameter. Specify either true or false. boolean raiseerror
If true, an error is raised if the validation fails. If false, no error is raised; instead, the method returns false if validation fails.
Return value v true if there are no errors in the document v false if there are errors in the document
442
Programming Guide, Volume 3: Java/CORBA Classes
Usage The form is as follows: 1. The form stored in the document, if any. 2. The value of the Form item, if no form is stored in the document. 3. The database default form, if the document does not have a Form item. In the user interface, you must use a form to create a document. The document must meet the form requirements for input validation, and the user interface informs you if the document does not meet these requirements. Programatically you can create a document without a form. The computeWithForm method provides a means of checking that the data you placed in a document meets the requirements of a form, although (unlike in the user interface) you can still save a document if computeWithForm returns false or throws an exception.
Language cross-reference ComputeWithForm method in LotusScript NotesDocument class @IsValid function in formula language .
Examples: computeWithForm method Assume that the Subject field on the ″Main Topic″ form contains the following validation formula: @If( Subject = ""; @Failure( "You must enter a Subject" ); @Success )
The following agent as it stands does not save the document. If the replaceItemValue line for Subject is uncommented, the agent saves the document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); // doc.replaceItemValue("Subject", "Subject of document"); doc.replaceItemValue("Body", "Text of document."); if (doc.computeWithForm(false, false)) { System.out.println("Saving document ..."); doc.save(true, true); } else System.out.println("Document not saved.. no subject"); } catch(Exception e) { e.printStackTrace(); } } }
copyAllItems method Copies all items in the current document into the destination document. The item names are unchanged.
Defined in Document
Syntax public void copyAllItems(Document doc, boolean replace) throws NotesException Chapter 2. Java Classes A-Z
443
Parameters Document
The destination document. boolean replace
If true, the items in the destination document are replaced. If false, the items in the destination document are appended.
Usage If you are not copying to a newly created document, you should probably specify true for the second parameter. See appendItemValue for a note about appending items to existing documents.
Language cross-reference CopyAllItems method in LotusScript NotesDocument class
Examples: copyAllItems method This agent copies all items from an existing document into a newly created one. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.search("Subject = \"Test appendItemValue\""); if (dc.getCount() == 1) { Document doc = dc.getFirstDocument(); Document docCopy = db.createDocument(); doc.copyAllItems(docCopy, false); docCopy.replaceItemValue("Subject", "Copy of test appendItemValue"); if (docCopy.save()) System.out.println("Document saved"); else System.out.println("Something went wrong"); } } catch(Exception e) { e.printStackTrace(); } } }
copyItem method Copies an item into the current document and optionally assigns the copied item a new name.
Defined in Document
Syntax public Item copyItem(Item item) throws NotesException public Item copyItem(Item item, String newname) throws NotesException
Parameters Item item
The item, usually from another document, that you want to copy. Cannot be null.
444
Programming Guide, Volume 3: Java/CORBA Classes
String newname
The name to assign to the copied item. Specify null to retain the existing name of the item.
Return value Item
A copy of the specified item parameter, identical except for its newname.
Language cross-reference CopyItem method in LotusScript NotesDocument class
Examples: copyItem method This agent copies an item from an existing document to a newly created document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.search( "Subject = \"Test appendItemValue\""); if (dc.getCount() == 1) { Document doc = dc.getFirstDocument(); Document docCopy = db.createDocument(); docCopy.replaceItemValue("Form", "Main Topic"); docCopy.replaceItemValue("Subject", "Copy of test appendItemValue"); Item bodyItem = doc.getFirstItem("Body"); docCopy.copyItem(bodyItem, ""); if (docCopy.save()) System.out.println("Document saved"); else System.out.println("Something went wrong"); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
copyToDatabase method Copies a document to a specified database.
Defined in Document
Syntax public Document copyToDatabase(Database db) throws NotesException
Parameters Database db
The database to which you want to copy the document. Cannot be null.
Chapter 2. Java Classes A-Z
445
Return value Document
The new document in the specified database.
Language cross-reference CopyToDatabase method in LotusScript NotesDocument class
Examples: copyToDatabase method This agent copies the documents in a view of one database to a newly created database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Database newdb = db.createCopy(null, "archive"); System.out.println("Archive created"); View view = db.getView("By Category"); Document doc = view.getFirstDocument(); int count = 0; while (doc != null) { doc.copyToDatabase(newdb); count++; doc = view.getNextDocument(doc); } System.out.println(count + " documents copied to archive"); } catch(Exception e) { e.printStackTrace(); } } }
createMIMEEntity method Creates an uninitialized top-level MIME entity in a document. Note: This method is new with Release 6.
Defined in Document
Syntax public MIMEEntity createMIMEEntity() throws NotesException public MIMEEntity createMIMEEntity(String itemName) throws NotesException
Parameters String itemName
The name of the item containing the MIME entity. ″Body″ is the default.
Return value MIMEEntity
The new MIME entity.
446
Programming Guide, Volume 3: Java/CORBA Classes
Usage An item created with this method is of type MIME_PART. To initialize the MIME entity, provide some content and save the containing document. A MIME entity named ″Body″ gets special support as a Domino mail message. In particular, non-Content headers become items in the document. If you specify an item name other than Body, the containing document cannot be mailed.
Language cross-reference CreateMIMEEntity method in LotusScript NotesDocument class
Examples: createMIMEEntity method This agent creates a mail message in MIME format. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Stream stream = session.createStream(); session.setConvertMIME(false); // Do not convert MIME to RT Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Memo"); MIMEEntity body = doc.createMIMEEntity(); header = body.createHeader("Subject"); header.setHeaderVal("MIME message"); header = body.createHeader("To"); header.setHeaderVal("Roberta Person"); stream.writeText("Text of message."); body.setContentFromText(stream, "text/plain;charset=UTF-8", MIMEEntity.ENC_NONE); doc.send(false); session.setConvertMIME(true); // Restore conversion } catch(Exception e) { e.printStackTrace(); } } }
createReplyMessage method Creates a new document that is formatted as a reply to the current document.
Defined in Document
Syntax public Document createReplyMessage(boolean toall) throws NotesException
Parameters boolean toall
Chapter 2. Java Classes A-Z
447
If true, the new document recipient list contains all the recipients of the original. If false, the new document recipient list contains only the sender of the original.
Return value Document
A reply to the current document.
Usage The new document does not contain a Subject item. If you want one, the program must explicitly add it to the document. The new document does not automatically get mailed. If you want to mail it, the program must explicitly call the send method.
Language cross-reference CreateReplyMessage method in LotusScript NotesDocument class
Examples: createReplyMessage method This agent sends a reply message for all documents in a view. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DbDirectory dir = session.getDbDirectory(null); Database db = dir.openMailDatabase(); View view = db.getView("Filed but not forgotten"); Document doc = view.getFirstDocument(); while (doc != null) { Document reply = doc.createReplyMessage(false); reply.replaceItemValue("Subject", "Can’t work on this now"); reply.replaceItemValue("Body", "This has been filed for future consideration."); reply.send(doc.getItemValueString("From")); doc = view.getNextDocument(doc); } } catch(NotesException e) { e.printStackTrace(); } } }
createRichTextItem method Creates a new rich-text item in a document.
Defined in Document
Syntax public RichTextItem createRichTextItem(String name) throws NotesException
Parameters String name
The name of the new rich-text item.
448
Programming Guide, Volume 3: Java/CORBA Classes
Return value RichTextItem
The newly created item.
Usage For more information, see the RichTextItem class.
Language cross-reference CreateRichTextItem method in LotusScript NotesDocument class
Examples: createRichTextItem method This agent creates a rich-text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", "Forest icon"); RichTextItem rtitem = doc.createRichTextItem("Body"); rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, "C:\\Windows\\forest.bmp", "Forest icon"); doc.save(); } catch(Exception e) { e.printStackTrace(); } } }
encrypt method Encrypts a document.
Defined in Document
Syntax public void encrypt() throws NotesException
Usage The encrypted document is not saved until you call save. Only the items for which isEncrypted is true are encrypted. Items for which isEncrypted is false remain visible to any user, even if the user does not have the proper encryption key. If the EncryptionKeys property is set with one or more named keys, those keys are used to encrypt the document. Any user who has one of the encryption keys can decrypt the document. If there are no encryption keys specified, the document is encrypted with the user’s public key, in which case only the user who encrypted the document can decrypt it. If the program is running on a server, it must have permission to use Encrypt. Since mail encryption works differently, do not use this method if you want to mail an encrypted document. Instead, set the EncryptOnSend property to true, and use the send method.
Chapter 2. Java Classes A-Z
449
You cannot use the encrypt method on a Document object returned by getDocumentContext.
Language cross-reference Encrypt method in LotusScript NotesDocument class
Examples: encrypt method and EncryptionKeys property This agent encrypts a document after making sure ″Top Secret″ is one of the encryption keys. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); View view = db.getView("By Category"); Document doc = view.getFirstDocument(); while (doc != null) { Item item = doc.getFirstItem("Body"); if (item != null) { // Make sure the item can be encrypted if (!item.isEncrypted()) item.setEncrypted(true); // Add "Top Secret" to the encryption keys // if not there boolean found = false; Vector v = doc.getEncryptionKeys(); for (int i=0; i 1) { Document doc = dc.getNextDocument(dc.getFirstDocument()); System.out.println("Doc # 2: " + doc.getItemValueString("Subject")); } } catch(Exception e) { e.printStackTrace(); } } }
getLastDocument method Gets the last document in a collection.
Defined in DocumentCollection
Syntax public Document getLastDocument() throws NotesException
Return value Document
The last document in the collection. If there are no documents in the collection, returns null.
Language cross-reference GetLastDocument method in LotusScript NotesDocumentCollection class
Examples: getLastDocument and getPrevDocument methods 1. This agent gets all the documents in a document collection in reverse order, demonstrating the preferred loop structure. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext =
496
Programming Guide, Volume 3: Java/CORBA Classes
session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getLastDocument(); while (doc != null) { System.out.println(doc.getItemValueString ("Subject")); doc = dc.getPrevDocument(); } } catch(Exception e) { e.printStackTrace(); } } }
2. This agent gets the next to the last document in a document collection by using the last document as a parameter to getPrevDocument. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); if (dc.getCount() > 1) { Document doc = dc.getPrevDocument(dc.getLastDocument()); System.out.println("Doc # n-1: " + doc.getItemValueString("Subject")); } } catch(Exception e) { e.printStackTrace(); } } }
getNextDocument method Gets the document immediately following the current document or a specified document in a collection.
Defined in DocumentCollection
Syntax public Document getNextDocument() throws NotesException public Document getNextDocument(Document doc) throws NotesException
Parameters Document doc
Any document in the collection. Cannot be null.
Return value Document
If no parameter, the document following the current document. If a parameter, the document following the specified document. If there is no next document, returns null.
Chapter 2. Java Classes A-Z
497
Usage In remote (IIOP) operations, getNextDocument(Document doc) invalidates the cache and is therefore discouraged. The preferred loop structure is getFirstDocument() followed by getNextDocument() until it returns null. For performance reasons, you should avoid using getNthDocument(int n) and getNextDocument(Document doc) in a loop.
Language cross-reference GetNextDocument method in LotusScript NotesDocumentCollection class NavigateNextSelected @command in formula language NavNextSelected @command in formula language
getNthDocument method Given a position number, returns the document at that position in a collection.
Defined in DocumentCollection
Syntax public Document getNthDocument(int n) throws NotesException
Parameters int n
Integer. A number indicating the document to return. Use 1 to indicate the first document in the collection, 2 to indicate the second document, and so on.
Return value Document
The document in the nth position in the collection. If there is no document at the specified position, returns null.
Usage Collections are renumbered when deletions occur so that the positions of documents after the deleted document change. Using getNthDocument in conjunction with getCount to iterate through a loop is strongly discouraged for performance reasons. See getNextDocument and getPrevDocument for the preferred loop structures.
Language cross-reference GetNthDocument method in LotusScript NotesDocumentCollection class
Examples: getNthDocument method This agent demonstrates a function that gets a document in a document collection specified by number. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase();
498
Programming Guide, Volume 3: Java/CORBA Classes
DocumentCollection dc = db.getAllDocuments(); int N = 3; printDocument(dc, N); } catch(Exception e) { e.printStackTrace(); } } void printDocument(DocumentCollection dc, int n) { try { if (n < 0 || n > dc.getCount()) System.out.println("N out of range"); else System.out.println("Doc #" + n + ": " + dc.getNthDocument(n).getItemValueString("Subject")); } catch(Exception e) { e.printStackTrace(); } } }
getPrevDocument method Gets the document immediately preceding the current document or a specified document in a collection.
Defined in DocumentCollection
Syntax public Document getPrevDocument() throws NotesException public Document getPrevDocument(Document doc) throws NotesException
Parameters Document doc
Any document in the collection. Cannot be null.
Return value Document
If no parameter, the document preceding the current document. If a parameter, the document preceding the specified document. If there is no previous document, returns null.
Usage In remote (IIOP) operations, getPrevDocument(Document doc) invalidates the cache and is therefore discouraged. The preferred loop structure is getLastDocument() followed by getPrevDocument() until it returns null. For performance reasons, you should avoid using getNthDocument(int n) and getPrevDocument(Document doc) in a loop.
Language cross-reference GetPrevDocument method in LotusScript NotesDocumentCollection class NavigatePrevSelected @command in formula language NavPrevSelected @command in formula language
Chapter 2. Java Classes A-Z
499
putAllInFolder method Adds all the documents in the collection to the specified folder. If the folder does not exist in the document’s database, it is created.
Defined in DocumentCollection
Syntax public void putAllInFolder(String folderName) throws NotesException public void putAllInFolder(String folderName, boolean createonfail) throws NotesException
Parameters String folderName
The name of the folder in which to place the documents. The folder may be personal if the script is running on the workstation. If the folder is within another folder, specify a path to it, separating folder names with backward slashes, for example, ″Vehicles\\Bikes″. boolean createonfail
If true (default), creates the folder if it does not exist. If false, throws an exception if the folder does not exist.
Usage For remote (IIOP) operations only, this method moves the current pointer to the first document in the collection. If a document is already inside the folder you specify, putAllInFolder does nothing for that document.
Language cross-reference PutAllInFolder method in LotusScript NotesDocumentCollection class
Examples: putAllInFolder method This agent puts all the documents returned by a full-text search in a folder. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.isFTIndexed()) db.updateFTIndex(false); else db.updateFTIndex(true); DocumentCollection dc = db.getAllDocuments(); dc.FTSearch("blue"); dc.putAllInFolder("Blue", false); } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
removeAll method Permanently removes the documents in a collection from a database.
500
Programming Guide, Volume 3: Java/CORBA Classes
Defined in DocumentCollection
Syntax public void removeAll(boolean force) throws NotesException
Parameters boolean force
If true, a document is removed even if another user modifies the document after it is retrieved. If false, a document is not removed if another user modifies it first.
Usage This method moves the current pointer to the first document in the collection. All documents removed from the database as a result of this operation are also removed from the collection.
Language cross-reference RemoveAll method in LotusScript NotesDocumentCollection class
Examples: removeAll method This agent removes all the documents returned by a full-text search in a folder. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.isFTIndexed()) db.updateFTIndex(false); else db.updateFTIndex(true); DocumentCollection dc = db.getAllDocuments(); dc.FTSearch("blue"); if (dc.getCount() > 0) { System.out.println(dc.getCount() + " \"blue\" documents being removed from database ..."); dc.removeAll(true); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
removeAllFromFolder method Removes all documents in the collection from the specified folder.
Defined in DocumentCollection
Syntax public void removeAllFromFolder(String foldername) throws NotesException
Parameters String foldername
Chapter 2. Java Classes A-Z
501
The name of the folder from which to remove the document. The folder may be personal if the script is running on a workstation. If the folder is within another folder, specify a path to it, separating folder names with backward slashes. For example, ″Vehicles\\Bikes″.
Usage This method moves the current pointer to the first document in the collection. The method does nothing for documents not in the folder you specify. This method does nothing if the folder you specify does not exist.
Language cross-reference RemoveAllFromFolder method in LotusScript NotesDocumentCollection class
Examples: removeAllFromFolder method This agent removes from a folder all the documents returned by a full-text search in a folder. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.isFTIndexed()) db.updateFTIndex(false); else db.updateFTIndex(true); DocumentCollection dc = db.getAllDocuments(); dc.FTSearch("blue"); dc.removeAllFromFolder("Blue"); } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
stampAll method Replaces the value of a specified item in all documents in a collection.
Defined in DocumentCollection
Syntax public void stampAll(String itemname, Object value) throws NotesException
Parameters String itemname
The name of the item. Object value
A value appropriate for the item type. See replaceItemValue.
Usage This method moves the current pointer to the first document in the collection. If the item does not exist, it is created.
502
Programming Guide, Volume 3: Java/CORBA Classes
The item values are immediately written to the server documents. You do not have to use the save method of Document after stampAll. However, any documents modified by your script must be saved before calling stampAll. This method does not modify existing Document objects. Documents must be retrieved again to see the changes.
Language cross-reference StampAll method in LotusScript NotesDocumentCollection class
Examples: stampAll method This agent replaces the value of an item in documents found through a full-text search. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); if (db.isFTIndexed()) db.updateFTIndex(false); else db.updateFTIndex(true); DocumentCollection dc = db.getAllDocuments(); dc.FTSearch("red"); if (dc.getCount() > 0) { System.out.println(dc.getCount() + " \"red\" documents being stamped ..."); dc.stampAll("Color", "red"); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
updateAll method Marks all documents in a collection as processed by an agent. Note: Does not apply to remote calls.
Defined in DocumentCollection
Syntax public void updateAll() throws NotesException
Usage See updateProcessedDoc in AgentContext for a description of the update process.
Language cross-reference UpdateAll method in LotusScript NotesDocumentCollection class
Examples: updateAll method This is an example of an agent that runs on, ″All new & modified documents.″ The agent processes the documents returned by getUnprocessedDocuments and marks them as updated. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Chapter 2. Java Classes A-Z
503
Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { System.out.println(doc.getItemValueString("Subject")); doc = dc.getNextDocument(); } dc.updateAll(); } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
DxlExporter class Represents the conversion of Domino data to DXL (Domino XML). Note: This class is new with Release 6.5.
Containment Contained by: Session
Properties ConvertNotesBitmapsToGIF through getConvertNotesBitmapsToGIF and setConvertNotesBitmapsToGIF DoctypeSYSTEM through getDoctypeSYSTEM and setDoctypeSYSTEM ExitOnFirstFatalError through getExitOnFirstFatalError and setExitOnFirstFatalError ForceNoteFormat through getForceNoteFormat and setForceNoteFormat Log through getLog LogComment through getLogComment and setLogComment OutputDOCTYPE through getOutputDOCTYPE and setOutputDOCTYPE
Methods exportDxl recycle
Creation and access Use createDxlExporter in Session to create a DxlExporter object. Call exportDxl to initiate an export.
Example: DxlExporter class This agent generates DXL from the current database.
504
Programming Guide, Volume 3: Java/CORBA Classes
import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Export to file String filename = "c:\\dxl\\exporteddb.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); System.out.println("Exported " + stream.writeText(exporter.exportDxl(db)) + " bytes to " + filename); } else System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
The file generated by this code can be imported using the code specified in Example 1 of the DXLImporter class.
ConvertNotesBitmapsToGIF property Read-write. Indicates whether bit maps pasted in rich text items should be converted to GIF format.
Defined in DxlExporter
Data type boolean
Syntax public boolean getConvertNotesBitmapsToGIF() throws NotesException public void setConvertNotesBitmapsToGIF(boolean flag) throws NotesException
Legal values v true to convert bit maps v false (default) to leave bit maps in Notes format
Usage Converted bit maps result in the following DXL: gif representation
While non-converted bit maps are: notes representation
Chapter 2. Java Classes A-Z
505
On import, GIF files are converted back to Notes format if the ″originalformat″ attribute is present.
Language cross-reference ConvertNotesBitmapsToGIF property in LotusScript NotesDXLExporter class
DoctypeSYSTEM property Read-write. The value of SYSTEM in the exported !DOCTYPE statement.
Defined in DxlExporter
Data type String
Syntax public String getDoctypeSYSTEM() throws NotesException public void setDoctypeSYSTEM(String system) throws NotesException
Usage OutputDOCTYPE must be true (the default) to export a DOCTYPE statement. This property defaults to SYSTEM ’domino.dtd’ so that, for example, the DOCTYPE statement for a database appears as follows:
Specifying this property as an empty string suppresses the SYSTEM clause.
Language cross-reference DoctypeSYSTEM property in LotusScript NotesDXLExporter class
Example: DoctypeSYSTEM property This agent generates DXL from the current database using the DTD named dominox.dtd instead of the default domino.dtd. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Export to file String filename = "c:\\dxl\\exporteddb.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); exporter.setDoctypeSYSTEM("dominox.dtd"); System.out.println("Exported " + stream.writeText(exporter.exportDxl(db)) + " bytes to " + filename); } else
506
Programming Guide, Volume 3: Java/CORBA Classes
System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
ExitOnFirstFatalError property Read-write. Indicates that processing should terminate if any fatal error is encountered.
Defined in DxlExporter
Data type boolean
Syntax public boolean getExitOnFirstFatalError() throws NotesException public void setExitOnFirstFatalError(boolean flag) throws NotesException
Legal values v true to terminate processing v false (default) to continue processing after a fatal processing error
Language cross-reference ExitOnFirstFatalError property in LotusScript NotesXMLProcessor class
ForceNoteFormat property Read-write. Writes the output DXL as note elements (in the Domino DTD) rather than formatted elements such as document, form, and view.
Defined in DxlExporter
Data type boolean
Syntax public boolean getForceNoteFormat() throws NotesException public void setForceNoteFormat(boolean flag) throws NotesException
Legal values v true for raw DXL output v false (default) for formatted DXL output
Language cross-reference ForceNoteFormat property in LotusScript NotesDXLExporter class
Example: ForceNoteFormat property This agent generates raw DXL from the current database.
Chapter 2. Java Classes A-Z
507
import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Export to file String filename = "c:\\dxl\\exporteddb.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); exporter.setForceNoteFormat(true); System.out.println("Exported " + stream.writeText(exporter.exportDxl(db)) + " bytes to " + filename); } else System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
Log property Read-only. An XML representation of warnings, errors, and fatal errors generated by the processor.
Defined in DxlExporter
Data type String
Syntax public String getLog() throws NotesException
Language cross-reference Log property in LotusScript NotesXMLProcessor class
LogComment property Read-write. A comment added to the top of the log.
Defined in DxlExporter
Data type String
Syntax public String getLogComment() throws NotesException
508
Programming Guide, Volume 3: Java/CORBA Classes
public void setLogComment(String comment) throws NotesException
Language cross-reference LogComment property in LotusScript NotesXMLProcessor class
OutputDOCTYPE property Read-write. Indicates whether a !DOCTYPE statement is exported.
Defined in DxlExporter
Data type String
Syntax public String getOutputDOCTYPE() throws NotesException public void setOutputDOCTYPE(String system) throws NotesException
Legal values v true (default) to export a !DOCTYPE statement v false to not export a !DOCTYPE statement
Usage The !DOCTYPE statement depends on the output and is typically one of the following:
You can change or suppress the SYSTEM clause with DoctypeSYSTEM.
Language cross-reference OutputDOCTYPE property in LotusScript NotesDXLExporter class
Example: OutputDOCTYPE property This agent generates DXL from the current database suppressing the !DOCTYPE statement. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Export to file String filename = "c:\\dxl\\exporteddb.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); exporter.setOutputDOCTYPE(false); System.out.println("Exported " + stream.writeText(exporter.exportDxl(db)) + Chapter 2. Java Classes A-Z
509
" bytes to " + filename); } else System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
exportDxl method Converts Domino data to DXL data.
Defined in DxlExporter
Syntax public String exportDxl(Database database) throws NotesException public String exportDxl(Document document) throws NotesException public String exportDxl(DocumentCollection documentcollection) throws NotesException public String exportDxl(NoteCollection notecollection) throws NotesException
Parameters Database database
The Domino data to be converted, in this case the entire database. Document document
The Domino data to be converted, in this case one document. DocumentCollection documentcollection
The Domino data to be converted, in this case the documents in a document collection. NoteCollection notecollection
The Domino data to be converted, in this case the elements in a note collection.
Return value String
The exported DXL.
Language cross-reference Export in LotusScript NotesDXLExporter class Process in LotusScript NotesXMLProcessor class SetInput in LotusScript NotesXMLProcessor class SetOutput in LotusScript NotesXMLProcessor class
Example: exportDxl method This agent generates DXL for all the design elements from the current database.
510
Programming Guide, Volume 3: Java/CORBA Classes
import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Build note collection of all design elements Database db = agentContext.getCurrentDatabase(); NoteCollection nc = db.createNoteCollection(false); nc.selectAllDesignElements(true); nc.buildCollection(); // Export to file String filename = "c:\\dxl\\exportedstuff.dxl"; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); System.out.println("Exported " + stream.writeText(exporter.exportDxl(nc)) + " bytes to c:\\dxl\\exportedstuff.dxl"); } else System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
DxlImporter class Represents the conversion of DXL (Domino XML) to Domino data. Note: This class is new with Release 6.5.
Containment Contained by: Session
Properties AclImportOption through getAclImportOption and setAclImportOption CreateFTIndex through getCreateFTIndex and setCreateFTIndex DesignImportOption through getDesignImportOption and setDesignImportOption DocumentImportOption through getDocumentImportOption and setDocumentImportOption ExitOnFirstFatalError through getExitOnFirstFatalError and setExitOnFirstFatalError ImportedNoteCount through getImportedNoteCount InputValidationOption through getInputValidationOption and setInputValidationOption Log through getLog Chapter 2. Java Classes A-Z
511
LogComment through getLogComment and setLogComment ReplaceDbProperties through getReplaceDbProperties and setReplaceDbProperties ReplicaRequiredForReplaceOrUpdate through getReplicaRequiredForReplaceOrUpdate and setReplicaRequiredForReplaceOrUpdate UnknownTokenLogOption through getUnknownTokenLogOption and setUnknownTokenLogOption
Methods getFirstImportedNoteID getNextImportedNoteID importDxl recycle
Creation and access Use createDxlImporter in Session to create a DxlImporter object. Use AclImportOption, DesignImportOption, and DocumentImportOption to indicate whether you want to create additional elements in the output database from the incoming DXL, ignore incoming elements, replace existing elements, or update existing elements. Call importDxl to initiate an import.
Example: DxlImporter class 1. This agent imports DXL from a file into a newly created database. import lotus.domino.*; public class JavaAgent extends AgentBase { static DxlImporter importer = null; public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Get DXL file String filename = "c:\\dxl\\exporteddb.dxl"; Stream stream = session.createStream(); if (stream.open(filename) & (stream.getBytes() >0)) { // Create new database - replace if it already exists Database newdb = session.getDatabase(null, "imported"); if (newdb.isOpen()) newdb.remove(); DbDirectory dbdir = session.getDbDirectory(null); newdb = dbdir.createDatabase("imported", true); newdb.setTitle("Imported"); // Import DXL from file to new database importer = session.createDxlImporter(); importer.setReplaceDbProperties(true); importer.setReplicaRequiredForReplaceOrUpdate(false);
512
Programming Guide, Volume 3: Java/CORBA Classes
importer.setAclImportOption( DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE); importer.setDesignImportOption( DxlImporter.DXLIMPORTOPTION_CREATE); importer.importDxl(stream, newdb); } else System.out.println(filename + " does not exist or is empty"); } catch(Exception e) { e.printStackTrace(); } finally { // Print importer log try { System.out.println(importer.getLog()); } catch(Exception e) {e.printStackTrace();} } } }
The file generated by the DXLExporter class example can be imported using this code. 2. This agent exports DXL to a string and imports the string into a newly created database. import lotus.domino.*; public class JavaAgent extends AgentBase { static DxlImporter importer = null; public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get current database Database db = agentContext.getCurrentDatabase(); // Create new database - replace if it already exists Database newdb = session.getDatabase(null, "imported"); if (newdb.isOpen()) newdb.remove(); DbDirectory dbdir = session.getDbDirectory(null); newdb = dbdir.createDatabase("imported", true); newdb.setTitle("Imported"); // Export current database and import into new database importer = session.createDxlImporter(); importer.setReplaceDbProperties(true); importer.setReplicaRequiredForReplaceOrUpdate(false); importer.setAclImportOption( DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE); importer.setDesignImportOption( DxlImporter.DXLIMPORTOPTION_CREATE); DxlExporter exporter = session.createDxlExporter(); importer.importDxl(exporter.exportDxl(db), newdb); } catch(Exception e) { e.printStackTrace(); } finally { // Print importer log try { System.out.println(importer.getLog()); } catch(Exception e) {e.printStackTrace();} } } } Chapter 2. Java Classes A-Z
513
AclImportOption property Read-write. Indicates the handling of the incoming ACL entries: ignore, replace, or update.
Defined in DxlImporter
Data type int
Syntax public int getAclImportOption() throws NotesException public void setAclImportOption(int option) throws NotesException
Legal values v DxlImporter.DXLIMPORTOPTION_IGNORE (1) (Default) Ignores any ACL in the incoming DXL and uses the ACL in the output database as is. v DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE (5) Replaces the ACL in the output database with the ACL in the incoming DXL. v DxlImporter.DXLIMPORTOPTION_UPDATE_ELSE_CREATE (10) Replaces ACL entries in the output database with ACL entries in the incoming DXL that match and adds any new ACL entries from the incoming DXL. v DxlImporter.DXLIMPORTOPTION_UPDATE_ELSE_IGNORE (9) Replaces ACL entries in the output database with ACL entries in the incoming DXL that match and leaves non-matching ACL entries in the output database.
Language cross-reference ACLImportOption property in LotusScript NotesDXLImporter class
CreateFTIndex property Read-write. Indicates whether the database receiving the imported notes is full-text indexed.
Defined in DxlImporter
Data type boolean
Syntax public boolean getCreateFTIndex() throws NotesException public void setCreateFTIndex(boolean flag) throws NotesException
Legal values v true if the database is full-text indexed v false (default) if the database is not full-text indexed
Language cross-reference CreateFTIndex property in LotusScript NotesDXLImporter class
514
Programming Guide, Volume 3: Java/CORBA Classes
DesignImportOption property Read-write. Indicates the handling of the incoming design elements: create, ignore, or replace.
Defined in DxlImporter
Data type int
Syntax public int getDesignImportOption() throws NotesException public void setDesignImportOption(int option) throws NotesException
Legal values v DxlImporter.DXLIMPORTOPTION_IGNORE (1) (Default) Ignores design elements in the incoming DXL and leaves the design elements in the output database intact. v DxlImporter.DXLIMPORTOPTION_CREATE (2) Creates new design elements from the incoming DXL, leaving existing design elements in the output database intact. v DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE (6) Replaces design elements in the output database with design elements in the incoming DXL that match. Adds any new design elements from the incoming DXL. v DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE (5) Replaces design elements in the output database with design elements in the incoming DXL that match. Leaves non-matching design elements in the output database.
Usage For purposes of replacement, two design elements match if: v The design elements are of the same type (forms, views, folders, and so on). v A name or alias in one design element matches a name or alias in the other design element. v The design elements are of the same language if the design element uses a language.
Language cross-reference DesignImportOption property in LotusScript NotesDXLImporter class
DocumentImportOption property Read-write. Indicates the handling of incoming documents: create, ignore, replace, or update.
Defined in DxlImporter
Data type int
Syntax public int getDocumentImportOption() throws NotesException public void setDocumentImportOption(int option) throws NotesException
Chapter 2. Java Classes A-Z
515
Legal values v DxlImporter.DXLIMPORTOPTION_IGNORE (1) Ignores documents in the incoming DXL and leaves the documents in the output database intact. v DxlImporter.DXLIMPORTOPTION_CREATE (2) (Default) Creates new documents from the incoming DXL, leaving existing documents in the output database intact. v DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE (6) Replaces documents in the output database with documents in the incoming DXL that match. Adds any new documents from the incoming DXL. v DxlImporter.DXLIMPORTOPTION_REPLACE_ELSE_IGNORE (5) Replaces documents in the output database with documents in the incoming DXL that match. Leaves non-matching documents in the output database. v DxlImporter.DXLIMPORTOPTION_UPDATE_ELSE_CREATE (10) Replaces document items in the output database with document items in the incoming DXL that match. Adds new documents and document items from the incoming DXL. v DxlImporter.DXLIMPORTOPTION_UPDATE_ELSE_IGNORE (9) Replaces document items in the output database with document items in the incoming DXL that match. Leaves non-matching documents and document items in the output database.
Usage For purposes of replacement, two documents match if: v The replica ID of the output database matches the replica ID of the incoming DXL. v The universal IDs of the two documents match.
Language cross-reference DocumentImportOption property in LotusScript NotesDXLImporter class
ExitOnFirstFatalError property Read-write. Indicates that processing should terminate if any fatal error is encountered.
Defined in DxlImporter
Data type boolean
Syntax public boolean getExitOnFirstFatalError() throws NotesException public void setExitOnFirstFatalError(boolean flag) throws NotesException
Legal values v true to terminate processing v false (default) to continue processing after a fatal processing error
Language cross-reference ExitOnFirstFatalError property in LotusScript NotesXMLProcessor class
ImportedNoteCount property Read-only. The number of Domino notes being imported.
516
Programming Guide, Volume 3: Java/CORBA Classes
Defined in DxlImporter
Data type int
Syntax public int getImportedNoteCount() throws NotesException
Language cross-reference ImportedNoteCount property in LotusScript NotesDXLImporter class
InputValidationOption property Read-write. Indicates that if a DTD is specified in the XML declaration statement, it should be used to validate the input XML.
Defined in DxlImporter
Data type int
Syntax public int getInputValidationOption() throws NotesException public void setInputValidationOption(int option) throws NotesException
Legal values v DxlImporter.DXLVALIDATIONOPTION_VALIDATE_NEVER (0) Do not try to validate. v DxlImporter.DXLVALIDATIONOPTION_ VALIDATE_ALWAYS (1) Validate the input. v DxlImporter.DXLVALIDATIONOPTION_ VALIDATE_AUTO (2) (Default) If the DTD is specified, validate the input; otherwise, do not validate.
Language cross-reference InputValidationOption property in LotusScript NotesDXLImporter class
Log property Read-only. An XML representation of warnings, errors, and fatal errors generated by the processor.
Defined in DxlImporter
Data type String
Syntax public String getLog() throws NotesException
Language cross-reference Log property in LotusScript NotesXMLProcessor class Chapter 2. Java Classes A-Z
517
LogComment property Read-write. A comment added to the top of the log.
Defined in DxlImporter
Data type String
Syntax public String getLogComment() throws NotesException public void setLogComment(String comment) throws NotesException
Language cross-reference LogComment property in LotusScript NotesXMLProcessor class
ReplaceDbProperties property Read-write. Indicates whether the incoming DXL replaces the database properties.
Defined in DxlImporter
Data type boolean
Syntax public boolean getReplaceDbProperties() throws NotesException public void setReplaceDbProperties(boolean flag) throws NotesException
Legal values v true to replace the database properties from the DXL v false (default) to leave the database properties
Usage This property is useful, for example, when you are using DxlImporter to create a new database and want to import the database title from the DXL to the new database. See the attributes for database in the DominoDTD for a list of the database properties.
Language cross-reference ReplaceDbProperties property in LotusScript NotesDXLImporter class
ReplicaRequiredForReplaceOrUpdate property Read-write. Indicates whether the replica ID of the DXL and the target database must match.
Defined in DxlImporter
Data type boolean
518
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public boolean getReplicaRequiredForReplaceOrUpdate() throws NotesException public void setReplicaRequiredForReplaceOrUpdate(boolean flag) throws NotesException
Legal values v true (default) requires that the replica ID of the DXL and the target database match v false does not require that the replica ID of the DXL and the target database match
Usage If this property is true and the replica IDs do not match, the import operation throws NOTES_ERR_DXLIMPORTER_FAILED (4522) and adds the following message to the log: ″Could not replace/update a matching NoteType note because the ReplicaRequiredForReplaceUpdate property is true and the DXL and database are not replicas.″
Language cross-reference ReplicaRequiredForReplaceOrUpdate property in LotusScript NotesDXLImporter class
UnknownTokenLogOption property Enables you to assign different error messages to different types of errors thrown when unrecognized data is encountered by the importer.
Defined in DxlImporter
Data type int
Syntax public int getUnknownTokenLogOption() throws NotesException public void setUnknownTokenLogOption(int option) throws NotesException
Legal values v DxlImporter.DXLLOGOPTION_FATALERROR (4) (Default) Aborts the import and reports the error to the log. v DxlImporter.DXLLOGOPTION_ERROR (3) Reports the error to the log. v DxlImporter.DXLLOGOPTION_WARNING (2) Displays a warning that an error has been encountered. v DxlImporter.DXLLOGOPTION_IGNORE (1) Does not abort the import, but ignores the error messages. Use this option if validation is on.
Usage Use the InputValidationOption property to turn the validator on or off. The name of the log is IMPORTER.LOG.
Language cross-reference UnknownTokenLogOption property in LotusScript NotesDXLImporter class
Chapter 2. Java Classes A-Z
519
getFirstImportedNoteID method Gets the first note in the collection.
Defined in DxlImporter
Syntax public String getFirstImportedNoteID() throws NotesException
Return value String
The ID of the first note.
Language cross-reference GetFirstImportedNoteID method in LotusScript NotesDXLImporter class
getNextImportedNoteID method Given a note, finds the note immediately following it in a collection.
Defined in DxlImporter
Syntax public String getNextImportedNoteID(String noteid) throws NotesException
Parameters String
A valid note ID.
Return value String noteid
The ID of the note following the specified note.
Language cross-reference GetNextImportedNoteID method in LotusScript NotesDXLImporter class
importDxl method Converts DXL data to Domino data.
Defined in DxlImporter
Syntax public void importDxl(RichTextItem input, Database target) throws NotesException public void importDxl(Stream input, Database target) throws NotesException public void importDxl(String input, Database target) throws NotesException
520
Programming Guide, Volume 3: Java/CORBA Classes
Parameters Database target
The target database for the DXL. RichTextItem input
The input DXL. Stream input
The input DXL. String
The input DXL.
Usage Before calling this method, set ACLImportOption, DesignImportOption, and DocumentImportOption. You cannot explicitly read or write a Stream object associated with a file prior to using it for XML input or output. For example, if you write to a file then use it for XML input, you must close and reopen the Stream object.
Language cross-reference Import in LotusScript NotesDXLImporter class Process in LotusScript NotesXMLProcessor class SetInput in LotusScript NotesXMLProcessor class SetOutput in LotusScript NotesXMLProcessor class
EmbeddedObject class Represents any one of the following: v An embedded object v An object link v A file attachment Note: Embedded objects and object links are not supported for OS/2, UNIX, and the Macintosh. File attachments are.
Syntax public class EmbeddedObject extends Base
Containment Contained by: Document and RichTextItem
Properties ClassName through getClassName FileSize through getFileSize InputSource through getInputSource
Chapter 2. Java Classes A-Z
521
InputStream through getInputStream Name through getName Object through getObject Parent through getParent Reader through getReader Source through getSource Type through getType Verbs through getVerbs
Methods activate doVerb extractFile parseXML recycle remove toString transformXML
Creation To create a new object, object link, or file attachment, use embedObject in RichTextItem.
Access To access an existing object, object link, or file attachment: v To access an object, object link, or attachment when you know its name and the rich text item that contains it, use getEmbeddedObject in RichTextItem. v To access all the objects, object links, and attachments in a particular rich text item, use getEmbeddedObjects in RichTextItem. v To access the objects and object links in a particular document, including those that are not contained within a particular rich text item, use getEmbeddedObjects in Document. This property does not return file attachments or objects and object links created in Notes Release 3.
Language cross-reference ObjectProperties @command in formula language HotspotProperties @command in formula language
522
Programming Guide, Volume 3: Java/CORBA Classes
Examples: EmbeddedObject class and ClassName, FileSize, Name, Object, Parent, Source, Type, and Verbs properties The agent gets the properties for all the embedded objects in all the ″Body″ items. import lotus.domino.*; import java.util.Vector; import java.util.Enumeration; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { RichTextItem body = (RichTextItem) doc.getFirstItem("Body"); System.out.println(doc.getItemValueString("Subject")); Vector v = body.getEmbeddedObjects(); Enumeration e = v.elements(); while (e.hasMoreElements()) { EmbeddedObject eo = (EmbeddedObject)e.nextElement(); System.out.println("\t" + eo.getName()); String type = null; switch (eo.getType()) { case EmbeddedObject.EMBED_ATTACHMENT : type = "file attachment"; break; case EmbeddedObject.EMBED_OBJECT : type = "embedded object"; break; case EmbeddedObject.EMBED_OBJECTLINK : type = "object link"; } System.out.println("\t\tType: " + type); if (type.equals("embedded object")) System.out.println("\t\tVerbs: " + eo.getVerbs()); System.out.println("\t\tSource: " + eo.getSource()); if (!type.equals("file attachment")) System.out.println("\t\tClass name: " + eo.getClassName()); if (type.equals("file attachment")) System.out.println("\t\tSize: " + eo.getFileSize() + " bytes"); System.out.println("\t\tParent doc: " + eo.getParent().getParent().getItemValueString( "Subject")); } doc = dc.getNextDocument(); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
ClassName property Read-only. The name of the application that created an object.
Defined in EmbeddedObject
Chapter 2. Java Classes A-Z
523
Data type String
Syntax public String getClassName() throws NotesException
Usage For file attachments, this property returns an empty string.
Language cross-reference Class property in LotusScript NotesEmbeddedObject class
FileSize property Read-only. The size of a file attachment, in bytes.
Defined in EmbeddedObject
Data type integer
Syntax public int getFileSize() throws NotesException
Usage Returns 0 for embedded objects and links.
Language cross-reference FileSize property in LotusScript NotesEmbeddedObject class @AttachmentLengths function in formula language
Name property Read-only. The name used to reference an object, object link, or file attachment.
Defined in EmbeddedObject
Data type Object of type java.lang.String
Syntax public String getName() throws NotesException
Usage If an object or object link does not have a name, this property returns an empty string. If an object or object link was created using embedObject in RichTextItem, this property returns the name parameter specification. If the name parameter was not specified, this property is the same as the Source property. If the embedded object or object link was created using the user interface, this property returns the name of the object as it appears in the user interface.
524
Programming Guide, Volume 3: Java/CORBA Classes
For file attachments, this property returns the name of the file unless the attachment is a duplicate. If the attachment is a duplicate, this property returns an internal name. (The Source property returns the file name in all cases.)
Language cross-reference Name property in LotusScript NotesEmbeddedObject class
Object property Read-only. If an embedded object has been loaded into memory, returns the OLE handle (IUnknown or IDispatch handle). If the OLE object supports OLE Automation, you can invoke the methods and properties of the object using the handle.
Defined in EmbeddedObject
Data type int
Syntax public int getObject() throws NotesException
Usage This property may or may not return a valid OLE handle for object links, depending upon the application used to create the object link.
Language cross-reference Object property in LotusScript NotesEmbeddedObject class
Parent property Read-only. The rich text item that holds an object.
Defined in EmbeddedObject
Data type RichTextItem
Syntax public RichTextItem getParent() throws NotesException
Usage When you get an embedded object from a document, it does not contain a RichTextItem parent. Calling the Parent property on such an embedded object returns null.
Language cross-reference Parent property in LotusScript NotesEmbeddedObject class
Source property Read-only. For an object or object link, returns the internal name for the source document. For a file attachment, returns the file name of the original file.
Defined in EmbeddedObject
Chapter 2. Java Classes A-Z
525
Data type Object of type java.lang.String
Syntax public String getSource() throws NotesException
Language cross-reference Source property in LotusScript NotesEmbeddedObject class @AttachmentNames function in formula language
Type property Read-only. Indicates whether an embedded object is an object, an object link, or a file attachment.
Defined in EmbeddedObject
Data type int
Syntax public int getType() throws NotesException
Return value v EmbeddedObject.EMBED_ATTACHMENT v EmbeddedObject.EMBED_OBJECT v EmbeddedObject.EMBED_OBJECTLINK
Language cross-reference Type property in LotusScript NotesEmbeddedObject class
Verbs property Read-only. The verbs that an object supports, if the object is an OLE/2 embedded object.
Defined in EmbeddedObject
Data type java.util.Vector; elements are String
Syntax public java.util.Vector getVerbs() throws NotesException
Usage Throws an exception if not invoked from an OLE/2 embedded object.
Language cross-reference Verbs property in LotusScript NotesEmbeddedObject class
activate method Causes an embedded object or object link to be loaded by OLE.
526
Programming Guide, Volume 3: Java/CORBA Classes
Defined in EmbeddedObject
Syntax public int activate(boolean show) throws NotesException
Parameters boolean show
If true, the OLE server application displays its user interface. If false, the server application hides its user interface.
Return value int The OLE handle to the object. Returns null if the embedded object or object link does not support OLE automation.
Usage Agents running on a server must set the show parameter to false. This method throws an exception if you invoke it on an EmbeddedObject that is a file attachment. This method may or may not return a valid OLE handle for object links, depending upon the application used to create the object link.
Language cross-reference Activate method in LotusScript NotesEmbeddedObject class ObjectOpen @command in formula language EditOpenLink @command in formula language
Examples: activate method 1. This script embeds a new object in the Body item of a document, and activates the object. Dim session As New session Dim doc As Document Dim rtitem As RichTextItem Dim object As EmbeddedObject Dim handle As Variant Set doc = New Document( session.CurrentDatabase ) Set rtitem = New RichTextItem( doc, "Body" ) Set object = rtitem.EmbedObject _ ( EMBED_OBJECT, "Microsoft Excel Worksheet", "", _ "Report" ) Set handle = object.Activate( false ) If ( handle Is Nothing ) Then doc.Subject = "This object has no OLE automation interface" Else doc.Subject = "This object has an OLE automation interface" End If Call doc.Save( true, true )
2. This script embeds a new worksheet object in a rich text item, activates it, and uses its handle to set the value of a cell in the worksheet. Dim rtitem as Dim object as Dim handle as ’...set value
RichTextItem EmbeddedObject Variant of rtitem... Chapter 2. Java Classes A-Z
527
Set object = rtitem.EmbedObject( EMBED_OBJECT, _ "Microsoft Excel Worksheet", "", "Report" ) Set handle = object.Activate ( false ) handle.Cells( 1,1 ).Value = 100 handle.Parent.Save
doVerb method Executes a verb in an embedded object.
Defined in EmbeddedObject
Syntax public void doVerb(String verb) throws NotesException
Parameters String verb
The name of one of the object’s verbs.
Usage Verbs which require user interaction, such as Open or Edit, are not supported.
Language cross-reference DoVerb method in LotusScript NotesEmbeddedObject class
extractFile method Writes a file attachment to storage.
Defined in EmbeddedObject
Syntax public void extractFile(String path) throws NotesException
Parameters String path
The path and file name where you want to store the extracted file.
Usage For embedded objects and object links, this method throws an exception.
Language cross-reference ExtractFile method in LotusScript NotesEmbeddedObject class AttachmentDetachAll @command in formula language EditDetach @command in formula language
Examples: extractFile and remove methods This agent extracts all the file attachments in all the ″Body″ items of a database, then removes the attachments.
528
Programming Guide, Volume 3: Java/CORBA Classes
import lotus.domino.*; import java.util.Vector; import java.util.Enumeration; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); boolean saveFlag = false; while (doc != null) { RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); System.out.println(doc.getItemValueString("Subject")); Vector v = body.getEmbeddedObjects(); Enumeration e = v.elements(); while (e.hasMoreElements()) { EmbeddedObject eo = (EmbeddedObject)e.nextElement(); if (eo.getType() == EmbeddedObject.EMBED_ATTACHMENT) { eo.extractFile("c:\\extracts\\" + eo.getSource()); eo.remove(); saveFlag = true; } } if (saveFlag) { doc.save(true, true); saveFlag = false; } doc = dc.getNextDocument(); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
remove method Removes an object, object link, or file attachment.
Defined in EmbeddedObject
Syntax public void remove() throws NotesException
Usage After calling remove, you must call save in Document to keep the change.
Language cross-reference Remove method in LotusScript NotesEmbeddedObject class HotspotClear @command in formula language
Form class Represents a form in a database.
Chapter 2. Java Classes A-Z
529
Syntax public class Form extends Base
Containment Contained by: Database
Properties Aliases through getAliases Fields through getFields FormUsers through getFormUsers and setFormUsers HttpURL through getHttpURL IsProtectReaders through isProtectReaders and setProtectReaders IsProtectUsers through isProtectUsers and setProtectUsers IsSubForm through isSubForm LockHolders through getLockHolders Name through getName NotesURL through getNotesURL Parent through getParent Readers through getReaders and setReaders
Methods getFieldType getURL lock lockProvisional recycle remove toString unlock
Access There are two ways to access a form: v To get all the forms in a database, use Forms in Database. v To get a form by its name, use getForm in Database.
530
Programming Guide, Volume 3: Java/CORBA Classes
You can’t access private forms belonging to other people.
Examples: Form class This agent prints the properties of all the forms in the current database. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Vector forms = db.getForms(); System.out.println ("Forms in \"" + db.getTitle() + "\":"); for (int i = 0; i < forms.size(); i++) { Form form = (Form)forms.elementAt(i); System.out.println ("\nForm name : " + form.getName()); Vector alias = form.getAliases(); if (alias.size() != 0) { System.out.println ("\tAlias\t: " + alias.elementAt(0)); for (int j = 1; j < alias.size(); j++) System.out.println ("\t \" \"\t: " + alias.elementAt(j)); } System.out.println ("\tProtect Readers\t: " + form.isProtectReaders()); System.out.println ("\tProtect Users\t: " + form.isProtectUsers()); System.out.println ("\tSub Form \t: " + form.isSubForm()); Vector users = form.getFormUsers(); if (users.size() != 0) { System.out.println ("\tForm users\t: " + users.elementAt(0)); for (int j = 1; j < users.size();j++) System.out.println ("\t \" \" \t: " + users.elementAt(j)); } Vector readers = form.getReaders(); if (readers.size() != 0) { System.out.println ("\tForm Readers\t: " + readers.elementAt(0)); for (int j = 1; j < readers.size(); j++) System.out.println ("\t \" \" \t: " + readers.elementAt(j)); } Vector fields = form.getFields(); if (fields.size() != 0) { System.out.println ("\tFields \t: " + fields.elementAt(0)); for (int j = 1; j < fields.size(); j++) System.out.println ("\t \"\" \t: " + fields.elementAt(j)); } } } catch(Exception e) { e.printStackTrace(); } } }
Aliases property Read-only. The aliases of a form.
Chapter 2. Java Classes A-Z
531
Defined in Form
Data type Vector; elements are String
Syntax public java.util.Vector getAliases() throws NotesException
Usage This property returns all but the first in the list of all the form’s names. The Name property returns the first name in the list.
Language cross-reference Aliases property in LotusScript NotesForm class
Examples: Aliases property This agent prints all the aliases for the form specified as the agent comment. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Agent agent = agentContext.getCurrentAgent(); Database db = agentContext.getCurrentDatabase(); Form form = db.getForm(agent.getComment()); Vector alias = form.getAliases(); if (alias.size() != 0) { System.out.println ("Aliases for " + agent.getComment()); for (int j=0; j 0) { Newsletter news = session.createNewsletter(dc); news.setSubjectItemName("Subject"); news.setDoSubject(true); Document doc = news.formatMsgWithDoclinks(db); doc.appendItemValue("Form", "Memo"); doc.appendItemValue("Subject", "The Arachnid Report"); doc.send(false, session.getUserName()); } } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
687
2. This agent performs a full-text search on the current database and creates a newsletter. The agent formats a newsletter document for each matching document and saves it in the database Reports.nsf. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); db.updateFTIndex(true); DocumentCollection dc = db.FTSearch("arachnid", 15); if (dc.getCount() > 0) { Newsletter news = session.createNewsletter(dc); Document doc; Database reports = session.getDatabase(null, "reports"); for (int j=0; j 0) { Newsletter news = session.createNewsletter(dc); Document doc; for (int j=0; j 0) { Newsletter news = session.createNewsletter(dc); news.setSubjectItemName("Subject"); news.setDoSubject(true); news.setDoScore(true); Document doc = news.formatMsgWithDoclinks(db); doc.appendItemValue("Form", "Memo"); doc.appendItemValue("Subject", "The Arachnid Report"); doc.send(false, session.getUserName()); } } catch(Exception e) { e.printStackTrace(); } } }
NoteCollection class Represents a collection of Domino design and data elements in a database. Note: This class is new with Release 6.5.
Containment Contained by: Database
692
Programming Guide, Volume 3: Java/CORBA Classes
Properties Count through getCount LastBuildTime through getLastBuildTime Parent through getParent SelectAcl through getSelectAcl and setSelectAcl SelectActions through getSelectActions and setSelectActions SelectAgents through getSelectAgents and setSelectAgents SelectDatabaseScript through getSelectDatabaseScript and setSelectDatabaseScript SelectDataConnections through getSelectDataConnections and setDataConnections SelectDocuments through getSelectDocuments and setSelectDocuments SelectFolders through getSelectFolders and setSelectFolders SelectForms through getSelectForms and setSelectForms SelectFramesets through getSelectFramesets and setSelectFramesets SelectHelpAbout through getSelectHelpAbout and setSelectHelpAbout SelectHelpIndex through getSelectHelpIndex and setSelectHelpIndex SelectHelpUsing through getSelectHelpUsing and setSelectHelpUsing SelectIcon through getSelectIcon and setSelectIcon SelectImageResources through getSelectImageResources and setSelectImageResources SelectionFormula through getSelectionFormula and setSelectionFormula SelectJavaResources through getSelectJavaResources and setSelectJavaResources SelectMiscCodeElements through getSelectMiscCodeElements and setSelectMiscCodeElements SelectMiscFormatElements through getSelectMiscFormatElements and setSelectMiscFormatElements SelectMiscIndexElements through getSelectMiscIndexElements and setSelectMiscIndexElements SelectNavigators through getSelectNavigators and setSelectNavigators SelectOutlines through getSelectOutlines and setSelectOutlines SelectPages through getSelectPages and setSelectPages SelectProfiles through getSelectProfiles and setSelectProfiles SelectReplicationFormulas through getSelectReplicationFormulas and setSelectReplicationFormulas
Chapter 2. Java Classes A-Z
693
SelectScriptLibraries through getSelectScriptLibraries and setSelectScriptLibraries SelectSharedFields through getSelectSharedFields and setSelectSharedFields SelectStylesheetResources through getSelectStylesheetResources and setSelectStylesheetResources SelectSubforms through getSelectSubforms and setSelectSubforms SelectViews through getSelectViews and setSelectViews SinceTime through getSinceTime and setSinceTime
Methods add buildCollection clearCollection getFirstNoteID getNextNoteID intersect recycle remove selectAllAdminNotes selectAllCodeElements selectAllDataNotes selectAllDesignElements selectAllFormatElements selectAllIndexElements selectAllNotes
Creation and access Use createNoteCollection in Database to create a NoteCollection object. The object represents the notes in the containing database. Use createNoteCollection to initialize all Select properties to true or false depending on the parameter specification. Change the Select properties as desired to specify the content of the collection. You can set the Select properties directly, or in groups by calling the Select methods. Further modify the collection as desired with the SelectionFormula and SinceTime properties. Use buildCollection to compile the collection. You must build before the collection can be used.
694
Programming Guide, Volume 3: Java/CORBA Classes
Usage A Domino database consists of design and data elements known internally as ″notes.″ The NoteCollection class represents all or a subset of the notes in a database. A NoteCollection object can be used as input to DxlExporter.
Examples: NoteCollection class This agent builds a note collection consisting only of the documents in the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Count property Read-only. The number of notes in the collection.
Defined in NoteCollection
Data type int
Chapter 2. Java Classes A-Z
695
Syntax public int getCount() throws NotesException
Language cross-reference Count property in LotusScript NotesNoteCollection class
LastBuildTime property Read-only. Date and time of the last build for this note collection.
Defined in NoteCollection
Data type DateTime
Syntax public DateTime getLastBuildTime() throws NotesException
Usage The buildCollection method sets this time. By default (prior to a build) this property is 12:00:00 AM without a date setting.
Language cross-reference LastBuildTime property in LotusScript NotesNoteCollection class
Examples: LastBuildTime property This agent builds a note collection and displays the time of the build. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.buildCollection(); System.out.println("Note collection built at " + nc.getLastBuildTime().getLocalTime()); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter();
696
Programming Guide, Volume 3: Java/CORBA Classes
String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Parent property Read-only. The database that contains the note collection.
Defined in NoteCollection
Data type Database
Syntax public Database getParent() throws NotesException
Language cross-reference Parent property in LotusScript NotesNoteCollection class
SelectAcl property Read-write. Indicates whether the collection contains an ACL note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectAcl() throws NotesException public void setSelectAcl(boolean flag) throws NotesException
Legal values v true to indicate inclusion of the ACL note v false to indicate exclusion of the ACL note
Usage The following methods set this property: v createNoteCollection in Database v selectAllAdminNotes v selectAllNotes
Language cross-reference SelectACL property in LotusScript NotesNoteCollection class Chapter 2. Java Classes A-Z
697
Examples: SelectAcl property This agent builds a note collection that consists of only the ACL note. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectAcl(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectActions property Read-write. Indicates whether the collection contains notes for actions.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectActions() throws NotesException public void setSelectActions(boolean flag) throws NotesException
698
Programming Guide, Volume 3: Java/CORBA Classes
Legal values v true to indicate inclusion of notes for actions v false to indicate exclusion of notes for actions
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectActions property in LotusScript NotesNoteCollection class
Examples: SelectActions property This agent builds a note collection that consists of all format elements except actions. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectActions(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
699
SelectAgents property Read-write. Indicates whether the collection contains notes for agents.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectAgents() throws NotesException public void setSelectAgents(boolean flag) throws NotesException
Legal values v true to indicate inclusion of notes for agents v false to indicate exclusion of notes for agents
Usage The following methods set this property: v createNoteCollection in Database v selectAllCodeElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectAgents property in LotusScript NotesNoteCollection class
Examples: SelectAgents property This agent builds a note collection that consists of all code elements except agents. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllCodeElements(true); nc.setSelectAgents(false); nc.buildCollection();
700
Programming Guide, Volume 3: Java/CORBA Classes
// Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectDatabaseScript property Read-write. Indicates whether the collection contains a database script note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectDatabaseScript() throws NotesException public void setSelectDatabaseScript(boolean flag) throws NotesException
Legal values v true to indicate inclusion of a database script note v false to indicate exclusion of a database script note
Usage The following methods set this property: v createNoteCollection in Database v selectAllCodeElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectDatabaseScript property in LotusScript NotesNoteCollection class
Examples: SelectDatabaseScript property This agent builds a note collection that consists of only a database script note. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Chapter 2. Java Classes A-Z
701
// Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDatabaseScript(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectDataConnections property Read-write. Indicates whether the collection contains a data connection note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectDataConnections() throws NotesException public void setSelectDataConnections(boolean flag) throws NotesException
Legal values v true to indicate inclusion of a data connection note v false to indicate exclusion of a data connection note
Usage The following methods set this property: v createNoteCollection in Database v selectAllCodeElements v selectAllNotes
Language cross-reference SelectDataConnections property in LotusScript NotesNoteCollection class
702
Programming Guide, Volume 3: Java/CORBA Classes
SelectDocuments property Read-write. Indicates whether the collection contains the data documents.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectDocuments() throws NotesException public void setSelectDocuments(boolean flag) throws NotesException
Legal values v true to indicate inclusion of data documents v false to indicate exclusion of data documents
Usage The following methods set this property: v createNoteCollection in Database v selectAllDataNotes v selectAllNotes
Language cross-reference SelectDocuments property in LotusScript NotesNoteCollection class
Examples: SelectDocuments property This agent builds a note collection that consists of documents only (no administration or design elements). import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); Chapter 2. Java Classes A-Z
703
String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectFolders property Read-write. Indicates whether the collection contains notes for folders.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectFolders() throws NotesException public void setSelectFolders(boolean flag) throws NotesException
Legal values v true to indicate inclusion of folders v false to indicate exclusion of folders
Usage The following methods set this property: v createNoteCollection in Database v selectAllIndexElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectFolders property in LotusScript NotesNoteCollection class
Examples: SelectFolders property This agent builds a note collection that consists of all index elements except folders. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database
704
Programming Guide, Volume 3: Java/CORBA Classes
Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllIndexElements(true); nc.setSelectFolders(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectForms property Read-write. Indicates whether the collection contains notes for forms.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectForms() throws NotesException public void setSelectForms(boolean flag) throws NotesException
Legal values v true to indicate inclusion of forms v false to indicate exclusion of forms
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectForms property in LotusScript NotesNoteCollection class
Chapter 2. Java Classes A-Z
705
Examples: SelectForms property This agent builds a note collection that consists of all format elements except forms. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectForms(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectFramesets property Read-write. Indicates whether the collection contains notes for frame sets.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectFramesets() throws NotesException public void setSelectFramesets(boolean flag) throws NotesException
706
Programming Guide, Volume 3: Java/CORBA Classes
Legal values v true to indicate the inclusion of frame sets v false to indicate the exclusion of frame sets
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectFrameSets property in LotusScript NotesNoteCollection class
Examples: SelectFramesets property This agent builds a note collection that consists of all format elements except frame sets. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectFramesets(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
707
SelectHelpAbout property Read-write. Indicates whether the collection contains an ″About Database″ note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectHelpAbout() throws NotesException public void setSelectHelpAbout(boolean flag) throws NotesException
Legal values v true to indicate inclusion of an ″About Database″ note v false to indicate exclusion of an ″About Database″ note
Usage The following methods set this property: v createNoteCollection in Database v selectAllDesignElements v selectAllNotes
Language cross-reference SelectHelpAbout property in LotusScript NotesNoteCollection class
Examples: SelectHelpAbout property This agent builds a note collection that consists of the ″About Database″ note. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectHelpAbout(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc);
708
Programming Guide, Volume 3: Java/CORBA Classes
stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectHelpIndex property Read-write. Indicates whether the collection contains a help index note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectHelpIndex() throws NotesException public void setSelectHelpIndex(boolean flag) throws NotesException
Legal values v true to indicate inclusion of a help index note v false to indicate exclusion of a help index note
Usage The following methods set this property: v createNoteCollection in Database v selectAllDesignElements v selectAllNotes
Language cross-reference SelectHelpIndex property in LotusScript NotesNoteCollection class
Examples: SelectHelpIndex property This agent builds a note collection that consists of the help index note. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); Chapter 2. Java Classes A-Z
709
filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectHelpIndex(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectHelpUsing property Read-write. Indicates whether the collection contains a ″Using Database″ note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectHelpUsing() throws NotesException public void setSelectHelpUsing(boolean flag) throws NotesException
Legal values v true to indicate inclusion of a ″Using Database″ note v false to indicate exclusion of a ″Using Database″ note
Usage The following methods set this property: v createNoteCollection in Database v selectAllDesignElements v selectAllNotes
Language cross-reference SelectHelpUsing property in LotusScript NotesNoteCollection class
Examples: SelectHelpUsing property This agent builds a note collection that consists of the ″Using Database″ note. import lotus.domino.*; public class JavaAgent extends AgentBase {
710
Programming Guide, Volume 3: Java/CORBA Classes
public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectHelpUsing(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectIcon property Read-write. Indicates whether the collection contains an icon note.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectIcon() throws NotesException public void setSelectIcon(boolean flag) throws NotesException
Legal values v true to indicate inclusion of an icon note v false to indicate exclusion of an icon note
Usage The following methods set this property: v createNoteCollection in Database Chapter 2. Java Classes A-Z
711
v selectAllDesignElements v selectAllNotes
Language cross-reference SelectIcon property in LotusScript NotesNoteCollection class
Examples: SelectIcon property This agent builds a note collection that consists of the icon note. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectIcon(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectImageResources property Read-write. Indicates whether the collection contains notes for image resources.
Defined in NoteCollection
Data type boolean
712
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public boolean getSelectImageResources() throws NotesException public void setSelectImageResources(boolean flag) throws NotesException
Legal values v true to indicate inclusion of image resources v false to indicate exclusion of image resources
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectImageResources property in LotusScript NotesNoteCollection class
Examples: SelectImageResources property This agent builds a note collection that consists of all format elements except image resources. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectImageResources(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { Chapter 2. Java Classes A-Z
713
e.printStackTrace(); } } }
SelectionFormula property Read-write. Formula that selects notes for inclusion in the collection.
Defined in NoteCollection
Data type String
Syntax public String getSelectionFormula() throws NotesException public void setSelectionFormula(String flag) throws NotesException
Usage This property must be a valid Domino formula that evaluates to true (includes the note) or false (excludes the note) for each note. This property is initially an empty string, which is equivalent to selecting all notes. This property is not a stand-alone specification. It intersects the other selection criteria.
Language cross-reference SelectionFormula property in LotusScript NotesNoteCollection class
Examples: SelectionFormula property This agent builds a note collection that consists of all documents that contain ″one″ in the Subject item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.setSelectionFormula("@Contains(@LowerCase(Subject); \"one\")"); nc.buildCollection();
714
Programming Guide, Volume 3: Java/CORBA Classes
// Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectJavaResources property Read-write. Indicates whether the collection contains notes for Java resources.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectJavaResources() throws NotesException public void setSelectJavaResources(boolean flag) throws NotesException
Legal values v true to indicate inclusion of Java resources v false to indicate exclusion of Java resources
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectJavaResources property in LotusScript NotesNoteCollection class
Examples: SelectJavaResources property This agent builds a note collection that consists of all format elements except Java resources. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Chapter 2. Java Classes A-Z
715
// Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectJavaResources(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectMiscCodeElements property Read-write. Indicates whether the collection contains notes for miscellaneous code elements.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectMiscCodeElements() throws NotesException public void setSelectMiscCodeElements(boolean flag) throws NotesException
Legal values v true to indicate inclusion of miscellaneous code elements v false to indicate exclusion of miscellaneous code elements
Usage The following methods set this property: v v v v
createNoteCollection in Database selectAllCodeElements selectAllDesignElements selectAllNotes
Language cross-reference SelectMiscCodeElements property in LotusScript NotesNoteCollection class
716
Programming Guide, Volume 3: Java/CORBA Classes
Examples: SelectMiscCodeElements property This agent builds a note collection that consists of all code elements except miscellaneous code elements. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllCodeElements(true); nc.setSelectMiscCodeElements(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectMiscFormatElements property Read-write. Indicates whether the collection contains notes for miscellaneous format elements.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectMiscFormatElements() throws NotesException public void setSelectMiscFormatElements(boolean flag) throws NotesException
Chapter 2. Java Classes A-Z
717
Legal values v true to indicate inclusion of miscellaneous format elements v false to indicate exclusion of miscellaneous format elements
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectMiscFormatElements property in LotusScript NotesNoteCollection class
Examples: SelectMiscFormatElements property This agent builds a note collection that consists of all format elements except miscellaneous format elements. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectMiscFormatElements(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
718
Programming Guide, Volume 3: Java/CORBA Classes
SelectMiscIndexElements property Read-write. Indicates whether the collection contains notes for miscellaneous index elements.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectMiscIndexElements() throws NotesException public void setSelectMiscIndexElements(boolean flag) throws NotesException
Legal values v true to indicate inclusion of miscellaneous index elements v false to indicate exclusion of miscellaneous index elements
Usage The following methods set this property: v createNoteCollection in Database v selectAllIndexElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectMiscIndexElements property in LotusScript NotesNoteCollection class
Examples: SelectMiscIndexElements property This agent builds a note collection that consists of all index elements except miscellaneous index elements. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllIndexElements(true); nc.setSelectMiscIndexElements(false); nc.buildCollection(); Chapter 2. Java Classes A-Z
719
// Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectNavigators property Read-write. Indicates whether the collection contains notes for navigators.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectNavigators() throws NotesException public void setSelectNavigators(boolean flag) throws NotesException
Legal values v true to indicate inclusion of navigators v false to indicate exclusion of navigators
Usage The following methods set this property: v createNoteCollection in Database v selectAllIndexElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectNavigators property in LotusScript NotesNoteCollection class
Examples: SelectNavigators property This agent builds a note collection that consists of all index elements except navigators. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here)
720
Programming Guide, Volume 3: Java/CORBA Classes
Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllIndexElements(true); nc.setSelectNavigators(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectOutlines property Read-write. Indicates whether the collection contains notes for outlines.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectOutlines() throws NotesException public void setSelectOutlines(boolean flag) throws NotesException
Legal values v true to indicate the inclusion of outlines v false to indicate the exclusion of outlines
Usage The following methods set this property: v createNoteCollection in Database v selectAllCodeElements v selectAllDesignElements v selectAllNotes
Chapter 2. Java Classes A-Z
721
Language cross-reference SelectOutlines property in LotusScript NotesNoteCollection class
Examples: SelectOutlines property This agent builds a note collection that consists of all code elements except outlines. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllCodeElements(true); nc.setSelectOutlines(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectPages property Read-write. Indicates whether the collection contains notes for pages.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectPages() throws NotesException public void setSelectPages(boolean flag) throws NotesException
722
Programming Guide, Volume 3: Java/CORBA Classes
Legal values v true to indicate inclusion of pages v false to indicate exclusion of pages
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectPages property in LotusScript NotesNoteCollection class
Examples: SelectPages property This agent builds a note collection that consists of all format elements except pages. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectPages(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
723
SelectProfiles property Read-write. Indicates whether the collection contains profile documents.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectProfiles() throws NotesException public void setSelectProfiles(boolean flag) throws NotesException
Legal values v true to indicate inclusion of profile documents v false to indicate exclusion of profile documents
Usage The following methods set this property: v createNoteCollection in Database v selectAllDataNotes v selectAllNotes
Language cross-reference SelectProfiles property in LotusScript NotesNoteCollection class
SelectReplicationFormulas property Read-write. Indicates whether the collection contains replication formulas.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectReplicationFormulas() throws NotesException public void setSelectReplicationFormulas(boolean flag) throws NotesException
Legal values v true to indicate that the collection contains replication formulas v false to indicate that the collection excludes replication formulas
Usage The following methods set this property: v createNoteCollection in Database v selectAllAdminNotes v selectAllNotes
724
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference SelectReplicationFormulas property in LotusScript NotesNoteCollection class
Examples: SelectReplicationFormulas property This agent builds a note collection that consists of only the notes for replication formulas. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectReplicationFormulas(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectScriptLibraries property Read-write. Indicates whether the collection contains notes for script libraries.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectScriptLibraries() throws NotesException public void setSelectScriptLibraries(boolean flag) throws NotesException
Chapter 2. Java Classes A-Z
725
Legal values v true to indicate inclusion of script libraries v false to indicate exclusion of script libraries
Usage The following methods set this property: v createNoteCollection in Database v selectAllCodeElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectScriptLibraries property in LotusScript NotesNoteCollection class
Examples: SelectScriptLibraries property This agent builds a note collection that consists of all code elements except script libraries. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllCodeElements(true); nc.setSelectScriptLibraries(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
726
Programming Guide, Volume 3: Java/CORBA Classes
SelectSharedFields property Read-write. Indicates whether the collection contains notes for shared fields.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectSharedFields() throws NotesException public void setSelectSharedFields(boolean flag) throws NotesException
Legal values v true to indicate inclusion of shared fields v false to indicate exclusion of shared fields
Usage The following methods set this property: v createNoteCollection in Database v selectAllDesignElements v selectAllNotes
Language cross-reference SelectSharedFields property in LotusScript NotesNoteCollection class
Examples: SelectSharedFields property This agent builds a note collection that consists of notes for shared fields. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectSharedFields(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); Chapter 2. Java Classes A-Z
727
stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectStylesheetResources property Read-write. Indicates whether the collection contains notes for style sheet resources.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectStylesheetResources() throws NotesException public void setSelectStylesheetResources(boolean flag) throws NotesException
Legal values v true to indicate inclusion of style sheet resources v false to indicate exclusion of style sheet resources
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectStyleSheetResources property in LotusScript NotesNoteCollection class
Examples: SelectStylesheetResources property This agent builds a note collection that consists of all format elements except style sheet resources. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream();
728
Programming Guide, Volume 3: Java/CORBA Classes
String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectStylesheetResources(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectSubforms property Read-write. Indicates whether the collection contains notes for subforms.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectSubforms() throws NotesException public void setSelectSubforms(boolean flag) throws NotesException
Legal values v true to indicate inclusion of subforms v false to indicate exclusion of subforms
Usage The following methods set this property: v createNoteCollection in Database v selectAllFormatElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectSubforms property in LotusScript NotesNoteCollection class
Chapter 2. Java Classes A-Z
729
Examples: SelectSubforms property This agent builds a note collection that consists of all format elements except subforms. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.setSelectSubforms(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
SelectViews property Read-write. Indicates whether the collection contains notes for views.
Defined in NoteCollection
Data type boolean
Syntax public boolean getSelectViews() throws NotesException public void setSelectViews(boolean flag) throws NotesException
730
Programming Guide, Volume 3: Java/CORBA Classes
Legal values v true to indicate inclusion of views v false to indicate exclusion of views
Usage The following methods set this property: v createNoteCollection in Database v selectAllIndexElements v selectAllDesignElements v selectAllNotes
Language cross-reference SelectViews property in LotusScript NotesNoteCollection class
Examples: SelectViews property This agent builds a note collection that consists of all index elements except views. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllIndexElements(true); nc.setSelectViews(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
731
SinceTime property Read-write. Indicates the earliest note creation time in the collection.
Defined in NoteCollection
Data type DateTime
Syntax public DateTime getSinceTime() throws NotesException public void setSinceTime(DateTime sincetime) throws NotesException
Usage buildCollection selects notes from the time specified by this property to the present time, excluding notes created prior to this time. By default this property is 12:00:00 AM without a date setting, which means that creation time is not a factor unless you explicitly set this property to a date. This property is not a stand-alone specification. It intersects the other selection criteria.
Language cross-reference SinceTime property in LotusScript NotesNoteCollection class
Examples: SinceTime property This agent creates a note collection containing the documents in the current database created since one day ago. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create date for yesterday DateTime dt = session.createDateTime("Yesterday"); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.setSinceTime(dt); nc.buildCollection();
732
Programming Guide, Volume 3: Java/CORBA Classes
// Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
add method Adds one or more notes to a note collection.
Defined in NoteCollection
Syntax public void add(Agent additionspecifier) throws NotesException public void add(Document additionspecifier) throws NotesException public void add(DocumentCollection additionspecifier) throws NotesException public void add(Form additionspecifier) throws NotesException public void add(NoteCollection additionspecifier) throws NotesException public void add(View additionspecifier) throws NotesException public void add(String additionspecifier) throws NotesException public void add(int additionspecifier) throws NotesException
Parameters Agent additionspecifier
An Agent object representing the note to be added. Document additionspecifier
A Document object representing the note to be added. DocumentCollection additionspecifier
A DocumentCollection object representing the note to be added. Form additionspecifier
A Form object representing the note to be added. NoteCollection additionspecifier
A NoteCollection object representing the note to be added. View additionspecifier
Chapter 2. Java Classes A-Z
733
A View object representing the note to be added. String additionspecifier
The note ID of the note to be added. int additionspecifier
The note ID of the note to be added.
Usage The Parent database of the note(s) to add must be the same as the note collection.
Language cross-reference Add method in LotusScript NotesNoteCollection class
Examples: add method This example creates a note collection from documents in the current database. Only documents containing the word ″one″ in the subject field are included. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.buildCollection(); // Search for specific documents DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { // Add document if Subject contains "one" String subject = doc.getItemValueString("Subject"); if (subject.toLowerCase().indexOf("one") >= 0) { nc.add(doc); } doc = dc.getNextDocument(doc); } // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); // Give count System.out.println("Number of documents = " + nc.getCount());
734
Programming Guide, Volume 3: Java/CORBA Classes
} else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
buildCollection method Builds (compiles) the note collection.
Defined in NoteCollection
Syntax public void buildCollection() throws NotesException
Usage You must build the collection before it is usable. The built collection contains the database notes determined by the current values of SelectionFormula, SinceTime, and the Select properties. Initially SelectionFormula and SinceTime select all notes. Initially the Select properties are all true or all false as determined by createNoteCollection. You can reset them all true or all false with selectAllNotes. You can set the Select properties individually or in groups. The following list arranges the Select properties under the selectAll methods that set them: 1. Not in a selectAll group: v SelectDocuments v SelectProfiles 2. Set by selectAllAdminNotes: v SelectAcl v SelectReplicationFormulas 3. Set by selectAllDesignElements and selectAllCodeElements: v SelectAgents v SelectDatabaseScript v SelectDataConnections v SelectMiscCodeElements v SelectOutlines v SelectScriptLibraries 4. Set by selectAllDesignElements and selectAllFormatElements: v SelectActions v v v v
SelectForms SelectFramesets SelectImageResources SelectJavaResources Chapter 2. Java Classes A-Z
735
v SelectMiscFormatElements v SelectPages v SelectStylesheetResources v SelectSubforms 5. Set by selectAllDesignElements and selectAllIndexElements: v SelectFolders v SelectMiscIndexElements v SelectNavigators v SelectViews 6. Set by selectAllDesignElements: v SelectHelpAbout v SelectHelpIndex v SelectHelpUsing v SelectIcon v SelectSharedFields Use LastBuildTime to get the time of the last build.
Language cross-reference BuildCollection method in LotusScript NotesNoteCollection class
Examples: buildCollection method This agent creates note collections based on form and view elements in the current database. The work occurs in a function, which creates the note collection depending on the input parameters, builds the collection, then clears the collection. import lotus.domino.*; public class JavaAgent extends AgentBase { Stream stream = null; NoteCollection nc = null; DxlExporter exporter = null; public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Create stream and note collection stream = session.createStream(); nc = db.createNoteCollection(false); exporter = session.createDxlExporter(); // Export forms exportFormView(true, false); // Export views exportFormView(false, true); // Export forms and views exportFormView(true, true); // Test bad call exportFormView(false, false);
736
Programming Guide, Volume 3: Java/CORBA Classes
} catch(Exception e) { e.printStackTrace(); } } void exportFormView(boolean form, boolean view) { try { // Check parameters and set up file name String filename = null; if (form & view) filename = "formview"; else if (form) filename = "form"; else if (view) filename = "view"; else { System.out.println("Form and view both false - no action"); return; } // Open DXL file named after type of action filename = "c:\\dxl\\" + filename + ".dxl"; if (!stream.open(filename)) { System.out.println("Could not open " + filename); return; } stream.truncate(); // Create note collection nc.selectAllNotes(false); if (form) { nc.setSelectForms(true); nc.setSelectSubforms(true); nc.setSelectSharedFields(true); } if (view) { nc.setSelectViews(true); nc.setSelectFolders(true); } nc.buildCollection(); // Export note collection as DXL String output = exporter.exportDxl(nc); stream.writeText(output); System.out.println("DXL exported to " + filename); stream.close(); nc.clearCollection(); return; } catch(Exception e) { e.printStackTrace(); } } }
clearCollection method Clears (invalidates) a note collection build.
Defined in NoteCollection
Chapter 2. Java Classes A-Z
737
Syntax public void clearCollection() throws NotesException
Usage Clearing renders a built note collection unusable. The collection must be built again. Clearing a note collection does not change SelectionFormula, SinceTime, and the Select properties. Use selectAllNotes to reinitialize the Select properties. Reinitialize SelectionFormula and SinceTime individually.
Language cross-reference ClearCollection method in LotusScript NotesNoteCollection class
getFirstNoteID method Gets the first note in a collection.
Defined in NoteCollection
Syntax public String getFirstNoteID() throws NotesException
Return value String
The ID of the first note in the collection.
Language cross-reference GetFirstNoteID method in LotusScript NotesNoteCollection class
getNextNoteID method Given a note, finds the note immediately following it in a collection.
Defined in NoteCollection
Syntax public String getNextNoteID(String noteid) throws NotesException
Parameters String noteid
A valid note ID.
Return value String
The ID of the note following the specified note.
Usage If no next note exists, this method returns a string of length 0. This method throws an exception if the parameter is an invalid note ID.
738
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference GetNextNoteID method in LotusScript NotesNoteCollection class
intersect method Creates a note collection containing the notes common to the original collection and the note or notes specified in the intersection parameter.
Defined in NoteCollection
Syntax public void intersect(Agent intersectionspecifier) throws NotesException public void intersect(Document intersectionspecifier) throws NotesException public void intersect(DocumentCollection intersectionspecifier) throws NotesException public void intersect(Form intersectionspecifier) throws NotesException public void intersect(NoteCollection intersectionspecifier) throws NotesException public void intersect(View intersectionspecifier) throws NotesException public void intersect(String intersectionspecifier) throws NotesException public void intersect(int intersectionspecifier) throws NotesException
Parameters Agent intersectionspecifier
An Agent object representing the note to be combined. Document intersectionspecifier
A Document object representing the note to be combined. DocumentCollection intersectionspecifier
A DocumentCollection object representing the note to be combined. Form intersectionspecifier
A Form object representing the note to be combined. NoteCollection intersectionspecifier
A NoteCollection object representing the note to be combined. View intersectionspecifier
A View object representing the note to be combined. String intersectionspecifier
The note ID of the note to be combined. int intersectionspecifier
The note ID of the note to be combined.
Chapter 2. Java Classes A-Z
739
Usage The Parent databases of the note collections must be the same.
Language cross-reference Intersect method in LotusScript NotesNoteCollection class
Examples: intersect method This example builds and exports a notes collection containing those agents with ″example″ in the name. First the collection contains all agents. Then a second collection is built by adding the desired notes one at a time from the first collection. Then the first collection is corrected by intersecting it with the second. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection of all agents NoteCollection nc = db.createNoteCollection(false); nc.setSelectAgents(true); nc.buildCollection(); if (nc.getCount() > 0) { // Build temporary note collection of agents whose // names contain the word "example" NoteCollection ncEx = db.createNoteCollection(false); nc.buildCollection(); String id = nc.getFirstNoteID(); Vector agents = db.getAgents(); // For each agent, use corresponding note from nc collection for (int i = 0; i < agents.size(); i++) { Agent agent = (Agent)agents.elementAt(i); String name = agent.getName(); if (name.toLowerCase().indexOf("example") >= 0) { ncEx.add(id); } id = nc.getNextNoteID(id); } // Reduce nc collection to examples by intersecting nc.intersect(ncEx); // Export note collection as DXL if (nc.getCount() > 0) { DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); System.out.println(nc.getCount() + " notes exported");
740
Programming Guide, Volume 3: Java/CORBA Classes
} else System.out.println("No notes exported"); } else System.out.println("No agents in database"); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
remove method Removes one or more notes from a note collection.
Defined in NoteCollection
Syntax public void remove(Agent removalspecifier) throws NotesException public void remove(Document removalspecifier) throws NotesException public void remove(DocumentCollection removalspecifier) throws NotesException public void remove(Form removalspecifier) throws NotesException public void remove(NoteCollection removalspecifier) throws NotesException public void remove(View removalspecifier) throws NotesException public void remove(String removalspecifier) throws NotesException public void remove(int removalspecifier) throws NotesException
Parameters Agent removalspecifier
An Agent object representing the note to be removed. Document removalspecifier
A Document object representing the note to be removed. DocumentCollection removalspecifier
A DocumentCollection object representing the note to be removed. Form removalspecifier
A Form object representing the note to be removed. NoteCollection removalspecifier
A NoteCollection object representing the note to be removed. View removalspecifier Chapter 2. Java Classes A-Z
741
A View object representing the note to be removed. String removalspecifier
The note ID of the note to be removed. int removalspecifier
The note ID of the note to be removed.
Language cross-reference Remove method in LotusScript NotesNoteCollection class
Examples: remove method This agent builds a note collection of documents from the current database. It removes any document with a subject containing the text ″example″ then exports the revised collection as DXL. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection of all agents NoteCollection nc = db.createNoteCollection(false); nc.setSelectDocuments(true); nc.buildCollection(); if (nc.getCount() > 0) { // Remove documents whose Subject contains "example" String id = nc.getFirstNoteID(); while (id.length() > 0) { String idZap = id; // Get next doc before zapping current id = nc.getNextNoteID(id); Document doc = db.getDocumentByID(idZap); String subject = doc.getItemValueString("Subject"); if (subject.toLowerCase().indexOf("example") >= 0) nc.remove(idZap); } // Export note collection as DXL if (nc.getCount() > 0) { DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); System.out.println(nc.getCount() + " notes exported"); } else System.out.println("No notes exported");
742
Programming Guide, Volume 3: Java/CORBA Classes
} else System.out.println("No agents in database"); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllAdminNotes method Selects or deselects the administration notes for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllAdminNotes(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes the administration notes v false excludes the administration notes
Usage The administration notes are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v SelectAcl v SelectReplicationFormulas
Language cross-reference SelectAllAdminNotes method in LotusScript NotesNoteCollection class
Examples: selectAllAdminNotes method This agent builds a note collection consisting of all the notes in the database except the administration notes. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { Chapter 2. Java Classes A-Z
743
System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllNotes(true); nc.selectAllAdminNotes(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllCodeElements method Selects or deselects the notes for code elements for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllCodeElements(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes all code elements v false excludes all code elements
Usage The notes for code elements are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v SelectAgents v SelectDatabaseScript v SelectDataConnections v SelectMiscCodeElements v SelectOutlines v SelectScriptLibraries
Language cross-reference SelectAllCodeElements method in LotusScript NotesNoteCollection class
Examples: selectAllCodeElements method This agent builds a note collection consisting of all code elements in the database. import lotus.domino.*; public class JavaAgent extends AgentBase {
744
Programming Guide, Volume 3: Java/CORBA Classes
public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllCodeElements(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllDataNotes method Selects or deselects the data notes for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllDataNotes(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes the data notes v false excludes the data notes
Usage The data notes are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v SelectDocuments v SelectProfiles
Chapter 2. Java Classes A-Z
745
Language cross-reference SelectAllDataNotes method in LotusScript NotesNoteCollection class
Examples: selectAllDataNotes method This agent builds a note collection consisting of all the data notes in the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllDataNotes(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllDesignElements method Selects or deselects the notes for design elements for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllDesignElements(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes all design elements v false excludes all design elements
746
Programming Guide, Volume 3: Java/CORBA Classes
Usage The notes for design elements are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v Also set by selectAllCodeElements – SelectAgents – SelectDatabaseScript – SelectMiscCodeElements – SelectOutlines – SelectScriptLibraries v Also set by selectAllFormatElements – SelectActions – SelectForms – SelectFramesets – SelectImageResources – SelectJavaResources – SelectMiscFormatElements – SelectPages – SelectStylesheetResources – SelectSubforms v Also set by selectAllIndexElements – SelectFolders – SelectMiscIndexElements – SelectNavigators – SelectViews v Other: – SelectHelpAbout – SelectHelpIndex – SelectHelpUsing – SelectIcon – SelectSharedFields
Language cross-reference SelectAllDesignElements method in LotusScript NotesNoteCollection class
Examples: selectAllDesignElements method This agent builds a note collection consisting of those design elements in the database not set by SelectCodeElements, SelectFormatElements, and SelectIndexElements. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Chapter 2. Java Classes A-Z
747
Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllDesignElements(true); nc.selectAllCodeElements(false); nc.selectAllFormatElements(false); nc.selectAllIndexElements(false); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllFormatElements method Selects or deselects the notes for format elements for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllFormatElements(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes all format elements v false excludes all format elements
Usage The notes for format elements are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v SelectActions v SelectForms v SelectFramesets v SelectImageResources v SelectJavaResources v SelectMiscFormatElements v SelectPages v SelectStylesheetResources
748
Programming Guide, Volume 3: Java/CORBA Classes
v SelectSubforms
Language cross-reference SelectAllFormatElements method in LotusScript NotesNoteCollection class
Examples: selectAllFormatElements method This agent builds a note collection consisting of all format elements in the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllFormatElements(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
selectAllIndexElements method Selects or deselects the notes for index elements for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllIndexElements(boolean selectorvalue) throws NotesException
Chapter 2. Java Classes A-Z
749
Parameters boolean selectorvalue
v true includes all index elements v false excludes all index elements
Usage The notes for index elements are those regulated by the following properties. This method sets these properties true or false as indicated by the selector value. v SelectFolders v SelectMiscIndexElements v SelectNavigators v SelectViews
Language cross-reference SelectAllIndexElements method in LotusScript NotesNoteCollection class
Examples: selectAllIndexElements method This agent builds a note collection consisting of all index elements in the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllIndexElements(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } }
750
Programming Guide, Volume 3: Java/CORBA Classes
selectAllNotes method Selects or deselects all notes for inclusion in the collection.
Defined in NoteCollection
Syntax public void selectAllNotes(boolean selectorvalue) throws NotesException
Parameters boolean selectorvalue
v true includes all notes v false excludes all notes
Language cross-reference SelectAllNotes method in LotusScript NotesNoteCollection class
Examples: selectAllNotes method This agent builds a notes collection consisting of all the notes in the database. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); // Open DXL file named after current database Stream stream = session.createStream(); String filename = "c:\\dxl\\"; filename = filename + db.getFileName(); filename = filename.substring(0, filename.length() - 3) + "dxl"; if (stream.open(filename)) { System.out.println("Opened " + filename); stream.truncate(); // Create note collection NoteCollection nc = db.createNoteCollection(false); nc.selectAllNotes(true); nc.buildCollection(); // Export note collection as DXL DxlExporter exporter = session.createDxlExporter(); String output = exporter.exportDxl(nc); stream.writeText(output); stream.close(); } else { System.out.println("Cannot open " + filename); } } catch(Exception e) { e.printStackTrace(); } } } Chapter 2. Java Classes A-Z
751
Outline class Represents an outline in a database.
Syntax public class Outline extends Base
Containment Contained by: Database Contains: OutlineEntry
Properties Alias through getAlias and setAlias Comment through getComment and setComment Name through getName and setName ParentDatabase through getParentDatabase
Methods addEntry createEntry getChild getFirst getLast getNext getNextSibling getParent getPrev getPrevSibling moveEntry recycle removeEntry save
Creation and access Create an outline with createOutline in Database. Get an existing outline object with getOutline in Database.
752
Programming Guide, Volume 3: Java/CORBA Classes
Usage An outline supports a hierarchy of outline entries and provides methods for their navigation and manipulation.
Examples: Outline class, Alias, Comment, and Name properties, getFirst and getNext methods, OutlineEntry class, Alias, EntryClass, IsInThisDB, IsPrivate, Label, Level, and Type properties 1. This agent gets the properties of every entry in an outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try Session session = getSession() AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println("*** " + outline.getName() + " ***"); System.out.println("Alias: " + outline.getAlias()); System.out.println("Comment: " + outline.getComment()); OutlineEntry entry = outline.getFirst(); while (entry != null) { System.out.println(entry.getLabel()); if (entry.getAlias().length() > 0) System.out.println("\tAlias: " + entry.getAlias()); String type = null; switch (entry.getType()) { case OutlineEntry.OUTLINE_OTHER_FOLDERS_TYPE: type = "Other folders"; break; case OutlineEntry.OUTLINE_OTHER_VIEWS_TYPE: type = "Other views"; break; case OutlineEntry.OUTLINE_OTHER_UNKNOWN_TYPE: type = "Other unknown"; break; case OutlineEntry.OUTLINE_TYPE_ACTION: type = "Action"; break; case OutlineEntry.OUTLINE_TYPE_NAMEDELEMENT: type = "Named element"; break; case OutlineEntry.OUTLINE_TYPE_NOTELINK: type = "Note link"; break; case OutlineEntry.OUTLINE_TYPE_URL: type = "URL"; break; } System.out.println("\tType: " + type); String entryClass = null; switch (entry.getEntryClass()) { case OutlineEntry.OUTLINE_CLASS_DATABASE: entryClass = "Database"; break; case OutlineEntry.OUTLINE_CLASS_DOCUMENT: entryClass = "Document"; break; case OutlineEntry.OUTLINE_CLASS_FORM: entryClass = "Form"; break; case OutlineEntry.OUTLINE_CLASS_FOLDER: entryClass = "Folder"; break; case OutlineEntry.OUTLINE_CLASS_FRAMESET: entryClass = "Frame set"; break; case OutlineEntry.OUTLINE_CLASS_NAVIGATOR: entryClass = "Navigator"; break; case OutlineEntry.OUTLINE_CLASS_PAGE: entryClass = "Page"; break; Chapter 2. Java Classes A-Z
753
case OutlineEntry.OUTLINE_CLASS_UNKNOWN: entryClass = "Unknown"; break; case OutlineEntry.OUTLINE_CLASS_VIEW: entryClass = "View"; break; } System.out.println("\tEntry class: " + entryClass); System.out.println("\tLevel: " + entry.getLevel()); if (entry.isInThisDB()) System.out.println("\tRefers to an element in this database"); else System.out.println ("\tDoes not refer to an element in this database"); if (entry.isPrivate()) System.out.println("\tEntry is private"); else System.out.println("\tEntry is public"); if (entry.getFrameText().length() > 0) System.out.println("\tFrame text: " + entry.getFrameText()); if (entry.getImagesText().length() > 0) System.out.println("\tImages text: " + entry.getImagesText()); entry = outline.getNext(entry); } } catch(Exception e) { e.printStackTrace(); } } }
2. This agent creates an outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.createOutline("Some Documents"); outline.setAlias("SomeDocuments"); outline.setComment("Gives partial view of database"); outline.save(); } catch(Exception e) { e.printStackTrace(); } } }
Alias property Read-Write. Alias name of an outline for programmatic access.
Defined in Outline
Data type String
754
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public String getAlias() throws NotesException public void setAlias(String value) throws NotesException
Language cross-reference Alias property in LotusScript NotesOutline class
Comment property Read-Write. An informational description of an outline.
Defined in Outline
Data type String
Syntax public String getComment() throws NotesException public void setComment(String value) throws NotesException
Language cross-reference Comment property in LotusScript NotesOutline class REM keyword in formula language
Name property Read-write. Name of an outline.
Defined in Outline
Data type String
Syntax public String getName() throws NotesException public void setName(String name) throws NotesException
Language cross-reference Name property in LotusScript NotesOutline class
ParentDatabase property Read-only. The parent database of the outline. Note: This property is new in Release 5.0.2.
Defined in Outline
Chapter 2. Java Classes A-Z
755
Data type Database
Syntax public Database getParentDatabase() throws NotesException
Language cross-reference ParentDatabase property in LotusScript NotesOutline class
Examples: ParentDatabase property This example prints the file name of the parent database of the Products outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("Products"); Database db2 = outline.getParentDatabase(); System.out.println(db2.getFileName()); } catch(Exception e) { e.printStackTrace(); } } }
addEntry method Adds an entry to an outline. Note: This method is obsolete as of Release 5.0.2, but is supported for backward compatibility. Use createEntry to add a new entry to an outline.
Defined in Outline
Syntax public void addEntry(OutlineEntry entry, OutlineEntry referenceEntry) throws NotesException public void addEntry(OutlineEntry entry, OutlineEntry referenceEntry, boolean after) throws NotesException public void addEntry(OutlineEntry entry, OutlineEntry referenceEntry, boolean after, boolean asChild) throws NotesException
Parameters OutlineEntry entry
The entry being added. OutlineEntry referenceEntry
The name of an existing entry. Specify null to add the first entry to an empty outline. boolean after
true (default) to put the entry after the existing entry; false to put the entry before the existing entry. boolean asChild
756
Programming Guide, Volume 3: Java/CORBA Classes
true (default) to make the entry a child of the preceding entry. If boolean after is false and boolean asChild is true, an exception is raised.
Usage You must save the outline or the effect of this method is lost when the program exits.
Language cross-reference AddEntry method in LotusScript NotesOutline class
Examples: addEntry, createEntry, and save methods, OutlineEntry FrameText, ImagesText, setNamedElement properties 1. This agent creates an entry as a subentry to the first entry in an outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println( "Creating entry ... Some Documents ..."); OutlineEntry entry = outline.createEntry( "Some Documents",outline.getFirst(), true,false); entry.setNamedElement(db, "Database", OutlineEntry.OUTLINE_CLASS_DATABASE); entry.setFrameText("NotesView"); entry.setImagesText("Domino\\icons\\abook.gif"); entry.setLabel("Some Documents"); outline.save(); } catch(Exception e) { e.printStackTrace(); } } }
2. This example creates a copy of the first entry in the ″Some Documents″ outline. The entry is then added to the outline after the second entry at the top level. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("Some Documents"); OutlineEntry entryA = outline.getFirst(); OutlineEntry entryB = outline.getNext(entryA); outline.createEntry(entryA,entryB,true,false); outline.save(); } catch(Exception e) { e.printStackTrace(); } } } Chapter 2. Java Classes A-Z
757
createEntry method Creates an outline entry and adds it to the outline. Note: All the methods except createEntry(String entryName) are new in Release 5.0.2.
Defined in Outline
Syntax public OutlineEntry createEntry(OutlineEntry fromEntry) throws NotesException public OutlineEntry createEntry(OutlineEntry fromEntry, OutlineEntry referenceEntry) throws NotesException public OutlineEntry createEntry(OutlineEntry fromEntry, OutlineEntry referenceEntry, boolean after) throws NotesException public OutlineEntry createEntry(OutlineEntry fromEntry, OutlineEntry referenceEntry, boolean after, boolean asChild) throws NotesException public OutlineEntry createEntry(String entryName) throws NotesException public OutlineEntry createEntry(String entryName, OutlineEntry referenceEntry) throws NotesException public OutlineEntry createEntry(String entryName, OutlineEntry referenceEntry, boolean after) throws NotesException public OutlineEntry createEntry(String entryName, OutlineEntry referenceEntry, boolean after, boolean asChild) throws NotesException
Parameters OutlineEntry fromEntry
The entry to be copied. String entryName
The name of the entry. OutlineEntry referenceEntry
The entry after or before which the entry is being placed. boolean after
true (default) to place the entry after the specified reference entry. boolean asChild
true to place the entry as a child of the specified reference entry. The default is false.
Usage The createEntry(OutlineEntry fromEntry) methods create a copy of an existing outline entry and add it to the outline. The createEntry(String entryName) methods create a new outline entry and add it to the outline. You must save the outline or the effect of this method is lost when the program exits.
758
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference CreateEntry method in LotusScript NotesOutline class
getChild method Gets the child of the specified outline entry. Note: This method is new in Release 5.0.2.
Defined in Outline
Syntax public OutlineEntry getChild(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
The parent entry.
Return value OutlineEntry
The child entry.
Language cross-reference GetChild method in LotusScript NotesOutline class
Examples: getChild method This example gets the child of the first entry in an outline and sets its alias to ″First quarter″. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("Product Discussion"); OutlineEntry entryA = outline.getFirst(); OutlineEntry entryB = outline.getChild(entryA); entryB.setAlias("First quarter"); outline.save(); } catch(Exception e) { e.printStackTrace(); } } }
getFirst method Gets the first entry of an outline.
Defined in Outline
Syntax public OutlineEntry getFirst() throws NotesException
Chapter 2. Java Classes A-Z
759
Return value OutlineEntry
The first entry of the outline, or null if there are no entries.
Language cross-reference GetFirst method in LotusScript NotesOutline class
getLast method Gets the last entry of an outline.
Defined in Outline
Syntax public OutlineEntry getLast() throws NotesException
Return value OutlineEntry
The last entry of the outline, or null if there are no entries.
Language cross-reference GetLast method in LotusScript NotesOutline class
Examples: getLast and getPrev methods This agent gets the entries in an outline last to first. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println("*** " + outline.getName() + " ***"); System.out.println("ALL ENTRIES LAST TO FIRST"); OutlineEntry entry = outline.getLast(); while (entry != null) { System.out.println(entry.getLabel()); entry = outline.getPrev(entry); } } catch(Exception e) { e.printStackTrace(); } } }
getNext method Gets the entry immediately following a specified entry of an outline.
Defined in Outline
Syntax public OutlineEntry getNext(OutlineEntry entry) throws NotesException
760
Programming Guide, Volume 3: Java/CORBA Classes
Parameters OutlineEntry entry
An entry in the outline.
Return value OutlineEntry
The entry following the one specified as the parameter, or null if there is no next entry.
Language cross-reference GetNext method in LotusScript NotesOutline class
getNextSibling method Gets the entry at the same level following a specified entry of an outline.
Defined in Outline
Syntax public OutlineEntry getNextSibling(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
An entry in the outline.
Return value OutlineEntry
The entry at the same level following the one specified as the parameter, or null if there is no next sibling.
Language cross-reference GetNextSibling method in LotusScript NotesOutline class
Examples: getNextSibling and getParent methods This agent gets the top-level entries in an outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println("*** " + outline.getName() + " ***"); System.out.println("TOP-LEVEL ENTRIES"); OutlineEntry entry = outline.getFirst(); while (entry != null) { System.out.println(entry.getLabel()); entry = outline.getNextSibling(entry); } } catch(Exception e) {
Chapter 2. Java Classes A-Z
761
e.printStackTrace(); } } }
getParent method Returns the parent of a specified entry.
Defined in Outline
Syntax public OutlineEntry getParent(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
An entry in the outline.
Return value OutlineEntry
The parent entry of the one specified as the parameter, or null if there is no parent.
Language cross-reference GetParent method in LotusScript NotesOutline class
getPrev method Gets the entry immediately preceding a specified entry of an outline.
Defined in Outline
Syntax public OutlineEntry getPrev(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
An entry in the outline.
Return value OutlineEntry
The entry preceding the one specified as the parameter, or null if there is no next entry.
Language cross-reference GetPrev method in LotusScript NotesOutline class
getPrevSibling method Gets the entry at the same level preceding a specified entry of an outline.
Defined in Outline
762
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public OutlineEntry getPrevSibling(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
An entry in the outline.
Return value OutlineEntry
The entry at the same level preceding the one specified as the parameter, or null if there is no next sibling.
Language cross-reference GetPrevSibling method in LotusScript NotesOutline class
Examples: getPrevSibling method This agent gets the top-level entries in an outline last to first. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println("*** " + outline.getName() + " ***"); System.out.println("TOP-LEVEL ENTRIES LAST TO FIRST"); OutlineEntry entry = outline.getLast(); while (entry.getLevel() > 0) entry = outline.getParent(entry); while (entry != null) { System.out.println(entry.getLabel()); entry = outline.getPrevSibling(entry); } } catch(Exception e) { e.printStackTrace(); } } }
moveEntry method Moves an outline entry and subentries from one location to another.
Defined in Outline
Syntax public void moveEntry(OutlineEntry entry, OutlineEntry referenceEntry) throws NotesException public void moveEntry(OutlineEntry entry, OutlineEntry referenceEntry, boolean after) throws NotesException public void moveEntry(OutlineEntry entry, OutlineEntry referenceEntry, boolean after, boolean asChild) throws NotesException
Chapter 2. Java Classes A-Z
763
Parameters OutlineEntry entry
The entry being moved. OutlineEntry referenceEntry
The entry after or before which the entry being moved is placed. boolean after
v true (default) to move the entry after the reference entry v false to move the entry before the reference entry, as a sibling boolean asChild
v true to make the entry a child of the preceding entry v false (default) to not make the entry a child Note: The parameter default changed to false in Release 5.0.2. If ″boolean after″ is false and ″boolean asChild″ is true, an exception is raised.
Usage You must save the outline or the effect of this method is lost when the program exits. Moving an entry to the beginning of the outline makes it a top-level (level 0) entry.
Language cross-reference MoveEntry method in LotusScript NotesOutline class
Examples: moveEntry method This agent moves an entry to the beginning of the outline. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); OutlineEntry entry = outline.getFirst(); while (entry != null) { if (entry.getLabel().equals("Some Documents")) { System.out.println(entry.getLabel() + " ... is being moved"); outline.moveEntry(entry, outline.getFirst(), false); outline.save(); break; } entry = outline.getNext(entry); } } catch(Exception e) { e.printStackTrace(); } } }
removeEntry method Deletes an entry and its subentries from an outline.
764
Programming Guide, Volume 3: Java/CORBA Classes
Defined in Outline
Syntax public void removeEntry(OutlineEntry entry) throws NotesException
Parameters OutlineEntry entry
The entry being removed. Cannot be null.
Usage You must save the outline or the effect of this method is lost when the program exits. An attempt to access entries removed with this method throws an exception.
Language cross-reference RemoveEntry method in LotusScript NotesOutline class
Examples: removeEntry method This agent removes all entries that are not at the top level. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); int count = 0; OutlineEntry entry = outline.getFirst(); while (entry != null) { OutlineEntry thisEntry = entry; entry = outline.getNext(entry); if (thisEntry.getLevel() > 0) { System.out.println(thisEntry.getLabel() + " ... is being removed"); outline.removeEntry(thisEntry); count++; } } outline.save(); System.out.println(count + " outline entries removed"); } catch(Exception e) { e.printStackTrace(); } } }
save method Saves any changes made to the outline.
Defined in Outline
Syntax public void save()
Chapter 2. Java Classes A-Z
765
Usage You must save the outline before the program exits or the effect of a method that changes the outline is lost. These methods include addEntry, createEntry, moveEntry, and removeEntry.
Language cross-reference Save method in LotusScript NotesOutline class
OutlineEntry class Represents an entry in an outline.
Syntax public class OutlineEntry extends Base
Containment Contained by: Outline
Properties Alias through getAlias and setAlias Database through getDatabase Document through getDocument EntryClass through getEntryClass Formula through getFormula FrameText through getFrameText and setFrameText HasChildren through hasChildren HideFormula through getHideFormula and setHideFormula ImagesText through getImagesText and setImagesText IsHidden through isHidden and setHidden IsHiddenFromNotes through isHiddenFromNotes and setHiddenFromNotes IsHiddenFromWeb through isHiddenFromWeb and setHiddenFromWeb IsInThisDB through isInThisDB IsPrivate through isPrivate KeepSelectionFocus through getKeepSelectionFocus and setKeepSelectionFocus Label through getLabel and setLabel Level through getLevel and setLevel NamedElement through getNamedElement
766
Programming Guide, Volume 3: Java/CORBA Classes
Parent through getParent Type through getType URL through getURL UseHideFormula through getUseHideFormula and setUseHideFormula View through getView
Methods recycle setAction setNamedElement setNoteLink setURL
Creation and access To create an outline entry, use createEntry in Outline. To access outline entries, use the navigation methods in Outline.
Alias property Read-Write. Name of an outline entry for programmatic access.
Defined in OutlineEntry
Data type String
Syntax public String getAlias() throws NotesException public void setAlias(String value) throws NotesException
Language cross-reference Alias property in LotusScript NotesOutlineEntry class
Database property Read-only. Database that is the resource link for an outline entry, or null.
Defined in OutlineEntry
Data type Database
Syntax public Database getDatabase() throws NotesException Chapter 2. Java Classes A-Z
767
Usage This property applies if the outline entry type is OUTLINE_TYPE_NOTELINK or OUTLINE_TYPE_NAMEDELEMENT and the entry class is OUTLINE_CLASS_DATABASE, OUTLINE_CLASS_DOCUMENT, or OUTLINE_CLASS_VIEW.
Language cross-reference Database property in LotusScript NotesOutlineEntry class
Document property Read-only. Document that is the resource link for an outline entry, or null.
Defined in OutlineEntry
Data type Document
Syntax public Document getDocument() throws NotesException
Usage This property applies if the outline entry type is OUTLINE_TYPE_NOTELINK and the entry class is OUTLINE_CLASS_DOCUMENT.
Language cross-reference Document property in LotusScript NotesOutlineEntry class
EntryClass property Read-only. Class of outline entry.
Defined in OutlineEntry
Data type int
Syntax public int getEntryClass() throws NotesException
Legal values v OutlineEntry.OUTLINE_CLASS_DATABASE v OutlineEntry.OUTLINE_CLASS_DOCUMENT v v v v v v v
OutlineEntry.OUTLINE_CLASS_FORM OutlineEntry.OUTLINE_CLASS_FOLDER OutlineEntry.OUTLINE_CLASS_FRAMESET OutlineEntry.OUTLINE_CLASS_NAVIGATOR OutlineEntry.OUTLINE_CLASS_PAGE OutlineEntry.OUTLINE_CLASS_UNKNOWN OutlineEntry.OUTLINE_CLASS_VIEW
Language cross-reference EntryClass property in LotusScript NotesOutlineEntry class
768
Programming Guide, Volume 3: Java/CORBA Classes
Formula property Read-only. Formula of an action outline, or an empty string.
Defined in OutlineEntry
Data type String
Syntax public String getFormula() throws NotesException
Usage This property applies if the outline entry type is OUTLINE_TYPE_ACTION.
Language cross-reference Formula property in LotusScript NotesOutlineEntry class
FrameText property Read-Write. The name of the target frame for the entry’s OnClick event.
Defined in OutlineEntry
Data type String
Syntax public String getFrameText() throws NotesException public void setFrameText(String value) throws NotesException
Language cross-reference FrameText property in LotusScript NotesOutlineEntry class @SetTargetFrame function in formula language
HasChildren property Read-only. Indicates whether an entry contains child entries.
Defined in OutlineEntry
Data type boolean
Syntax public boolean hasChildren() throws NotesException
Legal values v true if the entry contains child entries v false if the entry does not contain child entries Chapter 2. Java Classes A-Z
769
Language cross-reference HasChildren property in LotusScript NotesOutlineEntry class @DocChildren function in formula language
Examples: HasChildren property This agent gets all the entries in an outline. It separates the children by dropping levels through a recursive function. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Outline outline = db.getOutline("DiscOutline"); System.out.println("*** " + outline.getName() + " ***"); OutlineEntry entry = outline.getFirst(); while (entry != null) { System.out.println(entry.getLabel()); if (entry.hasChildren()) printChild(outline, entry); entry = outline.getNextSibling(entry); } } catch(Exception e) { e.printStackTrace(); } } void printChild(Outline outline, OutlineEntry entry) { try { entry = outline.getNext(entry); String tabs = ""; for (int i=0; i 0) System.out.println(dbdir.getName()); else System.out.println("Local"); } else System.out.println("Entry does not exist"); } else System.out.println( "Can’t get " + database + " on " + server); } catch(Exception e) { e.printStackTrace(); } } }
Views property Read-write. The views in the source database that are replicated when replicating a subset of views and folders.
Defined in ReplicationEntry
Data type String
Syntax public String getViews() throws NotesException public void setViews(String views) throws NotesException
Usage Specify the views as a list, separating view names with semicolons.
842
Programming Guide, Volume 3: Java/CORBA Classes
After setting this property, you must call save for the changes to take effect. If you do not call save, your changes are lost.
Language cross-reference Views property in NotesReplicationEntry class
Examples: Views property This agent toggles a subset of views and all views. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String server = "Server1/East/Acme"; String database = "test\\DatabaseJava"; String AnyServer = "-"; Database db = session.getDatabase(server, database); if (db.isOpen()) { Replication rep = db.getReplicationInfo(); ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false); if (re != null) { if (re.getViews().length() == 0) { String views = "Base;Special View"; re.setViews(views); } else re.setViews(""); re.save(); System.out.println("Views = " + re.getViews()); } else System.out.println("Entry does not exist"); } else System.out.println( "Can’t get " + database + " on " + server); } catch(Exception e) { e.printStackTrace(); } } }
remove method Removes the replication entry from the database.
Defined in ReplicationEntry
Syntax public int remove() throws NotesException
Language cross-reference Remove method in NotesReplicationEntry class
Chapter 2. Java Classes A-Z
843
Examples: remove method This agent removes a replication entry. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String server = "Server1/East/Acme"; String database = "test\\DatabaseJava"; String AnyServer = "-"; Database db = session.getDatabase(server, database); if (db.isOpen()) { Replication rep = db.getReplicationInfo(); ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false); if (re != null) { re.remove(); System.out.println("Entry removed"); } else System.out.println("Entry does not exist"); } else System.out.println( "Can’t get " + database + " on " + server); } catch(Exception e) { e.printStackTrace(); } } }
save method Saves the replication entry.
Defined in ReplicationEntry
Syntax public int save() throws NotesException
Usage If you don’t call the save method before closing the database, any changes to the replication entry are lost.
Language cross-reference Save method in NotesReplicationEntry class
Examples: save method This agents sets the formula and saves a replication entry. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() {
844
Programming Guide, Volume 3: Java/CORBA Classes
try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String server = "Server1/East/Acme"; String database = "test\\DatabaseJava"; String AnyServer = "-"; Database db = session.getDatabase(server, database); if (db.isOpen()) { Replication rep = db.getReplicationInfo(); ReplicationEntry re = rep.getEntry(AnyServer, AnyServer, false); if (re != null) { re.setFormula("Form=\"MainTopic\""); System.out.println(re.getFormula()); } else System.out.println("Entry does not exist"); } else System.out.println( "Can’t get " + database + " on " + server); } catch(Exception e) { e.printStackTrace(); } } }
RichTextDoclink class Represents a doclink in a rich text item. Note: This class is new with Release 6.5.
Containment Contained by: RichTextItem, RichTextNavigator Contains: RichTextStyle
Properties DBReplicaID through getDBReplicaID and setDBReplicaID DisplayComment through getDisplayComment and setDisplayComment DocUnID through getDocUnID and setDocUnID HotSpotText through getHotSpotText and setHotSpotText HotSpotTextStyle through getHotSpotTextStyle ServerHint through getServerHint and setServerHint ViewUnID through getViewUnID and setViewUnID
Methods recycle remove Chapter 2. Java Classes A-Z
845
setHotSpotTextStyle
Access To access a RichTextDoclink object, use the RichTextNavigator methods in conjunction with the type RTELEM_TYPE_DOCLINK.
Usage Hotspot text representing a doclink can be retrieved by navigating to the doclink, enclosing it in a RichTextRange, and retrieving the associated text with TextRun. If the doclink is not a hotspot, no text is present.
Examples: RichTextDoclink class This agent displays the applicable properties for all the doclinks in the Body item of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { String idzero = new String("00000000000000000000000000000000"); do { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String server = rtlink.getServerHint(); if (server.length() == 0) server = "Local"; System.out.println("Server = " + server); System.out.println( "\tDatabase replica ID = " + rtlink.getDBReplicaID()); String viewunid = rtlink.getViewUnID(); if (!viewunid.equals(idzero)) System.out.println("\tView UNID = " + viewunid); String docunid = rtlink.getDocUnID(); if (!docunid.equals(idzero)) System.out.println("\tDocument UNID = " + docunid); } while (rtnav.findNextElement()); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
DBReplicaID property Read-write. Replica ID of the target database.
Defined in RichTextDoclink
846
Programming Guide, Volume 3: Java/CORBA Classes
Data type String
Syntax public String getDBReplicaID() throws NotesException public void setDBReplicaID(String replicaid) throws NotesException
Language cross-reference @ReplicaID function in formula language DbReplicaID property in LotusScript NotesRichTextDoclink class
Examples: DBReplicaID property This agent displays the title of the local replica of the target database of the first or only doclink in the Body item of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); DbDirectory dbdir = session.getDbDirectory(""); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(db.getTitle()); else System.out.println("Database has no local replica"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
DisplayComment property Read-write. Comment text of the doclink.
Defined in RichTextDoclink
Data type String
Chapter 2. Java Classes A-Z
847
Syntax public String getDisplayComment() throws NotesException public void setDisplayComment(String comment) throws NotesException
Language cross-reference DisplayComment property in LotusScript NotesRichTextDocLink class
Examples: DisplayComment property This agent displays the comment for every doclink in the Body item of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { do { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String comment = rtlink.getDisplayComment(); if (comment.length() > 0) System.out.println(rtlink.getDisplayComment()); else System.out.println("No display comment"); } while (rtnav.findNextElement()); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
DocUnID property Read-write. Universal ID of the target document.
Defined in RichTextDoclink
Data type String
Syntax public String getDocUnID() throws NotesException public void setDocUnID(String unid) throws NotesException
848
Programming Guide, Volume 3: Java/CORBA Classes
Usage If the doclink does not target a document, this property is 32 zeros.
Language cross-reference @DocumentUniqueID in the formula language DocUNID property in LotusScript NotesRichTextDocLink class
Examples: DocUnID property This agent displays value of the Subject item of the target document of the first or only doclink in the Body item of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { String idzero = new String("00000000000000000000000000000000"); RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String docunid = rtlink.getDocUnID(); if (!docunid.equals(idzero)) { DbDirectory dbdir = session.getDbDirectory( rtlink.getServerHint()); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) { try { Document doc2 = db.getDocumentByUNID( rtlink.getDocUnID()); System.out.println(doc2.getItemValueString("Subject")); } catch(NotesException ne) { System.out.println("Could not open document"); } } else System.out.println("No local replica"); } else System.out.println("Link does not have doc component"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
HotSpotText property Read-write. For a hotspot doclink, the text representing the doclink.
Chapter 2. Java Classes A-Z
849
Defined in RichTextDoclink
Data type String
Syntax public String getHotSpotText() throws NotesException public void setHotSpotText(String text) throws NotesException
Usage If this property is an empty string, the doclink is not a hotspot doclink. You can set this property only for a hotspot doclink. You cannot set this property to an empty string.
Language cross-reference HotSpotText property in LotusScript NotesRichTextDocLink class
Examples: HotspotText 1. This agent displays the hotspot text of the first doclink in the Body item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String hot = rtlink.getHotSpotText(); if (hot.length() != 0) System.out.println("Hotspot text = " + hot); else System.out.println("No hotspot text"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent changes the hotspot text of the first doclink in the Body item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() {
850
Programming Guide, Volume 3: Java/CORBA Classes
try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String hot = rtlink.getHotSpotText(); if (hot.length() != 0) { rtlink.setHotSpotText(hot + "!"); doc.save(true, true); } else System.out.println("No hotspot text"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
HotSpotTextStyle property Read-only. For a hotspot doclink, the style of the text representing the doclink.
Defined in RichTextDoclink
Data type RichTextStyle
Syntax public RichTextStyle getHotSpotTextStyle() throws NotesException
Usage To set the style, use setHotSpotTextStyle.
Language cross-reference HotSpotTextStyle property in LotusScript NotesRichTextDoclink class
Examples: HotSpotTextStyle property This agent toggles the bold attribute of the hotspot text for the first doclink in the Body item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); Chapter 2. Java Classes A-Z
851
RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); if (rtlink.getHotSpotText().length() != 0) { RichTextStyle rts = rtlink.getHotSpotTextStyle(); if (rts.getBold() == RichTextStyle.YES) rts.setBold(RichTextStyle.NO); else rts.setBold(RichTextStyle.YES); rtlink.setHotSpotTextStyle(rts); doc.save(true, true); } else System.out.println("No hotspot text"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
ServerHint property Read-write. Name of the server containing the target database.
Defined in RichTextDoclink
Data type String
Syntax public String getServerHint() throws NotesException public void setServerHint(String server) throws NotesException
Usage This property is an empty string if the database is local.
Language cross-reference ServerHint property in LotusScript NotesRichTextDocLink class
Examples: ServerHint property This agent displays the server of the database of the first or only doclink in the Body item of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body");
852
Programming Guide, Volume 3: Java/CORBA Classes
RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String server = rtlink.getServerHint(); if (server.length() == 0) System.out.println("Doclink points to a local database"); else System.out.println( "Doclink points to a database on " + server); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
ViewUnID property Read-write. Universal ID of the target view.
Defined in RichTextDoclink
Data type String
Syntax public String getViewUnID() throws NotesException public void setViewUnID(String unid) throws NotesException
Usage If the doclink does not target a view, this property is 32 zeros.
Language cross-reference ViewUNID property in LotusScript NotesRichTextDocLink class
Examples: ViewUnID property This agent displays the name of the target view of the first or only doclink in the Body item of the current document. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { String idzero = new String("00000000000000000000000000000000"); RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); Chapter 2. Java Classes A-Z
853
String viewunid = rtlink.getViewUnID(); if (!viewunid.equals(idzero)) { DbDirectory dbdir = session.getDbDirectory(rtlink.getServerHint()); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) { Vector views = db.getViews(); View view = null; for (int i = 0; i < views.size(); i++) { view = (View)views.elementAt(i); if (view.getUniversalID().equals(rtlink.getViewUnID())) { System.out.println(view.getName()); break; } } } else System.out.println("Cannot open database"); } else System.out.println("Link does not have view component"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
remove method Removes the doclink from the rich text item.
Defined in RichTextDoclink
Syntax public void remove() throws NotesException
Language cross-reference Remove method in LotusScript NotesRichTextDocLink class
Examples: remove method This agent removes doclinks from the Body item of the current document at user discretion. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { String idzero = new String("00000000000000000000000000000000");
854
Programming Guide, Volume 3: Java/CORBA Classes
RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String viewunid = rtlink.getViewUnID(); if (!viewunid.equals(idzero)) { DbDirectory dbdir = session.getDbDirectory(rtlink.getServerHint()); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) { Vector views = db.getViews(); View view = null; for (int i = 0; i < views.size(); i++) { view = (View)views.elementAt(i); if (view.getUniversalID().equals(rtlink.getViewUnID())) { System.out.println(view.getName()); break; } } } else System.out.println("Cannot open database"); } else System.out.println("Link does not have view component"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
setHotSpotTextStyle method Sets the style of the text for a hotspot link.
Defined in RichTextDoclink
Syntax public void setHotSpotTextStyle(RichTextStyle style) throws NotesException
Parameters RichTextStyle style
The style for the doclink text.
Usage To get the style, use HotSpotTextStyle.
Language cross-reference SetHotSpotTextStyle method in LotusScript NotesRichTextDocLink class
Examples: setHotSpotTextStyle method This agent changes the hotspot text and style of the first doclink in the Body item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Chapter 2. Java Classes A-Z
855
Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); String hot = rtlink.getHotSpotText(); if (hot.length() != 0) { rtlink.setHotSpotText("New hotspot text"); RichTextStyle rts = rtlink.getHotSpotTextStyle(); rts.setBold(RichTextStyle.YES); rtlink.setHotSpotTextStyle(rts); doc.save(true, true); } else System.out.println("No hotspot text"); } else System.out.println("No doclinks in Body"); } catch(Exception e) { e.printStackTrace(); } } }
RichTextItem class Represents an item of type rich text.
Syntax public class RichTextItem extends Item
Base class Inherits from: Item
Containment Contained by: Document Contains: EmbeddedObject
Property DateTimeValue through getDateTimeValue and setDateTimeValue (from Item) EmbeddedObjects through getEmbeddedObjects InputSource through getInputSource (from Item) InputStream through getInputStream (from Item) IsAuthors through isAuthors and setAuthors (from Item) IsEncrypted through isEncrypted and setEncrypted (from Item) IsNames through isNames and setNames (from Item)
856
Programming Guide, Volume 3: Java/CORBA Classes
IsProtected through isProtected and setProtected (from Item) IsReaders through isReaders and setReaders (from Item) IsSaveToDisk through isSaveToDisk and setSaveToDisk (from Item) IsSigned through isSigned and setSigned (from Item) IsSummary through isSummary and setSummary (from Item) LastModified through getLastModified (from Item) Name through getName (from Item) Parent through getParent (from Item) Reader through getReader (from Item) Text through getText (from Item) Type through getType (from Item) ValueDouble through getValueDouble and setValueDouble (from Item) ValueInteger through getValueInteger and setValueInteger (from Item) ValueLength through getValueLength (from Item) Values through getValues and setValues (from Item) ValueString through getValueString and setValueString (from Item)
Methods abstractText (from Item) addNewLine addPageBreak addTab appendDocLink appendParagraphStyle appendRTItem appendStyle appendTable appendText appendToTextList (from Item)
Chapter 2. Java Classes A-Z
857
beginInsert beginSection compact containsValue (from Item) copyItemToDocument (from Item) createNavigator createRange embedObject endInsert endSection getEmbeddedObject getFormattedText getMIMEEntity (from Item) getNotesFont getUnformattedText getValueCustomData (from Item) getValueCustomDataBytes (from Item) parseXML (from Item) recycle remove (from Item) setValueCustomData (from Item) setValueCustomDataBytes (from Item) toString (from Item) transformXML (from Item) update
Creation To create a new RichTextItem object, use createRichTextItem in Document.
858
Programming Guide, Volume 3: Java/CORBA Classes
Access To access an existing RichTextItem object, use getFirstItem in Document. You must explicitly cast the return value to RichTextItem. Because RichTextItem inherits from Item, all of the Item properties and methods can be used on a RichTextItem, too. When you change the value of a RichTextItem object, the change is not written to disk until you call save for the parent Document object.
Examples: RichTextItem class 1. This agent creates a rich text item and appends text to it. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); Item subject = doc.replaceItemValue("Subject", "Project description"); RichTextItem body = doc.createRichTextItem("Body"); body.appendText("Cartoon book for children ages 9-12"); // Print text of subject and body System.out.println(subject.getText()); System.out.println(body.getText()); // Save the document doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent gets a rich text item. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); Item subject = doc.getFirstItem("Subject"); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); // Print text of subject and body System.out.println(subject.getText()); System.out.println(body.getText()); } catch(Exception e) {
Chapter 2. Java Classes A-Z
859
e.printStackTrace(); } } }
EmbeddedObjects property Read-only. All the embedded objects, object links, and file attachments contained in a rich text item. Note: Embedded objects and object links are not supported for OS/2, UNIX, and the Macintosh. File attachments are.
Defined in RichTextItem
Data type java.util.Vector; elements are EmbeddedObject
Syntax public java.util.Vector getEmbeddedObjects() throws NotesException
Usage This property includes OLE/1 and OLE/2 embedded objects and object links as well as file attachments. If you need access to OLE/2 embedded objects that exist in a document but are not part of a rich text item (for example, because the object was originally created on the document’s form), use the EmbeddedObjects property in Document.
Language cross-reference EmbeddedObjects property in LotusScript NotesRichTextItem class
Examples: EmbeddedObjects property This agent gets the names of the embedded objects in the Body item of the documents in a database. import lotus.domino.*; import java.util.Vector; import java.util.Enumeration; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); System.out.println(doc.getItemValueString("Subject")); Vector v = body.getEmbeddedObjects(); Enumeration e = v.elements(); while (e.hasMoreElements()) { EmbeddedObject eo = (EmbeddedObject)e.nextElement(); System.out.println("\t" + eo.getName()); } doc = dc.getNextDocument(); } } catch(NotesException e) { System.out.println(e.id + " " + e.text);
860
Programming Guide, Volume 3: Java/CORBA Classes
e.printStackTrace(); } } }
addNewLine method Appends one or more new lines (carriage returns) to a rich text item.
Defined in RichTextItem
Syntax public void addNewLine() throws NotesException public void addNewLine(int count) throws NotesException public void addNewLine(int count, boolean newparagraph) throws NotesException
Parameters int count
The number of new lines to append. boolean newparagraph
If true (default), forces the new line to be a paragraph separator. If false, the new line is added, but does not force a new paragragh.
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AddNewLine method in LotusScript NotesRichTextItem class @NewLine function in formula language @Char function in formula language
Examples: addNewLine, addPageBreak, addTab, and appendText methods This agent creates a rich text item, appends text, and adds new lines, page breaks, and tabs. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); Item subject = doc.replaceItemValue("Subject","Rich text item"); RichTextItem body = doc.createRichTextItem("Body"); body.appendText("This is the first sentence."); body.appendText(" This is the second sentence."); body.addNewLine(2); body.appendText("This is a new paragraph."); body.addPageBreak(); body.appendText("Column 1"); Chapter 2. Java Classes A-Z
861
body.addTab(); body.appendText("Column 2"); body.addNewLine(); body.appendText("Element A1"); body.addTab(); body.appendText("Element B1"); body.addNewLine(); body.appendText("Element A2"); body.addTab(); body.appendText("Element B2"); // Save the document doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
addPageBreak method Appends a page break to a rich text item.
Defined in RichTextItem
Syntax public void addPageBreak() throws NotesException public void addPageBreak(RichTextParagraphStyle pstyle) throws NotesException
Parameters RichTextParagraphStyle pstyle Starts the new page with the specified paragraph style.
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AddPageBreak method in LotusScript NotesRichTextItem class EditInsertPageBreak @command in formula language
addTab method Appends one or more tabs to a rich text item.
Defined in RichTextItem
Syntax public void addTab() throws NotesException public void addTab(int count) throws NotesException
862
Programming Guide, Volume 3: Java/CORBA Classes
Parameters int count
The number of tabs to append.
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AddTab method in LotusScript NotesRichTextItem class
appendDocLink method Adds a doclink to a rich text item.
Defined in RichTextItem
Syntax public void appendDocLink(Document doc) throws NotesException public void appendDocLink(Database db) throws NotesException public void appendDocLink(View vw) throws NotesException public void appendDocLink(Document doc, String comment) throws NotesException public void appendDocLink(Database db, String comment) throws NotesException public void appendDocLink(View vw, String comment) throws NotesException public void appendDocLink(Document doc, String comment, String hotspottext) throws NotesException public void appendDocLink(Database db, String comment, String hotspottext) throws NotesException public void appendDocLink(View vw, String comment, String hotspottext) throws NotesException
Parameters Document doc
The document to which you want to link. Database db
The database to which you want to link. View vw
The view to which you want to link. String comment
The text that appears when a user presses and holds the mouse over the link. String hotspottext
Boxed text which the user clicks to follow the link. This text appears in place of a token.
Chapter 2. Java Classes A-Z
863
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AppendDocLink method in LotusScript NotesRichTextItem class EditMakeDocLink @command in formula language
Examples: appendDocLink method This agent creates a rich text field and appends doc links. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Subject", "Doc links"); doc.replaceItemValue("Form", "Memo"); RichTextItem body = doc.createRichTextItem("Body"); body.appendText("Here are the links:"); body.addNewLine(2); body.appendDocLink(db, db.getTitle(), "Database link"); body.addNewLine(); body.appendDocLink(doc, doc.getItemValueString("Subject"), "Document link"); // Send the document doc.send("Pierre LaPierre"); } catch(Exception e) { e.printStackTrace(); } } }
appendParagraphStyle method Appends a paragraph style to a rich text item. Text following the paragraph style is rendered using the attributes of that paragraph style.
Defined in RichTextItem
Syntax public void appendParagraphStyle(RichTextParagraphStyle pstyle) throws NotesException
Parameters RichTextParagraphStyle pstyle
The paragraph style to be appended.
Usage See RichTextParagraphStyle for details and examples.
864
Programming Guide, Volume 3: Java/CORBA Classes
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AppendParagraphStyle method in LotusScript NotesRichTextItem class
appendRTItem method Appends the contents of one rich text item to another rich text item.
Defined in RichTextItem
Syntax public void appendRTItem(RichTextItem item) throws NotesException
Parameters RichTextItem item
The item to be appended. Cannot be null.
Usage The insertion occurs at the end of the item. You cannot call appendRTItem after beginInsert.
Language cross-reference AppendRTItem method in LotusScript NotesRichTextItem class
Examples: appendRTItem method This agent creates a rich text item and appends the contents of another rich text item. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Subject", "Copy of first document"); doc.replaceItemValue("Form", "Memo"); RichTextItem body = doc.createRichTextItem("Body"); body.appendText("Here is the body of the first document:"); body.addNewLine(2); DocumentCollection dc = db.getAllDocuments(); Document doc1 = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc1.getFirstItem("Body"); body.appendRTItem(rti); // Send the document doc.send("Roberta Person"); } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
865
appendStyle method Appends a style to a rich text item. Text following the style is rendered using the attributes of that style until another style is appended.
Defined in RichTextItem
Syntax public void appendStyle(RichTextStyle style) throws NotesException
Parameters RichTextStyle style
The style to be appended.
Usage This method does not affect text appended by appendRTItem. See ″RichTextStyle″ for details and examples. By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AppendStyle method in LotusScript NotesRichTextItem class EditTableFormat @command in formula language
appendTable method Inserts a table in a rich text item. The table text takes the current style of the item. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void appendTable(int rows, int columns) throws NotesException public void appendTable(int rows, int columns, java.util.Vector labels) throws NotesException public void appendTable(int rows, int columns, java.util.Vector labels, int leftmargin, java.util.Vector rtpstyles) throws NotesException
Parameters A default is taken if the signature does not include the parameter or the parameter is specified as null. int rows
Number of rows in the table. int columns
Number of columns in the table. java.util.Vector labels
866
Programming Guide, Volume 3: Java/CORBA Classes
Elements are of type String. Text of labels for a tabbed table. The number of elements must equal the number of rows. Specifying this parameter appends a tabbed table. The default is a basic table. int leftmargin
Left margin of the table in twips. The following constants are available: v RichTextParagraphStyle.RULER_ONE_CENTIMETER v RichTextParagraphStyle.RULER_ONE_INCH (default) java.util.Vector rtpstyles
Elements are of type RichTextParagraphStyle. Creates a table with fixed-width columns and style attributes as specified. The default is an auto-width table. The vector must contain one element for each column in the table in sequence. Explicitly set the first line left margin and left margin, which control the start of text relative to the start of the column, and the right margin, which controls column width.
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert. The RichTextTable class represents a table.
Language cross-reference AppendTable method in LotusScript NotesRichTextItem class EditInsertTable @command in formula language
Examples: appendTable method 1. This agent creates a basic table in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Basic table"); RichTextItem rti = doc.createRichTextItem("Body"); rti.appendText("Paragraph of text."); rti.addNewLine(2); // Create table with 4 rows and 3 columns rti.appendTable(4, 3); doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent creates a tabbed table in a rich text item. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase {
Chapter 2. Java Classes A-Z
867
public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Tabbed table"); RichTextItem rti = doc.createRichTextItem("Body"); rti.appendText("Paragraph of text."); rti.addNewLine(2); // Create tabbed table with 4 rows and 3 columns Vector tabs = new Vector(); for (int i = 0; i < 4; i++) { String element = "Row " + (i + 1); tabs.addElement(element); } rti.appendTable(4, 3, tabs); doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } }
3. This agent creates a basic table and populates it. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Basic table populated"); RichTextItem rti = doc.createRichTextItem("Body"); rti.appendText("Paragraph of text."); rti.addNewLine(2); // Create table with 4 rows and 3 columns rti.appendTable(4, 3); // Populate table RichTextNavigator rtnav = rti.createNavigator(); rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TABLECELL); for (int irow = 1; irow < 5; irow++) { for (int icol = 1; icol < 4; icol++) { rti.beginInsert(rtnav); rti.appendText("Row " + irow + ", column " + icol); rti.endInsert(); rtnav.findNextElement(RichTextItem.RTELEM_TYPE_TABLECELL); } } doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
868
Programming Guide, Volume 3: Java/CORBA Classes
4. This agent creates a basic auto-width table with a left margin of 1.5 inches rather than the default 1 inch, and populates it. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Basic table with 1.5 left margin"); RichTextItem rti = doc.createRichTextItem("Body"); rti.appendText("Paragraph of text."); rti.addNewLine(2); // Create table with 4 rows and 3 columns rti.appendTable(4, 3, null, (int)(RichTextParagraphStyle.RULER_ONE_INCH * 1.5), null); // Populate table RichTextNavigator rtnav = rti.createNavigator(); rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TABLECELL); for (int irow = 1; irow < 5; irow++) { for (int icol = 1; icol < 4; icol++) { rti.beginInsert(rtnav); rti.appendText("Row " + irow + ", column " + icol); rti.endInsert(); rtnav.findNextElement(RichTextItem.RTELEM_TYPE_TABLECELL); } } doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
5. This agent creates a basic table and populates it. The width of each column is fixed at 1.5 inches. The left margin of the table is 1.5 inches. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Basic table with 1.5 left margin"); RichTextItem rti = doc.createRichTextItem("Body"); rti.appendText("Paragraph of text."); rti.addNewLine(2); // Create table with 4 rows and 3 columns Chapter 2. Java Classes A-Z
869
RichTextParagraphStyle rtps = session.createRichTextParagraphStyle(); rtps.setLeftMargin(0); rtps.setFirstLineLeftMargin(0); rtps.setRightMargin( (int)(RichTextParagraphStyle.RULER_ONE_INCH * 1.5)); Vector styles = new Vector(); for (int i = 0; i < 3; i++) { styles.addElement(rtps); } rti.appendTable(4, 3, null, (int)(RichTextParagraphStyle.RULER_ONE_INCH * 1.5), styles); // Populate table RichTextNavigator rtnav = rti.createNavigator(); rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TABLECELL); for (int irow = 1; irow < 5; irow++) { for (int icol = 1; icol < 4; icol++) { rti.beginInsert(rtnav); rti.appendText("Row " + irow + ", column " + icol); rti.endInsert(); rtnav.findNextElement(RichTextItem.RTELEM_TYPE_TABLECELL); } } doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
appendText method Appends text to a rich text item. The text is rendered in the current style of the item.
Defined in RichTextItem
Syntax public void appendText(String text) throws NotesException
Parameters String text
The text to append.
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert.
Language cross-reference AppendText method in LotusScript NotesRichTextItem class
beginInsert method Changes the insertion position from the end of the rich text item to the beginning or end of a specified element. Note: This method is new with Release 6.5.
Defined in RichTextItem
870
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public void beginInsert(Base element) throws NotesException public void beginInsert(Base element, boolean after) throws NotesException
Parameters Base element
EmbeddedObject, RichTextDocLink, RichTextNavigator, RichTextRange, RichTextSection, or RichTextTable. The element. A RichTextNavigator element means the element at the current position of the navigator. Other elements mean the specified element. boolean after
v true to put the insertion position at the end of the element v false (default) to put the insertion position at the beginning of the element
Language cross-reference BeginInsert method in LotusScript NotesRichTextItem class
Examples: beginInsert method 1. This agent inserts text at the beginning of a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH); rti.beginInsert(rtnav); rti.appendText("Beginning text."); rti.addNewLine(1); rti.endInsert(); doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent inserts text after the second paragraph in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Chapter 2. Java Classes A-Z
871
Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator if (rtnav.findNthElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, 2)) { rti.beginInsert(rtnav, true); rti.addNewLine(1); rti.appendText("Text following 2nd paragraph."); rti.endInsert(); doc.save(true, true); } else System.out.println("No 2nd paragraph."); } catch(Exception e) { e.printStackTrace(); } } }
beginSection method Inserts a section in a rich text item. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void beginSection(String title) throws NotesException public void beginSection(String title, RichTextStyle titlestyle) throws NotesException public void beginSection(String title, RichTextStyle titlestyle, ColorObject barcolor, boolean expand) throws NotesException
Parameters String title
The title of the section. RichTextStyle titlestyle
The style of the title of the section. See RichTextStyle. ColorObject barcolor
The color of the section bar. See ColorObject. boolean expand
v true expands the section v false (default) collapses the section
Usage By default the insertion occurs at the end of the item. You can change the insertion point with beginInsert and endInsert. You cannot create a section containing existing rich text. You must start the section with beginSection, append rich text, and end the section with endSection.
872
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference BeginSection method in LotusScript NotesRichTextItem class
Examples: beginSection method This agent begins a section at the end of a rich text item. The section contains the contents of a file. The section title is the name of the file. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Open file - proceed only if file can be opened String filename = "c:\\lotus\\notesv6\\notes.ini"; Stream stream = session.createStream(); if (stream.open(filename)) { DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextStyle rts = session.createRichTextStyle(); rts.setBold(RichTextStyle.YES); ColorObject color = session.createColorObject(); color.setNotesColor(RichTextStyle.COLOR_RED); rti.beginSection(filename, rts, color, true); rti.appendText(stream.readText()); rti.endSection(); doc.save(true, true); } else System.out.println("Cannot open " + filename); } catch(Exception e) { e.printStackTrace(); } } }
compact method Compacts a rich text item to use minimum space. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void compact() throws NotesException
Usage In rare cases, editing a rich text item may introduce extraneous space. This method eliminates any extraneous space. This method invalidates the positions of navigators and is best used at the end of editing.
Chapter 2. Java Classes A-Z
873
Language cross-reference Compact method in LotusScript NotesRichTextItem class
Examples: compact method This agent compacts the Body item of the current or first selected document after a search and replace. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = rti.createRange(); int n = 0; while (rtrange.findandReplace("foo", "bar") > 0) { n++; rti.update(); // Must update before looping } if (n > 0) rti.compact(); doc.save(true, true); } } catch(NotesException e) { System.out.println(e.id + e.text); e.printStackTrace(); } } }
createNavigator method Creates a RichTextNavigator object. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public RichTextNavigator createNavigator() throws NotesException
Return value RichTextNavigator
The object.
Language cross-reference CreateNavigator method in LotusScript NotesRichTextItem class
874
Programming Guide, Volume 3: Java/CORBA Classes
Examples: createNavigator method This agent displays the number of elements of each type in the Body item of the selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Open file - proceed only if file can be opened String filename = "c:\\lotus\\notesv6\\notes.ini"; Stream stream = session.createStream(); DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator(); System.out.println("Number of doc links = " + getCount(RichTextItem.RTELEM_TYPE_DOCLINK, rtnav)); System.out.println("Number of file attachments = " + getCount(RichTextItem.RTELEM_TYPE_FILEATTACHMENT, rtnav)); System.out.println("Number of OLE objects = " + getCount(RichTextItem.RTELEM_TYPE_OLE, rtnav)); System.out.println("Number of sections = " + getCount(RichTextItem.RTELEM_TYPE_SECTION, rtnav)); System.out.println("Number of tables = " + getCount(RichTextItem.RTELEM_TYPE_TABLE, rtnav)); System.out.println("Number of table cells = " + getCount(RichTextItem.RTELEM_TYPE_TABLECELL, rtnav)); System.out.println("Number of text paragraphs = " + getCount(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, rtnav)); System.out.println("Number of text runs = " + getCount(RichTextItem.RTELEM_TYPE_TEXTRUN, rtnav)); } catch(Exception e) { e.printStackTrace(); } } int getCount(int elementType, RichTextNavigator rtnav) { int n = 0; try { if (rtnav.findFirstElement(elementType)) { do { n++; } while (rtnav.findNextElement(elementType)); } } catch(Exception e) { e.printStackTrace(); } return n; } }
createRange method Creates a NotesRichTextRange object. Note: This method is new with Release 6.5.
Defined in RichTextItem Chapter 2. Java Classes A-Z
875
Syntax public RichTextRange createRange() throws NotesException
Return value RichTextRange
The object.
Language cross-reference CreateRange method in LotusScript NotesRichTextItem class
Examples: createRange method This agent creates a range to access the text paragraphs in an item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Open file - proceed only if file can be opened String filename = "c:\\lotus\\notesv6\\notes.ini"; Stream stream = session.createStream(); DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator(); if (rtnav.findFirstElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = rti.createRange(); do { rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } while (rtnav.findNextElement()); } else System.out.println("No text in Body."); } catch(Exception e) { e.printStackTrace(); } } }
embedObject method Given the name of a file or an application, either: v Attaches the file you specify to a rich text item. v Embeds an OLE/1 object in a rich text item. The OLE/1 object is created using the file you specify.
Defined in RichTextItem
Syntax public EmbeddedObject embedObject(int type, String class, String source, String name) throws NotesException
876
Programming Guide, Volume 3: Java/CORBA Classes
Parameters int type
One of the following: v EmbeddedObject.EMBED_ATTACHMENT v EmbeddedObject.EMBED_OBJECT (OLE/1 objects only) String class
Specify an empty string (″″). String source
Specify the name of the file to attach or embed. String name
String. Name by which you can reference the EmbeddedObject later. Can be null.
Return value EmbeddedObject
The newly attached file or embedded OLE/1 object.
Usage Files can be attached on any supported platform. Files can be embedded as OLE/1 objects on any supported platform (if the file is of a supported type, such as a Lotus® application data file).
Language cross-reference EmbedObject method in LotusScript NotesRichTextItem class EditInsertObject @command in formula language EditInsertFileAttachment @command in formula language
Examples: embedObject method This agent creates a rich text item and embeds an attachment. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Subject", "Attachment"); RichTextItem body = doc.createRichTextItem("Body"); body.appendText("Here is the attachment:"); body.addNewLine(2); body.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, "c:\\notes\\notes.ini", "notesini"); // Save the document doc.save(true, true); } catch(NotesException e) { System.out.println(e.id + " " + e.text);
Chapter 2. Java Classes A-Z
877
e.printStackTrace(); } } }
endInsert method Resets the insertion position to the end of the rich text item. Must be paired with beginInsert. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void endInsert() throws NotesException
Language cross-reference EndInsert method in LotusScript NotesRichTextItem class
Examples: endInsert method This agent prepends a paragraph and appends another paragraph to an item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Open file - proceed only if file can be opened String filename = "c:\\lotus\\notesv6\\notes.ini"; Stream stream = session.createStream(); DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator(); String firstPara = "First paragraph of text."; String lastPara = "Last paragraph of text."; if (rtnav.findFirstElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { // If Body has text, put first line and NL before existing text rti.beginInsert(rtnav); rti.appendText(firstPara); rti.addNewLine(1); rti.endInsert(); } else // If Body does not have text, simply add first line and NL rti.appendText(firstPara); // Put NL and last line at end of existing text rti.addNewLine(1); rti.appendText(lastPara); doc.save(true, true); } catch(Exception e) { e.printStackTrace();
878
Programming Guide, Volume 3: Java/CORBA Classes
} } }
endSection method Ends a section. Must be paired with beginSection. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void endSection() throws NotesException
Language cross-reference EndSection method in LotusScript NotesRichTextItem class
Examples: endSection method This agent creates a new document whose Body item is a section containing the Body item of the selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); Database db = agentContext.getCurrentDatabase(); Document newdoc = db.createDocument(); newdoc.appendItemValue("Form", "MainTopic"); newdoc.appendItemValue("Subject", "New document with attachment"); RichTextItem rti = newdoc.createRichTextItem("Body"); rti.beginSection(doc.getItemValueString("Subject")); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); rti.appendRTItem(body); rti.endSection(); newdoc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
getEmbeddedObject method Given the name of a file attachment, embedded object, or object link in a rich text item, returns the corresponding EmbeddedObject. Note: Embedded objects and object links are not supported for OS/2, UNIX, and the Macintosh. File attachments are. Chapter 2. Java Classes A-Z
879
Defined in RichTextItem
Syntax public EmbeddedObject getEmbeddedObject(String name) throws NotesException
Parameters String name
String. The name of the object to find. v To find a file attachment, specify its file name. Specify just the file name not the full path. v To find an embedded object or object link, use the name of the object or link as it appears in the InfoBox, or as designated in the embedObject method.
Return value EmbeddedObject
The object, if found. Otherwise, returns null.
Usage If you modify the object returned by getEmbeddedObject, the changes are saved but the rendering of the object in the Domino document is not updated until you manually activate the object.
Language cross-reference GetEmbeddedObject method in LotusScript NotesRichTextItem class
Examples: getEmbeddedObject method This agent examines the documents in a database to see which ones contain a specified embedded object. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); if (body.getEmbeddedObject("notes.ini") != null) System.out.println("Found notes.ini in " + doc.getItemValueString("Subject")); doc = dc.getNextDocument(); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } }
getFormattedText method Returns the contents of a rich text item as plain text.
880
Programming Guide, Volume 3: Java/CORBA Classes
Defined in RichTextItem
Syntax public String getFormattedText(boolean tabstrip, int linelen, int maxlen) throws NotesException
Parameters boolean tabstrip
If true, tabs are replaced by spaces in the resulting plain text. If false, tabs are retained. int linelen
Number of characters at which to wrap (carriage return and line feed) lines of text. Zero means 80 characters. Words without white space are not wrapped. int maxlen
Maximum number of characters to return. Set to 0 for the default.
Return value String
The contents of the rich text item, as plain text.
Usage This method strips out non-text data, such as bitmaps and file attachments.
Language cross-reference GetFormattedText method in LotusScript NotesRichTextItem class @Text function in formula language @Abstract function in formula language
Examples: getFormattedText method This agent gets the formatted text from a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); System.out.println(doc.getItemValueString("Subject")); System.out.println(body.getFormattedText(false, 0, 0) + "\n"); doc = dc.getNextDocument(); } } catch(NotesException e) { System.out.println(e.id + " " + e.text); e.printStackTrace(); } } } Chapter 2. Java Classes A-Z
881
getNotesFont method Returns an identifier for a font face in a document. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public int getNotesFont(String facename, boolean addonfail) throws NotesException
Parameters String facename
The name of the font face, which must be valid for the platform on which the agent is running. boolean addonfail
v true to assign an identifier for the font face if one is not already assigned in the current document v false (default) to return 0 if an identifier is not assigned for the font face in the current document
Return value int
The identifier associated with the specified font face, or 0.
Usage The identifier can be used to set Font in RichTextStyle. Identifiers assigned by getNotesFont are in the range 5 through 254.
Language cross-reference GetNotesFont method in LotusScript NotesRichTextItem class @FontList function in formula language
Examples: getNotesFont method This agent creates a document with a rich text item with three lines of text in different fonts. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.appendItemValue("Form", "MainTopic"); doc.appendItemValue("Subject", "Three fonts"); RichTextItem rti = doc.createRichTextItem("Body"); RichTextStyle style = session.createRichTextStyle(); style.setFont(rti.getNotesFont("Times", true)); rti.appendStyle(style); rti.appendText("This text is in Times"); rti.addNewLine(2); style.setFont(rti.getNotesFont("Courier", true));
882
Programming Guide, Volume 3: Java/CORBA Classes
rti.appendStyle(style); rti.appendText("This text is in Courier"); rti.addNewLine(2); style.setFont(rti.getNotesFont("Arial", true)); rti.appendStyle(style); rti.appendText("This text is in Arial"); doc.save(true, true); } catch(Exception e) { e.printStackTrace(); } } }
getUnformattedText method Returns the contents of a rich text item as plain text. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public String getUnformattedText() throws NotesException
Return value String
The contents of the rich text item, as plain text. Tabs and carriage returns are left intact.
Usage This method omits non-text data, such as bitmaps and file attachments. The text is not wrapped and tabs cannot be stripped as in getFormattedText.
Language cross-reference GetUnformattedText method in LotusScript NotesRichTextItem class @Text function in formula language @Abstract function in formula language
Examples: getUnformattedText method This agent gets the unformatted text of the Body item in the selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); String text = rti.getUnformattedText(); Chapter 2. Java Classes A-Z
883
System.out.println(text); } catch(Exception e) { e.printStackTrace(); } } }
update method Processes all pending operations on a rich text item. Note: This method is new with Release 6.5.
Defined in RichTextItem
Syntax public void update() throws NotesException
Usage Operations on a rich text item are queued for efficiency. The order and time of completion are not predictable. Use this method to ensure that processing is complete at a certain point.
Language cross-reference Update method in LotusScript NotesRichTextItem class
Examples: update method This agent updates processing after each of a series of find-and-replace operations in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = rti.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = rti.createRange(); int n = 0; while (rtrange.findandReplace("foo", "bar") > 0) { n++; rti.update(); // Must update before looping } if (n > 0) rti.compact(); doc.save(true, true); } } catch(NotesException e) { System.out.println(e.id + e.text);
884
Programming Guide, Volume 3: Java/CORBA Classes
e.printStackTrace(); } } }
RichTextNavigator class Represents a means of navigation in a rich text item. Note: This class is new with Release 6.5.
Containment Contained by: RichTextItem Contains: RichTextDocLink, RichTextSection, RichTextTable
Methods Clone findFirstElement findFirstString findLastElement findNextElement findNextString findNthElement getElement getFirstElement getLastElement getNextElement getNthElement recycle setCharOffset setPosition setPositionAtEnd
Creation To create a new RichTextNavigator object, use the createNavigator method in RichTextItem or the Navigator property in RichTextRange.
Chapter 2. Java Classes A-Z
885
Usage Navigation is within elements of the same type. You can find or get the first element of a type, the next element of a type, and the nth element of a type. You cannot find or get an element regardless of type. The navigator maintains a current position. Both find and get operations change the current position in the rich text item.
Examples: RichTextNavigator class This agent displays the number of elements of each type in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { RichTextNavigator rtnav = null; public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem rti = (RichTextItem)doc.getFirstItem("Body"); rtnav = rti.createNavigator(); System.out.println("Number of doc links = " + getCount(RichTextItem.RTELEM_TYPE_DOCLINK)); System.out.println("Number of file attachments = " + getCount(RichTextItem.RTELEM_TYPE_FILEATTACHMENT)); System.out.println("Number of OLE objects = " + getCount(RichTextItem.RTELEM_TYPE_OLE)); System.out.println("Number of sections = " + getCount(RichTextItem.RTELEM_TYPE_SECTION)); System.out.println("Number of tables = " + getCount(RichTextItem.RTELEM_TYPE_TABLE)); System.out.println("Number of table cells = " + getCount(RichTextItem.RTELEM_TYPE_TABLECELL)); System.out.println("Number of text paragraphs = " + getCount(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)); System.out.println("Number of text runs = " + getCount(RichTextItem.RTELEM_TYPE_TEXTRUN)); } catch(Exception e) { e.printStackTrace(); } } int getCount(int elementType) { int count = 0; try { if (rtnav.findFirstElement(elementType)) { do { count++; } while (rtnav.findNextElement()); } } catch(Exception e) { e.printStackTrace(); } return count; } }
886
Programming Guide, Volume 3: Java/CORBA Classes
Clone method Creates another RichTextNavigator object with the same position as the current one.
Defined in RichTextNavigator
Syntax public RichTextNavigator Clone() throws NotesException
Return value RichTextNavigator
The new navigator.
Language cross-reference Clone method in LotusScript NotesRichTextNavigator class
Examples: clone method This agent gets the first two paragraphs in the Body item of the current document. The agent finds the first paragraph with one navigator, clones it, and finds the second paragraph with the cloned navigator. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); // Set navigator to first paragraph in Body item RichTextNavigator rtnav1 = body.createNavigator(); if (rtnav1.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { // Set cloned navigator to second paragraph in Body item RichTextNavigator rtnav2 = rtnav1.Clone(); if (rtnav2.findNextElement()) { RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav1); System.out.println(rtrange.getTextParagraph()); rtrange.setBegin(rtnav2); System.out.println(rtrange.getTextParagraph()); } else System.out.println("No 2nd para in Body item"); } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
findFirstElement method Moves the current position to the first element of a specified type in a rich text item. Chapter 2. Java Classes A-Z
887
Defined in RichTextNavigator
Syntax public boolean findFirstElement(int type) throws NotesException
Parameters int type
The type of element: v RichTextItem.RTELEM_TYPE_DOCLINK v RichTextItem.RTELEM_TYPE_FILEATTACHMENT v RichTextItem.RTELEM_TYPE_OLE v RichTextItem.RTELEM_TYPE_SECTION v RichTextItem.RTELEM_TYPE_TABLE v RichTextItem.RTELEM_TYPE_TABLECELL v RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH v RichTextItem.RTELEM_TYPE_TEXTRUN
Return value boolean
v true if the element exists and the current position is reset v false if the element does not exist and the current position is not reset
Language cross-reference FindFirstElement method in LotusScript NotesRichTextNavigator class
Examples: findFirstElement method This agent finds the first text paragraph in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
888
Programming Guide, Volume 3: Java/CORBA Classes
findFirstString method Moves the current position to the beginning of the first occurrence of a string in a rich text item.
Defined in RichTextNavigator
Syntax public boolean findFirstString(String target) throws NotesException public boolean findFirstString(String target, int options) throws NotesException
Parameters String target
The search string. int options
Any of the following. Specify multiple options by combining them with addition or logical ORs. v RichTextRange.RT_FIND_ACCENTINSENSITIVE (default is accent sensitive) v RichTextRange.RT_FIND_CASEINSENSITIVE (default is case sensitive) v RichTextRange.RT_FIND_PITCHINSENSITIVE (default is pitch insensitive)
Return value boolean
v true if the string exists and the current position is reset v false if the string does not exist and the current position is not reset
Usage For purposes of identity, this method finds an element of type RTELEM_TYPE_TEXTSTRING. You can use the RichTextRange methods setBegin and setEnd on the navigator to delineate the string.
Language cross-reference FindFirstString method in LotusScript NotesRichTextNavigator class
Examples: findFirstString method This agent finds the first occurrence of a search string in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String searchString = "foo"; DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); RichTextRange rtrange = body.createRange(); if (rtnav.findFirstString(searchString, RichTextItem.RT_FIND_CASEINSENSITIVE)) { rtrange.setBegin(rtnav); Chapter 2. Java Classes A-Z
889
System.out.println(rtrange.getTextParagraph()); } else System.out.println("String not found"); } catch(Exception e) { e.printStackTrace(); } } }
findLastElement method Moves the current position to the last element of a specified type in a rich text item.
Defined in RichTextNavigator
Syntax public boolean findLastElement(int type) throws NotesException
Parameters int type
v v v v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE RichTextItem.RTELEM_TYPE_TABLECELL RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH RichTextItem.RTELEM_TYPE_TEXTRUN
Return value boolean
v true if the element exists and the current position is reset v false if the element does not exist and the current position is not reset
Language cross-reference FindLastElement method in LotusScript NotesRichTextNavigator class
Examples: findLastElement method This agent finds the last text paragraph in the Body item of the current or last selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findLastElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) {
890
Programming Guide, Volume 3: Java/CORBA Classes
RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
findNextElement method Moves the current position to the next element of a specified type in a rich text item after the current position.
Defined in RichTextNavigator
Syntax public boolean findNextElement() throws NotesException public boolean findNextElement(int type) throws NotesException public boolean findNextElement(int type, int occurrence) throws NotesException
Parameters int type
v v v v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE RichTextItem.RTELEM_TYPE_TABLECELL RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH RichTextItem.RTELEM_TYPE_TEXTRUN
Defaults to the type last specified by a find method. int occurrence
The position of the element, within elements of the specified type, relative to the current position; 1 means the next element, 2 means the element after the next element, and so on. Must be a positive integer; you cannot use this method to find preceding elements. Defaults to 1.
Return value boolean
v true if the element exists and the current pointer is reset v false if the element does not exist and the current pointer is not reset
Usage This method returns false if a current position does not exist, for example, if you use this method without first calling findFirstElement or findNthElement.
Chapter 2. Java Classes A-Z
891
Language cross-reference FindNextElement method in LotusScript NotesRichTextNavigator class
Examples: findNextElement method This agent displays each paragraph in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = body.createRange(); int count = 0; do { count++; rtrange.setBegin(rtnav); System.out.println(count + ") " + rtrange.getTextParagraph()); } while (rtnav.findNextElement()); } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
findNextString method Moves the current position to the beginning of the next occurrence of a string in a rich text item after the current position.
Defined in RichTextNavigator
Syntax public boolean findNextString(String target) throws NotesException public boolean findNextString(String target, int options) throws NotesException
Parameters String target
The search string. int options
Any of the following. Specify multiple options by combining them with addition or logical ORs. v RichTextItem.RT_FIND_ACCENTINSENSITIVE (default is accent sensitive) v RichTextItem.RT_FIND_CASEINSENSITIVE (default is case sensitive)
892
Programming Guide, Volume 3: Java/CORBA Classes
v RichTextItem.RT_FIND_PITCHINSENSITIVE (default is pitch insensitive)
Return value boolean
v true if the string exists after the current position and the current position is reset v false if the string does not exist after the current position and the current position is not reset
Usage For purposes of identity, this method finds an element of type RTELEM_TYPE_TEXTSTRING. You can use the RichTextRange methods setBegin and setEnd on the navigator to delineate the string.
Language cross-reference FindNextString method in LotusScript NotesRichTextNavigator class
Examples: findNextString method This agent finds the next search string in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String searchString = "foo"; DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); RichTextRange rtrange = body.createRange(); if (rtnav.findFirstString(searchString, RichTextItem.RT_FIND_CASEINSENSITIVE)) { do { rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } while (rtnav.findNextString(searchString, RichTextItem.RT_FIND_CASEINSENSITIVE)); } else System.out.println("String not found"); } catch(Exception e) { e.printStackTrace(); } } }
findNthElement method Moves the current position to the element at a specified position within elements of the same type.
Defined in RichTextNavigator
Syntax public boolean findNthElement(int type) throws NotesException public boolean findNthElement(int type, int occurrence) throws NotesException Chapter 2. Java Classes A-Z
893
Parameters int type
v RichTextItem.RTELEM_TYPE_DOCLINK v v v v v v v
RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE RichTextItem.RTELEM_TYPE_TABLECELL RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH RichTextItem.RTELEM_TYPE_TEXTRUN
int occurrence
The position of the element within elements of the same type in the rich text item. Must be a positive integer. Defaults to 1.
Return value boolean
v true if the element exists and the current pointer is reset v false if the element does not exist and the current pointer is not reset
Usage This method returns false if the specified position does not exist. You can use this method as a basis for future navigation, for example, with findNextElement if the occurrence is explicitly specified.
Language cross-reference FindNthElement method in LotusScript NotesRichTextNavigator class
Examples: findNthElement method This agent displays each paragraph in the Body item of the current or first selected document in reverse order. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { int count = 0; do { count++; } while (rtnav.findNextElement()); RichTextRange rtrange = body.createRange(); for (int i = count; i > 0; i--) { if (rtnav.findNthElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, i)) {
894
Programming Guide, Volume 3: Java/CORBA Classes
rtrange.setBegin(rtnav); System.out.println(i + ") " + rtrange.getTextParagraph()); } else System.out.println(i + ") ***Could not find element***"); } } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
getElement method Returns the element at the current position.
Defined in RichTextNavigator
Syntax public Base getElement() throws NotesException
Return value Base
EmbeddedObject, RichTextDocLink, RichTextSection, or RichTextTable. The requested element. You must cast the return value to the type required. Returns null if there is no element.
Usage This method does not change the current position. An exception occurs occurs if a valid position does not exist. You must precede this method with a valid find method. An exception occurs occurs if you try to get an element of type RTELEM_TYPE_TABLECELL, RTELEM_TYPE_TEXTPARAGRAPH, or RTELEM_TYPE_TEXTRUN. Access these elements through RichTextRange.
Language cross-reference GetElement method in LotusScript NotesRichTextNavigator class
Examples: getElement method This agent displays the file path of the target database of the first or only doclink in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Chapter 2. Java Classes A-Z
895
Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement(); DbDirectory dbdir = session.getDbDirectory(""); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(db.getFilePath()); else System.out.println("No local replica"); } else System.out.println("No doclinks in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
getFirstElement method Returns the first element of a specified type in a rich text item.
Defined in RichTextNavigator
Syntax public Base getFirstElement(int type) throws NotesException
Parameters int type
v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE
Return value Base
EmbeddedObject, RichTextDocLink, RichTextSection, or RichTextTable. The requested element. You must cast the return value to the type required. Returns null if there is no element.
Usage An exception occurs occurs if you try to get an element of type RTELEM_TYPE_TABLECELL, RTELEM_TYPE_TEXTPARAGRAPH, or RTELEM_TYPE_TEXTRUN. Access these elements through RichTextRange. This method moves the current position to the position of the retrieved element.
Language cross-reference GetFirstElement method in LotusScript NotesRichTextNavigator class
896
Programming Guide, Volume 3: Java/CORBA Classes
Examples: getFirstElement method This agent displays the file path of the target database of the first or only doclink in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); RichTextDoclink rtlink = (RichTextDoclink)rtnav.getFirstElement( RichTextItem.RTELEM_TYPE_DOCLINK); if (rtlink != null) { DbDirectory dbdir = session.getDbDirectory(""); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(db.getFilePath()); else System.out.println("No local replica"); } else System.out.println("No doclinks in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
getLastElement method Returns the last element of a specified type in a rich text item.
Defined in RichTextNavigator
Syntax public Base getLastElement(int type) throws NotesException
Parameters int type
v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE
Return value Base
Chapter 2. Java Classes A-Z
897
EmbeddedObject, RichTextDocLink, RichTextSection, or RichTextTable. The requested element. You must cast the return value to the type required. Returns null if there is no element.
Usage An exception occurs occurs if you try to get an element of type RTELEM_TYPE_TABLECELL, RTELEM_TYPE_TEXTPARAGRAPH, or RTELEM_TYPE_TEXTRUN. Access these elements through RichTextRange. This method moves the current position to the position of the retrieved element.
Language cross-reference GetLastElement method in LotusScript NotesRichTextNavigator class
Examples: getLastElement method This agent displays the file path of the target database of the last or only doclink in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); RichTextDoclink rtlink = (RichTextDoclink)rtnav.getLastElement( RichTextItem.RTELEM_TYPE_DOCLINK); if (rtlink != null) { DbDirectory dbdir = session.getDbDirectory(""); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(db.getFilePath()); else System.out.println("No local replica"); } else System.out.println("No doclinks in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
getNextElement method Returns the element of a specified type at a position in a rich text item after the current position.
Defined in RichTextNavigator
Syntax public Base getNextElement() throws NotesException
898
Programming Guide, Volume 3: Java/CORBA Classes
public Base getNextElement(int type) throws NotesException public Base getNextElement(int type, int occurrence) throws NotesException
Parameters int type
v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE
Defaults to the type last specified by a find method. int occurrence
The position of the element, within elements of the specified type, relative to the current position; 1 means the next element, 2 means the element after the next element, and so on. Must be a positive integer; you cannot use this method to find preceding elements. Defaults to 1.
Return value Base
EmbeddedObject, RichTextDocLink, RichTextSection, or RichTextTable. The requested element. You must cast the return value to the type required. Returns null if there is no element.
Usage An exception occurs occurs if you try to get an element of type RTELEM_TYPE_TABLECELL, RTELEM_TYPE_TEXTPARAGRAPH, or RTELEM_TYPE_TEXTRUN. Access these elements through RichTextRange. This method fails if a current position does not exist, for example, if you use this method without first calling findFirstElement, findNextElement, or findNthElement. This method moves the current position to the position of the retrieved element.
Language cross-reference GetNextElement method in LotusScript NotesRichTextNavigator class
Examples: getNextElement method This agent displays the file path of the target database of all the doclinks in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); RichTextDoclink rtlink = (RichTextDoclink)rtnav.getFirstElement( Chapter 2. Java Classes A-Z
899
RichTextItem.RTELEM_TYPE_DOCLINK); DbDirectory dbdir = session.getDbDirectory(""); while (rtlink != null) { Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(db.getFilePath()); else System.out.println("No local replica"); db.recycle(); rtlink = (RichTextDoclink)rtnav.getNextElement(); } } catch(Exception e) { e.printStackTrace(); } } }
getNthElement method Returns the element of a specified type at a specified position in a rich text item.
Defined in RichTextNavigator
Syntax public Base getNthElement(int type, int occurrence) throws NotesException
Parameters int type
v v v v v
RichTextItem.RTELEM_TYPE_DOCLINK RichTextItem.RTELEM_TYPE_FILEATTACHMENT RichTextItem.RTELEM_TYPE_OLE RichTextItem.RTELEM_TYPE_SECTION RichTextItem.RTELEM_TYPE_TABLE
int occurrence
The position of the element within elements of the same type in the rich text item.
Return value element EmbeddedObject, RichTextDocLink, RichTextSection, or RichTextTable. The requested element. You must cast the return value to the type required. Returns null if there is no element.
Usage An exception occurs occurs if you try to get an element of type RTELEM_TYPE_TABLECELL, RTELEM_TYPE_TEXTPARAGRAPH, or RTELEM_TYPE_TEXTRUN. Access these elements through RichTextRange. This method moves the current position to the position of the retrieved element.
Language cross-reference GetNthElement method in LotusScript NotesRichTextNavigator class
900
Programming Guide, Volume 3: Java/CORBA Classes
Examples: getNthElement method This agent displays in reverse order the file path of the target database of all the doclinks in the Body item of the current or first selected document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) { int count = 0; do { count++; } while (rtnav.findNextElement()); for (int i = count; i > 0; i--) { RichTextDoclink rtlink = (RichTextDoclink)rtnav.getNthElement( RichTextItem.RTELEM_TYPE_DOCLINK, i); DbDirectory dbdir = session.getDbDirectory(""); Database db = dbdir.openDatabaseByReplicaID( rtlink.getDBReplicaID()); if (db.isOpen()) System.out.println(i + ") " + db.getFilePath()); else System.out.println("No local replica"); db.recycle(); } } else System.out.println("No doclinks in Body"); /* if (rtlink != null) { rtlink = (RichTextDoclink)rtnav.getNextElement(); } */ } catch(Exception e) { e.printStackTrace(); } } }
setCharOffset method Sets the current position to an offset from the current position.
Defined in RichTextNavigator
Syntax public void setCharOffset(int offset) throws NotesException
Chapter 2. Java Classes A-Z
901
Parameters int offset
The offset which must be positive (you cannot back up).
Language cross-reference SetCharOffset method in LotusScript NotesRichTextNavigator class
Examples: setCharOffset method This agent gets the first text paragraph starting at the ninth character. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { rtnav.setCharOffset(8); RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } else System.out.println("No text in Body item"); } catch(Exception e) { e.printStackTrace(); } } }
setPosition method Sets the current position to a specified element in a rich text item.
Defined in RichTextNavigator
Syntax public void setPosition(Base element) throws NotesException
Parameters Base element
EmbeddedObject, RichTextDocLink, RichTextNavigator, RichTextRange, or RichTextTable. The element.
Language cross-reference SetPosition method in LotusScript NotesRichTextNavigator class
Examples: setPosition method Not available.
902
Programming Guide, Volume 3: Java/CORBA Classes
setPositionAtEnd method Sets the current position at the end of a specified element in a rich text item.
Defined in RichTextNavigator
Syntax public void setPositionAtEnd(Base element) throws NotesException
Parameters Base element
EmbeddedObject, RichTextDocLink, RichTextNavigator, RichTextRange, or RichTextTable. The element.
Language cross-reference SetPositionAtEnd method in LotusScript NotesRichTextNavigator class
Examples: setPositionAtEnd method Not available.
RichTextParagraphStyle class Represents rich text paragraph attributes.
Syntax public class RichTextParagraphStyle extends Base
Containment Contained by: Session Contains: RichTextTab
Properties Alignment through getAlignment and setAlignment FirstLineLeftMargin through getFirstLineLeftMargin and setFirstLineLeftMargin InterLineSpacing through getInterLineSpacing and setInterLineSpacing LeftMargin through getLeftMargin and setLeftMargin Pagination through getPagination and setPagination RightMargin through getRightMargin and setRightMargin SpacingAbove through getSpacingAbove and setSpacingAbove SpacingBelow through getSpacingBelow and setSpacingBelow Tabs through getTabs
Chapter 2. Java Classes A-Z
903
Methods clearAllTabs recycle setTab setTabs
Creation and access To create a new RichTextParagraphStyle object, use createRichTextParagraphStyle in Session. Use a RichTextParagraphStyle object with appendParagraphStyle of RichTextItem. Text that follows a rich text paragraph style assumes the attributes of the rich text paragraph style.
Examples: RichTextParagraphStyle class This agent defines two rich text paragraph styles and applies each. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); Item subject = doc.replaceItemValue ("Subject", "Rich text paragraph style"); RichTextItem body = doc.createRichTextItem("Body"); RichTextParagraphStyle h = headerStyle(session); RichTextParagraphStyle b = bodyStyle(session); body.appendParagraphStyle(h); body.appendText("Header"); body.appendParagraphStyle(b); for (int i=0; i 0) { System.out.println(count + " Foos replaced by Bars"); doc.save(true, true); } else { count = rtrange.findandReplace(bar, foo, RichTextItem.RT_FIND_CASEINSENSITIVE + RichTextItem.RT_REPL_ALL + RichTextItem.RT_REPL_PRESERVECASE); if (count > 0) { System.out.println(count + " Bars replaced by Foos"); doc.save(true, true); } else System.out.println("No Foos or Bars in Body"); } } else System.out.println("Body does not contain any text"); } catch(Exception e) { e.printStackTrace(); } } }
remove method Removes everything in the range, including supported elements.
Defined in RichTextRange
Syntax public void remove() throws NotesException
Usage If the end of the range is an object, that object is not removed.
Language cross-reference Remove method in LotusScript NotesRichTextRange class
Examples: remove method This agent removes the content of every cell in the first table of the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TABLE)) { // Set up range and navigator for table RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); Chapter 2. Java Classes A-Z
923
rtrange.setEnd(rtnav); RichTextNavigator rtnav2 = rtrange.getNavigator(); // Find cells in table RichTextRange rtrange2 = body.createRange(); rtnav2.findFirstElement(RichTextItem.RTELEM_TYPE_TABLECELL); do { rtrange2.setBegin(rtnav2); rtrange2.setEnd(rtnav2); rtrange2.remove(); } while (rtnav2.findNextElement()); doc.save(true, true); } else System.out.println("Body does not contain any tables"); } catch(Exception e) { e.printStackTrace(); } } }
reset method Resets the range to its default values.
Defined in RichTextRange
Syntax public void reset(boolean begin, boolean end) throws NotesException
Parameters boolean begin
v true to reset the beginning of the range to the default v false to leave it as is boolean end
v true to reset the end of the range to the default v false to leave it as is
Language cross-reference Reset method in LotusScript NotesRichTextRange class
Examples: reset method Not available.
setBegin method Defines the beginning of a range.
Defined in RichTextRange
Syntax public void setBegin(Base element) throws NotesException
Parameters Base element
924
Programming Guide, Volume 3: Java/CORBA Classes
RichTextDocLink, RichTextNavigator, RichTextRange, or RichTextTable. The element that begins the range. For RichTextNavigator, this is the current position. For other elements, this is the position of the element.
Language cross-reference SetBegin method in LotusScript NotesRichTextRange class
Examples: setBegin method This agent gets the text of the second paragraph. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findNthElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, 2)) { RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); System.out.println(rtrange.getTextParagraph()); } else System.out.println("Body does not have 2nd paragraph"); } catch(Exception e) { e.printStackTrace(); } } }
setEnd method Defines the end of a range.
Defined in RichTextRange
Syntax public void setEnd(Base element) throws NotesException
Parameters element RichTextDocLink, RichTextNavigator, RichTextRange, or RichTextTable. The element that ends the range. For RichTextNavigator, this is the current position. For other elements, this is the position of the element.
Usage Calling this method after calling setBegin with the same element defines a range containing that element.
Language cross-reference SetEnd method in LotusScript NotesRichTextRange class
Chapter 2. Java Classes A-Z
925
Examples: setEnd method This agents gets a requested range of paragraphs from the Body item of the current document. The code uses setBegin to mark the first paragraph in the range, and setPositionAtEnd followed by setEnd to mark and include the last paragraph in the range. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH)) { RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); if (rtnav.findNthElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH, 2)) { rtnav.setPositionAtEnd(rtnav); rtrange.setEnd(rtnav); RichTextNavigator rtnav2 = rtrange.getNavigator(); RichTextRange rtrange2 = body.createRange(); rtnav2.findFirstElement( RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH); do { rtrange2.setBegin(rtnav2); System.out.println(rtrange2.getTextParagraph()); } while (rtnav2.findNextElement()); } else System.out.println("Body does not have 2nd paragraph"); } else System.out.println("No text in Body"); } catch(Exception e) { e.printStackTrace(); } } }
setStyle method Sets a style for all text in the range.
Defined in RichTextRange
Syntax public void setStyle(RichTextStyle style) throws NotesException
Parameters RichTextStyle style
The style to set.
926
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference SetStyle method in LotusScript NotesRichTextRange class
Examples: setStyle method This agent changes to blue the content of the first table in the current document. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_TABLE)) { RichTextRange rtrange = body.createRange(); rtrange.setBegin(rtnav); rtrange.setEnd(rtnav); RichTextStyle rtstyle = session.createRichTextStyle(); rtstyle.setColor(RichTextStyle.COLOR_BLUE); rtrange.setStyle(rtstyle); doc.save(true, true); } else System.out.println("Body does not contain any tables"); } catch(Exception e) { e.printStackTrace(); } } }
RichTextSection class Represents a collapsible section in a rich text item. Note: This class is new with Release 6.5.
Containment Contained by: RichTextNavigator Contains: ColorObject, RichTextStyle
Properties BarColor through getBarColor IsExpanded through isExpanded and setExpanded Title through getTitle and setTitle TitleStyle through getTitleStyle
Chapter 2. Java Classes A-Z
927
Methods recycle remove setBarColor setTitleStyle
Access To access a RichTextSection object, use the RichTextNavigator methods in conjunction with the type RTELEM_TYPE_SECTION.
Examples: RichTextSection class This agent gets each section in a rich text item and displays its properties. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); System.out.println( "Title = " + rtsection.getTitle()); System.out.println("\tBar color = " + rtsection.getBarColor().getNotesColor()); System.out.println( "\tIs expanded = " + rtsection.isExpanded()); System.out.println( "\tTitle style font = " + rtsection.getTitleStyle().getFont()); } while (rtnav.findNextElement()); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
BarColor property Read-only. The color of the section bar.
Defined in RichTextSection
Data type ColorObject
928
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public ColorObject getBarColor() throws NotesException
Usage Use setBarColor to set the bar color.
Language cross-reference BarColor property in LotusScript NotesRichTextSection class
Examples: BarColor property This agent displays the bar color of each section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); System.out.println( "Title = " + rtsection.getTitle()); System.out.println("\tBar color = " + getColorString(rtsection.getBarColor())); } while (rtnav.findNextElement()); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } String getColorString(ColorObject color) { String fc = null; try { switch (color.getNotesColor()) { case RichTextStyle.COLOR_BLACK : fc = "black"; break; case RichTextStyle.COLOR_WHITE : fc = "white"; break; case RichTextStyle.COLOR_RED : fc = "red"; break; case RichTextStyle.COLOR_GREEN : fc = "green"; break; case RichTextStyle.COLOR_BLUE : fc = "blue"; break; case RichTextStyle.COLOR_MAGENTA : fc = "magenta"; break; case RichTextStyle.COLOR_YELLOW : fc = "yellow"; break; case RichTextStyle.COLOR_CYAN : fc = "cyan"; break; case RichTextStyle.COLOR_DARK_RED : Chapter 2. Java Classes A-Z
929
fc = "dark red"; break; case RichTextStyle.COLOR_DARK_GREEN : fc = "dark green"; break; case RichTextStyle.COLOR_DARK_BLUE : fc = "dark blue"; break; case RichTextStyle.COLOR_DARK_MAGENTA : fc = "dark magenta"; break; case RichTextStyle.COLOR_DARK_YELLOW : fc = "dark yellow"; break; case RichTextStyle.COLOR_DARK_CYAN : fc = "dark cyan"; break; case RichTextStyle.COLOR_GRAY : fc = "gray"; break; case RichTextStyle.COLOR_LIGHT_GRAY : fc = "light gray"; break; default : Integer i = new Integer(color.getNotesColor()); fc = i.toString(); } } catch(Exception e) { e.printStackTrace(); } return(fc); } }
IsExpanded property Read-write. Indicates whether the section is expanded.
Defined in RichTextSection
Data type boolean
Syntax public boolean isExpanded() throws NotesException public void setExpanded(boolean flag) throws NotesException
Legal values v true if the section is expanded v false if the section is collapsed Note: For Release 6, IsExpanded is reliable only if ″Don’t auto expand or collapse″ is set for the environment in which the code is running (Previewed, Opened for reading, Opened for editing, or Printed). This is the default setting. IsExpanded is not reliable where ″Auto-expand section″ or ″Auto-collapse section″ is set.
Language cross-reference IsExpanded property in LotusScript NotesRichTextSection class
Examples: IsExpanded property This agent collapses all sections in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() {
930
Programming Guide, Volume 3: Java/CORBA Classes
try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); rtsection.setExpanded(false); } while (rtnav.findNextElement()); doc.save(true, true); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
Title property Read-write. The title of the section.
Defined in RichTextSection
Data type String
Syntax public String getTitle() throws NotesException public void setTitle(String title) throws NotesException
Language cross-reference Title property in LotusScript NotesRichTextSection class
Examples: Title property 1. This agent displays the title of each section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { System.out.println(doc.getItemValueString("Subject")); Chapter 2. Java Classes A-Z
931
do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); System.out.println("\t" + rtsection.getTitle()); } while (rtnav.findNextElement()); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent sets the title of each section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { int count = 0; do { count++; RichTextSection rtsection = (RichTextSection)rtnav.getElement(); rtsection.setTitle("Section " + count); } while (rtnav.findNextElement()); doc.save(true, true); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
TitleStyle property Read-only. The style of the section title.
Defined in RichTextSection
Data type RichTextStyle
Syntax public RichTextStyle getTitleStyle() throws NotesException
Usage Use setTitleStyle to set the title style.
932
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference TitleStyle property in LotusScript NotesRichTextSection class
Examples: TitleStyle property This agent displays the font size of the title of each section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); RichTextStyle rtstyle = rtsection.getTitleStyle(); System.out.println( rtsection.getTitle() + "\n\tFont size = " + rtstyle.getFontSize()); } while (rtnav.findNextElement()); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
remove method Removes the section and everything in the section.
Defined in RichTextSection
Syntax public void remove() throws NotesException
Language cross-reference Remove method in LotusScript NotesRichTextSection class
Examples: remove method This agent removes all sections in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Chapter 2. Java Classes A-Z
933
// (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); rtsection.remove(); } while (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)); doc.save(true, true); } else System.out.println("Body does not contain any sections"); } catch(Exception e) { e.printStackTrace(); } } }
setBarColor method Sets the color of a section bar.
Defined in RichTextSection
Syntax public void setBarColor(ColorObject color) throws NotesException
Parameters ColorObject color
The new bar color.
Usage See BarColor to get the section bar color.
Language cross-reference SetBarColor method in LotusScript NotesRichTextSection class
Examples: setBarColor method This agent sets the bar color of each section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { do {
934
Programming Guide, Volume 3: Java/CORBA Classes
RichTextSection rtsection = (RichTextSection)rtnav.getElement(); ColorObject color = session.createColorObject(); color.setNotesColor(RichTextStyle.COLOR_RED); rtsection.setBarColor(color); } while (rtnav.findNextElement()); doc.save(true, true); } else System.out.println("No sections in Body"); } catch(Exception e) { e.printStackTrace(); } } }
setTitleStyle method Sets the style of a section title.
Defined in RichTextSection
Syntax public void setTitleStyle(RichTextStyle style) throws NotesException
Parameters RichTextStyle style
The style.
Usage See TitleStyle to get the section title style.
Language cross-reference SetTitleStyle method in LotusScript NotesRichTextSection class
Examples: setTitleStyle method This agent sets the title style of every section in a rich text item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); RichTextNavigator rtnav = body.createNavigator(); if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_SECTION)) { RichTextStyle rtstyle = session.createRichTextStyle(); rtstyle.setFontSize(12); do { RichTextSection rtsection = (RichTextSection)rtnav.getElement(); rtsection.setTitleStyle(rtstyle); } while (rtnav.findNextElement()); doc.save(true, true); Chapter 2. Java Classes A-Z
935
} else System.out.println("Body does not contain any sections"); } catch(Exception e) { e.printStackTrace(); } } }
RichTextStyle class Represents rich-text attributes.
Syntax public class RichTextStyle extends Base
Containment Contained by: Session and RichTextItem
Properties Bold through getBold and setBold Color through getColor and setColor Effects through getEffects and setEffects Font through getFont and setFont FontSize through getFontSize and setFontSize IsDefault through isDefault Italic through getItalic and setItalic Parent through getParent PassThruHTML through getPassThruHTML and setPassThruHTML StrikeThrough through getStrikeThrough and setStrikeThrough Underline through getUnderline and setUnderline
Methods recycle
Creation and access To create a new RichTextStyle object, use createRichTextStyle in Session. Use a RichTextStyle object with appendStyle of RichTextItem. Text that follows a rich-text style assumes the attributes of the rich-text style. At creation, all the RichTextStyle properties are STYLE_NO_CHANGE.
936
Programming Guide, Volume 3: Java/CORBA Classes
Examples: RichTextStyle class, and Bold, Color, Effects, Font, FontSize, Italic, Parent, StrikeThrough, and Underline properties This agent writes a text using various styles. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); Item subject = doc.replaceItemValue("Subject", "Rich text tab"); RichTextItem body = doc.createRichTextItem("Body"); // Create and define styles RichTextStyle header = session.createRichTextStyle(); header.setBold(RichTextStyle.YES); header.setColor(RichTextStyle.COLOR_DARK_BLUE); header.setEffects(RichTextStyle.EFFECTS_SHADOW); header.setFont(RichTextStyle.FONT_ROMAN); header.setFontSize(14); RichTextStyle byline = session.createRichTextStyle(); byline.setBold(RichTextStyle.NO); byline.setColor(RichTextStyle.COLOR_BLACK); byline.setEffects(RichTextStyle.EFFECTS_NONE); byline.setItalic(RichTextStyle.YES); byline.setFontSize(10); RichTextStyle normal = session.createRichTextStyle(); normal.setItalic(RichTextStyle.NO); normal.setUnderline(RichTextStyle.NO); normal.setStrikeThrough(RichTextStyle.NO); RichTextStyle underline = session.createRichTextStyle(); underline.setUnderline(RichTextStyle.YES); RichTextStyle strike = session.createRichTextStyle(); strike.setStrikeThrough(RichTextStyle.YES); // Generate Body item body.appendStyle(header); body.appendText("Header"); body.addNewLine(); body.appendStyle(byline); body.appendText("by " + byline.getParent().getCommonUserName()); body.addNewLine(2); body.appendStyle(normal); for (int i=0; i 1) { Name secondary = (Name)ulist.lastElement(); System.out.println("\t" + secondary.getCommon() + " (alternate)"); } else { System.out.println("\tNo alternate name"); } } catch(Exception e) { e.printStackTrace(); } } }
UserNameObject property Read-only. The name, in the form of a Name object, of the user or server that created the session.
Defined in Session
Data type Name
Syntax public Name getUserNameObject() throws NotesException
Language cross-reference UserNameObject property in LotusScript NotesSession class
Examples: UserNameObject property This agent gets a Name object for the current user and prints the common user name. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Name no = session.getUserNameObject(); String u = no.getCommon(); System.out.println("Common user name = " + u); } catch(Exception e) { e.printStackTrace(); } } }
createAdministrationProcess method Creates a new AdministrationProcess object. Note: This method is new with Release 6.5.
Chapter 2. Java Classes A-Z
969
Defined in Session
Syntax public AdministrationProcess createAdministrationProcess(String server) throws NotesException
Parameters String server
The name of the server containing the Administration Requests database (ADMIN4.NSF). An empty string means the local computer. The server must contain a replica of the Certification Log. You must have access privileges to the Domino Directory on the server for Administration Process requests that use it.
Return value AdministrationProcess
The newly created Administration Process object.
Usage For more information, see the AdministrationProcess class.
Language cross-reference CreateAdministrationProcess method in LotusScript NotesSession class
createColorObject method Creates a new ColorObject object. Note: This method is new with Release 6.5.
Defined in Session
Syntax public ColorObject createColorObject() throws NotesException
Return value ColorObject
The newly created ColorObject object.
Usage For more information, see the ColorObject class.
Language cross-reference CreateColorObject method in LotusScript NotesSession class
createDateRange method Creates a new DateRange object.
Defined in Session
970
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public DateRange createDateRange() throws NotesException public DateRange createDateRange(DateTime startt, DateTime endt) throws NotesException public DateRange createDateRange(java.util.Date startt, java.util.Date endt) throws NotesException
Parameters DateTime startt
The starting date-time of the range. Cannot be null. DateTime endt
The ending date-time of the range. Cannot be null. Date startt
The starting date-time of the range using a java.util.Date object. Date endt
The ending date-time of the range using a java.util.Date object.
Return value DateRange
The newly created DateRange object.
Usage See the DateRange class for descriptions and examples.
Language cross-reference CreateDateRange method in LotusScript NotesSession class
createDateTime method Creates a DateTime object that represents a specified date and time.
Defined in Session
Syntax public DateTime createDateTime(String date) throws NotesException public DateTime createDateTime(java.util.Date date) throws NotesException public DateTime createDateTime(java.util.Calendar date) throws NotesException
Note: This signature is new with Release 6.
Parameters String date
The date and time you want the object to represent. See DateTime for formats. An invalid date-time or empty string results in an ″Invalid date″ exception. java.util.Date date
Chapter 2. Java Classes A-Z
971
The date and time you want the object to represent using a java.util.Date object. java.util.Calendar date
The date, time, and time zone you want the object to represent using a java.util.Calendar object.
Return value DateTime
The newly created date-time.
Usage See DateTime for descriptions and examples.
Language cross-reference CreateDateTime method in LotusScript NotesSession class
createDxlExporter method Creates a DxlExporter object. Note: This method is new with Release 6.5.
Defined in Session
Syntax public DxlExporter createDxlExporter() throws NotesException
Return value DxlExporter
The newly created DxlExporter object.
Usage For more information, see the DxlExporter class.
Language cross-reference CreateDXLExporter method in LotusScript NotesSession class
createDxlImporter method Creates a DxlImporter object. Note: This method is new with Release 6.5.
Defined in Session
Syntax public DxlImporter createDxlImporter() throws NotesException
Return value DxlImporter
The newly created DxlImporter object.
972
Programming Guide, Volume 3: Java/CORBA Classes
Usage For more information, see the DxlImporter class.
Language cross-reference CreateDXLImporter method in LotusScript NotesSession class
createLog method Creates a new Log object with the name you specify.
Defined in Session
Syntax public Log createLog(String name) throws NotesException
Parameters String name
A name that identifies the log.
Return value Log
The newly created log.
Usage See the Log class for descriptions and examples.
Language cross-reference CreateLog method in LotusScript NotesSession class
createName method Creates a new Name object.
Defined in Session
Syntax public Name createName(String name) throws NotesException public Name createName(String name, String lang) throws NotesException
Parameters String name
A user or server name. If the name is not in the format of an abbreviated or canonical hierarchical name, it is treated as a flat name. String lang
A language associated with the user name. For primary user names, the language should be null. For alternate user names, a language can be specified. See the Language property in Name. See @Locale in the formula language for a list of language codes.
Chapter 2. Java Classes A-Z
973
Return value Name
The new Name object.
Usage See the Name class for descriptions and examples.
Language cross-reference CreateName method in LotusScript NotesSession class
createNewsletter method Given a DocumentCollection containing the documents you want, creates a new Newsletter.
Defined in Session
Syntax public Newsletter createNewsletter(DocumentCollection collection) throws NotesException
Parameters DocumentCollection collection
The documents that you want included in the newsletter. Can be null.
Return value Newsletter
The newly created newsletter.
Usage See the Newsletter for descriptions and examples.
Language cross-reference CreateNewsletter method in LotusScript NotesSession class
createRegistration method Creates a new Registration object. Note: This property is illegal for remote (IIOP) calls.
Defined in Session
Syntax public Registration createRegistration() throws NotesException
Return value Registration
The newly created Registration object.
Language cross-reference CreateRegistration method in LotusScript NotesSession class
974
Programming Guide, Volume 3: Java/CORBA Classes
createRichTextParagraphStyle method Creates a new RichTextParagraphStyle object.
Defined in Session
Syntax public RichTextParagraphStyle createRichTextParagraphStyle() throws NotesException
Return value RichTextParagraphStyle
The newly created RichTextParagraphStyle object.
Usage See the RichTextParagraphStyle class for descriptions and examples.
Language cross-reference CreateRichTextParagraphStyle method in LotusScript NotesSession class
createRichTextStyle method Creates a new RichTextStyle object.
Defined in Session
Syntax public RichTextStyle createRichTextStyle() throws NotesException
Return value RichTextStyle
The newly created RichTextStyle object.
Usage See the RichTextStyle class for descriptions and examples.
Language cross-reference CreateRichTextStyle method in LotusScript NotesSession class TextFont @command in formula language
createStream method Creates a new Stream object. Note: This method is new with Release 6.
Defined in Session
Syntax public Stream createStream() throws NotesException
Chapter 2. Java Classes A-Z
975
Return value Stream
The newly created Stream object.
Usage See the Stream class for descriptions and examples.
Language cross-reference CreateStream method in LotusScript NotesSession class
evaluate method Evaluates a Domino formula.
Defined in Session
Syntax public java.util.Vector evaluate(String formula) throws NotesException public java.util.Vector evaluate(String formula, Document doc) throws NotesException
Parameters String formula
The formula. Document doc
The formula context. Cannot be null.
Return value java.util.Vector
The result of the evaluation. A scalar result is returned in firstElement.
Usage If the formula contains the name of a field, you must use the 2-parameter method. The formula takes the field from the document specified as parameter 2. @Functions that affect the user interface do not work in evaluate. These include: @Command, @DbManager, @DbName, @DbTitle, @DDEExecute, @DDEInitiate, @DDEPoke, @DDETerminate, @DialogBox, @PickList, @PostedCommand, @Prompt, and @ViewTitle. You cannot change a document with evaluate; you can only get a result. To change a document, write the result to the document with a method such as Document.replaceItemValue.
Language cross-reference Evaluate method in LotusScript NotesSession class
Examples: evaluate method 1. This agent applies the @ProperCase @function to the Subject field in every document of the current database. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase {
976
Programming Guide, Volume 3: Java/CORBA Classes
public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); Document doc = dc.getFirstDocument(); while (doc != null) { Vector v = session.evaluate("@ProperCase(Subject)", doc); doc.replaceItemValue("Subject", v.firstElement()); doc.save(true, false); doc = dc.getNextDocument(); } } catch(Exception e) { e.printStackTrace(); } } }
2. This agent applies the @Sum @function to the Amount field (which allows multiple values) in each document. import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = agentContext.getCurrentDatabase(); DocumentCollection dc = db.getAllDocuments(); System.out.println("Count = " + dc.getCount()); Document doc = dc.getFirstDocument(); while (doc != null) { if (doc.getItemValueInteger("Amount") != 0) { Vector v = session.evaluate("@Sum(Amount)", doc); System.out.println(v.firstElement() + " " + doc.getItemValueString("Subject")); } doc = dc.getNextDocument(); } } catch(NotesException ne) { System.out.println(ne.id + " " + ne.text); } catch(Exception e) { e.printStackTrace(); } } }
freeTimeSearch method Searches for free-time slots in the calendar.
Defined in Session
Syntax public java.util.Vector freeTimeSearch(DateRange window, int duration, Object names, boolean firstfit) throws NotesException
Parameters DateRange window
Starting and ending times within which to search for a match. Cannot be null. Chapter 2. Java Classes A-Z
977
int duration
The length in minutes of the free-time interval you want to schedule. Object names
String or vector of strings. The name or names of the people or groups whose free time you want to schedule. Cannot be null. boolean firstfit
Specify true if you just want the first matching date range, false if you want all matching times.
Return value java.util.Vector
Each member of the vector is a DateRange object. The vector is null if there are no matches.
Language cross-reference FreeTimeSearch method in LotusScript NotesSession class
Examples: freeTimeSearch method This application finds the first 60-minute time slot available for three people. import java.util.*; import lotus.notes.*; class free extends NotesThread { public static void main(String argv[]) { free t = new free(); t.start(); } public void runNotes() { try { Session s = Session.newInstance(); DateRange window = s.createDateRange(); window.setStartDateTime(s.createDateTime("Today")); window.setEndDateTime(s.createDateTime("Tomorrow")); Vector names = new Vector(3); names.addElement("Roberta Person"); names.addElement("Kerry Ordway"); names.addElement("Marybeth May"); Vector freetime = s.freeTimeSearch (window, 60, names, true); if (freetime == null) System.out.println("No time slots"); else for (int i=0; i 0) { Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", inPath); MIMEEntity mime = doc.createMIMEEntity(); if (mime != null) { mime.setContentFromText(inStream, "text/plain; charset=" + charset, MIMEEntity.ENC_NONE); mime.encodeContent(MIMEEntity.ENC_QUOTED_PRINTABLE); System.out.println("Charset = " + mime.getCharset()); } inStream.close(); doc.save(true, true); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); session.setConvertMIME(true); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
IsEOS property Read-only. Indicates whether the selected position is at the end of the stream.
Defined in Stream
Data type boolean
Syntax public boolean isEOS() throws NotesException
Legal values v true indicates end of stream v false indicates not end of stream
Usage This property is true in the following cases: v The stream is empty v An open occurs on an empty stream v A truncate occurs on the stream v A write or writeText occurs on the stream
998
Programming Guide, Volume 3: Java/CORBA Classes
Language cross-reference IsEOS property in LotusScript NotesStream class
Examples: IsEOS property This agent reads and processes blocks of bytes until end of stream occurs. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\domobj.tlb"; String outPath = "c:\\StreamFiles\\domobjcopy.tlb"; // Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "binary")) { if (inStream.getBytes() > 0) { // Get the output file Stream outStream = session.createStream(); if (outStream.open(outPath, "binary")) { if (outStream.getBytes() == 0) { // Transfer input file to output file do { byte[] buffer = inStream.read(32767); outStream.write(buffer); } while (!inStream.isEOS()); inStream.close(); outStream.close(); } else System.out.println("Output file exists and has content"); } else System.out.println("Output file open failed"); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
IsReadOnly property Indicates that the stream is associated with a read-only file.
Defined in Stream
Data type boolean Chapter 2. Java Classes A-Z
999
Syntax public boolean isReadOnly() throws NotesException
Legal values v true indicates read-only v false indicates not read-only
Usage This property is true if the stream is opened to a read-only file. Otherwise it is false. Write operations on a read-only file throw an exception.
Language cross-reference IsReadOnly property in LotusScript NotesStream class
Examples: IsReadOnly property This agent appends text to a file reporting an error if the file is read-only. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get the input file DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); String outPath = "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt"; Stream outStream = session.createStream(); if (outStream.open(outPath, "ASCII")) { if (!outStream.isReadOnly()) { outStream.writeText(doc.getItemValueString("Body")); } outStream.close(); else System.out.println("Output file is read-only"); } else System.out.println("Output file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
Position property Read-write. Offset from the beginning of the stream in bytes.
Defined in Stream
1000
Programming Guide, Volume 3: Java/CORBA Classes
Data type int
Syntax public int getPosition() throws NotesException public void setPosition(int position) throws NotesException
Usage A value of 0 means the beginning of the stream. Setting this property to a negative value or a value greater than the size of the stream sets the position at end of stream. write and writeText update this property to end of stream. Setting this property has no effect on these methods. This property affects Read and ReadText. You should exercise care setting a value other than 0. No special support exists for multi-byte characters.
Language cross-reference Position property in LotusScript NotesStream class
Examples: Position property This agent writes the content of the Body item of the selected document to a stream, then positions the stream to the beginning (0) before reading from it. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); // Create stream and write text of Body item to it Stream stream = session.createStream(); stream.writeText(doc.getItemValueString("Body")); // Reset position to beginning and read text stream.setPosition(0); System.out.println(stream.readText()); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
close method Releases the file, if any, associated with the stream.
Chapter 2. Java Classes A-Z
1001
Defined in Stream
Syntax public void close() throws NotesException
Usage It is recommended that you close streams explicitly using this method, although they close implicitly at the end of their scope. Closing a stream with zero bytes deletes the associated file.
Language cross-reference Close method in LotusScript NotesStream class
Examples: close method This example gets information on the normal files in a directory by opening each file as a stream. The agent reuses the same NotesStream object by opening and closing it for each file. import lotus.domino.*; import java.io.File; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Stream stream = session.createStream(); int bytes = 0; File directory = new File("C:\\StreamFiles"); String[] files = directory.list(); for (int i = 0; i < files.length; i++) { if (stream.open(directory + "\\" + files[i])) { bytes = bytes + stream.getBytes(); stream.close(); } else throw new NotesException (NotesError.NOTES_ERR_FILEOPEN_FAILED, "Open failed"); } System.out.println("Number of files = " + files.length); System.out.println("Total bytes = " + bytes); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
getContents method Copies stream contents to a java.io.OutputStream or Writer object.
Defined in Stream
1002
Programming Guide, Volume 3: Java/CORBA Classes
Syntax public void getContents(java.io.OutputStream stream) throws NotesException public void getContents(java.io.Writer stream) throws NotesException
Usage If the native stream has content, the new content is appended. When a stream is copied, property values are: v IsEOS is true v Position is set at end of stream
Examples: getContents method This agent writes to a stream using java.io.OutputStreamWriter. import lotus.domino.*; import java.io.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); String outPath = "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt"; FileOutputStream fos = new FileOutputStream(outPath); OutputStreamWriter osw = new OutputStreamWriter(fos); Stream outStream = session.createStream(); outStream.writeText(doc.getItemValueString("Body")); outStream.getContents(osw); osw.close(); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
open method Associates a file with a stream.
Defined in Stream
Syntax public boolean open(String pathname) throws NotesException public boolean open(String pathname, String charset) throws NotesException
Chapter 2. Java Classes A-Z
1003
Parameters String pathname
The full path name of a file. Must be valid for the current platform. String charset
The character set used by the file. The character set that describes the file content. Defaults to ″System.″
Return value boolean
v true if the file opens successfully. v false if the open fails. See the usage notes below.
Usage This method creates the file if it does not exist. When a stream is opened, property values are: v Bytes is 0 for a new file and the number of bytes in the file for an existing file. v Charset is as specified for charset. v IsEOS is true if the stream is empty; otherwise, it is false. v IsReadOnly is true if the file is read-only, false if the file is read-write. v Position is 0. It is recommended that you call Close when you are finished processing the stream. Valid character sets include: ASCII, Big5, Binary, EUC-JP, EUC-KR, EUC-TW, GF2312, ISO-2022-JP, ISO-2022-KR, ISO-8859-1 through ISO-8859-9, ISO-8859-15, KOI8-R, Latin4, Shift-JIS, System, TCVN3, Unicode, Unicode-1-1, US-ASCII, UTF-7, UTF-8, UTF-16, UTF-16BE, UTF-16LE, Windows-1250 through Windows-1258, and Windows-874. Binary implies byte operations only on the stream. Unicode is the same as UTF-16 and Unicode-1-1 is a compatible subset of UTF-16. This method fails if: v The path name is not valid. v The stream is already open. v The stream has content. v The charset parameter is not a valid character set.
Language cross-reference Open method in LotusScript NotesStream class
Examples: open method 1. This example gets information on the normal files in a directory by opening each file as a stream. The agent reuses the same NotesStream object by opening and closing it for each file. import lotus.domino.*; import java.io.File; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here)
1004
Programming Guide, Volume 3: Java/CORBA Classes
Stream stream = session.createStream(); int bytes = 0; File directory = new File("C:\\StreamFiles"); String[] files = directory.list(); for (int i = 0; i < files.length; i++) { if (stream.open(directory + "\\" + files[i])) { bytes = bytes + stream.getBytes(); stream.close(); } else throw new NotesException (NotesError.NOTES_ERR_FILEOPEN_FAILED, "Open failed"); } System.out.println("Number of files = " + files.length); System.out.println("Total bytes = " + bytes); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent opens a file as a stream for reading. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\readme.txt"; // Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "ASCII")) { if (inStream.getBytes() > 0) { Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", inPath); doc.replaceItemValue("Body", inStream.readText()); inStream.close(); doc.save(true, true); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
3. This agent opens a file for writing. Chapter 2. Java Classes A-Z
1005
import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get the input file DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); String outPath = "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt"; Stream outStream = session.createStream(); if (outStream.open(outPath, "ASCII")) { if (outStream.getBytes() == 0) { outStream.writeText(doc.getItemValueString("Body")); outStream.close(); } else System.out.println("Output file exists and has content"); } else System.out.println("Output file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
read method Reads bytes from a stream.
Defined in Stream
Syntax public byte[] read() throws NotesException public byte[] read(int length) throws NotesException
Parameters int length
The number of bytes to read to a maximum of 2GB. Defaults to the number of bytes in the stream starting at the current position to a maximum of 2GB.
Return value byte[]
The bytes read. The lower bound of the array is 0.
1006
Programming Guide, Volume 3: Java/CORBA Classes
Usage This method starts at getPosition and reads the number of bytes specified or the number of bytes left in the stream.
Language cross-reference Read method in LotusScript NotesStream class
Examples: read method This agent demonstrates making an exact copy of a file using Stream. The agent associates one stream with an existing file and a second stream with a new file. The agent reads blocks of bytes from the first stream and writes them to the second stream until end of stream occurs on the first stream. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\domobj.tlb"; String outPath = "c:\\StreamFiles\\domobjcopy.tlb"; // Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "binary")) { if (inStream.getBytes() > 0) { // Get the output file Stream outStream = session.createStream(); if (outStream.open(outPath, "binary")) { if (outStream.getBytes() == 0) { // Transfer input file to output file do { byte[] buffer = inStream.read(32767); outStream.write(buffer); } while (!inStream.isEOS()); inStream.close(); outStream.close(); } else System.out.println("Output file exists and has content"); } else System.out.println("Output file open failed"); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
Chapter 2. Java Classes A-Z
1007
readText method Reads text lines from a stream.
Defined in Stream
Syntax public String readText() throws NotesException public String readText(int constant) throws NotesException public String readText(int constant, int constant) throws NotesException
Parameters int constant
v Stream.STMREAD_LINE (0) reads one line. v Defaults to the entire stream to a maximum of 2GB. int constant
End-of-line character(s) within the text. The default is Stream.EOL_NONE. v v v v v v
Stream.EOL_ANY (4) treats any of EOL_CR, EOL_CRLF, or EOL_LF as end-of-line. Stream.EOL_CR (2) treats a carriage return (ASCII 13) as end-of-line. Stream.EOL_CRLF (0) treats a carriage return and line feed (ASCII 10 + 13) as end-of-line. Stream.EOL_LF (1) treats a line feed (ASCII 10) as end-of-line. Stream.EOL_NONE (5) treats nothing as end-of-line. Default. Stream.EOL_PLATFORM (3) follows the conventions of the current platform.
Return value String
The text read.
Usage This method starts at getPosition and reads text until end of line, including the end-of-line character, or end of stream.
Language cross-reference ReadText method in LotusScript NotesStream class
Examples: readText method 1. This agent reads a text file and saves its content in the Body item of a new document in the current database. The agent uses the file name for the content of the Subject item. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\readme.txt";
1008
Programming Guide, Volume 3: Java/CORBA Classes
// Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "ASCII")) { if (inStream.getBytes() > 0) { Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", inPath); doc.replaceItemValue("Body", inStream.readText()); inStream.close(); doc.save(true, true); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent is similar to the first example but reads the file a line at a time. The agent adds text to the Body item of the new document until end of stream occurs. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\readme.txt"; // Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "ASCII")) { if (inStream.getBytes() > 0) { Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", inPath); RichTextItem body = doc.createRichTextItem("Body"); do { body.appendText(inStream.readText( Stream.STMREAD_LINE, Stream.EOL_CRLF)); } while (!inStream.isEOS()); inStream.close(); doc.save(true, true); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); Chapter 2. Java Classes A-Z
1009
} catch(Exception e) { e.printStackTrace(); } } }
setContents method Copies java.io.InputStream or Reader contents to a stream.
Defined in Stream
Syntax public void setContents(java.io.InputStream stream) throws NotesException public void setContents(java.io.Reader stream) throws NotesException
Usage If the stream has content, the new content is appended. When a stream is copied, property values are: v IsEOS is true v Position is set at end of stream
Examples: setContents method This agent reads from a file using java.io.InputStreamReader. import lotus.domino.*; import java.io.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\readme.txt"; FileInputStream fis = new FileInputStream(inPath); InputStreamReader isr = new InputStreamReader(fis, "ASCII"); Stream inStream = session.createStream(); inStream.setContents(isr); Database db = agentContext.getCurrentDatabase(); Document doc = db.createDocument(); doc.replaceItemValue("Form", "Main Topic"); doc.replaceItemValue("Subject", inPath); doc.replaceItemValue("Body", inStream.readText()); inStream.close(); doc.save(true, true); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
1010
Programming Guide, Volume 3: Java/CORBA Classes
truncate method Deletes the contents of a stream.
Defined in Stream
Syntax public void truncate() throws NotesException
Usage This method throws an exception if the stream is read-only. See IsReadOnly. When a stream is truncated, property values are: v Bytes is 0 v IsEOS is true v Position is 0 Closing a stream with zero bytes deletes the associated file.
Language cross-reference Truncate method in LotusScript NotesStream class
Examples: truncate method This agent opens a stream for a file and writes to it. If the file already has content, the agent truncates the stream before writing to it. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get the input file DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); String outPath = "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt"; Stream outStream = session.createStream(); if (outStream.open(outPath, "ASCII")) { if (outStream.getBytes() > 0) outStream.truncate(); outStream.writeText(doc.getItemValueString("Body")); outStream.close(); } else System.out.println("Output file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } } Chapter 2. Java Classes A-Z
1011
write method Associates a file with a stream.
Defined in Stream
Syntax public int write(byte[] buffer) throws NotesException
Parameters byte[] buffer
Variant array. The bytes to write, to a maximum of 2GB.
Return value int
The number of bytes written.
Usage This method appends the bytes to the end of the stream. This method throws an exception if the stream is read-only. See IsReadOnly. When a stream is written, property values are: v Bytes is incremented by the number of bytes read v IsEOS is true v Position is set at end of stream
Language cross-reference Write method in LotusScript NotesStream class
Examples: write method This agent demonstrates making an exact copy of a file using Stream. The agent associates one stream with an existing file and a second stream with a new file. The agent reads blocks of bytes from the first stream and writes them to the second stream until end of stream occurs on the first stream. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) String inPath = "c:\\StreamFiles\\domobj.tlb"; String outPath = "c:\\StreamFiles\\domobjcopy.tlb"; // Get the input file Stream inStream = session.createStream(); if (inStream.open(inPath, "binary")) { if (inStream.getBytes() > 0) { // Get the output file Stream outStream = session.createStream(); if (outStream.open(outPath, "binary")) { if (outStream.getBytes() == 0) {
1012
Programming Guide, Volume 3: Java/CORBA Classes
// Transfer input file to output file do { byte[] buffer = inStream.read(32767); outStream.write(buffer); } while (!inStream.isEOS()); inStream.close(); outStream.close(); } else System.out.println("Output file exists and has content"); } else System.out.println("Output file open failed"); } else System.out.println("Input file has no content"); } else System.out.println("Input file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
writeText method Writes text to a stream.
Defined in Stream
Syntax public int writeText(String text) throws NotesException public int writeText(String text, int endOfLine) throws NotesException
Parameters String text
The text to write, to a maximum of 2GB bytes. int endOfLine
End-of-line character(s) appended to the text. The default is Stream.EOL_NONE. v Stream.EOL_CR (2) appends a carriage return (ASCII 13). v Stream.EOL_CRLF (0) appends a carriage return and line feed (ASCII 10 + 13). v Stream.EOL_LF (1) appends a line feed (ASCII 10). v Stream.EOL_NONE (5) appends nothing. Default. v Stream.EOL_PLATFORM (3) follows the conventions of the current platform.
Return value Int
The number of characters written.
Chapter 2. Java Classes A-Z
1013
Usage This method appends the text to the end of the stream. This method throws an exception if the stream is read-only. See IsReadOnly. When a stream is written, property values are: v Bytes is incremented by the number of bytes read v IsEOS is true v Position is set at end of stream If the stream is opened on an empty file and the character set is Unicode, UTF-16, UTF-16BE, or UTF-16LE, this method writes byte order mark or signature bytes at the beginning of the stream. These bytes are transparent upon subsequent accesses of the stream with the same character set.
Language cross-reference WriteText method in LotusScript NotesStream class
Examples: writeText method This agent creates a file using the Subject item of the selected document for the file name, then writes the Body item of the selected document to it. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) // Get the input file DocumentCollection dc = agentContext.getUnprocessedDocuments(); Document doc = dc.getFirstDocument(); String outPath = "c:\\StreamFiles\\" + doc.getItemValueString("Subject") + ".txt"; Stream outStream = session.createStream(); if (outStream.open(outPath, "ASCII")) { if (outStream.getBytes() == 0) { outStream.writeText(doc.getItemValueString("Body"), Stream.EOL_CRLF); outStream.close(); } else System.out.println("Output file exists and has content"); } else System.out.println("Output file open failed"); } catch(NotesException e) { e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } } }
1014
Programming Guide, Volume 3: Java/CORBA Classes
View class Represents a view or folder of a database and provides access to documents within it.
Syntax public class View extends Base
Containment Contained by: Database Contains: Document, DateTime, ViewColumn, ViewEntry, ViewEntryCollection, ViewNavigator
Properties Aliases through getAliases and setAliases AllEntries through getAllEntries BackgroundColor through getBackgroundColor and setBackgroundColor ColumnCount through getColumnCount ColumnNames through getColumnNames Columns through getColumns Created through getCreated EntryCount through getEntryCount HeaderLines through getHeaderLines HttpURL through getHttpURL IsAutoUpdate through isAutoUpdate and setAutoUpdate IsCalendar through isCalendar IsCategorized through isCategorized IsConflict through isConflict IsDefaultView through isDefaultView and setDefaultView IsFolder through isFolder IsHierarchical through isHierarchical IsModified through isModified IsPrivate through isPrivate IsProhibitDesignRefresh through isProhibitDesignRefresh and setProhibitDesignRefresh IsProtectReaders through isProtectReaders and setProtectReaders Chapter 2. Java Classes A-Z
1015
LastModified through getLastModified LockHolders through getLockHolders Name through getName and setName NotesURL through getNotesURL Parent through getParent Readers through getReaders and setReaders RowLines through getRowLines SelectionFormula through getSelectionFormula and setSelectionFormula Spacing through getSpacing and setSpacing TopLevelEntryCount through getTopLevelEntryCount UniversalID through getUniversalID ViewInheritedName through getViewInheritedName
Methods clear copyColumn createColumn createViewNav createViewNavFrom createViewNavFromCategory createViewNavFromChildren createViewNavFromDescendants createViewNavMaxLevel FTSearch getAllDocumentsByKey getAllEntriesByKey getChild getColumn getDocumentByKey
1016
Programming Guide, Volume 3: Java/CORBA Classes
getEntryByKey getFirstDocument getLastDocument getNextDocument getNextSibling getNthDocument getParentDocument getPrevDocument getPrevSibling getURL lock lockProvisional recycle refresh remove removeColumn setAliases toString unlock
Access You access a view or folder through the Database object that contains it. There are two ways: v To access a view or folder when you know its name or alias, use getView. v To access all the views and folders in a database, use getViews. Returned is a View object or a vector of View objects that represent accessible views and/or folders in the database. These View objects may be public views or folders or private views or folders stored in the database that are owned by the effective id running the agent. Personal views and folders stored in the desktop cannot be accessed by programs. To access a view or folder when you have a view entry, use getParent in ViewEntry.
Usage A View object provides access to ViewEntry, ViewEntryCollection, and ViewNavigator objects: v A ViewEntry object represents a row in the view and can be a document, category, or total. A document entry provides a handle to the associated Document object. Chapter 2. Java Classes A-Z
1017
v A ViewEntryCollection object provides access to selected or all document ViewEntry objects. (Excluded are category and total ViewEntry objects.) v A ViewNavigator object provides methods for navigating through selected or all ViewEntry and Document objects. A View object provides access to ViewColumn objects, which contain information on each column in the view If you create a View object then change a document so that it affects the underlying view, navigation with the View object may produce incorrect results.You must refresh the View object or create a new one. Document changes that affect views include additions, deletions, and changes to fields used by selection formulas. See refresh for further information.
Language cross-reference FolderProperties @command in formula language
Examples: View class 1. This agent finds the ″By Category″ view in a database and gets the first document in the view. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase ("FrenchFry", "NotesUA\\progwork"); View view = db.getView("By Category"); Document doc = view.getFirstDocument(); System.out.println (doc.getItemValueString("Subject")); } catch(Exception e) { e.printStackTrace(); } } }
2. This agent finds the ″($All)″ hidden view in a database and gets the first document in the view. import lotus.domino.*; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase ("FrenchFry", "NotesUA\\progwork"); View view = db.getView("($All)"); Document doc = view.getFirstDocument(); System.out.println (doc.getItemValueString("Subject")); } catch(Exception e) { e.printStackTrace(); } } }
3. This agent finds the default view in a database.
1018
Programming Guide, Volume 3: Java/CORBA Classes
import lotus.domino.*; import java.util.Vector; public class JavaAgent extends AgentBase { public void NotesMain() { try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // (Your code goes here) Database db = session.getDatabase ("FrenchFry", "NotesUA\\progwork"); Vector views = db.getViews(); View view = null; for (int i=0; i