Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs427fa20team22
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
htmoss2
cs427fa20team22
Commits
0bf0d424
Commit
0bf0d424
authored
4 years ago
by
xuechen5
Committed by
adityab3
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement AddPreRegisterPatientAction when preregister form is submitted
parent
330be7bf
Branches
UC91.1
Branches containing commit
No related tags found
1 merge request
!3
Uc91.1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/action/AddPreRegisteredPatientAction.java
+22
-8
22 additions, 8 deletions
...ncsu/csc/itrust/action/AddPreRegisteredPatientAction.java
with
22 additions
and
8 deletions
iTrust/src/edu/ncsu/csc/itrust/action/AddPreRegisteredPatientAction.java
+
22
−
8
View file @
0bf0d424
...
...
@@ -6,6 +6,10 @@ import edu.ncsu.csc.itrust.beans.PatientBean;
import
edu.ncsu.csc.itrust.dao.DAOFactory
;
import
edu.ncsu.csc.itrust.dao.mysql.PatientDAO
;
import
edu.ncsu.csc.itrust.dao.mysql.AuthDAO
;
import
edu.ncsu.csc.itrust.enums.Role
;
import
edu.ncsu.csc.itrust.exception.FormValidationException
;
import
edu.ncsu.csc.itrust.exception.ITrustException
;
import
edu.ncsu.csc.itrust.validate.AddPatientValidator
;
/**
* Used for Add Pre-registered Patient page (PreRegisterPatient.jsp). This just adds an empty patient, creates an entered password for
...
...
@@ -27,23 +31,33 @@ public class AddPreRegisteredPatientAction {
* @param loggedInMID
*/
public
AddPreRegisteredPatientAction
(
DAOFactory
factory
,
long
loggedInMID
)
{
this
.
patientDAO
=
factory
.
getPatientDAO
();
this
.
loggedInMID
=
loggedInMID
;
this
.
patientDAO
=
factory
.
getPatientDAO
();
this
.
loggedInMID
=
loggedInMID
;
this
.
authDAO
=
factory
.
getAuthDAO
();
}
/**
* Creates a new patient, returns the new MID.
* Creates a new patient, returns the new MID. Adds a new user to the table with a
* preRegisteredPatient role
*
* @param p patient to be created
* @return the new MID of the patient
* @throws FormValidationException if the patient is not successfully validated
* @throws ITrustException
*/
public
long
addPatient
(
PatientBean
p
)
{
// Add patient to DB
long
newMID
=
0L
;
public
long
addPatient
(
PatientBean
p
)
throws
FormValidationException
,
ITrustException
{
new
AddPatientValidator
().
validate
(
p
);
long
newMID
=
patientDAO
.
addEmptyPatient
();
// the new added row id in the database
p
.
setMID
(
newMID
);
String
pwd
=
authDAO
.
addUser
(
newMID
,
Role
.
PREREGISTEREDPATIENT
,
p
.
getPassword
());
p
.
setPassword
(
pwd
);
patientDAO
.
editPatient
(
p
,
loggedInMID
);
return
newMID
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment