Bonjour,
je remonte le topic pour l’intérêt d’avoir un hook initRefSelect directement dans l’enfant.
En faisant une revue de code pour effectuer la migration Rhino en Java, je suis tombée sur le cas suivant :
BCSIApplication.initRefSelect = function(parent) {
this.setSearchSpec(this.getDefaultSearchSpec());
var searchSpec = "1=1";
if (parent != null){
var parentName = parent.getName();
if (parentName == "BCSIAppLic") {
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSITechApp','BCSIDesktopApp','BCSIBusnFunctionality','BCSITechFunctionality','BCSIReusableComp','BCSIAppInstance','BCSIAppVersion')";
}
if (parentName == "BCSIProjApp" || parentName == "BCSIWorkPackage" || parentName == "BCSIWebSvc" || parentName == "BCSIAppWebSvc" ){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSITechApp','BCSIBusnFunctionality','BCSITechFunctionality','BCSIReusableComp','BCSIAppInstance','BCSIAppVersion')";
}
if (parentName == "BCSIFlow" || parentName =="BCSIAppSoftware"){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSITechApp','BCSIBusnFunctionality','BCSITechFunctionality','BCSIReusableComp','BCSIDesktopApp','BCSIAppInstance','BCSIAppVersion')";
}
if (parentName == "BCSIAppCotation"){
searchSpec="t.app_typo = 'BCSIBusnApp'";
}
if (parentName == "BCSIDataConceptUsage" || parentName == "BCSIDataConcept" || parentName == "BCSIAppProductPlatform"){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSITechApp','BCSIBusnFunctionality','BCSITechFunctionality')";
}
if (parentName == "BCSIDeployment"){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSIBusnFunctionality','BCSITechApp','BCSITechFunctionality','BCSIAppInstance','BCSIAppVersion')";
}
if (parentName == "BCSIAppScope"){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSIBusnFunctionality','BCSIAppInstance','BCSIAppVersion')";
}
if (parentName == "BCSIAppFunction"){
searchSpec="t.app_typo IN ('BCSIBusnApp','BCSIBusnFunctionality','BCSITechApp','BCSITechFunctionality','BCSIReusableComp','BCSIDesktopApp')";
}
if (parentName == "BCSIAppContractor" || parentName == "BCSIDataAppli"){
searchSpec="t.app_typo IN ('BCSIRegroupApp','BCSIBusnApp','BCSIBusnFunctionality','BCSITechApp','BCSIReusableComp','BCSIDesktopApp')";
}
if ( this.getGrant().hasResponsibility("BCSI-Security-ADMIN") && parent.getName().equals("BCSIAppPersonRMSSI") ) {
searchSpec="t.app_sub_type in ('RA','AM','FM','TE','IL','PO') and t.app_state in ('IN','ES','PR') and t.app_scope in ('RE','RN') and (t.app_it_support in ('DO','ES','HD') or t.app_it_support like 'ES%')";
} else
if ( this.getGrant().hasResponsibility("BCSI-Security-CONTRIB") && parent.getName().equals("BCSIAppPersonRMSSI") ){
if ( !this.getGrant().hasResponsibility("BCSICollect-Security-RMSSI-CONTRIB") && this.getGrant().hasResponsibility("BCSICollect-Security-RMSSIL-CONTRIB") ) {
// RMSSI local uniquement -> ne peut créer que des fiches RMSSIL pour applications locales
searchSpec="t.app_sub_type in ('RA','AM','FM','TE','IL','PO') and t.app_state in ('IN','ES','PR') and t.app_scope in ('RE','RN') and (t.app_it_support in ('DO','ES','HD') or t.app_it_support like 'ES%') and ("+
BCSIApplicationShared.localAppSQLBribe("BCSIApplication","")+
")";
} else if ( this.getGrant().hasResponsibility("BCSICollect-Security-RMSSI-CONTRIB") && !this.getGrant().hasResponsibility("BCSICollect-Security-RMSSIL-CONTRIB") ) {
// RMSSI central uniquement -> ne peut créer que des fiches RMSSI et RMSSIL pour applications centrales
searchSpec="t.app_sub_type in ('RA','AM','FM','TE','IL','PO') and t.app_state in ('IN','ES','PR') and t.app_scope in ('RE','RN') and (t.app_it_support in ('DO','ES','HD') or t.app_it_support like 'ES%') and ("+
BCSIApplicationShared.centralAppSQLBribe("BCSIApplication","")+
")";
} else if ( this.getGrant().hasResponsibility("BCSICollect-Security-RMSSI-CONTRIB") && this.getGrant().hasResponsibility("BCSICollect-Security-RMSSIL-CONTRIB") ) {
// RMSSI central et local -> peut créer des fiches sur applications RMSSI et RMSSIL centrales et locales
searchSpec="t.app_sub_type in ('RA','AM','FM','TE','IL','PO') and t.app_state in ('IN','ES','PR') and t.app_scope in ('RE','RN') and (t.app_it_support in ('DO','ES','HD') or t.app_it_support like 'ES%')";
} else {
// Ni RMSSI ni RMSSIL / Cas non censé se produire
console.log("[IN BCSIApplication.initRefSelect] STRANGE, NOT RMSSI or RMSSIL, SHOULD NOT OCCURS");
searchSpec="(1=0/*STRANGE, NOT RMSSI or RMSSIL, SHOULD NOT OCCURS*/)";
}
} else
if ( this.getGrant().hasResponsibility("BCSICollect-Security-ADMIN") && parent.getName().equals("BCSIAppPersonADA")){
searchSpec="t.app_sub_type in ('RA','AM','FM','TE','IL','PO') and t.app_state in ('IN','ES','PR') and t.app_scope in ('RE','RN') and (t.app_it_support in ('DO','ES','HD') or t.app_it_support like 'ES%')";
} else
if ( this.getGrant().hasResponsibility("BCSICollect-Security-CONTRIB") && parent.getName().equals("BCSIAppPersonADA")){
searchSpec="("+
"(exists (select 1 from bcsi_app_person ap where ap.app_person_app_id=t.row_id and "+wherePortfolioClause("RMSSI",this.getGrant())+"))"+
" OR "+
"(exists (select 1 from bcsi_app_person ap where ap.app_person_app_id=t.row_id and "+wherePortfolioClause("RMSSIL",this.getGrant())+"))"+
")";
}
if (parentName == "BCSIAppDatacateg" && parent.getSearchSpec().contains("BCSIHome-Security-ADMIN/BCSI-App-Status-INESPR-Datacateg")||parent.getName().equals("BCSIAppDatacateg_Home_ADMIN")){
searchSpec="(exists (select 1 from bcsi_app_person ap where ap.app_person_app_id=t.row_id and ap.app_person_role in ('RMSSI','RMSSIS','RMSSIL') ))";
}
if (parentName == "BCSIAppDatacateg" && parent.getSearchSpec().contains("BCSIHome-Security-CONTRIB/BCSI-App-Status-INESPR-Datacateg")||parent.getName().equals("BCSIAppDatacateg_Home_CONTRIB")){
searchSpec="("+
"(exists (select 1 from bcsi_app_person ap where ap.app_person_app_id=t.row_id and "+wherePortfolioClause("RMSSI",this.getGrant())+"))"+
" OR "+
"(exists (select 1 from bcsi_app_person ap where ap.app_person_app_id=t.row_id and "+wherePortfolioClause("RMSSIL",this.getGrant())+"))"+
"and (t.app_rmssi is null or t.app_rmssi='')"+
")";
}
if (parentName == "BCSIFamCoSurvey"){
searchSpec="(not exists (select 1 from bcsi_fam_co_survey famco where famco.fam_co_survey_app_id=t.row_id) and t.app_state in ('IN','ES','PR'))";
}
//BCSICompApp,BCSILicDem,BCSIAppPerson,BCSIDocument,
}
this.setSearchSpec(searchSpec + " " + "and t.app_state in ('IN','ES','PR')");
//console.log("[IN BCSIApplication.initRefSelect] this.getSearchSpec=<br/>"+this.getSearchSpec());
};
Je suis consciente que ce code n’est pas optimisé. Cela dit, il prouve que sur des objets centraux complexes, cela devient vite illisible.
Cordialement
Amandine T.