class AssetAssociationNodeDialog: def __init__(self,objt,environmentName,builder): self.window = builder.get_object("AssetAssociationNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theCurrentEnvironment = environmentName self.theHeadName = objt.name() self.decorator = NDImplementationDecorator(builder) assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment) associationTypes = ['Inheritance','Association','Aggregation','Composition','Dependency'] multiplicityTypes = ['1','*','1..*'] self.decorator.updateComboCtrl("assetAssociationHeadAdornmentCtrl",associationTypes,'') self.decorator.updateComboCtrl("assetAssociationHeadNryCtrl",multiplicityTypes,'') self.decorator.updateComboCtrl("assetAssociationTailNryCtrl",multiplicityTypes,'') self.decorator.updateComboCtrl("assetAssociationTailAdornmentCtrl",associationTypes,'') self.decorator.updateComboCtrl("assetAssociationTailNameCtrl",assets,'') self.decorator.updateButtonLabel("assetAssociationOkButton","Create") def on_assetAssociationOkButton_clicked(self,callback_data): headAdornment = self.decorator.getComboValue("assetAssociationHeadAdornmentCtrl") headNry = self.decorator.getComboValue("assetAssociationHeadNryCtrl") headRole = self.decorator.getText("assetAssociationHeadRoleCtrl") tailRole = self.decorator.getText("assetAssociationTailRoleCtrl") tailNry = self.decorator.getComboValue("assetAssociationTailNryCtrl") tailAdornment = self.decorator.getComboValue("assetAssociationTailAdornmentCtrl") tailName = self.decorator.getComboValue("assetAssociationTailNameCtrl") parameters = ClassAssociationParameters(self.theCurrentEnvironment,self.theHeadName,'asset',tailAdornment,tailNry,tailRole,headRole,headNry,headAdornment,'asset',tailName) self.dbProxy.addClassAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class NewRequirementNodeDialog: def __init__(self, objt, environmentName, builder): self.window = builder.get_object("NewRequirementNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theGoalName = objt.name() self.theEnvironmentName = environmentName self.theGoalAssociation = None self.decorator = NDImplementationDecorator(builder) reqTypes = self.dbProxy.getDimensionNames('requirement_type') priorityTypes = ['1', '2', '3'] reqAssets = self.dbProxy.environmentAssets(self.theEnvironmentName) self.goalAssociations = [] self.subGoalAssociations = [] self.decorator.updateComboCtrl("newRequirementTypeCtrl", reqTypes, '') self.decorator.updateComboCtrl("requirementAssetCtrl", reqAssets, '') self.decorator.updateComboCtrl("newRequirementPriorityCtrl", priorityTypes, '') self.window.resize(350, 600) def requirementParameters(self): reqType = self.decorator.getComboValue("newRequirementTypeCtrl") reqPri = self.decorator.getComboValue("newRequirementPriorityCtrl") reqDesc = self.decorator.getMLText("newRequirementDescriptionCtrl") reqRat = self.decorator.getMLText("newRequirementRationaleCtrl") reqFC = self.decorator.getMLText("newRequirementFitCriterionCtrl") reqOrig = self.decorator.getMLText("newRequirementOriginatorCtrl") self.theAssetName = self.decorator.getComboValue( "requirementAssetCtrl") completeReqLabel = self.dbProxy.lastRequirementLabel(self.theAssetName) reqAsset, reqLabel = completeReqLabel.split('-') reqId = self.dbProxy.newId() reqLabel = int(reqLabel) reqLabel += 1 r = RequirementFactory.build(reqId, reqLabel, reqDesc, reqPri, reqRat, reqFC, reqOrig, reqType, self.theAssetName) return r def requirementAsset(self): return self.theAssetName def on_newRequirementOkButton_clicked(self, callback_data): req = self.requirementParameters() self.dbProxy.addRequirement(req, self.theAssetName, True) reqLabel = self.dbProxy.lastRequirementLabel(self.theAssetName) self.theGoalAssociation = GoalAssociationParameters( self.theEnvironmentName, self.theGoalName, 'goal', 'and', reqLabel, 'requirement', ) self.dbProxy.addGoalAssociation(self.theGoalAssociation) self.window.destroy() def show(self): self.window.show()
class NewRequirementNodeDialog: def __init__(self, objt, environmentName, builder): self.window = builder.get_object("NewRequirementNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theGoalName = objt.name() self.theEnvironmentName = environmentName self.theGoalAssociation = None self.decorator = NDImplementationDecorator(builder) reqTypes = self.dbProxy.getDimensionNames("requirement_type") priorityTypes = ["1", "2", "3"] reqAssets = self.dbProxy.environmentAssets(self.theEnvironmentName) self.goalAssociations = [] self.subGoalAssociations = [] self.decorator.updateComboCtrl("newRequirementTypeCtrl", reqTypes, "") self.decorator.updateComboCtrl("requirementAssetCtrl", reqAssets, "") self.decorator.updateComboCtrl("newRequirementPriorityCtrl", priorityTypes, "") self.window.resize(350, 600) def requirementParameters(self): reqType = self.decorator.getComboValue("newRequirementTypeCtrl") reqPri = self.decorator.getComboValue("newRequirementPriorityCtrl") reqDesc = self.decorator.getMLText("newRequirementDescriptionCtrl") reqRat = self.decorator.getMLText("newRequirementRationaleCtrl") reqFC = self.decorator.getMLText("newRequirementFitCriterionCtrl") reqOrig = self.decorator.getMLText("newRequirementOriginatorCtrl") self.theAssetName = self.decorator.getComboValue("requirementAssetCtrl") completeReqLabel = self.dbProxy.lastRequirementLabel(self.theAssetName) reqAsset, reqLabel = completeReqLabel.split("-") reqId = self.dbProxy.newId() reqLabel = int(reqLabel) reqLabel += 1 r = RequirementFactory.build( reqId, reqLabel, reqDesc, reqPri, reqRat, reqFC, reqOrig, reqType, self.theAssetName ) return r def requirementAsset(self): return self.theAssetName def on_newRequirementOkButton_clicked(self, callback_data): req = self.requirementParameters() self.dbProxy.addRequirement(req, self.theAssetName, True) reqLabel = self.dbProxy.lastRequirementLabel(self.theAssetName) self.theGoalAssociation = GoalAssociationParameters( self.theEnvironmentName, self.theGoalName, "goal", "and", reqLabel, "requirement" ) self.dbProxy.addGoalAssociation(self.theGoalAssociation) self.window.destroy() def show(self): self.window.show()
class GoalRefinementNodeDialog: def __init__(self, objt, environmentName, builder, goalIndicator, gName, reqIndicator=False): self.window = builder.get_object("GoalRefinementNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.decorator = NDImplementationDecorator(builder) self.reqIndicator = reqIndicator refTypes = ['and', 'or'] goals = self.dbProxy.environmentGoals(self.theEnvironmentName) if (self.reqIndicator == True): refTypes = ['and'] goals = self.dbProxy.getDimensionNames('requirement') self.decorator.updateComboCtrl("goalRefNameCtrl", goals, '') self.decorator.updateComboCtrl("goalRefinementCtrl", refTypes, '') self.decorator.updateButtonLabel("goalRefinementOkButton", "Create") self.window.resize(350, 200) self.goalIndicator = goalIndicator self.inputGoalName = gName def on_goalRefinementOkButton_clicked(self, callback_data): goalName = self.decorator.getComboValue("goalRefNameCtrl") assocType = self.decorator.getComboValue("goalRefinementCtrl") if (self.reqIndicator == True): parameters = GoalAssociationParameters(self.theEnvironmentName, self.inputGoalName, 'goal', 'and', goalName, 'requirement') elif (self.goalIndicator == True): parameters = GoalAssociationParameters(self.theEnvironmentName, goalName, 'goal', assocType, self.inputGoalName, 'goal') else: parameters = GoalAssociationParameters(self.theEnvironmentName, self.inputGoalName, 'goal', assocType, goalName, 'goal') self.dbProxy.addGoalAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class AssetAssociationNodeDialog: def __init__(self, objt, environmentName, builder): self.window = builder.get_object("AssetAssociationNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theCurrentEnvironment = environmentName self.theHeadName = objt.name() self.decorator = NDImplementationDecorator(builder) assets = self.dbProxy.environmentAssets(self.theCurrentEnvironment) associationTypes = [ 'Inheritance', 'Association', 'Aggregation', 'Composition', 'Dependency' ] multiplicityTypes = ['1', '*', '1..*'] self.decorator.updateComboCtrl("assetAssociationHeadAdornmentCtrl", associationTypes, '') self.decorator.updateComboCtrl("assetAssociationHeadNryCtrl", multiplicityTypes, '') self.decorator.updateComboCtrl("assetAssociationTailNryCtrl", multiplicityTypes, '') self.decorator.updateComboCtrl("assetAssociationTailAdornmentCtrl", associationTypes, '') self.decorator.updateComboCtrl("assetAssociationTailNameCtrl", assets, '') self.decorator.updateButtonLabel("assetAssociationOkButton", "Create") def on_assetAssociationOkButton_clicked(self, callback_data): headAdornment = self.decorator.getComboValue( "assetAssociationHeadAdornmentCtrl") headNry = self.decorator.getComboValue("assetAssociationHeadNryCtrl") headRole = self.decorator.getText("assetAssociationHeadRoleCtrl") tailRole = self.decorator.getText("assetAssociationTailRoleCtrl") tailNry = self.decorator.getComboValue("assetAssociationTailNryCtrl") tailAdornment = self.decorator.getComboValue( "assetAssociationTailAdornmentCtrl") tailName = self.decorator.getComboValue("assetAssociationTailNameCtrl") parameters = ClassAssociationParameters(self.theCurrentEnvironment, self.theHeadName, 'asset', tailAdornment, tailNry, tailRole, headRole, headNry, headAdornment, 'asset', tailName) self.dbProxy.addClassAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class AssignResponsibilityNodeDialog: def __init__(self,objt,environmentName,builder,goalName,isGoal = True): self.window = builder.get_object("AssignResponsibilityNodeDialog") b = Borg() self.isGoalIndicator = isGoal self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.theGoalName = goalName self.decorator = NDImplementationDecorator(builder) self.theObjtId = objt.id() roles = self.dbProxy.getDimensionNames('role') self.decorator.updateComboCtrl("roleRespNameCtrl",roles,'') self.window.resize(350,200) def on_roleResponsibilityOkButton_clicked(self,callback_data): roleName = self.decorator.getComboValue("roleRespNameCtrl") if (self.isGoalIndicator == False): roleId = self.dbProxy.getDimensionId(roleName,'role') self.dbProxy.addTrace('requirement_role',self.theObjtId,roleId) else: goalDim = 'goal' if (self.isGoalIndicator == False): goalDim = 'requirement' parameters = GoalAssociationParameters(self.theEnvironmentName,self.theGoalName,goalDim,'responsible',roleName,'role') self.dbProxy.addGoalAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class AssignResponsibilityNodeDialog: def __init__(self, objt, environmentName, builder, goalName, isGoal=True): self.window = builder.get_object("AssignResponsibilityNodeDialog") b = Borg() self.isGoalIndicator = isGoal self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.theGoalName = goalName self.decorator = NDImplementationDecorator(builder) self.theObjtId = objt.id() roles = self.dbProxy.getDimensionNames('role') self.decorator.updateComboCtrl("roleRespNameCtrl", roles, '') self.window.resize(350, 200) def on_roleResponsibilityOkButton_clicked(self, callback_data): roleName = self.decorator.getComboValue("roleRespNameCtrl") if (self.isGoalIndicator == False): roleId = self.dbProxy.getDimensionId(roleName, 'role') self.dbProxy.addTrace('requirement_role', self.theObjtId, roleId) else: goalDim = 'goal' if (self.isGoalIndicator == False): goalDim = 'requirement' parameters = GoalAssociationParameters(self.theEnvironmentName, self.theGoalName, goalDim, 'responsible', roleName, 'role') self.dbProxy.addGoalAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class GoalRefinementNodeDialog: def __init__(self,objt,environmentName,builder,goalIndicator,gName,reqIndicator = False): self.window = builder.get_object("GoalRefinementNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.decorator = NDImplementationDecorator(builder) self.reqIndicator = reqIndicator refTypes = ['and','or'] goals = self.dbProxy.environmentGoals(self.theEnvironmentName) if (self.reqIndicator == True): refTypes = ['and'] goals = self.dbProxy.getDimensionNames('requirement') self.decorator.updateComboCtrl("goalRefNameCtrl",goals,'') self.decorator.updateComboCtrl("goalRefinementCtrl",refTypes,'') self.decorator.updateButtonLabel("goalRefinementOkButton","Create") self.window.resize(350,200) self.goalIndicator = goalIndicator self.inputGoalName = gName def on_goalRefinementOkButton_clicked(self,callback_data): goalName = self.decorator.getComboValue("goalRefNameCtrl") assocType = self.decorator.getComboValue("goalRefinementCtrl") if (self.reqIndicator == True): parameters = GoalAssociationParameters(self.theEnvironmentName,self.inputGoalName,'goal','and',goalName,'requirement') elif (self.goalIndicator == True): parameters = GoalAssociationParameters(self.theEnvironmentName,goalName,'goal',assocType,self.inputGoalName,'goal') else: parameters = GoalAssociationParameters(self.theEnvironmentName,self.inputGoalName,'goal',assocType,goalName,'goal') self.dbProxy.addGoalAssociation(parameters) self.window.destroy() def show(self): self.window.show()
class ObstacleNodeDialog: def __init__(self,objt,environmentName,dupProperty,overridingEnvironment,builder): self.window = builder.get_object("ObstacleNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.theObstacleAssociation = None self.theObstacleId = -1 self.decorator = NDImplementationDecorator(builder) obstacleCategories = self.dbProxy.getDimensionNames('obstacle_category_type') self.obstacleAssociations = [] self.subObstacleAssociations = [] if (objt == None): self.decorator.updateComboCtrl("obstacleCategoryCtrl",obstacleCategories,'') self.decorator.updateButtonLabel("obstacleOkButton","Create") self.isCreate = True else: self.theObstacleId= objt.id() envProperty = objt.environmentProperty(self.theEnvironmentName) self.obstacleAssociations = envProperty.goalRefinements() self.subObstacleAssociations = envProperty.subGoalRefinements() self.decorator.updateTextCtrl("obstacleNameCtrl",objt.name()) self.decorator.updateComboCtrl("obstacleCategoryCtrl",obstacleCategories,objt.category(environmentName,dupProperty)) self.decorator.updateMLTextCtrl("obstacleDefinitionCtrl",objt.definition(environmentName,dupProperty)) self.decorator.updateButtonLabel("obstacleOkButton","Update") self.isCreate = False self.window.resize(350,600) def environmentProperties(self): obsCat = self.decorator.getComboValue("obstacleCategoryCtrl") obsDef = self.decorator.getMLText("obstacleDefinitionCtrl") envProperties = ObstacleEnvironmentProperties(self.theEnvironmentName,'',obsDef,obsCat,self.obstacleAssociations,self.subObstacleAssociations) return envProperties def newObstacleParameters(self): obsName = self.decorator.getText("obstacleNameCtrl") envProperties = self.environmentProperties() parameters = ObstacleParameters(obsName,'Obstacle refinement',[],[envProperties]) parameters.setId(self.theObstacleId) return parameters def existingObstacleParameters(self): obsName = self.decorator.getText("obstacleNameCtrl") modifiedProperties = self.environmentProperties() envProperties = self.dbProxy.obstacleEnvironmentProperties(self.theObstacleId) for idx,p in enumerate(envProperties): if (p.name() == self.theEnvironmentName): envProperties[idx] = modifiedProperties parameters = ObstacleParameters(obsName,'Obstacle refinement',[],envProperties) parameters.setId(self.theObstacleId) return parameters def parentObstacle(self,obsName,assocType): self.theObstacleAssociation = GoalAssociationParameters(self.theEnvironmentName,obsName,'obstacle',assocType) def on_obstacleOkButton_clicked(self,callback_data): if (self.isCreate): parameters = self.newObstacleParameters() self.dbProxy.addObstacle(parameters) self.theObstacleAssociation.theSubGoal = parameters.name() self.theObstacleAssociation.theSubGoalDimension = 'obstacle' self.theObstacleAssociation.theAlternativeId = 0 self.theObstacleAssociation.theRationale = '' self.dbProxy.addGoalAssociation(self.theObstacleAssociation) else: parameters = self.existingObstacleParameters() self.dbProxy.updateObstacle(parameters) self.window.destroy() def show(self): self.window.show()
class GoalNodeDialog: def __init__(self,objt,environmentName,dupProperty,overridingEnvironment,builder): self.window = builder.get_object("GoalNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.theGoalAssociation = None self.theGoalId = -1 self.decorator = NDImplementationDecorator(builder) goalCategories = self.dbProxy.getDimensionNames('goal_category_type') priorityTypes = self.dbProxy.getDimensionNames('priority_type') self.goalAssociations = [] self.subGoalAssociations= [] if (objt == None): self.decorator.updateComboCtrl("goalCategoryCtrl",goalCategories,'') self.decorator.updateComboCtrl("goalPriorityCtrl",priorityTypes,'') self.decorator.updateButtonLabel("goalOkButton","Create") self.isCreate = True else: self.theGoalId = objt.id() envProperty = objt.environmentProperty(self.theEnvironmentName) self.goalAssociations = envProperty.goalRefinements() self.subGoalAssociations = envProperty.subGoalRefinements() self.decorator.updateTextCtrl("goalNameCtrl",objt.name()) self.decorator.updateMLTextCtrl("goalDefinitionCtrl",objt.definition(environmentName,dupProperty)) self.decorator.updateComboCtrl("goalCategoryCtrl",goalCategories,objt.category(environmentName,dupProperty)) self.decorator.updateComboCtrl("goalPriorityCtrl",priorityTypes,objt.priority(environmentName,dupProperty)) self.decorator.updateMLTextCtrl("goalFitCriterionCtrl",objt.fitCriterion(environmentName,dupProperty)) self.decorator.updateMLTextCtrl("goalIssueCtrl",objt.issue(environmentName,dupProperty)) self.decorator.updateButtonLabel("goalOkButton","Update") self.isCreate = False self.window.resize(350,600) def environmentProperties(self): goalDef = self.decorator.getMLText("goalDefinitionCtrl") goalCat = self.decorator.getComboValue("goalCategoryCtrl") goalPri = self.decorator.getComboValue("goalPriorityCtrl") goalFC = self.decorator.getMLText("goalFitCriterionCtrl") goalIssue = self.decorator.getMLText("goalIssueCtrl") envProperties = GoalEnvironmentProperties(self.theEnvironmentName,'',goalDef,goalCat,goalPri,goalFC,goalIssue,self.goalAssociations,self.subGoalAssociations) return envProperties def newGoalParameters(self): goalName = self.decorator.getText("goalNameCtrl") envProperties = self.environmentProperties() parameters = GoalParameters(goalName,'None',[],[envProperties]) parameters.setId(self.theGoalId) return parameters def existingGoalParameters(self): goalName = self.decorator.getText("goalNameCtrl") modifiedProperties = self.environmentProperties() goalEnvProperties = self.dbProxy.goalEnvironmentProperties(self.theGoalId) for idx,p in enumerate(goalEnvProperties): if (p.name() == self.theEnvironmentName): goalEnvProperties[idx] = modifiedProperties parameters = GoalParameters(goalName,'None',[],goalEnvProperties) parameters.setId(self.theGoalId) return parameters def parentGoal(self,goalName,assocType): self.theGoalAssociation = GoalAssociationParameters(self.theEnvironmentName,goalName,'goal',assocType) def on_goalOkButton_clicked(self,callback_data): if (self.isCreate): parameters = self.newGoalParameters() self.dbProxy.addGoal(parameters) self.theGoalAssociation.theSubGoal = parameters.name() self.theGoalAssociation.theSubGoalDimension = 'goal' self.theGoalAssociation.theAlternativeId = 0 self.theGoalAssociation.theRationale = '' self.dbProxy.addGoalAssociation(self.theGoalAssociation) else: parameters = self.existingGoalParameters() self.dbProxy.updateGoal(parameters) self.window.destroy() def show(self): self.window.show()
class ObstacleNodeDialog: def __init__(self, objt, environmentName, dupProperty, overridingEnvironment, builder): self.window = builder.get_object("ObstacleNodeDialog") b = Borg() self.dbProxy = b.dbProxy self.theEnvironmentName = environmentName self.theObstacleAssociation = None self.theObstacleId = -1 self.decorator = NDImplementationDecorator(builder) obstacleCategories = self.dbProxy.getDimensionNames("obstacle_category_type") self.obstacleAssociations = [] self.subObstacleAssociations = [] if objt == None: self.decorator.updateComboCtrl("obstacleCategoryCtrl", obstacleCategories, "") self.decorator.updateButtonLabel("obstacleOkButton", "Create") self.isCreate = True else: self.theObstacleId = objt.id() envProperty = objt.environmentProperty(self.theEnvironmentName) self.obstacleAssociations = envProperty.goalRefinements() self.subObstacleAssociations = envProperty.subGoalRefinements() self.decorator.updateTextCtrl("obstacleNameCtrl", objt.name()) self.decorator.updateComboCtrl( "obstacleCategoryCtrl", obstacleCategories, objt.category(environmentName, dupProperty) ) self.decorator.updateMLTextCtrl("obstacleDefinitionCtrl", objt.definition(environmentName, dupProperty)) self.decorator.updateButtonLabel("obstacleOkButton", "Update") self.isCreate = False self.window.resize(350, 600) def environmentProperties(self): obsCat = self.decorator.getComboValue("obstacleCategoryCtrl") obsDef = self.decorator.getMLText("obstacleDefinitionCtrl") envProperties = ObstacleEnvironmentProperties( self.theEnvironmentName, "", obsDef, obsCat, self.obstacleAssociations, self.subObstacleAssociations ) return envProperties def newObstacleParameters(self): obsName = self.decorator.getText("obstacleNameCtrl") envProperties = self.environmentProperties() parameters = ObstacleParameters(obsName, "Obstacle refinement", [], [envProperties]) parameters.setId(self.theObstacleId) return parameters def existingObstacleParameters(self): obsName = self.decorator.getText("obstacleNameCtrl") modifiedProperties = self.environmentProperties() envProperties = self.dbProxy.obstacleEnvironmentProperties(self.theObstacleId) for idx, p in enumerate(envProperties): if p.name() == self.theEnvironmentName: envProperties[idx] = modifiedProperties parameters = ObstacleParameters(obsName, "Obstacle refinement", [], envProperties) parameters.setId(self.theObstacleId) return parameters def parentObstacle(self, obsName, assocType): self.theObstacleAssociation = GoalAssociationParameters(self.theEnvironmentName, obsName, "obstacle", assocType) def on_obstacleOkButton_clicked(self, callback_data): if self.isCreate: parameters = self.newObstacleParameters() self.dbProxy.addObstacle(parameters) self.theObstacleAssociation.theSubGoal = parameters.name() self.theObstacleAssociation.theSubGoalDimension = "obstacle" self.theObstacleAssociation.theAlternativeId = 0 self.theObstacleAssociation.theRationale = "" self.dbProxy.addGoalAssociation(self.theObstacleAssociation) else: parameters = self.existingObstacleParameters() self.dbProxy.updateObstacle(parameters) self.window.destroy() def show(self): self.window.show()