public class NSFNote extends NSFHandle
Modifier and Type | Class and Description |
---|---|
static interface |
NSFNote.NSFNoteItemProc |
Constructor and Description |
---|
NSFNote(NSFDatabase parent,
long handle) |
Modifier and Type | Method and Description |
---|---|
void |
attachFile(String filePath,
String attachmentName)
Attaches the provided file to an item named $FILE in the note.
|
void |
convertCDToMIME() |
HTMLExporter |
createHTMLExporter(String itemName)
Creates a configurable exporter for the specified item.
|
void |
delete(boolean force,
boolean purge)
Delete the note from its database.
|
void |
detachFile(String fileName) |
protected void |
doFree()
This method is called when the final reference to this object is freed.
|
void |
eachItem(NSFITEMSCANPROC proc)
Iterates through each item in the note using
NSFItemScan . |
void |
eachItemValue(NSFNote.NSFNoteItemProc proc)
Iterates through each item and its value in the note, providing the
NSFNote.NSFNoteItemProc
with the item name and value. |
static NSFNote |
fromLotus(NSFDatabase parent,
lotus.domino.Document lotusDoc) |
Object[] |
get(String itemName)
Returns the value(s) for the given item.
|
<T> T |
get(String itemName,
Class<T> clazz)
This method attempts to coerce the item's value into the provided class.
|
NSFDateTime |
getAddedToFile() |
List<NSFItem> |
getAllItems(String itemName) |
String |
getAsString(String itemName,
char separator)
Returns the specified item's value as a String.
|
NSFCompositeData |
getCompositeData(String itemName)
Returns a
NSFCompositeData view of all of the items used to store CD in a note
for the given name. |
List<NSFView> |
getContainingFolders() |
Date |
getCreated()
Returns the creation date of the note.
|
NSFItem |
getFirstItem(String itemName) |
List<NSFItem> |
getItems() |
ValueType |
getItemType(String itemName) |
NSFDateTime |
getModifiedInFile() |
NSFItem |
getNextItem(NSFItem previous) |
NSFItem |
getNextItem(NSFItem previous,
String itemName) |
int |
getNoteID() |
OID |
getOID()
Retrieves the note's OID.
|
NSFDatabase |
getParent() |
int |
getParentDocumentID()
Returns the note ID of this note's parent, as an
int , or 0 if
this note has no parent. |
String |
getParentDocumentUNID()
Returns the UNID of this note's parent, or
"" if this note has no parent. |
String |
getProfileName()
If the note is a profile note, this returns the form name of the profile
|
String |
getProfileUserName()
If the note is a profile note, this returns the user name of the profile
|
int |
getResponseCount()
Returns the count of responses to the document.
|
NSFNoteIDCollection |
getResponses()
Returns an
NSFNoteIDCollection of the responses to this note. |
NSFDateTime |
getSequenceModified()
Returns the last modification time of the note globally (as opposed to just in this file).
|
String |
getUniversalID() |
boolean |
hasEmbedded() |
boolean |
hasItem(String itemName) |
boolean |
hasMime() |
void |
makeResponse(NSFNote parentNote) |
void |
removeItem(String itemName) |
void |
save() |
void |
save(int flags) |
void |
set(String itemName,
Object value) |
void |
set(String itemName,
Object value,
short flags) |
void |
setAddedToFile(long timeMillis) |
void |
setModified(long timeMillis) |
void |
setNoteRef(String itemName,
String... unids) |
void |
setParentDocumentUNID(String parentUnid)
Sets the document's parent UNID to the provided UNID string.
|
void |
setSequence(int id) |
void |
setSequenceModified(long timeMillis) |
String |
toString() |
_checkRefValidity, equals, getHandle, getSession, hashCode, isRefValid, setHandle
addChild, addChildStruct, debugPrintChildHierarchy, finalize, free, free, free, getAPI, getChildObjectCount, getChildObjectCount, getChildStructCount, isFreed, isTraceCreation, removeChild, removeChildStruct, removeFromParent, retain, setNeedsFree, setTraceCreation
public NSFNote(NSFDatabase parent, long handle)
public static NSFNote fromLotus(NSFDatabase parent, lotus.domino.Document lotusDoc) throws lotus.domino.NotesException, DominoException
lotus.domino.NotesException
DominoException
public NSFDatabase getParent()
public void save() throws DominoException
DominoException
public void save(int flags) throws DominoException
DominoException
public int getNoteID() throws DominoException
DominoException
public OID getOID() throws DominoException
DominoException
- if there is a problem retrieving the OIDpublic String getUniversalID() throws DominoException
DominoException
public void setSequence(int id) throws DominoException
DominoException
public int getParentDocumentID()
int
, or 0
if
this note has no parent.int
, or 0
if
this note has no parent.public String getParentDocumentUNID() throws DominoException
""
if this note has no parent.""
if this note has no parent.DominoException
public void makeResponse(NSFNote parentNote) throws DominoException
DominoException
public void setParentDocumentUNID(String parentUnid) throws DominoException
makeResponse(NSFNote)
with the parent note, but does not require that the
parent note be open (or, for that matter, exist).parentUnid
- the new parent UNID. This must be a 32-character hex stringDominoException
- if there is a problem setting the parent UNIDIllegalArgumentException
- if parentUnid
is not a legal UNIDpublic void attachFile(String filePath, String attachmentName) throws DominoException
attachmentName
- the name of the file when attached to the note (e.g. "foo.txt")filePath
- the path to the file on the filesystem (e.g. "c:\foo.txt")DominoException
- if there is a problem attaching the file to the notepublic void detachFile(String fileName)
public void eachItem(NSFITEMSCANPROC proc) throws DominoException
NSFItemScan
.
This method does not free any structs generated from within the scanning code.
proc
- the handler to be called for each item in the noteDominoException
- if there is a problem iterating over the note's itemspublic void eachItemValue(NSFNote.NSFNoteItemProc proc) throws DominoException
NSFNote.NSFNoteItemProc
with the item name and value.
Domino struct values are freed by this method and do not need to be freed by the proc.
proc
- the handler to be called for each item name/value pairDominoException
- if there is a problem iterating over the note's valuespublic void convertCDToMIME() throws DominoException
DominoException
public boolean hasMime()
public boolean hasEmbedded()
public NSFNoteIDCollection getResponses() throws DominoException
NSFNoteIDCollection
of the responses to this note. Warning: though those collections
are usually tied to the session, collections created this way will become invalid when the creating
NSFNote
is freed.
If the collection should survive past the lifetime of the NSFNote
, then it should be
merged into an independently-created collection.
DominoException
- if there is a problem retrieving this collectionpublic int getResponseCount() throws DominoException
getResponses()
.DominoException
public NSFDateTime getSequenceModified() throws DominoException
NSFDateTime
of the note's modification timeDominoException
- if there is a lower-level-API problem retrieving the modification timepublic void setSequenceModified(long timeMillis) throws DominoException
DominoException
public void setModified(long timeMillis) throws DominoException
DominoException
public void setAddedToFile(long timeMillis) throws DominoException
DominoException
public NSFDateTime getAddedToFile() throws DominoException
DominoException
public NSFDateTime getModifiedInFile() throws DominoException
DominoException
public Date getCreated() throws DominoException
DominoException
- if there is a problem determining the creation datepublic void delete(boolean force, boolean purge) throws DominoException
force
- whether to force deletionpurge
- whether to delete without leaving a replication stubDominoException
- if there is a problem deleting the notepublic void set(String itemName, Object value) throws DominoException
DominoException
public void set(String itemName, Object value, short flags) throws DominoException
DominoException
public void setNoteRef(String itemName, String... unids) throws DominoException
DominoException
public Object[] get(String itemName) throws DominoException
DominoException
DominoNativeUtils#readItemValueArray(long, int, long)
public <T> T get(String itemName, Class<T> clazz) throws DominoException
In the case of supported single-value classes and multi-value items, the item's first value is returned.
itemName
- the item name whose value to retrieveclazz
- the class to attempt to coerce the item tonull
if the item doesn't exist or can't be coercedDominoException
- if there is a problem retrieving the valuepublic String getAsString(String itemName, char separator) throws DominoException
This is distinct from calling get(String, Class)
with String
for the class,
as this uses the underlying NSFItemConvertToText
function call, which has its own
characteristics.
This implementation uses a buffer size of 60K (the maximum allowed by the underlying API).
itemName
- the item name whose value to retrieveseparator
- the separator to use to concatenate multiple item valuesDominoException
- if there is a problem retrieving the value or convering it to a Stringpublic HTMLExporter createHTMLExporter(String itemName)
HTMLExporter
for usage.itemName
- An item containing composite data or MIMEHTMLExporter
for the specified itempublic boolean hasItem(String itemName) throws DominoException
DominoException
public void removeItem(String itemName) throws DominoException
DominoException
public ValueType getItemType(String itemName) throws DominoException
itemName
- the name of the item to queryValueType
of the item, or null
if the item does not existDominoException
- if there is a problem determining the item typepublic List<NSFItem> getAllItems(String itemName) throws DominoException
DominoException
public NSFItem getFirstItem(String itemName) throws DominoException
DominoException
public NSFItem getNextItem(NSFItem previous, String itemName) throws DominoException
previous
- the note's item prior to the one you want to retrieveitemName
- the name of the item you want to retrieve, or null
if you would like the next
item regardless of namenull
if there are no more itemsDominoException
- if there is a problem retrieving the itempublic NSFItem getNextItem(NSFItem previous) throws DominoException
previous
- the note's item prior to the one you want to retrievenull
if there are no more itemsDominoException
- if there is a problem retrieving the itempublic List<NSFItem> getItems() throws DominoException
DominoException
public NSFCompositeData getCompositeData(String itemName) throws DominoException
NSFCompositeData
view of all of the items used to store CD in a note
for the given name.
The caller is responsible for freeing the returned object.
itemName
- the item name to openNSFCompositeData
view of the items, or null
if the item is not setDominoException
- if there is an underlying API problem reading the itemspublic String getProfileName() throws DominoException
null
if this is not a profileDominoException
- if there is a problem retrieving the name itempublic String getProfileUserName() throws DominoException
null
if this is not a profileDominoException
- if there is a problem retrieving the name itempublic List<NSFView> getContainingFolders() throws DominoException
List
of the folders in the database that contain this noteDominoException
protected void doFree()
NSFBase
Implemented classes are expected to release any memory or network resources they have open. They are also expected to write this defensively, allowing the method to be called multiple times on the same object without problem.
Copyright © 2014–2018. All rights reserved.