protected Map<String, byte[]> getPageResources(BusinessArchive businessArchive) { return businessArchive.getResources(REGEX); }
public ActorMapping getActorMapping() { return entity.getActorMapping(); }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final DesignProcessDefinition processDefinition = businessArchive.getProcessDefinition(); serializeProcessDefinition(barFolder, processDefinition); }
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); } }
@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); } } }
/** * @return * The BusinessArchive * @throws InvalidBusinessArchiveFormatException * when the business archive is inconsistent in the current state */ public BusinessArchive done() throws InvalidBusinessArchiveFormatException { if (entity.getProcessDefinition() == null) { throw new InvalidBusinessArchiveFormatException("missing process definition"); } final ArrayList<String> errors = new ArrayList<>(); for (final DocumentDefinition document : entity.getProcessDefinition().getProcessContainer().getDocumentDefinitions()) { if (document.getFile() != null && !document.getFile().isEmpty()) { final byte[] resources = entity.getResource("documents/" + document.getFile()); if (resources == null) { errors.add("missing document in the business archive that is present in the process definition " + document.getFile()); } } } if (!errors.isEmpty()) { throw new InvalidBusinessArchiveFormatException(errors); } return entity; }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final Map<String, String> parameters = businessArchive.getParameters(); if (parameters != null) { final Properties properties = new Properties(); for (final Entry<String, String> entry : parameters.entrySet()) { properties.put(entry.getKey(), entry.getValue() == null ? NULL : entry.getValue()); } final File file = new File(barFolder, PARAMETERS_FILE); PropertiesManager.saveProperties(properties, file); } }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Objects.requireNonNull(file); Objects.requireNonNull(attrs); businessArchive.addResource(barRootFolder.relativize(file).toString().replace(File.separator, "/"), IOUtil.getAllContentFrom(file.toFile())); resourcesCount++; return FileVisitResult.CONTINUE; }
public BusinessArchiveBuilder createNewBusinessArchive() { entity = new BusinessArchive(); return this; }
public BusinessArchiveBuilder setActorMapping(ActorMapping actorMapping) { entity.setActorMapping(actorMapping); return this; } }
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); } }
@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); } } }
/** * @return * The BusinessArchive * @throws InvalidBusinessArchiveFormatException * when the business archive is inconsistent in the current state */ public BusinessArchive done() throws InvalidBusinessArchiveFormatException { if (entity.getProcessDefinition() == null) { throw new InvalidBusinessArchiveFormatException("missing process definition"); } final ArrayList<String> errors = new ArrayList<>(); for (final DocumentDefinition document : entity.getProcessDefinition().getProcessContainer().getDocumentDefinitions()) { if (document.getFile() != null && !document.getFile().isEmpty()) { final byte[] resources = entity.getResource("documents/" + document.getFile()); if (resources == null) { errors.add("missing document in the business archive that is present in the process definition " + document.getFile()); } } } if (!errors.isEmpty()) { throw new InvalidBusinessArchiveFormatException(errors); } return entity; }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final Map<String, String> parameters = businessArchive.getParameters(); if (parameters != null) { final Properties properties = new Properties(); for (final Entry<String, String> entry : parameters.entrySet()) { properties.put(entry.getKey(), entry.getValue() == null ? NULL : entry.getValue()); } final File file = new File(barFolder, PARAMETERS_FILE); PropertiesManager.saveProperties(properties, file); } }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Objects.requireNonNull(file); Objects.requireNonNull(attrs); businessArchive.addResource(barRootFolder.relativize(file).toString().replace(File.separator, "/"), IOUtil.getAllContentFrom(file.toFile())); resourcesCount++; return FileVisitResult.CONTINUE; }
public BusinessArchiveBuilder createNewBusinessArchive() { entity = new BusinessArchive(); return this; }
public BusinessArchiveBuilder setActorMapping(ActorMapping actorMapping) { entity.setActorMapping(actorMapping); return this; } }
protected Map<String, byte[]> getPageResources(BusinessArchive businessArchive) { return businessArchive.getResources(REGEX); }
@Override public void saveToBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final DesignProcessDefinition processDefinition = businessArchive.getProcessDefinition(); serializeProcessDefinition(barFolder, processDefinition); }
public ActorMapping getActorMapping() { return entity.getActorMapping(); }