[R1] Add java doc
This commit is contained in:
parent
e7034a9236
commit
51f83b3bda
@ -26,7 +26,15 @@ public class DoctorController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DoctorService doctorService;
|
private DoctorService doctorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post method to create a new Doctor object based on the provided DTO.
|
||||||
|
*
|
||||||
|
* @param doctorDTO The data transfer object containing data for Doctor
|
||||||
|
* entity.
|
||||||
|
*
|
||||||
|
* @return A response entity containing the saved doctor if successful, or
|
||||||
|
* a 400-level error if there is a validation error
|
||||||
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseEntity<Object> postDoctor(@RequestBody @Valid DoctorDTO doctorDTO) {
|
public ResponseEntity<Object> postDoctor(@RequestBody @Valid DoctorDTO doctorDTO) {
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,12 @@ package com.mirna.hospitalmanagementapi.domain.dtos;
|
|||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data transfer object used to transfer data that will be saved in a Address entity
|
||||||
|
*
|
||||||
|
* @author Mirna Gama
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public record AddressDTO(
|
public record AddressDTO(
|
||||||
|
|
||||||
@NotBlank(message="street cannot be blank")
|
@NotBlank(message="street cannot be blank")
|
||||||
|
|||||||
@ -8,6 +8,12 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data transfer object used to transfer data that will be saved in a Doctor entity
|
||||||
|
*
|
||||||
|
* @author Mirna Gama
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public record DoctorDTO(
|
public record DoctorDTO(
|
||||||
|
|
||||||
@NotBlank(message="name cannot be blank")
|
@NotBlank(message="name cannot be blank")
|
||||||
|
|||||||
@ -4,6 +4,11 @@ import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
|
|||||||
|
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Mirna Gama
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public class Address {
|
public class Address {
|
||||||
|
|
||||||
@ -29,58 +34,115 @@ public class Address {
|
|||||||
private String additionalDetails;
|
private String additionalDetails;
|
||||||
private String houseNumber;
|
private String houseNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the street
|
||||||
|
* @return A string representing the street.
|
||||||
|
*/
|
||||||
public String getStreet() {
|
public String getStreet() {
|
||||||
return street;
|
return street;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the street
|
||||||
|
* @param street Must not be blank.
|
||||||
|
*/
|
||||||
public void setStreet(String street) {
|
public void setStreet(String street) {
|
||||||
this.street = street;
|
this.street = street;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the neighborhood
|
||||||
|
* @return A string representing the neighborhood.
|
||||||
|
*/
|
||||||
public String getNeighborhood() {
|
public String getNeighborhood() {
|
||||||
return neighborhood;
|
return neighborhood;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the neighborhood
|
||||||
|
* @param neighborhood Must not be blank.
|
||||||
|
*/
|
||||||
public void setNeighborhood(String neighborhood) {
|
public void setNeighborhood(String neighborhood) {
|
||||||
this.neighborhood = neighborhood;
|
this.neighborhood = neighborhood;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the zip code
|
||||||
|
* @return A string representing the zip code.
|
||||||
|
*/
|
||||||
public String getZipCode() {
|
public String getZipCode() {
|
||||||
return zipCode;
|
return zipCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the zip code
|
||||||
|
* @param zipCode Must not be blank.
|
||||||
|
*/
|
||||||
public void setZipCode(String zipCode) {
|
public void setZipCode(String zipCode) {
|
||||||
this.zipCode = zipCode;
|
this.zipCode = zipCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the city
|
||||||
|
* @return A string representing the city.
|
||||||
|
*/
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return city;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the city
|
||||||
|
* @param city Must not be blank.
|
||||||
|
*/
|
||||||
public void setCity(String city) {
|
public void setCity(String city) {
|
||||||
this.city = city;
|
this.city = city;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state
|
||||||
|
* @return A string representing the state.
|
||||||
|
*/
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state
|
||||||
|
* @param state Must not be blank.
|
||||||
|
*/
|
||||||
public void setState(String state) {
|
public void setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the additional details
|
||||||
|
* @return A string representing the additional details.
|
||||||
|
*/
|
||||||
public String getAdditionalDetails() {
|
public String getAdditionalDetails() {
|
||||||
return additionalDetails;
|
return additionalDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the additional details
|
||||||
|
* @param additionalDetails Not required
|
||||||
|
*/
|
||||||
public void setAdditionalDetails(String additionalDetails) {
|
public void setAdditionalDetails(String additionalDetails) {
|
||||||
this.additionalDetails = additionalDetails;
|
this.additionalDetails = additionalDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the house number
|
||||||
|
* @return A string representing the house number.
|
||||||
|
*/
|
||||||
public String getHouseNumber() {
|
public String getHouseNumber() {
|
||||||
return houseNumber;
|
return houseNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the house number
|
||||||
|
* @param houseNumber Not required
|
||||||
|
*/
|
||||||
public void setHouseNumber(String houseNumber) {
|
public void setHouseNumber(String houseNumber) {
|
||||||
this.houseNumber = houseNumber;
|
this.houseNumber = houseNumber;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,11 @@ import jakarta.persistence.GenerationType;
|
|||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Mirna Gama
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
@Table(name="doctors")
|
@Table(name="doctors")
|
||||||
@Entity(name="Doctor")
|
@Entity(name="Doctor")
|
||||||
public class Doctor {
|
public class Doctor {
|
||||||
@ -38,58 +43,116 @@ public class Doctor {
|
|||||||
@Embedded
|
@Embedded
|
||||||
private Address address;
|
private Address address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the doctor id.
|
||||||
|
* @return A Long representing the doctor id.
|
||||||
|
*/
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the doctor id.
|
||||||
|
* @param id The doctor's unique identifier.
|
||||||
|
*/
|
||||||
public void setId(Long id) {
|
public void setId(Long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name
|
||||||
|
* @return A string representing the doctor's name.
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name
|
||||||
|
* @param name Must not be blank.
|
||||||
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the email
|
||||||
|
* @return A string representing the doctor's email.
|
||||||
|
*/
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the email
|
||||||
|
* @param email Must not be blank.
|
||||||
|
*/
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the crm
|
||||||
|
* @return A string representing the doctor's crm.
|
||||||
|
*/
|
||||||
public String getCrm() {
|
public String getCrm() {
|
||||||
return crm;
|
return crm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the crm
|
||||||
|
* @param crn Must not be blank.
|
||||||
|
*/
|
||||||
public void setCrm(String crm) {
|
public void setCrm(String crm) {
|
||||||
this.crm = crm;
|
this.crm = crm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the telephone
|
||||||
|
* @return A string representing the doctor's telephone.
|
||||||
|
*/
|
||||||
public String getTelephone() {
|
public String getTelephone() {
|
||||||
return telephone;
|
return telephone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the telephone
|
||||||
|
* @param telephone Must not be blank.
|
||||||
|
*/
|
||||||
public void setTelephone(String telephone) {
|
public void setTelephone(String telephone) {
|
||||||
this.telephone = telephone;
|
this.telephone = telephone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the speciality
|
||||||
|
* @return An enum class representing the doctor's speciality.
|
||||||
|
* @see Speciality
|
||||||
|
*/
|
||||||
public Speciality getSpeciality() {
|
public Speciality getSpeciality() {
|
||||||
return speciality;
|
return speciality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the speciality
|
||||||
|
* @param speciality Must not be null.
|
||||||
|
*/
|
||||||
public void setSpeciality(Speciality speciality) {
|
public void setSpeciality(Speciality speciality) {
|
||||||
this.speciality = speciality;
|
this.speciality = speciality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the address
|
||||||
|
* @return An object class representing the doctor's address.
|
||||||
|
* @see Address
|
||||||
|
*/
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the address
|
||||||
|
* @param address Must not be null.
|
||||||
|
*/
|
||||||
public void setAddress(Address address) {
|
public void setAddress(Address address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user