Rev 1281 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
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, snippetTDSEDim Query_String, rsQry, CQSQL, rsCQ, depIssDICT, depIssARR(), releaseInfo, newReleaseInfoConst 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_NUMBERSet rsQry = OraDatabase.CreateDynaset( Query_String, cint(0))Call Get_Snippet ( "Title", outNotes, snippetSTR, insertFrom )If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) TheninsterSTR = Replace( snippetSTR, "$PKG_TITLE$", rsQry("pkg_name") &" "& rsQry("pkg_version"))End IfCall Insert_To_Page ( outNotes, insertFrom, insterSTR )'--- DEVI-037294 Requirement: Insert <ReleaseName>: <PkgName> <PkgVersion> --------------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)) TheninsterSTR = 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 IfCall Insert_To_Page ( outNotes, insertFrom, insterSTR )' --- Package Information ---Call Get_Snippet ( "Package_Information", outNotes, snippetSTR, insertFrom )If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) ThenIf IsNull(rsQry("short_desc")) TheninsterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", "Not supplied!" )ElseinsterSTR = Replace( snippetSTR, "$SHORT_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("short_desc") ) ) )End IfIf IsNull(rsQry("long_desc")) TheninsterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", "Not supplied!" )ElseinsterSTR = Replace( insterSTR, "$LONG_DESCRIPTION$", FormatTextBox( HTML_Encode ( rsQry("long_desc") ) ) )End IfEnd IfCall Insert_To_Page ( outNotes, insertFrom, insterSTR )' --- Reason for This Version ---Dim resonForReleaseresonForRelease = 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 )' HeaderIf rsCQ.BOF OR rsCQ.EOF ThenIf IsNull( resonForRelease ) ThentempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", "See ""Issues"" section below." )ElsetempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", FormatTextBox( resonForRelease ) & "<br>" & "Also see ""Issues"" section below." )End IfElseIf NOT IsNull( resonForRelease ) ThentempSTR = Replace( headerSnippet, "$REASON_FOR_VERSION$", FormatTextBox( resonForRelease ) )End If' ColumnstempSTR = tempSTR & columnSnippetEnd IfWhile ((NOT rsCQ.BOF) AND (NOT rsCQ.EOF))'If CInt(NNproj_id) = CInt(SYD_PROJID) Then'Extract Release Info If ExistsreleaseInfo = rsCQ("releaseinfo")Call EditReleaseInfoDetails ( rsCQ("iss_db"), rsCQ("iss_id"), newReleaseInfo, releaseInfo )'End If' Add RowIf CInt(rsCQ("iss_db")) = enumCLEARQUEST_DEVI_ID ThentempSTR = tempSTR & Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" )ElseIf CInt(rsCQ("iss_db")) = enumCLEARQUEST_TDSE_ID ThentempSTR = tempSTR & Replace( snippetTDSE, "$ISSUE_DATABASE$", "TDSE" )End IftempSTR = 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.MoveNextWEndrsCQ.Close()insterSTR = insterSTR & tempSTRCall Insert_To_Page ( outNotes, insertFrom, insterSTR )' --- Changes Since Last Version ---' Dependency_Changes:HeaderQuery_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)) ThentempSTR = 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_NUMBERElseCall 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 IfCall Insert_To_Page ( outNotes, insertFrom, insterSTR )' Dependency_Changes:ListQuery_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" ThentempSTR = Replace( snippetSTR, "$CLASS_NAME$", "pkg_changed" )ElseIf rsQry("status") = "Removed" ThentempSTR = Replace( snippetSTR, "$CLASS_NAME$", "pkg_removed" )ElsetempSTR = Replace( snippetSTR, "$CLASS_NAME$", "body_txt" )End IftempSTR = 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$", "<a href='mailto:"& rsQry("user_email") &"' class='txt_linked'>"& rsQry("full_name") &"</a>" )rsQry.MoveNextWEndCall 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 ThentempSTR = Replace( snippetSTR, "$PKG_NAME$", " " )tempSTR = Replace( tempSTR, "$RELEASE_NOTE_PATH$", " " )insterSTR = insterSTR & Replace( tempSTR, "$PKG_VERSION$", " " )End IfWhile ((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.MoveNextWEndCall 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 ThentempSTR = Replace( snippetSTR, "$PKG_NAME$", " " )tempSTR = Replace( tempSTR, "$PKG_VERSION$", " " )insterSTR = insterSTR & Replace( tempSTR, "$COMMENTS$", " ")End IfWhile ((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") ) &"<br>"& HTML_Encode ( rsQry("rtd_url") ) ) ) )rsQry.MoveNextWEndCall 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 ThentempSTR = Replace( snippetSTR, "$FILE_NAME$", " " )tempSTR = Replace( tempSTR, "$FILE_PATH$", " " )tempSTR = Replace( tempSTR, "$BYTE_SIZE$", " " )insterSTR = insterSTR & Replace( tempSTR, "$CRC_CKSUM$", " " )End IfWhile ((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.MoveNextWEndCall Insert_To_Page ( outNotes, insertFrom, insterSTR )' --- Issues ---Dim curr_pv_id, recCode, GroupChangedCall 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_NUMBERSet 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 = 0insterSTR = ""GroupChanged = FALSEWhile ((NOT rsQry.BOF) AND (NOT rsQry.EOF))recCode = Cstr(rsQry("iss_db") &"."& rsQry("iss_id"))' Issues:HeadertempSTR = 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:ListIf NOT IsNull(rsQry("iss_id")) ThenIf GroupChanged Then' Add column namesinsterSTR = insterSTR & columnSnippetGroupChanged = FALSEEnd If' Add RowIf CInt(rsQry("iss_db")) = enumCLEARQUEST_DEVI_ID ThentempSTR = Replace( snippetDEVI, "$ISSUE_DATABASE$", "DEVI" )ElseIf CInt(rsQry("iss_db")) = enumCLEARQUEST_TDSE_ID ThentempSTR = Replace( snippetTDSE, "$ISSUE_DATABASE$", "TDSE" )End IftempSTR = 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 IfrsQry.MoveNextWEndCall 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 TheninsterSTR = tempSTREnd IfWhile ((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.MoveNextWEndCall Insert_To_Page ( outNotes, insertFrom, insterSTR )rsQry.Close()Set rsQry = NothingOraDatabase.Parameters.Remove "PV_ID"OraDatabase.Parameters.Remove "OLD_PV_ID"OraDatabase.Parameters.Remove "enumISSUES_STATE_IMPORTED"End Sub