Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.mindoo.domino.jna;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import com.mindoo.domino.jna.NotesItem.ICompositeCallbackDirect.Action;
import com.mindoo.domino.jna.constants.CDRecordType;
import com.mindoo.domino.jna.errors.NotesError;
import com.mindoo.domino.jna.errors.NotesErrorUtils;
import com.mindoo.domino.jna.internal.DisposableMemory;
import com.mindoo.domino.jna.internal.Mem32;
import com.mindoo.domino.jna.internal.Mem64;
import com.mindoo.domino.jna.internal.NotesConstants;
import com.mindoo.domino.jna.internal.NotesNativeAPI32;
import com.mindoo.domino.jna.internal.NotesNativeAPI64;
import com.mindoo.domino.jna.internal.structs.NotesBlockIdStruct;
import com.mindoo.domino.jna.internal.structs.NotesTimeDateStruct;
import com.mindoo.domino.jna.utils.NotesStringUtils;
import com.mindoo.domino.jna.utils.PlatformUtils;
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByteByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.ShortByReference;
/**
* Container for note item data
*
* @author Karsten Lehmann
*/
public class NotesItem {
/* All datatypes below are passed to NSF in either host (machine-specific
byte ordering and padding) or canonical form (Intel 86 packed form).
The format of each datatype, as it is passed to and from NSF functions,
is listed below in the comment field next to each of the data types.
(This host/canonical issue is NOT applicable to Intel86 machines,
because on that machine, they are the same and no conversion is required).
On all other machines, use the ODS subroutine package to perform
conversions of those datatypes in canonical format before they can
be interpreted. */
/* "Computable" Data Types */
public static final int TYPE_ERROR = (int)(0 + (1 << 8));
public static final int TYPE_UNAVAILABLE = (int)(0 + (2 << 8));
public static final int TYPE_TEXT = (int)(0 + (5 << 8));
public static final int TYPE_TEXT_LIST = (int)(1 + (5 << 8));
public static final int TYPE_NUMBER = (int)(0 + (3 << 8));
public static final int TYPE_NUMBER_RANGE = (int)(1 + (3 << 8));
public static final int TYPE_TIME = (int)(0 + (4 << 8));
public static final int TYPE_TIME_RANGE = (int)(1 + (4 << 8));
public static final int TYPE_FORMULA = (int)(0 + (6 << 8));
public static final int TYPE_USERID = (int)(0 + (7 << 8));
/* "Non-Computable" Data Types */
public static final int TYPE_SIGNATURE = (int)(8 + (0 << 8));
public static final int TYPE_ACTION = (int)(16 + (0 << 8));
public static final int TYPE_WORKSHEET_DATA = (int)(13 + (0 << 8));
public static final int TYPE_VIEWMAP_LAYOUT = (int)(19 + (0 << 8));
public static final int TYPE_SEAL2 = (int)(31 + (0 << 8));
public static final int TYPE_LSOBJECT = (int)(20 + (0 << 8));
public static final int TYPE_ICON = (int)(6 + (0 << 8));
public static final int TYPE_VIEW_FORMAT = (int)(5 + (0 << 8));
public static final int TYPE_SCHED_LIST = (int)(22 + (0 << 8));
public static final int TYPE_VIEWMAP_DATASET = (int)(18 + (0 << 8));
public static final int TYPE_SEAL = (int)(9 + (0 << 8));
public static final int TYPE_MIME_PART = (int)(25 + (0 << 8));
public static final int TYPE_SEALDATA = (int)(10 + (0 << 8));
public static final int TYPE_NOTELINK_LIST = (int)(7 + (0 << 8));
public static final int TYPE_COLLATION = (int)(2 + (0 << 8));
public static final int TYPE_RFC822_TEXT = (int)(2 + (5 << 8));
public static final int TYPE_COMPOSITE = (int)(1 + (0 << 8));
public static final int TYPE_OBJECT = (int)(3 + (0 << 8));
public static final int TYPE_HTML = (int)(21 + (0 << 8));
public static final int TYPE_ASSISTANT_INFO = (int)(17 + (0 << 8));
public static final int TYPE_HIGHLIGHTS = (int)(12 + (0 << 8));
public static final int TYPE_NOTEREF_LIST = (int)(4 + (0 << 8));
public static final int TYPE_QUERY = (int)(15 + (0 << 8));
public static final int TYPE_USERDATA = (int)(14 + (0 << 8));
public static final int TYPE_INVALID_OR_UNKNOWN = (int)(0 + (0 << 8));
public static final int TYPE_SEAL_LIST = (int)(11 + (0 << 8));
public static final int TYPE_CALENDAR_FORMAT = (int)(24 + (0 << 8));
private NotesNote m_parentNote;
private boolean m_itemFlagsLoaded;
private int m_itemFlags;
private byte m_seq;
private byte m_dupItemId;
private int m_dataType;
private int m_valueLength;
private String m_itemName;
private NotesBlockIdStruct m_itemBlockId;
private NotesBlockIdStruct m_valueBlockId;
/**
* Creates a new item object
*
* @param parentNote parent note
* @param itemBlockId item block id
* @param dataType data type
* @param valueBlockId value block id
* @param valueLength value length in bytes
*/
NotesItem(NotesNote parentNote, NotesBlockIdStruct itemBlockId, int dataType,
NotesBlockIdStruct valueBlockId) {
m_parentNote = parentNote;
m_itemBlockId = itemBlockId;
m_dataType = dataType;
m_valueBlockId = valueBlockId;
}
/**
* This function converts the input {@link NotesItem#TYPE_RFC822_TEXT} item in an open
* note to its pre-V5 equivalent; i.e. to {@link NotesItem#TYPE_TEXT}, {@link NotesItem#TYPE_TEXT_LIST},
* or {@link NotesItem#TYPE_TIME}.
*
* It does not update the Domino database; to update the database, call NSFNoteUpdate.
*
* convertRFC822TextItem converts the named input item to the appropriate pre-V5 item type.
*
* For example, we convert the PostedDate {@link NotesItem#TYPE_RFC822_TEXT} item to a
* {@link NotesItem#TYPE_TIME} item.
*/
public void convertRFC822TextItem() {
m_parentNote.checkHandle();
NotesBlockIdStruct.ByValue itemBlockIdByVal = NotesBlockIdStruct.ByValue.newInstance();
itemBlockIdByVal.pool = m_itemBlockId.pool;
itemBlockIdByVal.block = m_itemBlockId.block;
NotesBlockIdStruct.ByValue valueBlockIdByVal = NotesBlockIdStruct.ByValue.newInstance();
valueBlockIdByVal.pool = m_valueBlockId.pool;
valueBlockIdByVal.block = m_valueBlockId.block;
short result;
if (PlatformUtils.is64Bit()) {
result = NotesNativeAPI64.get().MIMEConvertRFC822TextItemByBLOCKID(m_parentNote.getHandle64(), itemBlockIdByVal,
valueBlockIdByVal);
}
else {
result = NotesNativeAPI32.get().MIMEConvertRFC822TextItemByBLOCKID(m_parentNote.getHandle32(), itemBlockIdByVal,
valueBlockIdByVal);
}
NotesErrorUtils.checkResult(result);
//force datatype and seq number reload
m_itemFlagsLoaded = false;
loadItemNameAndFlags();
}
/**
* Returns the parent note for this item
*
* @return note
*/
public NotesNote getParent() {
return m_parentNote;
}
/**
* Returns the item block id to read item meta data
*
* @return item block id
*/
NotesBlockIdStruct getItemBlockId() {
return m_itemBlockId;
}
/**
* Returns the value block id to lock the value in memory and decode it
*
* @return value block id
*/
NotesBlockIdStruct getValueBlockId() {
return m_valueBlockId;
}
/**
* Returns the value length in bytes
*
* @return length
*/
public int getValueLength() {
loadItemNameAndFlags();
return m_valueLength;
}
/**
* Returns the item name
*
* @return item name
*/
public String getName() {
loadItemNameAndFlags();
return m_itemName;
}
/**
* Returns the data type, e.g. {@link #TYPE_TEXT} or {@link #TYPE_NUMBER}
*
* @return type
*/
public int getType() {
return m_dataType;
}
/**
* Returns false if the item's type is {@link #TYPE_UNAVAILABLE}
*
* @return true if available
*/
public boolean isAvailable() {
return m_dataType!=TYPE_UNAVAILABLE;
}
/**
* Returns the sequence number of the item
*
* @return sequence number (byte)
*/
public int getSeq() {
loadItemNameAndFlags();
return (int) (m_seq & 0xff);
}
/**
* Returna the Duplicate item ID
*
* @return id
*/
public int getDupItemId() {
loadItemNameAndFlags();
return m_dupItemId;
}
/**
* Decodes the item value(s). The data is always returned as a list even though
* the list may contain only one element (e.g. for {@link #TYPE_TEXT}.
*
* We currently support the following data types:
*
*
{@link #TYPE_TEXT} - List with String object
*
{@link #TYPE_TEXT_LIST} - List of String objects
*
{@link #TYPE_NUMBER} - List with Double object
*
{@link #TYPE_NUMBER_RANGE} - List of Double objects
*
{@link #TYPE_TIME} - List with Calendar object
*
{@link #TYPE_TIME_RANGE} - List of Calendar objects
*
{@link #TYPE_OBJECT} with the subtype Attachment (e.g. $File items) - List with {@link NotesAttachment} object
*
{@link #TYPE_NOTEREF_LIST} - List with one {@link NotesUniversalNoteId} object
*
{@link #TYPE_UNAVAILABLE} - returns an empty list; might e.g. be returned by {@link NotesDatabase#getNotes(int[], java.util.EnumSet[], int[], java.util.EnumSet, NotesDatabase, com.mindoo.domino.jna.NotesDatabase.IGetNotesCallback, com.mindoo.domino.jna.NotesDatabase.INoteOpenCallback, com.mindoo.domino.jna.NotesDatabase.IObjectAllocCallback, com.mindoo.domino.jna.NotesDatabase.IObjectWriteCallback, NotesTimeDate, com.mindoo.domino.jna.NotesDatabase.IFolderAddCallback)} with to high sequence numbers
*
* Other data types may be read via {@link #getValueAsText(char)} or native support may be added at
* a later time.
*
* @return item value(s)
*/
public List