Master Table, Backup

Master Table, Backup
Master Table, Backup

Backups the master information shared in the Workflow Platform with saving as an Options-XML file. If the specified master name does not exist, an error will occur. To save as a different name, specify the backup file name.

2020-06-09 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/master-table-backup/

Configs
  • A: Set Name of Master (e.g. “foo.xml”) * #{EL}
  • B: Select FILE DATA for Master File (append) *
  • C: Set Backup File Name (e.g. “bar.xml”) #{EL}
Script
// Nashorn Script (engine type: 1)
/*
 Questetra BPMS V12.0 (released 2020-05-11)
 - configs.getObject()
 - engine.findData()
 - engine.setData()
*/

//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){ 

//// == Config Retrieving / 工程コンフィグの参照 ==
const strMasterName      = configs.get( "strSetConfA"  );      // required
const pocketBackupMaster = configs.getObject( "SelectConfB" ); // required
let   strSaveAs          = configs.get( "strSetConfC"  );      // not
if( strMasterName === "" ){
  throw new Error( "\n AutomatedTask ConfigError:" +
                   " Config {MasterFile Name A} is empty \n" );
}
if( strSaveAs === "" ){
  strSaveAs = strMasterName;
}


//// == Data Retrieving / ワークフローデータの参照 ==
let filesBackupMaster = engine.findData( pocketBackupMaster ); 
if( filesBackupMaster === null ){
  filesBackupMaster = new java.util.ArrayList();
  // java.util.ArrayList
  // - com.questetra.bpms.core.event.scripttask.QfileView
}


//// == Calculating / 演算 ==
const jarrOptions = itemDao.findAll( strMasterName, true );
// return "List<ItemView>" (java.util.ArrayList)
// 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
if( jarrOptions.size() - 0 === 0 ){
  throw new Error( "\n AutomatedTask UnexpectedOptionsXmlError:" +
                   strMasterName + " not found or null \n" );
}

engine.log( " AutomatedTask OptionsXML: " + 
            strMasterName + ": " +
            jarrOptions.size() + " options" );
let xmlBackup = '<?xml version="1.0" encoding="UTF-8"?><items>\n';
for( let i = 0; i < (jarrOptions.size() - 0); i++ ){
  xmlBackup += '<item value="';
  xmlBackup += jarrOptions.get(i).getValue();
  xmlBackup += '" display="';
  xmlBackup += jarrOptions.get(i).getDisplay();
  xmlBackup += '" />\n';
}
xmlBackup += "</items>";

filesBackupMaster.add(
  new com.questetra.bpms.core.event.scripttask.NewQfile(
    strSaveAs, "text/xml", xmlBackup
  )
);


//// == Data Updating / ワークフローデータへの代入 ==
engine.setData( pocketBackupMaster, filesBackupMaster ); // FILES

} //////// END "main()" /////////////////////////////////////////////////////////////////

Download

Capture

Backups the master information shared in the Workflow Platform with saving as an Options-XML file. If the specified master name does not exist, an error will occur. To save as a different name, specify the backup file name.

Notes

  1. M319: Register an Options-XML file to which the Process Model Definitions Refer

See also

1 thought on “Master Table, Backup”

  1. Pingback: Master Table, Update – Questetra Support

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top

Discover more from Questetra Support

Subscribe now to keep reading and get access to the full archive.

Continue reading