Option Explicit '===================================================== ' Name: style_b_generator.vbs ' Description: Creates a release notes in TEMPLATE B format. '===================================================== Sub Generate_Notes_Style_B ( NNpv_id, outNotes, SSrtag_name, NNproj_id ) Dim snippetSTR, insertFrom, insterSTR, tempSTR, headerSnippet, columnSnippet, listSnippet, snippetDEVI, snippetTDSE Dim Query_String, rsQry, CQSQL, rsCQ, depIssDICT, depIssARR(), releaseInfo, newReleaseInfo Const SYD_PROJID = 142'This is a temp for the BETA release of the functionality '----------------------------------------------------------- Set rsCQ = CreateObject("ADODB.Recordset") Set depIssDICT = CreateObject("Scripting.Dictionary") '----------------------------------------------------------- WScript.Echo "Generating notes using Template Style B." outNotes = ReadFile( AppPath & RELEASE_NOTES_TEMPLATE_B ) ' --- Title --- Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_official_details.sql" ) OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Title", outNotes, snippetSTR, insertFrom ) If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then insterSTR = Replace( snippetSTR, "$PKG_TITLE$", rsQry("pkg_name") &" "& rsQry("pkg_version")) End If Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) '--- DEVI-037294 Requirement: Insert : -------------- newReleaseInfo = SSrtag_name + ": " + rsQry("pkg_name") + " " + rsQry("pkg_version") ' --- Identification --- Call Get_Snippet ( "Identification", outNotes, snippetSTR, insertFrom ) If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then insterSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") ) insterSTR = Replace( insterSTR, "$PKG_VERSION$", rsQry("pkg_version") ) insterSTR = Replace( insterSTR, "$LABEL$", NVL( rsQry("pkg_label") ) ) insterSTR = Replace( insterSTR, "$SOURCE_PATH$", NVL( rsQry("src_path") ) ) insterSTR = Replace( insterSTR, "$RELEASE_DATE$", ( EuroDate ( rsQry("modified_stamp") ) ) ) insterSTR = Replace( insterSTR, "$RELEASOR_EMAIL$", rsQry("modifier_email") ) insterSTR = Replace( insterSTR, "$RELEASOR$", rsQry("modifier") ) End If Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Package Information --- Call Get_Snippet ( "Package_Information", outNotes, snippetSTR, insertFrom ) If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then If IsNull(rsQry("short_desc")) Then insterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", "Not supplied!" ) Else insterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("short_desc") ) ) ) End If If IsNull(rsQry("long_desc")) Then insterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", "Not supplied!" ) Else insterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("long_desc") ) ) ) End If End If Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Reason for This Version --- Dim resonForRelease resonForRelease = rsQry("reason") Call Get_Snippet ( "Reason_For_This_Version:Header", outNotes, headerSnippet, insertFrom ) Call Get_Snippet ( "Reason_For_This_Version:Columns", outNotes, columnSnippet, insertFrom ) Call Get_Snippet ( "Issues:List:DEVI", outNotes, snippetDEVI, insertFrom ) Call Get_Snippet ( "Issues:List:TDSE", outNotes, snippetTDSE, insertFrom ) Call Get_Snippet ( "Reason_For_This_Version:List", outNotes, listSnippet, insertFrom ) Call Get_ORA_Package_Issues ( "Fixed_Issues", CQSQL ) Call Get_CQ_Issues ( CQSQL, rsCQ ) ' Header If rsCQ.BOF OR rsCQ.EOF Then If IsNull( resonForRelease ) Then tempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", "See ""Issues"" section below." ) Else tempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", FormatTextBox( resonForRelease ) & "
" & "Also see ""Issues"" section below." ) End If Else If NOT IsNull( resonForRelease ) Then tempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", FormatTextBox( resonForRelease ) ) End If ' Columns tempSTR = tempSTR & columnSnippet End If While ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF)) 'If CInt(NNproj_id) = CInt(SYD_PROJID) Then 'Extract Release Info If Exists releaseInfo = rsCQ("releaseinfo") Call EditReleaseInfoDetails ( rsCQ("iss_db"), rsCQ("iss_id"), newReleaseInfo, releaseInfo ) 'End If ' Add Row If CInt(rsCQ("iss_db")) = enumCLEARQUEST_DEVI_ID Then tempSTR = tempSTR & Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" ) Else tempSTR = tempSTR & Replace( snippetTDSE, "$ISSUE_DATABASE$", "UNKNWOWN" ) End If tempSTR = Replace( tempSTR, "$TAG_ID$", rsCQ("iss_db") &"_"& rsCQ("iss_id") ) tempSTR = Replace( tempSTR, "$BOX_WIDTH$", String(20, "_") ) tempSTR = Replace( tempSTR, "$ISSUE_NUMBER$", rsCQ("iss_num") ) tempSTR = Replace( tempSTR, "$SUMMARY$", NVL( HTML_Encode ( rsCQ("summary") ) ) ) ' --- CQ Issues body --- tempSTR = Replace( tempSTR, "$CQ_ISSUE_TYPE$", NVL( rsCQ("issue_type") ) ) tempSTR = Replace( tempSTR, "$CQ_SUBMITTER$", NVL( rsCQ("submitter") ) ) tempSTR = Replace( tempSTR, "$CQ_DETECTED_IN_VERSION$", NVL( rsCQ("release_part1") &"."& rsCQ("release_part2") &"."& rsCQ("release_part3") ) ) tempSTR = Replace( tempSTR, "$CQ_SUBMIT_DATE$", NVL( EuroDate ( rsCQ("submit_date") ) ) ) tempSTR = Replace( tempSTR, "$CQ_PROJECT$", NVL( rsCQ("project") ) ) tempSTR = Replace( tempSTR, "$CQ_OWNER$", NVL( rsCQ("owner") ) ) tempSTR = Replace( tempSTR, "$CQ_PRODUCT$", NVL( rsCQ("product") ) ) tempSTR = Replace( tempSTR, "$CQ_APPROVER$", NVL( rsCQ("approver") ) ) tempSTR = Replace( tempSTR, "$CQ_PACKAGE$", NVL( rsCQ("package_ref") ) ) tempSTR = Replace( tempSTR, "$CQ_PRIORITY$", NVL( rsCQ("priority") ) ) tempSTR = Replace( tempSTR, "$CQ_STATUS$", NVL( rsCQ("status") ) ) tempSTR = Replace( tempSTR, "$CQ_DESCRIPTION$", FormatTextBox ( NVL( HTML_Encode( rsCQ("description") ) ) ) ) tempSTR = Replace( tempSTR, "$CQ_NOTES_LOG$", FormatTextBox ( NVL( HTML_Encode( rsCQ("notes_log") ) ) ) ) tempSTR = Replace( tempSTR, "$CQ_RELEASE_ID$", NVL( rsCQ("release_id") ) ) tempSTR = Replace( tempSTR, "$CQ_CLIENT_REFERENCE$", NVL( rsCQ("client_ref") ) ) tempSTR = Replace( tempSTR, "$CQ_SEVERITY$", NVL( rsCQ("severity") ) ) tempSTR = Replace( tempSTR, "$CQ_CHANGE_REQUEST$", Format_CQ_CHANGE_REQUEST ( rsCQ("cr_internal"), rsCQ("cr_external") ) ) '----------------------- tempSTR = Replace( tempSTR, "$ISSUE_TYPE$", NVL( rsCQ("issue_type") ) ) tempSTR = Replace( tempSTR, "$PRIORITY$", NVL( rsCQ("priority") ) ) rsCQ.MoveNext WEnd rsCQ.Close() insterSTR = insterSTR & tempSTR Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Changes Since Last Version --- ' Dependency_Changes:Header Query_String = _ "SELECT pkg.pkg_name, cpv.pkg_version, ppv.pkg_version AS previous_version, cpv.last_pv_id"&_ " FROM PACKAGE_VERSIONS cpv,"&_ " PACKAGE_VERSIONS ppv,"&_ " PACKAGES pkg"&_ " WHERE cpv.LAST_PV_ID = ppv.pv_id"&_ " AND cpv.pkg_id = pkg.pkg_id"&_ " AND cpv.pv_id = :PV_ID " Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Dependency_Changes:Header", outNotes, snippetSTR, insertFrom ) If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then tempSTR = Replace( snippetSTR, "$CURRENT_PKG_NAME_AND_VERSION$", rsQry("pkg_name") &" "& rsQry("pkg_version") ) tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", rsQry("pkg_name") &"/"& rsQry("previous_version") &"/"& DOC_FOLDER &"/"& Format_FileName( rsQry("pkg_name"), rsQry("previous_version"), rsQry("last_pv_id") ) ) insterSTR = insterSTR & Replace( tempSTR, "$PREVIOUS_VERSION$", rsQry("previous_version") ) OraDatabase.Parameters.Add "OLD_PV_ID", rsQry("last_pv_id"), ORAPARM_INPUT, ORATYPE_NUMBER Else Call Write_To_Release_Notes_Info ( NNpv_id, enum_RELEASE_NOTES_NO_PREVIOUS_VERSION ) Call Raise_Event ( enumEVENT_ERROR, "[job:GenerateReleaseNotes sub:Generate_Notes_Style_B]", _ "package: "& parPkg_name &" "& parPkg_Version , _ "Previous Version is unknow! Go to Release Manager and define Previous Version for this package.", enum_RELEASE_NOTES_NO_PREVIOUS_VERSION ) End If Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' Dependency_Changes:List Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\diff_dependencies.sql" ) Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Dependency_Changes:List", outNotes, snippetSTR, insertFrom ) While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) If rsQry("status") = "New" OR rsQry("status") = "Updated" Then tempSTR = Replace( snippetSTR, "$CLASS_NAME$", "pkg_changed" ) ElseIf rsQry("status") = "Removed" Then tempSTR = Replace( snippetSTR, "$CLASS_NAME$", "pkg_removed" ) Else tempSTR = Replace( snippetSTR, "$CLASS_NAME$", "body_txt" ) End If tempSTR = Replace( tempSTR, "$PKG_NAME$", rsQry("pkg_name") ) tempSTR = Replace( tempSTR, "$STATUS$", NVL( rsQry("status") ) ) tempSTR = Replace( tempSTR, "$CURRENT_VERSION$", NVL( rsQry("pkg_version") ) ) tempSTR = Replace( tempSTR, "$PREVIOUS_VERSION$", NVL( rsQry("previous_version") ) ) insterSTR = insterSTR & Replace( tempSTR, "$LAST_OWNER$", ""& rsQry("full_name") &"" ) rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Build Dependencies --- Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_build_dependencies.sql" ) Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Build_Dependencies", outNotes, snippetSTR, insertFrom ) If rsQry.RecordCount < 1 Then tempSTR = Replace( snippetSTR, "$PKG_NAME$", " " ) tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", " " ) insterSTR = insterSTR & Replace( tempSTR, "$PKG_VERSION$", " " ) End If While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) tempSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") ) tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", rsQry("pkg_name") &"/"& rsQry("pkg_version") &"/"& DOC_FOLDER &"/"& Format_FileName( rsQry("pkg_name"), rsQry("pkg_version"), rsQry("dpv_id") ) ) insterSTR = insterSTR & Replace( tempSTR, "$PKG_VERSION$", rsQry("pkg_version") ) rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Runtime Dependencies --- Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_runtime_dependencies.sql" ) Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Runtime_Dependencies", outNotes, snippetSTR, insertFrom ) If rsQry.RecordCount < 1 Then tempSTR = Replace( snippetSTR, "$PKG_NAME$", " " ) tempSTR = Replace( tempSTR, "$PKG_VERSION$", " " ) insterSTR = insterSTR & Replace( tempSTR, "$COMMENTS$", " ") End If While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) tempSTR = Replace( snippetSTR, "$PKG_NAME$", rsQry("pkg_name") ) tempSTR = Replace( tempSTR, "$PKG_VERSION$", rsQry("pkg_version") ) insterSTR = insterSTR & Replace( tempSTR, "$COMMENTS$", NVL( FormatTextBox ( HTML_Encode ( rsQry("rtd_comments") ) &"
"& HTML_Encode ( rsQry("rtd_url") ) ) ) ) rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Files --- Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\package_components.sql" ) Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Files", outNotes, snippetSTR, insertFrom ) If rsQry.RecordCount < 1 Then tempSTR = Replace( snippetSTR, "$FILE_NAME$", " " ) tempSTR = Replace( tempSTR, "$FILE_PATH$", " " ) tempSTR = Replace( tempSTR, "$BYTE_SIZE$", " " ) insterSTR = insterSTR & Replace( tempSTR, "$CRC_CKSUM$", " " ) End If While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) tempSTR = Replace( snippetSTR, "$FILE_NAME$", NVL( rsQry("file_name") ) ) tempSTR = Replace( tempSTR, "$FILE_PATH$", NVL( rsQry("file_path") ) ) tempSTR = Replace( tempSTR, "$BYTE_SIZE$", NVL( rsQry("byte_size") ) ) insterSTR = insterSTR & Replace( tempSTR, "$CRC_CKSUM$", NVL( rsQry("crc_cksum") ) ) rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Issues --- Dim curr_pv_id, recCode, GroupChanged Call Get_ORA_Package_Issues ( "Dependency_Issues", CQSQL ) Call Get_Dependency_CQ_Issues ( CQSQL, rsCQ, depIssDICT, depIssARR ) Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\dependency_issues_fixed.sql" ) OraDatabase.Parameters.Add "enumISSUES_STATE_IMPORTED", enumISSUES_STATE_IMPORTED, ORAPARM_INPUT, ORATYPE_NUMBER Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Issues:Header", outNotes, headerSnippet, insertFrom ) Call Get_Snippet ( "Issues:Columns", outNotes, columnSnippet, insertFrom ) Call Get_Snippet ( "Issues:List:DEVI", outNotes, snippetDEVI, insertFrom ) Call Get_Snippet ( "Issues:List:TDSE", outNotes, snippetTDSE, insertFrom ) Call Get_Snippet ( "Issues:List", outNotes, listSnippet, insertFrom ) curr_pv_id = 0 insterSTR = "" GroupChanged = FALSE While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) recCode = Cstr(rsQry("iss_db") &"."& rsQry("iss_id")) ' Issues:Header tempSTR = Replace( headerSnippet, "$PKG_NAME_AND_VERSION$", rsQry("pkg_name") &" "& rsQry("pkg_version") ) tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", rsQry("pkg_name") &"/"& rsQry("pkg_version") &"/"& DOC_FOLDER &"/"& Format_FileName( rsQry("pkg_name"), rsQry("pkg_version"), rsQry("pv_id") ) ) tempSTR = Replace( tempSTR, "$REASON_FOR_RELEASE$", Format_Reason_For_Release ( rsQry("iss_id"), rsQry("reasons") ) ) Call Group_By ( rsQry("pv_id"), curr_pv_id, tempSTR, insterSTR, GroupChanged ) ' Issues:List If NOT IsNull(rsQry("iss_id")) Then If GroupChanged Then ' Add column names insterSTR = insterSTR & columnSnippet GroupChanged = FALSE End If ' Add Row If CInt(rsQry("iss_db")) = enumCLEARQUEST_DEVI_ID Then tempSTR = Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" ) Else tempSTR = Replace( snippetTDSE, "$ISSUE_DATABASE$", "UNKNOWN" ) End If tempSTR = Replace( tempSTR, "$TAG_ID$", ArrayRecord( enumLoc_iss_db, recCode, depIssDICT, depIssARR ) &"_"& ArrayRecord( enumLoc_iss_id, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$BOX_WIDTH$", String(20, "_") ) tempSTR = Replace( tempSTR, "$ISSUE_NUMBER$", ArrayRecord( enumLoc_iss_num, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$SUMMARY$", ArrayRecord( enumLoc_summary, recCode, depIssDICT, depIssARR ) ) ' --- CQ Issues body --- tempSTR = Replace( tempSTR, "$CQ_ISSUE_TYPE$", ArrayRecord( enumLoc_issue_type, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_SUBMITTER$", ArrayRecord( enumLoc_submitter, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_DETECTED_IN_VERSION$", ArrayRecord( enumLoc_defect_in, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_SUBMIT_DATE$", ArrayRecord( enumLoc_submit_date, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_PROJECT$", ArrayRecord( enumLoc_project, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_OWNER$", ArrayRecord( enumLoc_owner, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_PRODUCT$", ArrayRecord( enumLoc_product, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_APPROVER$", ArrayRecord( enumLoc_approver, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_PACKAGE$", ArrayRecord( enumLoc_package, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_PRIORITY$", ArrayRecord( enumLoc_priority, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_STATUS$", ArrayRecord( enumLoc_status, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_DESCRIPTION$", ArrayRecord( enumLoc_description, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_NOTES_LOG$", ArrayRecord( enumLoc_notes_log, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_RELEASE_ID$", ArrayRecord( enumLoc_release_id, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_CLIENT_REFERENCE$", ArrayRecord( enumLoc_client_ref, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_SEVERITY$", ArrayRecord( enumLoc_severity, recCode, depIssDICT, depIssARR ) ) tempSTR = Replace( tempSTR, "$CQ_CHANGE_REQUEST$", ArrayRecord( enumLoc_change_request, recCode, depIssDICT, depIssARR ) ) '----------------------- tempSTR = Replace( tempSTR, "$ISSUE_TYPE$", ArrayRecord( enumLoc_issue_type, recCode, depIssDICT, depIssARR ) ) insterSTR = insterSTR & Replace( tempSTR, "$PRIORITY$", ArrayRecord( enumLoc_priority, recCode, depIssDICT, depIssARR ) ) End If rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) ' --- Additional_Notes --- Query_String = ReadFile( AppPath & QUERIES_FOLDER & "\additional_notes.sql" ) Set rsQry = OraDatabase.CreateDynaset( Query_String, cint(0)) Call Get_Snippet ( "Additional_Notes:Blank", outNotes, tempSTR, insertFrom ) Call Get_Snippet ( "Additional_Notes", outNotes, snippetSTR, insertFrom ) If rsQry.RecordCount < 1 Then insterSTR = tempSTR End If While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) tempSTR = Replace( snippetSTR, "$NOTE_TITLE$", rsQry("note_title") ) tempSTR = Replace( tempSTR, "$NOTE_BODY$", FormatTextBox( NVL( rsQry("note_body") ) ) ) tempSTR = Replace( tempSTR, "$MOD_DATE$", EuroDate ( rsQry("mod_date") ) ) insterSTR = insterSTR & Replace( tempSTR, "$MOD_USER$", NVL( rsQry("full_name") ) ) rsQry.MoveNext WEnd Call Insert_To_Page ( outNotes, insertFrom, insterSTR ) rsQry.Close() Set rsQry = Nothing OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "OLD_PV_ID" OraDatabase.Parameters.Remove "enumISSUES_STATE_IMPORTED" End Sub