Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
147 ghuddy 1
<%
2
'=====================================================
3
'    Common Subs for DAEMON INSTRUCTIONS
4
'
5
' NB. Must be included AFTER conf.asp
6
'=====================================================
7
%>
8
<%
9
'--------------------------------------------------------------------------------------------
10
' Indicates if the specified daemon instruction is in progress
11
'--------------------------------------------------------------------------------------------
12
Function DaemonInstructionInProgress( nInstId )
13
   Dim rsQry
14
 
15
   DaemonInstructionInProgress = False
16
 
17
   If NOT IsNull(nInstId) AND nInstId <> "" Then
18
 
19
      Set rsQry = OraDatabase.DbCreateDynaset( "SELECT IN_PROGRESS"&_
20
                                               "  FROM DAEMON_INSTRUCTIONS "&_
21
                                               " WHERE DAEMON_INSTRUCTIONS_ID = "& nInstId, ORADYN_DEFAULT )
22
      If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
23
 
24
         If (NOT IsNull(rsQry("IN_PROGRESS"))) AND (rsQry("IN_PROGRESS") = "1") Then
25
            DaemonInstructionInProgress = True
26
         End If
27
      End If
28
 
29
      rsQry.Close
30
      Set rsQry = nothing
31
   End If
32
End Function
33
'--------------------------------------------------------------------------------------------
34
' Convert a Daemon Instruction operation code into a meaningful string
35
'--------------------------------------------------------------------------------------------
36
Function DaemonInstructionOperationName(nOpCode)
37
   Select Case nOpCode
38
   Case OP_CODE_0_RIPPLE_BUILD_PACKAGE
39
      DaemonInstructionOperationName = OP_CODE_0_STR
40
 
41
   'Case OP_CODE_1_GET_RELEASE_METRICS
42
   '   DaemonInstructionOperationName = OP_CODE_1_STR
43
 
44
   Case Else
45
      DaemonInstructionOperationName = "Undefined (" & nOpCode & ")"
46
   End Select
47
End Function
48
'--------------------------------------------------------------------------------------------
49
' Convert a Repeat Seconds value into a meaningful string. This takes account of the
50
' daemon instruction op-code too - a repeat seconds value is only relevant for certain
51
' op-codes
52
'--------------------------------------------------------------------------------------------
53
Function DaemonInstructionRepeatString(nOpCode, nRepeatSecs)
54
   DaemonInstructionRepeatString = "N/A"
55
 
56
   ' uncomment this when we are ready to introduce the "get release metrics" instruction
57
   'Select Case nOpCode
58
   'Case OP_CODE_1_GET_RELEASE_METRICS
59
   '   Select Case nRepeatSecs
60
   '   Case 86400
61
   '      DaemonInstructionRepeatString = "24Hrs"
62
   '   Case Else
63
   '      DaemonInstructionRepeatString = "NO"
64
   '   End Select
65
   '
66
   'Case Else
67
   '   DaemonInstructionRepeatString = "N/A"
68
   'End Select
69
 
70
End Function
71
'--------------------------------------------------------------------------------------------
72
' Queries the database to get a comma-seperated list of op-codes for a given release, and
73
' converts them into a comma seperated list of operation names for display purposes
74
'--------------------------------------------------------------------------------------------
75
Function GetOpCodeListForRtagId( pretext, nRtag_id, posttext )
76
   Dim opCodeListString
77
   Dim opCodeList
78
   Dim opCodeStr
79
   GetOpCodeListForRtagId = ""
80
 
81
   On Error Resume Next
82
 
83
   objEH.TryORA ( OraSession )
84
 
85
   OraDatabase.Parameters.Add "OP_CODE_LIST", NULL, ORAPARM_OUTPUT, ORATYPE_VARCHAR2
86
 
87
   OraDatabase.ExecuteSQL _
88
   "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag("& nRtag_id & "); END;"
89
 
90
   objEH.CatchORA ( OraSession )
91
 
92
   opCodeListString  = OraDatabase.Parameters("OP_CODE_LIST").Value
93
 
94
   OraDatabase.Parameters.Remove "OP_CODE_LIST"
95
 
96
   If NOT IsNull(opCodeListString) AND opCodeListString <> "" Then
97
      opCodeList = Split(opCodeListString, ",")
98
      For Each opCodeStr In opCodeList
99
         If NOT IsNull(opCodeStr) AND opCodeStr <> "" Then
100
            GetOpCodeListForRtagId = GetOpCodeListForRtagId + DaemonInstructionOperationName(opCodeStr)
101
         End If
102
      Next
103
   End If
104
 
105
   If GetOpCodeListForRtagId <> "" Then
106
      GetOpCodeListForRtagId = pretext & GetOpCodeListForRtagId + posttext
107
   End If
108
End Function
109
'--------------------------------------------------------------------------------------------
110
' Queries the database to get a comma-seperated list of op-codes for a given release and package
111
' version, and converts them into a comma seperated list of operation names for display purposes
112
'--------------------------------------------------------------------------------------------
113
Function GetOpCodeListForRtagIdAndPvId( pretext, nRtag_id, nPv_id, posttext )
114
   Dim opCodeListString
115
   Dim opCodeList
116
   Dim opCodeStr
117
 
118
   GetOpCodeListForRtagIdAndPvId = ""
119
 
120
   On Error Resume Next
121
 
122
   If (NOT IsNull(nRtag_id)) AND nRtag_id <> "" Then
123
 
124
      objEH.TryORA ( OraSession )
125
 
126
      OraDatabase.Parameters.Add "OP_CODE_LIST", NULL, ORAPARM_OUTPUT, ORATYPE_VARCHAR2
127
 
128
      If (NOT IsNull(nPv_id)) AND nPv_id <> "" Then
129
         OraDatabase.ExecuteSQL _
130
         "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag_pvid("& nRtag_id & "," & nPv_id & "); END;"
131
      Else
132
         OraDatabase.ExecuteSQL _
133
         "BEGIN :OP_CODE_LIST := PK_BUILDAPI.daemon_ops_for_rtag("& nRtag_id & "); END;"
134
      End If
135
 
136
      objEH.CatchORA ( OraSession )
137
 
138
      opCodeListString  = OraDatabase.Parameters("OP_CODE_LIST").Value
139
 
140
      OraDatabase.Parameters.Remove "OP_CODE_LIST"
141
 
142
      If NOT IsNull(opCodeListString) AND opCodeListString <> "" Then
143
         opCodeList = Split(opCodeListString, ",")
144
         For Each opCodeStr In opCodeList
145
            If NOT IsNull(opCodeStr) AND opCodeStr <> "" Then
146
               GetOpCodeListForRtagIdAndPvId = GetOpCodeListForRtagIdAndPvId + DaemonInstructionOperationName(opCodeStr)
147
            End If
148
         Next
149
      End If
150
 
151
   End If
152
 
153
   If GetOpCodeListForRtagIdAndPvId <> "" Then
154
      GetOpCodeListForRtagIdAndPvId = pretext & GetOpCodeListForRtagIdAndPvId + posttext
155
   End If
156
End Function
157
'--------------------------------------------------------------------------------------------
158
' Function to inform caller of whether the user is allowed to reset the daemon instructions
159
' in-progress flag
160
'--------------------------------------------------------------------------------------------
161
Function UserAllowedToResetInProgress
162
   UserAllowedToResetInProgress = True
163
   If objAccessControl.UserLogedIn Then
164
      If NOT objAccessControl.IsActive("ResetDaemonInstInProgress") Then
165
         UserAllowedToResetInProgress = False
166
      End If
167
   Else
168
      UserAllowedToResetInProgress = False
169
   End If
170
End Function
171
 
172
 
173
 
174
%>