1909: str_buffer := str_buffer || g_newLine;
1910:
1911: if(length(str_buffer) > 24000) then
1912: str_buffer := UrlEncode(str_buffer);
1913: DBMS_LOB.writeAppend(lob_loc => doc,
1914: amount => length(str_buffer),
1915: buffer => str_buffer);
1916: str_buffer := '';
1917: end if;
1915: buffer => str_buffer);
1916: str_buffer := '';
1917: end if;
1918:
1919: -- DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob,
1920: -- length(str_buffer),
1921: -- str_buffer);
1922: -- str_buffer := '';
1923:
1923:
1924: end loop;
1925: if(length(str_buffer) > 0) then
1926: str_buffer := UrlEncode(str_buffer);
1927: DBMS_LOB.writeAppend(lob_loc => doc,
1928: amount => length(str_buffer),
1929: buffer => str_buffer);
1930: str_buffer := '';
1931: end if;
1928: amount => length(str_buffer),
1929: buffer => str_buffer);
1930: str_buffer := '';
1931: end if;
1932: -- DBMS_LOB.Append(doc, g_LOBTable(bufferIdx).temp_lob);
1933: -- wf_temp_lob.releaseLob(g_LOBTable, bufferIdx);
1934:
1935: exception
1936: when others then
3267: tokenFound boolean;
3268:
3269: begin
3270:
3271: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3272: tempIdx := -1;
3273:
3274: offset := 1;
3275: sourcePos := 1;
3274: offset := 1;
3275: sourcePos := 1;
3276: targetPos := 1;
3277: continue := TRUE;
3278: msgLen := DBMS_LOB.GetLength(message);
3279: tokenLen := length(token);
3280: tokenFound := FALSE;
3281:
3282: while continue
3281:
3282: while continue
3283: loop
3284:
3285: pos := DBMS_LOB.Instr(message, token, offset, 1);
3286: if (pos <> 0) then
3287: if (pos + tokenLen <= msgLen) then
3288: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3289: if (instr(xSet, nextChar,1,1) > 0) then
3284:
3285: pos := DBMS_LOB.Instr(message, token, offset, 1);
3286: if (pos <> 0) then
3287: if (pos + tokenLen <= msgLen) then
3288: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3289: if (instr(xSet, nextChar,1,1) > 0) then
3290: validToken := false;
3291: else
3292: validToken := true;
3306: if tempIdx = -1 then
3307: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3308: end if;
3309: amount := pos - sourcePos;
3310: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3311: src_lob => message,
3312: amount => amount,
3313: dest_offset => targetPos,
3314: src_offset => sourcePos);
3312: amount => amount,
3313: dest_offset => targetPos,
3314: src_offset => sourcePos);
3315: if (tokenValue <> '' or tokenValue is not null) then
3316: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3317: length(tokenValue), tokenValue);
3318: end if;
3319: sourcePos := pos + tokenLen;
3320: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3316: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3317: length(tokenValue), tokenValue);
3318: end if;
3319: sourcePos := pos + tokenLen;
3320: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3321: tokenFound := TRUE;
3322: end if;
3323: offset := pos + tokenLen;
3324: else
3326: if (amount > 0)then
3327: if tempIdx = -1 then
3328: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3329: end if;
3330: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3331: targetPos, sourcePos);
3332: end if;
3333:
3334: if (append and tokenFound = FALSE and msgLen > 0) then
3335: if (tokenValue <> '' or tokenValue is not null) then
3336: if tempIdx = -1 then
3337: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3338: end if;
3339: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3340: length(tokenValue), tokenValue);
3341: end if;
3342: end if;
3343: end if; -- CONTINUE
3344:
3345: end loop;
3346:
3347: if tokenFound = TRUE then
3348: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3349: DBMS_LOB.Trim(message, 0);
3350: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3351: end if;
3352:
3345: end loop;
3346:
3347: if tokenFound = TRUE then
3348: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3349: DBMS_LOB.Trim(message, 0);
3350: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3351: end if;
3352:
3353: -- << sstomar bug 6511028 >> Release allocated TEMP LOb.
3346:
3347: if tokenFound = TRUE then
3348: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3349: DBMS_LOB.Trim(message, 0);
3350: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3351: end if;
3352:
3353: -- << sstomar bug 6511028 >> Release allocated TEMP LOb.
3354: if tempIdx <> -1 then
3397: '0123456789_';
3398: tokenFound boolean;
3399:
3400: begin
3401: -- DBMS_LOB.CreateTemporary(temp, FALSE, DBMS_LOB.CALL);
3402: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3403:
3404: offset := 1;
3405: sourcePos := 1;
3404: offset := 1;
3405: sourcePos := 1;
3406: targetPos := 1;
3407: continue := TRUE;
3408: msgLen := DBMS_LOB.GetLength(message);
3409: tokenLen := length(token);
3410: tokenFound := FALSE;
3411:
3412: while continue
3410: tokenFound := FALSE;
3411:
3412: while continue
3413: loop
3414: pos := DBMS_LOB.Instr(message, token, offset, 1);
3415:
3416: if pos <> 0 then
3417: if (pos + tokenLen <= msgLen) then
3418: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3414: pos := DBMS_LOB.Instr(message, token, offset, 1);
3415:
3416: if pos <> 0 then
3417: if (pos + tokenLen <= msgLen) then
3418: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3419: if (instr(xSet, nextChar,1,1) > 0) then
3420: validToken := false;
3421: else
3422: validToken := true;
3431:
3432: if continue then
3433: if validToken then
3434: amount := pos - sourcePos;
3435: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3436: targetPos, sourcePos);
3437: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3438: if (tokenValueLen > 0) then
3439: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3433: if validToken then
3434: amount := pos - sourcePos;
3435: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3436: targetPos, sourcePos);
3437: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3438: if (tokenValueLen > 0) then
3439: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3440: end if;
3441: sourcePos := pos + tokenLen;
3435: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3436: targetPos, sourcePos);
3437: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3438: if (tokenValueLen > 0) then
3439: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3440: end if;
3441: sourcePos := pos + tokenLen;
3442: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3443: tokenFound := TRUE;
3438: if (tokenValueLen > 0) then
3439: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3440: end if;
3441: sourcePos := pos + tokenLen;
3442: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3443: tokenFound := TRUE;
3444: end if;
3445: offset := pos + tokenLen;
3446: else
3445: offset := pos + tokenLen;
3446: else
3447: amount := msgLen - sourcePos + 1;
3448: if (amount > 0) then
3449: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3450: targetPos, sourcePos);
3451: end if;
3452:
3453: if (append and tokenFound = FALSE and msgLen > 0) then
3450: targetPos, sourcePos);
3451: end if;
3452:
3453: if (append and tokenFound = FALSE and msgLen > 0) then
3454: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3455: if tokenValueLen <> 0 then
3456: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3457: end if;
3458: end if;
3452:
3453: if (append and tokenFound = FALSE and msgLen > 0) then
3454: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3455: if tokenValueLen <> 0 then
3456: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3457: end if;
3458: end if;
3459: end if;
3460: end loop;
3459: end if;
3460: end loop;
3461:
3462: if tokenFound then
3463: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3464: DBMS_LOB.Trim(message, 0);
3465: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3466: end if;
3467: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3460: end loop;
3461:
3462: if tokenFound then
3463: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3464: DBMS_LOB.Trim(message, 0);
3465: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3466: end if;
3467: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3468:
3461:
3462: if tokenFound then
3463: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3464: DBMS_LOB.Trim(message, 0);
3465: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3466: end if;
3467: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3468:
3469: exception
3561: --n_priority_text := wf_core.substitute('WFTKN', 'LOW');
3562: n_priority_text := wf_core.substitute('WFTKN', 'HIGH');
3563: end if;
3564:
3565: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.SESSION);
3566: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3567: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3568:
3569: pos := 1;
3562: n_priority_text := wf_core.substitute('WFTKN', 'HIGH');
3563: end if;
3564:
3565: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.SESSION);
3566: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3567: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3568:
3569: pos := 1;
3570: tempPos := 1;
3576:
3577: if amper = 0 then
3578: -- No ampers left. so write the rest of the CLOB
3579: if pos < msgLen then
3580: -- DBMS_LOB.Copy(temp, template, (msgLen - pos)+1, tempPos, pos);
3581: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (msgLen - pos)+1, tempPos,
3582: substr(template, pos, (msgLen - pos)+1));
3583: end if;
3584: EXIT;
3577: if amper = 0 then
3578: -- No ampers left. so write the rest of the CLOB
3579: if pos < msgLen then
3580: -- DBMS_LOB.Copy(temp, template, (msgLen - pos)+1, tempPos, pos);
3581: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (msgLen - pos)+1, tempPos,
3582: substr(template, pos, (msgLen - pos)+1));
3583: end if;
3584: EXIT;
3585: end if;
3588: -- token it is, if any.
3589:
3590: -- write from the last pos to the new token.
3591: if amper > pos then
3592: -- DBMS_LOB.Copy(temp, template, (amper - pos), tempPos, pos);
3593: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (amper - pos), tempPos,
3594: substr(template, pos, (amper - pos)));
3595: tempPos := tempPos + ((amper - pos));
3596: end if;
3589:
3590: -- write from the last pos to the new token.
3591: if amper > pos then
3592: -- DBMS_LOB.Copy(temp, template, (amper - pos), tempPos, pos);
3593: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (amper - pos), tempPos,
3594: substr(template, pos, (amper - pos)));
3595: tempPos := tempPos + ((amper - pos));
3596: end if;
3597: pos := amper + 1;
3608: tokenMatch := FALSE;
3609: if instr(tokenName,'NOTIFICATION_ID',1,1)=1 then
3610: n_nidStr := to_char(n_nid);
3611: if n_nidStr is not null then
3612: -- DBMS_LOB.WriteAppend(temp, length(n_nidStr), n_nidStr);
3613: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_nidStr),
3614: n_nidStr);
3615: tempPos := tempPos + length(n_nidStr);
3616: end if;
3609: if instr(tokenName,'NOTIFICATION_ID',1,1)=1 then
3610: n_nidStr := to_char(n_nid);
3611: if n_nidStr is not null then
3612: -- DBMS_LOB.WriteAppend(temp, length(n_nidStr), n_nidStr);
3613: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_nidStr),
3614: n_nidStr);
3615: tempPos := tempPos + length(n_nidStr);
3616: end if;
3617: pos := amper + length('NOTIFICATION_ID') + 1;
3618: tokenMatch := TRUE;
3619: end if;
3620: if instr(tokenName,'NOTIFICATION',1,1)=1 then
3621: if n_code is not null then
3622: -- DBMS_LOB.WriteAppend(temp, length(n_code), n_code);
3623: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_code),
3624: n_code);
3625: tempPos := tempPos + length(n_code);
3626: end if;
3619: end if;
3620: if instr(tokenName,'NOTIFICATION',1,1)=1 then
3621: if n_code is not null then
3622: -- DBMS_LOB.WriteAppend(temp, length(n_code), n_code);
3623: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_code),
3624: n_code);
3625: tempPos := tempPos + length(n_code);
3626: end if;
3627: pos := amper + length('NOTIFICATION') + 1;
3628: tokenMatch := TRUE;
3629: end if;
3630: if instr(tokenName,'STATUS',1,1)=1 then
3631: if n_status is not null then
3632: -- DBMS_LOB.WriteAppend(temp, length(n_status), n_status);
3633: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_status), n_status);
3634: tempPos := tempPos + length(n_status);
3635: end if;
3636: pos := amper + length('STATUS') + 1;
3629: end if;
3630: if instr(tokenName,'STATUS',1,1)=1 then
3631: if n_status is not null then
3632: -- DBMS_LOB.WriteAppend(temp, length(n_status), n_status);
3633: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_status), n_status);
3634: tempPos := tempPos + length(n_status);
3635: end if;
3636: pos := amper + length('STATUS') + 1;
3637: tokenMatch := TRUE;
3637: tokenMatch := TRUE;
3638: end if;
3639: if instr(tokenName, 'TO_DNAME', 1, 1)=1 then
3640: if r_dname is not null then
3641: -- DBMS_LOB.WriteAppend(temp, length(r_dname), r_dname);
3642: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_dname), r_dname);
3643: tempPos := tempPos + length(r_dname);
3644: end if;
3645: pos := amper + length('TO_DNAME') + 1;
3638: end if;
3639: if instr(tokenName, 'TO_DNAME', 1, 1)=1 then
3640: if r_dname is not null then
3641: -- DBMS_LOB.WriteAppend(temp, length(r_dname), r_dname);
3642: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_dname), r_dname);
3643: tempPos := tempPos + length(r_dname);
3644: end if;
3645: pos := amper + length('TO_DNAME') + 1;
3646: tokenMatch := TRUE;
3646: tokenMatch := TRUE;
3647: end if;
3648: if instr(tokenName, 'TO_EMAIL', 1, 1)=1 then
3649: if r_email is not null then
3650: -- DBMS_LOB.WriteAppend(temp, length(r_email), r_email);
3651: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_email), r_email);
3652: tempPos := tempPos + length(r_email);
3653: end if;
3654: pos := amper + length('TO_EMAIL') + 1;
3647: end if;
3648: if instr(tokenName, 'TO_EMAIL', 1, 1)=1 then
3649: if r_email is not null then
3650: -- DBMS_LOB.WriteAppend(temp, length(r_email), r_email);
3651: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_email), r_email);
3652: tempPos := tempPos + length(r_email);
3653: end if;
3654: pos := amper + length('TO_EMAIL') + 1;
3655: tokenMatch := TRUE;
3655: tokenMatch := TRUE;
3656: end if;
3657: if instr(tokenName,'TO',1,1)=1 then
3658: if n_to_role is not null then
3659: -- DBMS_LOB.WriteAppend(temp, length(n_to_role), n_to_role);
3660: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_to_role), n_to_role);
3661: tempPos := tempPos + length(n_to_role);
3662: end if;
3663: pos := amper + length('TO') + 1;
3656: end if;
3657: if instr(tokenName,'TO',1,1)=1 then
3658: if n_to_role is not null then
3659: -- DBMS_LOB.WriteAppend(temp, length(n_to_role), n_to_role);
3660: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_to_role), n_to_role);
3661: tempPos := tempPos + length(n_to_role);
3662: end if;
3663: pos := amper + length('TO') + 1;
3664: tokenMatch := TRUE;
3664: tokenMatch := TRUE;
3665: end if;
3666: if instr(tokenName, 'PRIORITY', 1, 1)=1 then
3667: if n_priority_text is not null then
3668: -- DBMS_LOB.WriteAppend(temp, length(n_priority_text), n_priority_text);
3669: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_priority_text),
3670: n_priority_text);
3671: tempPos := tempPos + length(n_priority_text);
3672: end if;
3665: end if;
3666: if instr(tokenName, 'PRIORITY', 1, 1)=1 then
3667: if n_priority_text is not null then
3668: -- DBMS_LOB.WriteAppend(temp, length(n_priority_text), n_priority_text);
3669: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_priority_text),
3670: n_priority_text);
3671: tempPos := tempPos + length(n_priority_text);
3672: end if;
3673: pos := amper + length('PRIORITY') + 1;
3674: tokenMatch := TRUE;
3675: end if;
3676: if instr(tokenName, 'START_DATE', 1, 1)=1 then
3677: if n_start_date is not null then
3678: -- DBMS_LOB.WriteAppend(temp, length(n_start_date), n_start_date);
3679: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3680: length(n_start_date_text), n_start_date_text);
3681: tempPos := tempPos + length(n_start_date_text);
3682: end if;
3675: end if;
3676: if instr(tokenName, 'START_DATE', 1, 1)=1 then
3677: if n_start_date is not null then
3678: -- DBMS_LOB.WriteAppend(temp, length(n_start_date), n_start_date);
3679: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3680: length(n_start_date_text), n_start_date_text);
3681: tempPos := tempPos + length(n_start_date_text);
3682: end if;
3683: pos := amper + length('START_DATE') + 1;
3684: tokenMatch := TRUE;
3685: end if;
3686: if instr(tokenName, 'DUE_DATE', 1, 1)=1 then
3687: if n_due_date is not null then
3688: -- DBMS_LOB.WriteAppend(temp, length(n_due_date_text), n_due_date_text);
3689: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_due_date_text),
3690: n_due_date_text);
3691: tempPos := tempPos + length(n_due_date_text);
3692: end if;
3685: end if;
3686: if instr(tokenName, 'DUE_DATE', 1, 1)=1 then
3687: if n_due_date is not null then
3688: -- DBMS_LOB.WriteAppend(temp, length(n_due_date_text), n_due_date_text);
3689: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_due_date_text),
3690: n_due_date_text);
3691: tempPos := tempPos + length(n_due_date_text);
3692: end if;
3693: pos := amper + length('DUE_DATE') + 1;
3694: tokenMatch := TRUE;
3695: end if;
3696: if instr(tokenName, 'END_DATE', 1, 1)=1 then
3697: if n_end_date is not null then
3698: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3699: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3700: -- n_end_date);
3701: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3702: n_end_date_text);
3695: end if;
3696: if instr(tokenName, 'END_DATE', 1, 1)=1 then
3697: if n_end_date is not null then
3698: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3699: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3700: -- n_end_date);
3701: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3702: n_end_date_text);
3703:
3697: if n_end_date is not null then
3698: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3699: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3700: -- n_end_date);
3701: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3702: n_end_date_text);
3703:
3704: tempPos := tempPos + length(n_end_date_text);
3705: end if;
3707: tokenMatch := TRUE;
3708: end if;
3709: if instr(tokenName, 'SENDER', 1, 1)=1 then
3710: if n_from_user is not null then
3711: -- DBMS_LOB.WriteAppend(temp, length(n_from_user), n_from_user);
3712: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_from_user),
3713: n_from_user);
3714: tempPos := tempPos + length(n_from_user);
3715: end if;
3708: end if;
3709: if instr(tokenName, 'SENDER', 1, 1)=1 then
3710: if n_from_user is not null then
3711: -- DBMS_LOB.WriteAppend(temp, length(n_from_user), n_from_user);
3712: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_from_user),
3713: n_from_user);
3714: tempPos := tempPos + length(n_from_user);
3715: end if;
3716: pos := amper + length('SENDER') + 1;
3717: tokenMatch := TRUE;
3718: end if;
3719: if instr(tokenName, 'COMMENT', 1, 1)=1 then
3720: if n_comment is not null then
3721: -- DBMS_LOB.WriteAppend(temp, length(n_comment), n_comment);
3722: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3723: length(n_comment), n_comment);
3724: tempPos := tempPos + length(n_comment);
3725: end if;
3718: end if;
3719: if instr(tokenName, 'COMMENT', 1, 1)=1 then
3720: if n_comment is not null then
3721: -- DBMS_LOB.WriteAppend(temp, length(n_comment), n_comment);
3722: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3723: length(n_comment), n_comment);
3724: tempPos := tempPos + length(n_comment);
3725: end if;
3726: pos := amper + length('COMMENT') + 1;
3727: tokenMatch := TRUE;
3728: end if;
3729: if instr(tokenName, 'TIMEZONE', 1, 1)=1 then
3730: if n_timezone is not null then
3731: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3732: length(n_timezone), n_timezone);
3733: tempPos := tempPos + length(n_timezone);
3734: end if;
3735: pos := amper + length('TIMEZONE') + 1;
3736: tokenMatch := TRUE;
3737: end if;
3738: if instr(tokenName, 'SUBJECT', 1, 1)=1 then
3739: if m_subject is not null then
3740: -- DBMS_LOB.WriteAppend(temp, length(m_subject), m_subject);
3741: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_subject), m_subject);
3742: tempPos := tempPos + length(m_subject);
3743: end if;
3744: pos := amper + length('SUBJECT') + 1;
3737: end if;
3738: if instr(tokenName, 'SUBJECT', 1, 1)=1 then
3739: if m_subject is not null then
3740: -- DBMS_LOB.WriteAppend(temp, length(m_subject), m_subject);
3741: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_subject), m_subject);
3742: tempPos := tempPos + length(m_subject);
3743: end if;
3744: pos := amper + length('SUBJECT') + 1;
3745: tokenMatch := TRUE;
3745: tokenMatch := TRUE;
3746: end if;
3747: if instr(tokenName, 'HEADER', 1, 1)=1 then
3748: if m_header is not null then
3749: --DBMS_LOB.WriteAppend(temp, length(m_header), m_header);
3750: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_header), m_header);
3751: tempPos := tempPos + length(m_header);
3752: end if;
3753: pos := amper + length('HEADER') + 1;
3746: end if;
3747: if instr(tokenName, 'HEADER', 1, 1)=1 then
3748: if m_header is not null then
3749: --DBMS_LOB.WriteAppend(temp, length(m_header), m_header);
3750: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_header), m_header);
3751: tempPos := tempPos + length(m_header);
3752: end if;
3753: pos := amper + length('HEADER') + 1;
3754: tokenMatch := TRUE;
3753: pos := amper + length('HEADER') + 1;
3754: tokenMatch := TRUE;
3755: end if;
3756: if instr(tokenName, 'BODY', 1, 1)=1 then
3757: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3758: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3759: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3760: pos := amper + length('BODY') + 1;
3761: tokenMatch := TRUE;
3754: tokenMatch := TRUE;
3755: end if;
3756: if instr(tokenName, 'BODY', 1, 1)=1 then
3757: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3758: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3759: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3760: pos := amper + length('BODY') + 1;
3761: tokenMatch := TRUE;
3762: else
3755: end if;
3756: if instr(tokenName, 'BODY', 1, 1)=1 then
3757: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3758: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3759: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3760: pos := amper + length('BODY') + 1;
3761: tokenMatch := TRUE;
3762: else
3763: tokenMatch := FALSE;
3764: end if;
3765: end if;
3766: if instr(tokenName, 'MAIL_ERROR_NAME', 1, 1)=1 then
3767: if err_name is not null then
3768: -- DBMS_LOB.WriteAppend(temp, length(err_name), err_name);
3769: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_name), err_name);
3770: tempPos := tempPos + length(err_name);
3771: end if;
3772: pos := amper + length('MAIL_ERROR_NAME') + 1;
3765: end if;
3766: if instr(tokenName, 'MAIL_ERROR_NAME', 1, 1)=1 then
3767: if err_name is not null then
3768: -- DBMS_LOB.WriteAppend(temp, length(err_name), err_name);
3769: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_name), err_name);
3770: tempPos := tempPos + length(err_name);
3771: end if;
3772: pos := amper + length('MAIL_ERROR_NAME') + 1;
3773: tokenMatch := TRUE;
3773: tokenMatch := TRUE;
3774: end if;
3775: if instr(tokenName, 'MAIL_ERROR_MESSAGE', 1, 1)=1 then
3776: if err_message is not null then
3777: -- DBMS_LOB.WriteAppend(temp, length(err_message), err_message);
3778: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_message),
3779: err_message);
3780: tempPos := tempPos + length(err_message);
3781: end if;
3774: end if;
3775: if instr(tokenName, 'MAIL_ERROR_MESSAGE', 1, 1)=1 then
3776: if err_message is not null then
3777: -- DBMS_LOB.WriteAppend(temp, length(err_message), err_message);
3778: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_message),
3779: err_message);
3780: tempPos := tempPos + length(err_message);
3781: end if;
3782: pos := amper + length('MAIL_ERROR_MESSAGE') + 1;
3788: -- to go with the WARNING message
3789:
3790: if instr(tokenName, 'MAIL_VALUE_FOUND', 1, 1)=1 then
3791: if err_invalid is not null then
3792: -- DBMS_LOB.WriteAppend(temp, length(err_invalid), err_invalid);
3793: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_invalid),
3794: err_invalid);
3795: tempPos := tempPos + length(err_invalid);
3796: end if;
3789:
3790: if instr(tokenName, 'MAIL_VALUE_FOUND', 1, 1)=1 then
3791: if err_invalid is not null then
3792: -- DBMS_LOB.WriteAppend(temp, length(err_invalid), err_invalid);
3793: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_invalid),
3794: err_invalid);
3795: tempPos := tempPos + length(err_invalid);
3796: end if;
3797: pos := amper + length('MAIL_VALUE_FOUND') + 1;
3799: end if;
3800:
3801: if instr(tokenName, 'MAIL_EXP_VALUES', 1, 1)=1 then
3802: if err_expected is not null then
3803: -- DBMS_LOB.WriteAppend(temp, length(err_expected), err_expected);
3804: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_expected),
3805: err_expected);
3806: tempPos := tempPos + length(err_expected);
3807: end if;
3800:
3801: if instr(tokenName, 'MAIL_EXP_VALUES', 1, 1)=1 then
3802: if err_expected is not null then
3803: -- DBMS_LOB.WriteAppend(temp, length(err_expected), err_expected);
3804: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_expected),
3805: err_expected);
3806: tempPos := tempPos + length(err_expected);
3807: end if;
3808: pos := amper + length('MAIL_EXP_VALUES') + 1;
3809: tokenMatch := TRUE;
3810: end if;
3811:
3812: if not tokenMatch and amper > 0 then
3813: -- DBMS_LOB.WriteAppend(temp, 1, '&');
3814: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, '&');
3815: tempPos := tempPos + 1;
3816: end if;
3817:
3810: end if;
3811:
3812: if not tokenMatch and amper > 0 then
3813: -- DBMS_LOB.WriteAppend(temp, 1, '&');
3814: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, '&');
3815: tempPos := tempPos + 1;
3816: end if;
3817:
3818: end loop;
3816: end if;
3817:
3818: end loop;
3819:
3820: -- msgLen := DBMS_LOB.GetLength(temp);
3821: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3822: if msgLen > 0 then
3823: DBMS_LOB.Trim(m_body, 0);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3817:
3818: end loop;
3819:
3820: -- msgLen := DBMS_LOB.GetLength(temp);
3821: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3822: if msgLen > 0 then
3823: DBMS_LOB.Trim(m_body, 0);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3819:
3820: -- msgLen := DBMS_LOB.GetLength(temp);
3821: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3822: if msgLen > 0 then
3823: DBMS_LOB.Trim(m_body, 0);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3826: end if;
3827:
3820: -- msgLen := DBMS_LOB.GetLength(temp);
3821: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3822: if msgLen > 0 then
3823: DBMS_LOB.Trim(m_body, 0);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3826: end if;
3827:
3828: -- DBMS_LOB.Close(temp);
3821: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3822: if msgLen > 0 then
3823: DBMS_LOB.Trim(m_body, 0);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3826: end if;
3827:
3828: -- DBMS_LOB.Close(temp);
3829: -- DBMS_LOB.FreeTemporary(temp);
3824: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3826: end if;
3827:
3828: -- DBMS_LOB.Close(temp);
3829: -- DBMS_LOB.FreeTemporary(temp);
3830: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3831:
3832: exception
3825: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3826: end if;
3827:
3828: -- DBMS_LOB.Close(temp);
3829: -- DBMS_LOB.FreeTemporary(temp);
3830: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3831:
3832: exception
3833: when others then
3870: --
3871: lnsize := lineSize;
3872: start_cnt := 1;
3873: end_cnt := lnsize;
3874: str_length := DBMS_LOB.GetLength(message);
3875: if str_length = 0 then
3876: return;
3877: end if;
3878:
3875: if str_length = 0 then
3876: return;
3877: end if;
3878:
3879: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3880: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
3881: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3882: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
3883: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3876: return;
3877: end if;
3878:
3879: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3880: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
3881: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3882: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
3883: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3884: lineIdx := wf_temp_lob.getLob(g_LOBTable);
3877: end if;
3878:
3879: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3880: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
3881: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3882: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
3883: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3884: lineIdx := wf_temp_lob.getLob(g_LOBTable);
3885:
3878:
3879: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3880: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
3881: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3882: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
3883: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3884: lineIdx := wf_temp_lob.getLob(g_LOBTable);
3885:
3886: while start_cnt < str_length loop
3884: lineIdx := wf_temp_lob.getLob(g_LOBTable);
3885:
3886: while start_cnt < str_length loop
3887: -- use the existing newlines as a natural break
3888: crpos := DBMS_LOB.instr(message, g_newLine, start_cnt+1, 1) - start_cnt;
3889:
3890:
3891: if crpos > 0 and crpos < end_cnt then
3892: -- If there was a line bread and it is positioned less than the
3898: end if;
3899:
3900: -- Move forward to the next white space.
3901: while (start_cnt + end_cnt < str_length) and
3902: DBMS_LOB.substr(message, 1, start_cnt + end_cnt)
3903: not in (' ', g_newLine, g_tab)
3904: and end_cnt < maxLineSize loop
3905: end_cnt := end_cnt + 1;
3906: end loop;
3911:
3912: if end_cnt >= (maxLineSize) then
3913: end_cnt := lnsize;
3914: while (start_cnt + end_cnt > start_cnt) and
3915: DBMS_LOB.substr(message, 1, start_cnt + end_cnt)
3916: not in (' ', g_newLine, g_tab)
3917: and end_cnt > 0 loop
3918: end_cnt := end_cnt - 1;
3919: end loop;
3924: end if;
3925: end if;
3926:
3927: -- Ensure the last characters are not lost.
3928: -- DBMS_LOB.Trim(line, 0);
3929: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3925: end if;
3926:
3927: -- Ensure the last characters are not lost.
3928: -- DBMS_LOB.Trim(line, 0);
3929: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3926:
3927: -- Ensure the last characters are not lost.
3928: -- DBMS_LOB.Trim(line, 0);
3929: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3928: -- DBMS_LOB.Trim(line, 0);
3929: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3929: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3930: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
3931: if start_cnt + end_cnt >= str_length then
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3938: -- start_cnt);
3932: -- line := DBMS_LOB.substr(message, start_cnt);
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3938: -- start_cnt);
3939: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3940: src_lob => message,
3933: -- DBMS_LOB.Copy(line, message,
3934: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3938: -- start_cnt);
3939: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3940: src_lob => message,
3941: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
3935: -- start_cnt);
3936: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3938: -- start_cnt);
3939: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3940: src_lob => message,
3941: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
3942: dest_offset => tempOffset,
3943: src_offset => start_cnt);
3937: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
3938: -- start_cnt);
3939: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3940: src_lob => message,
3941: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
3942: dest_offset => tempOffset,
3943: src_offset => start_cnt);
3944:
3945: else
3942: dest_offset => tempOffset,
3943: src_offset => start_cnt);
3944:
3945: else
3946: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
3947: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
3948: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
3949: -- start_cnt);
3950: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3943: src_offset => start_cnt);
3944:
3945: else
3946: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
3947: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
3948: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
3949: -- start_cnt);
3950: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3951: src_lob => message,
3944:
3945: else
3946: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
3947: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
3948: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
3949: -- start_cnt);
3950: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3951: src_lob => message,
3952: amount => end_cnt,
3946: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
3947: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
3948: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
3949: -- start_cnt);
3950: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3951: src_lob => message,
3952: amount => end_cnt,
3953: dest_offset => tempOffset,
3954: src_offset => start_cnt);
3954: src_offset => start_cnt);
3955: end if;
3956:
3957: -- temp := temp || line;
3958: -- DBMS_LOB.Append(temp, line);
3959: -- DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob,
3960: -- g_LOBTable(lineIdx).temp_lob);
3961:
3962: -- If there is a newline at this point,
3955: end if;
3956:
3957: -- temp := temp || line;
3958: -- DBMS_LOB.Append(temp, line);
3959: -- DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob,
3960: -- g_LOBTable(lineIdx).temp_lob);
3961:
3962: -- If there is a newline at this point,
3963: -- then do not bother with another.
3960: -- g_LOBTable(lineIdx).temp_lob);
3961:
3962: -- If there is a newline at this point,
3963: -- then do not bother with another.
3964: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
3965: g_newLine then
3966: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
3967: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
3968: end if;
3962: -- If there is a newline at this point,
3963: -- then do not bother with another.
3964: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
3965: g_newLine then
3966: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
3967: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
3968: end if;
3969:
3970: -- We do not want to start the new line with the space.
3963: -- then do not bother with another.
3964: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
3965: g_newLine then
3966: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
3967: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
3968: end if;
3969:
3970: -- We do not want to start the new line with the space.
3971: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) = ' ' then
3967: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
3968: end if;
3969:
3970: -- We do not want to start the new line with the space.
3971: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) = ' ' then
3972: start_cnt := start_cnt + end_cnt + 1;
3973: else
3974: start_cnt := start_cnt + end_cnt;
3975: end if;
3974: start_cnt := start_cnt + end_cnt;
3975: end if;
3976: end_cnt := lnsize;
3977: end loop;
3978: DBMS_LOB.Trim(message, 0);
3979: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
3980: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3975: end if;
3976: end_cnt := lnsize;
3977: end loop;
3978: DBMS_LOB.Trim(message, 0);
3979: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
3980: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3983:
3976: end_cnt := lnsize;
3977: end loop;
3978: DBMS_LOB.Trim(message, 0);
3979: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
3980: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3983:
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3977: end loop;
3978: DBMS_LOB.Trim(message, 0);
3979: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
3980: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3983:
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3985: -- DBMS_LOB.Close(temp);
3980: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3983:
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3985: -- DBMS_LOB.Close(temp);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3981: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
3982:
3983:
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3985: -- DBMS_LOB.Close(temp);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3989: -- DBMS_LOB.Close(line);
3982:
3983:
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3985: -- DBMS_LOB.Close(temp);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3989: -- DBMS_LOB.Close(line);
3990: -- DBMS_LOB.FreeTemporary(line);
3984: -- if DBMS_LOB.IsOpen(temp)=1 then
3985: -- DBMS_LOB.Close(temp);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3989: -- DBMS_LOB.Close(line);
3990: -- DBMS_LOB.FreeTemporary(line);
3991: -- end if;
3992: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
3985: -- DBMS_LOB.Close(temp);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3989: -- DBMS_LOB.Close(line);
3990: -- DBMS_LOB.FreeTemporary(line);
3991: -- end if;
3992: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
3993: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3986: -- DBMS_LOB.FreeTemporary(temp);
3987: -- end if;
3988: -- if DBMS_LOB.IsOpen(line)=1 then
3989: -- DBMS_LOB.Close(line);
3990: -- DBMS_LOB.FreeTemporary(line);
3991: -- end if;
3992: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
3993: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3994:
4024: lnsize := textWidth;
4025: bfr_start := 1;
4026: chk_start := 1;
4027: line_size := lnsize;
4028: doc_length := DBMS_LOB.GetLength(message);
4029: if doc_length = 0 or doc_length < line_size then
4030: return;
4031: end if;
4032:
4041: insertNewLine := false;
4042:
4043: -- use the existing newlines as a natural break. If found
4044: -- crpos will be the relative position from chk_start.
4045: crpos := DBMS_LOB.instr(lob_loc => message,
4046: pattern => g_newLine,
4047: offset => chk_start,
4048: nth => 1) - chk_start;
4049:
4056: insertNewLine := false;
4057: else
4058: -- Move forward to the next white space.
4059:
4060: wsLoc := DBMS_LOB.instr(lob_loc => message,
4061: pattern => ' ',
4062: offset => (chk_start + line_size),
4063: nth => 1) - chk_start;
4064:
4061: pattern => ' ',
4062: offset => (chk_start + line_size),
4063: nth => 1) - chk_start;
4064:
4065: crpos := DBMS_LOB.instr(lob_loc => message,
4066: pattern => g_newline,
4067: offset => (chk_start + line_size),
4068: nth => 1) - chk_start;
4069:
4075: insertNewLine := true;
4076: whitespace := true;
4077: else
4078:
4079: wsLoc := DBMS_LOB.instr(lob_loc => message,
4080: pattern => g_newLine,
4081: offset => chk_start + line_size,
4082: nth => 1) - chk_start;
4083:
4087: insertNewLine := false;
4088: whitespace := true;
4089: else
4090:
4091: wsLoc := DBMS_LOB.instr(lob_loc => message,
4092: pattern => g_tab,
4093: offset => chk_start + line_size,
4094: nth => 1) - chk_start;
4095:
4108:
4109: -- Ensure the last characters are not lost.
4110: if chk_start + line_size >= doc_length then
4111: -- copy from the chk_start to the end of the document.
4112: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4113:
4114: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4115: src_lob => message,
4116: amount => doc_length - bfr_start +1 ,
4110: if chk_start + line_size >= doc_length then
4111: -- copy from the chk_start to the end of the document.
4112: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4113:
4114: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4115: src_lob => message,
4116: amount => doc_length - bfr_start +1 ,
4117: dest_offset => tempOffset,
4118: src_offset => bfr_start);
4117: dest_offset => tempOffset,
4118: src_offset => bfr_start);
4119: elsif insertNewLine then
4120: -- Copy partial and make note of the current position
4121: -- This is to minimise the number of calls to dbms_lob.copy.
4122: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4123: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4124: src_lob => message,
4125: amount => (chk_start - bfr_start) + line_size,
4118: src_offset => bfr_start);
4119: elsif insertNewLine then
4120: -- Copy partial and make note of the current position
4121: -- This is to minimise the number of calls to dbms_lob.copy.
4122: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4123: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4124: src_lob => message,
4125: amount => (chk_start - bfr_start) + line_size,
4126: dest_offset => tempOffset,
4119: elsif insertNewLine then
4120: -- Copy partial and make note of the current position
4121: -- This is to minimise the number of calls to dbms_lob.copy.
4122: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4123: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4124: src_lob => message,
4125: amount => (chk_start - bfr_start) + line_size,
4126: dest_offset => tempOffset,
4127: src_offset => bfr_start);
4124: src_lob => message,
4125: amount => (chk_start - bfr_start) + line_size,
4126: dest_offset => tempOffset,
4127: src_offset => bfr_start);
4128: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4129: bfr_start := chk_start + line_size +1;
4130: end if;
4131:
4132: if wsLoc > 0 then
4136: end if;
4137: line_size := lnsize;
4138: end loop;
4139:
4140: DBMS_LOB.Trim(message, 0);
4141: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4142: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4143:
4144: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4137: line_size := lnsize;
4138: end loop;
4139:
4140: DBMS_LOB.Trim(message, 0);
4141: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4142: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4143:
4144: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4145: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4138: end loop;
4139:
4140: DBMS_LOB.Trim(message, 0);
4141: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4142: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4143:
4144: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4145: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4146:
4140: DBMS_LOB.Trim(message, 0);
4141: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4142: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4143:
4144: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4145: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4146:
4147: end OBSOLETE2LOBLineBreak;
4148:
4175: begin
4176:
4177: l_tempIdx := wf_temp_lob.getLob(g_LOBTable);
4178:
4179: l_amount := dbms_lob.getLength(message);
4180: l_offset := 1;
4181: l_bufferSize := l_lineSize;
4182: l_forcedBreak := false;
4183:
4185: loop
4186: l_lastCR := 0;
4187: l_forcedBreak := false;
4188: if(l_amount > l_lineSize) then
4189: dbms_lob.read(lob_loc => message, amount => l_lineSize,
4190: offset => l_offSet, buffer => l_strBuffer);
4191:
4192: l_lastCR := instr(l_strBuffer, wf_core.newline, -1);
4193: l_lastWS := instr(l_strBuffer, ' ', -1);
4211: -- same size as the space that was removed
4212: l_bufferSize := length(l_strBuffer);
4213: end if;
4214:
4215: DBMS_LOB.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4216: amount => l_bufferSize,
4217: buffer => l_strBuffer);
4218:
4219: l_strBuffer := '';
4218:
4219: l_strBuffer := '';
4220: else
4221:
4222: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4223: dbms_lob.read(lob_loc => message, amount => l_amount,
4224: offset => l_offset, buffer => l_strBuffer);
4225:
4226: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4219: l_strBuffer := '';
4220: else
4221:
4222: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4223: dbms_lob.read(lob_loc => message, amount => l_amount,
4224: offset => l_offset, buffer => l_strBuffer);
4225:
4226: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4227: amount => l_amount,
4222: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4223: dbms_lob.read(lob_loc => message, amount => l_amount,
4224: offset => l_offset, buffer => l_strBuffer);
4225:
4226: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4227: amount => l_amount,
4228: buffer => l_strBuffer);
4229:
4230: exit;
4229:
4230: exit;
4231: end if;
4232: end loop;
4233: DBMS_LOB.Trim(message, 0);
4234: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4235: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4236:
4237: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4230: exit;
4231: end if;
4232: end loop;
4233: DBMS_LOB.Trim(message, 0);
4234: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4235: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4236:
4237: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4238: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4231: end if;
4232: end loop;
4233: DBMS_LOB.Trim(message, 0);
4234: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4235: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4236:
4237: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4238: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4239: end if;
4233: DBMS_LOB.Trim(message, 0);
4234: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4235: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4236:
4237: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4238: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4239: end if;
4240:
4241: -- exception
4291: begin
4292:
4293: -- Clear buffer
4294: str_buffer := '';
4295: -- DBMS_LOB.createTemporary(buffer, FALSE, dbms_lob.call);
4296: bufferIdx := wf_temp_lob.getLob(g_LOBTable);
4297:
4298: -- URL RESPONSE attributes overrides the normal RESULT attributes.
4299: -- So, my goal here is to check for this case.
4315: '" target="_top">';
4316: str_buffer := str_buffer||' '||rec.display_name;
4317: str_buffer := str_buffer||''||'';
4318: str_buffer := str_buffer||g_newLine;
4319: -- DBMS_LOB.writeAppend(buffer, length(str_buffer), str_buffer);
4320: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4321: str_buffer := '';
4322: end loop;
4323:
4316: str_buffer := str_buffer||' '||rec.display_name;
4317: str_buffer := str_buffer||''||'';
4318: str_buffer := str_buffer||g_newLine;
4319: -- DBMS_LOB.writeAppend(buffer, length(str_buffer), str_buffer);
4320: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4321: str_buffer := '';
4322: end loop;
4323:
4324: -- if (dbms_lob.GetLength(buffer) > 0) then
4320: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4321: str_buffer := '';
4322: end loop;
4323:
4324: -- if (dbms_lob.GetLength(buffer) > 0) then
4325: if (dbms_lob.GetLength(g_LOBTable(bufferIdx).temp_lob) > 0) then
4326: -- LOBReplace(doc, '&'||'MAILTO', buffer, FALSE);
4327: LOBReplace(doc, '&'||'MAILTO', g_LOBTable(bufferIdx).temp_lob, FALSE);
4328: RETURN;
4321: str_buffer := '';
4322: end loop;
4323:
4324: -- if (dbms_lob.GetLength(buffer) > 0) then
4325: if (dbms_lob.GetLength(g_LOBTable(bufferIdx).temp_lob) > 0) then
4326: -- LOBReplace(doc, '&'||'MAILTO', buffer, FALSE);
4327: LOBReplace(doc, '&'||'MAILTO', g_LOBTable(bufferIdx).temp_lob, FALSE);
4328: RETURN;
4329: end if;
4381: -- Construct mailto syntax
4382: str_buffer := str_buffer||'
'||disp_name||': '||''||
4392: g_noResult||''||'';
4393: -- DBMS_LOB.WriteAppend(buffer, length(str_buffer), str_buffer);
4394: DBMS_LOB.WriteAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4395: str_buffer := '';
4396: else
4397: lov_list := GetLovListInternal(auto_answer);
4390: GetMailToBody(nid, auto_answer, g_LOBTable(bufferIdx).temp_lob);
4391: str_buffer := '%0D%0A%0D%0A'||encoded_tag||'">'||''||
4392: g_noResult||''||'';
4393: -- DBMS_LOB.WriteAppend(buffer, length(str_buffer), str_buffer);
4394: DBMS_LOB.WriteAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4395: str_buffer := '';
4396: else
4397: lov_list := GetLovListInternal(auto_answer);
4398: lov_list := substr(lov_list, 1, length(lov_list)-1);
4423: str_buffer := str_buffer||'&'||'nbsp;'||'&'||'nbsp;'||
4424: '';
7639: l_pos := length(l_str);
7640: dbms_lob.write(l_msg_doc, l_pos, 1, l_str);
7641:
7636:
7637: dbms_lob.createTemporary(l_msg_doc, TRUE, dbms_lob.call);
7638: l_str := '';
7639: l_pos := length(l_str);
7640: dbms_lob.write(l_msg_doc, l_pos, 1, l_str);
7641:
7642: --
7643: wf_xml.AddElementAttribute('maxcount', '1', l_attrlist);
7644: l_pos := wf_xml.NewLOBTag(l_msg_doc, l_pos, 'NOTIFICATIONGROUP', '', l_attrlist);
7688:
7689: l_pos := wf_xml.NewLOBTag(l_msg_doc, l_pos, 'NOTIFICATION', '', l_attrlist);
7690: l_attrlist.DELETE;
7691:
7692: dbms_lob.createTemporary(l_recp_clob, TRUE, dbms_lob.call);
7693:
7694: l_recp_pos := 0;
7695: l_recp_tmp := '';
7696:
7721: i := p_recipient_list.next(i);
7722:
7723: l_recp_len := length(l_recp_tmp);
7724: if (l_recp_len > 30000) then
7725: dbms_lob.WriteAppend(l_recp_clob, l_recp_len, l_recp_tmp);
7726: l_recp_tmp := '';
7727: l_recp_pos := 0;
7728: l_recp_is_lob := true;
7729: end if;
7730: end loop;
7731:
7732: l_recp_len := length(l_recp_tmp);
7733: if(l_recp_len > 0 and l_recp_is_lob) then
7734: dbms_lob.WriteAppend(l_recp_clob, l_recp_len, l_recp_tmp);
7735: end if;
7736:
7737: --
7738: l_recp_pos := 0;
7736:
7737: --
7738: l_recp_pos := 0;
7739: if (l_recp_is_lob) then
7740: dbms_lob.createTemporary(l_recp, TRUE, dbms_lob.call);
7741: l_recp_pos := wf_xml.NewLOBTag(l_recp, l_recp_pos, 'RECIPIENTLIST', l_recp_clob, l_attrlist);
7742: l_recp_pos := wf_xml.SkipLOBTag(l_recp, 'RECIPIENTLIST', l_recp_pos, l_occurance);
7743: else
7744: l_recp_pos := wf_xml.NewTag(l_recp_txt, l_recp_pos, 'RECIPIENTLIST', l_recp_tmp, l_attrlist);
7776: l_hdr_pos := wf_xml.NewTag(l_hdr_tmp, l_hdr_pos, 'SUBJECT', l_subject, l_attrlist);
7777: l_hdr_pos := wf_xml.SkipTag(l_hdr_tmp, 'SUBJECT', l_hdr_pos, l_occurance);
7778:
7779: if (l_recp_is_lob) then
7780: dbms_lob.WriteAppend(l_recp, length(l_hdr_tmp), l_hdr_tmp);
7781: l_pos := wf_xml.NewLOBTag(l_msg_doc, l_pos, 'HEADER', l_recp, l_attrlist);
7782: else
7783: l_hdr_tmp := l_recp_txt || l_hdr_tmp;
7784: l_pos := wf_xml.NewLOBTag(l_msg_doc, l_pos, 'HEADER', l_hdr_tmp, l_attrlist);
7798: --
7799:
7800: l_messageIdx := wf_temp_lob.getLOB(g_LOBTable);
7801:
7802: dbms_lob.trim(g_LOBTable(l_messageIdx).temp_lob,0);
7803:
7804: dbms_lob.writeAppend(g_LOBTable(l_messageIdx).temp_lob,
7805: length(l_start_cdata), l_start_cdata);
7806:
7800: l_messageIdx := wf_temp_lob.getLOB(g_LOBTable);
7801:
7802: dbms_lob.trim(g_LOBTable(l_messageIdx).temp_lob,0);
7803:
7804: dbms_lob.writeAppend(g_LOBTable(l_messageIdx).temp_lob,
7805: length(l_start_cdata), l_start_cdata);
7806:
7807: dbms_lob.append(dest_lob => g_LOBTable(l_messageIdx).temp_lob,
7808: src_lob => p_message);
7803:
7804: dbms_lob.writeAppend(g_LOBTable(l_messageIdx).temp_lob,
7805: length(l_start_cdata), l_start_cdata);
7806:
7807: dbms_lob.append(dest_lob => g_LOBTable(l_messageIdx).temp_lob,
7808: src_lob => p_message);
7809:
7810: if l_idstr is not null and l_fyi_flag = false then
7811: l_idstr := wf_core.newline||l_idstr;
7809:
7810: if l_idstr is not null and l_fyi_flag = false then
7811: l_idstr := wf_core.newline||l_idstr;
7812: l_idsize := length(l_idstr);
7813: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_messageIdx).temp_lob,
7814: amount => l_idsize,
7815: buffer => l_idstr);
7816: end if;
7817:
7814: amount => l_idsize,
7815: buffer => l_idstr);
7816: end if;
7817:
7818: dbms_lob.writeAppend(g_LOBTable(l_messageIdx).temp_lob,
7819: length(l_end_cdata), l_end_cdata);
7820:
7821: -- Alert Message has been appended in XML Payload, can be released now
7822: l_pos := wf_xml.NewLOBTag(l_msg_doc, l_pos, 'MESSAGE',
8102: -- reset the session language
8103: WF_Notification.SetNLSLanguage(l_orig_lang, l_orig_terr);
8104:
8105: -- LOB to store message payload.
8106: dbms_lob.createtemporary(l_msg_doc, TRUE,dbms_lob.CALL);
8107:
8108: l_str := '';
8109: l_pos := LENGTH(l_str);
8110: dbms_lob.WRITE(l_msg_doc, l_pos, 1, l_str);
8106: dbms_lob.createtemporary(l_msg_doc, TRUE,dbms_lob.CALL);
8107:
8108: l_str := '';
8109: l_pos := LENGTH(l_str);
8110: dbms_lob.WRITE(l_msg_doc, l_pos, 1, l_str);
8111:
8112: --
8113: wf_xml.AddElementAttribute('maxcount','1',l_attrlist);
8114: l_pos := wf_xml.newlobtag(l_msg_doc,l_pos,'NOTIFICATIONGROUP','',l_attrlist);
8218:
8219:
8220: l_messageidx := wf_temp_lob.getlob(g_lobtable);
8221:
8222: dbms_lob.TRIM(g_lobtable(l_messageidx).temp_lob,0);
8223:
8224: dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8225: LENGTH(l_start_cdata), l_start_cdata);
8226:
8220: l_messageidx := wf_temp_lob.getlob(g_lobtable);
8221:
8222: dbms_lob.TRIM(g_lobtable(l_messageidx).temp_lob,0);
8223:
8224: dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8225: LENGTH(l_start_cdata), l_start_cdata);
8226:
8227: dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8228: src_lob=>l_text_body);
8223:
8224: dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8225: LENGTH(l_start_cdata), l_start_cdata);
8226:
8227: dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8228: src_lob=>l_text_body);
8229:
8230: dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8231: LENGTH(l_end_cdata),l_end_cdata);
8226:
8227: dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8228: src_lob=>l_text_body);
8229:
8230: dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8231: LENGTH(l_end_cdata),l_end_cdata);
8232:
8233: -- l_attrlist content-type='text/plain' will be used same
8234: -- as for BODYPART
8248: -- commenting below code as of now.
8249:
8250: -- reuse same LOB for html body
8251: -- Check if same can be re-used or not.
8252: --dbms_lob.trim(g_LOBTable(l_messageidx).temp_lob, 0);
8253:
8254: --l_attrlist.DELETE;
8255:
8256: --
8256: --
8257: --wf_xml.AddElementAttribute('content-type','text/html', l_attrlist);
8258: --l_pos := wf_xml.NewLOBTag(l_msg_doc,l_pos,'BODYPART', '', l_attrlist);
8259:
8260: --dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8261: -- LENGTH(l_start_cdata), l_start_cdata);
8262:
8263: --dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8264: -- src_lob=>l_html_body);
8259:
8260: --dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8261: -- LENGTH(l_start_cdata), l_start_cdata);
8262:
8263: --dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8264: -- src_lob=>l_html_body);
8265:
8266: --dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8267: -- LENGTH(l_end_cdata),l_end_cdata);
8262:
8263: --dbms_lob.append(dest_lob=>g_lobtable(l_messageidx).temp_lob,
8264: -- src_lob=>l_html_body);
8265:
8266: --dbms_lob.writeappend(g_lobtable(l_messageidx).temp_lob,
8267: -- LENGTH(l_end_cdata),l_end_cdata);
8268:
8269: --l_pos := wf_xml.NewLOBTag(l_msg_doc,l_pos, 'MESSAGE',
8270: -- g_lobtable(l_messageidx).temp_lob,