/** * @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; }
/** * @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; }