%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
' _destroy_package.asp
' Intended to be invoked within an Iframe
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<%
'------------ ACCESS CONTROL ------------------
%>
<%
'------------ VARIABLE DEFINITION -------------
Dim sMessage, sMessageType
Dim parPvId
Dim rsQry, rsView
Dim Qstring
Dim pName, pVersion
Dim illAdvised, canDoBad
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL
sMessageType = 3
parPvId = Request("pv_id")
canDoBad = canShowControlInProject ("DestroyPackage")
illAdvised = FALSE
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------------------------
'
' Add a line of text to the System Message
' eLevel - 1 == Critical, 2==Warning, 3==Note
Sub sMessageAdd(eLevel, text)
If NOT isNull(sMessage) Then
sMessage = sMessage & " "
End If
sMessage = sMessage & text
If eLevel < sMessageType Then
sMessageType = eLevel
End If
End Sub
Sub DestroyPackage ( nPvId, cOverrideWarnings, outSet )
OraDatabase.Parameters.Add "PV_ID", nPvId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "RTAG_ID", parRtag_Id, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "OVERRIDE_WARNINGS", cOverrideWarnings, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "RESULTS", NULL, ORAPARM_OUTPUT, ORATYPE_CURSOR
objEH.ErrorRedirect = FALSE
objEH.TryORA ( OraSession )
On Error Resume Next
OraDatabase.ExecuteSQL _
"BEGIN "&_
" PK_PACKAGE.destroy_package_extended (:PV_ID, :RTAG_ID, :OVERRIDE_WARNINGS, :RESULTS ); "&_
"END; "
objEH.CatchORA ( OraSession )
' NULL RESULTS list indicates that the operation did not generate any errors
outSet = nothing
If NOT isNull(OraDatabase.Parameters("RESULTS").Value) Then
Set outSet = OraDatabase.Parameters("RESULTS").Value
End If
OraDatabase.Parameters.Remove "PV_ID"
OraDatabase.Parameters.Remove "RTAG_ID"
OraDatabase.Parameters.Remove "OVERRIDE_WARNINGS"
OraDatabase.Parameters.Remove "RESULTS"
End Sub
Function getRecordCount( obj )
getRecordCount = 0
If NOT isNull(obj) Then
If isObject(obj) Then
getRecordCount = obj.RecordCount
End If
End If
End Function
'------------ RUN BEFORE PAGE RENDER ----------
' Setup persistance object
Call objPMod.StoreParameter ( "bfile", Request("bfile") )
Call objPMod.StoreParameter ( "rfile", Request("rfile") )
Call objPMod.StoreParameter ( "rtag_id", Request("rtag_id") )
Call objPMod.StoreParameter ( "pv_id", Request("pv_id") )
Call objPMod.StoreParameter ( "pkg_id", Request("pkg_id") )
Call objPMod.StoreParameter ( "OLDpv_id", Request("OLDpv_id") )
Call objPMod.StoreParameter ( "FLuser_name", Request("FLuser_name") )
Call objPMod.StoreParameter ( "FLpkg_version", Request("FLpkg_version") )
Call objPMod.StoreParameter ( "listby", Request("listby") )
Call objPMod.StoreParameter ( "index", Request("index") )
' Basic sanity checks
'
If objAccessControl.UserId = "" Then
sMessageAdd 1, "No longer logged in"
End If
If parPvId = "" Then
sMessageAdd 1, "Internal: PVID not provided"
End If
If CBool(Request("action")) AND isNULL(sMessage) Then
'
' Attempt to destroy the package
DestroyPackage parPvId, RequestDefault("destroy", 1), rsView
If getRecordCount(rsView) = 0 Then
If Request("bfile") <> "" Then
OpenInParentWindow(objPMod.GetParamValue("bfile") &"?DESTROYED=OK"& objPMod.ComposeURLWithout("bfile,pv_id"))
Else
ReloadParentWindow()
End If
Call Destroy_All_Objects
Response.End
End If
Else
'
' Show the current set of reasons for NOT destroying the package
DestroyPackage parPvId, 0, rsView
End If
' Need to generate a display
' Get the Package Version information
'
Qstring = "SELECT p.pkg_name, pv.pkg_version" &_
" FROM packages p, package_versions pv" &_
" WHERE p.pkg_id = pv.pkg_id" &_
" AND pv.pv_id = " & parPvId
Set rsQry = OraDatabase.DbCreateDynaset( Qstring, cint(0))
If rsQry.RecordCount = 0 Then
sMessageAdd 1, "Package Version no longer exists"
End If
pName = rsQry("pkg_name")
pVersion = rsQry("pkg_version")
rsQry.Close
Set rsQry = nothing
'----------------------------------------------
%>
Release Manager
<%=enum_IMG_Critical%>You are about to destroy <%=pName%> <%=pVersion%>. You cannot undo this operation.
<%Call Messenger ( sMessage , sMessageType, "100%" )%>
<%If IsObject(rsView) Then %>
<%If rsView.RecordCount > 0 Then %>
This package is in use
<%
Do Until ((rsView.BOF) OR (rsView.EOF))
Dim mtype
mtype = rsView("mtype")
Response.Write "
"
If mtype <> "A" Then
Response.Write enum_imgCritical
illAdvised = TRUE
End If
Response.Write "
" & rsView("MSG") & "
"
Response.Write "
"
rsView.MoveNext
Loop
%>
<%ElseIf isNULL(sMessage) Then%>
There is no reasons that this package cannot be destroyed.
<%End If%>
<%End If%>
<%If illAdvised Then %>
<%If canDoBad Then %>
Destroy this version, even though it will affect other packages and releases. The package will be removed from:
All packages that depend on this version
All SDKs that use this version
All SBOMS that use this version
This is strongly discouraged.
<%Else%>
You do not have permission to destroy this package. The side effects of destroying
this package are wide ranging.
<%End If%>
<%End If%>
<%If isNULL(sMessage) Then%>
<%End If%>
<%=objPMod.ComposeHiddenTags()%>
<%
Call objFormComponent.FormEnd()
'-- FROM END ----------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
On Error Resume Next
rsView.Close
Set rsView = nothing
Call Destroy_All_Objects
%>