Seminar 12 - Asynchronous Execution & CLI
Task 0: Update your repository
For this seminar, you will work with the same forked repository as previously. We assume you already have the upstream
remote set from Seminar 03 (if not, please follow task 0a from that seminar).
Task 0a: Update your main
branch
First, you need to fetch new changes from the upstream
repository and update your local main
branch:
git switch main
git pull upstream main
Then you need to update the main branch in your forked repository:
git push origin main
Task 0b: Create a new branch for this seminar
For the first time, the whole team will work on this task together in one branch:
git switch -c seminar-12
Task 1: Discover changes
Look at the project structure and try to understand what happened. Think about the impact. Could you tell why this is beneficial?
Task 2: Asynchronous import
This task is to add the asynchronicity to the import operation. In order to do so, a small refactoring of the import needed to be done.
Hint: to test the asynchronous execution you can use these datasets:
Or:
wget https://pv168.pages.fi.muni.cz/data/employees_1k.csv
wget https://pv168.pages.fi.muni.cz/data/employees_5k.csv
wget https://pv168.pages.fi.muni.cz/data/employees_10k.csv
Task 2.1: Study the asynchronous export
Look at the AsyncExporter
and ExportAction
classes. Could you explain why are those classes placed in the UI? Could you explain why this modification is correct?
Task 2.2: Implement asynchronous import
Get yourself inspired and implement the import operation in a similar way.
Task 3: List departments in CLI
Now lets focus on CLI and add there a new command.
To run the CLI application, you first need to build the whole project:
mvn clean package
And then you can run it like this:
java -jar ./employee-records-cli-app/target/employee-records-cli.jar list-employees
Hint: you can run the CLI application from the IDEA but you need to edit the run configuration, so you can specify the CLI arguments:
Task 3.1: Study ListEmployeesCommand
Look how the ListEmployeesCommand
class is implemented and how it is incorporated in the CLI application.
Task 3.2: Implement ListDepartmentsCommand
Get yourself inspired and implement the list departments command in a similar way.
Task 4: Add new department via CLI
Introduce new command for adding departments. It is up to you how the arguments will look like.
Task 4.1: Verify newly added department
Try both CLI and GUI to see that the department was added to the application and is available.