1 PACKAGE HZ_RELATIONSHIP_V2PUB AS
2 /*$Header: ARH2RESS.pls 120.10 2007/10/23 09:36:29 rgokavar ship $ */
3 /*#
4 * This package contains the public APIs for party relationships.
5 * @rep:scope public
6 * @rep:product HZ
7 * @rep:displayname Party Relationship
8 * @rep:category BUSINESS_ENTITY HZ_ORGANIZATION
9 * @rep:category BUSINESS_ENTITY HZ_PERSON
10 * @rep:category BUSINESS_ENTITY HZ_PARTY
11 * @rep:category BUSINESS_ENTITY HZ_RELATIONSHIP
12 * @rep:lifecycle active
13 * @rep:doccd 120hztig.pdf Relationship APIs, Oracle Trading Community Architecture Technical Implementation Guide
14 */
15
16 G_MISS_CONTENT_SOURCE_TYPE CONSTANT VARCHAR2(30) := 'USER_ENTERED';
17
18 TYPE relationship_rec_type IS RECORD(
19 relationship_id NUMBER,
20 subject_id NUMBER,
21 subject_type VARCHAR2(30),
22 subject_table_name VARCHAR2(30),
23 object_id NUMBER,
24 object_type VARCHAR2(30),
25 object_table_name VARCHAR2(30),
26 relationship_code VARCHAR2(30),
27 relationship_type VARCHAR2(30),
28 comments VARCHAR2(240),
29 start_date DATE ,
30 end_date DATE,
31 status VARCHAR2(1),
32 content_source_type VARCHAR2(30) := G_MISS_CONTENT_SOURCE_TYPE,
33 attribute_category VARCHAR2(30),
34 attribute1 VARCHAR2(150),
35 attribute2 VARCHAR2(150),
36 attribute3 VARCHAR2(150),
37 attribute4 VARCHAR2(150),
38 attribute5 VARCHAR2(150),
39 attribute6 VARCHAR2(150),
40 attribute7 VARCHAR2(150),
41 attribute8 VARCHAR2(150),
42 attribute9 VARCHAR2(150),
43 attribute10 VARCHAR2(150),
44 attribute11 VARCHAR2(150),
45 attribute12 VARCHAR2(150),
46 attribute13 VARCHAR2(150),
47 attribute14 VARCHAR2(150),
48 attribute15 VARCHAR2(150),
49 attribute16 VARCHAR2(150),
50 attribute17 VARCHAR2(150),
51 attribute18 VARCHAR2(150),
52 attribute19 VARCHAR2(150),
53 attribute20 VARCHAR2(150),
54 created_by_module VARCHAR2(150),
55 application_id NUMBER,
56 party_rec HZ_PARTY_V2PUB.PARTY_REC_TYPE := HZ_PARTY_V2PUB.G_MISS_PARTY_REC,
57 additional_information1 VARCHAR2(150),
58 additional_information2 VARCHAR2(150),
59 additional_information3 VARCHAR2(150),
60 additional_information4 VARCHAR2(150),
61 additional_information5 VARCHAR2(150),
62 additional_information6 VARCHAR2(150),
63 additional_information7 VARCHAR2(150),
64 additional_information8 VARCHAR2(150),
65 additional_information9 VARCHAR2(150),
66 additional_information10 VARCHAR2(150),
67 additional_information11 VARCHAR2(150),
68 additional_information12 VARCHAR2(150),
69 additional_information13 VARCHAR2(150),
70 additional_information14 VARCHAR2(150),
71 additional_information15 VARCHAR2(150),
72 additional_information16 VARCHAR2(150),
73 additional_information17 VARCHAR2(150),
74 additional_information18 VARCHAR2(150),
75 additional_information19 VARCHAR2(150),
76 additional_information20 VARCHAR2(150),
77 additional_information21 VARCHAR2(150),
78 additional_information22 VARCHAR2(150),
79 additional_information23 VARCHAR2(150),
80 additional_information24 VARCHAR2(150),
81 additional_information25 VARCHAR2(150),
82 additional_information26 VARCHAR2(150),
83 additional_information27 VARCHAR2(150),
84 additional_information28 VARCHAR2(150),
85 additional_information29 VARCHAR2(150),
86 additional_information30 VARCHAR2(150),
87 percentage_ownership NUMBER,
88 actual_content_source VARCHAR2(30)
89 );
90
91 G_MISS_REL_REC RELATIONSHIP_REC_TYPE;
92
93 -------------------------------------------------------------------------
94
95 /*#
96 * Use this routine to create a relationship between two parties or entities. This API
97 * creates records in the HZ_RELATIONSHIPS table. The record defines the relationship that
98 * exists between Parties of type PERSON, ORGANIZATION, and other entities that are
99 * defined in the FND_OBJECT_INSTANCE_SETS table.
100 * You can view relationships in either direction, because an additional relationship
101 * record is created to store the reverse relationship. The relationship code,
102 * relationship type, subject and object types must be a valid combination already defined
103 * in the HZ_RELATIONSHIP_TYPES table. The two relationship records have the same
104 * relationship_id, but you can distinguish between them by the directional_flag column.
105 * If you use a hierarchical relationship type (hierarchical_flag = Y) to create a
106 * relationship, then the relationship information is denormalized to the
107 * HZ_HIERARCHY_NODES table with the level, effective date, and so on. The API ensures
108 * that no circular relationship is created, so that all of the relationships using that
109 * relationship type are hierarchical.
110 * @rep:scope public
111 * @rep:lifecycle active
112 * @rep:displayname Create Relationship
113 * @rep:businessevent oracle.apps.ar.hz.Relationship.create
114 * @rep:doccd 120hztig.pdf Relationship APIs, Oracle Trading Community Architecture Technical Implementation Guide
115 */
116 PROCEDURE create_relationship (
117 p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE,
118 p_relationship_rec IN RELATIONSHIP_REC_TYPE,
119 x_relationship_id OUT NOCOPY NUMBER,
120 x_party_id OUT NOCOPY NUMBER,
121 x_party_number OUT NOCOPY VARCHAR2,
122 x_return_status OUT NOCOPY VARCHAR2,
123 x_msg_count OUT NOCOPY NUMBER,
124 x_msg_data OUT NOCOPY VARCHAR2,
125 p_create_org_contact IN VARCHAR2
126 );
127
128 -- bug 3801870. Overloaded the procedure create_relationship to
129 -- support backward compatibility.
130 -- Bug 6521493 Annotation added
131 /*#
132 * Use this routine to create a relationship between two parties or entities. This API
133 * creates records in the HZ_RELATIONSHIPS table. The record defines the relationship that
134 * exists between Parties of type PERSON, ORGANIZATION, and other entities that are
135 * defined in the FND_OBJECT_INSTANCE_SETS table.
136 * You can view relationships in either direction, because an additional relationship
137 * record is created to store the reverse relationship. The relationship code,
138 * relationship type, subject and object types must be a valid combination already defined
139 * in the HZ_RELATIONSHIP_TYPES table. The two relationship records have the same
140 * relationship_id, but you can distinguish between them by the directional_flag column.
141 * If you use a hierarchical relationship type (hierarchical_flag = Y) to create a
142 * relationship, then the relationship information is denormalized to the
143 * HZ_HIERARCHY_NODES table with the level, effective date, and so on. The API ensures
144 * that no circular relationship is created, so that all of the relationships using that
145 * relationship type are hierarchical. This signature of API internally calls
146 * overloaded API signature with p_create_org_contact parameter value as 'Y'.
147 * @rep:scope public
148 * @rep:lifecycle active
149 * @rep:displayname Create Relationship
150 * @rep:businessevent oracle.apps.ar.hz.Relationship.create
151 * @rep:doccd 115hztig.pdf Relationship APIs, Oracle Trading Community Architecture Technical Implementation Guide
152 */
153 PROCEDURE create_relationship (
154 p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE,
155 p_relationship_rec IN RELATIONSHIP_REC_TYPE,
156 x_relationship_id OUT NOCOPY NUMBER,
157 x_party_id OUT NOCOPY NUMBER,
158 x_party_number OUT NOCOPY VARCHAR2,
159 x_return_status OUT NOCOPY VARCHAR2,
160 x_msg_count OUT NOCOPY NUMBER,
161 x_msg_data OUT NOCOPY VARCHAR2
162 );
163
164
165 /**
166 * PROCEDURE create_relationship_with_usg
167 *
168 * DESCRIPTION
169 * Creates relationship with party usages.
170 *
171 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
172 *
173 * ARGUMENTS
174 * IN:
175 * p_init_msg_list Initialize message stack if it is set to
176 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
177 * p_relationship_rec Relationship record.
178 * p_contact_party_id Contact party Id.
179 * p_contact_party_usage_code Contact party usage code.
180 * p_create_org_contact Decide if we need to create org contact or not.
181 * IN/OUT:
182 * OUT:
183 * x_relationship_id Relationship ID.
184 * x_party_id Relationship party Id.
185 * x_party_number Party number.
186 * x_return_status Return status after the call. The status can
187 * be FND_API.G_RET_STS_SUCCESS (success),
188 * FND_API.G_RET_STS_ERROR (error),
189 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
190 * x_msg_count Number of messages in message stack.
191 * x_msg_data Message text if x_msg_count is 1.
192 *
193 * NOTES
194 *
195 * MODIFICATION HISTORY
196 *
197 * 05-15-2005 Jianying Huang o Created.
198 *
199 */
200
201 PROCEDURE create_relationship_with_usg (
202 p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE,
203 p_relationship_rec IN RELATIONSHIP_REC_TYPE,
204 p_contact_party_id IN NUMBER,
205 p_contact_party_usage_code IN VARCHAR2,
206 p_create_org_contact IN VARCHAR2 DEFAULT NULL,
207 x_relationship_id OUT NOCOPY NUMBER,
208 x_party_id OUT NOCOPY NUMBER,
209 x_party_number OUT NOCOPY VARCHAR2,
210 x_return_status OUT NOCOPY VARCHAR2,
211 x_msg_count OUT NOCOPY NUMBER,
212 x_msg_data OUT NOCOPY VARCHAR2
213 );
214
215
216 /*#
217 * Use this routine to update a relationship. Because there are forward and backward
218 * records for each relationship, the API updates two records in the HZ_RELATIONSHIPS
219 * table. You can also update the denormalized party record for the relationship (if it is
220 * present) by passing the party's id and object version number.
221 * @rep:scope public
222 * @rep:lifecycle active
223 * @rep:displayname Update Relationship
224 * @rep:businessevent oracle.apps.ar.hz.Relationship.update
225 * @rep:doccd 120hztig.pdf Relationship APIs, Oracle Trading Community Architecture Technical Implementation Guide
226 */
227 PROCEDURE update_relationship (
228 p_init_msg_list IN VARCHAR2:= FND_API.G_FALSE,
229 p_relationship_rec IN RELATIONSHIP_REC_TYPE,
230 p_object_version_number IN OUT NOCOPY NUMBER,
231 p_party_object_version_number IN OUT NOCOPY NUMBER,
232 x_return_status OUT NOCOPY VARCHAR2,
233 x_msg_count OUT NOCOPY NUMBER,
234 x_msg_data OUT NOCOPY VARCHAR2
235 );
236
237 PROCEDURE get_relationship_rec (
238 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
239 p_relationship_id IN NUMBER,
240 p_directional_flag IN VARCHAR2 := 'F',
241 x_rel_rec OUT NOCOPY RELATIONSHIP_REC_TYPE,
242 x_return_status OUT NOCOPY VARCHAR2,
243 x_msg_count OUT NOCOPY NUMBER,
244 x_msg_data OUT NOCOPY VARCHAR2
245 );
246
247 END HZ_RELATIONSHIP_V2PUB;