Skip to content

Commit

Permalink
Fix #159
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed Dec 5, 2017
1 parent ae7b425 commit ab5298f
Show file tree
Hide file tree
Showing 5 changed files with 371 additions and 291 deletions.
2 changes: 1 addition & 1 deletion cairis/core/MySQLDatabaseProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ def addGoalConcernAssociations(self,goalId,environmentName,associations):
self.addGoalConcernAssociation(goalId,environmentName,source,sourceMultiplicity,link,target,targetMultiplicity)

def addGoalConcernAssociation(self,goalId,environmentName,source,sourceMultiplicity,link,target,targetMultiplicity):
self.updateDatabase('call addGoalConcernAssociation(:gId,:env,:src,:sMulti,:link,:trgt,:tMulti)',{'gId':goalId,'env':environmentName,'src':source,'sMulti':sourceMultiplicity,'linl':link,'trgt':target,'tMulti':targetMultiplicity},'MySQL error adding goal concern association')
self.updateDatabase('call addGoalConcernAssociation(:gId,:env,:src,:sMulti,:link,:trgt,:tMulti)',{'gId':goalId,'env':environmentName,'src':source,'sMulti':sourceMultiplicity,'link':link,'trgt':target,'tMulti':targetMultiplicity},'MySQL error adding goal concern association')

def addTaskConcernAssociations(self,taskId,environmentName,associations):
for source,sourceMultiplicity,link,target,targetMultiplicity in associations:
Expand Down
12 changes: 6 additions & 6 deletions cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8888,7 +8888,7 @@ create procedure goalRefinements(in goalId int, in environmentId int)
begin
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'goal' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal tg where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,concat(a.short_code,'-',tg.label) subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.asset_id = a.id
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.asset_id = a.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'task' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goaltask_goalassociation ga, environment e, goal hg, reference_type rt, task tg where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
Expand All @@ -8898,7 +8898,7 @@ begin
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'usecase' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalusecase_goalassociation ga, environment e, goal hg, reference_type rt, usecase tg where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,concat(a.short_code,'-',tg.label) subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.environment_id = a.id
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.environment_id = a.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goaldomainproperty_goalassociation ga, environment e, goal hg, reference_type rt, domainproperty tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
union
Expand All @@ -8916,17 +8916,17 @@ begin
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name,'vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
union
select ga.id id,e.name environment,concat(a.short_code,'-',hg.label) goal_name,'requirement' subgoal_dim,rt.name ref_type,tg.name subgoal_name,'obstacle' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from requirementobstacle_goalassociation ga, environment e, requirement hg, reference_type rt, obstacle tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and hg.version = (select max(i.version) from requirement i where i.id = hg.id) and ga.environment_id = e.id and ga.goal_id = ar.requirement_id and ar.asset_id = a.id
select ga.id id,e.name environment,hg.name goal_name,'requirement' subgoal_dim,rt.name ref_type,tg.name subgoal_name,'obstacle' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from requirementobstacle_goalassociation ga, environment e, requirement hg, reference_type rt, obstacle tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and hg.version = (select max(i.version) from requirement i where i.id = hg.id) and ga.environment_id = e.id and ga.goal_id = ar.requirement_id and ar.asset_id = a.id
union
select ga.id id,e.name environment,concat(a.short_code,'-',hg.label) goal_name,'requirement' subgoal_dim,rt.name ref_type,tg.name subgoal_name,'obstacle' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from requirementobstacle_goalassociation ga, environment e, requirement hg, reference_type rt, obstacle tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and hg.version = (select max(i.version) from requirement i where i.id = hg.id) and ga.environment_id = e.id and ga.goal_id = ar.requirement_id and ar.environment_id = a.id;
select ga.id id,e.name environment,hg.name goal_name,'requirement' subgoal_dim,rt.name ref_type,tg.name subgoal_name,'obstacle' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from requirementobstacle_goalassociation ga, environment e, requirement hg, reference_type rt, obstacle tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = goalId and ga.subgoal_id = tg.id and hg.version = (select max(i.version) from requirement i where i.id = hg.id) and ga.environment_id = e.id and ga.goal_id = ar.requirement_id and ar.environment_id = a.id;
end
//

create procedure subGoalRefinements(in goalId int, in environmentId int)
begin
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'goal' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal tg where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,concat(a.short_code,'-',tg.label) subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.asset_id = a.id
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, asset_requirement ar, asset a where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.asset_id = a.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'task' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goaltask_goalassociation ga, environment e, goal hg, reference_type rt, task tg where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
Expand All @@ -8936,7 +8936,7 @@ begin
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'usecase' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalusecase_goalassociation ga, environment e, goal hg, reference_type rt, usecase tg where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,concat(a.short_code,'-',tg.label) subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.environment_id = a.id
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'requirement' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalrequirement_goalassociation ga, environment e, goal hg, reference_type rt, requirement tg, environment_requirement ar, environment a where ga.environment_id = environmentId and ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and tg.version = (select max(i.version) from requirement i where i.id = tg.id) and ga.environment_id = e.id and tg.id = ar.requirement_id and ar.environment_id = a.id
union
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goaldomainproperty_goalassociation ga, environment e, goal hg, reference_type rt, domainproperty tg where ga.goal_id = goalId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
union
Expand Down
Loading

0 comments on commit ab5298f

Please sign in to comment.