Last change
on this file since 14b648e was 4cec0a3, checked in by Vzdra <vladko.zdravkovski@…>, 3 years ago |
added response dto for job response
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[4cec0a3] | 1 | package it.finki.tinki.model.dto;
|
---|
| 2 |
|
---|
| 3 | import it.finki.tinki.model.Address;
|
---|
| 4 | import it.finki.tinki.model.Jobs.Job;
|
---|
| 5 | import it.finki.tinki.model.Users.Company;
|
---|
| 6 | import it.finki.tinki.model.Users.Team;
|
---|
| 7 | import it.finki.tinki.model.enumerator.AccountType;
|
---|
| 8 | import lombok.Data;
|
---|
| 9 |
|
---|
| 10 | @Data
|
---|
| 11 | public class JobResponseDTO {
|
---|
| 12 | Long id;
|
---|
| 13 | String title;
|
---|
| 14 | String description;
|
---|
| 15 | int salary;
|
---|
| 16 | String accountEmail;
|
---|
| 17 | String accountName;
|
---|
| 18 | AccountType accountType;
|
---|
| 19 | Address accountAddress;
|
---|
| 20 | int members;
|
---|
| 21 |
|
---|
| 22 | public JobResponseDTO(Job job){
|
---|
| 23 | this.id = job.getId();
|
---|
| 24 | this.title = job.getTitle();
|
---|
| 25 | this.description = job.getDescription();
|
---|
| 26 | this.salary = job.getSalary();
|
---|
| 27 | this.accountEmail = job.getAccount().getEmail();
|
---|
| 28 | this.accountName = job.getAccount().getName();
|
---|
| 29 | this.accountType = job.getAccount().getAccountType();
|
---|
| 30 | if(job.getAccount().getAccountType()==AccountType.COMPANY){
|
---|
| 31 | this.accountAddress = ((Company) job.getAccount()).getAddress();
|
---|
| 32 | this.members = 0;
|
---|
| 33 | }else{
|
---|
| 34 | this.members = ((Team) job.getAccount()).getMembers();
|
---|
| 35 | this.accountAddress = null;
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.