Class: Notesgrip::NotesDatabase

Inherits:
GripWrapper show all
Defined in:
lib/notesgrip/NotesDatabase.rb

Overview

NotesDatabase Class ===============

Constant Summary collapse

ACLLEVEL_NOACCESS =
0
ACLLEVEL_DEPOSITOR =
1
ACLLEVEL_READER =
2
ACLLEVEL_AUTHOR =
3
ACLLEVEL_EDITOR =
4
ACLLEVEL_DESIGNER =
5
ACLLEVEL_MANAGER =
6
CMPC_ARCHIVE_DELETE_COMPACT =

archive and delete, then compact

1
CMPC_ARCHIVE_DELETE_ONLY =

archive and delete with no compact; supersedes a

2
CMPC_CHK_OVERLAP =

check overlap

32768
CMPC_COPYSTYLE =

copy style; supersedes b and B

16
CMPC_DISABLE_DOCTBLBIT_OPTMZN =

disable document table bit map optimization

128
CMPC_DISABLE_LARGE_UNKTBL =

disable large unknown table

4096
CMPC_DISABLE_RESPONSE_INFO =

disable “Don’t support specialized response hierarchy”

512
CMPC_DISABLE_TRANSACTIONLOGGING =

disable transaction logging

262144
CMPC_DISABLE_UNREAD_MARKS =

disable “Don’t maintain unread marks”

1048576
CMPC_DISCARD_VIEW_INDICES =

discard view indexes

32
CMPC_ENABLE_DOCTBLBIT_OPTMZN =

enable document table bit map optimization; supersedes f

64
CMPC_ENABLE_LARGE_UNKTBL =

enable large unknown table; supersedes k

2048
CMPC_ENABLE_RESPONSE_INFO =

enable “Don’t support specialized response hierarchy”; supersedes H

256
CMPC_ENABLE_TRANSACTIONLOGGING =

enable transaction logging; supersedes t

131072
CMPC_ENABLE_UNREAD_MARKS =

enable “Don’t maintain unread marks”; supersedes U

524288
CMPC_IGNORE_COPYSTYLE_ERRORS =

ignore copy-style errors

1024
CMPC_MAX_4GB =

set maximum database size at 4 gigabytes

16384
CMPC_NO_LOCKOUT =

do not lock out users

8192
CMPC_RECOVER_INPLACE =

recover unused space in-place and reduce file size; supersedes b

8
CMPC_RECOVER_REDUCE_INPLACE =

recover unused space in-place without reducing file size

4
CMPC_REVERT_FILEFORMAT =

do not convert old file format

65536
FTINDEX_ALL_BREAKS =

index sentence and paragraph breaks

4
FTINDEX_ATTACHED_BIN_FILES =

index attached files (binary)

16
FTINDEX_ATTACHED_FILES =

index attached files (raw text)

1
FTINDEX_CASE_SENSITIVE =

enable case-sensitive searches

8
FTINDEX_ENCRYPTED_FIELDS =

index encrypted fields

2
FIXUP_INCREMENTAL =

checks only documents since last Fixup

4
FIXUP_NODELETE =

prevents Fixup from deleting corrupted documents

16
FIXUP_NOVIEWS =

does not check views

64
FIXUP_QUICK =

checks documents more quickly but less thoroughly

2
FIXUP_REVERT =

reverts ID tables to the previous release format

32
FIXUP_TXLOGGED =

includes databases enabled for transaction logging

8
FIXUP_VERIFY =

makes no modifications

1
FT_DATE_ASC =

Constant for FTSearch

64
FT_DATE_DES =

sorts by document creation date in ascending order.

32
FT_SCORES =

sorts by document creation date in descending order.

8
FT_DATABASE =

sorts by relevance score (default).

8192
FT_FUZZY =

includes Domino databases.

16384
FT_FILESYSTEM =

searches for related words. Need not be an exact match.

4096
FT_STEMS =

includes files that are not Domino databases.

512
FT_THESAURUS =

uses stem words as the basis of the search.

1024
DBMOD_DOC_ACL =
64
DBMOD_DOC_AGENT =
512
DBMOD_DOC_ALL =
32767
DBMOD_DOC_DATA =
1
DBMOD_DOC_FORM =
4
DBMOD_DOC_HELP =
256
DBMOD_DOC_ICON =
16
DBMOD_DOC_REPLFORMULA =
2048
DBMOD_DOC_SHAREDFIELD =
1024
DBMOD_DOC_VIEW =
8
DBOPT_LZCOMPRESSION =

uses LZ1 compression for attachments

65
DBOPT_MAINTAINLASTACCESSED =

maintains LastAccessed property

44
DBOPT_MOREFIELDS =

allows more fields in database

54
DBOPT_NOHEADLINEMONITORS =

doesn’t allow headline monitoring

46
DBOPT_NOOVERWRITE =

doesn’t overwrite free space

36
DBOPT_NORESPONSEINFO =

doesn’t support specialized response hierarchy

38
DBOPT_NOTRANSACTIONLOGGING =

disables transaction logging

45
DBOPT_NOUNREAD =

doesn’t maintain unread marks

37
DBOPT_OPTIMIZATION =

enables document table bitmap optimization

41
DBOPT_REPLICATEUNREADMARKSTOANY =

replicates unread marks to all servers

71
DBOPT_REPLICATEUNREADMARKSTOCLUSTER =

replicates unread marks to clustered servers only

70
DBOPT_SOFTDELETE =

allows soft deletions

49

Instance Method Summary collapse

Methods inherited from GripWrapper

#raw

Constructor Details

#initialize(raw_object) ⇒ NotesDatabase

Returns a new instance of NotesDatabase.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/notesgrip/NotesDatabase.rb', line 6

def initialize(raw_object)
  super(raw_object)
  # auto open Database 
  unless @raw_object.isOpen
    begin
      @raw_object.Open("","")
    rescue WIN32OLERuntimeError
      # unable access DataBase
    end
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Notesgrip::GripWrapper

Instance Method Details

#ACLObject



18
19
20
# File 'lib/notesgrip/NotesDatabase.rb', line 18

def ACL
  NotesACL.new(@raw_object.ACL)
end

#ACLActivityLogObject



22
23
24
# File 'lib/notesgrip/NotesDatabase.rb', line 22

def ACLActivityLog
  @raw_object.ACLActivityLog()
end

#AgentsObject



26
27
28
29
30
31
32
33
34
# File 'lib/notesgrip/NotesDatabase.rb', line 26

def Agents
  agent_arr = @raw_object.Agents
  return [] unless agent_arr  # Case of No Agent in database
  ret_list = []
  agent_arr.each {|raw_agent|
    ret_list.push NotesAgent.new(raw_agent)
  }
  ret_list
end

#AllDocumentsObject



36
37
38
# File 'lib/notesgrip/NotesDatabase.rb', line 36

def AllDocuments
  NotesDocumentCollection.new(@raw_object.AllDocuments)
end

#CompactWithOptions(options) ⇒ Object



95
96
97
# File 'lib/notesgrip/NotesDatabase.rb', line 95

def CompactWithOptions( options )
  @raw_object.CompactWithOptions( options )
end

#CreateCopy(newServer, newDbFile, maxsize = 4) ⇒ Object



99
100
101
102
# File 'lib/notesgrip/NotesDatabase.rb', line 99

def CreateCopy( newServer, newDbFile , maxsize=4 )
  db = @raw_object.CreateCopy( newServer, newDbFile , maxsize )
  NotesDatabase.new(db)
end

#CreateDocument(formName = nil) ⇒ Object



104
105
106
107
108
109
110
111
112
# File 'lib/notesgrip/NotesDatabase.rb', line 104

def CreateDocument(formName=nil)
  raw_doc = @raw_object.CreateDocument()
  new_doc = raw_doc ? NotesDocument.new(raw_doc) : nil
  if new_doc and formName
    new_doc.AppendItemValue('Form', formName)
    #new_doc['Form'].Values =  formName
  end
  new_doc
end

#CreateFromTemplate(newServer, newDbFile, inheritFlag, maxsize = 4) ⇒ Object



114
115
116
117
# File 'lib/notesgrip/NotesDatabase.rb', line 114

def CreateFromTemplate( newServer, newDbFile, inheritFlag, maxsize=4 )
  db = @raw_object.CreateFromTemplate( newServer, newDbFile, inheritFlag, maxsize )
  NotesDatabase.new(db)
end

#CreateFTIndex(options, recreate = false) ⇒ Object



125
126
127
# File 'lib/notesgrip/NotesDatabase.rb', line 125

def CreateFTIndex( options , recreate=false )
  @raw_object.CreateFTIndex( options , recreate )
end

#CreateNoteCollection(selectAllFlag = false) ⇒ Object



129
130
131
132
# File 'lib/notesgrip/NotesDatabase.rb', line 129

def CreateNoteCollection( selectAllFlag = false)
  raw_notesNotesCollection = @raw_object.CreateNoteCollection( selectAllFlag)
  NotesNoteCollection.new(raw_notesNotesCollection)
end

#CreateOutline(outlinename, defaultOutline = false) ⇒ Object



134
135
136
137
# File 'lib/notesgrip/NotesDatabase.rb', line 134

def CreateOutline( outlinename, defaultOutline=false )
  raw_outline = @raw_object.CreateOutline( outlinename, defaultOutline)
  NotesOutline.new(raw_outline)
end

#CreateReplica(newServer, newDbFile) ⇒ Object



139
140
141
142
# File 'lib/notesgrip/NotesDatabase.rb', line 139

def CreateReplica( newServer, newDbFile )
  raw_db = @raw_object.CreateReplica( newServer, newDbFile )
  raw_doc ? NotesDocument.new(raw_doc) : nil
end

#CreateView(viewName = nil, viewSelectionFormula = nil, templateView = nil, prohibitDesignRefreshModifications = false) ⇒ Object



144
145
146
147
# File 'lib/notesgrip/NotesDatabase.rb', line 144

def CreateView( viewName=nil, viewSelectionFormula=nil, templateView=nil, prohibitDesignRefreshModifications=false )
  raw_view = @raw_object.CreateView( viewName, viewSelectionFormula, templateView, prohibitDesignRefreshModifications )
  NotesView.new(raw_view)
end

#each_agentObject



325
326
327
328
329
# File 'lib/notesgrip/NotesDatabase.rb', line 325

def each_agent
  self.Agents.each {|agent|
    yield agent
  }
end

#each_documentObject



304
305
306
307
308
309
# File 'lib/notesgrip/NotesDatabase.rb', line 304

def each_document
  doc_collection = self.AllDocuments
  doc_collection.each {|doc|
    yield doc
  }
end

#each_formObject



318
319
320
321
322
323
# File 'lib/notesgrip/NotesDatabase.rb', line 318

def each_form
  form_collection = self.Forms
  form_collection.each {|form|
    yield form
  }
end

#each_profileObject



331
332
333
334
335
# File 'lib/notesgrip/NotesDatabase.rb', line 331

def each_profile
  self.GetProfileDocCollection.each {|profileDoc|
    yield profileDoc
  }
end

#each_viewObject



311
312
313
314
315
316
# File 'lib/notesgrip/NotesDatabase.rb', line 311

def each_view
  view_collection = self.Views
  view_collection.each {|view|
    yield view
  }
end

#Fixup(options) ⇒ Object



157
158
159
# File 'lib/notesgrip/NotesDatabase.rb', line 157

def Fixup(options)
  @raw_object.Fixup(options)
end

#FormsObject



48
49
50
51
52
53
54
# File 'lib/notesgrip/NotesDatabase.rb', line 48

def Forms
  ret_list = []
  @raw_object.Forms.each {|raw_form|
    ret_list.push NotesForm.new(raw_form)
  }
  ret_list
end

#FTDomainSearch(query, maxDocs = 0, sortoptions = FT_SCORES, otheroptions = 0, start = 0, count = 1, entryform = "") ⇒ Object

uses thesaurus synonyms.



171
172
173
174
175
# File 'lib/notesgrip/NotesDatabase.rb', line 171

def FTDomainSearch( query, maxDocs=0, sortoptions=FT_SCORES, otheroptions=0, start=0, count=1, entryform="" )
  #raw_doc = @raw_object.FTDomainSearch( query, maxDocs, sortoptions, otheroptions, start, count, entryform )
  #raw_doc ? NotesDocument.new(raw_doc) : nil
  raise "FTDomainSearch() is not work."
end

#FTSearch(query, maxdocs = 0, sortoptions = FT_SCORES, otheroptions = 0) ⇒ Object



177
178
179
180
# File 'lib/notesgrip/NotesDatabase.rb', line 177

def FTSearch( query, maxdocs=0, sortoptions=FT_SCORES, otheroptions=0 )
  raw_docCollection = @raw_object.FTSearch( query, maxdocs, sortoptions, otheroptions)
  NotesDocumentCollection.new(raw_docCollection)
end

#FTSearchRange(query, maxdocs = 0, sortoptions = FT_SCORES, otheroptions = 0, start = 0) ⇒ Object



182
183
184
185
# File 'lib/notesgrip/NotesDatabase.rb', line 182

def FTSearchRange( query, maxdocs=0, sortoptions=FT_SCORES, otheroptions=0, start=0 )
  raw_docCollection = @raw_object.FTSearchRange( query, maxdocs, sortoptions, otheroptions, start)
  NotesDocumentCollection.new(raw_docCollection)
end

#GetAgent(agentName) ⇒ Object



187
188
189
190
# File 'lib/notesgrip/NotesDatabase.rb', line 187

def GetAgent( agentName )
  raw_agent = @raw_object.GetAgent(agentName)
  NotesAgent.new(raw_agent)
end

#GetAllReadDocuments(username = nil) ⇒ Object



192
193
194
195
# File 'lib/notesgrip/NotesDatabase.rb', line 192

def GetAllReadDocuments( username=nil )
  raw_docCollection = @raw_object.GetAllReadDocuments(username)
  NotesDocumentCollection.new(raw_docCollection)
end

#GetAllUnreadDocuments(username = nil) ⇒ Object



197
198
199
200
# File 'lib/notesgrip/NotesDatabase.rb', line 197

def GetAllUnreadDocuments( username=nil )
  raw_docCollection = @raw_object.GetAllUnreadDocuments(username)
  NotesDocumentCollection.new(raw_docCollection)
end

#GetDocumentByID(noteID) ⇒ Object



202
203
204
205
# File 'lib/notesgrip/NotesDatabase.rb', line 202

def GetDocumentByID( noteID )
  raw_doc = @raw_object.GetDocumentByID( noteID )
  raw_doc ? NotesDocument.new(raw_doc) : nil
end

#GetDocumentByUNID(unid) ⇒ Object



207
208
209
210
# File 'lib/notesgrip/NotesDatabase.rb', line 207

def GetDocumentByUNID(unid)
  raw_doc = @raw_object.GetDocumentByUNID(unid)
  raw_doc ? NotesDocument.new(raw_doc) : nil
end

#GetDocumentByURL(url, reload = 0, urllist = 0, charset = "", webusername = "", webpassword = nil, proxywebusername = nil, proxywebpassword = nil, returnimmediately = false) ⇒ Object



212
213
214
215
216
# File 'lib/notesgrip/NotesDatabase.rb', line 212

def GetDocumentByURL( url, reload=0, urllist=0, charset="", webusername="", webpassword=nil, proxywebusername=nil, proxywebpassword=nil, returnimmediately=false )
  #raw_doc = @raw_object.GetDocumentByURL( url, reload, urllist, charset, webusername, webpassword, proxywebusername, proxywebpassword, returnimmediately )
  #raw_doc ? NotesDocument.new(raw_doc) : nil
  raise "GetDocumentByURL() is not Work"
end

#GetForm(name) ⇒ Object



218
219
220
221
# File 'lib/notesgrip/NotesDatabase.rb', line 218

def GetForm( name )
  raw_form = @raw_object.GetForm(name)
  raw_form ? NotesForm.new(raw_form) : nil
end

#GetModifiedDocuments(since = nil, noteClass = DBMOD_DOC_DATA) ⇒ Object



234
235
236
237
238
# File 'lib/notesgrip/NotesDatabase.rb', line 234

def GetModifiedDocuments( since=nil , noteClass=DBMOD_DOC_DATA )
  #raw_docCollection = @raw_object.GetModifiedDocuments( since, noteClass)
  #NotesDocumentCollection.new(raw_docCollection)
  raise "GetModifiedDocuments() is not work."
end

#GetOption(optionName) ⇒ Object



253
254
255
# File 'lib/notesgrip/NotesDatabase.rb', line 253

def GetOption(optionName)
  @raw_object.GetOption(optionName)
end

#GetOutline(outlinename) ⇒ Object



261
262
263
264
265
# File 'lib/notesgrip/NotesDatabase.rb', line 261

def GetOutline( outlinename )
  #raw_outline = @raw_object.GetOutline( outlinename )
  #NotesOutline.new(raw_outline)
  raise "GetOutline is not work."
end

#GetProfileDocCollection(profilename = nil) ⇒ Object



267
268
269
270
# File 'lib/notesgrip/NotesDatabase.rb', line 267

def GetProfileDocCollection( profilename=nil )
  raw_docCollection = @raw_object.GetProfileDocCollection( profilename )
  NotesDocumentCollection.new(raw_docCollection)
end

#GetProfileDocument(profilename, uniqueKey = nil) ⇒ Object



272
273
274
275
# File 'lib/notesgrip/NotesDatabase.rb', line 272

def GetProfileDocument( profilename, uniqueKey=nil )
  raw_document = @raw_object.GetProfileDocument( profilename, uniqueKey)
  raw_document ? NotesDocument.new(raw_document) : nil
end

#GetView(viewName) ⇒ Object Also known as: view



277
278
279
280
# File 'lib/notesgrip/NotesDatabase.rb', line 277

def GetView( viewName )
  raw_view = @raw_object.GetView( viewName )
  raw_view ? NotesView.new(raw_view) : nil
end

#inspectObject



337
338
339
# File 'lib/notesgrip/NotesDatabase.rb', line 337

def inspect
  "<#{self.class}, Name:#{self.name.inspect}, FilePath:#{self.FilePath.inspect}>"
end

#nameObject

—- Additional Methods ——



296
297
298
# File 'lib/notesgrip/NotesDatabase.rb', line 296

def name
  @raw_object.Title
end

#open?Boolean

Returns:

  • (Boolean)


300
301
302
# File 'lib/notesgrip/NotesDatabase.rb', line 300

def open?()
  @raw_object.IsOpen()
end

#ParentObject



56
57
58
# File 'lib/notesgrip/NotesDatabase.rb', line 56

def Parent()
  NotesSession.new()
end

#ReplicationInfoObject



60
61
62
# File 'lib/notesgrip/NotesDatabase.rb', line 60

def ReplicationInfo
  NotesReplication.new(@raw_object.NotesReplication)
end

#Search(formula, notesDateTime = nil, maxDocs = 0) ⇒ Object



283
284
285
286
287
# File 'lib/notesgrip/NotesDatabase.rb', line 283

def Search( formula, notesDateTime=nil, maxDocs=0 )
  #raw_docCollection = @raw_object.Search( formula, notesDateTime, maxDocs )
  #NotesDocumentCollection.new(raw_docCollection)
  raise "Search() is not work."
end

#SetOption(optionName, flag) ⇒ Object



257
258
259
# File 'lib/notesgrip/NotesDatabase.rb', line 257

def SetOption( optionName, flag )
  @raw_object.SetOption(optionName, flag)
end

#UnprocessedFTSearch(query, maxdocs = 0, sortoptions = nil, otheroptions = nil) ⇒ Object



289
290
291
292
293
# File 'lib/notesgrip/NotesDatabase.rb', line 289

def UnprocessedFTSearch(query, maxdocs=0, sortoptions=nil, otheroptions=nil )
  #raw_docCollection = @raw_object.UnprocessedFTSearch(query, maxdocs, sortoptions, otheroptions )
  #NotesDocumentCollection.new(raw_docCollection)
  raise "UnprocessedFTSearch() is not work."
end

#ViewsObject



64
65
66
67
68
69
70
71
72
# File 'lib/notesgrip/NotesDatabase.rb', line 64

def Views
  ret_list = []
  raw_views = @raw_object.Views
  return [] unless raw_views
  raw_views.each {|raw_view|
    ret_list.push NotesView.new(raw_view)
  }
  ret_list
end