jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HttpsStatus is not being imported when importing from JDL

amatosg opened this issue · comments

Overview of the issue

When defining a relationship like JobHistory to Employee instead of JobHistory{employee} to Employee and importing it from a JDL file, the HttpsStatus object is not being imported:

if ("jobhistory-is-null".equals(filter)) {
        log.debug("REST request to get all Employees where jobHistory is null");
        return new HttpResponse<>(employeeService.findAllWhereJobHistoryIsNull(),
            HttpStatus.OK); 
}

I asume the import is from org.springframework.http.HttpStatus

Reproduce the error
JDL entity definitions
entity Region {
  regionName String
}
entity Country {
  countryName String
}
/**
 * not an ignored comment
 */
entity Location {
  streetAddress String,
  postalCode String,
  city String,
  stateProvince String
}
entity Department {
  departmentName String required
}
/**
 * Task entity.\n@author The JHipster team.
 */
entity Task {
  title String,
  description String
}
/**
 * The Employee entity.
 */
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String,
  lastName String,
  email String,
  phoneNumber String,
  hireDate Instant,
  salary Long,
  commissionPct Long
}
entity Job {
  jobTitle String,
  minSalary Long,
  maxSalary Long
}
entity JobHistory {
  startDate Instant,
  endDate Instant,
  language Language
}
enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region,
  Location{country} to Country,
  Department{location} to Location,
  JobHistory{job} to Job{jobHistory},
  JobHistory{department} to Department{jobHistory},
  JobHistory{employee} to Employee{jobHistory}
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to
  /**
   * Another side of the same relationship
   */
  Employee{department},
  Employee{job} to Job{employee}
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

dto Region, Country, Location, Department, Task, Employee, Job, JobHistory with mapstruct
paginate Region, Country, Location, Department, Task, Employee, Job, JobHistory with pagination
service Region, Country, Location, Department, Task, Employee, Job, JobHistory with serviceImpl

Related issues

None that I can find

Suggest a Fix

Add the proper import and return a valid response (currently employeeService.findAllWhereJobHistoryIsNull() returns a list instead of a page)

  • Checking this box is mandatory (this is just to show you read everything)

I tried creating a new app with the main branch. After doing this, I ran mvn verify. Compilation succeeds and tests pass, so I'm closing this. Please re-open if it still happens for you.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:44 min
[INFO] Finished at: 2024-02-21T16:58:21-07:00
[INFO] ------------------------------------------------------------------------