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
038e14cc
Commit
038e14cc
authored
4 years ago
by
xuechen5
Browse files
Options
Downloads
Patches
Plain Diff
Backend: Activate and Deactivate a Pre-Registered Patient
parent
ba8159b3
No related branches found
Branches containing commit
No related tags found
2 merge requests
!22
Merge UC92 into Master
,
!15
Merge 5-uc-92-activate-pre-registered-patient-2 into UC92v2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java
+108
-0
108 additions, 0 deletions
.../ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java
with
108 additions
and
0 deletions
iTrust/src/edu/ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java
0 → 100644
+
108
−
0
View file @
038e14cc
package
edu.ncsu.csc.itrust.action
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
edu.ncsu.csc.itrust.action.base.PatientBaseAction
;
import
edu.ncsu.csc.itrust.beans.Email
;
import
edu.ncsu.csc.itrust.beans.PatientBean
;
import
edu.ncsu.csc.itrust.beans.PatientHistoryBean
;
import
edu.ncsu.csc.itrust.dao.DAOFactory
;
import
edu.ncsu.csc.itrust.dao.mysql.AuthDAO
;
import
edu.ncsu.csc.itrust.dao.mysql.PatientDAO
;
import
edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO
;
import
edu.ncsu.csc.itrust.exception.DBException
;
import
edu.ncsu.csc.itrust.exception.FormValidationException
;
import
edu.ncsu.csc.itrust.exception.ITrustException
;
import
edu.ncsu.csc.itrust.validate.PatientValidator
;
/**
* Edits a patient Used by editPatient.jsp
*
*
*/
public
class
ActivateAndDeactivatePreRegi
extends
PatientBaseAction
{
private
PatientValidator
validator
=
new
PatientValidator
();
private
PatientDAO
patientDAO
;
private
PersonnelDAO
personnelDAO
;
private
AuthDAO
authDAO
;
private
long
loggedInMID
;
/**
* The super class validates the patient id
*
* @param factory The DAOFactory used to create the DAOs for this action.
* @param loggedInMID The MID of the user who is authorizing this action.
* @param pidString The MID of the patient being edited.
* @throws ITrustException
*/
public
ActivateAndDeactivatePreRegi
(
DAOFactory
factory
,
long
loggedInMID
,
String
pidString
)
throws
ITrustException
{
super
(
factory
,
pidString
);
this
.
patientDAO
=
factory
.
getPatientDAO
();
this
.
personnelDAO
=
factory
.
getPersonnelDAO
();
this
.
authDAO
=
factory
.
getAuthDAO
();
this
.
loggedInMID
=
loggedInMID
;
}
/**
* Takes the information out of the PatientBean param and updates the patient's information
*
* @param p
* the new patient information
* @throws ITrustException
* @throws FormValidationException
*/
public
void
updateInformation
(
PatientBean
p
)
throws
ITrustException
,
FormValidationException
{
p
.
setMID
(
pid
);
// for security reasons
validator
.
validate
(
p
);
patientDAO
.
editPatient
(
p
,
loggedInMID
);
}
/**
* Returns a PatientBean for the patient
*
* @return the PatientBean
* @throws DBException
*/
public
PatientBean
getPatient
()
throws
DBException
{
return
patientDAO
.
getPatient
(
this
.
getPid
());
}
/**
* The DateOfDeactivationStr of the PatientBean when not null indicates that the user has been deactivated.
* @throws DBException
*/
public
void
deactivate
()
throws
DBException
{
PatientBean
p
=
patientDAO
.
getPatient
(
this
.
getPid
());
p
.
setMID
(
pid
);
p
.
setDateOfDeactivationStr
(
new
SimpleDateFormat
(
"MM/dd/yyyy"
).
format
(
Calendar
.
getInstance
().
getTime
()));
patientDAO
.
editPatient
(
p
,
loggedInMID
);
patientDAO
.
removeAllRepresented
(
pid
);
patientDAO
.
removeAllRepresentee
(
pid
);
}
/**
* The DateOfDeactivationStr of the PatientBean is null when the patient is activated
* @throws DBException
*/
public
long
activate
()
throws
DBException
{
PatientBean
p
=
patientDAO
.
getPatient
(
this
.
getPid
());
p
.
setMID
(
pid
);
p
.
setDateOfDeactivationStr
(
null
);
//patientDAO.editPatient(p, loggedInMID);
patientDAO
.
ConvertPreRegisteredPatientsToPatient
(
this
.
getPid
());
//this.getPid());//411); //////////// this.getPid()
return
this
.
getPid
();
}
}
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