use of org.apache.xmlbeans.XmlException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method skipActivity.
public void skipActivity(Long activityId, Long activityInstId, String compCode) throws DataAccessException, XmlException, IOException {
if (currentServer.isSchemaVersion61()) {
((RestfulServer) currentServer).skipActivityInstance(activityInstId, ActivityResultCodeConstant.RESULT_PROCEED, compCode);
} else {
String request = currentServer.buildSkipActivityInstanceRequest(activityId, activityInstId, compCode, false);
String response = this.engineCall(request);
try {
String result = currentServer.getErrorMessageFromResponse(response);
if (result == null || result.length() > 0)
throw new RemoteException(result);
auditLog(Action.Proceed, Entity.ActivityInstance, activityInstId, compCode);
} catch (XmlException e) {
throw new DataAccessException("Response is not an MDWStatusMessage");
}
}
}
use of org.apache.xmlbeans.XmlException in project mdw-designer by CenturyLinkCloud.
the class RuntimeDataAccessRest method deleteProcessInstances.
public int deleteProcessInstances(List<Long> processInstanceIds) throws DataAccessException {
try {
List<ProcessInstanceVO> instances = new ArrayList<ProcessInstanceVO>();
for (Long id : processInstanceIds) instances.add(new ProcessInstanceVO(id));
ProcessList processList = new ProcessList(ProcessList.PROCESS_INSTANCES, instances);
if (getServer().getSchemaVersion() >= 6000) {
try {
getServer().delete("Processes", processList.getJson().toString(2));
} catch (IOException ex) {
throw new DataAccessOfflineException("Unable to connect to " + getServer().getServiceUrl(), ex);
}
} else {
ActionRequestMessage actionRequest = new ActionRequestMessage();
actionRequest.setAction("DeleteProcessInstances");
actionRequest.addParameter("appName", "MDW Designer");
JSONObject msgJson = actionRequest.getJson();
msgJson.put(processList.getJsonName(), processList.getJson());
invokeActionService(msgJson.toString(2));
}
return processList.getCount();
} catch (XmlException ex) {
throw new DataAccessException(ex.getMessage(), ex);
} catch (JSONException ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
use of org.apache.xmlbeans.XmlException in project mdw-designer by CenturyLinkCloud.
the class NewTaskTemplateWizard method performFinish.
@Override
public boolean performFinish() {
TaskTemplate taskTemplate = (TaskTemplate) getWorkflowAsset();
try {
TaskTemplateDocument doc;
if (isImportFile()) {
// load from selected file
doc = TaskTemplateDocument.Factory.parse(new File(getImportFilePath()));
com.centurylink.mdw.task.TaskTemplate template = doc.getTaskTemplate();
// selection)
if (template.getLogicalId() == null)
throw new XmlException("Task template missing logicalId");
else if (template.getCategory() == null)
throw new XmlException("Task template missing category");
else if (template.getName() == null || template.getName().isEmpty())
throw new XmlException("Task template missing name");
} else {
doc = TaskTemplateDocument.Factory.newInstance();
com.centurylink.mdw.task.TaskTemplate template = doc.addNewTaskTemplate();
String taskName = taskTemplate.getName().substring(0, taskTemplate.getName().length() - 5);
template.setLogicalId(taskName.replace(' ', '_'));
template.setCategory("GEN");
template.setName(taskName);
if ("AUTOFORM".equals(taskTemplate.getLanguage())) {
Attribute form = template.addNewAttribute();
form.setName("FormName");
form.setStringValue("Autoform");
}
}
XmlOptions xmlOptions = new XmlOptions().setSaveAggressiveNamespaces();
xmlOptions.setSavePrettyPrint().setSavePrettyPrintIndent(2);
taskTemplate.setContent(doc.xmlText(xmlOptions));
String templateName = taskTemplate.getName();
taskTemplate.setTaskVO(new TaskVO(doc.getTaskTemplate()));
taskTemplate.setName(templateName);
taskTemplate.getTaskVO().setPackageName(taskTemplate.getPackage().getName());
DesignerProxy designerProxy = taskTemplate.getProject().getDesignerProxy();
designerProxy.createNewTaskTemplate(taskTemplate);
if (designerProxy.getRunnerStatus().equals(RunnerStatus.SUCCESS)) {
taskTemplate.openFile(new NullProgressMonitor());
taskTemplate.addElementChangeListener(taskTemplate.getProject());
taskTemplate.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, taskTemplate);
taskTemplate.setVersion(1);
taskTemplate.fireElementChangeEvent(ChangeType.VERSION_CHANGE, taskTemplate);
DesignerPerspective.promptForShowPerspective(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), taskTemplate);
return true;
} else {
return false;
}
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Create " + taskTemplate.getTitle(), taskTemplate.getProject());
return false;
}
}
use of org.apache.xmlbeans.XmlException in project carbon-business-process by wso2.
the class BPELServerConfiguration method loadBPELServerConfigurationFile.
private void loadBPELServerConfigurationFile() {
String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath();
String bpsConfigPath = carbonConfigDirPath + File.separator + BPELConstants.BPEL_CONFIGURATION_FILE_NAME;
File bpsConfigFile = new File(bpsConfigPath);
if (!bpsConfigFile.exists()) {
log.warn("Cannot find BPEL configuration file: " + bpsConfigPath + " Default values are used.");
return;
}
try {
this.bpsConfigDocument = WSO2BPSDocument.Factory.parse(bpsConfigFile);
populateFields();
} catch (XmlException e) {
String errMsg = "BPS configuration parsing exception. " + BPELConstants.BPEL_CONFIGURATION_FILE_NAME + " can be found at " + bpsConfigPath;
log.error(errMsg);
throw new RuntimeException(errMsg, e);
} catch (IOException e) {
String errMsg = "Error reading bps configuration file." + BPELConstants.BPEL_CONFIGURATION_FILE_NAME + " can be found at " + bpsConfigPath;
log.error(errMsg);
throw new RuntimeException(errMsg, e);
}
}
use of org.apache.xmlbeans.XmlException in project sw360portal by sw360.
the class DocxGenerator method generateOutputFile.
@Override
public byte[] generateOutputFile(Collection<LicenseInfoParsingResult> projectLicenseInfoResults, String projectName, String projectVersion, String licenseInfoHeaderText) throws SW360Exception {
ByteArrayOutputStream docxOutputStream = new ByteArrayOutputStream();
Optional<byte[]> docxTemplateFile = CommonUtils.loadResource(DocxGenerator.class, DOCX_TEMPLATE_FILE);
if (docxTemplateFile.isPresent()) {
try {
XWPFDocument xwpfDocument = new XWPFDocument(new ByteArrayInputStream(docxTemplateFile.get()));
switch(getOutputVariant()) {
case DISCLOSURE:
fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, false);
break;
case REPORT:
fillDocument(xwpfDocument, projectLicenseInfoResults, projectName, projectVersion, licenseInfoHeaderText, true);
break;
default:
throw new IllegalArgumentException("Unknown generator variant type: " + getOutputVariant());
}
xwpfDocument.write(docxOutputStream);
docxOutputStream.close();
} catch (XmlException e) {
throw new SW360Exception("Got XmlException while generating docx document: " + e.getMessage());
} catch (IOException e) {
throw new SW360Exception("Got IOException when generating docx document: " + e.getMessage());
} catch (TException e) {
throw new SW360Exception("Error reading sw360 licenses: " + e.getMessage());
}
return docxOutputStream.toByteArray();
} else {
throw new SW360Exception("Could not load the template for xwpf document: " + DOCX_TEMPLATE_FILE);
}
}
Aggregations