// (c) 2019, Questetra, Inc. (the MIT License)
// Notes:
// id = value, label = display
//////// START "main()" ////////////////////////////////////////////////////////////////
main();
function main(){
//// == Config Retrieving / 工程コンフィグの参照 ==
const strId = configs.get( "conf_StrId" ) + ""; // config required
const optionsXml = configs.get( "conf_OptionsXml" ) + ""; // config required
const dataIdC = configs.get( "conf_DataIdC" ) + ""; // config required
engine.log( " AutomatedTask Config: ID String: " + strId );
engine.log( " AutomatedTask Config: OptionsXML: " + optionsXml );
if( strId === "" ){
throw new Error( "\n AutomatedTask ConfigError:" +
" Config {ID String} is empty \n" );
}
if( optionsXml === "" ){
throw new Error( "\n AutomatedTask ConfigError:" +
" Config {Options-XML} is empty \n" );
}
//// == Data Retrieving / ワークフローデータの参照 ==
// (nothing)
//// == Calculating / 演算 ==
const arrOptions = itemDao.findAll( optionsXml, true );
// return "List<ItemView>" (java.util.ArrayList)
// cf.
// M319: Register an Options-XML file to which the Process Model Definitions Refer
// M319: Options-XML: 複数の業務プロセス定義から参照される選択肢XML
// R2300 com.questetra.bpms.core.event.scripttask.ItemDaoWrapper
let strLabel = "";
const numArrOptionsLength = arrOptions.size() - 0; // Java Long to Javascript number
for( let i = 0; i < numArrOptionsLength; i++ ){
let tmpId = arrOptions.get(i).getValue() + ""; // Java String to Javascript string
if( tmpId === strId ){
strLabel = arrOptions.get(i).getDisplay() + ""; // Java String to Javascript string
break;
}
}
//// == Data Updating / ワークフローデータへの代入 ==
if( strLabel === "" ){
engine.log( " AutomatedTask StringWarning:" +
" {Decoded Label String} is empty" );
}
engine.setDataByNumber( dataIdC, strLabel );
} //////// END "main()" ////////////////////////////////////////////////////////////////