@Override public Integer[] applyControlsToImpact(int riskType,CnATreeElement asset,Integer impactC,Integer impactI,Integer impactA){
  if (riskType == RISK_PRE_CONTROLS) {
    return null;
  }
  asset=Retriever.checkRetrieveLinks(asset,true);
  Map<CnATreeElement,CnALink> linkedElements=CnALink.getLinkedElements(asset,Control.TYPE_ID);
  Integer impactC0=Integer.valueOf(impactC.intValue());
  Integer impactI0=Integer.valueOf(impactI.intValue());
  Integer impactA0=Integer.valueOf(impactA.intValue());
switch (riskType) {
case RISK_WITH_IMPLEMENTED_CONTROLS:
    for (    CnATreeElement control : linkedElements.keySet()) {
      control=Retriever.checkRetrieveElement(control);
      if (Control.isImplemented(control.getEntity())) {
        impactC0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_C);
        impactI0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_I);
        impactA0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_A);
      }
    }
  break;
case RISK_WITH_ALL_CONTROLS:
for (CnATreeElement control : linkedElements.keySet()) {
  control=Retriever.checkRetrieveElement(control);
  impactC0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_C);
  impactI0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_I);
  impactA0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_A);
}
break;
case RISK_WITHOUT_NA_CONTROLS:
for (CnATreeElement control : linkedElements.keySet()) {
control=Retriever.checkRetrieveElement(control);
if (Control.isPlanned(control.getEntity())) {
impactC0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_C);
impactI0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_I);
impactA0-=control.getNumericProperty(IRiskAnalysisService.PROP_CONTROL_EFFECT_A);
}
}
break;
default :
break;
}
impactC0=(impactC0.intValue() < 0) ? Integer.valueOf(0) : impactC0;
impactI0=(impactI0.intValue() < 0) ? Integer.valueOf(0) : impactI0;
impactA0=(impactA0.intValue() < 0) ? Integer.valueOf(0) : impactA0;
return new Integer[]{impactC0,impactI0,impactA0};
}

@ Override public Integer [ ] applyControlsToImpact ( int riskType , CnATreeElement asset , Integer impactC , Integer impactI , Integer impactA ) { if ( riskType == RISK_PRE_CONTROLS ) { return null ; } asset = Retriever . checkRetrieveLinks ( asset , true ) ; Map < CnATreeElement , CnALink > linkedElements = CnALink . getLinkedElements ( asset , Control . TYPE_ID ) ; Integer impactC0 = Integer . valueOf ( impactC . intValue ( ) ) ; Integer impactI0 = Integer . valueOf ( impactI . intValue ( ) ) ; Integer impactA0 = Integer . valueOf ( impactA . intValue ( ) ) ; switch ( riskType ) { case RISK_WITH_IMPLEMENTED_CONTROLS : for ( CnATreeElement control : linkedElements . keySet ( ) ) { control = Retriever . checkRetrieveElement ( control ) ; if ( Control . isImplemented ( control . getEntity ( ) ) ) { impactC0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_C ) ; impactI0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_I ) ; impactA0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_A ) ; } } break ; case RISK_WITH_ALL_CONTROLS : for ( CnATreeElement control : linkedElements . keySet ( ) ) { control = Retriever . checkRetrieveElement ( control ) ; impactC0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_C ) ; impactI0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_I ) ; impactA0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_A ) ; } break ; case RISK_WITHOUT_NA_CONTROLS : for ( CnATreeElement control : linkedElements . keySet ( ) ) { control = Retriever . checkRetrieveElement ( control ) ; if ( Control . isPlanned ( control . getEntity ( ) ) ) { impactC0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_C ) ; impactI0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_I ) ; impactA0 -= control . getNumericProperty ( IRiskAnalysisService . PROP_CONTROL_EFFECT_A ) ; } } break ; default : break ; } impactC0 = ( impactC0 . intValue ( ) < 0 ) ? Integer . valueOf ( 0 ) : impactC0 ; impactI0 = ( impactI0 . intValue ( ) < 0 ) ? Integer . valueOf ( 0 ) : impactI0 ; impactA0 = ( impactA0 . intValue ( ) < 0 ) ? Integer . valueOf ( 0 ) : impactA0 ; return new Integer [ ] { impactC0 , impactI0 , impactA0 } ; }
reduce impact levels by all controls applied to this asset .
