Subversion Repositories DevTools

Rev

Rev 149 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%
'=====================================================
'    Common Subs for DAEMON INSTRUCTIONS
'
' NB. Must be included AFTER conf.asp
'=====================================================
%>
<%
'--------------------------------------------------------------------------------------------
' Indicates if the specified daemon instruction is in progress
'--------------------------------------------------------------------------------------------
Function DaemonInstructionInProgress( nInstId )
   Dim rsQry

   DaemonInstructionInProgress = False

   If NOT IsNull(nInstId) AND nInstId <> "" Then

      Set rsQry = OraDatabase.DbCreateDynaset( "SELECT IN_PROGRESS"&_
                                               "  FROM DAEMON_INSTRUCTIONS "&_
                                               " WHERE DAEMON_INSTRUCTIONS_ID = "& nInstId, ORADYN_DEFAULT )
      If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then

         If (NOT IsNull(rsQry("IN_PROGRESS"))) AND (rsQry("IN_PROGRESS") = "1") Then
            DaemonInstructionInProgress = True
         End If
      End If

      rsQry.Close
      Set rsQry = nothing
   End If
End Function
'--------------------------------------------------------------------------------------------
' Convert a Daemon Instruction operation code into a meaningful string
'--------------------------------------------------------------------------------------------
Function DaemonInstructionOperationName(nOpCode)
   Select Case nOpCode
   Case OP_CODE_0_RIPPLE_BUILD_PACKAGE
      DaemonInstructionOperationName = OP_CODE_0_STR

   'Case OP_CODE_1_GET_RELEASE_METRICS
   '   DaemonInstructionOperationName = OP_CODE_1_STR

   Case Else
      DaemonInstructionOperationName = "Undefined (" & nOpCode & ")"
   End Select
End Function
'--------------------------------------------------------------------------------------------
' Convert a Repeat Seconds value into a meaningful string. This takes account of the
' daemon instruction op-code too - a repeat seconds value is only relevant for certain
' op-codes
'--------------------------------------------------------------------------------------------
Function DaemonInstructionRepeatString(nOpCode, nRepeatSecs)
   DaemonInstructionRepeatString = "N/A"

   ' uncomment this when we are ready to introduce the "get release metrics" instruction
   'Select Case nOpCode
   'Case OP_CODE_1_GET_RELEASE_METRICS
   '   Select Case nRepeatSecs
   '   Case 86400
   '      DaemonInstructionRepeatString = "24Hrs"
   '   Case Else
   '      DaemonInstructionRepeatString = "NO"
   '   End Select
   '
   'Case Else
   '   DaemonInstructionRepeatString = "N/A"
   'End Select

End Function
'--------------------------------------------------------------------------------------------
' Queries the database to get a comma-seperated list of op-codes for a given release, and
' converts them into a comma seperated list of operation names for display purposes
'--------------------------------------------------------------------------------------------
Function GetOpCodeListForRtagId( pretext, nRtag_id, posttext )
   Dim opCodeListString
   Dim opCodeList
   Dim opCodeStr
   GetOpCodeListForRtagId = ""

   On Error Resume Next

   objEH.TryORA ( OraSession )

   OraDatabase.Parameters.Add "OP_CODE_LIST", NULL, ORAPARM_OUTPUT, ORATYPE_VARCHAR2

   OraDatabase.ExecuteSQL _
   "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag("& nRtag_id & "); END;"

   objEH.CatchORA ( OraSession )

   opCodeListString  = OraDatabase.Parameters("OP_CODE_LIST").Value

   OraDatabase.Parameters.Remove "OP_CODE_LIST"

   If NOT IsNull(opCodeListString) AND opCodeListString <> "" Then
      opCodeList = Split(opCodeListString, ",")
      For Each opCodeStr In opCodeList
         If NOT IsNull(opCodeStr) AND opCodeStr <> "" Then
            GetOpCodeListForRtagId = GetOpCodeListForRtagId + DaemonInstructionOperationName(opCodeStr)
         End If
      Next
   End If

   If GetOpCodeListForRtagId <> "" Then
      GetOpCodeListForRtagId = pretext & GetOpCodeListForRtagId + posttext
   End If
End Function
'--------------------------------------------------------------------------------------------
' Queries the database to get a comma-seperated list of op-codes for a given release and package
' version, and converts them into a comma seperated list of operation names for display purposes
'--------------------------------------------------------------------------------------------
Function GetOpCodeListForRtagIdAndPvId( pretext, nRtag_id, nPv_id, posttext )
   Dim opCodeListString
   Dim opCodeList
   Dim opCodeStr

   GetOpCodeListForRtagIdAndPvId = ""

   On Error Resume Next

   If (NOT IsNull(nRtag_id)) AND nRtag_id <> "" Then

      objEH.TryORA ( OraSession )

      OraDatabase.Parameters.Add "OP_CODE_LIST", NULL, ORAPARM_OUTPUT, ORATYPE_VARCHAR2

      If (NOT IsNull(nPv_id)) AND nPv_id <> "" Then
         OraDatabase.ExecuteSQL _
         "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag_pvid("& nRtag_id & "," & nPv_id & "); END;"
      Else
         OraDatabase.ExecuteSQL _
         "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag("& nRtag_id & "); END;"
      End If

      objEH.CatchORA ( OraSession )

      opCodeListString  = OraDatabase.Parameters("OP_CODE_LIST").Value

      OraDatabase.Parameters.Remove "OP_CODE_LIST"

      If NOT IsNull(opCodeListString) AND opCodeListString <> "" Then
         opCodeList = Split(opCodeListString, ",")
         For Each opCodeStr In opCodeList
            If NOT IsNull(opCodeStr) AND opCodeStr <> "" Then
               GetOpCodeListForRtagIdAndPvId = GetOpCodeListForRtagIdAndPvId + DaemonInstructionOperationName(opCodeStr)
            End If
         Next
      End If

   End If

   If GetOpCodeListForRtagIdAndPvId <> "" Then
      GetOpCodeListForRtagIdAndPvId = pretext & GetOpCodeListForRtagIdAndPvId + posttext
   End If
End Function
'--------------------------------------------------------------------------------------------
' Function to inform caller of whether the user is allowed to reset the daemon instructions
' in-progress flag
'--------------------------------------------------------------------------------------------
Function UserAllowedToResetInProgress
   UserAllowedToResetInProgress = True
   If objAccessControl.UserLogedIn Then
      If NOT objAccessControl.IsActive("ResetDaemonInstInProgress") Then
         UserAllowedToResetInProgress = False
      End If
   Else
      UserAllowedToResetInProgress = False
   End If
End Function



%>