Class Campaign

    • Constructor Detail

      • Campaign

        public Campaign()
        Empty constructor.
      • Campaign

        public Campaign​(Locale selectedLocale)
        Locale constructor.
        Parameters:
        selectedLocale - a Locale object.
      • Campaign

        public Campaign​(Campaign orig)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getCampaignVisibilityValues

        public List<Campaign.CampaignVisibility> getCampaignVisibilityValues()

        getCampaignVisibilityValues.

        Returns:
        available values of the CampaignVisibility enum
      • getNumRecordsForStatus

        public long getNumRecordsForStatus​(String status)

        getNumRecordsForStatus.

        Parameters:
        status - a String object.
        Returns:
        number of records with the given status
      • getContributorCount

        public long getContributorCount()
                                 throws DAOException
        Determines the number of distinct users that have created or reviewed annotations in the context of this campaign.
        Returns:
        number of users who either annotated or reviewed annotations
        Throws:
        DAOException - if any.
      • isHasAnnotations

        public boolean isHasAnnotations()
        Returns:
        true if this campaign has at least one annotation; false otherwise
      • getDaysBeforeStart

        public long getDaysBeforeStart()
        Returns the number of whole days between today and the starting date for this campaign.
        Returns:
        whole days left between today and dateStart; -1 if no dateStart
      • getDaysLeft

        public long getDaysLeft()
        Returns the number of whole days between today and the end date for this campaign. Because this method only returns the number of whole days left, its main purpose is for displaying the number of days to the user, and it shouldn't be used for access control.
        Returns:
        whole days left between today and dateEnd; -1 if no dateEnd
      • getDaysLeftAsString

        public String getDaysLeftAsString()

        getDaysLeftAsString.

        Returns:
        number of days left as string; infinity symbol if no dateEnd
      • isHasStarted

        public boolean isHasStarted()

        isHasStarted.

        Returns:
        true if dateStart lies after now; false otherwise
      • isHasEnded

        public boolean isHasEnded()

        isHasEnded.

        Returns:
        true if dateEnd lies before now; false otherwise
      • isUserMayEdit

        public boolean isUserMayEdit​(User user)
                              throws DAOException
        Parameters:
        user - User for whom to check access
        Returns:
        Throws:
        DAOException
      • getTitle

        public String getTitle()
        Returns the title value in the current language of the campaign object (current tab). This is meant to be used for campaign editing only, since the language will not be in sync with the selected locale!
        Returns:
        a String object.
      • setTitle

        public void setTitle​(String title)

        setTitle.

        Parameters:
        title - a String object.
      • getMenuTitle

        public String getMenuTitle()
        Returns the menu title value in the current language of the campaign object (current tab). This is meant to be used for campaign editing only, since the language will not be in sync with the selected locale!
        Returns:
        a String object.
      • getMenuTitleOrElseTitle

        public String getMenuTitleOrElseTitle()

        getMenuTitleOrElseTitle.

        Returns:
        a String object.
      • getMenuTitleOrElseTitle

        public String getMenuTitleOrElseTitle​(String lang,
                                              boolean useFallback)

        getMenuTitleOrElseTitle.

        Parameters:
        lang - a String object.
        useFallback - a boolean.
        Returns:
        a String object.
      • setMenuTitle

        public void setMenuTitle​(String menuTitle)

        setMenuTitle.

        Parameters:
        menuTitle - a String object.
      • getDescription

        public String getDescription()
        Returns the description value in the current language of the campaign object (current tab). This is meant to be used for campaign editing only, since the language will not be in sync with the selected locale!
        Returns:
        Description value in the current language in the campaign object
      • setDescription

        public void setDescription​(String description)

        setDescription.

        Parameters:
        description - a String object.
      • getTitle

        public String getTitle​(String lang)

        getTitle.

        Parameters:
        lang - a String object.
        Returns:
        a String object.
      • getTitle

        public String getTitle​(String lang,
                               boolean useFallback)

        getTitle.

        Parameters:
        lang - a String object.
        useFallback - a boolean.
        Returns:
        the title of the given language or if it doesn't exist the title of the default language
      • getDescription

        public String getDescription​(String lang)

        getDescription.

        Parameters:
        lang - a String object.
        Returns:
        a String object.
      • getDescription

        public String getDescription​(String lang,
                                     boolean useFallback)

        getDescription.

        Parameters:
        lang - a String object.
        useFallback - a boolean.
        Returns:
        a String object.
      • getMenuTitle

        public String getMenuTitle​(String lang)

        getMenuTitle.

        Parameters:
        lang - a String object.
        Returns:
        a String object.
      • getMenuTitle

        public String getMenuTitle​(String lang,
                                   boolean useFallback)

        getMenuTitle.

        Parameters:
        lang - a String object.
        useFallback - a boolean.
        Returns:
        a String object.
      • getDisplayTitle

        public String getDisplayTitle()
      • getDisplayDescription

        public String getDisplayDescription()
      • getId

        public Long getId()

        Getter for the field id.

        Returns:
        the id
      • getId

        public static Long getId​(URI idAsURI)

        Getter for the field id.

        Parameters:
        idAsURI - a URI object.
        Returns:
        a Long object.
      • getIdAsURI

        public URI getIdAsURI()

        getIdAsURI.

        Returns:
        a URI object.
      • setId

        public void setId​(Long id)

        Setter for the field id.

        Parameters:
        id - the id to set
      • getDateCreated

        public LocalDateTime getDateCreated()

        Getter for the field dateCreated.

        Returns:
        the dateCreated
      • setDateCreated

        public void setDateCreated​(LocalDateTime dateCreated)

        Setter for the field dateCreated.

        Parameters:
        dateCreated - the dateCreated to set
      • getDateUpdated

        public LocalDateTime getDateUpdated()

        Getter for the field dateUpdated.

        Returns:
        the dateUpdated
      • setDateUpdated

        public void setDateUpdated​(LocalDateTime dateUpdated)

        Setter for the field dateUpdated.

        Parameters:
        dateUpdated - the dateUpdated to set
      • setVisibility

        public void setVisibility​(Campaign.CampaignVisibility visibility)

        Setter for the field visibility.

        Parameters:
        visibility - the visibility to set
      • getDateOnlyStart

        public LocalDate getDateOnlyStart()
        Returns:
      • setDateOnlyStart

        public void setDateOnlyStart​(LocalDate dateStart)
        Parameters:
        dateStart -
      • getDateStart

        public LocalDateTime getDateStart()

        Getter for the field dateStart.

        Returns:
        the dateStart
      • setDateStart

        public void setDateStart​(LocalDateTime dateStart)

        Setter for the field dateStart.

        Parameters:
        dateStart - the dateStart to set
      • getDateStartString

        @Deprecated
        public String getDateStartString()
        Deprecated.

        getDateStartString.

        Returns:
        formatted ISO string representation of stateStart
      • setDateStartString

        @Deprecated
        public void setDateStartString​(String dateStartString)
        Deprecated.

        setDateStartString.

        Parameters:
        dateStartString - a String object.
      • getDateOnlyEnd

        public LocalDate getDateOnlyEnd()
        Returns:
      • setDateOnlyEnd

        public void setDateOnlyEnd​(LocalDate dateEnd)
        Parameters:
        dateEnd -
      • getDateEnd

        public LocalDateTime getDateEnd()

        Getter for the field dateEnd.

        Returns:
        the dateEnd
      • setDateEnd

        public void setDateEnd​(LocalDateTime dateEnd)

        Setter for the field dateEnd.

        Parameters:
        dateEnd - the dateEnd to set
      • getDateEndString

        @Deprecated
        public String getDateEndString()
        Deprecated.

        getDateEndString.

        Returns:
        formatted ISO string representation of dateEnd
      • setDateEndString

        @Deprecated
        public void setDateEndString​(String dateEndString)
        Deprecated.

        setDateEndString.

        Parameters:
        dateEndString - a String object.
      • getSolrQuery

        public String getSolrQuery()

        Getter for the field solrQuery.

        Returns:
        the solrQuery
      • setSolrQuery

        public void setSolrQuery​(String solrQuery)

        Setter for the field solrQuery.

        Parameters:
        solrQuery - the solrQuery to set
      • getPermalink

        public String getPermalink()

        Getter for the field permalink.

        Returns:
        the permalink
      • setPermalink

        public void setPermalink​(String permalink)

        Setter for the field permalink.

        Parameters:
        permalink - the permalink to set
      • getBreadcrumbParentCmsPageId

        public String getBreadcrumbParentCmsPageId()

        Getter for the field breadcrumbParentCmsPageId.

        Returns:
        the breadcrumbParentCmsPageId
      • setBreadcrumbParentCmsPageId

        public void setBreadcrumbParentCmsPageId​(String breadcrumbParentCmsPageId)

        Setter for the field breadcrumbParentCmsPageId.

        Parameters:
        breadcrumbParentCmsPageId - the breadcrumbParentCmsPageId to set
      • getTranslations

        public List<CampaignTranslation> getTranslations()

        Getter for the field translations.

        Returns:
        the translations
      • setTranslations

        public void setTranslations​(List<CampaignTranslation> translations)

        Setter for the field translations.

        Parameters:
        translations - the translations to set
      • getQuestions

        public List<Question> getQuestions()

        Getter for the field questions.

        Returns:
        the questions
      • setQuestions

        public void setQuestions​(List<Question> questions)

        Setter for the field questions.

        Parameters:
        questions - the questions to set
      • setStatistics

        public void setStatistics​(Map<String,​CampaignRecordStatistic> statistics)

        Setter for the field statistics.

        Parameters:
        statistics - the statistics to set
      • getSelectedLocale

        public Locale getSelectedLocale()

        Getter for the field selectedLocale.

        Specified by:
        getSelectedLocale in interface IPolyglott
        Returns:
        the selectedLocale
      • setSelectedLocale

        public void setSelectedLocale​(Locale selectedLocale)

        Setter for the field selectedLocale.

        Specified by:
        setSelectedLocale in interface IPolyglott
        Parameters:
        selectedLocale - the selectedLocale to set
      • isReady

        public boolean isReady()
        Return true if the campaign is ready for use. For this, the title in the default language must exists and there must be at least one question
      • isValid

        public boolean isValid​(Locale locale)
        Description copied from interface: IPolyglott
        Only meaningfull for the default language for which all required fields must be filled
        Specified by:
        isValid in interface IPolyglott
        Returns:
        true if the title is not empty for the given locale
      • isEmpty

        public boolean isEmpty​(Locale locale)
        Description copied from interface: IPolyglott
        If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class
        Specified by:
        isEmpty in interface IPolyglott
        Returns:
        true if no fields are filled for the given locale
      • resetSolrQueryResults

        public void resetSolrQueryResults()
      • isEligibleToEdit

        public boolean isEligibleToEdit​(String pi,
                                        CrowdsourcingStatus status,
                                        User user)
        Check if the given user may annotate/review (depending on status) a specific pi within this campaign
        Parameters:
        status - a io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.CrowdsourcingStatus object.
        user - a User object.
        pi - a String object.
        Returns:
        true if
        • the status is REVIEW and the user is not contained in the annotators list
        • or
        • the status is ANNOTATE and the user is not contained in the reviewers list
        • or
        • The user is admin
        • or
        • The user is null
      • getRecordStatus

        public CrowdsourcingStatus getRecordStatus​(String pi)

        getRecordStatus.

        Parameters:
        pi - a String object.
        Returns:
        record status for the given pi
      • isGroupLimitActive

        public boolean isGroupLimitActive()
        Returns:
      • isReviewGroupLimitActive

        public boolean isReviewGroupLimitActive()
      • isReviewModeActive

        public boolean isReviewModeActive()
      • setRecordStatus

        public void setRecordStatus​(String pi,
                                    CrowdsourcingStatus status,
                                    Optional<User> user)
        Updates record status in the campaign statistics.
        Parameters:
        pi - a String object.
        status - a io.goobi.viewer.model.crowdsourcing.campaigns.CampaignRecordStatistic.CrowdsourcingStatus object.
        user - a Optional object.
      • getMediaFilter

        public String getMediaFilter()

        A regular expression determining which filenames are shown in the media list and may be uploaded

        Specified by:
        getMediaFilter in interface CMSMediaHolder
        Returns:
        a String object.
      • getMediaTypes

        public String getMediaTypes()
        Description copied from interface: CMSMediaHolder
        A string representing the allowed media formates for a user. Should be a comma separated list of format names or filename suffixes
        Specified by:
        getMediaTypes in interface CMSMediaHolder
        Returns:
      • hasMediaItem

        public boolean hasMediaItem()

        hasMediaItem.

        Specified by:
        hasMediaItem in interface CMSMediaHolder
        Returns:
        a boolean.
      • setShowLog

        public void setShowLog​(boolean showLog)
        Parameters:
        showLog - the showLog to set
      • isShowLog

        public boolean isShowLog()
        Returns:
        the showLog
      • isLimitToGroup

        public boolean isLimitToGroup()
        Returns:
        the limitToGroup
      • setLimitToGroup

        public void setLimitToGroup​(boolean limitToGroup)
        Parameters:
        limitToGroup - the limitToGroup to set
      • setReviewMode

        public void setReviewMode​(Campaign.ReviewMode reviewMode)
        Parameters:
        reviewMode - the reviewMode to set
      • setStatisticMode

        public void setStatisticMode​(Campaign.StatisticMode statisticMode)
        Parameters:
        statisticMode - the statisticMode to set
      • getUserGroup

        public UserGroup getUserGroup()
        Returns:
        the userGroup
      • setUserGroup

        public void setUserGroup​(UserGroup userGroup)
        Parameters:
        userGroup - the userGroup to set
      • getReviewerUserGroup

        public UserGroup getReviewerUserGroup()
        Returns:
        the reviewerUserGroup
      • setReviewerUserGroup

        public void setReviewerUserGroup​(UserGroup reviewerUserGroup)
        Parameters:
        reviewerUserGroup - the reviewerUserGroup to set
      • isTimePeriodEnabled

        public boolean isTimePeriodEnabled()
        Returns:
        the timePeriodEnabled
      • setRestrictAnnotationAccess

        public void setRestrictAnnotationAccess​(boolean restrictAnnotationAccess)
        Parameters:
        restrictAnnotationAccess - the restrictAnnotationAccess to set
      • setTimePeriodEnabled

        public void setTimePeriodEnabled​(boolean timePeriodEnabled)
        Parameters:
        timePeriodEnabled - the timePeriodEnabled to set
      • deleteLogMessage

        public void deleteLogMessage​(Long messageId)
        Parameters:
        messageId -
      • getAccessConditionValue

        public String getAccessConditionValue()
        Returns: