├── Microservices ├── hospital │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ ├── application.properties │ │ │ │ └── services.properties │ │ │ └── java │ │ │ │ └── lk │ │ │ │ └── himash │ │ │ │ └── hospital │ │ │ │ ├── dto │ │ │ │ ├── PostDto.java │ │ │ │ ├── TodoDto.java │ │ │ │ ├── PostUserDto.java │ │ │ │ ├── Response.java │ │ │ │ ├── DoctorDto.java │ │ │ │ └── PatientDto.java │ │ │ │ ├── HospitalApplication.java │ │ │ │ ├── service │ │ │ │ ├── TodoService.java │ │ │ │ ├── PostService.java │ │ │ │ ├── DoctorService.java │ │ │ │ ├── PatientService.java │ │ │ │ └── serviceImpl │ │ │ │ │ ├── DoctorServiceImpl.java │ │ │ │ │ ├── TodoServiceImpl.java │ │ │ │ │ ├── PostServiceImpl.java │ │ │ │ │ └── PatientServiceImpl.java │ │ │ │ ├── util │ │ │ │ └── PropertyFileReader.java │ │ │ │ └── controller │ │ │ │ ├── TodoController.java │ │ │ │ ├── PostController.java │ │ │ │ ├── DoctorController.java │ │ │ │ └── PatientController.java │ │ └── test │ │ │ └── java │ │ │ └── lk │ │ │ └── himash │ │ │ └── hospital │ │ │ └── HospitalApplicationTests.java │ ├── HELP.md │ ├── pom.xml │ ├── mvnw.cmd │ └── mvnw ├── Services │ ├── patient │ │ ├── patientDB.sql │ │ ├── src │ │ │ ├── test │ │ │ │ └── java │ │ │ │ │ └── lk │ │ │ │ │ └── himash │ │ │ │ │ └── patient │ │ │ │ │ └── PatientApplicationTests.java │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── lk │ │ │ │ │ └── himash │ │ │ │ │ └── patient │ │ │ │ │ ├── PatientApplication.java │ │ │ │ │ ├── util │ │ │ │ │ ├── Response.java │ │ │ │ │ ├── PatientDto.java │ │ │ │ │ └── EntityConversion.java │ │ │ │ │ ├── service │ │ │ │ │ ├── PatientService.java │ │ │ │ │ └── serviceImpl │ │ │ │ │ │ └── PatientServiceImpl.java │ │ │ │ │ ├── model │ │ │ │ │ └── Patient.java │ │ │ │ │ ├── repository │ │ │ │ │ └── PatientRepository.java │ │ │ │ │ └── controller │ │ │ │ │ └── PatientController.java │ │ │ │ └── resources │ │ │ │ └── application.properties │ │ ├── HELP.md │ │ ├── pom.xml │ │ ├── mvnw.cmd │ │ ├── patient.iml │ │ └── mvnw │ └── doctor │ │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ └── java │ │ │ │ └── lk │ │ │ │ └── himash │ │ │ │ └── doctor │ │ │ │ ├── DoctorApplication.java │ │ │ │ ├── util │ │ │ │ ├── Response.java │ │ │ │ ├── DoctorDto.java │ │ │ │ └── EntityConversion.java │ │ │ │ ├── service │ │ │ │ ├── DoctorService.java │ │ │ │ └── serivceImpl │ │ │ │ │ └── DoctorServiceImpl.java │ │ │ │ ├── repository │ │ │ │ └── DoctorRepository.java │ │ │ │ ├── model │ │ │ │ └── Doctor.java │ │ │ │ └── controller │ │ │ │ └── DoctorController.java │ │ └── test │ │ │ └── java │ │ │ └── lk │ │ │ └── himash │ │ │ └── doctor │ │ │ └── DoctorApplicationTests.java │ │ ├── HELP.md │ │ ├── Doctor.json │ │ ├── pom.xml │ │ ├── mvnw.cmd │ │ ├── doctor.iml │ │ └── mvnw └── Config.txt └── README.md /Microservices/hospital/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8093 2 | -------------------------------------------------------------------------------- /Microservices/Services/patient/patientDB.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/himash79/Spring-Boot-with-Reactive-Programming/HEAD/Microservices/Services/patient/patientDB.sql -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8090 2 | 3 | spring.data.mongodb.database=Doctor_Databse 4 | spring.data.mongodb.port=27017 5 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/test/java/lk/himash/doctor/DoctorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DoctorApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/hospital/src/test/java/lk/himash/hospital/HospitalApplicationTests.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class HospitalApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/test/java/lk/himash/patient/PatientApplicationTests.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PatientApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/DoctorApplication.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class DoctorApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(DoctorApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/PostDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class PostDto { 11 | 12 | private String userId; 13 | private String id; 14 | private String title; 15 | private String body; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/HospitalApplication.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class HospitalApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(HospitalApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/TodoDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class TodoDto { 11 | 12 | private String userId; 13 | private String id; 14 | private String title; 15 | private String completed; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/PatientApplication.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class PatientApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(PatientApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8091 2 | 3 | spring.datasource.url=jdbc:postgresql://localhost:5432/patientdb 4 | spring.datasource.username=postgres 5 | spring.datasource.password=PASSWORD 6 | 7 | spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true 8 | spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect 9 | 10 | spring.jpa.hibernate.ddl-auto= update 11 | 12 | 13 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/util/Response.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.http.HttpStatus; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class Response { 12 | 13 | private HttpStatus httpStatus; 14 | private Object obj; 15 | private String msg; 16 | } 17 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/TodoService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service; 2 | 3 | import lk.himash.hospital.dto.Response; 4 | import lk.himash.hospital.dto.TodoDto; 5 | 6 | public interface TodoService { 7 | 8 | Response getAllTodos(); 9 | Response getTodo(String id); 10 | Response addTodo(TodoDto todoDto); 11 | Response removeTodo(String id); 12 | Response editTodoDetail(TodoDto todoDto, String id); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/util/Response.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.http.HttpStatus; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class Response { 12 | 13 | private HttpStatus httpStatus; 14 | private Object obj; 15 | private String msg; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/PostUserDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class PostUserDto { 11 | 12 | private String postId; 13 | private String id; 14 | private String name; 15 | private String email; 16 | private String body; 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Microservices/Config.txt: -------------------------------------------------------------------------------- 1 | 01) Configure the Doctor service DB. 2 | 01) Import Doctor.json file to MongoDB. 3 | 4 | 02) Configure the Patient service DB. 5 | 01) Import the Patient.sql file to Postgresql. 6 | 7 | 03) Open the project Doctor, Patient and hospital project directories and run below command. 8 | 01) mvn clean install 9 | or 10 | 02) Import prefer IDE to auto cofigure to the projects. 11 | 12 | 04) Expose the API using prefer Rest Client (Postman or Insomnia). -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/Response.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class Response { 13 | 14 | private HttpStatus httpStatus; 15 | private Object obj; 16 | private String msg; 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/DoctorDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class DoctorDto { 11 | 12 | private String _id; 13 | private String first_name; 14 | private String last_name; 15 | private String age; 16 | private String marital_status; 17 | private String state; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/PostService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service; 2 | 3 | import lk.himash.hospital.dto.PostDto; 4 | import lk.himash.hospital.dto.Response; 5 | 6 | public interface PostService { 7 | 8 | Response getAllPosts(); 9 | Response getPost(String id); 10 | Response getRelatedPostComments(String id, String value); 11 | Response addPost(PostDto postDto); 12 | Response removePost(String id); 13 | Response editPost(PostDto postDto, String id); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/util/DoctorDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class DoctorDto { 11 | 12 | private String _id; 13 | private String first_name; 14 | private String last_name; 15 | private String age; 16 | private String marital_status; 17 | private String state; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/dto/PatientDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class PatientDto { 11 | 12 | private String patient_id; 13 | private String first_name; 14 | private String last_name; 15 | private String age; 16 | private String marital_status; 17 | private String state; 18 | private String disease; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/DoctorService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service; 2 | 3 | import lk.himash.hospital.dto.DoctorDto; 4 | import lk.himash.hospital.dto.Response; 5 | 6 | public interface DoctorService { 7 | 8 | Response getAllDocDetails(); 9 | Response getDocDetails(String id); 10 | Response AddDoctor(DoctorDto doctorDto); 11 | Response removeDoctor(String id); 12 | Response editDocDetails(DoctorDto doctorDto, String id); 13 | Response getDocByMaritalStatus(String param); 14 | Response getDocByName(String param); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/PatientService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service; 2 | 3 | import lk.himash.hospital.dto.PatientDto; 4 | import lk.himash.hospital.dto.Response; 5 | 6 | public interface PatientService { 7 | 8 | Response getAllPatientDetails(); 9 | Response getPatientDetails(String id); 10 | Response addPatient(PatientDto patientDto); 11 | Response removePatient(String id); 12 | Response editDetails(PatientDto patientDto, String id); 13 | Response getPatientByName(String orderType); 14 | Response getPatientByAge(String orderType); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/util/PatientDto.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.util; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class PatientDto { 11 | 12 | private String patient_id; 13 | 14 | private String first_name; 15 | 16 | private String last_name; 17 | 18 | private String age; 19 | 20 | private String marital_status; 21 | 22 | private String state; 23 | 24 | private String disease; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/service/DoctorService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.service; 2 | 3 | import lk.himash.doctor.util.DoctorDto; 4 | import lk.himash.doctor.util.Response; 5 | 6 | public interface DoctorService { 7 | 8 | Response getAllDoctorDetails(); 9 | Response getDoctorDetails(String _id); 10 | Response addDoctor(DoctorDto doctorDto); 11 | Response deleteDoctor(String id); 12 | Response editDoctorDetails(DoctorDto doctorDto, String id); 13 | Response getDoctorsByMaritalStatus(String mStatus); 14 | Response getDoctorsByFirstName(String order); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/service/PatientService.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.service; 2 | 3 | import lk.himash.patient.util.PatientDto; 4 | import lk.himash.patient.util.Response; 5 | 6 | public interface PatientService { 7 | 8 | Response getAllPatientDetails(); 9 | Response getPatientDetails(String id); 10 | Response addPatient(PatientDto patientDto); 11 | Response deletePatient(String patient_id); 12 | Response editPatientDetails(PatientDto patientDto, String id); 13 | Response getPatientByName(String orderType); 14 | Response getPatientByAge(String orderType); 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Spring-Boot-with-Reactive-Programming 2 | Build the Spring boot application operation using reactive programming way with modern reactive technologies. 3 | 4 | ## Requirements 5 | 6 | 01) Java 1.8 + 7 | 02) Maven 3.8 + 8 | 03) MongoDB 9 | 04) Postgresql 10 | 11 | ## Project setup 12 | 13 | 01) Clone the project 14 | 15 | https://github.com/himash79/Spring-Boot-with-Reactive-Programming.git 16 | 17 | 02) Configure Services and Databases 18 | 19 | Lookup the `Config.txt` file and initiate the service configurations. 20 | 21 | 03) Open project using IDEs 22 | 23 | 04) Execute the main service. 24 | 25 | Perform form operations. 26 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/repository/DoctorRepository.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.repository; 2 | 3 | import lk.himash.doctor.model.Doctor; 4 | import org.springframework.data.domain.Sort; 5 | import org.springframework.data.mongodb.repository.MongoRepository; 6 | import org.springframework.data.mongodb.repository.Query; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | @Repository 12 | public interface DoctorRepository extends MongoRepository{ 13 | 14 | @Query("{ marital_status : ?0 }") 15 | public List getDoctorRelatedMaritalStatus(String mStatus); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/model/Doctor.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.mongodb.core.mapping.Document; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | @Document(collection = "Doctor") 13 | public class Doctor { 14 | 15 | @Id 16 | private String _id; 17 | private String first_name; 18 | private String last_name; 19 | private String age; 20 | private String marital_status; 21 | private String state; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/util/EntityConversion.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.util; 2 | 3 | import lk.himash.doctor.model.Doctor; 4 | 5 | public class EntityConversion { 6 | 7 | public static Doctor dtoToEntity(DoctorDto doctorDto) { 8 | Doctor doctor = new Doctor(); 9 | doctor.set_id(doctorDto.get_id()); 10 | doctor.setFirst_name(doctorDto.getFirst_name()); 11 | doctor.setLast_name(doctorDto.getLast_name()); 12 | doctor.setAge(doctorDto.getAge()); 13 | doctor.setMarital_status(doctorDto.getMarital_status()); 14 | doctor.setState(doctorDto.getState()); 15 | return doctor; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/util/EntityConversion.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.util; 2 | 3 | import lk.himash.patient.model.Patient; 4 | 5 | public class EntityConversion { 6 | 7 | public static Patient dtoToEntity(PatientDto patientDto) { 8 | Patient patient = new Patient(); 9 | patient.setPatient_id(patientDto.getPatient_id()); 10 | patient.setFirst_name(patientDto.getFirst_name()); 11 | patient.setLast_name(patientDto.getLast_name()); 12 | patient.setAge(patientDto.getAge()); 13 | patient.setMarital_status(patientDto.getMarital_status()); 14 | patient.setState(patientDto.getState()); 15 | patient.setDisease(patientDto.getDisease()); 16 | return patient; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/model/Patient.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.Id; 10 | import javax.persistence.Table; 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @Table(name = "patient") 16 | @Entity 17 | public class Patient { 18 | 19 | @Id 20 | private String patient_id; 21 | 22 | private String first_name; 23 | 24 | private String last_name; 25 | 26 | private String age; 27 | 28 | private String marital_status; 29 | 30 | private String state; 31 | 32 | private String disease; 33 | } 34 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/util/PropertyFileReader.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.util; 2 | 3 | import java.io.FileReader; 4 | import java.util.Properties; 5 | 6 | public class PropertyFileReader { 7 | 8 | public static String getPropertyFileData(String propertyKey) { 9 | Properties p = new Properties(); 10 | String URL = ""; 11 | try { 12 | String dir = System.getProperty("user.dir"); 13 | FileReader reader = new FileReader(dir + "\\src\\main\\resources\\services.properties"); 14 | p.load(reader); 15 | URL = p.getProperty(propertyKey); 16 | // System.out.println(URL); 17 | } catch (Exception ex) { 18 | System.out.println("Exception found on | getPropertyFileData() method | PropertyFileReader.class |"); 19 | System.out.println(ex.getMessage()); 20 | } 21 | return URL; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Microservices/Services/patient/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/#build-image) 9 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#using.devtools) 10 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#data.sql.jpa-and-spring-data) 11 | 12 | ### Guides 13 | The following guides illustrate how to use some features concretely: 14 | 15 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/) 16 | 17 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/repository/PatientRepository.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.repository; 2 | 3 | import lk.himash.patient.model.Patient; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface PatientRepository extends JpaRepository { 12 | 13 | @Query("select p from Patient p order by first_name ASC") 14 | List getPatientByNameASC(); 15 | 16 | @Query("select p from Patient p order by first_name DESC") 17 | List getPatientByNameDESC(); 18 | 19 | @Query("select p from Patient p order by age ASC") 20 | List getPatientByAgeASC(); 21 | 22 | @Query("select p from Patient p order by age DESC") 23 | List getPatientByAgeDESC(); 24 | } 25 | -------------------------------------------------------------------------------- /Microservices/hospital/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.1/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.1/maven-plugin/reference/html/#build-image) 9 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.7.1/reference/htmlsingle/#using.devtools) 10 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.7.1/reference/htmlsingle/#data.sql.jpa-and-spring-data) 11 | 12 | ### Guides 13 | The following guides illustrate how to use some features concretely: 14 | 15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/) 16 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/) 17 | 18 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.0/maven-plugin/reference/html/#build-image) 9 | * [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#data.nosql.mongodb) 10 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#using.devtools) 11 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.0/reference/htmlsingle/#web) 12 | 13 | ### Guides 14 | The following guides illustrate how to use some features concretely: 15 | 16 | * [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/) 17 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 18 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 19 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 20 | 21 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/resources/services.properties: -------------------------------------------------------------------------------- 1 | #Doctor back-end services 2 | GET_ALL_DOCTOR_DETAILS=http://localhost:8090/docApi/getAllDocDetails 3 | GET_DOCTOR_DETAILS=http://localhost:8090/docApi/getDocDetails/ 4 | ADD_DOCTOR=http://localhost:8090/docApi/addDoctor 5 | REMOVE_DOCTOR=http://localhost:8090/docApi/removeDoctor/ 6 | EDIT_DOCTO_DETAILS=http://localhost:8090/docApi/editDoctorDetails/ 7 | GET_DOCTOR_BY_MARITAL_STATUS=http://localhost:8090/docApi/getDoctorsByMaritalStatus/ 8 | GET_DOC_BY_FIRST_NAME=http://localhost:8090/docApi/getDoctorsByFirstName/ 9 | 10 | #Patient back-end services 11 | GET_ALL_PATIENT_DETAILS=http://localhost:8091/patientApi/getAllPaDetails/ 12 | GET_PATIENT_DETAILS=http://localhost:8091/patientApi/getPaDetails/ 13 | ADD_PATIENT=http://localhost:8091/patientApi/addPatient 14 | REMOVE_PATIENT=http://localhost:8091/patientApi/removePatient/ 15 | EDIT_PATIENT_DETAILS=http://localhost:8091/patientApi/editPatientDetails/ 16 | GET_PATIENT_BY_NAME=http://localhost:8091/patientApi/getPatientByName/ 17 | GET_PATIENT_BT_AGE=http://localhost:8091/patientApi/getPatientByAge/ 18 | 19 | #Example API services (Required internet) 20 | GET_ALL_POSTS=https://jsonplaceholder.typicode.com/posts/ 21 | GET_ALL_TODOS=https://jsonplaceholder.typicode.com/todos/ 22 | GET_ALL_USERS=https://jsonplaceholder.typicode.com/users -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/controller/TodoController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.DeleteMapping; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.PutMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import lk.himash.hospital.dto.Response; 14 | import lk.himash.hospital.dto.TodoDto; 15 | import lk.himash.hospital.service.TodoService; 16 | 17 | @RestController 18 | @RequestMapping("/v1/todoAPI") 19 | public class TodoController { 20 | 21 | @Autowired 22 | private TodoService todoService; 23 | 24 | @GetMapping("/getAllTodos") 25 | public Response getAllTodos() { 26 | return todoService.getAllTodos(); 27 | } 28 | 29 | @GetMapping("/getTodo/{id}") 30 | public Response getTodo(@PathVariable String id) { 31 | return todoService.getTodo(id); 32 | } 33 | 34 | @PostMapping("/addTodo") 35 | public Response addTodo(@RequestBody TodoDto todoDto) { 36 | return todoService.addTodo(todoDto); 37 | } 38 | 39 | @DeleteMapping("/removeTodo/{id}") 40 | public Response removeTodo(@PathVariable String id) { 41 | return todoService.removeTodo(id); 42 | } 43 | 44 | @PutMapping("/editTodo/{id}") 45 | public Response removeTodo(@RequestBody TodoDto todoDto, @PathVariable String id) { 46 | return todoService.editTodoDetail(todoDto, id); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/Doctor.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "_id": { 3 | "$oid": "62aed1d4e2b2c92b39e04e53" 4 | }, 5 | "first_name": "nirmal", 6 | "last_name": "perera", 7 | "age": "30", 8 | "marital_status": "single", 9 | "state": "ambepussa" 10 | },{ 11 | "_id": { 12 | "$oid": "62aed2d6e2b2c92b39e04e55" 13 | }, 14 | "first_name": "damith", 15 | "last_name": "jayawadhana", 16 | "age": "22", 17 | "marital_status": "married", 18 | "state": "mathara" 19 | },{ 20 | "_id": { 21 | "$oid": "62aed2f3e2b2c92b39e04e56" 22 | }, 23 | "first_name": "sumith", 24 | "last_name": "darpadathu", 25 | "age": "25", 26 | "marital_status": "single", 27 | "state": "kandy" 28 | },{ 29 | "_id": { 30 | "$oid": "62aed31ce2b2c92b39e04e57" 31 | }, 32 | "first_name": "chinthaka", 33 | "last_name": "ranathunga", 34 | "age": "40", 35 | "marital_status": "married", 36 | "state": "kaluthara" 37 | },{ 38 | "_id": { 39 | "$oid": "62aed34de2b2c92b39e04e59" 40 | }, 41 | "first_name": "dasith", 42 | "last_name": "gallage", 43 | "age": "60", 44 | "marital_status": "single", 45 | "state": "ranala" 46 | },{ 47 | "_id": { 48 | "$oid": "62af52791e7c5c617a6453fc" 49 | }, 50 | "first_name": "jagath", 51 | "last_name": "bandara", 52 | "age": "24", 53 | "marital_status": "single", 54 | "state": "baththaramulla", 55 | "_class": "lk.himash.doctor.model.Doctor" 56 | },{ 57 | "_id": { 58 | "$oid": "62b08642a246964c4854a3bf" 59 | }, 60 | "first_name": "priyankara", 61 | "last_name": "piyadasa", 62 | "age": "34", 63 | "marital_status": "married", 64 | "state": "ahungalla", 65 | "_class": "lk.himash.doctor.model.Doctor" 66 | },{ 67 | "_id": { 68 | "$oid": "62b884aa5b16094445263051" 69 | }, 70 | "first_name": "sethan", 71 | "last_name": "faisal", 72 | "age": "10", 73 | "marital_status": "other", 74 | "state": "angoda", 75 | "_class": "lk.himash.doctor.model.Doctor" 76 | }] -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/controller/PatientController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.controller; 2 | 3 | import lk.himash.patient.service.PatientService; 4 | import lk.himash.patient.util.PatientDto; 5 | import lk.himash.patient.util.Response; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | @RestController 10 | @RequestMapping("/patientApi") 11 | @CrossOrigin(origins = "*") 12 | public class PatientController { 13 | 14 | @Autowired 15 | private PatientService paService; 16 | 17 | @GetMapping("/getAllPaDetails") 18 | private Response getAllPatientDetails() { 19 | return paService.getAllPatientDetails(); 20 | } 21 | 22 | @GetMapping("/getPaDetails/{id}") 23 | public Response getPatientDetails(@PathVariable String id) { 24 | return paService.getPatientDetails(id); 25 | } 26 | 27 | @PostMapping("/addPatient") 28 | public Response addPatient(@RequestBody PatientDto patientDto) { 29 | return paService.addPatient(patientDto); 30 | } 31 | 32 | @DeleteMapping("/removePatient/{id}") 33 | public Response removePatient(@PathVariable String id) { 34 | return paService.deletePatient(id); 35 | } 36 | 37 | @PutMapping("/editPatientDetails/{id}") 38 | public Response editPatientDetails(@RequestBody PatientDto patientDto, @PathVariable String id) { 39 | return paService.editPatientDetails(patientDto,id); 40 | } 41 | 42 | @GetMapping("/getPatientByName/{orderType}") 43 | private Response getPatientByName(@PathVariable String orderType) { 44 | return paService.getPatientByName(orderType); 45 | } 46 | 47 | @GetMapping("/getPatientByAge/{orderType}") 48 | private Response getPatientByAge(@PathVariable String orderType) { 49 | return paService.getPatientByAge(orderType); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/controller/DoctorController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.controller; 2 | 3 | import lk.himash.doctor.service.DoctorService; 4 | import lk.himash.doctor.util.DoctorDto; 5 | import lk.himash.doctor.util.Response; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | @RestController 10 | @RequestMapping("/docApi") 11 | @CrossOrigin(origins = "*") 12 | public class DoctorController { 13 | 14 | @Autowired 15 | private DoctorService docService; 16 | 17 | @GetMapping("/getAllDocDetails") 18 | private Response getAllDocDetails() { 19 | return docService.getAllDoctorDetails(); 20 | } 21 | 22 | @GetMapping("/getDocDetails/{id}") 23 | public Response getDocDetails(@PathVariable String id) { 24 | return docService.getDoctorDetails(id); 25 | } 26 | 27 | @PostMapping("/addDoctor") 28 | public Response addDoctor(@RequestBody DoctorDto doctorDto) { 29 | return docService.addDoctor(doctorDto); 30 | } 31 | 32 | @DeleteMapping("/removeDoctor/{id}") 33 | public Response removeDoctor(@PathVariable String id) { 34 | return docService.deleteDoctor(id); 35 | } 36 | 37 | @PutMapping("/editDoctorDetails/{id}") 38 | public Response editDoctorDetails(@RequestBody DoctorDto doctorDto, @PathVariable String id) { 39 | return docService.editDoctorDetails(doctorDto,id); 40 | } 41 | 42 | @GetMapping("/getDoctorsByMaritalStatus/{mStatus}") 43 | public Response getDoctorsByMaritalStatus(@PathVariable String mStatus) { 44 | return docService.getDoctorsByMaritalStatus(mStatus); 45 | } 46 | 47 | @GetMapping("/getDoctorsByFirstName/{order}") 48 | public Response getDoctorsByFirstName(@PathVariable String order) { 49 | return docService.getDoctorsByFirstName(order); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/controller/PostController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.DeleteMapping; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.PutMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import lk.himash.hospital.dto.PostDto; 14 | import lk.himash.hospital.dto.Response; 15 | import lk.himash.hospital.service.PostService; 16 | 17 | @RestController 18 | @RequestMapping("/v1/postAPI") 19 | public class PostController { 20 | 21 | @Autowired 22 | private PostService postService; 23 | 24 | @GetMapping("/getAllPosts") 25 | public Response getPosts() { 26 | return postService.getAllPosts(); 27 | } 28 | 29 | @GetMapping("/getPost/{id}") 30 | public Response getPosts(@PathVariable String id) { 31 | return postService.getPost(id); 32 | } 33 | 34 | @GetMapping("/getPostCommentsRelatedUser/{id}/{value}") // value = comments, ... 35 | public Response getPosts(@PathVariable String id, @PathVariable String value) { 36 | return postService.getRelatedPostComments(id, value); 37 | } 38 | 39 | @PostMapping("/addPost") 40 | public Response addPost(@RequestBody PostDto postDto) { 41 | return postService.addPost(postDto); 42 | } 43 | 44 | @DeleteMapping("/removePost/{id}") 45 | public Response removePost(@PathVariable String id) { 46 | return postService.removePost(id); 47 | } 48 | 49 | @PutMapping("/editPost/{id}") 50 | public Response editPost(@RequestBody PostDto postDto, @PathVariable String id) { 51 | return postService.editPost(postDto, id); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/controller/DoctorController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.DeleteMapping; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.PutMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import lk.himash.hospital.dto.DoctorDto; 14 | import lk.himash.hospital.dto.Response; 15 | import lk.himash.hospital.service.DoctorService; 16 | 17 | @RestController 18 | @RequestMapping("/v1/docAPI") 19 | public class DoctorController { 20 | 21 | @Autowired 22 | private DoctorService docService; 23 | 24 | @GetMapping("/getDocDetails") 25 | public Response getAllDocDetails() { 26 | return docService.getAllDocDetails(); 27 | } 28 | 29 | @GetMapping("/getDocDetails/{id}") 30 | public Response getDocDetails(@PathVariable String id) { 31 | return docService.getDocDetails(id); 32 | } 33 | 34 | @PostMapping("/addDocDetails") 35 | public Response addDocDetails(@RequestBody DoctorDto doctorDto) { 36 | return docService.AddDoctor(doctorDto); 37 | } 38 | 39 | @DeleteMapping("/removeDocDetails/{id}") 40 | public Response removeDocDetails(@PathVariable String id) { 41 | return docService.removeDoctor(id); 42 | } 43 | 44 | @PutMapping("/editDocDetails/{id}") 45 | public Response editDocDetails(@RequestBody DoctorDto doctorDto, @PathVariable String id) { 46 | return docService.editDocDetails(doctorDto, id); 47 | } 48 | 49 | @GetMapping("/getDocByMaritalStatus/{param}") 50 | public Response editDocDetails(@PathVariable String param) { 51 | return docService.getDocByMaritalStatus(param); 52 | } 53 | 54 | @GetMapping("/getDocByFirstName/{param}") 55 | public Response getDocByName(@PathVariable String param) { 56 | return docService.getDocByName(param); 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/controller/PatientController.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.DeleteMapping; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.PutMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | import lk.himash.hospital.dto.PatientDto; 14 | import lk.himash.hospital.dto.Response; 15 | import lk.himash.hospital.service.PatientService; 16 | 17 | @RestController 18 | @RequestMapping("/v1/paAPI") 19 | public class PatientController { 20 | 21 | @Autowired 22 | private PatientService paService; 23 | 24 | @GetMapping("/getpatientsDetails") 25 | public Response getAllPatientDetails() { 26 | return paService.getAllPatientDetails(); 27 | } 28 | 29 | @GetMapping("/getPatientDetails/{id}") 30 | public Response getPatientDetails(@PathVariable String id) { 31 | return paService.getPatientDetails(id); 32 | } 33 | 34 | @PostMapping("/addPpatient") 35 | public Response getPatientDetails(@RequestBody PatientDto patientDto) { 36 | return paService.addPatient(patientDto); 37 | } 38 | 39 | @DeleteMapping("/removePatient/{id}") 40 | public Response removePatient(@PathVariable String id) { 41 | return paService.removePatient(id); 42 | } 43 | 44 | @PutMapping("/editPatient/{id}") 45 | public Response editDetails(@RequestBody PatientDto patientDto, @PathVariable String id) { 46 | return paService.editDetails(patientDto, id); 47 | } 48 | 49 | @GetMapping("/getPatientByName/{orderType}") 50 | public Response getPatientByName(@PathVariable String orderType) { // ASC , DESC 51 | return paService.getPatientByName(orderType); 52 | } 53 | 54 | @GetMapping("/getPatientByAge/{orderType}") 55 | public Response getPatientByAge(@PathVariable String orderType) { // ASC , DESC 56 | return paService.getPatientByAge(orderType); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.0 9 | 10 | 11 | lk.himash 12 | doctor 13 | 0.0.1-SNAPSHOT 14 | war 15 | doctor 16 | Doctor service 17 | 18 | 1.8 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter-data-mongodb 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-devtools 33 | runtime 34 | true 35 | 36 | 37 | org.projectlombok 38 | lombok 39 | true 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-starter-test 49 | test 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-maven-plugin 58 | 59 | 60 | 61 | org.projectlombok 62 | lombok 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /Microservices/Services/patient/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.0 9 | 10 | 11 | lk.himash 12 | patient 13 | 0.0.1-SNAPSHOT 14 | war 15 | patient 16 | patient service 17 | 18 | 1.8 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter-data-jpa 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-devtools 33 | runtime 34 | true 35 | 36 | 37 | org.postgresql 38 | postgresql 39 | runtime 40 | 41 | 42 | org.projectlombok 43 | lombok 44 | true 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-starter-test 54 | test 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | 64 | 65 | 66 | org.projectlombok 67 | lombok 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Microservices/hospital/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | org.springframework.boot 8 | spring-boot-starter-parent 9 | 2.7.1 10 | 11 | 12 | lk.himash 13 | hospital 14 | 0.0.1-SNAPSHOT 15 | war 16 | hospital 17 | Hospital management system 18 | 19 | 1.8 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | org.springframework.boot 28 | spring-boot-devtools 29 | runtime 30 | true 31 | 32 | 33 | org.projectlombok 34 | lombok 35 | true 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-tomcat 40 | provided 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-webflux 51 | 52 | 53 | io.projectreactor 54 | reactor-test 55 | test 56 | 57 | 58 | io.projectreactor.netty 59 | reactor-netty 60 | 61 | 62 | org.springframework 63 | spring-webflux 64 | 65 | 66 | io.projectreactor 67 | reactor-core 68 | 69 | 70 | com.google.code.gson 71 | gson 72 | 73 | 74 | org.apache.httpcomponents 75 | httpclient 76 | test 77 | 78 | 79 | org.apache.httpcomponents 80 | httpclient 81 | 82 | 83 | 84 | 85 | 86 | 87 | org.springframework.boot 88 | spring-boot-maven-plugin 89 | 90 | 91 | 92 | org.projectlombok 93 | lombok 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/serviceImpl/DoctorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service.serviceImpl; 2 | 3 | import org.springframework.http.HttpHeaders; 4 | import org.springframework.http.MediaType; 5 | import org.springframework.stereotype.Service; 6 | import org.springframework.web.reactive.function.client.WebClient; 7 | 8 | import lk.himash.hospital.dto.DoctorDto; 9 | import lk.himash.hospital.dto.Response; 10 | import lk.himash.hospital.service.DoctorService; 11 | import lk.himash.hospital.util.PropertyFileReader; 12 | import reactor.core.publisher.Mono; 13 | 14 | @Service 15 | public class DoctorServiceImpl implements DoctorService{ 16 | 17 | @Override 18 | public Response getAllDocDetails() { 19 | Response res = new Response(); 20 | try { 21 | WebClient webClient = WebClient.create(); 22 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_DOCTOR_DETAILS"); 23 | res = webClient.get().uri(url).retrieve().bodyToMono(Response.class).block(); 24 | } catch(Exception ex) { 25 | System.out.println("Exception found on | getDocDetails() method | DoctorService.class | "); 26 | System.out.println(ex.getMessage()); 27 | return res; 28 | } 29 | return res; 30 | } 31 | 32 | @Override 33 | public Response getDocDetails(String id) { 34 | Response res = new Response(); 35 | try { 36 | WebClient webClient = WebClient.create(); 37 | String url = PropertyFileReader.getPropertyFileData("GET_DOCTOR_DETAILS"); 38 | res = webClient.get().uri(url + id).retrieve().bodyToMono(Response.class).block(); 39 | }catch(Exception ex) { 40 | System.out.println("Exception found on | getDocDetails() method | DoctorService.class | "); 41 | System.out.println(ex.getMessage()); 42 | return res; 43 | } 44 | return res; 45 | } 46 | 47 | @Override 48 | public Response AddDoctor(DoctorDto doctorDto) { 49 | Response res = new Response(); 50 | try { 51 | WebClient webClient = WebClient.create(); 52 | String url = PropertyFileReader.getPropertyFileData("ADD_DOCTOR"); 53 | res = webClient.post() 54 | .uri(url) 55 | .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 56 | .body(Mono.just(doctorDto), DoctorDto.class) 57 | .retrieve().bodyToMono(Response.class).block(); 58 | }catch(Exception ex) { 59 | System.out.println("Exception found on | AddDoctor() method | DoctorService.class | "); 60 | System.out.println(ex.getMessage()); 61 | return res; 62 | } 63 | return res; 64 | } 65 | 66 | @Override 67 | public Response removeDoctor(String id) { 68 | Response res = new Response(); 69 | try { 70 | WebClient webClient = WebClient.create(); 71 | String url = PropertyFileReader.getPropertyFileData("REMOVE_DOCTOR"); 72 | res = webClient.delete().uri(url + id).retrieve().bodyToMono(Response.class).block(); 73 | }catch(Exception ex) { 74 | System.out.println("Exception found on | removeDoctor() method | DoctorService.class | "); 75 | System.out.println(ex.getMessage()); 76 | return res; 77 | } 78 | return res; 79 | } 80 | 81 | @Override 82 | public Response editDocDetails(DoctorDto doctorDto, String id) { 83 | Response res = new Response(); 84 | try { 85 | WebClient webClient = WebClient.create(); 86 | String url = PropertyFileReader.getPropertyFileData("EDIT_DOCTO_DETAILS"); 87 | res = webClient.put() 88 | .uri(url + id) 89 | .body(Mono.just(doctorDto), DoctorDto.class) 90 | .retrieve() 91 | .bodyToMono(Response.class) 92 | .block(); 93 | }catch(Exception ex) { 94 | System.out.println("Exception found on | editDocDetails() method | DoctorService.class | "); 95 | System.out.println(ex.getMessage()); 96 | return res; 97 | } 98 | 99 | return res; 100 | } 101 | 102 | @Override 103 | public Response getDocByMaritalStatus(String param) { 104 | Response res = new Response(); 105 | try { 106 | WebClient webClient = WebClient.create(); 107 | String url = PropertyFileReader.getPropertyFileData("GET_DOCTOR_BY_MARITAL_STATUS"); 108 | res = webClient.get().uri(url + param).retrieve().bodyToMono(Response.class).block(); 109 | }catch(Exception ex) { 110 | System.out.println("Exception found on | getDocByMaritalStatus() method | DoctorService.class | "); 111 | System.out.println(ex.getMessage()); 112 | return res; 113 | } 114 | return res; 115 | } 116 | 117 | @Override 118 | public Response getDocByName(String param) { // can use as parameter first_name / last_name / age.... 119 | Response res = new Response(); 120 | try { 121 | WebClient webClient = WebClient.create(); 122 | String url = PropertyFileReader.getPropertyFileData("GET_DOC_BY_FIRST_NAME"); 123 | res = webClient.get().uri(url + param).retrieve().bodyToMono(Response.class).block(); 124 | }catch(Exception ex) { 125 | System.out.println("Exception found on | getDocByName() method | DoctorService.class | "); 126 | System.out.println(ex.getMessage()); 127 | return res; 128 | } 129 | return res; 130 | } 131 | 132 | 133 | 134 | 135 | 136 | } 137 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/src/main/java/lk/himash/doctor/service/serivceImpl/DoctorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.doctor.service.serivceImpl; 2 | 3 | import lk.himash.doctor.model.Doctor; 4 | import lk.himash.doctor.repository.DoctorRepository; 5 | import lk.himash.doctor.service.DoctorService; 6 | import lk.himash.doctor.util.DoctorDto; 7 | import lk.himash.doctor.util.EntityConversion; 8 | import lk.himash.doctor.util.Response; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.data.domain.Sort; 11 | import org.springframework.http.HttpStatus; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | @Service 19 | @Transactional 20 | public class DoctorServiceImpl implements DoctorService { 21 | 22 | @Autowired 23 | private DoctorRepository docRepo; 24 | 25 | @Override 26 | public Response getAllDoctorDetails() { 27 | List docs = new ArrayList<>(); 28 | Response res = new Response(); 29 | try { 30 | docs = docRepo.findAll(); 31 | res.setHttpStatus(HttpStatus.OK); 32 | res.setObj(docs); 33 | res.setMsg("SUCCESS"); 34 | }catch(Exception ex) { 35 | res.setHttpStatus(HttpStatus.NOT_FOUND); 36 | res.setObj(docs); 37 | res.setMsg("ERROR"); 38 | } 39 | return res; 40 | } 41 | 42 | @Override 43 | public Response getDoctorDetails(String _id) { 44 | Response res = new Response(); 45 | Doctor doc; 46 | try { 47 | doc = docRepo.findById(_id).get(); 48 | res.setHttpStatus(HttpStatus.OK); 49 | res.setObj(doc); 50 | res.setMsg("SUCCESS"); 51 | }catch(Exception ex) { 52 | res.setHttpStatus(HttpStatus.NOT_FOUND); 53 | res.setObj(ex.getMessage()); 54 | res.setMsg("ERROR"); 55 | } 56 | return res; 57 | } 58 | 59 | @Override 60 | public Response addDoctor(DoctorDto doctorDto) { 61 | Response res = new Response(); 62 | Doctor doc; 63 | try { 64 | doc = EntityConversion.dtoToEntity(doctorDto); 65 | doc = docRepo.save(doc); 66 | res.setHttpStatus(HttpStatus.CREATED); 67 | res.setObj(doc); 68 | res.setMsg("SUCCESS"); 69 | }catch(Exception ex) { 70 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 71 | res.setObj(ex.getMessage()); 72 | res.setMsg("ERROR"); 73 | } 74 | return res; 75 | } 76 | 77 | @Override 78 | public Response deleteDoctor(String id) { 79 | Response res = new Response(); 80 | Doctor doc; 81 | try { 82 | doc = docRepo.findById(id).get(); 83 | docRepo.delete(doc); 84 | res.setHttpStatus(HttpStatus.OK); 85 | res.setObj(doc); 86 | res.setMsg("SUCCESS"); 87 | }catch(Exception ex) { 88 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 89 | res.setObj(ex.getMessage()); 90 | res.setMsg("ERROR"); 91 | } 92 | return res; 93 | } 94 | 95 | @Override 96 | public Response editDoctorDetails(DoctorDto newDoctorDto, String id) { 97 | Response res = new Response(); 98 | Doctor oldDocObj, newDocObj, updatedDocObj; 99 | try { 100 | oldDocObj = docRepo.findById(id).get(); 101 | newDocObj = EntityConversion.dtoToEntity(newDoctorDto); 102 | updatedDocObj = setNewDoctorDetails(oldDocObj, newDocObj); 103 | docRepo.save(updatedDocObj); 104 | res.setHttpStatus(HttpStatus.CREATED); 105 | res.setMsg("SUCCESS"); 106 | res.setObj(updatedDocObj); 107 | }catch(Exception ex) { 108 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 109 | res.setObj(ex.getMessage()); 110 | res.setMsg("ERROR"); 111 | } 112 | return res; 113 | } 114 | 115 | private static Doctor setNewDoctorDetails(Doctor oldDocObj, Doctor newDocObj) { 116 | oldDocObj.setFirst_name(newDocObj.getFirst_name()); 117 | oldDocObj.setLast_name(newDocObj.getLast_name()); 118 | oldDocObj.setAge(newDocObj.getAge()); 119 | oldDocObj.setMarital_status(newDocObj.getMarital_status()); 120 | oldDocObj.setState(newDocObj.getState()); 121 | return oldDocObj; 122 | } 123 | 124 | @Override 125 | public Response getDoctorsByMaritalStatus(String mStatus) { 126 | Response res = new Response(); 127 | List doctors; 128 | try { 129 | doctors = docRepo.getDoctorRelatedMaritalStatus(mStatus); 130 | res.setHttpStatus(HttpStatus.FOUND); 131 | res.setMsg("SUCCESS"); 132 | res.setObj(doctors); 133 | }catch(Exception ex) { 134 | res.setHttpStatus(HttpStatus.NOT_FOUND); 135 | res.setObj(ex.getMessage()); 136 | res.setMsg("ERROR"); 137 | } 138 | return res; 139 | } 140 | 141 | @Override 142 | public Response getDoctorsByFirstName(String order) { 143 | Response res = new Response(); 144 | List doctors; 145 | try { 146 | doctors = docRepo.findAll(Sort.by(Sort.Direction.ASC, order)); 147 | System.out.println("doctor : " + doctors); 148 | res.setHttpStatus(HttpStatus.FOUND); 149 | res.setMsg("SUCCESS"); 150 | res.setObj(doctors); 151 | }catch(Exception ex) { 152 | res.setHttpStatus(HttpStatus.NOT_FOUND); 153 | res.setObj(ex.getMessage()); 154 | res.setMsg("ERROR"); 155 | } 156 | return res; 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/serviceImpl/TodoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service.serviceImpl; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.springframework.http.HttpEntity; 7 | import org.springframework.http.HttpHeaders; 8 | import org.springframework.http.HttpMethod; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.http.MediaType; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.web.client.RestTemplate; 14 | 15 | import com.fasterxml.jackson.core.type.TypeReference; 16 | import com.fasterxml.jackson.databind.ObjectMapper; 17 | 18 | import lk.himash.hospital.dto.Response; 19 | import lk.himash.hospital.dto.TodoDto; 20 | import lk.himash.hospital.service.TodoService; 21 | import lk.himash.hospital.util.PropertyFileReader; 22 | 23 | @Service 24 | public class TodoServiceImpl implements TodoService { 25 | 26 | private static RestTemplate restTemplate = new RestTemplate(); 27 | 28 | @Override 29 | public Response getAllTodos() { 30 | Response res = new Response(); 31 | ResponseEntity result = null; 32 | HttpHeaders headers = new HttpHeaders(); 33 | ObjectMapper mapper = new ObjectMapper(); 34 | try { 35 | // headers.add(HttpHeaders.AUTHORIZATION, jsonReader.getAccesTokenforErpNext().get("token")); If have JWT authentication 36 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 37 | HttpEntity entity = new HttpEntity("parameters", headers); 38 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_TODOS"); 39 | result = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); 40 | List todos = mapper.readValue(result.getBody(), new TypeReference>(){}); 41 | res.setHttpStatus(HttpStatus.FOUND); 42 | res.setObj(todos); 43 | res.setMsg("SUCCESS"); 44 | } catch (Exception ex) { 45 | System.out.println("Exception found on | getAllTodos() method | TodoService.class | "); 46 | System.out.println(ex.getMessage()); 47 | res.setHttpStatus(HttpStatus.NOT_FOUND); 48 | res.setObj(null); 49 | res.setMsg("ERROR"); 50 | } 51 | return res; 52 | } 53 | 54 | @Override 55 | public Response getTodo(String id) { 56 | Response res = new Response(); 57 | HttpHeaders header = new HttpHeaders(); 58 | try { 59 | header.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 60 | HttpEntity entity = new HttpEntity<>("parameters", header); 61 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_TODOS"); 62 | TodoDto result = restTemplate.exchange(url + id, HttpMethod.GET, entity, TodoDto.class).getBody(); 63 | res.setHttpStatus(HttpStatus.FOUND); 64 | res.setObj(result); 65 | res.setMsg("SUCCESS"); 66 | }catch(Exception ex) { 67 | System.out.println("Exception found on | getTodo() method | TodoService.class | "); 68 | System.out.println(ex.getMessage()); 69 | res.setHttpStatus(HttpStatus.NOT_FOUND); 70 | res.setObj(null); 71 | res.setMsg("ERROR"); 72 | } 73 | return res; 74 | } 75 | 76 | @Override 77 | public Response addTodo(TodoDto todoDto) { 78 | Response res = new Response(); 79 | HttpHeaders header = new HttpHeaders(); 80 | try { 81 | header.add(HttpHeaders.CONTENT_TYPE, "application/json"); 82 | header.add(HttpHeaders.ACCEPT, "application/json"); 83 | HttpEntity entity = new HttpEntity<>(todoDto, header); 84 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_TODOS"); 85 | TodoDto result = restTemplate.exchange(url, HttpMethod.POST, entity, TodoDto.class).getBody(); 86 | res.setHttpStatus(HttpStatus.CREATED); 87 | res.setObj(result); 88 | res.setMsg("SUCCESS"); 89 | } catch(Exception ex) { 90 | System.out.println("Exception found on | addTodo() method | TodoService.class | "); 91 | System.out.println(ex.getMessage()); 92 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 93 | res.setObj(null); 94 | res.setMsg("ERROR"); 95 | } 96 | return res; 97 | } 98 | 99 | @Override 100 | public Response removeTodo(String id) { 101 | Response res = new Response(); 102 | HttpHeaders header = new HttpHeaders(); 103 | try { 104 | header.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 105 | HttpEntity entity = new HttpEntity<>("parameters", header); 106 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_TODOS"); 107 | TodoDto result = restTemplate.exchange(url + id, HttpMethod.DELETE, entity, TodoDto.class).getBody(); 108 | res.setHttpStatus(HttpStatus.OK); 109 | res.setObj(result); 110 | res.setMsg("SUCCESS"); 111 | } catch(Exception ex) { 112 | System.out.println("Exception found on | removeTodo() method | TodoService.class | "); 113 | System.out.println(ex.getMessage()); 114 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 115 | res.setObj(null); 116 | res.setMsg("ERROR"); 117 | } 118 | return res; 119 | } 120 | 121 | @Override 122 | public Response editTodoDetail(TodoDto todoDto, String id) { 123 | Response res = new Response(); 124 | HttpHeaders header = new HttpHeaders(); 125 | try { 126 | header.add(HttpHeaders.CONTENT_TYPE, "application/json"); 127 | header.add(HttpHeaders.ACCEPT, "application/json"); 128 | HttpEntity entity = new HttpEntity<>(todoDto, header); 129 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_TODOS"); 130 | TodoDto result = restTemplate.exchange(url + id, HttpMethod.PUT, entity, TodoDto.class).getBody(); 131 | res.setHttpStatus(HttpStatus.OK); 132 | res.setObj(result); 133 | res.setMsg("SUCCESS"); 134 | }catch(Exception ex) { 135 | System.out.println("Exception found on | editTodoDetail() method | TodoService.class | "); 136 | System.out.println(ex.getMessage()); 137 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 138 | res.setObj(null); 139 | res.setMsg("ERROR"); 140 | } 141 | return res; 142 | } 143 | 144 | 145 | 146 | } 147 | -------------------------------------------------------------------------------- /Microservices/Services/patient/src/main/java/lk/himash/patient/service/serviceImpl/PatientServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.patient.service.serviceImpl; 2 | 3 | import lk.himash.patient.model.Patient; 4 | import lk.himash.patient.repository.PatientRepository; 5 | import lk.himash.patient.service.PatientService; 6 | import lk.himash.patient.util.EntityConversion; 7 | import lk.himash.patient.util.PatientDto; 8 | import lk.himash.patient.util.Response; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @Service 18 | @Transactional 19 | public class PatientServiceImpl implements PatientService { 20 | 21 | @Autowired 22 | private PatientRepository paRepo; 23 | 24 | @Override 25 | public Response getAllPatientDetails() { 26 | List patients = new ArrayList<>(); 27 | Response res = new Response(); 28 | try { 29 | patients = paRepo.findAll(); 30 | System.out.println(patients); 31 | res.setHttpStatus(HttpStatus.OK); 32 | res.setObj(patients); 33 | res.setMsg("SUCCESS"); 34 | }catch(Exception ex) { 35 | res.setHttpStatus(HttpStatus.NOT_FOUND); 36 | res.setObj(patients); 37 | res.setMsg("ERROR"); 38 | } 39 | return res; 40 | } 41 | 42 | @Override 43 | public Response getPatientDetails(String id) { 44 | Response res = new Response(); 45 | Patient patient; 46 | try { 47 | patient = paRepo.findById(id).get(); 48 | res.setHttpStatus(HttpStatus.OK); 49 | res.setObj(patient); 50 | res.setMsg("SUCCESS"); 51 | }catch(Exception ex) { 52 | res.setHttpStatus(HttpStatus.NOT_FOUND); 53 | res.setObj(ex.getMessage()); 54 | res.setMsg("ERROR"); 55 | } 56 | return res; 57 | } 58 | 59 | @Override 60 | public Response addPatient(PatientDto patientDto) { 61 | Response res = new Response(); 62 | Patient patient; 63 | try { 64 | patient = EntityConversion.dtoToEntity(patientDto); 65 | patient = paRepo.save(patient); 66 | res.setHttpStatus(HttpStatus.CREATED); 67 | res.setObj(patient); 68 | res.setMsg("SUCCESS"); 69 | }catch(Exception ex) { 70 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 71 | res.setObj(ex.getMessage()); 72 | res.setMsg("ERROR"); 73 | } 74 | return res; 75 | } 76 | 77 | @Override 78 | public Response deletePatient(String patient_id) { 79 | Response res = new Response(); 80 | Patient patient; 81 | try { 82 | patient = paRepo.findById(patient_id).get(); 83 | paRepo.delete(patient); 84 | res.setHttpStatus(HttpStatus.OK); 85 | res.setObj(patient); 86 | res.setMsg("SUCCESS"); 87 | }catch(Exception ex) { 88 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 89 | res.setObj(ex.getMessage()); 90 | res.setMsg("ERROR"); 91 | } 92 | return res; 93 | } 94 | 95 | @Override 96 | public Response editPatientDetails(PatientDto patientDto, String id) { 97 | Response res = new Response(); 98 | Patient oldPaObj, newPaObj, updatedPaObj; 99 | try { 100 | oldPaObj = paRepo.findById(id).get(); 101 | newPaObj = EntityConversion.dtoToEntity(patientDto); 102 | updatedPaObj = setNewDoctorDetails(oldPaObj, newPaObj); 103 | paRepo.save(updatedPaObj); 104 | res.setHttpStatus(HttpStatus.CREATED); 105 | res.setMsg("SUCCESS"); 106 | res.setObj(updatedPaObj); 107 | }catch(Exception ex) { 108 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 109 | res.setObj(ex.getMessage()); 110 | res.setMsg("ERROR"); 111 | } 112 | return res; 113 | } 114 | 115 | private static Patient setNewDoctorDetails(Patient oldPaObj, Patient newPaObj) { 116 | oldPaObj.setFirst_name(newPaObj.getFirst_name()); 117 | oldPaObj.setLast_name(newPaObj.getLast_name()); 118 | oldPaObj.setAge(newPaObj.getAge()); 119 | oldPaObj.setMarital_status(newPaObj.getMarital_status()); 120 | oldPaObj.setState(newPaObj.getState()); 121 | oldPaObj.setDisease(newPaObj.getDisease()); 122 | return oldPaObj; 123 | } 124 | 125 | @Override 126 | public Response getPatientByName(String orderType) { 127 | Response res = new Response(); 128 | List patients = new ArrayList(); 129 | try { 130 | if(orderType.equalsIgnoreCase("ASC")) { 131 | patients = paRepo.getPatientByNameASC(); 132 | res.setHttpStatus(HttpStatus.FOUND); 133 | res.setMsg("SUCCESS"); 134 | res.setObj(patients); 135 | } else if(orderType.equalsIgnoreCase("DESC")) { 136 | patients = paRepo.getPatientByNameDESC(); 137 | res.setHttpStatus(HttpStatus.FOUND); 138 | res.setMsg("SUCCESS"); 139 | res.setObj(patients); 140 | } else { 141 | res.setHttpStatus(HttpStatus.NOT_FOUND); 142 | res.setMsg("ERROR"); 143 | res.setObj(patients); 144 | } 145 | }catch(Exception ex) { 146 | res.setHttpStatus(HttpStatus.NOT_FOUND); 147 | res.setObj(ex.getMessage()); 148 | res.setMsg("ERROR"); 149 | } 150 | return res; 151 | } 152 | 153 | @Override 154 | public Response getPatientByAge(String orderType) { 155 | Response res = new Response(); 156 | List patients = new ArrayList(); 157 | try { 158 | if(orderType.equalsIgnoreCase("ASC")) { 159 | patients = paRepo.getPatientByAgeASC(); 160 | res.setHttpStatus(HttpStatus.FOUND); 161 | res.setMsg("SUCCESS"); 162 | res.setObj(patients); 163 | } else if(orderType.equalsIgnoreCase("DESC")) { 164 | patients = paRepo.getPatientByAgeDESC(); 165 | res.setHttpStatus(HttpStatus.FOUND); 166 | res.setMsg("SUCCESS"); 167 | res.setObj(patients); 168 | } else { 169 | res.setHttpStatus(HttpStatus.NOT_FOUND); 170 | res.setMsg("ERROR"); 171 | res.setObj(patients); 172 | } 173 | }catch(Exception ex) { 174 | res.setHttpStatus(HttpStatus.NOT_FOUND); 175 | res.setObj(ex.getMessage()); 176 | res.setMsg("ERROR"); 177 | } 178 | return res; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/serviceImpl/PostServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service.serviceImpl; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | import org.apache.http.HttpHeaders; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.http.MediaType; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.web.reactive.function.client.WebClient; 12 | 13 | import com.fasterxml.jackson.databind.ObjectMapper; 14 | 15 | import lk.himash.hospital.dto.PostDto; 16 | import lk.himash.hospital.dto.PostUserDto; 17 | import lk.himash.hospital.dto.Response; 18 | import lk.himash.hospital.service.PostService; 19 | import lk.himash.hospital.util.PropertyFileReader; 20 | import reactor.core.publisher.Mono; 21 | 22 | @Service 23 | public class PostServiceImpl implements PostService { 24 | 25 | @Override 26 | public Response getAllPosts() { 27 | Response res = new Response(); 28 | ObjectMapper mapper = new ObjectMapper(); 29 | try { 30 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 31 | WebClient webClient = WebClient.create(); 32 | Mono response = webClient.get().uri(url).accept(MediaType.APPLICATION_JSON).retrieve() 33 | .bodyToMono(Object[].class).log(); 34 | Object[] objects = response.block(); 35 | List posts = Arrays.stream(objects).map(object -> mapper.convertValue(object, PostDto.class)) 36 | .collect(Collectors.toList()); 37 | res.setHttpStatus(HttpStatus.FOUND); 38 | res.setObj(posts); 39 | res.setMsg("SUCCESS"); 40 | } catch (Exception ex) { 41 | System.out.println("Exception found on | getAllPosts() method | PostServiceImpl.class | "); 42 | System.out.println(ex.getMessage()); 43 | res.setHttpStatus(HttpStatus.NOT_FOUND); 44 | res.setObj(null); 45 | res.setMsg("ERROR"); 46 | } 47 | return res; 48 | } 49 | 50 | @Override 51 | public Response getPost(String id) { 52 | Response res = new Response(); 53 | ObjectMapper mapper = new ObjectMapper(); 54 | try { 55 | WebClient webClient = WebClient.create(); 56 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 57 | Mono response = webClient.get() 58 | .uri(url + id) 59 | .accept(MediaType.APPLICATION_JSON) 60 | .retrieve() 61 | .bodyToMono(Object.class); 62 | Object objects = response.block(); 63 | PostDto post = mapper.convertValue(objects, PostDto.class); 64 | res.setHttpStatus(HttpStatus.FOUND); 65 | res.setObj(post); 66 | res.setMsg("SUCCESS"); 67 | } catch (Exception ex) { 68 | System.out.println("Exception found on | getPost() method | PostServiceImpl.class | "); 69 | System.out.println(ex.getMessage()); 70 | res.setHttpStatus(HttpStatus.NOT_FOUND); 71 | res.setObj(null); 72 | res.setMsg("ERROR"); 73 | } 74 | return res; 75 | } 76 | 77 | @Override 78 | public Response getRelatedPostComments(String id, String value) { 79 | Response res = new Response(); 80 | ObjectMapper mapper = new ObjectMapper(); 81 | try { 82 | WebClient webClient = WebClient.create(); 83 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 84 | String URI = url.concat(id).concat("/").concat(value).concat("/"); 85 | Mono response = webClient.get().uri(URI).accept(MediaType.APPLICATION_JSON) 86 | .retrieve().bodyToMono(Object[].class); 87 | Object[] objects = response.block(); 88 | List posts = Arrays.stream(objects).map(postObj -> mapper.convertValue(postObj, PostUserDto.class)) 89 | .collect(Collectors.toList()); 90 | System.out.println(posts); 91 | res.setHttpStatus(HttpStatus.FOUND); 92 | res.setObj(posts); 93 | res.setMsg("SUCCESS"); 94 | } catch (Exception ex) { 95 | System.out.println("Exception found on | getRelatedPostComments() method | PostServiceImpl.class | "); 96 | System.out.println(ex.getMessage()); 97 | res.setHttpStatus(HttpStatus.NOT_FOUND); 98 | res.setObj(null); 99 | res.setMsg("ERROR"); 100 | } 101 | return res; 102 | } 103 | 104 | @Override 105 | public Response addPost(PostDto postDto) { 106 | PostDto postDto1 = new PostDto(); 107 | // ObjectMapper mapper = new ObjectMapper(); 108 | Response res = new Response(); 109 | try { 110 | WebClient webClient = WebClient.create(); 111 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 112 | postDto1 = webClient.post().uri(url) 113 | .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 114 | .body(Mono.just(postDto), PostDto.class) 115 | .retrieve() 116 | .bodyToMono(PostDto.class) 117 | .block(); 118 | res.setHttpStatus(HttpStatus.CREATED); 119 | res.setObj(postDto1); 120 | res.setMsg("SUCCESS"); 121 | }catch(Exception ex) { 122 | System.out.println("Exception found on | addPost() method | PostServiceImpl.class | "); 123 | System.out.println(ex.getMessage()); 124 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 125 | res.setObj(null); 126 | res.setMsg("ERROR"); 127 | } 128 | return res; 129 | } 130 | 131 | @Override 132 | public Response removePost(String id) { 133 | Response res = new Response(); 134 | PostDto postDto = new PostDto(); 135 | try { 136 | WebClient webClient = WebClient.create(); 137 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 138 | postDto = webClient.delete() 139 | .uri(url + postDto.getId()) 140 | .accept(MediaType.APPLICATION_JSON) 141 | .retrieve() 142 | .bodyToMono(PostDto.class) 143 | .block(); 144 | 145 | res.setHttpStatus(HttpStatus.OK); 146 | res.setObj(postDto); 147 | res.setMsg("SUCCESS"); 148 | } catch(Exception ex) { 149 | System.out.println("Exception found on | removePost() method | PostServiceImpl.class | "); 150 | System.out.println(ex.getMessage()); 151 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 152 | res.setObj(null); 153 | res.setMsg("ERROR"); 154 | } 155 | return res; 156 | } 157 | 158 | @Override 159 | public Response editPost(PostDto newPostDto, String id) { 160 | Response res = new Response(); 161 | try { 162 | WebClient webClient = WebClient.create(); 163 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_POSTS"); 164 | 165 | PostDto updatedPost = webClient.put().uri(url + id) 166 | .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 167 | .body(Mono.just(newPostDto), PostDto.class) 168 | .retrieve() 169 | .bodyToMono(PostDto.class) 170 | .block(); 171 | 172 | res.setHttpStatus(HttpStatus.OK); 173 | res.setObj(updatedPost); 174 | res.setMsg("SUCCESS"); 175 | } catch(Exception ex) { 176 | System.out.println("Exception found on | editPost() method | PostServiceImpl.class | "); 177 | System.out.println(ex.getMessage()); 178 | res.setHttpStatus(HttpStatus.BAD_REQUEST); 179 | res.setObj(null); 180 | res.setMsg("ERROR"); 181 | } 182 | return res; 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /Microservices/hospital/src/main/java/lk/himash/hospital/service/serviceImpl/PatientServiceImpl.java: -------------------------------------------------------------------------------- 1 | package lk.himash.hospital.service.serviceImpl; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.springframework.http.HttpEntity; 6 | import org.springframework.http.HttpHeaders; 7 | import org.springframework.http.HttpMethod; 8 | import org.springframework.http.MediaType; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.web.client.RestTemplate; 12 | 13 | import com.google.gson.Gson; 14 | 15 | import lk.himash.hospital.dto.PatientDto; 16 | import lk.himash.hospital.dto.Response; 17 | import lk.himash.hospital.service.PatientService; 18 | import lk.himash.hospital.util.PropertyFileReader; 19 | 20 | @Service 21 | public class PatientServiceImpl implements PatientService { 22 | 23 | private static RestTemplate restTemplate = new RestTemplate(); 24 | 25 | @Override 26 | public Response getAllPatientDetails() { 27 | Response res = new Response(); 28 | ResponseEntity result = null; 29 | Gson gson = new Gson(); 30 | HttpHeaders headers = new HttpHeaders(); 31 | try { 32 | // headers.add(HttpHeaders.AUTHORIZATION, jsonReader.getAccesTokenforErpNext().get("token")); If have JWT authentication 33 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 34 | HttpEntity entity = new HttpEntity("parameters", headers); 35 | String url = PropertyFileReader.getPropertyFileData("GET_ALL_PATIENT_DETAILS"); 36 | result = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); 37 | res = gson.fromJson(result.getBody(), Response.class); 38 | } catch (Exception ex) { 39 | System.out.println("Exception found on | getAllPatientDetails() method | PatientService.class | "); 40 | System.out.println(ex.getMessage()); 41 | } 42 | return res; 43 | } 44 | 45 | @Override 46 | public Response getPatientDetails(String id) { 47 | Response res = new Response(); 48 | ResponseEntity result = null; 49 | Gson gson = new Gson(); 50 | HttpHeaders headers = new HttpHeaders(); 51 | try { 52 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 53 | HttpEntity entity = new HttpEntity("parameters", headers); 54 | String url = PropertyFileReader.getPropertyFileData("GET_PATIENT_DETAILS"); 55 | result = restTemplate.exchange(url + id, HttpMethod.GET, entity, String.class); 56 | res = gson.fromJson(result.getBody(), Response.class); 57 | } catch (Exception ex) { 58 | System.out.println("Exception found on | getPatientDetails() method | PatientService.class | "); 59 | System.out.println(ex.getMessage()); 60 | } 61 | 62 | return res; 63 | } 64 | 65 | @Override 66 | public Response addPatient(PatientDto patientDto) { 67 | Response res = new Response(); 68 | HttpHeaders headers = new HttpHeaders(); 69 | ResponseEntity result = null; 70 | Gson gson = new Gson(); 71 | try { 72 | headers.add(HttpHeaders.CONTENT_TYPE, "application/json"); 73 | headers.add(HttpHeaders.ACCEPT, "application/json"); 74 | HttpEntity entity = new HttpEntity<>(patientDto, headers); 75 | String url = PropertyFileReader.getPropertyFileData("ADD_PATIENT"); 76 | result = restTemplate.postForEntity(url, entity, String.class); 77 | res = gson.fromJson(result.getBody(), Response.class); 78 | } catch (Exception ex) { 79 | System.out.println("Exception found on | addPatient() method | PatientService.class | "); 80 | System.out.println(ex.getMessage()); 81 | } 82 | 83 | return res; 84 | } 85 | 86 | @Override 87 | public Response removePatient(String id) { 88 | Response res = new Response(); 89 | ResponseEntity result = null; 90 | Gson gson = new Gson(); 91 | HttpHeaders headers = new HttpHeaders(); 92 | try { 93 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 94 | HttpEntity entity = new HttpEntity("parameters", headers); 95 | String url = PropertyFileReader.getPropertyFileData("REMOVE_PATIENT"); 96 | result = restTemplate.exchange(url + id, HttpMethod.DELETE, entity, String.class); 97 | res = gson.fromJson(result.getBody(), Response.class); 98 | } catch (Exception ex) { 99 | System.out.println("Exception found on | removePatient() method | PatientService.class | "); 100 | System.out.println(ex.getMessage()); 101 | } 102 | return res; 103 | } 104 | 105 | @Override 106 | public Response editDetails(PatientDto patientDto, String id) { 107 | Response res = new Response(); 108 | ResponseEntity result = null; 109 | Gson gson = new Gson(); 110 | HttpHeaders headers = new HttpHeaders(); 111 | try { 112 | headers.add(HttpHeaders.CONTENT_TYPE, "application/json"); 113 | headers.add(HttpHeaders.ACCEPT, "application/json"); 114 | HttpEntity entity = new HttpEntity<>(patientDto, headers); 115 | String url = PropertyFileReader.getPropertyFileData("EDIT_PATIENT_DETAILS"); 116 | result = restTemplate.exchange(url + id, HttpMethod.PUT, entity, String.class); 117 | res = gson.fromJson(result.getBody(), Response.class); 118 | } catch (Exception ex) { 119 | System.out.println("Exception found on | editDetails() method | PatientService.class | "); 120 | System.out.println(ex.getMessage()); 121 | } 122 | return res; 123 | } 124 | 125 | @Override 126 | public Response getPatientByName(String orderType) { 127 | Response res = new Response(); 128 | ResponseEntity result = null; 129 | Gson gson = new Gson(); 130 | HttpHeaders headers = new HttpHeaders(); 131 | try { 132 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 133 | HttpEntity entity = new HttpEntity("parameters", headers); 134 | String url = PropertyFileReader.getPropertyFileData("GET_PATIENT_BY_NAME"); 135 | result = restTemplate.exchange(url + orderType, HttpMethod.GET, entity, String.class); 136 | res = gson.fromJson(result.getBody(), Response.class); 137 | } catch (Exception ex) { 138 | System.out.println("Exception found on | getPatientByName() method | PatientService.class | "); 139 | System.out.println(ex.getMessage()); 140 | } 141 | return res; 142 | } 143 | 144 | @Override 145 | public Response getPatientByAge(String orderType) { 146 | Response res = new Response(); 147 | ResponseEntity result = null; 148 | Gson gson = new Gson(); 149 | HttpHeaders headers = new HttpHeaders(); 150 | try { 151 | headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); 152 | HttpEntity entity = new HttpEntity("parameters", headers); 153 | String url = PropertyFileReader.getPropertyFileData("GET_PATIENT_BT_AGE"); 154 | result = restTemplate.exchange(url + orderType, HttpMethod.GET, entity, String.class); 155 | res = gson.fromJson(result.getBody(), Response.class); 156 | } catch (Exception ex) { 157 | System.out.println("Exception found on | getPatientByName() method | PatientService.class | "); 158 | System.out.println(ex.getMessage()); 159 | } 160 | return res; 161 | } 162 | 163 | 164 | 165 | } 166 | -------------------------------------------------------------------------------- /Microservices/hospital/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /Microservices/Services/patient/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/doctor.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /Microservices/Services/patient/patient.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Microservices/hospital/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /Microservices/Services/doctor/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /Microservices/Services/patient/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | --------------------------------------------------------------------------------