}
public ActionResult callAction(RemoteSession session, String dbKey, String actionID, String executionContext, List<Object> params, Form form) throws WGAServiceException {
try {
// Open db
WGDatabase db = retrieveAndOpenDB(session, dbKey);
// Test permissions
if (!mayCallAction(db, actionID)) {
throw new WGAServiceException("You are not permitted to call remote action '" + actionID + "'");
}
// Get root content and action
TMLContext context = new TMLContext(db.getDummyContent(db.getDefaultLanguage()), _core, null, null);
context.makeThreadMainContext();
TMLAction action = context.getActionByID(actionID, null);
if (action == null) {
throw new WGAServiceException("Undefined action: " + actionID);
}
// Calculate execution context
if (executionContext != null) {
context = context.context(executionContext, false);
if (context == null) {
throw new WGAServiceException("Unretrievable execution context: " + executionContext);
}
}
// Create TMLForm, if form information was issued
if (form != null) {
FormInfo formInfo = new FormInfo(form.getId(), false, false);
formInfo.setSource("none");
formInfo.setKeepOnValidate(false);
CSConfig csConfig = (CSConfig) db.getAttribute(WGACore.DBATTRIB_CSCONFIG);
if (csConfig != null) {
formInfo.setVersionCompliance(csConfig.getVersionCompliance());
}
de.innovationgate.wgpublisher.webtml.utils.TMLForm tmlForm = context.createform(formInfo);
tmlForm.importServicesForm(form);