Package org.javarosa.core.model
Class IDag
java.lang.Object
org.javarosa.core.model.IDag
- Direct Known Subclasses:
April2014DagImpl,LatestDagBase,LegacyDagImpl
public abstract class IDag extends Object
Abstract interface of the DAG management and triggerable processing logic.
Some method bodies are intentionally duplicated in the derived classes
so as to ensure that future changes do not affect the existing implementations.
- Author:
- mitchellsundt@gmail.com
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIDag.EventNotifierAccessor -
Field Summary
Fields Modifier and Type Field Description protected IDag.EventNotifierAccessoraccessorprotected HashMap<TreeReference,QuickTriggerable>conditionRepeatTargetIndexprotected ArrayList<QuickTriggerable>triggerablesDAGprotected HashMap<TreeReference,ArrayList<QuickTriggerable>>triggerIndexprotected ArrayList<QuickTriggerable>unorderedTriggerables -
Constructor Summary
Constructors Modifier Constructor Description protectedIDag(IDag.EventNotifierAccessor accessor) -
Method Summary
Modifier and Type Method Description TriggerableaddTriggerable(Triggerable t)Add the triggerables to the dataset prior to finalizing.abstract voidcopyItemsetAnswer(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement copyToElement, boolean midSurvey)Take actions related to changes of select-one and select-multiple itemsets.abstract voidcreateRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement parentElement, TreeElement createdElement)Take whatever action is required when creating a repeat group.abstract voiddeleteRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement parentElement, TreeElement deletedElement)Take whatever action is required when deleting a repeat group.abstract voidfinalizeTriggerables(FormInstance mainInstance, EvaluationContext evalContext)Initialize the triggerableDAG array and the triggerIndex array.IConditionExprgetConditionExpressionForTrueAction(FormInstance mainInstance, TreeElement instanceNode, int action)Pull this in from FormOverview so that we can make fields private.ArrayList<Condition>getConditions()API for retrieving the list of conditions, for use when serializing the form definition (e.g., into .cache file).abstract FormDef.EvalBehaviorgetEvalBehavior()The EvalBehavior that the implementation provides.ArrayList<Recalculate>getRecalculates()API for retrieving thelist of recalculates, for use when serializing the form definition (e.g., into .cache file).abstract QuickTriggerablegetTriggerableForRepeatGroup(TreeReference ref)Used to obtain the triggerable that impacts the relevancy of the repeat group.abstract Collection<QuickTriggerable>initializeTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference rootRef, boolean midSurvey)Invoked externally when a new mainInstance is loaded (initial sweep of calculates).voidprintTriggerables(String path)For debuggingprotected voidpublishSummary(String lead, Collection<QuickTriggerable> quickTriggerables)protected voidpublishSummary(String lead, TreeReference ref, Collection<QuickTriggerable> quickTriggerables)voidreportDependencyCycles()abstract booleanshouldTrustPreviouslyCommittedAnswer()Specifies if unchanged answers should be trusted (and not re-committed).abstract Collection<QuickTriggerable>triggerTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, boolean midSurvey)Fire a triggereable.ValidateOutcomevalidate(FormEntryController formEntryControllerToBeValidated, boolean markCompleted)Invoked to validate a filled-in form.
-
Field Details
-
Constructor Details
-
Method Details
-
getEvalBehavior
The EvalBehavior that the implementation provides.- Returns:
-
getTriggerableForRepeatGroup
Used to obtain the triggerable that impacts the relevancy of the repeat group.- Parameters:
ref-- Returns:
-
triggerTriggerables
public abstract Collection<QuickTriggerable> triggerTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, boolean midSurvey)Fire a triggereable.- Parameters:
mainInstance-evalContext-ref-midSurvey-
-
deleteRepeatGroup
public abstract void deleteRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement parentElement, TreeElement deletedElement)Take whatever action is required when deleting a repeat group.- Parameters:
mainInstance-evalContext-ref-parentElement-deletedElement-
-
createRepeatGroup
public abstract void createRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement parentElement, TreeElement createdElement)Take whatever action is required when creating a repeat group.- Parameters:
mainInstance-evalContext-ref-parentElement-createdElement-
-
copyItemsetAnswer
public abstract void copyItemsetAnswer(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, TreeElement copyToElement, boolean midSurvey)Take actions related to changes of select-one and select-multiple itemsets.- Parameters:
mainInstance-evalContext-ref-copyToElement-midSurvey-
-
addTriggerable
Add the triggerables to the dataset prior to finalizing.- Parameters:
t-
-
finalizeTriggerables
public abstract void finalizeTriggerables(FormInstance mainInstance, EvaluationContext evalContext) throws IllegalStateExceptionInitialize the triggerableDAG array and the triggerIndex array.- Parameters:
mainInstance-evalContext-- Throws:
IllegalStateException
-
initializeTriggerables
public abstract Collection<QuickTriggerable> initializeTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference rootRef, boolean midSurvey)Invoked externally when a new mainInstance is loaded (initial sweep of calculates). Invoked internally when creating repeat groups and copying itemsets(?).- Parameters:
mainInstance-evalContext-rootRef-midSurvey- true if we are during the survey, false if we are on loading/saving phase
-
validate
public ValidateOutcome validate(FormEntryController formEntryControllerToBeValidated, boolean markCompleted)Invoked to validate a filled-in form. Sweeps through from beginning to end, confirming that the entered values satisfy all constraints. The FormEntryController is based upon the FormDef, but has its own model and controller independent of anything at the UI layer.- Parameters:
formEntryControllerToBeValidated-markCompleted-- Returns:
-
shouldTrustPreviouslyCommittedAnswer
public abstract boolean shouldTrustPreviouslyCommittedAnswer()Specifies if unchanged answers should be trusted (and not re-committed).- Returns:
-
publishSummary
-
publishSummary
protected final void publishSummary(String lead, TreeReference ref, Collection<QuickTriggerable> quickTriggerables) -
printTriggerables
For debugging -
getConditionExpressionForTrueAction
public final IConditionExpr getConditionExpressionForTrueAction(FormInstance mainInstance, TreeElement instanceNode, int action)Pull this in from FormOverview so that we can make fields private.- Parameters:
instanceNode-action-- Returns:
-
getConditions
API for retrieving the list of conditions, for use when serializing the form definition (e.g., into .cache file).- Returns:
-
getRecalculates
API for retrieving thelist of recalculates, for use when serializing the form definition (e.g., into .cache file).- Returns:
-
reportDependencyCycles
public final void reportDependencyCycles()
-