-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow api upgrade #2744
base: master
Are you sure you want to change the base?
Workflow api upgrade #2744
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Aditya!
add some test.
} | ||
|
||
/** Provides a read-only view of a request phase. */ | ||
class ReadOnlyRequestPhase<R : CPGRequestResource<*>>(private val cpgRequestResource: R) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should phase implement read only phrase?
fun getPhase() = | ||
when (cpgRequestResource.getIntent()) { | ||
Intent.PROPOSAL -> Phase.PhaseName.PROPOSAL | ||
Intent.PLAN -> Phase.PhaseName.PLAN | ||
Intent.ORDER -> Phase.PhaseName.ORDER | ||
else -> | ||
throw IllegalArgumentException( | ||
"Resource intent can't be ${cpgRequestResource.getIntent().code} ", | ||
) | ||
} | ||
|
||
/** Returns the underlying [CPGRequestResource] of this phase. */ | ||
fun getRequestResource() = cpgRequestResource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these just be in the base phase class?
* Returns an iterator to go over the previous states of the activity flow. The iterator provides | ||
* a read-only view to the phase. | ||
*/ | ||
fun getPreviousPhase(): PreviousPhaseIterator<R> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think it's better or worse to just return a list?
i can see different arguments, it's only 3 phases at most, but maybe developers typically would want to display the previous phases together (maybe?) and if this is an interator, they actually have to repeated call till all phases are loaded anyway? so I'm not sure if this is better...
but on the other hand, if they only wan to check a immediately preceding phase, this would be good... i don't really know how often that would be
val eventTypes = | ||
listOf( | ||
MedicationDispense::class.java, | ||
Communication::class.java, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment here to say we need to add new resource types to this list
CommunicationRequest::class.java, | ||
) | ||
|
||
val cache: MutableMap<String, CPGRequestResource<*>> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this variable.
* Represents the chain of event/requests of an activity flow. A [RequestChain] would either have a | ||
* [request] or an [event]. | ||
*/ | ||
internal data class RequestChain( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
} | ||
} | ||
|
||
fun of(request: Resource): CPGEventResource<*> { | ||
return when (request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return when (request) { | |
return when (event) { |
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2736
Description
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
Screenshots (if applicable)
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.