DBA Data[Home] [Help]

PACKAGE BODY: APPS.PV_GE_NOTIF_RULES_PVT

Source


1 PACKAGE BODY PV_Ge_Notif_Rules_PVT as
2 /* $Header: pvxvgnrb.pls 120.3 2005/08/26 10:19:51 appldev ship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 --          PV_Ge_Notif_Rules_PVT
7 -- Purpose
8 --
9 -- History
10 --  15 Nov 2002  anubhavk created
11 --  19 Nov 2002 anubhavk  Updated - For NOCOPY by running nocopy.sh
12 --
13 -- NOTE
14 --
15 -- This Api is generated with Latest version of
16 -- Rosetta, where g_miss indicates NULL and
17 -- NULL indicates missing value. Rosetta Version 1.55
18 -- End of Comments
19 -- ===============================================================
20 
21 
22 G_PKG_NAME CONSTANT VARCHAR2(30):= 'PV_Ge_Notif_Rules_PVT';
23 G_FILE_NAME CONSTANT VARCHAR2(12) := 'pvxvgnrb.pls';
24 
25 -- G_USER_ID         NUMBER := FND_GLOBAL.USER_ID;
26 -- G_LOGIN_ID        NUMBER := FND_GLOBAL.CONC_LOGIN_ID;
27 --
28 -- Foreward Procedure Declarations
29 --
30 
31 PROCEDURE Default_Ge_Notif_Rules_Items (
32    p_ge_notif_rules_rec IN  ge_notif_rules_rec_type ,
33    x_ge_notif_rules_rec OUT NOCOPY ge_notif_rules_rec_type
34 ) ;
35 
36 
37 
38 -- Hint: Primary key needs to be returned.
39 --   ==============================================================================
40 --    Start of Comments
41 --   ==============================================================================
42 --   API Name
43 --           Create_Ge_Notif_Rules
44 --   Type
45 --           Private
46 --   Pre-Req
47 --
48 --   Parameters
49 --
50 --   IN
51 --       p_api_version_number      IN   NUMBER     Required
52 --       p_init_msg_list           IN   VARCHAR2   Optional  Default = FND_API_G_FALSE
53 --       p_commit                  IN   VARCHAR2   Optional  Default = FND_API.G_FALSE
54 --       p_validation_level        IN   NUMBER     Optional  Default = FND_API.G_VALID_LEVEL_FULL
55 --       p_ge_notif_rules_rec            IN   ge_notif_rules_rec_type  Required
56 --
57 --   OUT
58 --       x_return_status           OUT  VARCHAR2
59 --       x_msg_count               OUT  NUMBER
60 --       x_msg_data                OUT  VARCHAR2
61 --   Version : Current version 1.0
62 --   Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
63 --         and basic operation, developer must manually add parameters and business logic as necessary.
64 --
65 --   History
66 --
67 --   NOTE
68 --
69 --   End of Comments
70 --   ==============================================================================
71 
72 PV_DEBUG_HIGH_ON CONSTANT boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
73 PV_DEBUG_LOW_ON CONSTANT boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
74 PV_DEBUG_MEDIUM_ON CONSTANT boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM);
75 
76 PROCEDURE Create_Ge_Notif_Rules(
77     p_api_version_number         IN   NUMBER,
78     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
79     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
80     p_validation_level           IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
81 
82     x_return_status              OUT NOCOPY  VARCHAR2,
83     x_msg_count                  OUT NOCOPY  NUMBER,
84     x_msg_data                   OUT NOCOPY  VARCHAR2,
85 
86     p_ge_notif_rules_rec              IN   ge_notif_rules_rec_type  := g_miss_ge_notif_rules_rec,
87     x_notif_rule_id              OUT NOCOPY  NUMBER
88      )
89 
90  IS
91 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Create_Ge_Notif_Rules';
92 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
93    l_return_status_full        VARCHAR2(1);
94    l_object_version_number     NUMBER := 1;
95    l_org_id                    NUMBER := FND_API.G_MISS_NUM;
96    l_notif_rule_id              NUMBER;
97    l_dummy                     NUMBER;
98    -- anubhav added
99    l_ge_notif_rules_rec       ge_notif_rules_rec_type := p_ge_notif_rules_rec;
100    --anubhav added ends
101 
102    CURSOR c_id IS
103       SELECT pv_ge_notif_rules_b_s.NEXTVAL
104       FROM dual;
105 
106    CURSOR c_id_exists (l_id IN NUMBER) IS
107       SELECT 1
108       FROM PV_GE_NOTIF_RULES_B
109       WHERE notif_rule_id = l_id;
110 BEGIN
111       -- Standard Start of API savepoint
112       SAVEPOINT create_ge_notif_rules_pvt;
113 
114       -- Standard call to check for call compatibility.
115       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
116                                            p_api_version_number,
117                                            l_api_name,
118                                            G_PKG_NAME)
119       THEN
120           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
121       END IF;
122 
123 
124       -- Initialize message list if p_init_msg_list is set to TRUE.
125       IF FND_API.to_Boolean( p_init_msg_list )
126       THEN
127          FND_MSG_PUB.initialize;
128       END IF;
129 
130 
131 
132       -- Debug Message
133       IF (PV_DEBUG_HIGH_ON) THEN
134 
135       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
136       END IF;
137 
138 
139 
140       -- Initialize API return status to SUCCESS
141       x_return_status := FND_API.G_RET_STS_SUCCESS;
142 
143       -- Local variable initialization
144 
145       IF p_ge_notif_rules_rec.notif_rule_id IS NULL OR p_ge_notif_rules_rec.notif_rule_id = FND_API.g_miss_num THEN
146       LOOP
147          l_dummy := NULL;
148          OPEN c_id;
149          --FETCH c_id INTO l_notif_rule_id;
150          FETCH c_id INTO l_ge_notif_rules_rec.notif_rule_id;
151          CLOSE c_id;
152 
153          OPEN c_id_exists(l_notif_rule_id);
154          FETCH c_id_exists INTO l_dummy;
155          CLOSE c_id_exists;
156          EXIT WHEN l_dummy IS NULL;
157       END LOOP;
158       ELSE
159          l_notif_rule_id := p_ge_notif_rules_rec.notif_rule_id;
160 	 -- Anubhav commented above added below
161          l_ge_notif_rules_rec.notif_rule_id := p_ge_notif_rules_rec.notif_rule_id;
162 	 -- Anubhav added ends
163      END IF;
164 
165 
166 
167       -- =========================================================================
168       -- Validate Environment
169       -- =========================================================================
170 
171       IF FND_GLOBAL.USER_ID IS NULL
172       THEN
173          PVX_UTILITY_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
174           RAISE FND_API.G_EXC_ERROR;
175       END IF;
176 
177 
178 
179       IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
180       THEN
181           -- Debug message
182           IF (PV_DEBUG_HIGH_ON) THEN
183 
184           PVX_UTILITY_PVT.debug_message('Private API: Validate_Ge_Notif_Rules');
185           END IF;
186 
187        -- Anubhav added to populate default values for not null columns
188 
189            l_ge_notif_rules_rec.last_update_date      := SYSDATE;
190            l_ge_notif_rules_rec.last_updated_by       := FND_GLOBAL.user_id;
191            l_ge_notif_rules_rec.creation_date         := SYSDATE;
192            l_ge_notif_rules_rec.created_by            := FND_GLOBAL.user_id;
193            l_ge_notif_rules_rec.last_update_login     := FND_GLOBAL.conc_login_id;
194            l_ge_notif_rules_rec.object_version_number := l_object_version_number;
195 
196        -- Anubhav added ends
197 
198 
199           -- Invoke validation procedures
200           Validate_ge_notif_rules(
201             p_api_version_number     => 1.0,
202             p_init_msg_list    => FND_API.G_FALSE,
203             p_validation_level => p_validation_level,
204             p_validation_mode => JTF_PLSQL_API.g_create,
205             --p_ge_notif_rules_rec  =>  p_ge_notif_rules_rec,
206             --Anubhav added
207             p_ge_notif_rules_rec => l_ge_notif_rules_rec,
208 	    -- Anubhav added ends
209             x_return_status    => x_return_status,
210             x_msg_count        => x_msg_count,
211             x_msg_data         => x_msg_data);
212       END IF;
213 
214       IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
215           RAISE FND_API.G_EXC_ERROR;
216       END IF;
217 
218 
219 
220       -- Debug Message
221       IF (PV_DEBUG_HIGH_ON) THEN
222 
223       PVX_UTILITY_PVT.debug_message( 'Private API: Calling create table handler');
224       END IF;
225 
226       -- Invoke table handler(Pv_Ge_Notif_Rules_Pkg.Insert_Row)
227       Pv_Ge_Notif_Rules_Pkg.Insert_Row(
228           --px_notif_rule_id  => l_notif_rule_id,
229 	  --Anubhav added
230 	  px_notif_rule_id  => l_ge_notif_rules_rec.notif_rule_id,
231 	  --Anubhav added ends
232           px_object_version_number  => l_object_version_number,
233           p_arc_notif_for_entity_code  => p_ge_notif_rules_rec.arc_notif_for_entity_code,
234           p_notif_for_entity_id  => p_ge_notif_rules_rec.notif_for_entity_id,
235           p_wf_item_type_code  => p_ge_notif_rules_rec.wf_item_type_code,
236           p_notif_type_code  => p_ge_notif_rules_rec.notif_type_code,
237           p_active_flag  => p_ge_notif_rules_rec.active_flag,
238           p_repeat_freq_unit  => p_ge_notif_rules_rec.repeat_freq_unit,
239           p_repeat_freq_value  => p_ge_notif_rules_rec.repeat_freq_value,
240           p_send_notif_before_unit  => p_ge_notif_rules_rec.send_notif_before_unit,
241           p_send_notif_before_value  => p_ge_notif_rules_rec.send_notif_before_value,
242           p_send_notif_after_unit  => p_ge_notif_rules_rec.send_notif_after_unit,
243           p_send_notif_after_value  => p_ge_notif_rules_rec.send_notif_after_value,
244           p_repeat_until_unit  => p_ge_notif_rules_rec.repeat_until_unit,
245           p_repeat_until_value  => p_ge_notif_rules_rec.repeat_until_value,
246           p_created_by  => FND_GLOBAL.USER_ID,
247           p_creation_date  => SYSDATE,
248           p_last_updated_by  => FND_GLOBAL.USER_ID,
249           p_last_update_date  => SYSDATE,
250           p_last_update_login  => FND_GLOBAL.conc_login_id,
251           p_notif_name  => p_ge_notif_rules_rec.notif_name,
252           p_notif_content  => p_ge_notif_rules_rec.notif_content,
253           p_notif_desc  => p_ge_notif_rules_rec.notif_desc
254 );
255 
256           x_notif_rule_id := l_notif_rule_id;
257       IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
258           RAISE FND_API.G_EXC_ERROR;
259       END IF;
260 --
261 -- End of API body
262 --
263 
264       -- Standard check for p_commit
265       IF FND_API.to_Boolean( p_commit )
266       THEN
267          COMMIT WORK;
268       END IF;
269 
270 
271       -- Debug Message
272       IF (PV_DEBUG_HIGH_ON) THEN
273 
274       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
275       END IF;
276 
277 
278       -- Standard call to get message count and if count is 1, get message info.
279       FND_MSG_PUB.Count_And_Get
280         (p_count          =>   x_msg_count,
281          p_data           =>   x_msg_data
282       );
283 EXCEPTION
284 
285    WHEN PVX_UTILITY_PVT.resource_locked THEN
286      x_return_status := FND_API.g_ret_sts_error;
287          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
288 
289    WHEN FND_API.G_EXC_ERROR THEN
290      ROLLBACK TO CREATE_Ge_Notif_Rules_PVT;
291      x_return_status := FND_API.G_RET_STS_ERROR;
292      -- Standard call to get message count and if count=1, get the message
293      FND_MSG_PUB.Count_And_Get (
294             p_encoded => FND_API.G_FALSE,
295             p_count   => x_msg_count,
296             p_data    => x_msg_data
297      );
298 
299    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
300      ROLLBACK TO CREATE_Ge_Notif_Rules_PVT;
301      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
302      -- Standard call to get message count and if count=1, get the message
303      FND_MSG_PUB.Count_And_Get (
304             p_encoded => FND_API.G_FALSE,
305             p_count => x_msg_count,
306             p_data  => x_msg_data
307      );
308 
309    WHEN OTHERS THEN
310      ROLLBACK TO CREATE_Ge_Notif_Rules_PVT;
311      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
312      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
313      THEN
314         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
315      END IF;
316      -- Standard call to get message count and if count=1, get the message
317      FND_MSG_PUB.Count_And_Get (
318             p_encoded => FND_API.G_FALSE,
319             p_count => x_msg_count,
320             p_data  => x_msg_data
321      );
322 End Create_Ge_Notif_Rules;
323 
324 
325 
326 /*********************
327  *
328  *
329  * Copy_Row
330  *
331  *
332  *********************/
333 PROCEDURE Copy_Row
334 (
335     p_api_version_number   IN    NUMBER
336    ,p_init_msg_list        IN    VARCHAR2 := FND_API.G_FALSE
337    ,p_commit               IN    VARCHAR2 := FND_API.G_FALSE
338    ,p_validation_level     IN    NUMBER   := FND_API.G_VALID_LEVEL_FULL
339    ,x_return_status        OUT   NOCOPY   VARCHAR2
340    ,x_msg_count            OUT   NOCOPY   NUMBER
341    ,x_msg_data             OUT   NOCOPY   VARCHAR2
342    ,p_src_object_id        IN    NUMBER
343    ,p_tar_object_id        IN    NUMBER
344 )
345 
346 IS
347 
348    CURSOR c_get_notif_rules_rec (cv_program_id IN NUMBER)  IS
349       SELECT  wf_item_type_code, notif_type_code,  active_flag, repeat_freq_unit, repeat_freq_value,
350 	send_notif_before_unit, send_notif_before_value, send_notif_after_unit, send_notif_after_value,
351 	repeat_until_unit, repeat_until_value
352       FROM    pv_ge_notif_rules_b
353       WHERE   arc_notif_for_entity_code = 'PRGM'
354       AND notif_for_entity_id = cv_program_id
355       order by notif_rule_id;
356 
357    CURSOR c_get_notif_rules_tl_rec (cv_program_id IN NUMBER)  IS
358       SELECT  tl.notif_rule_id, notif_name, notif_content, notif_desc, language, source_lang
359       FROM     pv_ge_notif_rules_b b, pv_ge_notif_rules_tl tl
360       WHERE   arc_notif_for_entity_code = 'PRGM'
361       and b.notif_rule_id = tl.notif_rule_id
362       AND notif_for_entity_id = cv_program_id
363       order by tl.notif_rule_id;
364 
365    CURSOR c_get_notif_rules_id (cv_program_id IN NUMBER)  IS
366       SELECT  NOTIF_RULE_ID
367       FROM    pv_ge_notif_rules_b
368       WHERE   arc_notif_for_entity_code = 'PRGM'
369       AND notif_for_entity_id = cv_program_id;
370 
371    l_notif_rule_id            NUMBER;
372    L_API_NAME                 CONSTANT VARCHAR2(30) := 'Copy_Notif_Rules';
373    L_API_VERSION_NUMBER       CONSTANT NUMBER   := 1.0;
374 
375    elmt_count				NUMBER;
376 
377    type numArray is table of number index by binary_integer;
378    type varcharArray is table of VARCHAR2(240) index by binary_integer;
379 
380    notif_rule_id_array numArray;
381    old_notif_rule_id_array numArray;
382    new_notif_rule_id_array numArray;
383 
384    notif_name_array varcharArray;
385    notif_content_array varcharArray;
386    notif_desc_array varcharArray;
387    source_lang_array varcharArray;
388    language_array varcharArray;
389 
390    wf_item_type_code_array varcharArray;
391    notif_type_code_array varcharArray;
392    active_flag_array varcharArray;
393    repeat_freq_unit_array varcharArray;
394    repeat_freq_value_array numArray;
395    send_notif_before_unit_array varcharArray;
396    send_notif_before_value_array numArray;
397    send_notif_after_unit_array varcharArray;
398    send_notif_after_value_array numArray;
399    repeat_until_unit_array  varcharArray;
400    repeat_until_value_array numArray;
401 
402 BEGIN
403    -- Standard Start of API savepoint
404    SAVEPOINT Copy_Row;
405 
406    -- Standard call to check for call compatibility.
407    IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
408                                         p_api_version_number,
409                                         l_api_name,
410                                         G_PKG_NAME)
411    THEN
412        RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
413    END IF;
414 
415 
416    -- Initialize message list if p_init_msg_list is set to TRUE.
417    IF FND_API.to_Boolean( p_init_msg_list )
418    THEN
419       FND_MSG_PUB.initialize;
420    END IF;
421 
422    -- Debug Message
423    IF (PV_DEBUG_HIGH_ON) THEN
424        PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
425    END IF;
426 
427 
428    -- Initialize API return status to SUCCESS
429    x_return_status := FND_API.G_RET_STS_SUCCESS;
430 
431 
432    OPEN c_get_notif_rules_id(p_tar_object_id);
433    FETCH c_get_notif_rules_id bulk collect into notif_rule_id_array
434    LIMIT 100;
435    --exit when c_get_notif_rules_id%notfound;
436    Close c_get_notif_rules_id;
437 
438    OPEN c_get_notif_rules_rec (p_src_object_id);
439    LOOP
440    IF (PV_DEBUG_HIGH_ON) THEN
441 	PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || ' : inside loop');
442    END IF;
443    FETCH c_get_notif_rules_rec  bulk collect into
444     wf_item_type_code_array, notif_type_code_array,  active_flag_array,
445     repeat_freq_unit_array, repeat_freq_value_array, send_notif_before_unit_array, send_notif_before_value_array,
446     send_notif_after_unit_array, send_notif_after_value_array, repeat_until_unit_array, repeat_until_value_array
447     LIMIT 100;
448     IF (PV_DEBUG_HIGH_ON) THEN
449       PVX_UTILITY_PVT.debug_message(l_api_name || 'notif_rule_id_array.count =' || to_char(notif_rule_id_array.count));
450 
451       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || ' : insert into b table');
452     END IF;
453 
454       forall i in 1..wf_item_type_code_array.count
455       update pv_ge_notif_rules_b
456       set  wf_item_type_code = wf_item_type_code_array(i),
457 	   notif_type_code = notif_type_code_array(i),
458 	   active_flag = active_flag_array(i),
459 	   repeat_freq_unit = repeat_freq_unit_array(i),
460 	   repeat_freq_value = repeat_freq_value_array(i),
461 	   send_notif_before_unit = send_notif_before_unit_array(i),
462 	   send_notif_before_value = send_notif_before_value_array(i),
463 	   send_notif_after_unit = send_notif_after_unit_array(i),
464 	   send_notif_after_value = send_notif_after_value_array(i),
465 	   repeat_until_unit = repeat_until_unit_array(i),
466 	   repeat_until_value = repeat_until_value_array(i),
467            object_version_number = object_version_number + 1,
468            last_updated_by = FND_GLOBAL.USER_ID,
469            last_update_date = sysdate,
470            last_update_login = FND_GLOBAL.CONC_LOGIN_ID
471       where notif_rule_id = notif_rule_id_array(i);
472 
473 	   exit when c_get_notif_rules_rec%notfound;
474      END LOOP;
475     Close c_get_notif_rules_rec;
476 
477 
478      open c_get_notif_rules_tl_rec(p_src_object_id);
479      LOOP
480 
481       Fetch c_get_notif_rules_tl_rec bulk collect into
482 	  old_notif_rule_id_array, notif_name_array, notif_content_array, notif_desc_array, language_array, source_lang_array limit 100;
483 
484       	  elmt_count := 1;
485 	  for k in 1..old_notif_rule_id_array.count loop
486 	  	  if ((k <> 1) and (old_notif_rule_id_array(k) <> old_notif_rule_id_array(k-1))) then
487 	      	  elmt_count := elmt_count + 1;
488 	  	  end if;
489 		  IF (PV_DEBUG_HIGH_ON) THEN
490 			PVX_UTILITY_PVT.debug_message(l_api_name || 'k = ' || to_char(k));
491 			PVX_UTILITY_PVT.debug_message(l_api_name || 'elmt_count = ' || to_char(elmt_count));
492 		  END IF;
493 	  	  new_notif_rule_id_array(k) := notif_rule_id_array(elmt_count);
494 
495 	  end loop;
496 
497       forall i in 1..old_notif_rule_id_array.count
498       update pv_ge_notif_rules_tl
499       set  notif_name = notif_name_array(i),
500 	   notif_content = notif_content_array(i),
501 	   notif_desc = notif_desc_array(i),
502 	   source_lang = source_lang_array(i),
503            last_updated_by = FND_GLOBAL.USER_ID,
504            last_update_date = sysdate,
505            last_update_login = FND_GLOBAL.CONC_LOGIN_ID
506       where notif_rule_id = new_notif_rule_id_array(i)
507       and   language = language_array(i);
508 
509 	 exit when c_get_notif_rules_tl_rec%notfound;
510 	 END LOOP;
511      close c_get_notif_rules_tl_rec;
512 
513    -- Check for commit
514    IF FND_API.to_boolean(p_commit) THEN
515       COMMIT;
516    END IF;
517 
518    FND_MSG_PUB.count_and_get(
519       p_encoded => FND_API.g_false
520      ,p_count   => x_msg_count
521      ,p_data    => x_msg_data
522    );
523 
524 EXCEPTION
525 
526    WHEN PVX_Utility_PVT.resource_locked THEN
527      x_return_status := FND_API.g_ret_sts_error;
528          PVX_Utility_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
529 
530    WHEN FND_API.G_EXC_ERROR THEN
531      ROLLBACK TO Copy_Row;
532      x_return_status := FND_API.G_RET_STS_ERROR;
533      -- Standard call to get message count and if count=1, get the message
534      FND_MSG_PUB.Count_And_Get (
535             p_encoded => FND_API.G_FALSE,
536             p_count   => x_msg_count,
537             p_data    => x_msg_data
538      );
539 
540    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
541      ROLLBACK TO Copy_Row;
542      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
543      -- Standard call to get message count and if count=1, get the message
544      FND_MSG_PUB.Count_And_Get (
545             p_encoded => FND_API.G_FALSE,
546             p_count => x_msg_count,
547             p_data  => x_msg_data
548      );
549 
550    WHEN OTHERS THEN
551      ROLLBACK TO Copy_Row;
552      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
553      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
554      THEN
555         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
556      END IF;
557      -- Standard call to get message count and if count=1, get the message
558      FND_MSG_PUB.Count_And_Get (
559             p_encoded => FND_API.G_FALSE,
560             p_count => x_msg_count,
561             p_data  => x_msg_data
562      );
563 
564 END Copy_Row;
565 
566 
567 --   ==============================================================================
568 --    Start of Comments
569 --   ==============================================================================
570 --   API Name
571 --           Update_Ge_Notif_Rules
572 --   Type
573 --           Private
574 --   Pre-Req
575 --
576 --   Parameters
577 --
578 --   IN
579 --       p_api_version_number      IN   NUMBER     Required
580 --       p_init_msg_list           IN   VARCHAR2   Optional  Default = FND_API_G_FALSE
581 --       p_commit                  IN   VARCHAR2   Optional  Default = FND_API.G_FALSE
582 --       p_validation_level        IN   NUMBER     Optional  Default = FND_API.G_VALID_LEVEL_FULL
583 --       p_ge_notif_rules_rec            IN   ge_notif_rules_rec_type  Required
584 --
585 --   OUT
586 --       x_return_status           OUT  VARCHAR2
587 --       x_msg_count               OUT  NUMBER
588 --       x_msg_data                OUT  VARCHAR2
589 --   Version : Current version 1.0
590 --   Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
591 --         and basic operation, developer must manually add parameters and business logic as necessary.
592 --
593 --   History
594 --
595 --   NOTE
596 --
597 --   End of Comments
598 --   ==============================================================================
599 
600 PROCEDURE Update_Ge_Notif_Rules(
601     p_api_version_number         IN   NUMBER,
602     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
603     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
604     p_validation_level           IN  NUMBER       := FND_API.G_VALID_LEVEL_FULL,
605 
606     x_return_status              OUT NOCOPY  VARCHAR2,
607     x_msg_count                  OUT NOCOPY  NUMBER,
608     x_msg_data                   OUT NOCOPY  VARCHAR2,
609 
610     p_ge_notif_rules_rec               IN    ge_notif_rules_rec_type
611     )
612 
613  IS
614 
615 
616 CURSOR c_get_ge_notif_rules(notif_rule_id NUMBER) IS
617     SELECT *
618     FROM  PV_GE_NOTIF_RULES_B
619     WHERE  notif_rule_id = p_ge_notif_rules_rec.notif_rule_id;
620     -- Hint: Developer need to provide Where clause
621 
622 
623 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Update_Ge_Notif_Rules';
624 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
625 -- Local Variables
626 l_object_version_number     NUMBER;
627 l_notif_rule_id    NUMBER;
628 l_ref_ge_notif_rules_rec  c_get_Ge_Notif_Rules%ROWTYPE ;
629 l_tar_ge_notif_rules_rec  ge_notif_rules_rec_type := P_ge_notif_rules_rec;
630 l_rowid  ROWID;
631 
632  BEGIN
633       -- Standard Start of API savepoint
634       SAVEPOINT update_ge_notif_rules_pvt;
635 
636       -- Standard call to check for call compatibility.
637       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
638                                            p_api_version_number,
639                                            l_api_name,
640                                            G_PKG_NAME)
641       THEN
642           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
643       END IF;
644 
645 
646       -- Initialize message list if p_init_msg_list is set to TRUE.
647       IF FND_API.to_Boolean( p_init_msg_list )
648       THEN
649          FND_MSG_PUB.initialize;
650       END IF;
651 
652 
653 
654       -- Debug Message
655       IF (PV_DEBUG_HIGH_ON) THEN
656 
657       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
658       END IF;
659 
660 
661 
662       -- Initialize API return status to SUCCESS
663       x_return_status := FND_API.G_RET_STS_SUCCESS;
664 
665       -- Debug Message
666       IF (PV_DEBUG_HIGH_ON) THEN
667 
668       PVX_UTILITY_PVT.debug_message('Private API: - Open Cursor to Select');
669       END IF;
670 
671       OPEN c_get_Ge_Notif_Rules( l_tar_ge_notif_rules_rec.notif_rule_id);
672 
673       FETCH c_get_Ge_Notif_Rules INTO l_ref_ge_notif_rules_rec  ;
674 
675        If ( c_get_Ge_Notif_Rules%NOTFOUND) THEN
676   PVX_UTILITY_PVT.Error_Message(p_message_name => 'API_MISSING_UPDATE_TARGET',
677    p_token_name   => 'INFO',
678  p_token_value  => 'Ge_Notif_Rules') ;
679            RAISE FND_API.G_EXC_ERROR;
680        END IF;
681        -- Debug Message
682        IF (PV_DEBUG_HIGH_ON) THEN
683 
684        PVX_UTILITY_PVT.debug_message('Private API: - Close Cursor');
685        END IF;
686        CLOSE     c_get_Ge_Notif_Rules;
687 
688 
689       If (l_tar_ge_notif_rules_rec.object_version_number is NULL or
690           l_tar_ge_notif_rules_rec.object_version_number = FND_API.G_MISS_NUM ) Then
691   PVX_UTILITY_PVT.Error_Message(p_message_name => 'API_VERSION_MISSING',
692    p_token_name   => 'COLUMN',
693  p_token_value  => 'Last_Update_Date') ;
694           raise FND_API.G_EXC_ERROR;
695       End if;
696       -- Check Whether record has been changed by someone else
697       If (l_tar_ge_notif_rules_rec.object_version_number <> l_ref_ge_notif_rules_rec.object_version_number) Then
698   PVX_UTILITY_PVT.Error_Message(p_message_name => 'API_RECORD_CHANGED',
699    p_token_name   => 'INFO',
700  p_token_value  => 'Ge_Notif_Rules') ;
701           raise FND_API.G_EXC_ERROR;
702       End if;
703 
704 
705       IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
706       THEN
707           -- Debug message
708           IF (PV_DEBUG_HIGH_ON) THEN
709 
710           PVX_UTILITY_PVT.debug_message('Private API: Validate_Ge_Notif_Rules');
711           END IF;
712 
713           -- Invoke validation procedures
714           Validate_ge_notif_rules(
715             p_api_version_number     => 1.0,
716             p_init_msg_list    => FND_API.G_FALSE,
717             p_validation_level => p_validation_level,
718             p_validation_mode => JTF_PLSQL_API.g_update,
719             p_ge_notif_rules_rec  =>  p_ge_notif_rules_rec,
720             x_return_status    => x_return_status,
721             x_msg_count        => x_msg_count,
722             x_msg_data         => x_msg_data);
723       END IF;
724 
725       IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
726           RAISE FND_API.G_EXC_ERROR;
727       END IF;
728 
729 
730       -- Debug Message
731       --IF (PV_DEBUG_HIGH_ON) THENPVX_UTILITY_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, 'Private API: Calling update table handler');END IF;
732 
733       -- Invoke table handler(Pv_Ge_Notif_Rules_Pkg.Update_Row)
734       Pv_Ge_Notif_Rules_Pkg.Update_Row(
735           p_notif_rule_id  => p_ge_notif_rules_rec.notif_rule_id,
736           p_object_version_number  => p_ge_notif_rules_rec.object_version_number,
737           p_arc_notif_for_entity_code  => p_ge_notif_rules_rec.arc_notif_for_entity_code,
738           p_notif_for_entity_id  => p_ge_notif_rules_rec.notif_for_entity_id,
739           p_wf_item_type_code  => p_ge_notif_rules_rec.wf_item_type_code,
740           p_notif_type_code  => p_ge_notif_rules_rec.notif_type_code,
741           p_active_flag  => p_ge_notif_rules_rec.active_flag,
742           p_repeat_freq_unit  => p_ge_notif_rules_rec.repeat_freq_unit,
743           p_repeat_freq_value  => p_ge_notif_rules_rec.repeat_freq_value,
744           p_send_notif_before_unit  => p_ge_notif_rules_rec.send_notif_before_unit,
745           p_send_notif_before_value  => p_ge_notif_rules_rec.send_notif_before_value,
746           p_send_notif_after_unit  => p_ge_notif_rules_rec.send_notif_after_unit,
747           p_send_notif_after_value  => p_ge_notif_rules_rec.send_notif_after_value,
748           p_repeat_until_unit  => p_ge_notif_rules_rec.repeat_until_unit,
749           p_repeat_until_value  => p_ge_notif_rules_rec.repeat_until_value,
750           p_last_updated_by  => FND_GLOBAL.USER_ID,
751           p_last_update_date  => SYSDATE,
752           p_last_update_login  => FND_GLOBAL.conc_login_id,
753           p_notif_name  => p_ge_notif_rules_rec.notif_name,
754           p_notif_content  => p_ge_notif_rules_rec.notif_content,
755           p_notif_desc  => p_ge_notif_rules_rec.notif_desc
756 );
757       --
758       -- End of API body.
759       --
760 
761       -- Standard check for p_commit
762       IF FND_API.to_Boolean( p_commit )
763       THEN
764          COMMIT WORK;
765       END IF;
766 
767 
768       -- Debug Message
769       IF (PV_DEBUG_HIGH_ON) THEN
770 
771       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
772       END IF;
773 
774 
775       -- Standard call to get message count and if count is 1, get message info.
776       FND_MSG_PUB.Count_And_Get
777         (p_count          =>   x_msg_count,
778          p_data           =>   x_msg_data
779       );
780 EXCEPTION
781 
782    WHEN PVX_UTILITY_PVT.resource_locked THEN
783      x_return_status := FND_API.g_ret_sts_error;
784          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
785 
786    WHEN FND_API.G_EXC_ERROR THEN
787      ROLLBACK TO UPDATE_Ge_Notif_Rules_PVT;
788      x_return_status := FND_API.G_RET_STS_ERROR;
789      -- Standard call to get message count and if count=1, get the message
790      FND_MSG_PUB.Count_And_Get (
791             p_encoded => FND_API.G_FALSE,
792             p_count   => x_msg_count,
793             p_data    => x_msg_data
794      );
795 
796    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
797      ROLLBACK TO UPDATE_Ge_Notif_Rules_PVT;
798      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
799      -- Standard call to get message count and if count=1, get the message
800      FND_MSG_PUB.Count_And_Get (
801             p_encoded => FND_API.G_FALSE,
802             p_count => x_msg_count,
803             p_data  => x_msg_data
804      );
805 
806    WHEN OTHERS THEN
807      ROLLBACK TO UPDATE_Ge_Notif_Rules_PVT;
808      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
809      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
810      THEN
811         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
812      END IF;
813      -- Standard call to get message count and if count=1, get the message
814      FND_MSG_PUB.Count_And_Get (
815             p_encoded => FND_API.G_FALSE,
816             p_count => x_msg_count,
817             p_data  => x_msg_data
818      );
819 End Update_Ge_Notif_Rules;
820 
821 
822 --   ==============================================================================
823 --    Start of Comments
824 --   ==============================================================================
825 --   API Name
826 --           Delete_Ge_Notif_Rules
827 --   Type
828 --           Private
829 --   Pre-Req
830 --
831 --   Parameters
832 --
833 --   IN
834 --       p_api_version_number      IN   NUMBER     Required
835 --       p_init_msg_list           IN   VARCHAR2   Optional  Default = FND_API_G_FALSE
836 --       p_commit                  IN   VARCHAR2   Optional  Default = FND_API.G_FALSE
837 --       p_validation_level        IN   NUMBER     Optional  Default = FND_API.G_VALID_LEVEL_FULL
838 --       p_notif_rule_id                IN   NUMBER
839 --       p_object_version_number   IN   NUMBER     Optional  Default = NULL
840 --
841 --   OUT
842 --       x_return_status           OUT  VARCHAR2
843 --       x_msg_count               OUT  NUMBER
844 --       x_msg_data                OUT  VARCHAR2
845 --   Version : Current version 1.0
846 --   Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
847 --         and basic operation, developer must manually add parameters and business logic as necessary.
848 --
849 --   History
850 --
851 --   NOTE
852 --
853 --   End of Comments
854 --   ==============================================================================
855 
856 PROCEDURE Delete_Ge_Notif_Rules(
857     p_api_version_number         IN   NUMBER,
858     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
859     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
860     p_validation_level           IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
861     x_return_status              OUT NOCOPY  VARCHAR2,
862     x_msg_count                  OUT NOCOPY  NUMBER,
863     x_msg_data                   OUT NOCOPY  VARCHAR2,
864     p_notif_rule_id                   IN  NUMBER,
865     p_object_version_number      IN   NUMBER
866     )
867 
868  IS
869 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Delete_Ge_Notif_Rules';
870 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
871 l_object_version_number     NUMBER;
872 
873  BEGIN
874       -- Standard Start of API savepoint
875       SAVEPOINT delete_ge_notif_rules_pvt;
876 
877       -- Standard call to check for call compatibility.
878       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
879                                            p_api_version_number,
880                                            l_api_name,
881                                            G_PKG_NAME)
882       THEN
883           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
884       END IF;
885 
886 
887       -- Initialize message list if p_init_msg_list is set to TRUE.
888       IF FND_API.to_Boolean( p_init_msg_list )
889       THEN
890          FND_MSG_PUB.initialize;
891       END IF;
892 
893 
894 
895       -- Debug Message
896       IF (PV_DEBUG_HIGH_ON) THEN
897 
898       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
899       END IF;
900 
901 
902 
903       -- Initialize API return status to SUCCESS
904       x_return_status := FND_API.G_RET_STS_SUCCESS;
905 
906       --
907       -- Api body
908       --
909       -- Debug Message
910       IF (PV_DEBUG_HIGH_ON) THEN
911 
912       PVX_UTILITY_PVT.debug_message( 'Private API: Calling delete table handler');
913       END IF;
914 
915       -- Invoke table handler(Pv_Ge_Notif_Rules_Pkg.Delete_Row)
916       Pv_Ge_Notif_Rules_Pkg.Delete_Row(
917           p_notif_rule_id  => p_notif_rule_id,
918           p_object_version_number => p_object_version_number     );
919       --
920       -- End of API body
921       --
922 
923       -- Standard check for p_commit
924       IF FND_API.to_Boolean( p_commit )
925       THEN
926          COMMIT WORK;
927       END IF;
928 
929 
930       -- Debug Message
931       IF (PV_DEBUG_HIGH_ON) THEN
932 
933       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
934       END IF;
935 
936 
937       -- Standard call to get message count and if count is 1, get message info.
938       FND_MSG_PUB.Count_And_Get
939         (p_count          =>   x_msg_count,
940          p_data           =>   x_msg_data
941       );
942 EXCEPTION
943 
944    WHEN PVX_UTILITY_PVT.resource_locked THEN
945      x_return_status := FND_API.g_ret_sts_error;
946          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
947 
948    WHEN FND_API.G_EXC_ERROR THEN
949      ROLLBACK TO DELETE_Ge_Notif_Rules_PVT;
950      x_return_status := FND_API.G_RET_STS_ERROR;
951      -- Standard call to get message count and if count=1, get the message
952      FND_MSG_PUB.Count_And_Get (
953             p_encoded => FND_API.G_FALSE,
954             p_count   => x_msg_count,
955             p_data    => x_msg_data
956      );
957 
958    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
959      ROLLBACK TO DELETE_Ge_Notif_Rules_PVT;
960      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
961      -- Standard call to get message count and if count=1, get the message
962      FND_MSG_PUB.Count_And_Get (
963             p_encoded => FND_API.G_FALSE,
964             p_count => x_msg_count,
965             p_data  => x_msg_data
966      );
967 
968    WHEN OTHERS THEN
969      ROLLBACK TO DELETE_Ge_Notif_Rules_PVT;
970      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
971      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
972      THEN
973         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
974      END IF;
975      -- Standard call to get message count and if count=1, get the message
976      FND_MSG_PUB.Count_And_Get (
977             p_encoded => FND_API.G_FALSE,
978             p_count => x_msg_count,
979             p_data  => x_msg_data
980      );
981 End Delete_Ge_Notif_Rules;
982 
983 
984 
985 -- Hint: Primary key needs to be returned.
986 --   ==============================================================================
987 --    Start of Comments
988 --   ==============================================================================
989 --   API Name
990 --           Lock_Ge_Notif_Rules
991 --   Type
992 --           Private
993 --   Pre-Req
994 --
995 --   Parameters
996 --
997 --   IN
998 --       p_api_version_number      IN   NUMBER     Required
999 --       p_init_msg_list           IN   VARCHAR2   Optional  Default = FND_API_G_FALSE
1000 --       p_commit                  IN   VARCHAR2   Optional  Default = FND_API.G_FALSE
1001 --       p_validation_level        IN   NUMBER     Optional  Default = FND_API.G_VALID_LEVEL_FULL
1002 --       p_ge_notif_rules_rec            IN   ge_notif_rules_rec_type  Required
1003 --
1004 --   OUT
1005 --       x_return_status           OUT  VARCHAR2
1006 --       x_msg_count               OUT  NUMBER
1007 --       x_msg_data                OUT  VARCHAR2
1008 --   Version : Current version 1.0
1009 --   Note: This automatic generated procedure definition, it includes standard IN/OUT parameters
1010 --         and basic operation, developer must manually add parameters and business logic as necessary.
1011 --
1012 --   History
1013 --
1014 --   NOTE
1015 --
1016 --   End of Comments
1017 --   ==============================================================================
1018 
1019 PROCEDURE Lock_Ge_Notif_Rules(
1020     p_api_version_number         IN   NUMBER,
1021     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
1022 
1023     x_return_status              OUT NOCOPY  VARCHAR2,
1024     x_msg_count                  OUT NOCOPY  NUMBER,
1025     x_msg_data                   OUT NOCOPY  VARCHAR2,
1026 
1027     p_notif_rule_id                   IN  NUMBER,
1028     p_object_version             IN  NUMBER
1029     )
1030 
1031  IS
1032 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Lock_Ge_Notif_Rules';
1033 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
1034 L_FULL_NAME                 CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
1035 l_notif_rule_id                  NUMBER;
1036 
1037 BEGIN
1038 
1039       -- Debug Message
1040       IF (PV_DEBUG_HIGH_ON) THEN
1041 
1042       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
1043       END IF;
1044 
1045 
1046       -- Initialize message list if p_init_msg_list is set to TRUE.
1047       IF FND_API.to_Boolean( p_init_msg_list )
1048       THEN
1049          FND_MSG_PUB.initialize;
1050       END IF;
1051 
1052 
1053 
1054       -- Standard call to check for call compatibility.
1055       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1056                                            p_api_version_number,
1057                                            l_api_name,
1058                                            G_PKG_NAME)
1059       THEN
1060           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1061       END IF;
1062 
1063 
1064 
1065       -- Initialize API return status to SUCCESS
1066       x_return_status := FND_API.G_RET_STS_SUCCESS;
1067 
1068 
1069 ------------------------ lock -------------------------
1070 Pv_Ge_Notif_Rules_Pkg.Lock_Row(l_notif_rule_id,p_object_version);
1071 
1072 
1073  -------------------- finish --------------------------
1074   FND_MSG_PUB.count_and_get(
1075     p_encoded => FND_API.g_false,
1076     p_count   => x_msg_count,
1077     p_data    => x_msg_data);
1078   IF (PV_DEBUG_HIGH_ON) THEN
1079 
1080   PVX_UTILITY_PVT.debug_message(l_full_name ||': end');
1081   END IF;
1082 EXCEPTION
1083 
1084    WHEN PVX_UTILITY_PVT.resource_locked THEN
1085      x_return_status := FND_API.g_ret_sts_error;
1086          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
1087 
1088    WHEN FND_API.G_EXC_ERROR THEN
1089      ROLLBACK TO LOCK_Ge_Notif_Rules_PVT;
1090      x_return_status := FND_API.G_RET_STS_ERROR;
1091      -- Standard call to get message count and if count=1, get the message
1092      FND_MSG_PUB.Count_And_Get (
1093             p_encoded => FND_API.G_FALSE,
1094             p_count   => x_msg_count,
1095             p_data    => x_msg_data
1096      );
1097 
1098    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1099      ROLLBACK TO LOCK_Ge_Notif_Rules_PVT;
1100      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1101      -- Standard call to get message count and if count=1, get the message
1102      FND_MSG_PUB.Count_And_Get (
1103             p_encoded => FND_API.G_FALSE,
1104             p_count => x_msg_count,
1105             p_data  => x_msg_data
1106      );
1107 
1108    WHEN OTHERS THEN
1109      ROLLBACK TO LOCK_Ge_Notif_Rules_PVT;
1110      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1111      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1112      THEN
1113         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1114      END IF;
1115      -- Standard call to get message count and if count=1, get the message
1116      FND_MSG_PUB.Count_And_Get (
1117             p_encoded => FND_API.G_FALSE,
1118             p_count => x_msg_count,
1119             p_data  => x_msg_data
1120      );
1121 End Lock_Ge_Notif_Rules;
1122 
1123 
1124 
1125 
1126 PROCEDURE check_Ge_Notif_Rules_Uk_Items(
1127     p_ge_notif_rules_rec               IN   ge_notif_rules_rec_type,
1128     p_validation_mode            IN  VARCHAR2 := JTF_PLSQL_API.g_create,
1129     x_return_status              OUT NOCOPY VARCHAR2)
1130 IS
1131 l_valid_flag  VARCHAR2(1);
1132 
1133 BEGIN
1134       x_return_status := FND_API.g_ret_sts_success;
1135       IF p_validation_mode = JTF_PLSQL_API.g_create
1136       AND p_ge_notif_rules_rec.notif_rule_id IS NOT NULL
1137       THEN
1138          l_valid_flag := PVX_UTILITY_PVT.check_uniqueness(
1139          'pv_ge_notif_rules_b',
1140          'notif_rule_id = ''' || p_ge_notif_rules_rec.notif_rule_id ||''''
1141          );
1142       END IF;
1143 
1144       IF l_valid_flag = FND_API.g_false THEN
1145          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_notif_rule_id_DUPLICATE');
1146          x_return_status := FND_API.g_ret_sts_error;
1147       END IF;
1148 
1149 END check_Ge_Notif_Rules_Uk_Items;
1150 
1151 
1152 
1153 PROCEDURE check_Ge_Notif_Rules_Req_Items(
1154     p_ge_notif_rules_rec               IN  ge_notif_rules_rec_type,
1155     p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
1156     x_return_status	         OUT NOCOPY VARCHAR2
1157 )
1158 IS
1159 BEGIN
1160    x_return_status := FND_API.g_ret_sts_success;
1161 
1162    IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1163 
1164 
1165       IF p_ge_notif_rules_rec.notif_rule_id = FND_API.G_MISS_NUM OR p_ge_notif_rules_rec.notif_rule_id IS NULL THEN
1166                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_RULE_ID' );
1167                x_return_status := FND_API.g_ret_sts_error;
1168       END IF;
1169 
1170 
1171       IF p_ge_notif_rules_rec.object_version_number = FND_API.G_MISS_NUM OR p_ge_notif_rules_rec.object_version_number IS NULL THEN
1172                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
1173                x_return_status := FND_API.g_ret_sts_error;
1174       END IF;
1175 
1176 
1177       IF p_ge_notif_rules_rec.arc_notif_for_entity_code = FND_API.g_miss_char OR p_ge_notif_rules_rec.arc_notif_for_entity_code IS NULL THEN
1178                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'ARC_NOTIF_FOR_ENTITY_CODE' );
1179                x_return_status := FND_API.g_ret_sts_error;
1180       END IF;
1181 
1182 
1183       IF p_ge_notif_rules_rec.notif_for_entity_id = FND_API.G_MISS_NUM OR p_ge_notif_rules_rec.notif_for_entity_id IS NULL THEN
1184                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_FOR_ENTITY_ID' );
1185                x_return_status := FND_API.g_ret_sts_error;
1186       END IF;
1187 
1188 
1189       IF p_ge_notif_rules_rec.notif_type_code = FND_API.g_miss_char OR p_ge_notif_rules_rec.notif_type_code IS NULL THEN
1190                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_TYPE_CODE' );
1191                x_return_status := FND_API.g_ret_sts_error;
1192       END IF;
1193 
1194 
1195       IF p_ge_notif_rules_rec.active_flag = FND_API.g_miss_char OR p_ge_notif_rules_rec.active_flag IS NULL THEN
1196                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'ACTIVE_FLAG' );
1197                x_return_status := FND_API.g_ret_sts_error;
1198       END IF;
1199 
1200 
1201    ELSE
1202 
1203 
1204       IF p_ge_notif_rules_rec.notif_rule_id = FND_API.G_MISS_NUM THEN
1205                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_RULE_ID' );
1206                x_return_status := FND_API.g_ret_sts_error;
1207       END IF;
1208 
1209 
1210       IF p_ge_notif_rules_rec.object_version_number = FND_API.G_MISS_NUM THEN
1211                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'OBJECT_VERSION_NUMBER' );
1212                x_return_status := FND_API.g_ret_sts_error;
1213       END IF;
1214 
1215 
1216       IF p_ge_notif_rules_rec.arc_notif_for_entity_code = FND_API.g_miss_char THEN
1217                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'ARC_NOTIF_FOR_ENTITY_CODE' );
1218                x_return_status := FND_API.g_ret_sts_error;
1219       END IF;
1220 
1221 
1222       IF p_ge_notif_rules_rec.notif_for_entity_id = FND_API.G_MISS_NUM THEN
1223                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_FOR_ENTITY_ID' );
1224                x_return_status := FND_API.g_ret_sts_error;
1225       END IF;
1226 
1227 
1228       IF p_ge_notif_rules_rec.notif_type_code = FND_API.g_miss_char THEN
1229                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'NOTIF_TYPE_CODE' );
1230                x_return_status := FND_API.g_ret_sts_error;
1231       END IF;
1232 
1233 
1234       IF p_ge_notif_rules_rec.active_flag = FND_API.g_miss_char THEN
1235                PVX_UTILITY_PVT.Error_Message('AMS_API_MISSING_FIELD', 'MISS_FIELD', 'ACTIVE_FLAG' );
1236                x_return_status := FND_API.g_ret_sts_error;
1237       END IF;
1238    END IF;
1239 
1240 END check_Ge_Notif_Rules_Req_Items;
1241 
1242 
1243 
1244 PROCEDURE check_Ge_Notif_Rules_Fk_Items(
1245     p_ge_notif_rules_rec IN ge_notif_rules_rec_type,
1246     x_return_status OUT NOCOPY VARCHAR2
1247 )
1248 IS
1249 BEGIN
1250    x_return_status := FND_API.g_ret_sts_success;
1251 
1252    -- Enter custom code here
1253 
1254 END check_Ge_Notif_Rules_Fk_Items;
1255 
1256 
1257 
1258 PROCEDURE check_Ge_Notif_Rules_Lkup_Item(
1259     p_ge_notif_rules_rec IN ge_notif_rules_rec_type,
1260     x_return_status OUT NOCOPY VARCHAR2
1261 )
1262 IS
1263 BEGIN
1264    x_return_status := FND_API.g_ret_sts_success;
1265 
1266    -- Enter custom code here
1267 
1268 END check_Ge_Notif_Rules_Lkup_Item;
1269 
1270 
1271 
1272 PROCEDURE Check_Ge_Notif_Rules_Items (
1273     P_ge_notif_rules_rec     IN    ge_notif_rules_rec_type,
1274     p_validation_mode  IN    VARCHAR2,
1275     x_return_status    OUT NOCOPY   VARCHAR2
1276     )
1277 IS
1278    l_return_status   VARCHAR2(1);
1279 BEGIN
1280 
1281     l_return_status := FND_API.g_ret_sts_success;
1282    -- Check Items Uniqueness API calls
1283 
1284    check_Ge_notif_rules_Uk_Items(
1285       p_ge_notif_rules_rec => p_ge_notif_rules_rec,
1286       p_validation_mode => p_validation_mode,
1287       x_return_status => x_return_status);
1288    IF x_return_status <> FND_API.g_ret_sts_success THEN
1289       l_return_status := FND_API.g_ret_sts_error;
1290    END IF;
1291 
1292    -- Check Items Required/NOT NULL API calls
1293 
1294    check_ge_notif_rules_req_items(
1295       p_ge_notif_rules_rec => p_ge_notif_rules_rec,
1296       p_validation_mode => p_validation_mode,
1297       x_return_status => x_return_status);
1298    IF x_return_status <> FND_API.g_ret_sts_success THEN
1299       l_return_status := FND_API.g_ret_sts_error;
1300    END IF;
1301    -- Check Items Foreign Keys API calls
1302 
1303    check_ge_notif_rules_FK_items(
1304       p_ge_notif_rules_rec => p_ge_notif_rules_rec,
1305       x_return_status => x_return_status);
1306    IF x_return_status <> FND_API.g_ret_sts_success THEN
1307       l_return_status := FND_API.g_ret_sts_error;
1308    END IF;
1309    -- Check Items Lookups
1310 
1311    check_Ge_Notif_Rules_Lkup_Item(
1312       p_ge_notif_rules_rec => p_ge_notif_rules_rec,
1313       x_return_status => x_return_status);
1314    IF x_return_status <> FND_API.g_ret_sts_success THEN
1315       l_return_status := FND_API.g_ret_sts_error;
1316    END IF;
1317 
1318    x_return_status := l_return_status;
1319 
1320 END Check_ge_notif_rules_Items;
1321 
1322 
1323 
1324 
1325 
1326 PROCEDURE Complete_Ge_Notif_Rules_Rec (
1327    p_ge_notif_rules_rec IN ge_notif_rules_rec_type,
1328    x_complete_rec OUT NOCOPY ge_notif_rules_rec_type)
1329 IS
1330    l_return_status  VARCHAR2(1);
1331 
1332    CURSOR c_complete IS
1333       SELECT *
1334       FROM pv_ge_notif_rules_b
1335       WHERE notif_rule_id = p_ge_notif_rules_rec.notif_rule_id;
1336    l_ge_notif_rules_rec c_complete%ROWTYPE;
1337 BEGIN
1338    x_complete_rec := p_ge_notif_rules_rec;
1339 
1340 
1341    OPEN c_complete;
1342    FETCH c_complete INTO l_ge_notif_rules_rec;
1343    CLOSE c_complete;
1344 
1345    -- notif_rule_id
1346    IF p_ge_notif_rules_rec.notif_rule_id IS NULL THEN
1347       x_complete_rec.notif_rule_id := l_ge_notif_rules_rec.notif_rule_id;
1348    END IF;
1349 
1350    -- object_version_number
1351    IF p_ge_notif_rules_rec.object_version_number IS NULL THEN
1352       x_complete_rec.object_version_number := l_ge_notif_rules_rec.object_version_number;
1353    END IF;
1354 
1355    -- arc_notif_for_entity_code
1356    IF p_ge_notif_rules_rec.arc_notif_for_entity_code IS NULL THEN
1357       x_complete_rec.arc_notif_for_entity_code := l_ge_notif_rules_rec.arc_notif_for_entity_code;
1358    END IF;
1359 
1360    -- notif_for_entity_id
1361    IF p_ge_notif_rules_rec.notif_for_entity_id IS NULL THEN
1362       x_complete_rec.notif_for_entity_id := l_ge_notif_rules_rec.notif_for_entity_id;
1363    END IF;
1364 
1365    -- wf_item_type_code
1366    IF p_ge_notif_rules_rec.wf_item_type_code IS NULL THEN
1367       x_complete_rec.wf_item_type_code := l_ge_notif_rules_rec.wf_item_type_code;
1368    END IF;
1369 
1370    -- notif_type_code
1371    IF p_ge_notif_rules_rec.notif_type_code IS NULL THEN
1372       x_complete_rec.notif_type_code := l_ge_notif_rules_rec.notif_type_code;
1373    END IF;
1374 
1375    -- active_flag
1376    IF p_ge_notif_rules_rec.active_flag IS NULL THEN
1377       x_complete_rec.active_flag := l_ge_notif_rules_rec.active_flag;
1378    END IF;
1379 
1380    -- repeat_freq_unit
1381    IF p_ge_notif_rules_rec.repeat_freq_unit IS NULL THEN
1382       x_complete_rec.repeat_freq_unit := l_ge_notif_rules_rec.repeat_freq_unit;
1383    END IF;
1384 
1385    -- repeat_freq_value
1386    IF p_ge_notif_rules_rec.repeat_freq_value IS NULL THEN
1387       x_complete_rec.repeat_freq_value := l_ge_notif_rules_rec.repeat_freq_value;
1388    END IF;
1389 
1390    -- send_notif_before_unit
1391    IF p_ge_notif_rules_rec.send_notif_before_unit IS NULL THEN
1392       x_complete_rec.send_notif_before_unit := l_ge_notif_rules_rec.send_notif_before_unit;
1393    END IF;
1394 
1395    -- send_notif_before_value
1396    IF p_ge_notif_rules_rec.send_notif_before_value IS NULL THEN
1397       x_complete_rec.send_notif_before_value := l_ge_notif_rules_rec.send_notif_before_value;
1398    END IF;
1399 
1400    -- send_notif_after_unit
1401    IF p_ge_notif_rules_rec.send_notif_after_unit IS NULL THEN
1402       x_complete_rec.send_notif_after_unit := l_ge_notif_rules_rec.send_notif_after_unit;
1403    END IF;
1404 
1405    -- send_notif_after_value
1406    IF p_ge_notif_rules_rec.send_notif_after_value IS NULL THEN
1407       x_complete_rec.send_notif_after_value := l_ge_notif_rules_rec.send_notif_after_value;
1408    END IF;
1409 
1410    -- repeat_until_unit
1411    IF p_ge_notif_rules_rec.repeat_until_unit IS NULL THEN
1412       x_complete_rec.repeat_until_unit := l_ge_notif_rules_rec.repeat_until_unit;
1413    END IF;
1414 
1415    -- repeat_until_value
1416    IF p_ge_notif_rules_rec.repeat_until_value IS NULL THEN
1417       x_complete_rec.repeat_until_value := l_ge_notif_rules_rec.repeat_until_value;
1418    END IF;
1419 
1420    -- created_by
1421    IF p_ge_notif_rules_rec.created_by IS NULL THEN
1422       x_complete_rec.created_by := l_ge_notif_rules_rec.created_by;
1423    END IF;
1424 
1425    -- creation_date
1426    IF p_ge_notif_rules_rec.creation_date IS NULL THEN
1427       x_complete_rec.creation_date := l_ge_notif_rules_rec.creation_date;
1428    END IF;
1429 
1430    -- last_updated_by
1431    IF p_ge_notif_rules_rec.last_updated_by IS NULL THEN
1432       x_complete_rec.last_updated_by := l_ge_notif_rules_rec.last_updated_by;
1433    END IF;
1434 
1435    -- last_update_date
1436    IF p_ge_notif_rules_rec.last_update_date IS NULL THEN
1437       x_complete_rec.last_update_date := l_ge_notif_rules_rec.last_update_date;
1438    END IF;
1439 
1440    -- last_update_login
1441    IF p_ge_notif_rules_rec.last_update_login IS NULL THEN
1442       x_complete_rec.last_update_login := l_ge_notif_rules_rec.last_update_login;
1443    END IF;
1444    -- Note: Developers need to modify the procedure
1445    -- to handle any business specific requirements.
1446 END Complete_Ge_Notif_Rules_Rec;
1447 
1448 
1449 
1450 
1451 PROCEDURE Default_Ge_Notif_Rules_Items ( p_ge_notif_rules_rec IN ge_notif_rules_rec_type ,
1452                                 x_ge_notif_rules_rec OUT NOCOPY ge_notif_rules_rec_type )
1453 IS
1454    l_ge_notif_rules_rec ge_notif_rules_rec_type := p_ge_notif_rules_rec;
1455 BEGIN
1456    -- Developers should put their code to default the record type
1457    -- e.g. IF p_campaign_rec.status_code IS NULL
1458    --      OR p_campaign_rec.status_code = FND_API.G_MISS_CHAR THEN
1459    --         l_campaign_rec.status_code := 'NEW' ;
1460    --      END IF ;
1461    --
1462    NULL ;
1463 END;
1464 
1465 
1466 
1467 
1468 PROCEDURE Validate_Ge_Notif_Rules(
1469     p_api_version_number         IN   NUMBER,
1470     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
1471     p_validation_level           IN   NUMBER := FND_API.G_VALID_LEVEL_FULL,
1472     p_ge_notif_rules_rec               IN   ge_notif_rules_rec_type,
1473     p_validation_mode            IN    VARCHAR2,
1474     x_return_status              OUT NOCOPY  VARCHAR2,
1475     x_msg_count                  OUT NOCOPY  NUMBER,
1476     x_msg_data                   OUT NOCOPY  VARCHAR2
1477     )
1478  IS
1479 L_API_NAME                  CONSTANT VARCHAR2(30) := 'Validate_Ge_Notif_Rules';
1480 L_API_VERSION_NUMBER        CONSTANT NUMBER   := 1.0;
1481 l_object_version_number     NUMBER;
1482 l_ge_notif_rules_rec        ge_notif_rules_rec_type;
1483 l_ge_notif_rules_rec_out    ge_notif_rules_rec_type;
1484 
1485  BEGIN
1486       -- Standard Start of API savepoint
1487       SAVEPOINT validate_ge_notif_rules_;
1488 
1489       -- Standard call to check for call compatibility.
1490       IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
1491                                            p_api_version_number,
1492                                            l_api_name,
1493                                            G_PKG_NAME)
1494       THEN
1495           RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1496       END IF;
1497 
1498 
1499       -- Initialize message list if p_init_msg_list is set to TRUE.
1500       IF FND_API.to_Boolean( p_init_msg_list )
1501       THEN
1502          FND_MSG_PUB.initialize;
1503       END IF;
1504 
1505 
1506       IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1507               Check_ge_notif_rules_Items(
1508                  p_ge_notif_rules_rec        => p_ge_notif_rules_rec,
1509                  p_validation_mode   => p_validation_mode,
1510                  x_return_status     => x_return_status
1511               );
1512 
1513               IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1514                   RAISE FND_API.G_EXC_ERROR;
1515               ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1516                   RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1517               END IF;
1518       END IF;
1519 
1520       IF p_validation_mode = JTF_PLSQL_API.g_create THEN
1521          Default_Ge_Notif_Rules_Items (p_ge_notif_rules_rec => p_ge_notif_rules_rec ,
1522                                 x_ge_notif_rules_rec => l_ge_notif_rules_rec) ;
1523       END IF ;
1524 
1525 
1526       Complete_ge_notif_rules_Rec(
1527          p_ge_notif_rules_rec        => l_ge_notif_rules_rec,
1528          x_complete_rec              => l_ge_notif_rules_rec_out
1529       );
1530 
1531       l_ge_notif_rules_rec := l_ge_notif_rules_rec_out;
1532 
1533       IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
1534          Validate_ge_notif_rules_Rec(
1535            p_api_version_number     => 1.0,
1536            p_init_msg_list          => FND_API.G_FALSE,
1537            x_return_status          => x_return_status,
1538            x_msg_count              => x_msg_count,
1539            x_msg_data               => x_msg_data,
1540            p_ge_notif_rules_rec           =>    l_ge_notif_rules_rec);
1541 
1542               IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1543                  RAISE FND_API.G_EXC_ERROR;
1544               ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1545                  RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1546               END IF;
1547       END IF;
1548 
1549 
1550       -- Debug Message
1551       IF (PV_DEBUG_HIGH_ON) THEN
1552 
1553       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
1554       END IF;
1555 
1556 
1557 
1558       -- Initialize API return status to SUCCESS
1559       x_return_status := FND_API.G_RET_STS_SUCCESS;
1560 
1561 
1562       -- Debug Message
1563       IF (PV_DEBUG_HIGH_ON) THEN
1564 
1565       PVX_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
1566       END IF;
1567 
1568 
1569       -- Standard call to get message count and if count is 1, get message info.
1570       FND_MSG_PUB.Count_And_Get
1571         (p_count          =>   x_msg_count,
1572          p_data           =>   x_msg_data
1573       );
1574 EXCEPTION
1575 
1576    WHEN PVX_UTILITY_PVT.resource_locked THEN
1577      x_return_status := FND_API.g_ret_sts_error;
1578          PVX_UTILITY_PVT.Error_Message(p_message_name => 'PV_API_RESOURCE_LOCKED');
1579 
1580    WHEN FND_API.G_EXC_ERROR THEN
1581      ROLLBACK TO VALIDATE_Ge_Notif_Rules_;
1582      x_return_status := FND_API.G_RET_STS_ERROR;
1583      -- Standard call to get message count and if count=1, get the message
1584      FND_MSG_PUB.Count_And_Get (
1585             p_encoded => FND_API.G_FALSE,
1586             p_count   => x_msg_count,
1587             p_data    => x_msg_data
1588      );
1589 
1590    WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1591      ROLLBACK TO VALIDATE_Ge_Notif_Rules_;
1592      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1593      -- Standard call to get message count and if count=1, get the message
1594      FND_MSG_PUB.Count_And_Get (
1595             p_encoded => FND_API.G_FALSE,
1596             p_count => x_msg_count,
1597             p_data  => x_msg_data
1598      );
1599 
1600    WHEN OTHERS THEN
1601      ROLLBACK TO VALIDATE_Ge_Notif_Rules_;
1602      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1603      IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1604      THEN
1605         FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1606      END IF;
1607      -- Standard call to get message count and if count=1, get the message
1608      FND_MSG_PUB.Count_And_Get (
1609             p_encoded => FND_API.G_FALSE,
1610             p_count => x_msg_count,
1611             p_data  => x_msg_data
1612      );
1613 End Validate_Ge_Notif_Rules;
1614 
1615 
1616 PROCEDURE Validate_Ge_Notif_Rules_Rec (
1617     p_api_version_number         IN   NUMBER,
1618     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
1619     x_return_status              OUT NOCOPY  VARCHAR2,
1620     x_msg_count                  OUT NOCOPY  NUMBER,
1621     x_msg_data                   OUT NOCOPY  VARCHAR2,
1622     p_ge_notif_rules_rec               IN    ge_notif_rules_rec_type
1623     )
1624 IS
1625 BEGIN
1626       -- Initialize message list if p_init_msg_list is set to TRUE.
1627       IF FND_API.to_Boolean( p_init_msg_list )
1628       THEN
1629          FND_MSG_PUB.initialize;
1630       END IF;
1631 
1632 
1633 
1634       -- Initialize API return status to SUCCESS
1635       x_return_status := FND_API.G_RET_STS_SUCCESS;
1636 
1637       -- Hint: Validate data
1638       -- If data not valid
1639       -- THEN
1640       -- x_return_status := FND_API.G_RET_STS_ERROR;
1641 
1642       -- Debug Message
1643       IF (PV_DEBUG_HIGH_ON) THEN
1644 
1645       PVX_UTILITY_PVT.debug_message('Private API: Validate_dm_model_rec');
1646       END IF;
1647       -- Standard call to get message count and if count is 1, get message info.
1648       FND_MSG_PUB.Count_And_Get
1649         (p_count          =>   x_msg_count,
1650          p_data           =>   x_msg_data
1651       );
1652 END Validate_ge_notif_rules_Rec;
1653 
1654 
1655 PROCEDURE Create_Ge_Notif_Rules_Rec(
1656     p_api_version_number         IN   NUMBER,
1657     p_init_msg_list              IN   VARCHAR2     := FND_API.G_FALSE,
1658     p_commit                     IN   VARCHAR2     := FND_API.G_FALSE,
1659     p_validation_level           IN   NUMBER       := FND_API.G_VALID_LEVEL_FULL,
1660 
1661     x_return_status              OUT NOCOPY  VARCHAR2,
1662     x_msg_count                  OUT NOCOPY  NUMBER,
1663     x_msg_data                   OUT NOCOPY  VARCHAR2,
1664     p_programId      IN NUMBER
1665 )
1666 
1667 IS
1668 l_ge_notif_rules_rec  ge_notif_rules_rec_type;
1669 x_notif_rule_id     NUMBER;
1670 
1671 BEGIN
1672 
1673 
1674 -- Initialize message list if p_init_msg_list is set to TRUE.
1675       IF FND_API.to_Boolean( p_init_msg_list )
1676       THEN
1677          FND_MSG_PUB.initialize;
1678       END IF;
1679 
1680 -- Initialize API return status to SUCCESS
1681       x_return_status := FND_API.G_RET_STS_SUCCESS;
1682 
1683 
1684       l_ge_notif_rules_rec.arc_notif_for_entity_code := 'PRGM';
1685       l_ge_notif_rules_rec.notif_for_entity_id       := p_programId;
1686       l_ge_notif_rules_rec.wf_item_type_code         := 'PVXNUTIL';
1687       l_ge_notif_rules_rec.ACTIVE_FLAG               := 'N';
1688 
1689 
1690       l_ge_notif_rules_rec.notif_type_code           := 'PG_THANKYOU';
1691       l_ge_notif_rules_rec.NOTIF_NAME                := 'ThankYou Notification';
1692       l_ge_notif_rules_rec.notif_content             := 'ThankYou Notification';
1693 
1694       Create_Ge_Notif_Rules( p_api_version_number,
1695                             p_init_msg_list,
1696 			    p_commit,
1697 			    p_validation_level,
1698 			    x_return_status,
1699 			    x_msg_count,
1700 			    x_msg_data,
1701 			    l_ge_notif_rules_rec,
1702 			    x_notif_rule_id
1703 			  );
1704 
1705       l_ge_notif_rules_rec.notif_type_code           := 'PG_WELCOME';
1706       l_ge_notif_rules_rec.NOTIF_NAME                := 'Welcome Notification';
1707       l_ge_notif_rules_rec.notif_content             := 'Welcome Notification';
1708       Create_Ge_Notif_Rules( p_api_version_number,
1709                             p_init_msg_list,
1710 			    p_commit,
1711 			    p_validation_level,
1712 			    x_return_status,
1713 			    x_msg_count,
1714 			    x_msg_data,
1715 			    l_ge_notif_rules_rec,
1716 			    x_notif_rule_id
1717 			  );
1718 
1719       l_ge_notif_rules_rec.notif_type_code           := 'PG_REJECT';
1720       l_ge_notif_rules_rec.NOTIF_NAME                := 'Rejection Notification';
1721       l_ge_notif_rules_rec.notif_content             := 'Rejection Notification';
1722       Create_Ge_Notif_Rules( p_api_version_number,
1723                             p_init_msg_list,
1724 			    p_commit,
1725 			    p_validation_level,
1726 			    x_return_status,
1727 			    x_msg_count,
1728 			    x_msg_data,
1729 			    l_ge_notif_rules_rec,
1730 			    x_notif_rule_id
1731 			  );
1732 
1733       l_ge_notif_rules_rec.notif_type_code           := 'PG_CONTRCT_NRCVD';
1734       l_ge_notif_rules_rec.NOTIF_NAME                := 'Contract not received notification';
1735       l_ge_notif_rules_rec.notif_content             := 'Contract not received';
1736       l_ge_notif_rules_rec.repeat_freq_value         := 0;
1737 
1738       Create_Ge_Notif_Rules( p_api_version_number,
1739                             p_init_msg_list,
1740 			    p_commit,
1741 			    p_validation_level,
1742 			    x_return_status,
1743 			    x_msg_count,
1744 			    x_msg_data,
1745 			    l_ge_notif_rules_rec,
1746 			    x_notif_rule_id
1747 			  );
1748 
1749 
1750       l_ge_notif_rules_rec.notif_type_code           := 'PG_MEM_EXP';
1751       l_ge_notif_rules_rec.NOTIF_NAME                := 'Membership Expiry Notification';
1752       l_ge_notif_rules_rec.notif_content             := 'Membership Expiry Notification';
1753       l_ge_notif_rules_rec.repeat_freq_value         := 0;
1754 
1755       Create_Ge_Notif_Rules( p_api_version_number,
1756                             p_init_msg_list,
1757 			    p_commit,
1758 			    p_validation_level,
1759 			    x_return_status,
1760 			    x_msg_count,
1761 			    x_msg_data,
1762 			    l_ge_notif_rules_rec,
1763 			    x_notif_rule_id
1764 			  );
1765 
1766 
1767 
1768 END Create_Ge_Notif_Rules_Rec;
1769 
1770 
1771 
1772 
1773 
1774 
1775 END PV_Ge_Notif_Rules_PVT;