@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final FormMappingModel formMappingModel = businessArchive.getFormMappingModel(); try { final byte[] fileContent = new FormMappingModelMarshaller().serializeToXML(formMappingModel); final File file = new File(barFolder, FORM_MAPPING_FILE); IOUtil.write(file, fileContent); } catch (JAXBException | SAXException e) { throw new IOException("Cannot write Form Mapping Model to Bar folder", e); } } }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final FormMappingModel formMappingModel = businessArchive.getFormMappingModel(); try { final byte[] fileContent = new FormMappingModelMarshaller().serializeToXML(formMappingModel); final File file = new File(barFolder, FORM_MAPPING_FILE); IOUtil.write(file, fileContent); } catch (JAXBException | SAXException e) { throw new IOException("Cannot write Form Mapping Model to Bar folder", e); } } }
private void checkNoV6Forms(BusinessArchive businessArchive) throws SV6FormsDeployException { List<FormMappingDefinition> formMappings = businessArchive.getFormMappingModel().getFormMappings(); for (FormMappingDefinition formMapping : formMappings) { if (formMapping.getTarget() == LEGACY) { throw new SV6FormsDeployException("The process contains v6 forms"); } } }
private void checkNoV6Forms(BusinessArchive businessArchive) throws SV6FormsDeployException { List<FormMappingDefinition> formMappings = businessArchive.getFormMappingModel().getFormMappings(); for (FormMappingDefinition formMapping : formMappings) { if (formMapping.getTarget() == LEGACY) { throw new SV6FormsDeployException("The process contains v6 forms"); } } }
public void deployFormMappings(final BusinessArchive businessArchive, final long processDefinitionId) throws ProcessDeployException { final List<FormMappingDefinition> formMappings = businessArchive.getFormMappingModel().getFormMappings(); final FlowElementContainerDefinition flowElementContainer = businessArchive.getProcessDefinition().getFlowElementContainer(); final List<ActivityDefinition> activities = flowElementContainer.getActivities(); try { // Deals with human tasks declared in process definition: for (final ActivityDefinition activity : activities) { createFormMapping(processDefinitionId, formMappingService, formMappings, activity); } // Deals with the process start / process overview forms: createFormMapping(formMappingService, processDefinitionId, getFormMappingForType(formMappings, PROCESS_START), PROCESS_START.getId(), null); createFormMapping(formMappingService, processDefinitionId, getFormMappingForType(formMappings, PROCESS_OVERVIEW), PROCESS_OVERVIEW.getId(), null); } catch (final SObjectCreationException | SBonitaReadException e) { throw new ProcessDeployException(e); } }
public void deployFormMappings(final BusinessArchive businessArchive, final long processDefinitionId) throws ProcessDeployException { final List<FormMappingDefinition> formMappings = businessArchive.getFormMappingModel().getFormMappings(); final FlowElementContainerDefinition flowElementContainer = businessArchive.getProcessDefinition().getFlowElementContainer(); final List<ActivityDefinition> activities = flowElementContainer.getActivities(); try { // Deals with human tasks declared in process definition: for (final ActivityDefinition activity : activities) { createFormMapping(processDefinitionId, formMappingService, formMappings, activity); } // Deals with the process start / process overview forms: createFormMapping(formMappingService, processDefinitionId, getFormMappingForType(formMappings, PROCESS_START), PROCESS_START.getId(), null); createFormMapping(formMappingService, processDefinitionId, getFormMappingForType(formMappings, PROCESS_OVERVIEW), PROCESS_OVERVIEW.getId(), null); } catch (final SObjectCreationException | SBonitaReadException e) { throw new ProcessDeployException(e); } }
@Test public void formMappingInBarShouldBeWrittenAndReadProperly() throws Exception { final DesignProcessDefinition designProcessDefinition = new ProcessDefinitionBuilder().createNewInstance("MethCookingPlanning", "Season 5").done(); final FormMappingModel formMappingModel = new FormMappingModel(); formMappingModel.addFormMapping(new FormMappingDefinition("/?myPageTokenID", FormMappingType.PROCESS_START, FormMappingTarget.INTERNAL)); formMappingModel.addFormMapping(new FormMappingDefinition("someExternalPage", FormMappingType.TASK, FormMappingTarget.URL, "requestTask")); final BusinessArchive businessArchive = new BusinessArchiveBuilder().createNewBusinessArchive().setProcessDefinition(designProcessDefinition) .setFormMappings(formMappingModel).done(); BusinessArchiveFactory.writeBusinessArchiveToFile(businessArchive, barFile); final BusinessArchive readBusinessArchive = BusinessArchiveFactory.readBusinessArchive(barFile); assertThat(readBusinessArchive.getFormMappingModel().getFormMappings()).as("Form Mapping should be found in BusinessArchive").hasSize(2); }