Class: Notesgrip::NotesDocument

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

Overview

NotesDocument Class ================

Instance Method Summary collapse

Methods inherited from GripWrapper

#raw

Constructor Details

#initialize(raw_doc) ⇒ NotesDocument

Returns a new instance of NotesDocument.



6
7
8
9
10
# File 'lib/notesgrip/NotesDocument.rb', line 6

def initialize(raw_doc)
  super(raw_doc)
  @parent_db = nil
  @parent_view = nil
end

Dynamic Method Handling

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

Instance Method Details

#[](itemname) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/notesgrip/NotesDocument.rb', line 146

def [](itemname)
  if @raw_object.HasItem(itemname)
    raw_item = @raw_object.GetFirstItem(itemname)
  else
    # If this document hasn't itemname field, create new item.
    raw_item = @raw_object.AppendItemValue(itemname, "")
  end
  if raw_item.Type == NotesItem::RICHTEXT
    NotesRichTextItem.new(raw_item)
  else
    NotesItem.new(raw_item)
  end
end

#[]=(itemname, other_item) ⇒ Object

Copy Field



161
162
163
164
165
166
167
168
169
# File 'lib/notesgrip/NotesDocument.rb', line 161

def []=(itemname, other_item)
  if @raw_object.HasItem(itemname)
    @raw_object.RemoveItem(itemname)
  end
  
  raw_otherItem = toRaw(other_item)
  raw_item = @raw_object.CopyItem(raw_otherItem, itemname)
  NotesItem.new(raw_item)
end

#AppendItemValue(itemName, value) ⇒ Object



47
48
49
50
# File 'lib/notesgrip/NotesDocument.rb', line 47

def AppendItemValue( itemName, value )
  raw_item = @raw_object.AppendItemValue( itemName, value )
  NotesItem.new(raw_item)
end

#AttachVCard(clientADTObject) ⇒ Object



52
53
54
55
# File 'lib/notesgrip/NotesDocument.rb', line 52

def AttachVCard( clientADTObject )
  raw_obj = toRaw(clientADTObject)
  @raw_object.AttachVCard(raw_obj)
end

#CopyAllItems(sourceDoc, replace = false) ⇒ Object



57
58
59
60
# File 'lib/notesgrip/NotesDocument.rb', line 57

def CopyAllItems( sourceDoc, replace=false )
  raw_sourceDoc = toRaw(sourceDoc)
  @raw_object.CopyAllItems( raw_sourceDoc, replace)
end

#CopyItem(sourceItem, newName = nil) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/notesgrip/NotesDocument.rb', line 62

def CopyItem( sourceItem, newName=nil )
  raw_sourceItem = toRaw(sourceItem)
  unless newName
    newName = sourceItem.Name
  end
  raw_item = @raw_object.CopyItem(raw_sourceItem, newName)
  NotesItem.new(raw_item)
end

#CopyToDatabase(destDatabase) ⇒ Object



71
72
73
74
75
# File 'lib/notesgrip/NotesDocument.rb', line 71

def CopyToDatabase( destDatabase )
  raw_destDB = toRaw(destDatabase)
  new_rawDoc = @raw_object.CopyToDatabase( raw_destDB )
  NotesDocument.new(new_rawDoc)
end

#CreateMIMEEntity(itemName) ⇒ Object



77
78
79
80
# File 'lib/notesgrip/NotesDocument.rb', line 77

def CreateMIMEEntity( itemName )
  raw_mimeEntry = @raw_object.CreateMIMEEntity( itemName )
  NotesMIMEEntity.new(raw_mimeEntry)
end

#CreateReplyMessage(all) ⇒ Object



82
83
84
85
# File 'lib/notesgrip/NotesDocument.rb', line 82

def CreateReplyMessage( all )
  raw_replyDoc = @raw_object.CreateReplyMessage( all )
  NotesDocument.new(raw_replyDoc)
end

#CreateRichTextItem(name) ⇒ Object



87
88
89
90
# File 'lib/notesgrip/NotesDocument.rb', line 87

def CreateRichTextItem( name )
  raw_richTextItem = @raw_object.CreateRichTextItem( name )
  NotesRichTextItem.new(raw_richTextItem)
end

#each_itemObject



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

def each_item
  self.Items.each {|notes_item|
    yield notes_item
  }
end

#EmbeddedObjectsObject



12
13
14
15
16
17
18
19
# File 'lib/notesgrip/NotesDocument.rb', line 12

def EmbeddedObjects
  raw_embeddedObjects = @raw_object.EmbeddedObjects
  ret_list = []
  raw_embeddedObjects.each {|raw_embeddedObject|
    ret_list.push NotesEmbeddedObject.new(raw_embeddedObject)
  }
  ret_list
end

#GetAttachment(fileName) ⇒ Object



92
93
94
95
# File 'lib/notesgrip/NotesDocument.rb', line 92

def GetAttachment( fileName )
  raw_embeddedObject = @raw_object.GetAttachment( fileName )
  raw_embeddedObject ? NotesEmbeddedObject.new(raw_embeddedObject) : nil
end

#GetFirstItem(name) ⇒ Object



97
98
99
100
# File 'lib/notesgrip/NotesDocument.rb', line 97

def GetFirstItem( name )
  raw_item = @raw_object.GetFirstItem( name )
  raw_item ? NotesItem.new(raw_item) : nil
end

#GetItemValue(itemName) ⇒ Object



102
103
104
# File 'lib/notesgrip/NotesDocument.rb', line 102

def GetItemValue( itemName )
  @raw_object.GetItemValue( itemName )
end

#GetItemValueCustomDataBytes(itemName, dataTypeName) ⇒ Object



106
107
108
# File 'lib/notesgrip/NotesDocument.rb', line 106

def GetItemValueCustomDataBytes( itemName, dataTypeName )
  @raw_object.GetItemValueCustomDataBytes( itemName, dataTypeName )
end

#GetItemValueDateTimeArray(itemName) ⇒ Object



110
111
112
113
114
115
116
# File 'lib/notesgrip/NotesDocument.rb', line 110

def GetItemValueDateTimeArray( itemName )
  obj_list = @raw_object.GetItemValueDateTimeArray( itemName )
  ret_list = []
  obj_list.each {|date_obj|
    ret_list.push NotesDateTime.new(date_obj)
  }
end

#GetMIMEEntity(itemName) ⇒ Object



118
119
120
121
# File 'lib/notesgrip/NotesDocument.rb', line 118

def GetMIMEEntity( itemName )
  raw_mimeEntry = @raw_object.GetMIMEEntity( itemName )
  raw_mimeEntry ? NotesMIMEEntity.new(raw_mimeEntry) : nil
end

#inspectObject



181
182
183
# File 'lib/notesgrip/NotesDocument.rb', line 181

def inspect
  "<#{self.class}, Form:#{self['Form'].text.inspect}>"
end

#ItemsObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/notesgrip/NotesDocument.rb', line 21

def Items
  ret_list = []
  @raw_object.Items.each {|raw_item|
    if raw_item.Type == NotesItem::RICHTEXT
      ret_list.push NotesRichTextItem.new(raw_item)
    else
      ret_list.push NotesItem.new(raw_item)
    end
  }
  ret_list
end

#MakeResponse(document) ⇒ Object



123
124
125
# File 'lib/notesgrip/NotesDocument.rb', line 123

def MakeResponse( document )
  NotesDocument.new(toRaw(document))
end

#ParentDatabaseObject



33
34
35
# File 'lib/notesgrip/NotesDocument.rb', line 33

def ParentDatabase
  NotesDatabase.new(@raw_object.ParentDatabase)
end

#ParentViewObject



37
38
39
40
# File 'lib/notesgrip/NotesDocument.rb', line 37

def ParentView
  raw_view = @raw_object.ParentView
  raw_view ? NotesView(raw_view) : nil
end

#RenderToRTItem(notesRichTextItem) ⇒ Object



127
128
129
130
# File 'lib/notesgrip/NotesDocument.rb', line 127

def RenderToRTItem( notesRichTextItem )
  raw_richTextItem = toRaw(notesRichTextItem)
  @raw_object.RenderToRTItem(raw_richTextItem)
end

#ReplaceItemValue(itemName, value) ⇒ Object



132
133
134
135
# File 'lib/notesgrip/NotesDocument.rb', line 132

def ReplaceItemValue( itemName, value )
  raw_item = @raw_object.ReplaceItemValue( itemName, value )
  NotesItem.new(raw_item)      
end

#ReplaceItemValueCustomDataBytes(itemName, dataTypeName, byteArray) ⇒ Object



137
138
139
# File 'lib/notesgrip/NotesDocument.rb', line 137

def ReplaceItemValueCustomDataBytes( itemName, dataTypeName, byteArray )
  @raw_object.ReplaceItemValueCustomDataBytes( itemName, dataTypeName, byteArray )
end

#ResponsesObject



42
43
44
45
# File 'lib/notesgrip/NotesDocument.rb', line 42

def Responses
  raw_docCollection = @raw_object.Responses
  NotesDocumentCollection.new(raw_docCollection)
end

#save(force = true, createResponse = false, markRead = false) ⇒ Object



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

def save(force=true, createResponse=false , markRead = false)
  @raw_object.Save(force, createResponse, markRead)
end

#unidObject

—- Additional Methods ——



142
143
144
# File 'lib/notesgrip/NotesDocument.rb', line 142

def unid
  @raw_object.UniversalID
end