Make the persistence method of hanging protocols configurable

- Implement ProtocolStore interface to allow persisting hanging protocols using different strategies
- Implement and set default strategy to persist hanging protocols in the MongoDB collection “HangingProtocols” in the application server
This commit is contained in:
Evren Ozkan committed 2017-01-04 17:49:31 -05:00
1 parent 06412b51bf
commit 77182d1916
17 files changed
+282 -183

No files matched your search

@@ -191,7 +191,7 @@ HP.ProtocolEngine = class ProtocolEngine {
findMatchByStudy(study) {
var matched = [];
HangingProtocols.find().forEach(protocol => {
HP.ProtocolStore.getProtocol().forEach(protocol => {
// Clone the protocol's protocolMatchingRules array
// We clone it so that we don't accidentally add the
// numberOfPriorsReferenced rule to the Protocol itself.
@@ -220,9 +220,7 @@ HP.ProtocolEngine = class ProtocolEngine {
});
if (!matched.length) {
var defaultProtocol = HangingProtocols.findOne({
id: 'defaultProtocol'
});
var defaultProtocol = HP.ProtocolStore.getProtocol('defaultProtocol');
return [{
score: 1,