-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid creating stub patientss and/or local patient unless strictly re…
…quired due to request to create new resource in patient compartment
- Loading branch information
1 parent
b82de1e
commit 96e9f40
Showing
27 changed files
with
1,478 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package edu.ohsu.cmp.ecp.sds; | ||
|
||
import java.util.Optional; | ||
|
||
import org.hl7.fhir.instance.model.api.IIdType; | ||
|
||
public final class Permissions { | ||
private final IIdType authorizedUserId; | ||
private final Optional<Permissions.ReadAllPatients> readAllPatients ; | ||
private final Optional<Permissions.ReadAndWriteSpecificPatient> readAndWriteSpecificPatient ; | ||
|
||
public Permissions( Permissions.ReadAllPatients readAllPatients ) { | ||
this.readAllPatients = Optional.of(readAllPatients); | ||
authorizedUserId = readAllPatients.authorizedUserId() ; | ||
this.readAndWriteSpecificPatient = Optional.empty(); | ||
} | ||
|
||
public Permissions( Permissions.ReadAndWriteSpecificPatient readAndWriteSpecificPatient) { | ||
this.readAllPatients = Optional.empty(); | ||
this.readAndWriteSpecificPatient = Optional.of( readAndWriteSpecificPatient ); | ||
authorizedUserId = readAndWriteSpecificPatient.authorizedUserId() ; | ||
} | ||
|
||
public IIdType authorizedUserId() { | ||
return authorizedUserId ; | ||
} | ||
|
||
public Optional<Permissions.ReadAllPatients> readAllPatients() { | ||
return readAllPatients ; | ||
} | ||
public Optional<Permissions.ReadAndWriteSpecificPatient> readAndWriteSpecificPatient() { | ||
return readAndWriteSpecificPatient ; | ||
} | ||
|
||
public static final class ReadAllPatients { | ||
private final IIdType authorizedUserId; | ||
|
||
public ReadAllPatients(IIdType authorizedUserId) { | ||
this.authorizedUserId = authorizedUserId; | ||
} | ||
|
||
public IIdType authorizedUserId() { | ||
return authorizedUserId ; | ||
} | ||
} | ||
|
||
public static final class ReadAndWriteSpecificPatient { | ||
private final IIdType authorizedUserId; | ||
|
||
private final UserIdentity patientId; | ||
|
||
public ReadAndWriteSpecificPatient(IIdType authorizedUserId, UserIdentity patientId) { | ||
this.authorizedUserId = authorizedUserId; | ||
this.patientId = patientId; | ||
} | ||
|
||
public IIdType authorizedUserId() { | ||
return authorizedUserId ; | ||
} | ||
|
||
public UserIdentity patientId() { | ||
return patientId ; | ||
} | ||
|
||
public Permissions.ReadAndWriteSpecificPatient withUpdatedPatientIdentity( UserIdentity replacementPatientId ) { | ||
return new ReadAndWriteSpecificPatient( authorizedUserId, replacementPatientId ) ; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.