-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE 1843] Import/Export services #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/7.0.0
Are you sure you want to change the base?
Conversation
- added CaseExporter class - implementation of case export - work in progress
- added CaseImporter - added service CaseImportExportService and controller CaseImportExportController - added schema location to properties - functionality changes to CaseExporter - added full xsd schema to petriflow_schema.xsd for testing purposes - added new dependecy zip4j - work in progress
- service name typo fix
- changes to case import and export functionality - translations are now exported - import and export of roles removed - implementation of zip service added - work in progress on tests
- removal of unused dependency
src/main/java/com/netgrif/application/engine/workflow/domain/CaseExportFiles.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/archive/ZipService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/domain/CaseExportFiles.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExportImportService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExportImportService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExportImportService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExportImportService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExporter.java
Outdated
Show resolved
Hide resolved
src/main/java/com/netgrif/application/engine/workflow/service/CaseExporter.java
Outdated
Show resolved
Hide resolved
- CaseImportExportTest tests improved, added test net nae_1843.xml - added nae.case.export.file-name property - improved error handling - multiple bug fixes and small optimizations
src/test/groovy/com/netgrif/application/engine/workflow/CaseImportExportTest.groovy
Outdated
Show resolved
Hide resolved
src/test/groovy/com/netgrif/application/engine/workflow/CaseImportExportTest.groovy
Show resolved
Hide resolved
- PR comment changes
for (String fileName : field.right) { | ||
String filePath = storageService.getPath(caseId, storageField.getStringId(), fileName); | ||
InputStream fis = storageService.get(storageField, filePath); | ||
String newFileName = caseId.concat(File.separator).concat(storageField.getStringId()).concat(File.separator).concat(fileName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better than concatenating strings with File.separator will be to use Paths.get()
...
Paths.get(caseId, storageField.toString(), filename)
import lombok.Data; | ||
|
||
@Data | ||
public class CaseExportProperties { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a separate class? This class is used only in the properties bean.
@Slf4j | ||
@Data | ||
@Component | ||
@ConfigurationProperties(prefix = "nae.case") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is the bean for properties specifically for case import and export, the prefix should be unique nae.case.export
.
try { | ||
marshallCase(xmlCases); | ||
} catch (JAXBException e) { | ||
throw new RuntimeException(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please log the error even if it is rethrown right after. At least log.error(e.getMeesage(), e)
@RestController() | ||
@RequestMapping("/api/case") | ||
@AllArgsConstructor | ||
public class CaseImportExportController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency reasons, shouldn't there be two controllers? One is for export endpoints, and the other is for import endpoints.
<xs:include schemaLocation="https://petriflow.com/petriflow.schema.xsd"/> | ||
|
||
<!--todo use include after new schema is published--> | ||
<xs:element name="cases"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This schema should be in Petriflow project, and only reference should be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was meant as a temporary workaround for development purposes, schema will be referenced after updated version is released
- implemented changes requested by PR reviewers - CaseImportExportController split into 2 separate controller CaseExportController and CaseImportController - CaseExportFiles refactored to be more readable, added StorageFieldWithFileNames wrapper class - CaseImportExportProperties renamed to CaseImportProperties and removed redundant nested object
- refactor of importCasesWithFiles method to get rid of redundant database calls in saveFiles
For me, this draft PR looks good at the moment. I will come back once the tests and documentation are pushed |
Description
Implements NAE-1843
Dependencies
No new dependencies were introduced
Third party dependencies
No new dependencies were introduced
Blocking Pull requests
There are no dependencies on other PR
How Has Been This Tested?
Manually, unit tests are WIP
Test Configuration
Checklist: