Skip to content

Commit

Permalink
Fix #603
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed Jan 12, 2021
1 parent 9b94c86 commit ea7ed80
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6079,7 +6079,7 @@ begin
union
select -1,e.name,concat('Concerns usecase ',t.name),'usecaseconcern',0,'Association','1','','','1','Association',0,'asset',a.name,concat('Concerns use case ',t.name) from usecase_asset tc, usecase t, environment_asset ea, asset a, environment e where ea.environment_id = environmentId and ea.environment_id = tc.environment_id and ea.asset_id = tc.asset_id and tc.usecase_id = t.id and tc.asset_id = ea.asset_id and tc.asset_id = a.id and ea.environment_id = e.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
else
select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,a.rationale rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id
union
Expand Down Expand Up @@ -6109,7 +6109,7 @@ begin
union
select -1,e.name,va.name,'asset',1,'Dependency','1','<<safeguards>>','','1','Association',0,'asset',ma.name,'' rationale from asset ma, asset va, environment e, component_threat_target ctt, asset_threat at where ma.id = ctt.asset_id and ctt.threat_id = at.threat_id and at.asset_id = va.id and ctt.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and at.environment_id = environmentId and at.environment_id = e.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
end if;
end
//
Expand Down Expand Up @@ -6143,7 +6143,7 @@ begin
union
select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, multiplicity_type smt, asset ta, multiplicity_type tmt, environment e where ca.environment_id = environmentId and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
else
select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,'' rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id
union
Expand All @@ -6169,7 +6169,7 @@ begin
union
select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, multiplicity_type smt, asset ta, multiplicity_type tmt, environment e where ca.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, asset_tag at, task_asset ta, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
end if;
end
//
Expand Down Expand Up @@ -12650,7 +12650,7 @@ begin
union
select -1,he.name,ha.name,'asset',0,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,0,'asset',ta.name,concat('Concerns Security Pattern ',sp.name) rationale from securitypattern_classassociation a, environment he, environment te, asset ha, template_asset hta, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, template_asset tta, environment_asset hea, environment_asset tea, securitypattern_asset_template_asset hata, securitypattern_asset_template_asset tata,securitypattern sp where a.tail_id = assetId and hea.environment_id = environmentId and hea.environment_id = tea.environment_id and hea.environment_id = he.id and tea.environment_id = te.id and hea.asset_id = ha.id and tea.asset_id = ta.id and a.head_id = hta.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = tta.id and ha.id = hata.asset_id and hata.template_asset_id = hta.id and hata.pattern_id = sp.id and ta.id = tata.asset_id and tata.template_asset_id = tta.id and tata.pattern_id = sp.id and a.pattern_id = sp.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
else
insert into temp_classtree(id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale)
select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,a.rationale rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.head_id = assetId and a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id
Expand Down Expand Up @@ -12679,7 +12679,7 @@ begin
union
select -1,he.name,ha.name,'asset',0,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,0,'asset',ta.name,concat('Concerns Security Pattern ',sp.name) rationale from securitypattern_classassociation a, environment he, environment te, asset ha, template_asset hta, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, template_asset tta, environment_asset hea, environment_asset tea, securitypattern_asset_template_asset hata, securitypattern_asset_template_asset tata,securitypattern sp where a.tail_id = assetId and hea.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and hea.environment_id = tea.environment_id and hea.environment_id = he.id and tea.environment_id = te.id and hea.asset_id = ha.id and tea.asset_id = ta.id and a.head_id = hta.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = tta.id and ha.id = hata.asset_id and hata.template_asset_id = hta.id and hata.pattern_id = sp.id and ta.id = tata.asset_id and tata.template_asset_id = tta.id and tata.pattern_id = sp.id and a.pattern_id = sp.id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
end if;

select id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale from temp_classtree;
Expand Down Expand Up @@ -12725,7 +12725,7 @@ begin
union
select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, environment_asset sea, multiplicity_type smt, asset ta, environment_asset tea, multiplicity_type tmt, environment e where ca.environment_id = environmentId and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id and sa.id = sea.asset_id and sea.environment_id = ca.environment_id and ta.id = assetId and ta.id = tea.asset_id and tea.environment_id = ca.environment_id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
else
insert into temp_classtree(id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale)
select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,'' rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, environment_asset hea, environment_asset tea where a.head_id = assetId and a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id and ha.id = hea.asset_id and hea.environment_id = a.environment_id and ta.id = tea.asset_id and tea.environment_id = a.environment_id
Expand All @@ -12746,7 +12746,7 @@ begin
union
select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, environment_asset sea, multiplicity_type smt, asset ta, environment_asset tea, multiplicity_type tmt, environment e where ca.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id and sa.id = sea.asset_id and sea.environment_id = ca.environment_id and ta.id = assetId and ta.id = tea.asset_id and tea.environment_id = ca.environment_id
union
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id;
select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id;
end if;
select id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale from temp_classtree;
end
Expand Down

0 comments on commit ea7ed80

Please sign in to comment.