java.lang.Object
io.goobi.viewer.model.crowdsourcing.questions.Question
All Implemented Interfaces:
Serializable

@Entity public class Question extends Object implements 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 Details

    • Question

      public Question()
      Empty constructor.
    • Question

      public Question(Campaign owner)
      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 generates
      targetSelector - scope selector for annotation targets
      targetFrequency - how often this question may be answered per target
      owner - campaign that owns this question
    • Question

      public Question(Question orig)
      Parameters:
      orig - question to copy
    • Question

      public Question(Question orig, Campaign campaign)
      Creates a clone of the given question with the given campaign as owner.
      Parameters:
      orig - question to copy
      campaign - crowdsourcing campaign to set as owner
  • Method Details

    • serializeMetadataFields

      public void serializeMetadataFields()
      Call when metadata list changes.
    • getAvailableQuestionTypes

      public List<QuestionType> getAvailableQuestionTypes()
      getAvailableQuestionTypes.
      Returns:
      available values of the QuestionType enum
    • getAvailableTargetSelectors

      public List<TargetSelector> getAvailableTargetSelectors()
      getAvailableTargetSelectors.
      Returns:
      available values of the TargetSelector enum
    • getId

      public Long getId()
      Getter for the field id.
      Returns:
      the database primary key of this question
    • setId

      public void setId(Long id)
      Setter for the field id.
      Parameters:
      id - the database primary key to set
    • getOwner

      public Campaign getOwner()
      Getter for the field owner.
      Returns:
      the campaign this question belongs to
    • setOwner

      public void setOwner(Campaign owner)
      Setter for the field owner.
      Parameters:
      owner - the campaign this question belongs to
    • getText

      public TranslatedText getText()
    • getQuestionType

      public QuestionType getQuestionType()
      Getter for the field questionType.
      Returns:
      the type of annotation this question requests from contributors
    • setQuestionType

      public void setQuestionType(QuestionType questionType)
      Setter for the field questionType.
      Parameters:
      questionType - the type of annotation this question requests from contributors
    • getTargetSelector

      public TargetSelector getTargetSelector()
      Getter for the field targetSelector.
      Returns:
      the selector defining which part of the record this question targets
    • setTargetSelector

      public void setTargetSelector(TargetSelector targetSelector)
      Setter for the field targetSelector.
      Parameters:
      targetSelector - the selector defining which part of the record this question targets
    • getTargetFrequency

      public int getTargetFrequency()
      Getter for the field targetFrequency.
      Returns:
      the number of times this question should be answered per target
    • getMetadataFields

      public List<String> getMetadataFields()
    • setMetadataFields

      public void setMetadataFields(List<String> metadataFields)
    • addMetadataField

      public void addMetadataField(String field)
    • removeMetadataField

      public void removeMetadataField(String field)
    • setMetadataToAdd

      public void setMetadataToAdd(String metadataToAdd)
    • getMetadataToAdd

      public String getMetadataToAdd()
    • getAvailableMetadataFields

      public List<String> getAvailableMetadataFields() throws IndexUnreachableException
      Returns:
      a list of all "MD_" fields from solr
      Throws:
      IOException
      org.apache.solr.client.solrj.SolrServerException
      IndexUnreachableException
    • setTargetFrequency

      public void setTargetFrequency(int targetFrequency)
      Setter for the field targetFrequency.
      Parameters:
      targetFrequency - the number of times this question should be answered per target resource
    • getQuestionId

      public static Long getQuestionId(URI idAsURI)
      Get the id of 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

      public static Long getCampaignId(URI idAsURI)
      Get the Campaign.id of 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

      public URI getIdAsURI()
      getIdAsURI.
      Returns:
      The URI identifier for this question from the question and campaign id
    • getAuthorityData

      public NormdataAuthority getAuthorityData()
      Currently only returns GND authority data.
      Returns:
      Normdata authority data if the question type is NORMDATA, otherwise null
    • getMetadataFieldSelection

      public Map<String,Boolean> getMetadataFieldSelection()
      Returns:
      a map of all available metadata fields to a boolean indicating whether each field is selected for this question
      Throws:
      IOException
      org.apache.solr.client.solrj.SolrServerException
    • getSelectedMetadataFields

      public List<String> getSelectedMetadataFields()