public class KeepJnxSession
extends java.lang.Object
implements java.lang.AutoCloseable
Wrapper / Replacement around a Domino Session to make the KEEP API functional
Modifier and Type | Class and Description |
---|---|
static class |
KeepJnxSession.DocumentScope
Options to deal with getDocumentbyXX(…) to allow inclusion or exclusion of deleted documents.
|
static class |
KeepJnxSession.Note2JsonOptions
Options available when converting a Note into a Json Structure
|
Constructor and Description |
---|
KeepJnxSession(KeepUser user) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
com.hcl.domino.data.Document |
createDocumentFromJson(com.hcl.domino.data.Database db,
io.vertx.core.json.JsonObject body)
Create and save a document based on pre-validated JSON
|
boolean |
deleteApplicationConfig(TheBarbican barbican,
java.lang.String appId)
Deletes an application configuration
|
io.vertx.core.json.JsonObject |
document2Json(com.hcl.domino.data.Document doc)
Get all fields from a document
|
io.vertx.core.json.JsonObject |
document2Json(com.hcl.domino.data.Document doc,
java.util.Map<java.lang.String,java.lang.String> fieldMap)
Get all fields from a document
|
io.vertx.core.json.JsonObject |
document2Json(com.hcl.domino.data.Document doc,
java.util.Map<java.lang.String,java.lang.String> rawFieldMap,
java.util.Set<KeepJnxSession.Note2JsonOptions> options) |
io.vertx.core.json.JsonObject |
document2JsonSelected(com.hcl.domino.data.Document doc,
java.util.Set<java.lang.String> fields,
java.lang.String onLoadFormula,
java.util.Map<java.lang.String,java.lang.String> fieldMap)
Get document based on FormAccessMode fields and onLoad formula
|
java.util.Map<java.lang.String,java.lang.String> |
extractFieldsForForm(io.vertx.core.json.JsonObject designInfo,
java.lang.String formName) |
com.hcl.domino.DominoClient |
getClient() |
com.hcl.domino.DominoClient |
getClientAsIDUser() |
com.hcl.domino.data.Database |
getDatabase(java.lang.String apiName) |
com.hcl.domino.data.Database |
getDatabase(java.lang.String apiName,
KeepDbInfo info) |
com.hcl.domino.data.Database |
getDatabaseDomino(java.lang.String filePath)
Gets a database by its Domino filepath
|
java.util.Optional<com.hcl.domino.data.Document> |
getDocumentById(com.hcl.domino.data.Database db,
int id,
KeepJnxSession.DocumentScope scope)
Returns a document from a database, including the option to return deleted documents
|
java.util.Optional<com.hcl.domino.data.Document> |
getDocumentByUNID(com.hcl.domino.data.Database db,
java.lang.String unid,
KeepJnxSession.DocumentScope scope)
Returns a document from a database, including the option to return deleted documents, as deleted or restored
|
java.util.Optional<com.hcl.domino.data.Document> |
getDocumentByUNID(com.hcl.domino.data.Database db,
java.lang.String unid,
KeepJnxSession.DocumentScope scope,
java.util.Set<com.hcl.domino.data.Database.OpenDocumentMode> options)
Returns a document from a database, including the option to return deleted documents, as deleted or restored
|
com.hcl.domino.dxl.DxlImporter |
getDxlImporter()
Grab a DXL Importer
|
java.lang.Object |
getItemValueForJson(com.hcl.domino.data.Document doc,
com.hcl.domino.data.Item item)
Converts the item value into something suitable for JSON
|
KeepUser |
getUser() |
java.lang.String |
getUserName() |
io.vertx.core.json.JsonObject |
getViewRow(java.util.Map<java.lang.String,com.hcl.domino.data.CollectionColumn> columnMap,
java.util.List<java.lang.String> columnNames,
com.hcl.domino.data.CollectionEntry curEntry,
boolean includeUnreadInfo)
Converts a NotesView Row into a JSON Object
|
KeepApplicationConfigInfo |
loadApplicationConfig(TheBarbican barbican,
java.lang.String appId)
Finds a KeepApplication document for a specific appId and converts it to a KeepApplicationConfigInfo object
|
void |
mime2doc(com.hcl.domino.data.Document doc,
java.lang.String message,
java.util.List<java.lang.String> headerNames)
Writes MIME content out into a Note By nature of Mime, Mime only gets appended, so we need to clear fields and most important the Body before commencing
|
java.lang.String |
modifyAndEvaluateFormula(java.lang.String formulaString,
com.hcl.domino.data.Document doc,
com.hcl.domino.data.Database db) |
com.hcl.domino.data.Formula.FormulaExecutionResult |
modifyAndExecuteFormula(java.lang.String formulaString,
com.hcl.domino.data.Document doc,
com.hcl.domino.data.Database db) |
java.lang.String |
modifyFormulaForUser(java.lang.String formula,
com.hcl.domino.data.Document doc,
com.hcl.domino.data.Database db) |
boolean |
processItemRequired(com.hcl.domino.data.Item item,
java.util.Map<java.lang.String,java.lang.String> fieldMap,
java.util.TreeMap<java.lang.String,java.lang.Object> itemsAlreadyProcessed,
java.util.Set<KeepJnxSession.Note2JsonOptions> options)
Determines if an item needs to be processed and converted into JSON
|
void |
readDocToMIME(com.hcl.domino.data.Document doc,
java.io.Writer writer,
java.lang.Class<?> clazz)
Reads the raw mime Stream from a NotesItem into a writer, based on options.
|
void |
readRawMIME(com.hcl.domino.data.Document doc,
java.lang.String itemName,
java.io.Writer writer,
java.util.Set<com.hcl.domino.mime.MimeReader.ReadMimeDataType> options,
java.lang.Class<?> clazz)
Reads the raw mime Stream from a NotesItem into a writer, based on options.
|
com.hcl.domino.person.OutOfOffice |
startOOOOperation(java.lang.String userName,
java.lang.String mailServer,
boolean isMailServer,
com.hcl.domino.data.Database db) |
void |
updateDocFromJson(io.vertx.core.json.JsonObject jsonSource,
com.hcl.domino.data.Document doc)
Write fields into a pre-created document, without validation against a Form Access Mode.
|
void |
validateAccessRequest(com.hcl.domino.data.Database db,
com.hcl.domino.security.AclLevel minimumRequiredAclLevel,
java.util.Set<AclAccessFlags> aclAccessFlags,
java.util.Set<java.lang.String> accessRolesRequired) |
com.hcl.domino.data.Document |
validateAttachmentAccessRequest(com.hcl.domino.data.Database db,
java.lang.String unid,
java.lang.String fileName,
DocumentAccess docAccess)
Validates request for attachment reading / writing
|
com.hcl.domino.data.Document |
validateDocumentAccessRequest(com.hcl.domino.data.Database db,
java.lang.String unid,
DocumentAccess docAccess)
Validates the user has access to read and, if required, write the document Checks for the document directly, we presume ACL check has been done already if the document is protected by a reader field it will return a not found error
|
void |
validateFormAccessFormula(java.lang.String formula,
com.hcl.domino.data.Document doc,
java.lang.String apiName)
Validate the user has access to perform an action using a FormAccessMode, according to the DQL access formula in the KeepConfig
|
void |
writeRawMIME(com.hcl.domino.data.Document doc,
java.io.Reader reader) |
public KeepJnxSession(KeepUser user)
user
- public void close()
close
in interface java.lang.AutoCloseable
public com.hcl.domino.data.Document createDocumentFromJson(com.hcl.domino.data.Database db, io.vertx.core.json.JsonObject body)
Create and save a document based on pre-validated JSON
db
- body
- public boolean deleteApplicationConfig(TheBarbican barbican, java.lang.String appId)
Deletes an application configuration
barbican
- appId
- public io.vertx.core.json.JsonObject document2Json(com.hcl.domino.data.Document doc)
Get all fields from a document
doc
- public io.vertx.core.json.JsonObject document2Json(com.hcl.domino.data.Document doc, java.util.Map<java.lang.String,java.lang.String> fieldMap)
Get all fields from a document
doc
- fieldMap
- public io.vertx.core.json.JsonObject document2Json(com.hcl.domino.data.Document doc, java.util.Map<java.lang.String,java.lang.String> rawFieldMap, @Nonnull java.util.Set<KeepJnxSession.Note2JsonOptions> options)
doc
- rawFieldMap
- options
- EnumSetpublic io.vertx.core.json.JsonObject document2JsonSelected(com.hcl.domino.data.Document doc, java.util.Set<java.lang.String> fields, java.lang.String onLoadFormula, java.util.Map<java.lang.String,java.lang.String> fieldMap)
Get document based on FormAccessMode fields and onLoad formula
doc
- fields
- onLoadFormula
- fieldMap
- public java.util.Map<java.lang.String,java.lang.String> extractFieldsForForm(io.vertx.core.json.JsonObject designInfo, java.lang.String formName)
designInfo
- formName
- public com.hcl.domino.DominoClient getClient()
public com.hcl.domino.DominoClient getClientAsIDUser()
public com.hcl.domino.data.Database getDatabase(java.lang.String apiName) throws KeepExceptionInsufficientAccess
apiName
- KeepExceptionInsufficientAccess
public com.hcl.domino.data.Database getDatabase(java.lang.String apiName, KeepDbInfo info) throws KeepExceptionInsufficientAccess
apiName
- info
- KeepExceptionInsufficientAccess
public com.hcl.domino.data.Database getDatabaseDomino(java.lang.String filePath) throws KeepExceptionInsufficientAccess
Gets a database by its Domino filepath
filePath
- actual filepathKeepExceptionInsufficientAccess
public java.util.Optional<com.hcl.domino.data.Document> getDocumentById(com.hcl.domino.data.Database db, int id, KeepJnxSession.DocumentScope scope)
Returns a document from a database, including the option to return deleted documents
db
- id
- scope
- public java.util.Optional<com.hcl.domino.data.Document> getDocumentByUNID(com.hcl.domino.data.Database db, java.lang.String unid, KeepJnxSession.DocumentScope scope)
Returns a document from a database, including the option to return deleted documents, as deleted or restored
db
- unid
- scope
- public java.util.Optional<com.hcl.domino.data.Document> getDocumentByUNID(com.hcl.domino.data.Database db, java.lang.String unid, KeepJnxSession.DocumentScope scope, java.util.Set<com.hcl.domino.data.Database.OpenDocumentMode> options)
Returns a document from a database, including the option to return deleted documents, as deleted or restored
db
- unid
- scope
- options
- public com.hcl.domino.dxl.DxlImporter getDxlImporter()
Grab a DXL Importer
public java.lang.Object getItemValueForJson(com.hcl.domino.data.Document doc, com.hcl.domino.data.Item item)
Converts the item value into something suitable for JSON
doc
- item
- public KeepUser getUser()
public java.lang.String getUserName()
public io.vertx.core.json.JsonObject getViewRow(java.util.Map<java.lang.String,com.hcl.domino.data.CollectionColumn> columnMap, java.util.List<java.lang.String> columnNames, com.hcl.domino.data.CollectionEntry curEntry, boolean includeUnreadInfo)
Converts a NotesView Row into a JSON Object
columnMap
- columnNames
- curEntry
- includeUnreadInfo
- boolean include unread y/npublic KeepApplicationConfigInfo loadApplicationConfig(TheBarbican barbican, java.lang.String appId) throws KeepException
Finds a KeepApplication document for a specific appId and converts it to a KeepApplicationConfigInfo object
barbican
- appId
- to search forKeepException
public void mime2doc(@Nonnull com.hcl.domino.data.Document doc, @Nonnull java.lang.String message, @Nonnull java.util.List<java.lang.String> headerNames) throws java.io.IOException
Writes MIME content out into a Note By nature of Mime, Mime only gets appended, so we need to clear fields and most important the Body before commencing
doc
- message
- headerNames
- java.io.IOException
public java.lang.String modifyAndEvaluateFormula(java.lang.String formulaString, com.hcl.domino.data.Document doc, com.hcl.domino.data.Database db)
formulaString
- Formula to rundoc
- Document to evaluate the formula againstdb
- public com.hcl.domino.data.Formula.FormulaExecutionResult modifyAndExecuteFormula(java.lang.String formulaString, com.hcl.domino.data.Document doc, com.hcl.domino.data.Database db) throws java.lang.Exception
formulaString
- Formula to rundoc
- Document to evaluate the formula againstdb
- Host databasejava.lang.Exception
public java.lang.String modifyFormulaForUser(java.lang.String formula, com.hcl.domino.data.Document doc, com.hcl.domino.data.Database db)
formula
- doc
- db
- public boolean processItemRequired(com.hcl.domino.data.Item item, java.util.Map<java.lang.String,java.lang.String> fieldMap, java.util.TreeMap<java.lang.String,java.lang.Object> itemsAlreadyProcessed, java.util.Set<KeepJnxSession.Note2JsonOptions> options)
Determines if an item needs to be processed and converted into JSON
item
- the NoteItem to look at. Can be any typefieldMap
- the map with inclusion or exclusion values based on optionsitemsAlreadyProcessed
- Set of item names that we covered beforeoptions
- EnumSet with options to check @see KeepJnxSession.Notes2JsonOptionspublic void readDocToMIME(com.hcl.domino.data.Document doc, java.io.Writer writer, java.lang.Class<?> clazz) throws java.io.IOException
Reads the raw mime Stream from a NotesItem into a writer, based on options. The optional class is used
doc
- writer
- clazz
- java.io.IOException
public void readRawMIME(com.hcl.domino.data.Document doc, java.lang.String itemName, java.io.Writer writer, java.util.Set<com.hcl.domino.mime.MimeReader.ReadMimeDataType> options, java.lang.Class<?> clazz) throws java.io.IOException
Reads the raw mime Stream from a NotesItem into a writer, based on options. The optional class is used
doc
- itemName
- writer
- options
- clazz
- java.io.IOException
public com.hcl.domino.person.OutOfOffice startOOOOperation(java.lang.String userName, java.lang.String mailServer, boolean isMailServer, com.hcl.domino.data.Database db)
userName
- mailServer
- isMailServer
- db
- public void updateDocFromJson(io.vertx.core.json.JsonObject jsonSource, com.hcl.domino.data.Document doc)
Write fields into a pre-created document, without validation against a Form Access Mode. NOTE: This does not save the document
jsonSource
- doc
- public void validateAccessRequest(com.hcl.domino.data.Database db, com.hcl.domino.security.AclLevel minimumRequiredAclLevel, java.util.Set<AclAccessFlags> aclAccessFlags, java.util.Set<java.lang.String> accessRolesRequired) throws KeepException
db
- minimumRequiredAclLevel
- aclAccessFlags
- accessRolesRequired
- KeepException
- public com.hcl.domino.data.Document validateAttachmentAccessRequest(@Nonnull com.hcl.domino.data.Database db, @Nonnull java.lang.String unid, java.lang.String fileName, @Nonnull DocumentAccess docAccess) throws KeepException
Validates request for attachment reading / writing
db
- database from which to retrieve the attachmentunid
- UniversalID of the document containing or to contain the notefileName
- filename for the attachmentdocAccess
- whether AUTHOR / EDITOR access is requiredKeepException
- validation errorpublic com.hcl.domino.data.Document validateDocumentAccessRequest(com.hcl.domino.data.Database db, java.lang.String unid, DocumentAccess docAccess) throws KeepException
Validates the user has access to read and, if required, write the document Checks for the document directly, we presume ACL check has been done already if the document is protected by a reader field it will return a not found error
db
- Database containing the documentunid
- UniversalID of the documentdocAccess
- whether or not to check for write accessKeepException
- error if validation failspublic void validateFormAccessFormula(java.lang.String formula, com.hcl.domino.data.Document doc, java.lang.String apiName) throws KeepException
Validate the user has access to perform an action using a FormAccessMode, according to the DQL access formula in the KeepConfig
formula
- doc
- apiName
- KeepException
- error, e.g. not enough access or failure parsing formulapublic void writeRawMIME(com.hcl.domino.data.Document doc, java.io.Reader reader) throws java.io.IOException
doc
- reader
- java.io.IOException