Master Table, Backup
Master Table, Backup
Backs up the master information shared in the Workflow Platform by saving as it 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.
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 (click to open)

// GraalJS Script (engine type: 2)
/*
 Questetra BPMS V13.1 (released 2021-07-21)
 - 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

2021-07-29 (C) Questetra, Inc. (MIT License)
https://support.questetra.com/addons/master-table-backup-2021/
The Add-on import feature is available with Professional edition.

Notes

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

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.

See also

1 thought on “Master Table, Backup”

  1. Pingback: Master Table, Backup – Questetra Support

Comments are closed.

%d