Skip to content

Commit c650ece

Browse files
committed
final
1 parent 9f422b1 commit c650ece

File tree

25 files changed

+149
-107
lines changed

25 files changed

+149
-107
lines changed

Vishal Mawani/Sprint 1/HealthCareSystem/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<attribute name="test" value="true"/>
2525
</attributes>
2626
</classpathentry>
27-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
27+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
2828
<attributes>
2929
<attribute name="maven.pomderived" value="true"/>
3030
</attributes>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
44
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5-
org.eclipse.jdt.core.compiler.compliance=1.5
5+
org.eclipse.jdt.core.compiler.compliance=1.8
66
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
77
org.eclipse.jdt.core.compiler.debug.localVariable=generate
88
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -13,4 +13,4 @@ org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
1313
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
1414
org.eclipse.jdt.core.compiler.processAnnotations=disabled
1515
org.eclipse.jdt.core.compiler.release=disabled
16-
org.eclipse.jdt.core.compiler.source=1.5
16+
org.eclipse.jdt.core.compiler.source=1.8

Vishal Mawani/Sprint 1/HealthCareSystem/src/main/java/com/capgemini/healthcaresystem/dao/TestDao.java

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33

44

55
import com.capgemini.healthcaresystem.dto.DiagnosticTest;
6-
import com.capgemini.healthcaresystem.ui.Ui;
76
import com.capgemini.healthcaresystem.util.TestRepository;
87

98
import java.util.ArrayList;
109
import java.util.List;
1110
import java.util.Map;
12-
import java.util.Scanner;
1311
import java.util.Map.Entry;
1412

1513
public class TestDao {
1614

1715

1816

19-
public String addTestDao(String cId,DiagnosticTest diagnosticTest) {
17+
public String addTestDao(String cId,DiagnosticTest diagnosticTest){
2018

2119
for (Entry<String, List<DiagnosticTest>> entry : TestRepository.getCenterIdTestListMap().entrySet()) {
2220
String key = entry.getKey();
23-
System.out.println(key);
21+
2422
if(key.equals(cId)) {
2523
List<DiagnosticTest> values = entry.getValue();
2624
values.add(diagnosticTest);
@@ -36,34 +34,38 @@ public String addTestDao(String cId,DiagnosticTest diagnosticTest) {
3634

3735

3836

39-
public boolean removeTestDao(String cid,String testname,DiagnosticTest diagnosticTest) {
40-
41-
return true;
37+
public String removeTestDao(String cid,DiagnosticTest diagnosticTest) {
38+
for (Entry<String, List<DiagnosticTest>> entry : TestRepository.getCenterIdTestListMap().entrySet()) {
39+
String key = entry.getKey();
40+
if(key.equals(cid)) {
41+
List<DiagnosticTest> values = entry.getValue();
42+
values.remove(diagnosticTest);
43+
TestRepository.getCenterIdTestListMap().put(key, values);
44+
}
45+
}
46+
return "removed successfully";
4247
}
4348

44-
public List<String> getCenterIdTestListDao(String cid){
45-
List<String> tempDao = new ArrayList<String>();
46-
for (Entry<String, List<DiagnosticTest>> entry : TestRepository.getCenterIdTestListMap().entrySet()) {
47-
String key = entry.getKey();
48-
System.out.println(key);
49-
if(key.equals(cid)) {
50-
List<DiagnosticTest> values = entry.getValue();
51-
for(int i=0;i<values.size();i++) {
52-
tempDao.add(values.get(i).getTestName());
53-
}
54-
}
55-
}
56-
return tempDao;}
57-
public Map<String,String> getCenterIdCenterNameMapDao() {
58-
return TestRepository.getCenterIdCenterNameMap();
59-
}
49+
// public List<String> getCenterIdTestListDao(String cid){
50+
// List<String> tempDao = new ArrayList<String>();
51+
// for (Entry<String, List<DiagnosticTest>> entry : TestRepository.getCenterIdTestListMap().entrySet()) {
52+
// String key = entry.getKey();
53+
// if(key.equals(cid)) {
54+
// List<DiagnosticTest> values = entry.getValue();
55+
// for(int i=0;i<values.size();i++) {
56+
// tempDao.add(values.get(i).getTestName());
57+
// }
58+
// }
59+
// }
60+
// return tempDao;
61+
// }
6062

63+
// public Map<String,String> getCenterIdCenterNameMapDao() {
64+
// return TestRepository.getCenterIdCenterNameMap();
65+
// }
6166

62-
63-
64-
6567

66-
public String getTestIdDao() {
68+
public String getTestIdDao() {
6769
return TestRepository.getTestId();
6870
}
6971
}

Vishal Mawani/Sprint 1/HealthCareSystem/src/main/java/com/capgemini/healthcaresystem/dto/DiagnosticCenter.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ public class DiagnosticCenter {
77

88
private String centerName;
99
private String centerId;
10-
public List<DiagnosticTest> listOfTests;
11-
public List<Appointment> appointmentList;
10+
public static List<DiagnosticTest> listOfTests;
11+
public static List<Appointment> appointmentList;
1212
static int randomCenterId=1001;
13-
//public List<DiagnosticCenter> centerList;
1413

15-
// Constructor
1614

1715
public DiagnosticCenter() {
1816

@@ -23,8 +21,8 @@ public DiagnosticCenter(String centerName, String centerId, List<DiagnosticTest>
2321
super();
2422
this.centerName = centerName;
2523
this.centerId = centerId;
26-
this.listOfTests = listOfTests;
27-
this.appointmentList = appointmentList;
24+
DiagnosticCenter.listOfTests = listOfTests;
25+
DiagnosticCenter.appointmentList = appointmentList;
2826
}
2927

3028
// Getters and Setters

Vishal Mawani/Sprint 1/HealthCareSystem/src/main/java/com/capgemini/healthcaresystem/dto/DiagnosticTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class DiagnosticTest {
44

55
private String testId;
66
private String testName;
7-
static int randomTestId=100;
7+
88

99
// Constructor
1010

@@ -33,10 +33,5 @@ public void setTestName(String testName) {
3333
this.testName = testName;
3434
}
3535

36-
public String generateTestId() {
37-
//Method or function to generate testId automatically...
38-
randomTestId+=1;
39-
return Integer.toString(randomTestId);
4036

4137
}
42-
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.capgemini.healthcaresystem.exception;
2+
3+
public class CenterIdIsNotPresent extends Exception{
4+
5+
public CenterIdIsNotPresent(String message) {
6+
super(message);
7+
}
8+
}

Vishal Mawani/Sprint 1/HealthCareSystem/src/main/java/com/capgemini/healthcaresystem/service/TestService.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,35 @@ public String addTestService(String cId,DiagnosticTest diagnosticTest) throws Nu
3030

3131

3232

33-
public boolean removeTestService(String cid,String testname,DiagnosticTest diagnosticTest) throws NullTestValue {
33+
public String removeTestService(String cid,DiagnosticTest diagnosticTest) throws NullTestValue, NullCenterId {
34+
3435
if(diagnosticTest == null) {
3536
throw new NullTestValue("Test object passed is null");
3637
}
37-
testDaoObject.removeTestDao(cid,testname,diagnosticTest);
38-
return true;
39-
}
40-
41-
public List<String> getCenterIdTestListService(String cid) throws NullCenterId{
38+
4239
if(cid.isEmpty()) {
43-
throw new NullCenterId("Center Id is passed null");
40+
throw new NullCenterId("Center Id passed is null");
4441
}
4542

46-
return testDaoObject.getCenterIdTestListDao(cid);
47-
43+
testDaoObject.removeTestDao(cid,diagnosticTest);
44+
return "called testDao remove";
4845
}
4946

50-
public Map<String,String> getCenterIdCenterNameMapService() {
51-
return testDaoObject.getCenterIdCenterNameMapDao();
52-
}
47+
48+
49+
50+
// public List<String> getCenterIdTestListService(String cid) throws NullCenterId{
51+
// if(cid.isEmpty()) {
52+
// throw new NullCenterId("Center Id is passed null");
53+
// }
54+
//
55+
// return testDaoObject.getCenterIdTestListDao(cid);
56+
//
57+
// }
58+
59+
// public Map<String,String> getCenterIdCenterNameMapService() {
60+
// return testDaoObject.getCenterIdCenterNameMapDao();
61+
// }
5362

5463

5564
public String getTestIdService() {

Vishal Mawani/Sprint 1/HealthCareSystem/src/main/java/com/capgemini/healthcaresystem/ui/Ui.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.capgemini.healthcaresystem.ui;
22

33
import java.util.Scanner;
4-
5-
import com.capgemini.healthcaresystem.dao.TestDao;
64
import com.capgemini.healthcaresystem.dto.DiagnosticTest;
75
import com.capgemini.healthcaresystem.exception.NullCenterId;
86
import com.capgemini.healthcaresystem.exception.NullTestValue;
@@ -35,22 +33,23 @@ public void execute(){
3533
switch(getChoice()) {
3634

3735
case 1:
38-
System.out.println(testServiceObject.getCenterIdCenterNameMapService());
36+
//System.out.println(testServiceObject.getCenterIdCenterNameMapService());
3937

40-
DiagnosticTest temp = new DiagnosticTest(getTestId(),getTestName());
38+
DiagnosticTest temp = new DiagnosticTest(null,getTestName());
4139

4240
String cid = getCenterId();
4341
testServiceObject.addTestService(cid,temp);
4442
break;
4543

4644
case 2:
47-
System.out.println(testServiceObject.getCenterIdCenterNameMapService());
45+
//System.out.println(testServiceObject.getCenterIdCenterNameMapService());
4846
sc.nextLine();
4947
String cid1 = getCenterId();
50-
System.out.println(testServiceObject.getCenterIdTestListService(cid1));
48+
//System.out.println(testServiceObject.getCenterIdTestListService(cid1));
49+
String tid = getTestIdUser();
5150
String tname = getTestName();
52-
DiagnosticTest temp1 = new DiagnosticTest(getTestId(),tname);
53-
testServiceObject.removeTestService(cid1,tname,temp1);
51+
DiagnosticTest temp1 = new DiagnosticTest(tid,tname);
52+
testServiceObject.removeTestService(cid1,temp1);
5453
break;
5554

5655
default:
@@ -60,36 +59,40 @@ public void execute(){
6059
}
6160
}
6261

63-
catch(NullTestValue e) {
64-
System.out.println(e.getMessage());
65-
}
66-
catch(NullCenterId e) {
62+
catch(NullTestValue | NullCenterId e) {
6763
System.out.println(e.getMessage());
6864
}
6965
}
7066

7167

7268

69+
private String getTestIdUser() {
70+
System.out.println("Enter test id:");
71+
return sc.nextLine();
72+
}
73+
74+
75+
7376
public int getChoice() {
74-
int choice = sc.nextInt();
75-
return choice;
77+
return sc.nextInt();
7678
}
7779

7880
public String getCenterId() {
7981
System.out.println("Enter Center Id:");
8082

81-
String userInputCenterId = sc.nextLine();
82-
return userInputCenterId;
83+
return sc.nextLine();
84+
8385
}
8486

8587
public String getTestId() {
8688
return testServiceObject.getTestIdService();
8789
}
90+
8891
public String getTestName() {
8992
System.out.println("Enter test name:");
9093
sc.nextLine();
91-
String userInputTestName = sc.nextLine();
92-
return userInputTestName;
94+
return sc.nextLine();
95+
9396
}
9497

9598
}

0 commit comments

Comments
 (0)