Class CrowdsourcingBean

    • Field Detail

      • userBean

        @Inject
        protected UserBean userBean
    • Constructor Detail

      • CrowdsourcingBean

        public CrowdsourcingBean()
      • CrowdsourcingBean

        public CrowdsourcingBean​(Configuration viewerConfig,
                                 IDAO dao)
    • Method Detail

      • init

        @PostConstruct
        public void init()
        Initialize all campaigns as lazily loaded list
      • getAllLocales

        public static Collection<Locale> getAllLocales()

        getAllLocales.

        Returns:
        A list of all locales supported by this viewer application
      • createNewCampaignAction

        public String createNewCampaignAction()
        Sets a new Campaign as the selectedCampaign and returns a pretty url to the view for creating a new campaign
        Returns:
        a String object.
      • addNewQuestionAction

        public String addNewQuestionAction()
        Add a new Question to the selected campaign
        Returns:
        a String object.
      • removeQuestionAction

        public String removeQuestionAction​(Question question)
        Remove the given Question from the selected campaign
        Parameters:
        question - a Question object.
        Returns:
        a String object.
      • resetDurationAction

        public String resetDurationAction()
        Resets dateStart + dateEnd to null.
        Returns:
        a String object.
      • getAllowedCampaigns

        public List<Campaign> getAllowedCampaigns​(User user)
                                           throws DAOException
        Returns the list of campaigns that are visible to the given user.
        Parameters:
        user -
        Returns:
        Throws:
        DAOException
      • isAllowed

        public static boolean isAllowed​(User user,
                                        Campaign campaign)
                                 throws DAOException
        Check if the given user is allowed access to the given campaign from a rights management standpoint alone. If the user is null, access is granted for public campaigns only, otherwise access is granted if the user has the appropriate rights
        Parameters:
        user - a User object.
        campaign - a Campaign object.
        Returns:
        true if campaign is allowed to the given user; false otherwise
        Throws:
        DAOException - if any.
      • getCampaignsRootUrl

        public String getCampaignsRootUrl()

        getCampaignsRootUrl.

        Returns:
        root URL for the permalink value
      • getLazyModelCampaigns

        public TableDataProvider<Campaign> getLazyModelCampaigns()

        Getter for the field lazyModelCampaigns.

        Returns:
        the lazyModelCampaigns
      • getSelectedCampaign

        public Campaign getSelectedCampaign()

        Getter for the field selectedCampaign.

        Returns:
        the selectedCampaign
      • setSelectedCampaign

        public void setSelectedCampaign​(Campaign campaign)
        Set the selected campaign to a clone of the given campaign
        Parameters:
        selectedCampaign - the selectedCampaign to set
      • getSelectedCampaignId

        public String getSelectedCampaignId()

        getSelectedCampaignId.

        Returns:
        The id of the selectedCampaign as String
      • isEditMode

        public boolean isEditMode()

        isEditMode.

        Returns:
        the editMode
      • getTargetCampaign

        public Campaign getTargetCampaign()

        Getter for the field targetCampaign.

        Returns:
        the targetCampaign
      • setTargetCampaign

        public void setTargetCampaign​(Campaign targetCampaign)

        Setter for the field targetCampaign.

        Parameters:
        targetCampaign - the targetCampaign to set
      • getTargetCampaignId

        public String getTargetCampaignId()

        getTargetCampaignId.

        Returns:
        the identifier of the targetCampaign
      • resetTarget

        public void resetTarget()
        removes the target identifier (pi) from the bean, so that pi can be targeted again by random target resolution
      • getTargetIdentifier

        public String getTargetIdentifier()

        Getter for the field targetIdentifier.

        Returns:
        the PI of a work selected for editing
      • getTargetIdentifierForUrl

        public String getTargetIdentifierForUrl()

        getTargetIdentifierForUrl.

        Returns:
        the PI of a work selected for editing or "-" if no targetIdentifier exists
      • setTargetIdentifierForUrl

        public void setTargetIdentifierForUrl​(String pi)

        setTargetIdentifierForUrl.

        Parameters:
        pi - a String object.
      • setTargetIdentifier

        public void setTargetIdentifier​(String targetIdentifier)

        Setter for the field targetIdentifier.

        Parameters:
        targetIdentifier - the targetIdentifier to set
      • getTargetPage

        public int getTargetPage()
        Returns:
        the targetPage
      • setTargetPage

        public void setTargetPage​(int targetPage)
        Parameters:
        targetPage - the targetPage to set
      • forwardToCrowdsourcingAnnotation

        public String forwardToCrowdsourcingAnnotation​(Campaign campaign)

        forwardToCrowdsourcingAnnotation.

        Parameters:
        campaign - a Campaign object.
        Returns:
        a pretty url to annotate a random work with the given Campaign
      • forwardToCrowdsourcingReview

        public String forwardToCrowdsourcingReview​(Campaign campaign)

        forwardToCrowdsourcingReview.

        Parameters:
        campaign - a Campaign object.
        Returns:
        a pretty url to review a random work with the given Campaign
      • forwardToCrowdsourcingAnnotation

        public String forwardToCrowdsourcingAnnotation​(Campaign campaign,
                                                       String pi)

        forwardToCrowdsourcingAnnotation.

        Parameters:
        campaign - a Campaign object.
        pi - a String object.
        Returns:
        a pretty url to annotate the work with the given pi with the given Campaign
      • forwardToCrowdsourcingReview

        public String forwardToCrowdsourcingReview​(Campaign campaign,
                                                   String pi)

        forwardToCrowdsourcingReview.

        Parameters:
        campaign - a Campaign object.
        pi - a String object.
        Returns:
        a pretty url to review the work with the given pi with the given Campaign
      • getNextItemUrl

        public String getNextItemUrl​(Campaign campaign,
                                     CrowdsourcingStatus status)

        getRandomItemUrl.

        Parameters:
        campaign - The campaign with which to annotate/review
        status - if io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.CrowdsourcingStatus#REVIEW, return a url for reviewing, otherwise for annotating
        Returns:
        The pretty url to either review or annotate a random work with the given Campaign
      • getTargetRecordStatus

        public CrowdsourcingStatus getTargetRecordStatus()

        getTargetRecordStatus.

        Returns:
        the io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.CrowdsourcingStatus of the targetCampaign for the targetIdentifier
      • handleInvalidTarget

        public String handleInvalidTarget()

        handleInvalidTarget.

        Returns:
        the pretty URL to the crowdsourcing campaigns page if UserBean.getUser() is not eligible for viewing the targetCampaign
      • setTargetStatus

        public void setTargetStatus​(CrowdsourcingStatus targetStatus)
        Parameters:
        targetStatus - the targetStatus to set
      • setTargetStatus

        public void setTargetStatus​(String targetStatus)