DBA Data[Home] [Help]

PACKAGE BODY: APPS.OZF_TASK_GROUP_PVT

Source


1 PACKAGE BODY OZF_TASK_GROUP_PVT AS
2 /* $Header: ozfvttgb.pls 115.2 2003/11/13 06:45:20 anujgupt noship $ */
3 --
4 
5 G_PKG_NAME     CONSTANT VARCHAR2(30) := 'OZF_TASK_GROUP_PVT';
6 G_FILE_NAME    CONSTANT VARCHAR2(12) := 'ozfvreab.pls';
7 
8 ---------------------------------------------------------------------
9 -- PROCEDURE
10 --    Create_task_group
11 --
12 -- PURPOSE
13 --    Create a task group code.
14 --
15 -- PARAMETERS
16 --    p_task_group   : the new record to be inserted
17 --    x_task_template_group_id  : return the task_template_group_id
18 --
19 -- NOTES
20 --    1. object_version_number will be set to 1.
21 --    2. If task_template_group_id is passed in, the uniqueness will be checked.
22 --       Raise exception in case of duplicates.
23 --    3. If task_template_group_id is not passed in, generate a unique one from
24 --       the sequence.
25 --    4. If a flag column is passed in, check if it is 'Y' or 'N'.
26 --       Raise exception for invalid flag.
27 --    5. If a flag column is not passed in, default it to 'Y'.
28 --    6. Please don't pass in any FND_API.g_mess_char/num/date.
29 ---------------------------------------------------------------------
30 PROCEDURE  Create_task_group (
31     p_api_version            IN    NUMBER
32    ,p_init_msg_list          IN    VARCHAR2 := FND_API.G_FALSE
33    ,p_commit                 IN    VARCHAR2 := FND_API.G_FALSE
34    ,p_validation_level       IN    NUMBER   := FND_API.G_VALID_LEVEL_FULL
35 
36    ,x_return_status          OUT NOCOPY  VARCHAR2
37    ,x_msg_data               OUT NOCOPY  VARCHAR2
38    ,x_msg_count              OUT NOCOPY  NUMBER
39 
40    ,p_task_group          	    IN     task_group_rec_type
41    ,x_task_template_group_id         OUT NOCOPY   NUMBER
42 )
43 IS
44 l_api_name          CONSTANT VARCHAR2(30) := 'Create_task_group';
45 l_api_version       CONSTANT NUMBER := 1.0;
46 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
47 --
48 l_resource_id       number;
49 l_user_id           number;
50 l_login_user_id     number;
51 l_login_user_status      varchar2(30);
52 l_Error_Msg              varchar2(2000);
53 l_Error_Token            varchar2(80);
54 l_object_version_number  number := 1;
55 l_return_status     VARCHAR2(1);
56 --
57 l_task_template_group_id number;
58 l_task_group		task_group_rec_type := p_task_group;
59 l_active_flag	varchar2(1) := FND_API.G_TRUE;
60 l_reason_type_id number;
61 --
62 --Create this sequence in case and use in API
63 CURSOR reason_type_id_seq IS
64 SELECT ozf_reasons_s.nextval FROM DUAL;
65 
66 BEGIN
67 	-- Standard begin of API savepoint
68 	SAVEPOINT  Create_task_group_PVT;
69 	-- Standard call to check for call compatibility.
70 	IF NOT FND_API.Compatible_API_Call (
71 		l_api_version,
72 		p_api_version,
73 		l_api_name,
74 		G_PKG_NAME)
75 	THEN
76 		RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
77 	END IF;
78 	-- Debug Message
79 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
80 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
81 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
82 		FND_MSG_PUB.Add;
83 	END IF;
84 	--Initialize message list if p_init_msg_list is TRUE.
85 	IF FND_API.To_Boolean (p_init_msg_list) THEN
86 		FND_MSG_PUB.initialize;
87 	END IF;
88 	-- Initialize API return status to sucess
89 	x_return_status := FND_API.G_RET_STS_SUCCESS;
90 
91 	-- Validate task_group
92 	Validate_task_group (
93      		p_api_version       => l_api_version,
94 	    	p_init_msg_list     => p_init_msg_list,
95 	 	p_validation_level  => p_validation_level,
96 		x_return_status     => l_return_status,
97 		x_msg_count         => x_msg_count,
98 		x_msg_data          => x_msg_data,
99 		p_task_group   	    => l_task_group
100 	);
101 
102   	IF l_return_status = FND_API.G_RET_STS_ERROR THEN
103 		RAISE FND_API.G_EXC_ERROR;
104   	ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
105 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
106 	END IF;
107 
108 	BEGIN
109 	  JTF_TASK_TEMP_GROUP_PUB.CREATE_TASK_TEMPLATE_GROUP
110   	  (
111 		P_API_VERSION => p_api_version,
112 		P_INIT_MSG_LIST => FND_API.G_FALSE,
113 		P_COMMIT => FND_API.G_FALSE,
114 		P_VALIDATE_LEVEL => p_validation_level,
115  		P_TEMPLATE_GROUP_NAME => l_task_group.template_group_name,
116     		P_SOURCE_OBJECT_TYPE_CODE => l_task_group.source_object_type_code,
117 		P_START_DATE_ACTIVE => l_task_group.start_date_active,
118 		P_END_DATE_ACTIVE => l_task_group.end_date_active,
119 		P_DESCRIPTION => l_task_group.description,
120 		P_ATTRIBUTE1 => l_task_group.attribute1,
121 		P_ATTRIBUTE2 => l_task_group.attribute2,
122 		P_ATTRIBUTE3 => l_task_group.attribute3,
123 		P_ATTRIBUTE4 => l_task_group.attribute4,
124 		P_ATTRIBUTE5 => l_task_group.attribute5,
125 		P_ATTRIBUTE6 => l_task_group.attribute6,
126 		P_ATTRIBUTE7 => l_task_group.attribute7,
127 		P_ATTRIBUTE8 => l_task_group.attribute8,
128 		P_ATTRIBUTE9 => l_task_group.attribute9,
129 		P_ATTRIBUTE10 => l_task_group.attribute10,
130 		P_ATTRIBUTE11 => l_task_group.attribute11,
131 		P_ATTRIBUTE12 => l_task_group.attribute12,
132 		P_ATTRIBUTE13 => l_task_group.attribute13,
133 		P_ATTRIBUTE14 => l_task_group.attribute14,
134 		P_ATTRIBUTE15 => l_task_group.attribute15,
135 		P_ATTRIBUTE_CATEGORY => l_task_group.attribute_category,
136 		X_RETURN_STATUS => x_return_status,
137 		X_MSG_COUNT => x_msg_count,
138   		X_MSG_DATA => x_msg_data,
139     		X_TASK_TEMPLATE_GROUP_ID => l_task_template_group_id
140 	  );
141 	EXCEPTION
142 		WHEN OTHERS THEN
143 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
144 	END;
145 
146 	-- Create Reason_Type and Reason_Code relationship
147 	--Create this sequence in case and use in API
148         /*
149 	OPEN reason_type_id_seq;
150 		FETCH reason_type_id_seq INTO l_reason_type_id;
151 	CLOSE reason_type_id_seq;
152 
153 	INSERT INTO ozf_reasons (
154 		reason_type_id,
155 		object_version_number,
156 		last_update_date,
157 		last_updated_by,
158 		creation_date,
159 		created_by,
160 		last_update_login,
161 		active_flag,
162 		reason_type,
163 		task_template_group_id
164 	)
165 	VALUES (
166 		l_reason_type_id,
167 		l_object_version_number,
168 		SYSDATE,
169 		NVL(FND_GLOBAL.user_id, -1),
170 		SYSDATE,
171 		NVL(FND_GLOBAL.user_id, -1),
172 		NVL(FND_GLOBAL.conc_login_id, -1),
173 		l_active_flag,
174 		l_task_group.reason_type,
175 		l_task_template_group_id
176 	);
177         */
178 
179 	-- assign reason code id to out param
180 	x_task_template_group_id := l_task_template_group_id;
181 
182 	--Standard check of commit
183 	IF FND_API.To_Boolean ( p_commit ) THEN
184 		COMMIT WORK;
185 	END IF;
186 	-- Debug Message
187 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
188 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
189 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
190 		FND_MSG_PUB.Add;
191 	END IF;
192 	--Standard call to get message count and if count=1, get the message
193 	FND_MSG_PUB.Count_And_Get (
194 		p_encoded => FND_API.G_FALSE,
195 		p_count => x_msg_count,
196 		p_data  => x_msg_data
197 	);
198 EXCEPTION
199 	WHEN FND_API.G_EXC_ERROR THEN
200 		ROLLBACK TO  Create_task_group_PVT;
201 		x_return_status := FND_API.G_RET_STS_ERROR;
202 		-- Standard call to get message count and if count=1, get the message
203 		FND_MSG_PUB.Count_And_Get (
204 			p_encoded => FND_API.G_FALSE,
205 			p_count => x_msg_count,
206 			p_data  => x_msg_data
207 		);
208 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
209 		ROLLBACK TO  Create_task_group_PVT;
210 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
211 		-- Standard call to get message count and if count=1, get the message
212 		FND_MSG_PUB.Count_And_Get (
213 			p_encoded => FND_API.G_FALSE,
214 			p_count => x_msg_count,
215 			p_data  => x_msg_data
216 		);
217 	WHEN OTHERS THEN
218 		ROLLBACK TO  Create_task_group_PVT;
219 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
220 		IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
221 		THEN
222 			FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
223 		END IF;
224 		-- Standard call to get message count and if count=1, get the message
225 		FND_MSG_PUB.Count_And_Get (
226 			p_encoded => FND_API.G_FALSE,
227 			p_count => x_msg_count,
228 			p_data  => x_msg_data
229 		);
230 --
231 END Create_task_group;
232 ---------------------------------------------------------------------
233 -- PROCEDURE
234 --    Update_task_group
235 --
236 -- PURPOSE
237 --    Update a task_group code.
238 --
239 -- PARAMETERS
240 --    p_task_group   : the record with new items.
241 --
242 -- NOTES
243 --    1. Raise exception if the object_version_number doesn't match.
244 --    2. If an attribute is passed in as FND_API.g_miss_char/num/date,
245 --       that column won't be updated.
246 ----------------------------------------------------------------------
247 PROCEDURE  Update_task_group (
248     p_api_version            IN    NUMBER
249    ,p_init_msg_list          IN    VARCHAR2 := FND_API.G_FALSE
250    ,p_commit                 IN    VARCHAR2 := FND_API.G_FALSE
251    ,p_validation_level       IN    NUMBER   := FND_API.G_VALID_LEVEL_FULL
252 
253    ,x_return_status          OUT  NOCOPY VARCHAR2
254    ,x_msg_data               OUT NOCOPY  VARCHAR2
255    ,x_msg_count              OUT NOCOPY  NUMBER
256 
257    ,p_task_group          	     IN    task_group_rec_type
258    ,x_object_version_number  OUT  NOCOPY NUMBER
259 )
260 IS
261 l_api_name          CONSTANT VARCHAR2(30) := 'Update_task_group';
262 l_api_version       CONSTANT NUMBER := 1.0;
263 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
264 --
265 l_resource_id       number;
266 l_user_id           number;
267 l_login_user_id     number;
268 l_login_user_status      varchar2(30);
269 l_Error_Msg              varchar2(2000);
270 l_Error_Token            varchar2(80);
271 l_object_version_number  number := 1;
272 l_return_status     VARCHAR2(1);
273 --
274 l_task_group 		task_group_rec_type := p_task_group;
275 l_reason_type 		varchar2(30);
276 --
277 CURSOR c_reason_type(cv_temp_group_id NUMBER) IS
278 select reason_type, object_version_number
279 from   ozf_reasons
280 where  task_template_group_id = cv_temp_group_id;
281 
282 BEGIN
283 
284 	-- Standard begin of API savepoint
285 	SAVEPOINT  Update_task_group_PVT;
286 	-- Standard call to check for call compatibility.
287 	IF NOT FND_API.Compatible_API_Call (
288 		l_api_version,
289 		p_api_version,
290 		l_api_name,
291 		G_PKG_NAME)
292 	THEN
293 		RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
294 	END IF;
295 	-- Debug Message
296 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
297 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
298 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
299 		FND_MSG_PUB.Add;
300 	END IF;
301 
302 	--Initialize message list if p_init_msg_list is TRUE.
303 	IF FND_API.To_Boolean (p_init_msg_list) THEN
304 		FND_MSG_PUB.initialize;
305 	END IF;
306 	-- Initialize API return status to sucess
307 	x_return_status := FND_API.G_RET_STS_SUCCESS;
308 
309 	IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
310 		Check_task_group_Items(
311 			p_task_group_rec        => p_task_group,
312 			p_validation_mode   => JTF_PLSQL_API.g_update,
313 			x_return_status     => l_return_status
314 		);
315 
316   		IF l_return_status = FND_API.G_RET_STS_ERROR THEN
317 			RAISE FND_API.G_EXC_ERROR;
318   		ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
319 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
320 		END IF;
321 	END IF;
322 
323 	-- Replace g_miss_char/num/date with current column values
324 	Complete_task_group_Rec(
325 		p_task_group_rec        => p_task_group,
326 		x_complete_rec      => l_task_group
327 	);
328 
329 	-- assign object version number
330 	l_object_version_number := l_task_group.object_version_number;
331 
332 	BEGIN
333 	  JTF_TASK_TEMP_GROUP_PUB.UPDATE_TASK_TEMPLATE_GROUP
334   	  (
335 		P_API_VERSION => p_api_version,
336 		P_INIT_MSG_LIST => FND_API.G_FALSE,
337 		P_COMMIT => FND_API.G_FALSE,
338 		P_VALIDATE_LEVEL => p_validation_level,
339  		P_TASK_TEMPLATE_GROUP_ID => l_task_group.task_template_group_id,
340  		P_TEMPLATE_GROUP_NAME => l_task_group.template_group_name,
341     		P_SOURCE_OBJECT_TYPE_CODE => l_task_group.source_object_type_code,
345 		P_ATTRIBUTE1 => l_task_group.attribute1,
342 		P_START_DATE_ACTIVE => l_task_group.start_date_active,
343 		P_END_DATE_ACTIVE => l_task_group.end_date_active,
344 		P_DESCRIPTION => l_task_group.description,
346 		P_ATTRIBUTE2 => l_task_group.attribute2,
347 		P_ATTRIBUTE3 => l_task_group.attribute3,
348 		P_ATTRIBUTE4 => l_task_group.attribute4,
349 		P_ATTRIBUTE5 => l_task_group.attribute5,
350 		P_ATTRIBUTE6 => l_task_group.attribute6,
351 		P_ATTRIBUTE7 => l_task_group.attribute7,
352 		P_ATTRIBUTE8 => l_task_group.attribute8,
353 		P_ATTRIBUTE9 => l_task_group.attribute9,
354 		P_ATTRIBUTE10 => l_task_group.attribute10,
355 		P_ATTRIBUTE11 => l_task_group.attribute11,
356 		P_ATTRIBUTE12 => l_task_group.attribute12,
357 		P_ATTRIBUTE13 => l_task_group.attribute13,
358 		P_ATTRIBUTE14 => l_task_group.attribute14,
359 		P_ATTRIBUTE15 => l_task_group.attribute15,
360 		P_ATTRIBUTE_CATEGORY => l_task_group.attribute_category,
361 		X_RETURN_STATUS => x_return_status,
362 		X_MSG_COUNT => x_msg_count,
363   		X_MSG_DATA => x_msg_data,
364     		X_OBJECT_VERSION_NUMBER => l_object_version_number
365 	  );
366 	EXCEPTION
367 		WHEN OTHERS THEN
368 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
369 	END;
370 
371 	x_object_version_number := l_object_version_number;
372 
373         /*
374 	l_reason_type := l_task_group.reason_type;
375 
376   	OPEN c_reason_type(l_task_group.task_template_group_id);
377   	  FETCH c_reason_type INTO l_reason_type, l_object_version_number;
378   	  IF c_reason_type%NOTFOUND THEN
379         	CLOSE c_reason_type;
380         	IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
381            	  FND_MESSAGE.set_name('OZF','OZF_API_RECORD_NOT_FOUND');
382            	  FND_MSG_PUB.add;
383         	END IF;
384         	RAISE FND_API.g_exc_error;
385   	  END IF;
386   	CLOSE c_reason_type;
387 
388 	-- Update the reason type if changed
389 	IF l_reason_type <> l_task_group.reason_type  THEN
390 	 UPDATE ozf_reasons
391 	 SET    REASON_TYPE = l_task_group.reason_type
392 	 ,      LAST_UPDATE_DATE = sysdate
393 	 ,      LAST_UPDATED_BY = NVL(FND_GLOBAL.user_id, -1)
394 	 ,      OBJECT_VERSION_NUMBER = l_object_version_number + 1
395 	 WHERE  TASK_TEMPLATE_GROUP_ID = l_task_group.task_template_group_id;
396 	END IF;
397         */
398 
399 	--Standard check of commit
400 	IF FND_API.To_Boolean ( p_commit ) THEN
401 		COMMIT WORK;
402 	END IF;
403 	-- Debug Message
404 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
405 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
406 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
407 		FND_MSG_PUB.Add;
408 	END IF;
409 	--Standard call to get message count and if count=1, get the message
410 	FND_MSG_PUB.Count_And_Get (
411 		p_encoded => FND_API.G_FALSE,
412 		p_count => x_msg_count,
413 		p_data  => x_msg_data
414 	);
415 EXCEPTION
419 		-- Standard call to get message count and if count=1, get the message
416 	WHEN FND_API.G_EXC_ERROR THEN
417 		ROLLBACK TO  Update_task_group_PVT;
418 		x_return_status := FND_API.G_RET_STS_ERROR;
420 		FND_MSG_PUB.Count_And_Get (
421 			p_encoded => FND_API.G_FALSE,
422 			p_count => x_msg_count,
426 		ROLLBACK TO  Update_task_group_PVT;
423 			p_data  => x_msg_data
424 		);
425 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
427 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
428 		-- Standard call to get message count and if count=1, get the message
429 		FND_MSG_PUB.Count_And_Get (
430 			p_encoded => FND_API.G_FALSE,
431 			p_count => x_msg_count,
432 			p_data  => x_msg_data
433 		);
434 	WHEN OTHERS THEN
435 		ROLLBACK TO  Update_task_group_PVT;
436 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
437 		IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
438 		THEN
439 			FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
440 		END IF;
441 		-- Standard call to get message count and if count=1, get the message
442 		FND_MSG_PUB.Count_And_Get (
443 			p_encoded => FND_API.G_FALSE,
444 			p_count => x_msg_count,
445 			p_data  => x_msg_data
446 		);
447 --
448 END Update_task_group;
449 ---------------------------------------------------------------------
450 -- PROCEDURE
451 --    Delete task_group
452 --
453 -- PURPOSE
454 --    Delete a task_group code.
455 --
456 -- PARAMETERS
457 --    p_task_template_group_id   : the record with new items.
458 --    p_object_version_number   : object version number
459 --
460 -- NOTES
461 --    1. Raise exception if the object_version_number doesn't match.
462 ----------------------------------------------------------------------
463 PROCEDURE  Delete_task_group (
464     p_api_version            IN    NUMBER
465    ,p_init_msg_list          IN    VARCHAR2 := FND_API.G_FALSE
466    ,p_commit                 IN    VARCHAR2 := FND_API.G_FALSE
467    ,p_validation_level       IN    NUMBER   := FND_API.G_VALID_LEVEL_FULL
468 
469    ,x_return_status          OUT  NOCOPY VARCHAR2
470    ,x_msg_data               OUT  NOCOPY VARCHAR2
471    ,x_msg_count              OUT NOCOPY  NUMBER
472 
473    ,p_task_template_group_id  	     IN    NUMBER
474    ,p_object_version_number  IN    NUMBER
475 )
476 IS
477 l_api_name          CONSTANT VARCHAR2(30) := 'Delete_task_group';
478 l_api_version       CONSTANT NUMBER := 1.0;
482 l_user_id           number;
479 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
480 --
481 l_resource_id       number;
483 l_login_user_id     number;
484 l_login_user_status      varchar2(30);
485 l_Error_Msg              varchar2(2000);
486 l_Error_Token            varchar2(80);
487 l_object_version_number  number := 1;
488 
489 l_task_template_group_id       number;
490 
491 CURSOR exist_task_group_csr(p_id in number) IS
492 select task_template_group_id
493 from   ozf_claims_all
494 where  task_template_group_id = p_id;
495 
496 --
497 BEGIN
498 	-- Standard begin of API savepoint
499 	SAVEPOINT  Delete_task_group_PVT;
500 	-- Standard call to check for call compatibility.
501 	IF NOT FND_API.Compatible_API_Call (
502 		l_api_version,
503 		p_api_version,
504 		l_api_name,
505 		G_PKG_NAME)
506 	THEN
507 		RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
508 	END IF;
509 
510 
511 -- Debug Message
512 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
513 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
514 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
515 		FND_MSG_PUB.Add;
516 	END IF;
517 	--Initialize message list if p_init_msg_list is TRUE.
518 	IF FND_API.To_Boolean (p_init_msg_list) THEN
519 		FND_MSG_PUB.initialize;
520 	END IF;
521 	-- Initialize API return status to sucess
522 	x_return_status := FND_API.G_RET_STS_SUCCESS;
523 
524 	OPEN exist_task_group_csr(p_task_template_group_id);
525 	   FETCH exist_task_group_csr INTO l_task_template_group_id;
526 	CLOSE exist_task_group_csr;
527 
528         IF l_task_template_group_id IS NOT NULL THEN
529            IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
530             FND_MESSAGE.set_name('OZF', 'OZF_CLAIM_TASK_GROUP_USED');
531             FND_MSG_PUB.add;
532            END IF;
533            RAISE FND_API.g_exc_error;
534 	END IF;
535 
536  	BEGIN
537 	   l_object_version_number := p_object_version_number;
538 	  JTF_TASK_TEMP_GROUP_PUB.DELETE_TASK_TEMPLATE_GROUP
539 	  (
540 		P_API_VERSION => p_api_version,
541 		P_INIT_MSG_LIST => FND_API.G_FALSE,
542 		P_COMMIT => FND_API.G_FALSE,
543 		P_VALIDATE_LEVEL => p_validation_level,
544  		P_TASK_TEMPLATE_GROUP_ID => p_task_template_group_id,
545 		X_RETURN_STATUS => x_return_status,
546 		X_MSG_COUNT => x_msg_count,
547   		X_MSG_DATA => x_msg_data,
548     		X_OBJECT_VERSION_NUMBER => l_object_version_number
549 	  );
550 	EXCEPTION
551 		WHEN OTHERS THEN
552 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
553 	END;
554 
555 	-- Remove Reason Type association
556 	-- CHECK Check to see if this should be deleted or made inactive
557 	DELETE FROM ozf_reasons
558 	WHERE  task_template_group_id = p_task_template_group_id;
559 
560 	--Standard check of commit
561 	IF FND_API.To_Boolean ( p_commit ) THEN
562 		COMMIT WORK;
563 	END IF;
564 	-- Debug Message
565 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
566 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
567 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
568 		FND_MSG_PUB.Add;
569 	END IF;
570 	--Standard call to get message count and if count=1, get the message
571 	FND_MSG_PUB.Count_And_Get (
572 		p_encoded => FND_API.G_FALSE,
573 		p_count => x_msg_count,
574 		p_data  => x_msg_data
575 	);
576 EXCEPTION
577 	WHEN FND_API.G_EXC_ERROR THEN
578 		ROLLBACK TO  Delete_task_group_PVT;
579 		x_return_status := FND_API.G_RET_STS_ERROR;
580 		-- Standard call to get message count and if count=1, get the message
581 		FND_MSG_PUB.Count_And_Get (
582 			p_encoded => FND_API.G_FALSE,
583 			p_count => x_msg_count,
584 			p_data  => x_msg_data
585 		);
589 		-- Standard call to get message count and if count=1, get the message
586 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
587 		ROLLBACK TO  Delete_task_group_PVT;
588 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
590 		FND_MSG_PUB.Count_And_Get (
591 			p_encoded => FND_API.G_FALSE,
592 			p_count => x_msg_count,
593 			p_data  => x_msg_data
594 		);
595 	WHEN OTHERS THEN
596 		ROLLBACK TO  Delete_task_group_PVT;
597 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
598 		IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
599 		THEN
600 			FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
601 		END IF;
602 		-- Standard call to get message count and if count=1, get the message
603 		FND_MSG_PUB.Count_And_Get (
604 			p_encoded => FND_API.G_FALSE,
605 			p_count => x_msg_count,
606 			p_data  => x_msg_data
607 		);
608 --
609 END Delete_task_group;
610 ---------------------------------------------------------------
611 -- PROCEDURE
612 --    Get_task_group
613 --
614 -- PURPOSE
615 --    Get task_group code.
616 --
617 -- PARAMETERS
618 --    p_task_template_group_id   : the record with new items.
619 --    p_object_version_number   : object version number
620 --
621 -- NOTES
622 --    1. Raise exception if the object_version_number doesn't match.
623 ----------------------------------------------------------------------
624 PROCEDURE  Get_task_group (
625     p_api_version            IN    NUMBER
626    ,p_init_msg_list          IN    VARCHAR2 := FND_API.G_FALSE
627    ,p_validation_level       IN    NUMBER   := FND_API.G_VALID_LEVEL_FULL
628 
629    ,x_return_status          OUT NOCOPY  VARCHAR2
630    ,x_msg_data               OUT NOCOPY  VARCHAR2
631    ,x_msg_count              OUT NOCOPY   NUMBER
632 
633    ,p_task_template_group_id 	     IN    NUMBER
634    ,p_template_group_name    	     IN    VARCHAR2
635    ,p_source_object_type_code IN   VARCHAR2
639    ,p_request_rec	     IN    ozf_request_rec_type
636    ,p_start_date_active	     IN    DATE
637    ,p_end_date_active	     IN    DATE
638    ,p_sort_data		     IN    ozf_sort_data
640    ,x_return_rec	     OUT NOCOPY  ozf_return_rec_type
641    ,x_task_group  	    	     OUT NOCOPY  task_group_tbl_type
642    )
643 IS
644 l_api_name          CONSTANT VARCHAR2(30) := 'Get_task_group';
645 l_api_version       CONSTANT NUMBER := 1.0;
646 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
647 --
648 l_resource_id       number;
649 l_user_id           number;
650 l_login_user_id     number;
651 l_login_user_status      varchar2(30);
652 l_Error_Msg              varchar2(2000);
653 l_Error_Token            varchar2(80);
654 l_object_version_number  number := 1;
655 
656 l_sort_data		JTF_TASK_TEMP_GROUP_PUB.SORT_DATA;
657 l_query_or_next_code 	varchar2(1) := 'Q';
658 l_start_pointer		number;
659 l_rec_wanted		number;
660 l_show_all		varchar2(1) := 'N'; --FND_API.G_FALSE;
661 l_template_group	JTF_TASK_TEMP_GROUP_PUB.TASK_TEMP_GROUP_TBL;
662 l_reason_type		varchar2(30);
663 --
664 CURSOR c_reason_type(cv_temp_group_id NUMBER) IS
665 select reason_type
666 from   ozf_reasons
667 where  task_template_group_id = cv_temp_group_id;
668 
669 BEGIN
670 	-- Standard begin of API savepoint
671 	SAVEPOINT  Get_task_group_PVT;
672 	-- Standard call to check for call compatibility.
673 	IF NOT FND_API.Compatible_API_Call (
674 		l_api_version,
675 		p_api_version,
676 		l_api_name,
677 		G_PKG_NAME)
678 	THEN
679 		RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
680 	END IF;
681 	-- Debug Message
682 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
683 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
684 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
685 		FND_MSG_PUB.Add;
686 	END IF;
687 	--Initialize message list if p_init_msg_list is TRUE.
688 	IF FND_API.To_Boolean (p_init_msg_list) THEN
689 		FND_MSG_PUB.initialize;
690 	END IF;
691 	-- Initialize API return status to sucess
692 	x_return_status := FND_API.G_RET_STS_SUCCESS;
693 
694 	FOR i in 1..p_sort_data.count LOOP
695 	  l_sort_data(i).field_name := p_sort_data(i).field_name;
696 	  l_sort_data(i).asc_dsc_flag := p_sort_data(i).asc_dsc_flag;
697 	END LOOP;
698 
699 	l_start_pointer := p_request_rec.start_record_position;
700 	l_rec_wanted := p_request_rec.records_requested;
701 
702 	IF p_request_rec.records_requested = FND_API.G_MISS_NUM THEN
703 	  l_show_all := 'Y'; --FND_API.G_TRUE;
704 	END IF;
705 
706 	JTF_TASK_TEMP_GROUP_PUB.GET_TASK_TEMPLATE_GROUP
707  	(
708 		P_API_VERSION => p_api_version,
709 		P_INIT_MSG_LIST => FND_API.G_FALSE,
710 		P_COMMIT => FND_API.G_FALSE,
711 		P_VALIDATE_LEVEL => p_validation_level,
712  		P_TASK_TEMPLATE_GROUP_ID => p_task_template_group_id,
713  		P_TEMPLATE_GROUP_NAME => p_template_group_name,
714  		P_SOURCE_OBJECT_TYPE_CODE => p_source_object_type_code,
715  		P_START_DATE_ACTIVE => p_start_date_active,
716  		P_END_DATE_ACTIVE => p_end_date_active,
717  		P_SORT_DATA => l_sort_data,
718  		P_QUERY_OR_NEXT_CODE  => l_query_or_next_code,
719  		P_START_POINTER => l_start_pointer,
720  		P_REC_WANTED => l_rec_wanted,
721  		P_SHOW_ALL => l_show_all,
722 		X_RETURN_STATUS => x_return_status,
723 		X_MSG_COUNT => x_msg_count,
724   		X_MSG_DATA => x_msg_data,
725  		X_TASK_TEMPLATE_GROUP => l_template_group,
726  		X_TOTAL_RETRIEVED => x_return_rec.total_record_count,
727  		X_TOTAL_RETURNED => x_return_rec.returned_record_count
728  	);
729 	x_return_rec.next_record_position :=
730 		l_start_pointer + x_return_rec.returned_record_count;
731 	x_task_group := task_group_tbl_type();
732 	FOR i in 1..l_template_group.count LOOP
733 	  x_task_group.extend;
734           OPEN c_reason_type(l_template_group(i).task_template_group_id);
735             FETCH c_reason_type INTO l_reason_type;
739                   FND_MESSAGE.set_name('OZF','OZF_API_RECORD_NOT_FOUND');
736               IF c_reason_type%NOTFOUND THEN
737                 CLOSE c_reason_type;
738                 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
740                   FND_MSG_PUB.add;
741                 END IF;
742                 RAISE FND_API.g_exc_error;
743               END IF;
744           CLOSE c_reason_type;
745 	  x_task_group(i).task_template_group_id := l_template_group(i).task_template_group_id;
746 	  x_task_group(i).start_date_active := l_template_group(i).start_date_active;
747 	  x_task_group(i).end_date_active := l_template_group(i).end_date_active;
748 	  x_task_group(i).source_object_type_code :=
749 			l_template_group(i).source_object_type_code;
750 	  x_task_group(i).object_version_number :=
751 			l_template_group(i).object_version_number;
752 	  x_task_group(i).attribute_category :=
753 			l_template_group(i).attribute_category;
754 	  x_task_group(i).attribute1 := l_template_group(i).attribute1;
755 	  x_task_group(i).attribute2 := l_template_group(i).attribute2;
756 	  x_task_group(i).attribute3 := l_template_group(i).attribute3;
757 	  x_task_group(i).attribute4 := l_template_group(i).attribute4;
758 	  x_task_group(i).attribute5 := l_template_group(i).attribute5;
759 	  x_task_group(i).attribute6 := l_template_group(i).attribute6;
760 	  x_task_group(i).attribute7 := l_template_group(i).attribute7;
761 	  x_task_group(i).attribute8 := l_template_group(i).attribute8;
762 	  x_task_group(i).attribute9 := l_template_group(i).attribute9;
763 	  x_task_group(i).attribute10 := l_template_group(i).attribute10;
764 	  x_task_group(i).attribute11 := l_template_group(i).attribute11;
765 	  x_task_group(i).attribute12 := l_template_group(i).attribute12;
766 	  x_task_group(i).attribute13 := l_template_group(i).attribute13;
767 	  x_task_group(i).attribute14 := l_template_group(i).attribute14;
768 	  x_task_group(i).attribute15 := l_template_group(i).attribute15;
769 	  x_task_group(i).reason_type := l_reason_type;
770 	  x_task_group(i).template_group_name := l_template_group(i).template_group_name;
771 	  x_task_group(i).description := l_template_group(i).description;
772 	END LOOP;
773 
774 
775 	-- Debug Message
776 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
777 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
778 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
779 		FND_MSG_PUB.Add;
780 	END IF;
781 	--Standard call to get message count and if count=1, get the message
782 	FND_MSG_PUB.Count_And_Get (
783 		p_encoded => FND_API.G_FALSE,
784 		p_count => x_msg_count,
785 		p_data  => x_msg_data
786 	);
787 EXCEPTION
788 	WHEN FND_API.G_EXC_ERROR THEN
789 		ROLLBACK TO  Get_task_group_PVT;
790 		x_return_status := FND_API.G_RET_STS_ERROR;
791 		-- Standard call to get message count and if count=1, get the message
792 		FND_MSG_PUB.Count_And_Get (
793 			p_encoded => FND_API.G_FALSE,
794 			p_count => x_msg_count,
795 			p_data  => x_msg_data
796 		);
797 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
798 		ROLLBACK TO  Get_task_group_PVT;
799 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
800 		-- Standard call to get message count and if count=1, get the message
801 		FND_MSG_PUB.Count_And_Get (
802 			p_encoded => FND_API.G_FALSE,
803 			p_count => x_msg_count,
804 			p_data  => x_msg_data
805 		);
806 	WHEN OTHERS THEN
807 		ROLLBACK TO  Get_task_group_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 --
820 END Get_task_group;
821 ---------------------------------------------------------------------
822 -- PROCEDURE
823 --    Validate_task_group
824 --
825 -- PURPOSE
826 --    Validate a task_group code record.
827 --
828 -- PARAMETERS
829 --    p_task_group : the task_group code record to be validated
830 --
831 -- NOTES
832 --
833 ----------------------------------------------------------------------
834 PROCEDURE  Validate_task_group (
835     p_api_version            IN   NUMBER
839    ,x_msg_count              OUT NOCOPY NUMBER
836    ,p_init_msg_list          IN   VARCHAR2 := FND_API.G_FALSE
837    ,p_validation_level       IN   NUMBER   := FND_API.G_VALID_LEVEL_FULL
838    ,x_return_status          OUT NOCOPY VARCHAR2
840    ,x_msg_data               OUT NOCOPY VARCHAR2
841    ,p_task_group        	    IN  task_group_rec_type
842 )
843 IS
844 l_api_name          CONSTANT VARCHAR2(30) := 'Validate_task_group';
845 l_api_version       CONSTANT NUMBER := 1.0;
846 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
847 --
848 l_resource_id       number;
849 l_user_id           number;
850 l_login_user_id     number;
851 l_login_user_status varchar2(30);
852 l_Error_Msg         varchar2(2000);
853 l_Error_Token       varchar2(80);
854 l_object_version_number  number := 1;
855 l_return_status     VARCHAR2(1);
856 --
857 l_task_group	task_group_rec_type := p_task_group;
858 BEGIN
859 	-- Standard begin of API savepoint
860 	SAVEPOINT  Validate_task_group_PVT;
861 	-- Standard call to check for call compatibility.
862 	IF NOT FND_API.Compatible_API_Call (
863 		l_api_version,
864 		p_api_version,
865 		l_api_name,
866 		G_PKG_NAME)
867 	THEN
868 		RAISE  FND_API.G_EXC_UNEXPECTED_ERROR;
869 	END IF;
870 	-- Debug Message
871 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
872 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
873 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': Start');
874 		FND_MSG_PUB.Add;
875 	END IF;
876 	--Initialize message list if p_init_msg_list is TRUE.
877 	IF FND_API.To_Boolean (p_init_msg_list) THEN
878 		FND_MSG_PUB.initialize;
879 	END IF;
880 	-- Initialize API return status to sucess
881 	x_return_status := FND_API.G_RET_STS_SUCCESS;
882 
883 	IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
884 		Check_task_group_Items(
885 			p_task_group_rec        => p_task_group,
886 			p_validation_mode   => JTF_PLSQL_API.g_update,
887 			x_return_status     => l_return_status
888 		);
889 
890   		IF l_return_status = FND_API.G_RET_STS_ERROR THEN
891 			RAISE FND_API.G_EXC_ERROR;
892   		ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
893 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
894 		END IF;
895 	END IF;
896 /*
897         Complete_task_group_Rec(
898                 p_task_group_rec        => p_task_group,
899                 x_complete_rec      => l_task_group
900         );
901 
902 	IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
903 		Check_task_group_Record(
904 			p_task_group_rec     => p_task_group,
905 			p_complete_rec   => l_task_group,
906 			x_return_status  => l_return_status
907 		);
908 
909   		IF l_return_status = FND_API.G_RET_STS_ERROR THEN
910 			RAISE FND_API.G_EXC_ERROR;
911   		ELSIF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
912 			RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
913 		END IF;
914 	END IF;
915 */
916 	-- Debug Message
917 	IF FND_MSG_PUB.Check_Msg_level (FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW) THEN
918 		FND_MESSAGE.Set_Name('OZF','OZF_API_DEBUG_MESSAGE');
919 		FND_MESSAGE.Set_Token('TEXT',l_full_name||': End');
920 		FND_MSG_PUB.Add;
921 	END IF;
922 	--Standard call to get message count and if count=1, get the message
923 	FND_MSG_PUB.Count_And_Get (
924 		p_encoded => FND_API.G_FALSE,
925 		p_count => x_msg_count,
926 		p_data  => x_msg_data
927 	);
928 EXCEPTION
929 	WHEN FND_API.G_EXC_ERROR THEN
930 		ROLLBACK TO  Validate_task_group_PVT;
931 		x_return_status := FND_API.G_RET_STS_ERROR;
932 		-- Standard call to get message count and if count=1, get the message
933 		FND_MSG_PUB.Count_And_Get (
934 			p_encoded => FND_API.G_FALSE,
935 			p_count => x_msg_count,
936 			p_data  => x_msg_data
937 		);
938 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
939 		ROLLBACK TO  Validate_task_group_PVT;
940 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
941 		-- Standard call to get message count and if count=1, get the message
942 		FND_MSG_PUB.Count_And_Get (
943 			p_encoded => FND_API.G_FALSE,
944 			p_count => x_msg_count,
945 			p_data  => x_msg_data
946 		);
947 	WHEN OTHERS THEN
948 		ROLLBACK TO  Validate_task_group_PVT;
949 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
950 		IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
951 		THEN
952 			FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
953 		END IF;
954 		-- Standard call to get message count and if count=1, get the message
955 		FND_MSG_PUB.Count_And_Get (
956 			p_encoded => FND_API.G_FALSE,
957 			p_count => x_msg_count,
958 			p_data  => x_msg_data
959 		);
960 --
961 END Validate_task_group;
962 ---------------------------------------------------------------------
963 -- PROCEDURE
964 --    Check_task_group_Req_Items
965 --
966 -- HISTORY
967 --    04/18/2000  Michelle Chang  Create.
968 ---------------------------------------------------------------------
969 PROCEDURE Check_task_group_Req_Items(
970    p_task_group_rec       IN  task_group_rec_type
971   ,x_return_status    OUT NOCOPY VARCHAR2
972 )
973 IS
974    l_source_object       VARCHAR2(30);
975    l_start_date		    DATE;
976    l_task_group_name     VARCHAR2(80);
977 BEGIN
978 
979    x_return_status := FND_API.G_RET_STS_SUCCESS;
980 
981    l_start_date := p_task_group_rec.start_date_active;
982    l_source_object := p_task_group_rec.source_object_type_code;
986    IF( (l_source_object IS NULL)
983    l_task_group_name := p_task_group_rec.template_group_name;
984 
985    -- Check for null source object
987    OR (l_source_object = FND_API.G_MISS_CHAR) )
988    THEN
989       FND_MESSAGE.Set_Name('OZF', 'OZF_ACTION_NULL_SOURCEOBJ');
990       FND_MSG_PUB.ADD;
991       x_return_status := FND_API.G_RET_STS_ERROR;
992       RAISE FND_API.G_EXC_ERROR;
993    END IF;
994 
995    -- Check for null task group name
996    IF( (l_task_group_name IS NULL)
997    OR (l_task_group_name = FND_API.G_MISS_CHAR) )
998    THEN
999 	   FND_MESSAGE.Set_Name('OZF', 'OZF_ACTION_NULL_TASK_GROUPNAME');
1000       FND_MSG_PUB.ADD;
1001       x_return_status := FND_API.G_RET_STS_ERROR;
1002       RAISE FND_API.G_EXC_ERROR;
1003    END IF;
1004 
1005    -- Check for null start date
1006    IF( (l_start_date IS NULL)
1007 	OR (l_start_date = FND_API.G_MISS_DATE) )
1008    THEN
1009       FND_MESSAGE.Set_Name('OZF', 'OZF_ACTION_NULL_STDATE');
1010       FND_MSG_PUB.ADD;
1011       x_return_status := FND_API.G_RET_STS_ERROR;
1012       RAISE FND_API.G_EXC_ERROR;
1013    END IF;
1014 
1015 END Check_task_group_Req_Items;
1016 ---------------------------------------------------------------------
1017 -- PROCEDURE
1018 --    Check_task_group_Uk_Items
1019 --
1020 -- HISTORY
1021 --    04/18/2000  Michelle Chang  Create.
1022 ---------------------------------------------------------------------
1023 PROCEDURE Check_task_group_Uk_Items(
1024    p_task_group_rec        IN  task_group_rec_type
1025   ,p_validation_mode   IN  VARCHAR2 := JTF_PLSQL_API.g_create
1026   ,x_return_status     OUT NOCOPY VARCHAR2
1027 )
1028 IS
1029    l_valid_flag  VARCHAR2(1);
1030 BEGIN
1031 
1032    x_return_status := FND_API.G_RET_STS_SUCCESS;
1033 
1034 END Check_task_group_Uk_Items;
1035 ---------------------------------------------------------------------
1036 -- PROCEDURE
1037 --    Check_task_group_Fk_Items
1038 --
1039 -- HISTORY
1040 --    04/18/2000  Michelle Chang  Create.
1041 ---------------------------------------------------------------------
1042 PROCEDURE Check_task_group_Fk_Items(
1043    p_task_group_rec        IN  task_group_rec_type
1044   ,x_return_status     OUT NOCOPY VARCHAR2
1045 )
1046 IS
1047 BEGIN
1048 
1049    x_return_status := FND_API.G_RET_STS_SUCCESS;
1050    -- check other fk items
1051 
1052 END Check_task_group_Fk_Items;
1053 ---------------------------------------------------------------------
1054 -- PROCEDURE
1055 --    Check_task_group_Lookup_Items
1056 --
1057 -- HISTORY
1058 --    04/18/2000  Michelle Chang  Create.
1059 ---------------------------------------------------------------------
1060 PROCEDURE Check_task_group_Lookup_Items(
1061    p_task_group_rec        IN  task_group_rec_type
1062   ,x_return_status   OUT NOCOPY VARCHAR2
1063 )
1064 IS
1065 BEGIN
1066 
1067    x_return_status := FND_API.G_RET_STS_SUCCESS;
1068    -- check other lookup codes
1069 
1070 END Check_task_group_Lookup_Items;
1071 ---------------------------------------------------------------------
1072 -- PROCEDURE
1073 --    Check_task_group_Flag_Items
1074 --
1075 -- HISTORY
1076 --    04/18/2000  Michelle Chang  Create.
1077 ---------------------------------------------------------------------
1078 PROCEDURE Check_task_group_Flag_Items(
1079    p_task_group_rec        IN  task_group_rec_type
1080   ,x_return_status   OUT NOCOPY VARCHAR2
1081 )
1082 IS
1083 BEGIN
1084 
1085    x_return_status := FND_API.G_RET_STS_SUCCESS;
1086 END Check_task_group_Flag_Items;
1087 ---------------------------------------------------------------------
1088 -- PROCEDURE
1089 --    Check_task_group_Items
1090 --
1091 -- PURPOSE
1092 --    Perform the item level checking including unique keys,
1093 --    required columns, foreign keys, , flag items, domain constraints.
1094 --
1095 -- PARAMETERS
1096 --    p_task_group_rec      : the record to be validated
1097 ---------------------------------------------------------------------
1098 PROCEDURE Check_task_group_Items(
1099    p_validation_mode   IN  VARCHAR2 := JTF_PLSQL_API.g_create
1100   ,x_return_status     OUT NOCOPY VARCHAR2
1101   ,p_task_group_rec        IN  task_group_rec_type
1102 )
1103 IS
1104 l_api_name          CONSTANT VARCHAR2(30) := 'Check_task_group_Items';
1105 l_api_version       CONSTANT NUMBER := 1.0;
1106 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
1107 --
1108 l_resource_id       number;
1109 l_user_id           number;
1110 l_login_user_id     number;
1111 l_login_user_status      varchar2(30);
1112 l_Error_Msg              varchar2(2000);
1113 l_Error_Token            varchar2(80);
1114 l_object_version_number  number := 1;
1115 --
1116 BEGIN
1117    --
1118    Check_task_group_Req_Items(
1119       p_task_group_rec       => p_task_group_rec
1120      ,x_return_status    => x_return_status
1121    );
1122    IF x_return_status <> FND_API.g_ret_sts_success THEN
1123       RETURN;
1124    END IF;
1125    Check_task_group_Uk_Items(
1126       p_task_group_rec       => p_task_group_rec
1127      ,p_validation_mode  => p_validation_mode
1128      ,x_return_status    => x_return_status
1129    );
1130    IF x_return_status <> FND_API.g_ret_sts_success THEN
1131       RETURN;
1132    END IF;
1133    Check_task_group_Fk_Items(
1134       p_task_group_rec       => p_task_group_rec
1135      ,x_return_status    => x_return_status
1136    );
1137    IF x_return_status <> FND_API.g_ret_sts_success THEN
1138       RETURN;
1142      ,x_return_status    => x_return_status
1139    END IF;
1140    Check_task_group_Lookup_Items(
1141       p_task_group_rec       => p_task_group_rec
1143    );
1144    IF x_return_status <> FND_API.g_ret_sts_success THEN
1145       RETURN;
1146    END IF;
1147    Check_task_group_Flag_Items(
1148       p_task_group_rec       => p_task_group_rec
1149      ,x_return_status    => x_return_status
1150    );
1151    IF x_return_status <> FND_API.g_ret_sts_success THEN
1152       RETURN;
1153    END IF;
1154    --
1155 END Check_task_group_Items;
1156 ---------------------------------------------------------------------
1157 -- PROCEDURE
1158 --    Check_task_group_Record
1159 --
1160 -- PURPOSE
1161 --    Check the record level business rules.
1162 --
1163 -- PARAMETERS
1164 --    p_task_group_rec  : the record to be validated; may contain attributes
1165 --                    as FND_API.g_miss_char/num/date
1166 --    p_complete_rec: the complete record after all "g_miss" items have
1167 --                    been replaced by current database values
1168 ---------------------------------------------------------------------
1169 PROCEDURE Check_task_group_Record(
1170    p_task_group_rec        IN   task_group_rec_type
1171   ,p_complete_rec      IN   task_group_rec_type := NULL
1172   ,x_return_status     OUT NOCOPY VARCHAR2
1173 )
1174 IS
1175 l_api_name          CONSTANT VARCHAR2(30) := 'Check_task_group_Record';
1176 l_api_version       CONSTANT NUMBER := 1.0;
1177 l_full_name         CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| l_api_name;
1178 --
1179 l_resource_id       number;
1180 l_user_id           number;
1181 l_login_user_id     number;
1182 l_login_user_status      varchar2(30);
1183 l_Error_Msg              varchar2(2000);
1184 l_Error_Token            varchar2(80);
1185 l_object_version_number  number := 1;
1186 --
1187 BEGIN
1188 
1189    x_return_status := FND_API.G_RET_STS_SUCCESS;
1190 
1191 --
1192 END Check_task_group_Record;
1193 ---------------------------------------------------------------------
1194 -- PROCEDURE
1195 --    Init_task_group_Rec
1196 --
1197 -- PURPOSE
1198 --    Initialize all attributes to be FND_API.g_miss_char/num/date.
1199 ---------------------------------------------------------------------
1200 PROCEDURE Init_task_group_Rec (
1201    x_task_group_rec        OUT NOCOPY task_group_rec_type
1202 )
1203 IS
1204 BEGIN
1205  --
1206  --
1207    RETURN;
1208 END Init_task_group_Rec;
1209 ---------------------------------------------------------------------
1210 -- PROCEDURE
1211 --    Complete_task_group_Rec
1212 --
1213 -- PURPOSE
1214 --    For Update_task_group, some attributes may be passed in as
1215 --    FND_API.g_miss_char/num/date if the user doesn't want to
1216 --    update those attributes. This procedure will replace the
1217 --    "g_miss" attributes with current database values.
1218 --	 must pass task_template_group_id
1219 -- PARAMETERS
1220 --    p_task_group_rec  : the record which may contain attributes as
1221 --                    FND_API.g_miss_char/num/date
1222 --    x_complete_rec: the complete record after all "g_miss" items
1223 --                    have been replaced by current database values
1224 ---------------------------------------------------------------------
1225 PROCEDURE Complete_task_group_Rec (
1226    p_task_group_rec        IN   task_group_rec_type
1227   ,x_complete_rec      OUT NOCOPY task_group_rec_type
1228 )
1229 IS
1230 
1231 CURSOR c_task_group (cv_task_template_group_id NUMBER) IS
1232 SELECT * FROM JTF_TASK_TEMP_GROUPS_VL
1233 WHERE TASK_TEMPLATE_GROUP_ID = cv_task_template_group_id;
1234 
1235 l_task_group_rec    c_task_group%ROWTYPE;
1236 
1237 BEGIN
1238 
1239   x_complete_rec  := p_task_group_rec;
1240 
1241   OPEN c_task_group(p_task_group_rec.task_template_group_id);
1242   FETCH c_task_group INTO l_task_group_rec;
1243   IF c_task_group%NOTFOUND THEN
1244         CLOSE c_task_group;
1245         IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1246            FND_MESSAGE.set_name('OZF','OZF_API_RECORD_NOT_FOUND');
1247            FND_MSG_PUB.add;
1248         END IF;
1249         RAISE FND_API.g_exc_error;
1250   END IF;
1251   CLOSE c_task_group;
1252 
1253   IF p_task_group_rec.start_date_active         = FND_API.G_MISS_DATE  THEN
1254      x_complete_rec.start_date_active       := NULL;
1255   END IF;
1256   IF p_task_group_rec.start_date_active         IS NULL THEN
1257      x_complete_rec.start_date_active       := l_task_group_rec.start_date_active;
1258   END IF;
1259 
1260   IF p_task_group_rec.end_date_active    	    = FND_API.G_MISS_DATE  THEN
1261      x_complete_rec.end_date_active         := NULL;
1262   END IF;
1263   IF p_task_group_rec.end_date_active    	    IS NULL THEN
1264      x_complete_rec.end_date_active         := l_task_group_rec.end_date_active;
1265   END IF;
1266 
1267   IF p_task_group_rec.source_object_type_code   = FND_API.G_MISS_CHAR  THEN
1268      x_complete_rec.source_object_type_code := NULL;
1269   END IF;
1270   IF p_task_group_rec.source_object_type_code   IS NULL THEN
1271      x_complete_rec.source_object_type_code := l_task_group_rec.source_object_type_code;
1272   END IF;
1273   IF p_task_group_rec.object_version_number     = FND_API.G_MISS_NUM  THEN
1274      x_complete_rec.object_version_number   := NULL;
1275   END IF;
1276   IF p_task_group_rec.object_version_number     IS NULL THEN
1277      x_complete_rec.object_version_number   := l_task_group_rec.object_version_number;
1278   END IF;
1282   IF p_task_group_rec.attribute_category        IS NULL THEN
1279   IF p_task_group_rec.attribute_category        = FND_API.G_MISS_CHAR  THEN
1280      x_complete_rec.attribute_category      := NULL;
1281   END IF;
1283      x_complete_rec.attribute_category      := l_task_group_rec.attribute_category;
1284   END IF;
1285   IF p_task_group_rec.attribute1                = FND_API.G_MISS_CHAR  THEN
1286      x_complete_rec.attribute1              := NULL;
1287   END IF;
1288   IF p_task_group_rec.attribute1                IS NULL THEN
1289      x_complete_rec.attribute1              := l_task_group_rec.attribute1;
1290   END IF;
1291   IF p_task_group_rec.attribute2                = FND_API.G_MISS_CHAR  THEN
1292      x_complete_rec.attribute2              := NULL;
1293   END IF;
1294   IF p_task_group_rec.attribute2                IS NULL THEN
1295      x_complete_rec.attribute2              := l_task_group_rec.attribute2;
1296   END IF;
1297   IF p_task_group_rec.attribute3                = FND_API.G_MISS_CHAR  THEN
1298      x_complete_rec.attribute3              := NULL;
1299   END IF;
1300   IF p_task_group_rec.attribute3                IS NULL THEN
1301      x_complete_rec.attribute3              := l_task_group_rec.attribute3;
1302   END IF;
1303   IF p_task_group_rec.attribute4                = FND_API.G_MISS_CHAR  THEN
1304      x_complete_rec.attribute4              := NULL;
1305   END IF;
1306   IF p_task_group_rec.attribute4                IS NULL THEN
1307      x_complete_rec.attribute4              := l_task_group_rec.attribute4;
1308   END IF;
1309   IF p_task_group_rec.attribute5                = FND_API.G_MISS_CHAR  THEN
1310      x_complete_rec.attribute5              := NULL;
1311   END IF;
1312   IF p_task_group_rec.attribute5                IS NULL THEN
1313      x_complete_rec.attribute5              := l_task_group_rec.attribute5;
1314   END IF;
1315   IF p_task_group_rec.attribute6                = FND_API.G_MISS_CHAR  THEN
1316      x_complete_rec.attribute6              := NULL;
1317   END IF;
1318   IF p_task_group_rec.attribute6                IS NULL THEN
1319      x_complete_rec.attribute6              := l_task_group_rec.attribute6;
1320   END IF;
1321   IF p_task_group_rec.attribute7                = FND_API.G_MISS_CHAR  THEN
1322      x_complete_rec.attribute7              := NULL;
1323   END IF;
1324   IF p_task_group_rec.attribute7                IS NULL THEN
1325      x_complete_rec.attribute7              := l_task_group_rec.attribute7;
1326   END IF;
1327   IF p_task_group_rec.attribute8                = FND_API.G_MISS_CHAR  THEN
1328      x_complete_rec.attribute8              := NULL;
1329   END IF;
1330   IF p_task_group_rec.attribute8                IS NULL THEN
1331      x_complete_rec.attribute8              := l_task_group_rec.attribute8;
1332   END IF;
1333   IF p_task_group_rec.attribute9                = FND_API.G_MISS_CHAR  THEN
1334      x_complete_rec.attribute9              := NULL;
1335   END IF;
1336   IF p_task_group_rec.attribute9                IS NULL THEN
1337      x_complete_rec.attribute9              := l_task_group_rec.attribute9;
1338   END IF;
1339   IF p_task_group_rec.attribute10               = FND_API.G_MISS_CHAR  THEN
1340      x_complete_rec.attribute10             := NULL;
1341   END IF;
1342   IF p_task_group_rec.attribute10               IS NULL THEN
1343      x_complete_rec.attribute10             := l_task_group_rec.attribute10;
1344   END IF;
1345   IF p_task_group_rec.attribute11               = FND_API.G_MISS_CHAR  THEN
1346      x_complete_rec.attribute11             := NULL;
1347   END IF;
1348   IF p_task_group_rec.attribute11               IS NULL THEN
1349      x_complete_rec.attribute11             := l_task_group_rec.attribute11;
1350   END IF;
1351   IF p_task_group_rec.attribute12               = FND_API.G_MISS_CHAR  THEN
1352      x_complete_rec.attribute12             := NULL;
1353   END IF;
1354   IF p_task_group_rec.attribute12               IS NULL THEN
1355      x_complete_rec.attribute12             := l_task_group_rec.attribute12;
1356   END IF;
1357   IF p_task_group_rec.attribute13               = FND_API.G_MISS_CHAR  THEN
1358      x_complete_rec.attribute13             := NULL;
1359   END IF;
1360   IF p_task_group_rec.attribute13               IS NULL THEN
1361      x_complete_rec.attribute13             := l_task_group_rec.attribute13;
1362   END IF;
1363   IF p_task_group_rec.attribute14               = FND_API.G_MISS_CHAR  THEN
1364      x_complete_rec.attribute14             := NULL;
1365   END IF;
1366   IF p_task_group_rec.attribute14               IS NULL THEN
1367      x_complete_rec.attribute14             := l_task_group_rec.attribute14;
1368   END IF;
1369   IF p_task_group_rec.attribute15               = FND_API.G_MISS_CHAR  THEN
1370      x_complete_rec.attribute15             := NULL;
1371   END IF;
1372   IF p_task_group_rec.attribute15               IS NULL THEN
1373      x_complete_rec.attribute15             := l_task_group_rec.attribute15;
1374   END IF;
1375   /*
1376   IF p_task_group_rec.reason_type               = FND_API.G_MISS_CHAR  THEN
1377      x_complete_rec.reason_type             := NULL;
1378   END IF;
1379   IF p_task_group_rec.reason_type               IS NULL THEN
1380      x_complete_rec.reason_type             := l_task_group_rec.reason_type;
1381   END IF;
1382   */
1383   IF p_task_group_rec.template_group_name               = FND_API.G_MISS_CHAR  THEN
1384      x_complete_rec.template_group_name             := NULL;
1385   END IF;
1386   IF p_task_group_rec.template_group_name               IS NULL THEN
1387      x_complete_rec.template_group_name             := l_task_group_rec.template_group_name;
1388   END IF;
1389   IF p_task_group_rec.description               = FND_API.G_MISS_CHAR  THEN
1390      x_complete_rec.description             := NULL;
1391   END IF;
1392   IF p_task_group_rec.description               IS NULL THEN
1393      x_complete_rec.description             := l_task_group_rec.description;
1394   END IF;
1395 END Complete_task_group_Rec;
1396 
1397 END OZF_TASK_GROUP_PVT;