11/************************************************
2- Copyright (c) 2015, 2018, 2021 by Progress Software Corporation. All rights reserved.
3- ************************************************ */
2+ Copyright (c) 2015, 2018, 2021, 2025 by Progress Software Corporation. All rights reserved.
3+ ************************************************ */
44/*------------------------------------------------------------------------
55 File : MultipartEntity
66 Purpose : Entity object representing a multi-part entity or message,
77 per http://www.ietf.org/rfc/rfc2046.txt
8- Syntax :
9- Description :
8+ Syntax :
9+ Description :
1010 Author(s) : pjudge
1111 Created : Tue May 19 14:50:22 EDT 2015
12- Notes :
12+ Notes :
1313 ---------------------------------------------------------------------- */
1414block-level on error undo , throw .
1515
@@ -19,132 +19,132 @@ using OpenEdge.Net.MessagePart.
1919using Progress.Lang.Object .
2020
2121class OpenEdge.Net.MultipartEntity implements ISupportMultipartEntity :
22-
22+
2323 /** The character string delimiting the parts. Excludes the leading and trailing -- */
2424 define public property Boundary as character no-undo
2525 get .
2626 set (input pBoundary as character ):
2727 Assert :NotNullOrEmpty (pBoundary , ' Multipart boundary' ).
2828 assign this-object :Boundary = pBoundary .
2929 end set .
30-
30+
3131 /** The number of parts */
3232 define public property Size as integer no-undo get . private set .
33-
33+
3434 /** Preamble text to be discarded/ignored. Kept for info purposes */
3535 define public property Prologue as character no-undo
3636 get .
3737 set (input pcPrologue as character ):
3838 Assert :NotNull (pcPrologue , ' Multipart prologue' ).
3939 assign this-object :Prologue = pcPrologue .
4040 end set .
41-
41+
4242 /** Epilogue text to be discarded/ignored. Kept for info purposes */
4343 define public property Epilogue as character no-undo
4444 get .
4545 set (input pcEpilogue as character ):
4646 Assert :NotNull (pcEpilogue , ' Multipart epilogue' ).
4747 assign this-object :Epilogue = pcEpilogue .
4848 end set .
49-
49+
5050 define private static temp-table ttPart no-undo
51- field ParentEntity as integer
51+ field ParentEntity as int64
5252 field PartNum as integer
5353 field Entity as Object /* OpenEdge.Net.MessagePart */
5454 index idx1 as primary unique ParentEntity PartNum .
55-
56-
55+
56+
5757 constructor MultipartEntity ():
5858 this-object :Boundary = guid .
5959 end constructor .
60-
60+
6161 destructor MultipartEntity ():
6262 ClearParts ().
6363 end destructor .
64-
64+
6565 /** Clears all the parts from this multipart entity */
6666 method public void ClearParts ():
6767 define buffer ttPart for ttPart .
68-
69- for each ttPart where ttPart.ParentEntity eq integer (this-object ):
68+
69+ for each ttPart where ttPart.ParentEntity eq int64 (this-object ):
7070 delete ttPart .
7171 end .
72-
72+
7373 assign this-object :Size = 0 .
7474 end method .
75-
75+
7676 /** Adds a part to this multi-part entity
77-
77+
7878 @param integer The part number being added.
7979 @param MessagePart The entity for the part
8080 @return logical True if the Part has replaced another part */
8181 method public logical SetPart (input piPartNum as integer ,
8282 input poEntity as MessagePart ):
8383 define variable lExists as logical no-undo .
8484 define buffer ttPart for ttPart .
85-
85+
8686 Assert :IsPositive (piPartNum , ' Part num' ).
8787 Assert :NotNull (poEntity , ' Entity' ).
88-
88+
8989 assign lExists = can-find (ttPart where
90- ttPart.ParentEntity eq integer (this-object ) and
91- ttPart.PartNum eq piPartNum ).
90+ ttPart.ParentEntity eq int64 (this-object ) and
91+ ttPart.PartNum eq piPartNum ).
9292 if lExists then
9393 find ttPart where
94- ttPart.ParentEntity eq integer (this-object ) and
94+ ttPart.ParentEntity eq int64 (this-object ) and
9595 ttPart.PartNum eq piPartNum
9696 no-error .
9797 else
9898 do :
9999 create ttPart .
100- assign ttPart.ParentEntity = integer (this-object )
100+ assign ttPart.ParentEntity = int64 (this-object )
101101 ttPart.PartNum = piPartNum
102-
102+
103103 this-object :Size = this-object :Size + 1 .
104- end .
105-
104+ end .
105+
106106 assign ttPart.Entity = poEntity .
107-
107+
108108 return lExists .
109109 end method .
110-
110+
111111 /** Adds a part to this multi-part entity
112-
112+
113113 @param MessagePart The entity for the part
114114 @return integer The part number being added. */
115115 method public integer AddPart (input poEntity as MessagePart ):
116116 define variable iPartNum as integer no-undo .
117-
117+
118118 assign iPartNum = this-object :Size + 1 .
119119 SetPart (iPartNum , poEntity ).
120-
120+
121121 return iPartNum .
122122 end method .
123123
124- /** Returns a part's content, selected by part number
125-
124+ /** Returns a part's content, selected by part number
125+
126126 @param integer The part number
127127 @return MessagePart The content */
128128 method public MessagePart GetPart (input piPartNumber as integer ):
129129 define buffer ttPart for ttPart .
130-
130+
131131 Assert :IsPositive (piPartNumber , ' Part num' ).
132-
132+
133133 if can-find (ttPart where
134- ttPart.ParentEntity eq integer (this-object ) and
135- ttPart.PartNum eq piPartNumber ) then
134+ ttPart.ParentEntity eq int64 (this-object ) and
135+ ttPart.PartNum eq piPartNumber ) then
136136 find ttPart where
137- ttPart.ParentEntity eq integer (this-object ) and
137+ ttPart.ParentEntity eq int64 (this-object ) and
138138 ttPart.PartNum eq piPartNumber
139139 no-error .
140140 if available ttPart then
141141 return cast (ttPart.Entity , MessagePart ).
142-
142+
143143 return ? .
144144 end method .
145-
145+
146146 /* Returns any parts that have the specified content-id.
147-
147+
148148 @param character A content ID to search by
149149 @return MessagePart[] An array of parts that have a content ID */
150150 method public MessagePart extent GetPart (input pcContentId as character ):
@@ -153,61 +153,61 @@ class OpenEdge.Net.MultipartEntity implements ISupportMultipartEntity:
153153 define variable cParts as character no-undo .
154154 define variable cDelimiter as character no-undo .
155155 define variable iMax as integer no-undo .
156-
156+
157157 define buffer ttPart for ttPart .
158-
158+
159159 Assert :NotNull (pcContentId , ' Content ID' ).
160-
160+
161161 assign cDelimiter = ' ' :u .
162-
163- for each ttPart where ttPart.ParentEntity eq integer (this-object ):
162+
163+ for each ttPart where ttPart.ParentEntity eq int64 (this-object ):
164164 if cast (ttPart.Entity , MessagePart ):ContentID eq pcContentId then
165165 assign cParts = cParts + cDelimiter + string (ttPart.PartNum )
166166 cDelimiter = ' ,' :u .
167167 end .
168-
168+
169169 assign iMax = num-entries (cParts , cDelimiter )
170170 extent (oPart ) = iMax
171171 /* in case iMax is 0 then we want to fail */
172172 no-error .
173-
173+
174174 do iLoop = 1 to iMax :
175175 find ttPart where
176- ttPart.ParentEntity eq integer (this-object ) and
176+ ttPart.ParentEntity eq int64 (this-object ) and
177177 ttPart.PartNum eq integer (entry (iLoop , cParts )) no-error .
178-
178+
179179 assign oPart [iLoop ] = cast (ttPart.Entity , MessagePart ).
180180 end .
181-
181+
182182 return oPart .
183183 end method .
184-
184+
185185 /** Removes a part (by number) and reorders the parts.
186-
186+
187187 @param integer The part number to remove
188188 @return logical True if the record was removed */
189189 method public logical RemovePart (input piPartNumber as integer ):
190190 define variable lExists as logical no-undo .
191191 define buffer ttPart for ttPart .
192192 define query qryParts for ttPart .
193-
193+
194194 Assert :IsPositive (piPartNumber , ' Part num' ).
195-
195+
196196 assign lExists = can-find (ttPart where
197- ttPart.ParentEntity eq integer (this-object ) and
198- ttPart.PartNum eq piPartNumber ).
197+ ttPart.ParentEntity eq int64 (this-object ) and
198+ ttPart.PartNum eq piPartNumber ).
199199 if lExists then
200200 do :
201201 find ttPart where
202- ttPart.ParentEntity eq integer (this-object ) and
202+ ttPart.ParentEntity eq int64 (this-object ) and
203203 ttPart.PartNum eq piPartNumber
204204 no-error .
205-
205+
206206 delete ttPart .
207207 assign this-object :Size = this-object :Size - 1 .
208-
208+
209209 open query qryParts preselect each ttPart where
210- ttPart.ParentEntity eq integer (this-object ) and
210+ ttPart.ParentEntity eq int64 (this-object ) and
211211 ttPart.PartNum gt piPartNumber .
212212 get first qryParts .
213213 do while available ttPart :
@@ -217,8 +217,8 @@ class OpenEdge.Net.MultipartEntity implements ISupportMultipartEntity:
217217 end .
218218 close query qryParts .
219219 end .
220-
220+
221221 return lExists .
222222 end method .
223-
223+
224224end class .
0 commit comments