| 119 |
ghuddy |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
|
|
4 |
' Import Dependency
|
|
|
5 |
' --- PROCESS FORM ---
|
|
|
6 |
'=====================================================
|
|
|
7 |
%>
|
|
|
8 |
<%
|
|
|
9 |
Option explicit
|
|
|
10 |
' Good idea to set when using redirect
|
|
|
11 |
Response.Expires = 0 ' always load the page, dont store
|
|
|
12 |
%>
|
|
|
13 |
|
|
|
14 |
<!--#include file="common/conf.asp"-->
|
|
|
15 |
<!--#include file="common/globals.asp"-->
|
|
|
16 |
<!--#include file="common/formating.asp"-->
|
|
|
17 |
<!--#include file="common/qstr.asp"-->
|
|
|
18 |
<!--#include file="common/common_subs.asp"-->
|
|
|
19 |
<!--#include file="common/common_dbedit.asp"-->
|
|
|
20 |
<%
|
|
|
21 |
' Set rfile parameter. This is a return page after Login
|
|
|
22 |
Call objPMod.StoreParameter ( "rfile", "dependencies.asp" )
|
|
|
23 |
'------------ ACCESS CONTROL ------------------
|
|
|
24 |
%>
|
|
|
25 |
<!--#include file="_access_control_login.asp"-->
|
|
|
26 |
<!--#include file="_access_control_general.asp"-->
|
|
|
27 |
<!--#include file="_access_control_project.asp"-->
|
|
|
28 |
<%
|
|
|
29 |
'------------ Variable Definition -------------
|
| 4301 |
dpurdie |
30 |
Dim parFromPv_id
|
| 119 |
ghuddy |
31 |
Dim parToRtag_id
|
|
|
32 |
'------------ Constants Declaration -----------
|
|
|
33 |
'------------ Variable Init -------------------
|
| 4301 |
dpurdie |
34 |
parFromPv_id = QStrPar("FromPv_id")
|
|
|
35 |
parToRtag_id = QStrPar("rtag_id")
|
| 119 |
ghuddy |
36 |
'----------------------------------------------
|
|
|
37 |
%>
|
|
|
38 |
<%
|
| 4301 |
dpurdie |
39 |
Function Import_Dependency ( NNFromPv_id, NNToRtag_id )
|
|
|
40 |
Dim sqlStr, PvId, ii
|
|
|
41 |
Dim ImportList, entry, keys
|
|
|
42 |
Set ImportList = CreateObject ("Scripting.Dictionary")
|
|
|
43 |
|
|
|
44 |
'
|
|
|
45 |
' Generate a list of packages to be added
|
|
|
46 |
' The union will add the base package to the set - if its not present
|
|
|
47 |
'
|
|
|
48 |
sqlStr = "SELECT DISTINCT qry.DPV_ID"&_
|
| 119 |
ghuddy |
49 |
" FROM ("&_
|
| 4301 |
dpurdie |
50 |
" SELECT dep.PV_ID, dep.DPV_ID, LEVEL AS LEVEL_NUM"&_
|
| 119 |
ghuddy |
51 |
" FROM PACKAGE_DEPENDENCIES dep"&_
|
|
|
52 |
" START WITH dep.PV_ID IN ( :PV_ID ) "&_
|
|
|
53 |
" CONNECT BY PRIOR dep.DPV_ID = dep.PV_ID"&_
|
| 4301 |
dpurdie |
54 |
" UNION" &_
|
|
|
55 |
" SELECT" &_
|
|
|
56 |
" TO_NUMBER(:PV_ID), TO_NUMBER(:PV_ID), TO_NUMBER(0) " &_
|
|
|
57 |
" FROM DUAL" &_
|
| 119 |
ghuddy |
58 |
" ) qry,"&_
|
|
|
59 |
" PACKAGES pkg,"&_
|
|
|
60 |
" PACKAGE_VERSIONS pv"&_
|
|
|
61 |
" WHERE qry.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID"&_
|
|
|
62 |
" and qry.dpv_id NOT IN (select pv_id from release_content where rtag_id = :RTAG_ID)"
|
|
|
63 |
|
| 4301 |
dpurdie |
64 |
On Error Resume Next
|
|
|
65 |
objEH.ErrorRedirect = TRUE
|
|
|
66 |
objEH.TryORA ( OraSession )
|
| 119 |
ghuddy |
67 |
|
| 4301 |
dpurdie |
68 |
OraDatabase.Parameters.Add "PV_ID", NNFromPv_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
69 |
OraDatabase.Parameters.Add "RTAG_ID", NNToRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
70 |
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
71 |
OraDatabase.Parameters.Add "OPERATION","A", ORAPARM_INPUT, ORATYPE_CHAR
|
| 119 |
ghuddy |
72 |
|
| 4301 |
dpurdie |
73 |
Dim rsTemp
|
|
|
74 |
Set rsTemp = OraDatabase.DbCreateDynaset( sqlStr, cint(0))
|
|
|
75 |
If Err.Number = 0 Then
|
|
|
76 |
While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
|
|
|
77 |
entry = rsTemp("DPV_ID")
|
|
|
78 |
If NOT ImportList.Exists(entry) Then
|
|
|
79 |
ImportList.add entry, 1
|
|
|
80 |
End If
|
|
|
81 |
rsTemp.MoveNext
|
|
|
82 |
WEnd
|
|
|
83 |
End If
|
|
|
84 |
rsTemp.Close
|
|
|
85 |
Set rsTemp = nothing
|
| 119 |
ghuddy |
86 |
|
| 4301 |
dpurdie |
87 |
'
|
|
|
88 |
' Add each entry into the 'Pending Tab'
|
|
|
89 |
'
|
|
|
90 |
keys = ImportList.Keys
|
|
|
91 |
For ii = 0 to ImportList.Count - 1
|
|
|
92 |
entry = keys(ii)
|
|
|
93 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
94 |
OraDatabase.Parameters.Add "PV_ID", entry, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
95 |
If Err.Number = 0 Then
|
|
|
96 |
OraDatabase.ExecuteSQL _
|
|
|
97 |
"BEGIN "&_
|
|
|
98 |
" PK_PLANNED.MERGE_PACKAGE ( :PV_ID, 7, :RTAG_ID, :USER_ID, :OPERATION ); "&_
|
|
|
99 |
"END;"
|
|
|
100 |
End If
|
|
|
101 |
Next
|
|
|
102 |
|
| 119 |
ghuddy |
103 |
objEH.CatchORA ( OraSession )
|
|
|
104 |
|
|
|
105 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
106 |
OraDatabase.Parameters.Remove "RTAG_ID"
|
|
|
107 |
OraDatabase.Parameters.Remove "USER_ID"
|
| 4301 |
dpurdie |
108 |
OraDatabase.Parameters.Remove "OPERATION"
|
|
|
109 |
|
|
|
110 |
Set ImportList = nothing
|
|
|
111 |
|
| 119 |
ghuddy |
112 |
End Function
|
|
|
113 |
|
|
|
114 |
%>
|
|
|
115 |
<%
|
|
|
116 |
'----------------------- MAIN LINE ---------------------------
|
| 4301 |
dpurdie |
117 |
|
| 119 |
ghuddy |
118 |
'--- Process submition ---
|
| 4301 |
dpurdie |
119 |
If (parFromPv_id <> "") AND (parToRtag_id <> "") Then
|
| 1376 |
dpurdie |
120 |
' All mandatory parameters FOUND
|
| 119 |
ghuddy |
121 |
|
|
|
122 |
'COMPLETE THE REQUEST...
|
| 4301 |
dpurdie |
123 |
Call Import_Dependency ( parFromPv_id, parToRtag_id )
|
| 119 |
ghuddy |
124 |
|
|
|
125 |
If objEH.Finally Then
|
|
|
126 |
Response.Redirect("dependencies.asp?rtag_id="& parToRtag_id )
|
|
|
127 |
End If
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Else
|
| 1376 |
dpurdie |
131 |
Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
|
| 4955 |
dpurdie |
132 |
Response.write QSTR_FullQuery
|
| 119 |
ghuddy |
133 |
End If
|
|
|
134 |
%>
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
<!-- DESTRUCTOR ------->
|
|
|
138 |
<!--#include file="common/destructor.asp"-->
|