2056: str_buffer := str_buffer || g_newLine;
2057:
2058: if(length(str_buffer) > 24000) then
2059: str_buffer := UrlEncode(str_buffer);
2060: DBMS_LOB.writeAppend(lob_loc => doc,
2061: amount => length(str_buffer),
2062: buffer => str_buffer);
2063: str_buffer := '';
2064: end if;
2062: buffer => str_buffer);
2063: str_buffer := '';
2064: end if;
2065:
2066: -- DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob,
2067: -- length(str_buffer),
2068: -- str_buffer);
2069: -- str_buffer := '';
2070:
2070:
2071: end loop;
2072: if(length(str_buffer) > 0) then
2073: str_buffer := UrlEncode(str_buffer);
2074: DBMS_LOB.writeAppend(lob_loc => doc,
2075: amount => length(str_buffer),
2076: buffer => str_buffer);
2077: str_buffer := '';
2078: end if;
2075: amount => length(str_buffer),
2076: buffer => str_buffer);
2077: str_buffer := '';
2078: end if;
2079: -- DBMS_LOB.Append(doc, g_LOBTable(bufferIdx).temp_lob);
2080: -- wf_temp_lob.releaseLob(g_LOBTable, bufferIdx);
2081:
2082: exception
2083: when others then
3421: tokenFound boolean;
3422:
3423: begin
3424:
3425: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
3426: tempIdx := -1;
3427:
3428: offset := 1;
3429: sourcePos := 1;
3428: offset := 1;
3429: sourcePos := 1;
3430: targetPos := 1;
3431: continue := TRUE;
3432: msgLen := DBMS_LOB.GetLength(message);
3433: tokenLen := length(token);
3434: tokenFound := FALSE;
3435:
3436: while continue
3435:
3436: while continue
3437: loop
3438:
3439: pos := DBMS_LOB.Instr(message, token, offset, 1);
3440: if (pos <> 0) then
3441: if (pos + tokenLen <= msgLen) then
3442: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3443: if (instr(xSet, nextChar,1,1) > 0) then
3438:
3439: pos := DBMS_LOB.Instr(message, token, offset, 1);
3440: if (pos <> 0) then
3441: if (pos + tokenLen <= msgLen) then
3442: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3443: if (instr(xSet, nextChar,1,1) > 0) then
3444: validToken := false;
3445: else
3446: validToken := true;
3460: if tempIdx = -1 then
3461: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3462: end if;
3463: amount := pos - sourcePos;
3464: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
3465: src_lob => message,
3466: amount => amount,
3467: dest_offset => targetPos,
3468: src_offset => sourcePos);
3466: amount => amount,
3467: dest_offset => targetPos,
3468: src_offset => sourcePos);
3469: if (tokenValue <> '' or tokenValue is not null) then
3470: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3471: length(tokenValue), tokenValue);
3472: end if;
3473: sourcePos := pos + tokenLen;
3474: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3470: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3471: length(tokenValue), tokenValue);
3472: end if;
3473: sourcePos := pos + tokenLen;
3474: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3475: tokenFound := TRUE;
3476: end if;
3477: offset := pos + tokenLen;
3478: else
3480: if (amount > 0)then
3481: if tempIdx = -1 then
3482: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3483: end if;
3484: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3485: targetPos, sourcePos);
3486: end if;
3487:
3488: if (append and tokenFound = FALSE and msgLen > 0) then
3489: if (tokenValue <> '' or tokenValue is not null) then
3490: if tempIdx = -1 then
3491: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3492: end if;
3493: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3494: length(tokenValue), tokenValue);
3495: end if;
3496: end if;
3497: end if; -- CONTINUE
3498:
3499: end loop;
3500:
3501: if tokenFound = TRUE then
3502: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3503: DBMS_LOB.Trim(message, 0);
3504: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3505: end if;
3506:
3499: end loop;
3500:
3501: if tokenFound = TRUE then
3502: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3503: DBMS_LOB.Trim(message, 0);
3504: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3505: end if;
3506:
3507: -- << sstomar bug 6511028 >> Release allocated TEMP LOb.
3500:
3501: if tokenFound = TRUE then
3502: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3503: DBMS_LOB.Trim(message, 0);
3504: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3505: end if;
3506:
3507: -- << sstomar bug 6511028 >> Release allocated TEMP LOb.
3508: if tempIdx <> -1 then
3551: '0123456789_';
3552: tokenFound boolean;
3553:
3554: begin
3555: -- DBMS_LOB.CreateTemporary(temp, FALSE, DBMS_LOB.CALL);
3556: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3557:
3558: offset := 1;
3559: sourcePos := 1;
3558: offset := 1;
3559: sourcePos := 1;
3560: targetPos := 1;
3561: continue := TRUE;
3562: msgLen := DBMS_LOB.GetLength(message);
3563: tokenLen := length(token);
3564: tokenFound := FALSE;
3565:
3566: while continue
3564: tokenFound := FALSE;
3565:
3566: while continue
3567: loop
3568: pos := DBMS_LOB.Instr(message, token, offset, 1);
3569:
3570: if pos <> 0 then
3571: if (pos + tokenLen <= msgLen) then
3572: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3568: pos := DBMS_LOB.Instr(message, token, offset, 1);
3569:
3570: if pos <> 0 then
3571: if (pos + tokenLen <= msgLen) then
3572: nextChar := upper(dbms_lob.substr(message, 1, pos + tokenLen));
3573: if (instr(xSet, nextChar,1,1) > 0) then
3574: validToken := false;
3575: else
3576: validToken := true;
3585:
3586: if continue then
3587: if validToken then
3588: amount := pos - sourcePos;
3589: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3590: targetPos, sourcePos);
3591: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3592: if (tokenValueLen > 0) then
3593: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3587: if validToken then
3588: amount := pos - sourcePos;
3589: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3590: targetPos, sourcePos);
3591: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3592: if (tokenValueLen > 0) then
3593: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3594: end if;
3595: sourcePos := pos + tokenLen;
3589: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3590: targetPos, sourcePos);
3591: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3592: if (tokenValueLen > 0) then
3593: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3594: end if;
3595: sourcePos := pos + tokenLen;
3596: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3597: tokenFound := TRUE;
3592: if (tokenValueLen > 0) then
3593: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3594: end if;
3595: sourcePos := pos + tokenLen;
3596: targetPos := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob) + 1;
3597: tokenFound := TRUE;
3598: end if;
3599: offset := pos + tokenLen;
3600: else
3599: offset := pos + tokenLen;
3600: else
3601: amount := msgLen - sourcePos + 1;
3602: if (amount > 0) then
3603: DBMS_LOB.Copy(g_LOBTable(tempIdx).temp_lob, message, amount,
3604: targetPos, sourcePos);
3605: end if;
3606:
3607: if (append and tokenFound = FALSE and msgLen > 0) then
3604: targetPos, sourcePos);
3605: end if;
3606:
3607: if (append and tokenFound = FALSE and msgLen > 0) then
3608: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3609: if tokenValueLen <> 0 then
3610: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3611: end if;
3612: end if;
3606:
3607: if (append and tokenFound = FALSE and msgLen > 0) then
3608: tokenValueLen := DBMS_LOB.GetLength(tokenValue);
3609: if tokenValueLen <> 0 then
3610: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, tokenValue);
3611: end if;
3612: end if;
3613: end if;
3614: end loop;
3613: end if;
3614: end loop;
3615:
3616: if tokenFound then
3617: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3618: DBMS_LOB.Trim(message, 0);
3619: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3620: end if;
3621: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3614: end loop;
3615:
3616: if tokenFound then
3617: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3618: DBMS_LOB.Trim(message, 0);
3619: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3620: end if;
3621: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3622:
3615:
3616: if tokenFound then
3617: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3618: DBMS_LOB.Trim(message, 0);
3619: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob, msgLen);
3620: end if;
3621: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3622:
3623: exception
3715: --n_priority_text := wf_core.substitute('WFTKN', 'LOW');
3716: n_priority_text := wf_core.substitute('WFTKN', 'HIGH');
3717: end if;
3718:
3719: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.SESSION);
3720: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3721: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3722:
3723: pos := 1;
3716: n_priority_text := wf_core.substitute('WFTKN', 'HIGH');
3717: end if;
3718:
3719: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.SESSION);
3720: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
3721: tempIdx := wf_temp_lob.getLob(g_LOBTable);
3722:
3723: pos := 1;
3724: tempPos := 1;
3730:
3731: if amper = 0 then
3732: -- No ampers left. so write the rest of the CLOB
3733: if pos < msgLen then
3734: -- DBMS_LOB.Copy(temp, template, (msgLen - pos)+1, tempPos, pos);
3735: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (msgLen - pos)+1, tempPos,
3736: substr(template, pos, (msgLen - pos)+1));
3737: end if;
3738: EXIT;
3731: if amper = 0 then
3732: -- No ampers left. so write the rest of the CLOB
3733: if pos < msgLen then
3734: -- DBMS_LOB.Copy(temp, template, (msgLen - pos)+1, tempPos, pos);
3735: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (msgLen - pos)+1, tempPos,
3736: substr(template, pos, (msgLen - pos)+1));
3737: end if;
3738: EXIT;
3739: end if;
3742: -- token it is, if any.
3743:
3744: -- write from the last pos to the new token.
3745: if amper > pos then
3746: -- DBMS_LOB.Copy(temp, template, (amper - pos), tempPos, pos);
3747: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (amper - pos), tempPos,
3748: substr(template, pos, (amper - pos)));
3749: tempPos := tempPos + ((amper - pos));
3750: end if;
3743:
3744: -- write from the last pos to the new token.
3745: if amper > pos then
3746: -- DBMS_LOB.Copy(temp, template, (amper - pos), tempPos, pos);
3747: DBMS_LOB.Write(g_LOBTable(tempIdx).temp_lob, (amper - pos), tempPos,
3748: substr(template, pos, (amper - pos)));
3749: tempPos := tempPos + ((amper - pos));
3750: end if;
3751: pos := amper + 1;
3764: -- as only one token can be replaced in each iteration of while loop
3765: if instr(tokenName,'NOTIFICATION_ID',1,1)=1 then
3766: n_nidStr := to_char(n_nid);
3767: if n_nidStr is not null then
3768: -- DBMS_LOB.WriteAppend(temp, length(n_nidStr), n_nidStr);
3769: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_nidStr),
3770: n_nidStr);
3771: tempPos := tempPos + length(n_nidStr);
3772: end if;
3765: if instr(tokenName,'NOTIFICATION_ID',1,1)=1 then
3766: n_nidStr := to_char(n_nid);
3767: if n_nidStr is not null then
3768: -- DBMS_LOB.WriteAppend(temp, length(n_nidStr), n_nidStr);
3769: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_nidStr),
3770: n_nidStr);
3771: tempPos := tempPos + length(n_nidStr);
3772: end if;
3773: pos := amper + length('NOTIFICATION_ID') + 1;
3774: tokenMatch := TRUE;
3775:
3776: elsif instr(tokenName,'NOTIFICATION',1,1)=1 then
3777: if n_code is not null then
3778: -- DBMS_LOB.WriteAppend(temp, length(n_code), n_code);
3779: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_code),
3780: n_code);
3781: tempPos := tempPos + length(n_code);
3782: end if;
3775:
3776: elsif instr(tokenName,'NOTIFICATION',1,1)=1 then
3777: if n_code is not null then
3778: -- DBMS_LOB.WriteAppend(temp, length(n_code), n_code);
3779: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_code),
3780: n_code);
3781: tempPos := tempPos + length(n_code);
3782: end if;
3783: pos := amper + length('NOTIFICATION') + 1;
3784: tokenMatch := TRUE;
3785:
3786: elsif instr(tokenName,'STATUS',1,1)=1 then
3787: if n_status is not null then
3788: -- DBMS_LOB.WriteAppend(temp, length(n_status), n_status);
3789: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_status), n_status);
3790: tempPos := tempPos + length(n_status);
3791: end if;
3792: pos := amper + length('STATUS') + 1;
3785:
3786: elsif instr(tokenName,'STATUS',1,1)=1 then
3787: if n_status is not null then
3788: -- DBMS_LOB.WriteAppend(temp, length(n_status), n_status);
3789: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_status), n_status);
3790: tempPos := tempPos + length(n_status);
3791: end if;
3792: pos := amper + length('STATUS') + 1;
3793: tokenMatch := TRUE;
3793: tokenMatch := TRUE;
3794:
3795: elsif instr(tokenName, 'TO_DNAME', 1, 1)=1 then
3796: if r_dname is not null then
3797: -- DBMS_LOB.WriteAppend(temp, length(r_dname), r_dname);
3798: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_dname), r_dname);
3799: tempPos := tempPos + length(r_dname);
3800: end if;
3801: pos := amper + length('TO_DNAME') + 1;
3794:
3795: elsif instr(tokenName, 'TO_DNAME', 1, 1)=1 then
3796: if r_dname is not null then
3797: -- DBMS_LOB.WriteAppend(temp, length(r_dname), r_dname);
3798: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_dname), r_dname);
3799: tempPos := tempPos + length(r_dname);
3800: end if;
3801: pos := amper + length('TO_DNAME') + 1;
3802: tokenMatch := TRUE;
3802: tokenMatch := TRUE;
3803:
3804: elsif instr(tokenName, 'TO_EMAIL', 1, 1)=1 then
3805: if r_email is not null then
3806: -- DBMS_LOB.WriteAppend(temp, length(r_email), r_email);
3807: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_email), r_email);
3808: tempPos := tempPos + length(r_email);
3809: end if;
3810: pos := amper + length('TO_EMAIL') + 1;
3803:
3804: elsif instr(tokenName, 'TO_EMAIL', 1, 1)=1 then
3805: if r_email is not null then
3806: -- DBMS_LOB.WriteAppend(temp, length(r_email), r_email);
3807: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(r_email), r_email);
3808: tempPos := tempPos + length(r_email);
3809: end if;
3810: pos := amper + length('TO_EMAIL') + 1;
3811: tokenMatch := TRUE;
3811: tokenMatch := TRUE;
3812:
3813: elsif instr(tokenName,'TO',1,1)=1 then
3814: if n_to_role is not null then
3815: -- DBMS_LOB.WriteAppend(temp, length(n_to_role), n_to_role);
3816: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_to_role), n_to_role);
3817: tempPos := tempPos + length(n_to_role);
3818: end if;
3819: pos := amper + length('TO') + 1;
3812:
3813: elsif instr(tokenName,'TO',1,1)=1 then
3814: if n_to_role is not null then
3815: -- DBMS_LOB.WriteAppend(temp, length(n_to_role), n_to_role);
3816: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_to_role), n_to_role);
3817: tempPos := tempPos + length(n_to_role);
3818: end if;
3819: pos := amper + length('TO') + 1;
3820: tokenMatch := TRUE;
3820: tokenMatch := TRUE;
3821:
3822: elsif instr(tokenName, 'PRIORITY', 1, 1)=1 then
3823: if n_priority_text is not null then
3824: -- DBMS_LOB.WriteAppend(temp, length(n_priority_text), n_priority_text);
3825: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_priority_text),
3826: n_priority_text);
3827: tempPos := tempPos + length(n_priority_text);
3828: end if;
3821:
3822: elsif instr(tokenName, 'PRIORITY', 1, 1)=1 then
3823: if n_priority_text is not null then
3824: -- DBMS_LOB.WriteAppend(temp, length(n_priority_text), n_priority_text);
3825: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_priority_text),
3826: n_priority_text);
3827: tempPos := tempPos + length(n_priority_text);
3828: end if;
3829: pos := amper + length('PRIORITY') + 1;
3830: tokenMatch := TRUE;
3831:
3832: elsif instr(tokenName, 'START_DATE', 1, 1)=1 then
3833: if n_start_date is not null then
3834: -- DBMS_LOB.WriteAppend(temp, length(n_start_date), n_start_date);
3835: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3836: length(n_start_date_text), n_start_date_text);
3837: tempPos := tempPos + length(n_start_date_text);
3838: end if;
3831:
3832: elsif instr(tokenName, 'START_DATE', 1, 1)=1 then
3833: if n_start_date is not null then
3834: -- DBMS_LOB.WriteAppend(temp, length(n_start_date), n_start_date);
3835: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3836: length(n_start_date_text), n_start_date_text);
3837: tempPos := tempPos + length(n_start_date_text);
3838: end if;
3839: pos := amper + length('START_DATE') + 1;
3840: tokenMatch := TRUE;
3841:
3842: elsif instr(tokenName, 'DUE_DATE', 1, 1)=1 then
3843: if n_due_date is not null then
3844: -- DBMS_LOB.WriteAppend(temp, length(n_due_date_text), n_due_date_text);
3845: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_due_date_text),
3846: n_due_date_text);
3847: tempPos := tempPos + length(n_due_date_text);
3848: end if;
3841:
3842: elsif instr(tokenName, 'DUE_DATE', 1, 1)=1 then
3843: if n_due_date is not null then
3844: -- DBMS_LOB.WriteAppend(temp, length(n_due_date_text), n_due_date_text);
3845: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_due_date_text),
3846: n_due_date_text);
3847: tempPos := tempPos + length(n_due_date_text);
3848: end if;
3849: pos := amper + length('DUE_DATE') + 1;
3850: tokenMatch := TRUE;
3851:
3852: elsif instr(tokenName, 'END_DATE', 1, 1)=1 then
3853: if n_end_date is not null then
3854: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3855: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3856: -- n_end_date);
3857: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3858: n_end_date_text);
3851:
3852: elsif instr(tokenName, 'END_DATE', 1, 1)=1 then
3853: if n_end_date is not null then
3854: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3855: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3856: -- n_end_date);
3857: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3858: n_end_date_text);
3859:
3853: if n_end_date is not null then
3854: -- DBMS_LOB.WriteAppend(temp, length(n_end_date), n_end_date);
3855: -- DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date),
3856: -- n_end_date);
3857: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_end_date_text),
3858: n_end_date_text);
3859:
3860: tempPos := tempPos + length(n_end_date_text);
3861: end if;
3863: tokenMatch := TRUE;
3864:
3865: elsif instr(tokenName, 'SENDER', 1, 1)=1 then
3866: if n_from_user is not null then
3867: -- DBMS_LOB.WriteAppend(temp, length(n_from_user), n_from_user);
3868: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_from_user),
3869: n_from_user);
3870: tempPos := tempPos + length(n_from_user);
3871: end if;
3864:
3865: elsif instr(tokenName, 'SENDER', 1, 1)=1 then
3866: if n_from_user is not null then
3867: -- DBMS_LOB.WriteAppend(temp, length(n_from_user), n_from_user);
3868: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(n_from_user),
3869: n_from_user);
3870: tempPos := tempPos + length(n_from_user);
3871: end if;
3872: pos := amper + length('SENDER') + 1;
3873: tokenMatch := TRUE;
3874:
3875: elsif instr(tokenName, 'COMMENT', 1, 1)=1 then
3876: if n_comment is not null then
3877: -- DBMS_LOB.WriteAppend(temp, length(n_comment), n_comment);
3878: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3879: length(n_comment), n_comment);
3880: tempPos := tempPos + length(n_comment);
3881: end if;
3874:
3875: elsif instr(tokenName, 'COMMENT', 1, 1)=1 then
3876: if n_comment is not null then
3877: -- DBMS_LOB.WriteAppend(temp, length(n_comment), n_comment);
3878: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3879: length(n_comment), n_comment);
3880: tempPos := tempPos + length(n_comment);
3881: end if;
3882: pos := amper + length('COMMENT') + 1;
3883: tokenMatch := TRUE;
3884:
3885: elsif instr(tokenName, 'TIMEZONE', 1, 1)=1 then
3886: if n_timezone is not null then
3887: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob,
3888: length(n_timezone), n_timezone);
3889: tempPos := tempPos + length(n_timezone);
3890: end if;
3891: pos := amper + length('TIMEZONE') + 1;
3892: tokenMatch := TRUE;
3893:
3894: elsif instr(tokenName, 'SUBJECT', 1, 1)=1 then
3895: if m_subject is not null then
3896: -- DBMS_LOB.WriteAppend(temp, length(m_subject), m_subject);
3897: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_subject), m_subject);
3898: tempPos := tempPos + length(m_subject);
3899: end if;
3900: pos := amper + length('SUBJECT') + 1;
3893:
3894: elsif instr(tokenName, 'SUBJECT', 1, 1)=1 then
3895: if m_subject is not null then
3896: -- DBMS_LOB.WriteAppend(temp, length(m_subject), m_subject);
3897: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_subject), m_subject);
3898: tempPos := tempPos + length(m_subject);
3899: end if;
3900: pos := amper + length('SUBJECT') + 1;
3901: tokenMatch := TRUE;
3901: tokenMatch := TRUE;
3902:
3903: elsif instr(tokenName, 'HEADER', 1, 1)=1 then
3904: if m_header is not null then
3905: --DBMS_LOB.WriteAppend(temp, length(m_header), m_header);
3906: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_header), m_header);
3907: tempPos := tempPos + length(m_header);
3908: end if;
3909: pos := amper + length('HEADER') + 1;
3902:
3903: elsif instr(tokenName, 'HEADER', 1, 1)=1 then
3904: if m_header is not null then
3905: --DBMS_LOB.WriteAppend(temp, length(m_header), m_header);
3906: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(m_header), m_header);
3907: tempPos := tempPos + length(m_header);
3908: end if;
3909: pos := amper + length('HEADER') + 1;
3910: tokenMatch := TRUE;
3909: pos := amper + length('HEADER') + 1;
3910: tokenMatch := TRUE;
3911:
3912: elsif instr(tokenName, 'BODY', 1, 1)=1 then
3913: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3914: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3915: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3916: pos := amper + length('BODY') + 1;
3917: tokenMatch := TRUE;
3910: tokenMatch := TRUE;
3911:
3912: elsif instr(tokenName, 'BODY', 1, 1)=1 then
3913: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3914: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3915: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3916: pos := amper + length('BODY') + 1;
3917: tokenMatch := TRUE;
3918: else
3911:
3912: elsif instr(tokenName, 'BODY', 1, 1)=1 then
3913: if (m_body is not null and dbms_lob.getLength(m_body) > 0) or not g_isFwkNtf then
3914: DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob, m_body);
3915: tempPos := tempPos + DBMS_LOB.GetLength(m_body);
3916: pos := amper + length('BODY') + 1;
3917: tokenMatch := TRUE;
3918: else
3919: tokenMatch := FALSE;
3920: end if;
3921:
3922: elsif instr(tokenName, 'MAIL_ERROR_NAME', 1, 1)=1 then
3923: if err_name is not null then
3924: -- DBMS_LOB.WriteAppend(temp, length(err_name), err_name);
3925: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_name), err_name);
3926: tempPos := tempPos + length(err_name);
3927: end if;
3928: pos := amper + length('MAIL_ERROR_NAME') + 1;
3921:
3922: elsif instr(tokenName, 'MAIL_ERROR_NAME', 1, 1)=1 then
3923: if err_name is not null then
3924: -- DBMS_LOB.WriteAppend(temp, length(err_name), err_name);
3925: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_name), err_name);
3926: tempPos := tempPos + length(err_name);
3927: end if;
3928: pos := amper + length('MAIL_ERROR_NAME') + 1;
3929: tokenMatch := TRUE;
3929: tokenMatch := TRUE;
3930:
3931: elsif instr(tokenName, 'MAIL_ERROR_MESSAGE', 1, 1)=1 then
3932: if err_message is not null then
3933: -- DBMS_LOB.WriteAppend(temp, length(err_message), err_message);
3934: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_message),
3935: err_message);
3936: tempPos := tempPos + length(err_message);
3937: end if;
3930:
3931: elsif instr(tokenName, 'MAIL_ERROR_MESSAGE', 1, 1)=1 then
3932: if err_message is not null then
3933: -- DBMS_LOB.WriteAppend(temp, length(err_message), err_message);
3934: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_message),
3935: err_message);
3936: tempPos := tempPos + length(err_message);
3937: end if;
3938: pos := amper + length('MAIL_ERROR_MESSAGE') + 1;
3944: -- to go with the WARNING message
3945:
3946: elsif instr(tokenName, 'MAIL_VALUE_FOUND', 1, 1)=1 then
3947: if err_invalid is not null then
3948: -- DBMS_LOB.WriteAppend(temp, length(err_invalid), err_invalid);
3949: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_invalid),
3950: err_invalid);
3951: tempPos := tempPos + length(err_invalid);
3952: end if;
3945:
3946: elsif instr(tokenName, 'MAIL_VALUE_FOUND', 1, 1)=1 then
3947: if err_invalid is not null then
3948: -- DBMS_LOB.WriteAppend(temp, length(err_invalid), err_invalid);
3949: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_invalid),
3950: err_invalid);
3951: tempPos := tempPos + length(err_invalid);
3952: end if;
3953: pos := amper + length('MAIL_VALUE_FOUND') + 1;
3955:
3956:
3957: elsif instr(tokenName, 'MAIL_EXP_VALUES', 1, 1)=1 then
3958: if err_expected is not null then
3959: -- DBMS_LOB.WriteAppend(temp, length(err_expected), err_expected);
3960: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_expected),
3961: err_expected);
3962: tempPos := tempPos + length(err_expected);
3963: end if;
3956:
3957: elsif instr(tokenName, 'MAIL_EXP_VALUES', 1, 1)=1 then
3958: if err_expected is not null then
3959: -- DBMS_LOB.WriteAppend(temp, length(err_expected), err_expected);
3960: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, length(err_expected),
3961: err_expected);
3962: tempPos := tempPos + length(err_expected);
3963: end if;
3964: pos := amper + length('MAIL_EXP_VALUES') + 1;
3965: tokenMatch := TRUE;
3966: end if;
3967:
3968: if not tokenMatch and amper > 0 then
3969: -- DBMS_LOB.WriteAppend(temp, 1, '&');
3970: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, '&');
3971: tempPos := tempPos + 1;
3972: end if;
3973:
3966: end if;
3967:
3968: if not tokenMatch and amper > 0 then
3969: -- DBMS_LOB.WriteAppend(temp, 1, '&');
3970: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, '&');
3971: tempPos := tempPos + 1;
3972: end if;
3973:
3974: end loop;
3972: end if;
3973:
3974: end loop;
3975:
3976: -- msgLen := DBMS_LOB.GetLength(temp);
3977: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3978: if msgLen > 0 then
3979: DBMS_LOB.Trim(m_body, 0);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3973:
3974: end loop;
3975:
3976: -- msgLen := DBMS_LOB.GetLength(temp);
3977: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3978: if msgLen > 0 then
3979: DBMS_LOB.Trim(m_body, 0);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3975:
3976: -- msgLen := DBMS_LOB.GetLength(temp);
3977: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3978: if msgLen > 0 then
3979: DBMS_LOB.Trim(m_body, 0);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3982: end if;
3983:
3976: -- msgLen := DBMS_LOB.GetLength(temp);
3977: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3978: if msgLen > 0 then
3979: DBMS_LOB.Trim(m_body, 0);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3982: end if;
3983:
3984: -- DBMS_LOB.Close(temp);
3977: msgLen := DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob);
3978: if msgLen > 0 then
3979: DBMS_LOB.Trim(m_body, 0);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3982: end if;
3983:
3984: -- DBMS_LOB.Close(temp);
3985: -- DBMS_LOB.FreeTemporary(temp);
3980: -- DBMS_LOB.Copy(m_body, temp, msgLen);
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3982: end if;
3983:
3984: -- DBMS_LOB.Close(temp);
3985: -- DBMS_LOB.FreeTemporary(temp);
3986: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3987:
3988: exception
3981: DBMS_LOB.Copy(m_body, g_LOBTable(tempIdx).temp_lob, msgLen);
3982: end if;
3983:
3984: -- DBMS_LOB.Close(temp);
3985: -- DBMS_LOB.FreeTemporary(temp);
3986: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
3987:
3988: exception
3989: when others then
4026: --
4027: lnsize := lineSize;
4028: start_cnt := 1;
4029: end_cnt := lnsize;
4030: str_length := DBMS_LOB.GetLength(message);
4031: if str_length = 0 then
4032: return;
4033: end if;
4034:
4031: if str_length = 0 then
4032: return;
4033: end if;
4034:
4035: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
4036: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
4037: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
4038: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
4039: tempIdx := wf_temp_lob.getLob(g_LOBTable);
4032: return;
4033: end if;
4034:
4035: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
4036: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
4037: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
4038: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
4039: tempIdx := wf_temp_lob.getLob(g_LOBTable);
4040: lineIdx := wf_temp_lob.getLob(g_LOBTable);
4033: end if;
4034:
4035: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
4036: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
4037: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
4038: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
4039: tempIdx := wf_temp_lob.getLob(g_LOBTable);
4040: lineIdx := wf_temp_lob.getLob(g_LOBTable);
4041:
4034:
4035: -- DBMS_LOB.CreateTemporary(temp, TRUE, DBMS_LOB.CALL);
4036: -- DBMS_LOB.CreateTemporary(line, TRUE, DBMS_LOB.CALL);
4037: -- DBMS_LOB.Open(temp, DBMS_LOB.LOB_READWRITE);
4038: -- DBMS_LOB.Open(line, DBMS_LOB.LOB_READWRITE);
4039: tempIdx := wf_temp_lob.getLob(g_LOBTable);
4040: lineIdx := wf_temp_lob.getLob(g_LOBTable);
4041:
4042: while start_cnt < str_length loop
4040: lineIdx := wf_temp_lob.getLob(g_LOBTable);
4041:
4042: while start_cnt < str_length loop
4043: -- use the existing newlines as a natural break
4044: crpos := DBMS_LOB.instr(message, g_newLine, start_cnt+1, 1) - start_cnt;
4045:
4046:
4047: if crpos > 0 and crpos < end_cnt then
4048: -- If there was a line bread and it is positioned less than the
4054: end if;
4055:
4056: -- Move forward to the next white space.
4057: while (start_cnt + end_cnt < str_length) and
4058: DBMS_LOB.substr(message, 1, start_cnt + end_cnt)
4059: not in (' ', g_newLine, g_tab)
4060: and end_cnt < maxLineSize loop
4061: end_cnt := end_cnt + 1;
4062: end loop;
4067:
4068: if end_cnt >= (maxLineSize) then
4069: end_cnt := lnsize;
4070: while (start_cnt + end_cnt > start_cnt) and
4071: DBMS_LOB.substr(message, 1, start_cnt + end_cnt)
4072: not in (' ', g_newLine, g_tab)
4073: and end_cnt > 0 loop
4074: end_cnt := end_cnt - 1;
4075: end loop;
4080: end if;
4081: end if;
4082:
4083: -- Ensure the last characters are not lost.
4084: -- DBMS_LOB.Trim(line, 0);
4085: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4081: end if;
4082:
4083: -- Ensure the last characters are not lost.
4084: -- DBMS_LOB.Trim(line, 0);
4085: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4082:
4083: -- Ensure the last characters are not lost.
4084: -- DBMS_LOB.Trim(line, 0);
4085: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4084: -- DBMS_LOB.Trim(line, 0);
4085: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4085: DBMS_LOB.Trim(g_LOBTable(lineIdx).temp_lob, 0);
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4086: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4087: if start_cnt + end_cnt >= str_length then
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4094: -- start_cnt);
4088: -- line := DBMS_LOB.substr(message, start_cnt);
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4094: -- start_cnt);
4095: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4096: src_lob => message,
4089: -- DBMS_LOB.Copy(line, message,
4090: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4094: -- start_cnt);
4095: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4096: src_lob => message,
4097: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
4091: -- start_cnt);
4092: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message,
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4094: -- start_cnt);
4095: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4096: src_lob => message,
4097: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
4098: dest_offset => tempOffset,
4099: src_offset => start_cnt);
4093: -- DBMS_LOB.GetLength(message) - start_cnt +1 , 1,
4094: -- start_cnt);
4095: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4096: src_lob => message,
4097: amount => DBMS_LOB.GetLength(message) - start_cnt +1 ,
4098: dest_offset => tempOffset,
4099: src_offset => start_cnt);
4100:
4101: else
4098: dest_offset => tempOffset,
4099: src_offset => start_cnt);
4100:
4101: else
4102: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
4103: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
4104: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
4105: -- start_cnt);
4106: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4099: src_offset => start_cnt);
4100:
4101: else
4102: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
4103: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
4104: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
4105: -- start_cnt);
4106: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4107: src_lob => message,
4100:
4101: else
4102: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
4103: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
4104: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
4105: -- start_cnt);
4106: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4107: src_lob => message,
4108: amount => end_cnt,
4102: -- line := DBMS_LOB.substr(message, start_cnt, end_cnt);
4103: -- DBMS_LOB.Copy(line, message, end_cnt, 1, start_cnt);
4104: -- DBMS_LOB.Copy(g_LOBTable(lineIdx).temp_lob, message, end_cnt, 1,
4105: -- start_cnt);
4106: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4107: src_lob => message,
4108: amount => end_cnt,
4109: dest_offset => tempOffset,
4110: src_offset => start_cnt);
4110: src_offset => start_cnt);
4111: end if;
4112:
4113: -- temp := temp || line;
4114: -- DBMS_LOB.Append(temp, line);
4115: -- DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob,
4116: -- g_LOBTable(lineIdx).temp_lob);
4117:
4118: -- If there is a newline at this point,
4111: end if;
4112:
4113: -- temp := temp || line;
4114: -- DBMS_LOB.Append(temp, line);
4115: -- DBMS_LOB.Append(g_LOBTable(tempIdx).temp_lob,
4116: -- g_LOBTable(lineIdx).temp_lob);
4117:
4118: -- If there is a newline at this point,
4119: -- then do not bother with another.
4116: -- g_LOBTable(lineIdx).temp_lob);
4117:
4118: -- If there is a newline at this point,
4119: -- then do not bother with another.
4120: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
4121: g_newLine then
4122: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
4123: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4124: end if;
4118: -- If there is a newline at this point,
4119: -- then do not bother with another.
4120: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
4121: g_newLine then
4122: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
4123: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4124: end if;
4125:
4126: -- We do not want to start the new line with the space.
4119: -- then do not bother with another.
4120: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) <>
4121: g_newLine then
4122: -- DBMS_LOB.WriteAppend(temp, 1, g_newLine);
4123: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4124: end if;
4125:
4126: -- We do not want to start the new line with the space.
4127: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) = ' ' then
4123: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4124: end if;
4125:
4126: -- We do not want to start the new line with the space.
4127: if DBMS_LOB.substr(message, 1, start_cnt + end_cnt) = ' ' then
4128: start_cnt := start_cnt + end_cnt + 1;
4129: else
4130: start_cnt := start_cnt + end_cnt;
4131: end if;
4130: start_cnt := start_cnt + end_cnt;
4131: end if;
4132: end_cnt := lnsize;
4133: end loop;
4134: DBMS_LOB.Trim(message, 0);
4135: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
4136: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4131: end if;
4132: end_cnt := lnsize;
4133: end loop;
4134: DBMS_LOB.Trim(message, 0);
4135: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
4136: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4139:
4132: end_cnt := lnsize;
4133: end loop;
4134: DBMS_LOB.Trim(message, 0);
4135: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
4136: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4139:
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4133: end loop;
4134: DBMS_LOB.Trim(message, 0);
4135: -- DBMS_LOB.Copy(message, temp, DBMS_LOB.GetLength(temp), 1, 1);
4136: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4139:
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4141: -- DBMS_LOB.Close(temp);
4136: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4139:
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4141: -- DBMS_LOB.Close(temp);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4137: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4138:
4139:
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4141: -- DBMS_LOB.Close(temp);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4145: -- DBMS_LOB.Close(line);
4138:
4139:
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4141: -- DBMS_LOB.Close(temp);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4145: -- DBMS_LOB.Close(line);
4146: -- DBMS_LOB.FreeTemporary(line);
4140: -- if DBMS_LOB.IsOpen(temp)=1 then
4141: -- DBMS_LOB.Close(temp);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4145: -- DBMS_LOB.Close(line);
4146: -- DBMS_LOB.FreeTemporary(line);
4147: -- end if;
4148: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
4141: -- DBMS_LOB.Close(temp);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4145: -- DBMS_LOB.Close(line);
4146: -- DBMS_LOB.FreeTemporary(line);
4147: -- end if;
4148: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
4149: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4142: -- DBMS_LOB.FreeTemporary(temp);
4143: -- end if;
4144: -- if DBMS_LOB.IsOpen(line)=1 then
4145: -- DBMS_LOB.Close(line);
4146: -- DBMS_LOB.FreeTemporary(line);
4147: -- end if;
4148: wf_temp_lob.releaseLob(g_LOBTable, lineIdx);
4149: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4150:
4180: lnsize := textWidth;
4181: bfr_start := 1;
4182: chk_start := 1;
4183: line_size := lnsize;
4184: doc_length := DBMS_LOB.GetLength(message);
4185: if doc_length = 0 or doc_length < line_size then
4186: return;
4187: end if;
4188:
4197: insertNewLine := false;
4198:
4199: -- use the existing newlines as a natural break. If found
4200: -- crpos will be the relative position from chk_start.
4201: crpos := DBMS_LOB.instr(lob_loc => message,
4202: pattern => g_newLine,
4203: offset => chk_start,
4204: nth => 1) - chk_start;
4205:
4212: insertNewLine := false;
4213: else
4214: -- Move forward to the next white space.
4215:
4216: wsLoc := DBMS_LOB.instr(lob_loc => message,
4217: pattern => ' ',
4218: offset => (chk_start + line_size),
4219: nth => 1) - chk_start;
4220:
4217: pattern => ' ',
4218: offset => (chk_start + line_size),
4219: nth => 1) - chk_start;
4220:
4221: crpos := DBMS_LOB.instr(lob_loc => message,
4222: pattern => g_newline,
4223: offset => (chk_start + line_size),
4224: nth => 1) - chk_start;
4225:
4231: insertNewLine := true;
4232: whitespace := true;
4233: else
4234:
4235: wsLoc := DBMS_LOB.instr(lob_loc => message,
4236: pattern => g_newLine,
4237: offset => chk_start + line_size,
4238: nth => 1) - chk_start;
4239:
4243: insertNewLine := false;
4244: whitespace := true;
4245: else
4246:
4247: wsLoc := DBMS_LOB.instr(lob_loc => message,
4248: pattern => g_tab,
4249: offset => chk_start + line_size,
4250: nth => 1) - chk_start;
4251:
4264:
4265: -- Ensure the last characters are not lost.
4266: if chk_start + line_size >= doc_length then
4267: -- copy from the chk_start to the end of the document.
4268: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4269:
4270: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4271: src_lob => message,
4272: amount => doc_length - bfr_start +1 ,
4266: if chk_start + line_size >= doc_length then
4267: -- copy from the chk_start to the end of the document.
4268: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4269:
4270: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4271: src_lob => message,
4272: amount => doc_length - bfr_start +1 ,
4273: dest_offset => tempOffset,
4274: src_offset => bfr_start);
4273: dest_offset => tempOffset,
4274: src_offset => bfr_start);
4275: elsif insertNewLine then
4276: -- Copy partial and make note of the current position
4277: -- This is to minimise the number of calls to dbms_lob.copy.
4278: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4279: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4280: src_lob => message,
4281: amount => (chk_start - bfr_start) + line_size,
4274: src_offset => bfr_start);
4275: elsif insertNewLine then
4276: -- Copy partial and make note of the current position
4277: -- This is to minimise the number of calls to dbms_lob.copy.
4278: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4279: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4280: src_lob => message,
4281: amount => (chk_start - bfr_start) + line_size,
4282: dest_offset => tempOffset,
4275: elsif insertNewLine then
4276: -- Copy partial and make note of the current position
4277: -- This is to minimise the number of calls to dbms_lob.copy.
4278: tempOffset := dbms_lob.getLength(g_LOBTable(tempIdx).temp_lob) +1;
4279: DBMS_LOB.Copy(dest_lob => g_LOBTable(tempIdx).temp_lob,
4280: src_lob => message,
4281: amount => (chk_start - bfr_start) + line_size,
4282: dest_offset => tempOffset,
4283: src_offset => bfr_start);
4280: src_lob => message,
4281: amount => (chk_start - bfr_start) + line_size,
4282: dest_offset => tempOffset,
4283: src_offset => bfr_start);
4284: DBMS_LOB.WriteAppend(g_LOBTable(tempIdx).temp_lob, 1, g_newLine);
4285: bfr_start := chk_start + line_size +1;
4286: end if;
4287:
4288: if wsLoc > 0 then
4292: end if;
4293: line_size := lnsize;
4294: end loop;
4295:
4296: DBMS_LOB.Trim(message, 0);
4297: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4298: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4299:
4300: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4293: line_size := lnsize;
4294: end loop;
4295:
4296: DBMS_LOB.Trim(message, 0);
4297: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4298: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4299:
4300: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4301: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4294: end loop;
4295:
4296: DBMS_LOB.Trim(message, 0);
4297: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4298: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4299:
4300: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4301: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4302:
4296: DBMS_LOB.Trim(message, 0);
4297: DBMS_LOB.Copy(message, g_LOBTable(tempIdx).temp_lob,
4298: DBMS_LOB.GetLength(g_LOBTable(tempIdx).temp_lob), 1, 1);
4299:
4300: DBMS_LOB.Trim(g_LOBTable(tempIdx).temp_lob, 0);
4301: wf_temp_lob.releaseLob(g_LOBTable, tempIdx);
4302:
4303: end OBSOLETE2LOBLineBreak;
4304:
4331: begin
4332:
4333: l_tempIdx := wf_temp_lob.getLob(g_LOBTable);
4334:
4335: l_amount := dbms_lob.getLength(message);
4336: l_offset := 1;
4337: l_bufferSize := l_lineSize;
4338: l_forcedBreak := false;
4339:
4341: loop
4342: l_lastCR := 0;
4343: l_forcedBreak := false;
4344: if(l_amount > l_lineSize) then
4345: dbms_lob.read(lob_loc => message, amount => l_lineSize,
4346: offset => l_offSet, buffer => l_strBuffer);
4347:
4348: l_lastCR := instr(l_strBuffer, wf_core.newline, -1);
4349: l_lastWS := instr(l_strBuffer, ' ', -1);
4367: -- same size as the space that was removed
4368: l_bufferSize := length(l_strBuffer);
4369: end if;
4370:
4371: DBMS_LOB.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4372: amount => l_bufferSize,
4373: buffer => l_strBuffer);
4374:
4375: l_strBuffer := '';
4374:
4375: l_strBuffer := '';
4376: else
4377:
4378: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4379: dbms_lob.read(lob_loc => message, amount => l_amount,
4380: offset => l_offset, buffer => l_strBuffer);
4381:
4382: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4375: l_strBuffer := '';
4376: else
4377:
4378: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4379: dbms_lob.read(lob_loc => message, amount => l_amount,
4380: offset => l_offset, buffer => l_strBuffer);
4381:
4382: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4383: amount => l_amount,
4378: l_amount := (dbms_lob.getLength(message) - l_offset) + 1;
4379: dbms_lob.read(lob_loc => message, amount => l_amount,
4380: offset => l_offset, buffer => l_strBuffer);
4381:
4382: dbms_lob.writeAppend(lob_loc => g_LOBTable(l_tempIdx).temp_lob,
4383: amount => l_amount,
4384: buffer => l_strBuffer);
4385:
4386: exit;
4385:
4386: exit;
4387: end if;
4388: end loop;
4389: DBMS_LOB.Trim(message, 0);
4390: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4391: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4392:
4393: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4386: exit;
4387: end if;
4388: end loop;
4389: DBMS_LOB.Trim(message, 0);
4390: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4391: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4392:
4393: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4394: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4387: end if;
4388: end loop;
4389: DBMS_LOB.Trim(message, 0);
4390: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4391: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4392:
4393: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4394: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4395: end if;
4389: DBMS_LOB.Trim(message, 0);
4390: DBMS_LOB.Copy(message, g_LOBTable(l_tempIdx).temp_lob,
4391: DBMS_LOB.GetLength(g_LOBTable(l_tempIdx).temp_lob), 1, 1);
4392:
4393: DBMS_LOB.Trim(g_LOBTable(l_tempIdx).temp_lob, 0);
4394: wf_temp_lob.releaseLob(g_LOBTable, l_tempIdx);
4395: end if;
4396:
4397: -- exception
4449:
4450:
4451: -- Clear buffer
4452: str_buffer := '';
4453: -- DBMS_LOB.createTemporary(buffer, FALSE, dbms_lob.call);
4454: bufferIdx := wf_temp_lob.getLob(g_LOBTable);
4455:
4456: -- URL RESPONSE attributes overrides the normal RESULT attributes.
4457: -- So, my goal here is to check for this case.
4473: '" target="_top">';
4474: str_buffer := str_buffer||' '||rec.display_name;
4475: str_buffer := str_buffer||''||'';
4476: str_buffer := str_buffer||g_newLine;
4477: -- DBMS_LOB.writeAppend(buffer, length(str_buffer), str_buffer);
4478: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4479: str_buffer := '';
4480: end loop;
4481:
4474: str_buffer := str_buffer||' '||rec.display_name;
4475: str_buffer := str_buffer||''||'';
4476: str_buffer := str_buffer||g_newLine;
4477: -- DBMS_LOB.writeAppend(buffer, length(str_buffer), str_buffer);
4478: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4479: str_buffer := '';
4480: end loop;
4481:
4482: -- if (dbms_lob.GetLength(buffer) > 0) then
4478: DBMS_LOB.writeAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4479: str_buffer := '';
4480: end loop;
4481:
4482: -- if (dbms_lob.GetLength(buffer) > 0) then
4483: if (dbms_lob.GetLength(g_LOBTable(bufferIdx).temp_lob) > 0) then
4484: -- LOBReplace(doc, '&'||'MAILTO', buffer, FALSE);
4485: LOBReplace(doc, '&'||'MAILTO', g_LOBTable(bufferIdx).temp_lob, FALSE);
4486: RETURN;
4479: str_buffer := '';
4480: end loop;
4481:
4482: -- if (dbms_lob.GetLength(buffer) > 0) then
4483: if (dbms_lob.GetLength(g_LOBTable(bufferIdx).temp_lob) > 0) then
4484: -- LOBReplace(doc, '&'||'MAILTO', buffer, FALSE);
4485: LOBReplace(doc, '&'||'MAILTO', g_LOBTable(bufferIdx).temp_lob, FALSE);
4486: RETURN;
4487: end if;
4546: str_buffer := str_buffer||'
'||disp_name||': '||''||
4559: g_noResult||''||'';
4560:
4561: DBMS_LOB.WriteAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4562: str_buffer := '';
4563:
4564: ELSE -- 'LOOKUP' Type Result Attribute.
4565:
4600: '?subject=%20'||UrlEncode(subject)||'&'||'body=%20';
4601:
4602: end if;
4603:
4604: -- DBMS_LOB.WriteAppend(buffer, length(str_buffer), str_buffer);
4605: DBMS_LOB.WriteAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4606: str_buffer := '';
4607: end loop;
4608:
4601:
4602: end if;
4603:
4604: -- DBMS_LOB.WriteAppend(buffer, length(str_buffer), str_buffer);
4605: DBMS_LOB.WriteAppend(g_LOBTable(bufferIdx).temp_lob, length(str_buffer), str_buffer);
4606: str_buffer := '';
4607: end loop;
4608:
4609: end if;
5278: while not (end_of_message) loop
5279: WF_NOTIFICATION.GetFullBody(nid, buffer, end_of_message,
5280: g_ntfDocText);
5281: if buffer is not null and length(buffer) > 0 then
5282: DBMS_LOB.WriteAppend(g_LOBTable(g_text_messageIdx).temp_lob,
5283: length(buffer), buffer);
5284: end if;
5285: end loop;
5286: exception
5313: while not (end_of_message) loop
5314: WF_NOTIFICATION.GetFullBody(nid, buffer, end_of_message,
5315: g_ntfDocHtml);
5316: if buffer is not null and length(buffer) > 0 then
5317: DBMS_LOB.WriteAppend(g_LOBTable(g_html_messageIdx).temp_lob,
5318: length(buffer), buffer);
5319: end if;
5320: end loop;
5321: exception
5395: end if;
5396: end if;
5397: end if;
5398:
5399: -- DBMS_LOB.Write(template_html, length(t_html_body), 1, t_html_body);
5400:
5401: if wf_mail.direct_response then
5402: n_direct := '[2]';
5403: else
5534: -- HTML. Since this is rendered in a LOB, there should be no
5535: -- cause for the exising end /body tag should drop off the end
5536: -- like what would happen in the varchar2 version.
5537: if textForHtml then
5538: DBMS_LOB.WriteAppend(g_LOBTable(g_html_messageIdx).temp_lob,
5539: length('