Class Question
java.lang.Object
io.goobi.viewer.model.crowdsourcing.questions.Question
- All Implemented Interfaces:
Serializable
An annotation generator to create a specific type of annotation for a specific question. One or more of these may be contained within a
Campaign- Author:
- Florian Alpers
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionQuestion()Empty constructor.Constructor setting the owning campaign.Creates a clone of the given question with the given campaign as owner.Question(QuestionType questionType, TargetSelector targetSelector, int targetFrequency, Campaign owner) Constructor setting the owning campaign as well as the type of annotation to be generated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataField(String field) Currently only returns GND authority data.getAvailableQuestionTypes.getAvailableTargetSelectors.static LonggetCampaignId(URI idAsURI) Get theCampaign.idof the owning campaign from an URI identifier of a question.getId()Getter for the fieldid.getIdAsURI.getOwner()Getter for the fieldowner.static LonggetQuestionId(URI idAsURI) Get theidof a question from an URI identifier.Getter for the fieldquestionType.intGetter for the fieldtargetFrequency.Getter for the fieldtargetSelector.getText()voidremoveMetadataField(String field) voidCall when metadata list changes.voidSetter for the fieldid.voidsetMetadataFields(List<String> metadataFields) voidsetMetadataToAdd(String metadataToAdd) voidSetter for the fieldowner.voidsetQuestionType(QuestionType questionType) Setter for the fieldquestionType.voidsetTargetFrequency(int targetFrequency) Setter for the fieldtargetFrequency.voidsetTargetSelector(TargetSelector targetSelector) Setter for the fieldtargetSelector.
-
Constructor Details
-
Question
public Question()Empty constructor. -
Question
Constructor setting the owning campaign.- Parameters:
owner- campaign that owns this question
-
Question
public Question(QuestionType questionType, TargetSelector targetSelector, int targetFrequency, Campaign owner) Constructor setting the owning campaign as well as the type of annotation to be generated.- Parameters:
questionType- type of annotation this question generatestargetSelector- scope selector for annotation targetstargetFrequency- how often this question may be answered per targetowner- campaign that owns this question
-
Question
- Parameters:
orig- question to copy
-
Question
Creates a clone of the given question with the given campaign as owner.- Parameters:
orig- question to copycampaign- crowdsourcing campaign to set as owner
-
-
Method Details
-
serializeMetadataFields
public void serializeMetadataFields()Call when metadata list changes. -
getAvailableQuestionTypes
getAvailableQuestionTypes.- Returns:
- available values of the QuestionType enum
-
getAvailableTargetSelectors
getAvailableTargetSelectors.- Returns:
- available values of the TargetSelector enum
-
getId
Getter for the fieldid.- Returns:
- the database primary key of this question
-
setId
Setter for the fieldid.- Parameters:
id- the database primary key to set
-
getOwner
Getter for the fieldowner.- Returns:
- the campaign this question belongs to
-
setOwner
Setter for the fieldowner.- Parameters:
owner- the campaign this question belongs to
-
getText
-
getQuestionType
Getter for the fieldquestionType.- Returns:
- the type of annotation this question requests from contributors
-
setQuestionType
Setter for the fieldquestionType.- Parameters:
questionType- the type of annotation this question requests from contributors
-
getTargetSelector
Getter for the fieldtargetSelector.- Returns:
- the selector defining which part of the record this question targets
-
setTargetSelector
Setter for the fieldtargetSelector.- Parameters:
targetSelector- the selector defining which part of the record this question targets
-
getTargetFrequency
public int getTargetFrequency()Getter for the fieldtargetFrequency.- Returns:
- the number of times this question should be answered per target
-
getMetadataFields
-
setMetadataFields
-
addMetadataField
-
removeMetadataField
-
setMetadataToAdd
-
getMetadataToAdd
-
getAvailableMetadataFields
- Returns:
- a list of all "MD_" fields from solr
- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerExceptionIndexUnreachableException
-
setTargetFrequency
public void setTargetFrequency(int targetFrequency) Setter for the fieldtargetFrequency.- Parameters:
targetFrequency- the number of times this question should be answered per target resource
-
getQuestionId
Get theidof a question from an URI identifier.- Parameters:
idAsURI- URI identifier containing the question ID- Returns:
- the numeric question ID extracted from the URI, or null if not found
-
getCampaignId
Get theCampaign.idof the owning campaign from an URI identifier of a question.- Parameters:
idAsURI- URI identifier containing the campaign ID segment- Returns:
- the numeric campaign ID extracted from the URI, or null if not found
-
getIdAsURI
getIdAsURI.- Returns:
- The URI identifier for this question from the question and campaign id
-
getAuthorityData
Currently only returns GND authority data.- Returns:
- Normdata authority data if the question type is NORMDATA, otherwise null
-
getMetadataFieldSelection
- Returns:
- a map of all available metadata fields to a boolean indicating whether each field is selected for this question
- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
getSelectedMetadataFields
-