Class: Notesgrip::NotesItem

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

Overview

NotesItem Class ==================

Direct Known Subclasses

NotesRichTextItem

Defined Under Namespace

Classes: NameError, RichFieldError

Constant Summary collapse

RICH_TYP =
1
DATE_TYP =
1024
ATTACHMENT_TYP =
1084
TEXT_TYP =
1280
NAME_TYP =
1074
ACTIONCD =

saved action CD records; non-Computable; canonical form.

16
ASSISTANTINFO =

saved assistant information; non-Computable; canonical form.

17
ATTACHMENT =

file attachment.

1084
AUTHORS =

authors.

1076
COLLATION =

COLLATION?

2
DATETIMES =

date-time value or range of date-time values.

1024
EMBEDDEDOBJECT =

embedded object.

1090
ERRORITEM =

an error occurred while accessing the type.

256
FORMULA =

Notes formula.

1536
HTML =

HTML source text.

21
ICON =

icon.

6
LSOBJECT =

saved LotusScript Object code for an agent.

20
MIME_PART =

MIME support.

25
NAMES =

names.

1074
7
NOTEREFS =

reference to the parent document.

4
NUMBERS =

number or number list.

768
OTHEROBJECT =

other object.

1085
QUERYCD =

saved query CD records; non-Computable; canonical form.

15
READERS =

readers.

1075
RFC822Text =

RFC822 Internet mail text.

1282
RICHTEXT =

rich text.

1
SIGNATURE =

signature.

8
TEXT =

text or text list.

1280
UNAVAILABLE =

the item type isn’t available.

512
UNKNOWN =

the item type isn’t known.

0
USERDATA =

user data.

14
USERID =

user ID name.

1792
VIEWMAPDATA =

saved ViewMap dataset; non-Computable; canonical form.

18
VIEWMAPLAYOUT =

saved ViewMap layout; non-Computable; canonical form.

19
ItemTypeDic =
{
  16=>'ACTIONCD', 17=>'ASSISTANTINFO', 1084=>'ATTACHMENT', 1076=>'AUTHORS', 2=>'COLLATION', 1024=>'DATETIMES', 
  1090=>'EMBEDDEDOBJECT', 256=>'ERRORITEM', 1536=>'FORMULA', 21=>'HTML', 6=>'ICON', 20=>'LSOBJECT', 25=>'MIME_PART', 
  1074=>'NAMES', 7=>'NOTELINKS', 4=>'NOTEREFS', 768=>'NUMBERS', 1085=>'OTHEROBJECT', 15=>'QUERYCD', 1075=>'READERS', 
  1282=>'RFC822Text', 1=>'RICHTEXT', 8=>'SIGNATURE', 1280=>'TEXT', 512=>'UNAVAILABLE', 0=>'UNKNOWN', 14=>'USERDATA', 
  1792=>'USERID', 18=>'VIEWMAPDATA', 19=>'VIEWMAPLAYOUT'
}

Instance Method Summary collapse

Methods inherited from GripWrapper

#initialize, #raw

Constructor Details

This class inherits a constructor from Notesgrip::GripWrapper

Dynamic Method Handling

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

Instance Method Details

#Abstract(maxAbstract = 1024, dropVowels = false, useDictionary = false) ⇒ Object



241
242
243
# File 'lib/notesgrip/NotesItem.rb', line 241

def Abstract(maxAbstract=1024, dropVowels=false, useDictionary=false)
  @raw_object.Abstract(maxAbstract, dropVowels, useDictionary)
end

#AppendToTextList(newValue) ⇒ Object



76
77
78
# File 'lib/notesgrip/NotesItem.rb', line 76

def AppendToTextList( newValue )
  @raw_object.AppendToTextList( newValue )
end

#Contains(value) ⇒ Object



245
246
247
# File 'lib/notesgrip/NotesItem.rb', line 245

def Contains(value)
  @raw_object.Contains(value)
end

#contains?(value) ⇒ Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/notesgrip/NotesItem.rb', line 80

def contains?(value)
  @raw_object.Contains(value)
end

#CopyItem(other_item) ⇒ Object



166
167
168
169
# File 'lib/notesgrip/NotesItem.rb', line 166

def CopyItem(other_item)
  parent_doc = self.Parent
  @raw_object = parent_doc.CopyItem(other_item, self.Name)
end

#CopyItemToDocument(otherDoc, newName = nil) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/notesgrip/NotesItem.rb', line 84

def CopyItemToDocument( otherDoc, newName=nil )
  unless newName
    newName = self.Name
  end
  raw_newItem = @raw_object.CopyItemToDocument( toRaw(otherDoc), newName )
  NotesItem.new(raw_newItem)
end

#DateTimeValueObject



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

def DateTimeValue
  raw_dateTimeVal = @raw_object.DateTimeValue
  raw_dateTimeVal ? NotesDateTime.new(raw_dateTimeVal) : nil
end

#each_valueObject



152
153
154
155
156
# File 'lib/notesgrip/NotesItem.rb', line 152

def each_value
  @raw_object.Values.each {|val|
    yield val
  }
end

#EmbeddedObjectsObject



158
159
160
# File 'lib/notesgrip/NotesItem.rb', line 158

def EmbeddedObjects
  []
end

#GetMIMEEntityObject



103
104
105
106
# File 'lib/notesgrip/NotesItem.rb', line 103

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

#GetValueCustomDataBytes(dataTypeName) ⇒ Object



249
250
251
# File 'lib/notesgrip/NotesItem.rb', line 249

def GetValueCustomDataBytes(dataTypeName)
  @raw_object.GetValueCustomDataBytes(dataTypeName)
end

#GetValueDateTimeArrayObject



92
93
94
95
96
97
98
99
100
101
# File 'lib/notesgrip/NotesItem.rb', line 92

def GetValueDateTimeArray()
  rawDateTimeArray = @raw_object.GetValueDateTimeArray()
  return nil unless rawDateTimeArray
  ret_list = []
  rawDateTimeArray.each {|rawDateTime|
    # ? How to distinct between NotesDateTime and NotesDateRange?
    ret_list.push NotesDateTime.new(rawDateTime)
    raise "Not Implement"
  }
end

#inspectObject



141
142
143
144
145
146
147
148
149
150
# File 'lib/notesgrip/NotesItem.rb', line 141

def inspect
  if self.Values == nil
    val = self.text
  elsif self.Values.size > 1
    val = self.Values
  else
    val = self.Text
  end
  "<#{self.class}, Type:#{ItemTypeDic[self.Type]}, #{self.name.inspect}=>#{val.inspect}>"
end

#IsAuthorsObject

———- Simple Relay Methods ———



172
173
174
# File 'lib/notesgrip/NotesItem.rb', line 172

def IsAuthors()
  @raw_object.IsAuthors()
end

#IsEncryptedObject



176
177
178
# File 'lib/notesgrip/NotesItem.rb', line 176

def IsEncrypted()
  @raw_object.IsEncrypted()
end

#IsEncrypted=(flag) ⇒ Object

Need to call NotesDocument#Encrypt() to encrypt NotesItem



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

def IsEncrypted=(flag)
  @raw_object.IsEncrypted = flag
end

#IsNamesObject



185
186
187
# File 'lib/notesgrip/NotesItem.rb', line 185

def IsNames()
  @raw_object.IsNames()
end

#IsNames=(flag) ⇒ Object



189
190
191
# File 'lib/notesgrip/NotesItem.rb', line 189

def IsNames=(flag)
  @raw_object.IsNames = flag
end

#IsProtectedObject



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

def IsProtected()
  @raw_object.IsProtected()
end

#IsProtected=(flag) ⇒ Object



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

def IsProtected=(flag)
  @raw_object.IsProtected = flag
end

#IsReadersObject



201
202
203
# File 'lib/notesgrip/NotesItem.rb', line 201

def IsReaders()
  @raw_object.IsReaders()
end

#IsReaders=(flag) ⇒ Object



205
206
207
# File 'lib/notesgrip/NotesItem.rb', line 205

def IsReaders=(flag)
  @raw_object.IsReaders = flag
end

#IsSignedObject



209
210
211
# File 'lib/notesgrip/NotesItem.rb', line 209

def IsSigned()
  @raw_object.IsSigned()
end

#IsSigned=(flag) ⇒ Object



213
214
215
# File 'lib/notesgrip/NotesItem.rb', line 213

def IsSigned=(flag)
  @raw_object.IsSigned = flag
end

#IsSummaryObject



217
218
219
# File 'lib/notesgrip/NotesItem.rb', line 217

def IsSummary()
  @raw_object.IsSummary()
end

#IsSummary=(flag) ⇒ Object



221
222
223
# File 'lib/notesgrip/NotesItem.rb', line 221

def IsSummary=(flag)
  @raw_object.IsSummary = flag
end

#LastModifiedObject



225
226
227
# File 'lib/notesgrip/NotesItem.rb', line 225

def LastModified()
  @raw_object.LastModified()
end

#NameObject



229
230
231
# File 'lib/notesgrip/NotesItem.rb', line 229

def Name()
  @raw_object.Name()
end

#ParentObject



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

def Parent
  NotesDocument.new(@raw_object.Parent)
end

#RemoveObject



108
109
110
111
# File 'lib/notesgrip/NotesItem.rb', line 108

def Remove
  @raw_object.Remove()
  @raw_object = nil
end

#SaveToDiskObject



233
234
235
# File 'lib/notesgrip/NotesItem.rb', line 233

def SaveToDisk()
  @raw_object.SaveToDisk()
end

#SaveToDisk=(flag) ⇒ Object



237
238
239
# File 'lib/notesgrip/NotesItem.rb', line 237

def SaveToDisk=(flag)
  @raw_object.SaveToDisk = flag
end

#SetValueCustomDataBytes(dataTypeName, byteArray) ⇒ Object



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

def SetValueCustomDataBytes(dataTypeName, byteArray)
  @raw_object.SetValueCustomDataBytes(dataTypeName, byteArray)
end

#TextObject



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

def Text
  @raw_object.text
end

#to_sObject



162
163
164
# File 'lib/notesgrip/NotesItem.rb', line 162

def to_s
  self.Text
end

#TypeObject



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

def Type
  @raw_object.Type
end

#ValueLengthObject Also known as: length



64
65
66
# File 'lib/notesgrip/NotesItem.rb', line 64

def ValueLength
  @raw_object.ValueLength
end

#ValuesObject Also known as: values



70
71
72
# File 'lib/notesgrip/NotesItem.rb', line 70

def Values
  @raw_object.Values
end

#Values=(item_value) ⇒ Object Also known as: text=

—– Additional Methods —-



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/notesgrip/NotesItem.rb', line 114

def Values=(item_value)
  # @raw_object.Type returns data type of field(ex: RICH_TYP,DATE_TYP...)
  case @raw_object.Type
  when RICH_TYP
    val_array = [item_value].flatten
    raw_doc = self.Parent.raw
    item_name = @raw_object.Name
    raw_doc.RemoveItem(item_name)
    new_item = raw_doc.CreateRichTextItem( item_name )
    @raw_object = new_item.AppendText(val_array.join(""))
  else
    val_array = [item_value].flatten
    raw_doc = self.Parent.raw
    item_name = @raw_object.Name
    raw_newitem = raw_doc.ReplaceItemValue(item_name, val_array)
    @raw_object = raw_newitem   # replace @raw_object
  end
end