Class Interview
- Direct Known Subclasses:
ConcurrencyInterview
,EnvironmentInterview
,ExcludeListInterview
,InterviewParameters
,InterviewSet
,KeywordsInterview
,KnownFailuresListInterview
,ListQuestion.Body
,PriorStatusInterview
,TestsInterview
,TimeoutFactorInterview
questions
, to be
presented to the user via some tool such as an assistant or wizard.
Interviews may be stand-alone, or designed to be part of other interviews.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated.No longer used in this API, direct JavaHelp usage was removed.static class
This exception is to report problems that occur while updating an interview.static class
Deprecated.No longer used in this API, direct JavaHelp usage was removed.static class
This exception is thrown when a question is expected to be on the current path, and is not.static interface
An observer interface for receiving notifications as the state of the interview is updated. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
A value indicating that export should ignore all exceptions that arise while calling each question's export method.static final int
A value indicating that export should not ignore any exceptions that arise while calling each question's export method.static final int
A value indicating that export should ignore runtime exceptions that arise while calling each question's export method.protected static final String
protected static final HelpSetFactory
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
static final int
The highest version number currently in use.static final int
Where necessary, the harness interview should behave as it did before the 3.2 release.static final int
Where necessary, the harness interview should behave as it did for the 3.2 release.static final int
Where necessary, the harness interview should behave as it did for the 4.3 release.static final int
Where necessary, the harness interview should behave as it did for the 4.3 release.protected static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an observer to monitor updates to the interview.protected Question
callInterview
(Interview i, Question q) Return a special type of question used to indicate that a sub-interview interview should be called before proceeding to the next question in this interview.void
clear()
Clear any responses to all the questions in this interview, and then recursively, in its child interviews.void
clearMarkedResponses
(String name) Clear the response to marked questions.boolean
Create a checklist composed of all checklist items for questions on the current path.createChecklistItem
(String sectionKey, String textKey) Create a checklist item based on entries in the interview's resource bundle.createChecklistItem
(String sectionKey, String textKey, Object textArg) Create a checklist item based on entries in the interview's resource bundle.createChecklistItem
(String sectionKey, String textKey, Object... textArgs) Create a checklist item based on entries in the interview's resource bundle.void
Export values for questions on the current path, by callingQuestion.export(java.util.Map<java.lang.String, java.lang.String>)
for each question returned bygetPath()
.Get all questions in this interview and recursively, in all child interviews.Get the current question in the interview.Get a default image to be used for the questions of an interview.int
Get a value representing the policy regarding how to treat exceptions that may arise during export.Get a (shallow) copy of the current "external" values.Get the first question of the interview.Get the help set used to locate the "more info" for each question.getInterview
(String tag) Get a sub-interview with a given tag name.int
Determine which semantics are being used for interview and question behavior.Get the parent interview for which this is a child.Question[]
getPath()
Get the set of questions on the current path.Question[]
Get the set of questions on the current path up to and including the current question.Retrieve set of keys for the "external" values being stored in the configuration.Get the complete set of questions in this interview and recursively, in all child interviews.Question[]
getRawPath
(boolean includeFinals) Get the current set path of questions, including some things normally hidden.Get the resource bundle for this interview, used to look up internationalized strings, such as the title and text of each question.protected String
getResourceString
(String key) Get an entry from the resource bundle.protected String
getResourceString
(String key, boolean checkAncestorsFirst) Get an entry from the resource bundle.getRoot()
Get the root interview object for an interview series.getTag()
Get a tag used to qualify the tags of questions in this interview.getTitle()
Get a descriptive title associated with this interview.boolean
Determine if a question has a non-null successor.boolean
Determine if a question has a successor which is neither null nor an ErrorQuestion.boolean
Check whether any questions on the current path have any associated checklist items.static boolean
isChecksumValid
(Map<String, String> data, boolean okIfOmitted) Deprecated.As of version 4.4.1, checksums are no longer calculated or checked.boolean
isEdited()
Determine if this interview as having been edited or not.boolean
Check if the interview has been completed.boolean
Determine if a question is the first question of the interview.protected boolean
Check if this subinterview has been completed.boolean
Determine if a question is the last question of the interview.boolean
isRoot()
Determine if this is the root interview.boolean
Check if the interview has been started.iteratePath
(boolean flattenNestedInterviews) Get an iterator for the set of questions on the current path.iteratePathToCurrent
(boolean flattenNestedInterviews) Get an iterator for the set of questions on the current path up to and including the current question.void
last()
Advance to the last question in the interview.void
Load the state for questions from an archive map.void
Load the state for questions from an archive map.void
next()
Advance to the next question in the interview.boolean
Check if the path contains questions from a specific interview.boolean
Check if the path contains a specific question.void
prev()
Back up to the previous question in the interview.void
protected static Locale
readLocale
(Map<?, ?> data) Reads information about locale from the given map.void
Remove all the markers, whatever their name.void
removeMarkers
(String name) Remove all the markers with a specified name.void
Remove an observer previously registered to monitor updates to the interview.void
reset()
Start (or restart) the interview.retrieveProperty
(String key) Retrieve a property from the collection of "external" values being stored in the configuration.Retrieve a template property.void
Save the state for questions in an archive map.protected void
setBaseTag
(String newBaseTag) Change the base tag for this interview.void
Jump to a specific question in the interview.protected void
Set a default image to be used for the questions of an interview.void
setEdited
(boolean edited) Mark this interview as having been edited or not.void
setExportIgnoreExceptionPolicy
(int policy) Set the policy regarding how to treat exceptions that may arise during export.protected void
Set the first question for an interview.protected void
setHelpSet
(Object hs) Set the help set used to locate the "more info" for each question.protected void
setHelpSet
(String name) Set the name of the help set used to locate the "more info" for each question.protected void
setHelpSet
(String name, File file) Set the name of the help set used to locate the "more info" for each question.void
setInterviewSemantics
(int value) This method is being used to toggle changes which are not backwards compatible with existing interviews.protected void
setResourceBundle
(String name) Set the base name of the resource bundle used to look up internationalized strings, such as the title and text of each question.protected void
setResourceBundle
(String name, File file) Set the base name of the resource bundle used to look up internationalized strings, such as the title and text of each question.protected void
Set a descriptive title to be used to annotate this interview.storeProperty
(String key, String value) Store an "external" value into the configuration.void
storeTemplateProperties
(Map<String, String> props) Clear a previous template properties and store the new into the configuration.storeTemplateProperty
(String key, String value) Store a template value into the configuration.void
Update the current path, typically because a response to a question has changed.void
Update the current path, typically because a response to a question has changed.void
Verify that the current path contains a specified question, and throw an exception if it does not.protected static void
writeLocale
(Map<String, String> data) Writes information about current locale to the given map.
-
Field Details
-
EXPORT_IGNORE_ALL_EXCEPTIONS
public static final int EXPORT_IGNORE_ALL_EXCEPTIONSA value indicating that export should ignore all exceptions that arise while calling each question's export method.- See Also:
-
EXPORT_IGNORE_RUNTIME_EXCEPTIONS
public static final int EXPORT_IGNORE_RUNTIME_EXCEPTIONSA value indicating that export should ignore runtime exceptions that arise while calling each question's export method.- See Also:
-
EXPORT_IGNORE_NO_EXCEPTIONS
public static final int EXPORT_IGNORE_NO_EXCEPTIONSA value indicating that export should not ignore any exceptions that arise while calling each question's export method.- See Also:
-
SEMANTIC_PRE_32
public static final int SEMANTIC_PRE_32Where necessary, the harness interview should behave as it did before the 3.2 release. This does not control every single possible change in behavior, but does control certain behaviors which may cause problems with interview code written against an earlier version of the harness.- See Also:
-
SEMANTIC_VERSION_32
public static final int SEMANTIC_VERSION_32Where necessary, the harness interview should behave as it did for the 3.2 release. This does not control every single possible change in behavior, but does control certain behaviors which may cause problems with interview code written against an earlier version of the harness.- See Also:
-
SEMANTIC_VERSION_43
public static final int SEMANTIC_VERSION_43Where necessary, the harness interview should behave as it did for the 4.3 release. This does not control every single possible change in behavior, but does control certain behaviors which may cause problems with interview code written against an earlier version of the harness.- See Also:
-
SEMANTIC_VERSION_50
public static final int SEMANTIC_VERSION_50Where necessary, the harness interview should behave as it did for the 4.3 release. This does not control every single possible change in behavior, but does control certain behaviors which may cause problems with interview code written against an earlier version of the harness.- See Also:
-
SEMANTIC_MAX_VERSION
public static final int SEMANTIC_MAX_VERSIONThe highest version number currently in use. Note that the compiler will probably inline this during compilation, so you will be locked at the version which you compile against. This is probably a useful behavior in this case.- See Also:
-
helpSetFactory
-
QUESTION
- See Also:
-
INTERVIEW
- See Also:
-
LOCALE
- See Also:
-
MARKERS
- See Also:
-
MARKERS_PREF
- See Also:
-
EXTERNAL_PREF
- See Also:
-
TEMPLATE_PREF
- See Also:
-
-
Constructor Details
-
Interview
Create a top-level interview.- Parameters:
tag
- A tag that will be used to qualify the tags of any questions in this interview, to help ensure uniqueness of those tags.
-
Interview
Create an interview to be used as part of another interview.- Parameters:
parent
- The parent interview of which this is a part.baseTag
- A name that will be used to qualify the tags of any questions in this interview, to help ensure uniqueness of those tags. It will be combined with the parent's tag if that has been specified.
-
-
Method Details
-
isChecksumValid
Deprecated.As of version 4.4.1, checksums are no longer calculated or checked. True is always returned.Check if the checksum is valid for a set of responses. When responses are saved to a map, they are checksummed, so that they can be checked for validity when reloaded. This method verifies that a set of responses are acceptable for loading.- Parameters:
data
- The set of responses to be checked.okIfOmitted
- A boolean determining the response if there is no checksum available in the data- Returns:
- Always true.
-
writeLocale
Writes information about current locale to the given map.
This information is used later to properly restore locale-sensitive values, like numerics.- Parameters:
data
- target map to write data to- See Also:
-
readLocale
Reads information about locale from the given map.
Implementation looks for the string keyed byLOCALE
and then tries to decode it to valid locale object.- Parameters:
data
- map with interview values- Returns:
- locale, decoded from value taken from map; or default (current) locale
- See Also:
-
getParent
Get the parent interview for which this is a child.- Returns:
- the parent interview, or null if no parent has been specified.
-
getTag
Get a tag used to qualify the tags of questions in this interview.- Returns:
- the title
-
getTitle
Get a descriptive title associated with this interview. If not specified, the system will try and locate the title in the interview's resource bundle, using the resource nametitle
. of the interview.- Returns:
- the title
- See Also:
-
setTitle
Set a descriptive title to be used to annotate this interview.- Parameters:
title
- A short descriptive title.- See Also:
-
getDefaultImage
Get a default image to be used for the questions of an interview. If no default has been set for this interview, the parent's default image (if any) is used instead.- Returns:
- a URL for the default image to be used
- See Also:
-
setDefaultImage
Set a default image to be used for the questions of an interview.- Parameters:
u
- A URL for the image- See Also:
-
setResourceBundle
Set the base name of the resource bundle used to look up internationalized strings, such as the title and text of each question. If the name is treated as filename of file which is located in directory file. The default is the interview tag name if this is a root interview. If this is a child interview, there is no default resource bundle.- Parameters:
name
- The name of the resource bundle used to look up internationalized strings.file
- The directory to find name.- Throws:
MissingResourceException
- if the resource bundle cannot be found.- See Also:
-
getResourceBundle
Get the resource bundle for this interview, used to look up internationalized strings, such as the title and text of each question. If the bundle has not been set explicitly, it defaults to the parent's resource bundle; the root interview has a default resource bundle based on the interview tag name.- Returns:
- the resource bundle for this interview.
- See Also:
-
setResourceBundle
Set the base name of the resource bundle used to look up internationalized strings, such as the title and text of each question. If the name starts with '/', it will be treated as an absolute resource name, and used "as is"; otherwise it will be treated as relative to the package in which the actual interview class is defined. The default is the interview tag name if this is a root interview. If this is a child interview, there is no default resource bundle.- Parameters:
name
- The name of the resource bundle used to look up internationalized strings.- Throws:
MissingResourceException
- if the resource bundle cannot be found.- See Also:
-
setHelpSet
Set the name of the help set used to locate the "more info" for each question. The name should identify a resource containing a JavaHelp helpset file. If the name is treated as filename of file which is located in directory file. If help sets are specified for child interviews, they will automatically be added into the help set for the root interview.- Parameters:
name
- The name of the help set containing the "more info" for each question.file
- The directory to find help set.- Throws:
Interview.HelpNotFoundFault
- if the help set could not be locatedInterview.BadHelpFault
- if some problem occurred while opening the help setInterview.Fault
- See Also:
-
getHelpSet
Get the help set used to locate the "more info" for each question. If the help set has not been set explicitly, it defaults to the parent's help set.- Returns:
- the help set used to locate "more info" for questions in this interview.
- See Also:
-
setHelpSet
Set the name of the help set used to locate the "more info" for each question. The name should identify a resource containing a JavaHelp helpset file. If the name starts with '/', it will be treated as an absolute resource name, and used "as is"; otherwise it will be treated as relative to the package in which the actual interview class is defined. If help sets are specified for child interviews, they will automatically be added into the help set for the root interview.- Parameters:
name
- The name of the help set containing the "more info" for each question.- Throws:
Interview.HelpNotFoundFault
- if the help set could not be locatedInterview.BadHelpFault
- if some problem occurred while opening the help setInterview.Fault
- See Also:
-
setHelpSet
Set the help set used to locate the "more info" for each question. If help sets are specified for child interviews, they will automatically be added into the help set for the root interview.- Parameters:
hs
- The help set containing the "more info" for each question in this interview.- See Also:
-
isEdited
public boolean isEdited()Determine if this interview as having been edited or not.- Returns:
- true if this interview is marked as having been edited
-
setEdited
public void setEdited(boolean edited) Mark this interview as having been edited or not.- Parameters:
edited
- whether or not this interview is marked as edited
-
getFirstQuestion
Get the first question of the interview.- Returns:
- the first question of the interview
- See Also:
-
setFirstQuestion
Set the first question for an interview. This may be called more than once, but only while the interview is being constructed. Once any method has been called that refers to the interview path, the initial question may not be changed.- Parameters:
q
- The initial question- Throws:
IllegalStateException
- if it is too late to change the initial question.- See Also:
-
getInterview
Get a sub-interview with a given tag name. All descendents are searched (i.e. all children, all their children, etc.)- Parameters:
tag
- The tag of the interview to be found.- Returns:
- the sub-interview with the specified name.
- Throws:
Interview.Fault
- if no interview is found with the given name.
-
isFirst
Determine if a question is the first question of the interview.- Parameters:
q
- the question to check- Returns:
- true if this is the first question.
-
isLast
Determine if a question is the last question of the interview.- Parameters:
q
- the question to check- Returns:
- true if this is the last question.
-
hasNext
Determine if a question has a non-null successor.- Parameters:
q
- the question to check- Returns:
- true if this question has a non-null successor.
-
hasValidNext
Determine if a question has a successor which is neither null nor an ErrorQuestion.- Parameters:
q
- the question to check- Returns:
- true if this question has a successor which is neither null nor an ErrorQuestion
-
reset
public void reset()Start (or restart) the interview. The current question is reset to the first question, and the current path is evaluated from there. -
next
Advance to the next question in the interview. Questions that have beendisabled
will be skipped over.- Throws:
Interview.Fault
- if there are no more questions
-
prev
Back up to the previous question in the interview. Questions that have beendisabled
will be skipped over.- Throws:
Interview.Fault
- if there is no previous question.
-
last
Advance to the last question in the interview. Questions that have beendisabled
will be skipped over.- Throws:
Interview.Fault
- if there are no more questions
-
isStarted
public boolean isStarted()Check if the interview has been started. An interview is considered to be at the beginning if there is only one question on the current path of a type that requires a response. This indirectly implies it must be the last question on the current path, and must only be preceded byinformation-only
questions.- Returns:
- true if the first answerable question is unanswered.
-
isFinishable
public boolean isFinishable()Check if the interview has been completed. An interview is considered to have been completed if the final question on the current path is of typeFinalQuestion
.- Returns:
- true if the interview has been completed.
-
isInterviewFinishable
protected boolean isInterviewFinishable()Check if this subinterview has been completed. A subinterview is considered to have been completed if none of the questions from this subinterview on the current path return null as the result of getNext(). Note:compare this to isFinishable() which checks that the entire interview (of which this subinterview may be a part) is complete.- Returns:
- true is this subinterview has been completed.
-
getCurrentQuestion
Get the current question in the interview.- Returns:
- The current question.
- See Also:
-
setCurrentQuestion
Jump to a specific question in the interview. The question must be on the current path, but can be either before or after the current position at the time this is called.- Parameters:
q
- The question which is to become the current question in the interview.- Throws:
Interview.Fault
- if the question given is not on the current path.- See Also:
-
getPath
Get the set of questions on the current path. The first question is determined by the interview; after that, each question in turn determines its successor. The path ends when a question indicates no successor (or erroneously returns a question that is already on the path, that would otherwise form a cycle). The special type of question,FinalQuestion
, never returns a successor. Within a particular interview, a question may refer to a nested interview, before continuing within the original interview. Any such references to nested interviews are automatically expanded by this method, leaving just the complete set of basic questions on the path.- Returns:
- an array containing the list of questions on the current path.
- See Also:
-
getPathToCurrent
Get the set of questions on the current path up to and including the current question.- Returns:
- an array containing the list of questions on the current path up to and including the current question
- See Also:
-
getRawPath
Get the current set path of questions, including some things normally hidden. Hidden, disabled and final questions are included upon demand. The list of questions is flattened to only include questions, no representation of the interview structure is given.- Parameters:
includeFinals
- Should FinalQuestions be included.- Returns:
- The current active path of questions, based on the requested options. Returns null if no path information is available.
-
iteratePath
Get an iterator for the set of questions on the current path. The first question is determined by the interview; after that, each question in turn determines its successor. The path ends when a question indicates no successor (or erroneously returns a question that is already on the path, that would otherwise form a cycle). The special type of question,FinalQuestion
, never returns a successor. Within a particular interview, a question may refer to a nested interview, before continuing within the original interview. Such nested interviews may optionally be expanded by this method, depending on the arguments.- Parameters:
flattenNestedInterviews
- If true, any nested interviews will be expanded in place and returned via the iterator; otherwise, the the nested interview will be returned instead.- Returns:
- an Iterator for the questions on the current path
- See Also:
-
iteratePathToCurrent
Get an iterator for the set of questions on the current path up to and including the current question.- Parameters:
flattenNestedInterviews
- If true, any nested interviews will be expanded in place and returned via the iterator; otherwise, the the nested interview will be returned instead.- Returns:
- an Iterator for the questions on the current path up to and including the current question
- See Also:
-
verifyPathContains
Verify that the current path contains a specified question, and throw an exception if it does not.- Parameters:
q
- the question to be checked- Throws:
Interview.NotOnPathFault
- if the current path does not contain the specified question.
-
pathContains
Check if the path contains a specific question.- Parameters:
q
- The question for which to check.- Returns:
- true if the question is found on the current path.
-
pathContains
Check if the path contains questions from a specific interview.- Parameters:
i
- The interview for which to check.- Returns:
- true if the interview is found on the current path.
-
getQuestions
Get the complete set of questions in this interview and recursively, in all child interviews.- Returns:
- a set of all questions in this and every child interview.
-
getAllQuestions
Get all questions in this interview and recursively, in all child interviews.- Returns:
- a map containing all questions in this and every child interview.
-
isChecklistEmpty
public boolean isChecklistEmpty()Check whether any questions on the current path have any associated checklist items.- Returns:
- true if no questions have any corresponding checklist items, and false otherwise.
-
createChecklist
Create a checklist composed of all checklist items for questions on the current path.- Returns:
- a checklist composed of all checklist items for questions on the current path.
- See Also:
-
createChecklistItem
Create a checklist item based on entries in the interview's resource bundle.- Parameters:
sectionKey
- A key to identify the section name within the interview's resource bundletextKey
- A key to identify the checklist item text within the interview's resource bundle- Returns:
- a Checklist.Item object composed from the appropriate entries in the interview's resource bundle
-
createChecklistItem
Create a checklist item based on entries in the interview's resource bundle.- Parameters:
sectionKey
- A key to identify the section name within the interview's resource bundletextKey
- A key to identify the checklist item text within the interview's resource bundletextArg
- a single argument to be formatted into the checklist item text- Returns:
- a Checklist.Item object composed from the appropriate entries in the interview's resource bundle and the specified argument value
-
createChecklistItem
Create a checklist item based on entries in the interview's resource bundle.- Parameters:
sectionKey
- A key to identify the section name within the interview's resource bundletextKey
- A key to identify the checklist item text within the interview's resource bundletextArgs
- an array of arguments to be formatted into the checklist item text- Returns:
- a Checklist.Item object composed from the appropriate entries in the interview's resource bundle and the specified argument values
-
removeMarkers
Remove all the markers with a specified name.- Parameters:
name
- The name of the markers to be removed
-
removeAllMarkers
public void removeAllMarkers()Remove all the markers, whatever their name. -
clearMarkedResponses
Clear the response to marked questions.- Parameters:
name
- The name of the markers for the questions to be cleared.
-
callInterview
Return a special type of question used to indicate that a sub-interview interview should be called before proceeding to the next question in this interview.- Parameters:
i
- The nested interview to be called nextq
- The next question to be asked when the nested interview has completes with afinal question
.- Returns:
- a pseudo-question that will call a nested interview before continuing with the specified follow-on question.
-
clear
public void clear()Clear any responses to all the questions in this interview, and then recursively, in its child interviews. -
load
Load the state for questions from an archive map. The map will be passed to each question in this interview and in any child interviews, and each question shouldload
its state, according to its tag. The data must normally contain a valid checksum, generated duringsave(java.util.Map<java.lang.String, java.lang.String>)
.- Parameters:
data
- The archive map from which the state should be loaded.- Throws:
Interview.Fault
- if the checksum is found to be incorrect.
-
load
Load the state for questions from an archive map. The map will be passed to each question in this interview and in any child interviews, and each question shouldload
its state, according to its tag. The data must normally contain a valid checksum, generated duringsave(java.util.Map<java.lang.String, java.lang.String>)
.- Parameters:
data
- The archive map from which the state should be loaded.checkChecksum
- If true, the checksum in the data will be checked.- Throws:
Interview.Fault
- if the checksum is found to be incorrect.
-
save
Save the state for questions in an archive map. The map will be passed to each question in this interview and in any child interviews, and each question shouldsave
its state, according to its tag.- Parameters:
data
- The archive in which the values should be saved.
-
export
Export values for questions on the current path, by callingQuestion.export(java.util.Map<java.lang.String, java.lang.String>)
for each question returned bygetPath()
. It should be called on the root interview to export the values for all questions on the current path, or it can be called on a sub-interview to export just the values from the question in that sub-interview (and in turn, in any further sub-interviews for which there are questions on the path.) Unchecked exceptions that arise from each question's export method are treated according to the policy set by setExportIgnoreExceptionPolicy for the interview for which export was called. It may be convenient to ignore runtime exceptions during export, if exceptions may be thrown when the interview is incomplete. It may be preferred not to ignore any exceptions, if no exceptions are expected.- Parameters:
data
- The map in which the values will be placed.- See Also:
-
getExportIgnoreExceptionPolicy
public int getExportIgnoreExceptionPolicy()Get a value representing the policy regarding how to treat exceptions that may arise during export.- Returns:
- a value representing the policy regarding how to treat exceptions that may arise during export.
- See Also:
-
setExportIgnoreExceptionPolicy
public void setExportIgnoreExceptionPolicy(int policy) Set the policy regarding how to treat exceptions that may arise during export. The default value is to ignore runtime exceptions.- Parameters:
policy
- a value representing the policy regarding how to treat exceptions that may arise during export- See Also:
-
addObserver
Add an observer to monitor updates to the interview.- Parameters:
o
- an observer to be notified as changes occur
-
removeObserver
Remove an observer previously registered to monitor updates to the interview.- Parameters:
o
- the observer to be removed from the list taht are notified
-
containsObserver
-
setBaseTag
Change the base tag for this interview. This should not be done for most interviews, since the base tag is the basis for storing loading and storing values, and changing the base tag may lead to unexpected results. Changing the base tag will caused the tags in all statically nested interviews and questions to be updated as well. This method is primarily intended to be used when renaming dynamically allocated loop bodies in ListQuestion.- Parameters:
newBaseTag
- the new value for the base tag.
-
getInterviewSemantics
public int getInterviewSemantics()Determine which semantics are being used for interview and question behavior. This is important because new behavior in future versions can cause unanticipated code flow, resulting in incorrect behavior of existing code.- Returns:
- The semantics that the interview is currently using.
- Since:
- 3.2
- See Also:
-
setInterviewSemantics
public void setInterviewSemantics(int value) This method is being used to toggle changes which are not backwards compatible with existing interviews. Changing this value after you first initialize the top-level interview object is not recommended or supported. This method should be called as soon as possible during construction. It is recommended that you select the most recent version possible when developing a new interview. As this interview ages and the harness libraries progress, the interview should remain locked at the current behavior. Each subsequent version works under the assumption that the behavior of all previous versions is also enabled, there is no way to select individual behaviors.The version numbers are effectively an indication of the harness version where the behavior was added (32 = 3.2, 50 = 5.0). Gaps in numbering would indicate that no incompatible behavior changes occurred.
Select PRE_32 behavior to select behaviors prior to 3.2.
In Version 32, the first versioned semantic change was introduced. Interviews will generally request SEMANTIC_PRE_32 for old semantics. This version has the behavioral changes:- ChoiceQuestion
- If the value is reset to null, resulting in the value being
"cleared", new behavior simply calls
clear()
to do this. Old behavior was to select either the last value or first possible choice (from the array of possible choices) THEN callupdatePath()
andsetEdited()
. - FileListQuestion
- During construction,
clear()
will be called before the default value is set, in older implementations it was not called. - FileQuestion
- During construction,
clear()
will be called before the default value is set, in older implementations it was not called.
In Version 43 changes to the way in which
export()
works were introduced. Earlier than this version, the list of questions to callexport()
upon with pre-generated as a flattened list of Questions (with all sub-interviews removed). In 43 and later, the structure is NOT flattened, but instead exporting will recurse into sub-interviews by calling its (the Interview)export()
. Additionally, questions which are on the path but hidden will be exported. Note that being hidden is not the same at being disabled.In Version 50, FileListQuestion has significantly altered processing of filters. See the
FileListQuestion.isValueValid()
for an explanation.- Parameters:
value
- Which semantics the interview should use.- Since:
- 3.2
- See Also:
-
storeProperty
Store an "external" value into the configuration. This is a value not associated with any interview question and in a separate namespace than all the question keys.- Parameters:
key
- The name of the key to store.value
- The value associated with the given key. Null to remove the property from the current set of properties for this interview.- Returns:
- The old value of this property, null if not previously set.
- See Also:
-
storeTemplateProperty
Store a template value into the configuration.- Parameters:
key
- The name of the key to store.value
- The value associated with the given key.- Returns:
- The old value of this property, null if not previously set.
-
storeTemplateProperties
Clear a previous template properties and store the new into the configuration.- Parameters:
props
- The properties to store.
-
retrieveProperty
Retrieve a property from the collection of "external" values being stored in the configuration.- Parameters:
key
- The key which identifies the property to retrieve.- Returns:
- The value associated with the given key, or null if it is not found.
- See Also:
-
retrieveTemplateProperty
Retrieve a template property.- Parameters:
key
- The key which identifies the property to retrieve.- Returns:
- The value associated with the given key, or null if it is not found.
-
retrieveTemplateKeys
-
getPropertyKeys
Retrieve set of keys for the "external" values being stored in the configuration.- Returns:
- The set of keys currently available. Null if there are none. All values in the Set are Strings.
- See Also:
-
getExternalProperties
Get a (shallow) copy of the current "external" values.- Returns:
- The copy of the properties, null if there are none.
- See Also:
-
propagateTemplateForAll
public void propagateTemplateForAll() -
isRoot
public boolean isRoot()Determine if this is the root interview.- Returns:
- True if this is the root interview.
-
getRoot
Get the root interview object for an interview series. Some parts of the data are associated only with the root interview, such as tags, external values and thegetRawPath(boolean)
information. -
updatePath
public void updatePath()Update the current path, typically because a response to a question has changed. -
updatePath
Update the current path, typically because a response to a question has changed.- Parameters:
q
- The question that was changed.
-
getResourceString
Get an entry from the resource bundle. The parent and other ancestors bundles will be checked first before this interview's bundle, allowing the root interview a chance to override the default value provided by this interview.- Parameters:
key
- the name of the entry to be returned- Returns:
- the value of the resource, or null if not found
-
getResourceString
Get an entry from the resource bundle. If checkAncestorsFirst is true, then the parent and other ancestors bundles will be checked first before this interview's bundle, allowing the root interview a chance to override the default value provided by this interview. Otherwise, the parent bundles will only be checked if this bundle does not provide a value.- Parameters:
key
- the name of the entry to be returnedcheckAncestorsFirst
- whether to recursively call this method on the parent (if any) before checking this bundle, or only afterwards, if this bundle does not provide a value- Returns:
- the value of the resource, or null if not found
-