//THIS SCRIPT IS TO USED TO UPDATE Objects in the subsystem Module!! // Operation Status attribute needs to be cleared from the // previous run for this to work correctly. /* Modification History: Jim Anderson 9/11/2007, 11/19/2007, 11/21/2007, 03/25/2009 */ Module m = current Module mReq = edit ("/Test/Software Subsystem Specification", true) string modNameOps = m."Name" "" // check to see if this is being executed from a lastest Version input module if (!matches ("Subsystem_module_update_from", modNameOps)) { errorBox"The current module is not a LA Operations Input module.\n\n" //- "Execute this script from Subsystem_module_update_from." halt } // ****update the next line with the complete module name of the module that you want to copy into**** // check to see if module to be updated is available in Exclusive Edit string modNameREQ = mReq."Name" "" if (matches("Software Subsystem Specification", modNameREQ "")) { if (null mReq) { errorBox"Unable to get Exclusive Edit access to the\n" //- "Software Subsystem Specification.\n\n" halt } } else if (!confirm("This will modify objects in Software Subsystem Specification Specification\n" //- " Environmental Control Subsystem Specification module selected\n" //- "Continue?", msgWarning)) { halt } Object o, oReq, oSec, oNew,oParent string opType, dcDoc, AttDoc, Atttype, dcName, UCStep, ReceiverName, SenderName, UseCaseList, AttName, OpName, MessageID, EAChange string objChanged, objChangedArchive, dExchangeQuid, AttrQuid, OpText string opNum, QUID, UseCaseID bool matchFound, modFound, opReq int objectTotalCount = 0 int operationMatchFoundCount = 0 int operationValidatedCount = 0 int operationUpdatedCount = 0 int operationDeletedCount = 0 int operationNewCount = 0 int operationErrorCount = 0 int UseCaseListupdate = 0 int SenderNameupdates = 0 int ReceiverNameupdates = 0 int dataclassdocupdate = 0 int attributedocupdate = 0 int attributetypeupdate = 0 int UCIDQUIDupdate = 0 int Enumerationupdate = 0 int operationnameupdate = 0 int deletedreq = 0 int foundamatchbutdidntgetupdated = 0 //int operationsProcessedCount print "Initiated Operation Update in " mReq."Name" ".\n\n" for o in entire m do { if (!isDeleted(o)) { objectTotalCount++ OpText = o."Object Text" "" OpName = o."Operation Name" "" UseCaseID = o."Use Case ID" "" MessagID = o."Message Id" "" ReqID = o."Req Id" "" //AttDoc = o."Attribute Doc" "" //Atttype = o."Attribute Type" "" //dcName = o."Data Class Name" "" //dcDoc = o."Data Class Doc" "" UCStep = o."UC Step" "" ReceiverName = o."Receiver Name or Destination" "" SenderName = o."Sender Name or Source" "" UseCaseName = o."Use Case Name" "" //AttName = o."Attribute Name" "" //EAChange = o."EAChange" "" //dcID = o."DC ID" "" MessagID = o. "Message ID" "" //EAChange = o."EAChange" "" matchFound = false Skip skpUseCaseID = createString() // KEY: 'string' UseCaseID; DATA: last 'Object' with that value for oReq in entire mReq do { if (!isDeleted(oReq)){ UseCaseID = oReq."Use Case ID" "" if (find(skpUseCaseID, skpUseCaseID)){ delete(skpUseCaseID, UseCaseID) // Remove the previous "last" object with that value } put(skpUseCaseID, UseCaseID, oReq) // This is the "last" one found with MessageId, so far } } for oReq in entire mReq do { if (!isDeleted(oReq) && MessagID == oReq."Message Id"""){ //print "I found a match" identifier(oReq) " From " identifier(o) "\n" matchFound = true operationUpdatedCount++ //print "I found a message ID match" identifier(oReq) " From " identifier(o) "\n" // check and update attributes as well as the rosechanged attribute that determine if object updated modFound = false if (OpText != oReq."Object Text" "") { dataclassdocupdate++ modFound = true oReq."Object Text" = OpText oReq."EA Changed" = oReq. "EA Changed" "Updated object text""\n" print "object text updated in " identifier(oReq) " From " identifier(o)".\n" } //if (UseCaseID != oReq."Use Case ID" "") { //UCIDQUIDupdate++ //modFound = true //oReq."Use Case ID" = UseCaseID //oReq."EA Changed" = oReq."EA Changed" "Updated UseCaseID""\n" //print "UseCaseID updated in " identifier(oReq) " From " identifier(o) ".\n" //} // check and update other attributes //if (Atttype != oReq."Attribute Type" "") { //attributetypeupdate++ //modFound = true //oReq."Attribute Type" = Atttype //oReq."EAChange" = oReq. "EAChange" "Updated Attribute Type""\n" //print "Attribute Type updated in " identifier(oReq) " From " identifier(o) ".\n" //} //if (AttName != oReq."Attribute Name" "") { //Attributenameupdate++ //modFound = true //oReq."Attribute Name" = AttName //oReq."EAChange" = oReq. "EAChange" "Updated Attribute Name""\n" //print "Attribute Name updated in " identifier(oReq) " From " identifier(o) ".\n" //} if (UCStep != oReq."UC Step" "") { Enumerationupdate++ modFound = true oReq."UC Step" = UCStep oReq."EA Changed" = oReq. "EA Changed""Updated UC Step List""\n" print "UC Step updated in " identifier(oReq) " From " identifier(o)".\n" } if (OpName != oReq."Operation Name" "") { operationnameupdate++ modFound = true oReq."Operation Name" = OpName oReq."EA Changed" = oReq. "EA Changed""Updated Operation Name""\n" print "OpName updated in " identifier(oReq) " From " identifier(o)".\n" } if (ReceiverName != oReq."Receiver Name or Destination" "") { ReceiverNameupdates++ modFound = true oReq."Receiver Name or Destination" = ReceiverName oReq."EA Changed" = oReq."EA Changed" "Updated Receiver Name""\n" print "roseObjReceiverName updated in " identifier(oReq) " From " identifier(o) ".\n" } if (SenderName != oReq."Sender Name or Source" "") { SenderNameupdates++ modFound = true oReq."Sender Name or Source" = SenderName oReq."EA Changed" = oReq. "EA Changed""Updated Sender Name""\n" print "roseObjSenderName updated in " identifier(oReq) " From " identifier(o) ".\n" } if (UseCaseName != oReq."Use Case Name" "") { UseCaseListupdate++ modFound = true oReq."Use Case Name" = UseCaseName oReq."EA Changed" = oReq. "EA Changed" "Updated UseCaseList""\n" print "Use Case Name updated in " identifier(oReq) " From " identifier(o) ".\n" } if (oReq."EA Changed""" == "") { oReq."EA Changed" = oReq."EA Changed" "Found a match but didn't get updated""\n" foundamatchbutdidntgetupdated++ print "Found a Match but didn't get updated " identifier(oReq) " From " identifier(o) ".\n" } if (oReq."EA Changed""" != ""){ operationMatchFoundCount++ } } } if (matchFound == false) { print "I found a new requirement""\n" find(skpUseCaseID, UseCaseID, oReq) oNew = create after oReq //move (oNew,after oReq) operationNewCount++ oNew."Message Id" = MessagID oNew."Operation Name" = OpName oNew."Object Text" = OpText oNew."Use Case ID" = UseCaseID oNew."UC Step" = UCStep oNew."Use Case Name" = UseCaseName oNew."Receiver Name or Destination" = ReceiverName oReq."Sender Name or Source = SenderName oNew."Use Case Name" = UseCaseName //oNew."Attribute Name" = AttName oNew."EAChange" = "New Requirement" //oNew."Data Class Doc" = dcDoc //oNew."EAChange" = objChangedArchive print "NEW REQUIREMENT CREATED (" identifier(oNew) " from updates module " identifier(o)")""\n" } //if (!isDeleted(oReq) && UsecaseName != "") { //move oReq //oReq."EAChange" = oReq. "EAChange" "DELETED_REQUIREMENT""\n" //print identifier(oReq) " DELETED""\n" //} } } //for oReq in entire mReq do { //if (!isDeleted(oReq) && oReq."EAChange""" == "") { //print identifier(oReq)"\n" //if (!isDeleted(oReq) && oReq."EAChange""" == "" && oReq."QUID""" == ReqID"" ) { //print identifier(oReq)"\n" //} //} //} print "Completed Operation Update in " mReq."Name" "\n" print objectTotalCount " Objects input\n" //print operationErrorCount " had errors and did not create updates\n" //operationUpdatedCount = operationMatchFoundCount + operationNewCount //print "resulting in " operationsProcessedCount " operations processed\n" //print "\t" operationMatchFoundCount " operation requirements matches found resulting in:\n" print "\t\t" operationValidatedCount " operation requirements validated\n" print "\t\t" operationUpdatedCount " operation requirements updated\n" //print "\t\t" operationDeletedCount " operation requirements deleted\n" print "\t\t" operationNewCount " new operation requirements created\n" print "\t\t" UseCaseListupdate " Use Case List updates\n" print "\t\t" SenderNameupdates " Sender Name updates\n" print "\t\t" ReceiverNameupdates " Receiver Name updates\n" //print "\t\t" dataclassdocupdate " data class doc update\n" //print "\t\t" attributedocupdate " attribute doc update\n" //print "\t\t" attributetypeupdate " attribute type update\n" //print "\t\t" Attributenameupdate " Attribute name update\n" //print "\t\t" Enumerationupdate " Enumeration update\n" print "\t\t" operationnameupdate " Operation name update\n"