Class Campaign
- All Implemented Interfaces:
CMSMediaHolder
,ILicenseType
,IPolyglott
,Serializable
Questions
contained in this Campaign- Author:
- florian
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The visibility of the campaign to other usersstatic enum
static enum
Statistics calculation mode (status per record or per record page). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddLogMessage
(LogMessage message, String pi) void
deleteLogMessage
(Long messageId) boolean
Getter for the fieldbreadcrumbParentCmsPageId
.getCampaignVisibilityValues.long
Determines the number of distinct users that have created or reviewed annotations in the context of this campaign.Getter for the fielddateCreated
.Getter for the fielddateEnd
.Deprecated.Getter for the fielddateStart
.Deprecated.Getter for the fielddateUpdated
.long
Returns the number of whole days between today and the starting date for this campaign.long
Returns the number of whole days between today and the end date for this campaign.getDaysLeftAsString.Returns the description value in the current language of the campaign object (current tab).getDescription
(String lang) getDescription.getDescription
(String lang, boolean useFallback) getDescription.getId()
Getter for the fieldid
.static Long
Getter for the fieldid
.getIdAsURI.A regular expression determining which filenames are shown in the media list and may be uploadedgetMediaItem.getMediaItemWrapper.A string representing the allowed media formates for a user.Returns the menu title value in the current language of the campaign object (current tab).getMenuTitle
(String lang) getMenuTitle.getMenuTitle
(String lang, boolean useFallback) getMenuTitle.getMenuTitleOrElseTitle.getMenuTitleOrElseTitle
(String lang, boolean useFallback) getMenuTitleOrElseTitle.getName()
getNextTarget
(CrowdsourcingStatus status, String currentPi, User user) Get the targetIdentifier to a random PI from the Solr query result list.long
getNumRecords.long
getNumRecordsForStatus
(String status) getNumRecordsForStatus.long
getNumRecordsToAnnotate.getPageStatus
(String pi, int page) Getter for the fieldpermalink
.int
FINISHED records in percentGetter for the fieldquestions
.getRandomizedTarget
(CrowdsourcingStatus status, String piToIgnore, User user) Get the targetIdentifier to a random PI from the Solr query result list.getRecordStatus.Getter for the fieldselectedLocale
.Getter for the fieldsolrQuery
.Getter for the fieldstatistics
.getTitle()
Returns the title value in the current language of the campaign object (current tab).getTitle.getTitle.Getter for the fieldtranslations
.Getter for the fieldvisibility
.int
hashCode()
boolean
hasMediaItem.boolean
hasRecordsToAnnotate
(User user) check if the given user is eligible to annotate any recordsboolean
hasRecordsToReview
(User user) check if the given user is eligible to review any recordsboolean
isComplete
(Locale locale) If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)
also returns trueboolean
isEligibleToEdit
(String pi, CrowdsourcingStatus status, User user) Check if the given user may annotate/review (depending on status) a specific pi within this campaignboolean
If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' classboolean
boolean
boolean
isHasEnded.boolean
isHasStarted.boolean
boolean
isReady()
Return true if the campaign is ready for use.boolean
boolean
boolean
boolean
boolean
boolean
isUserAllowedAction
(User user, CrowdsourcingStatus status) Checks whether the given user may annotate or review records based on the given status.boolean
isUserMayEdit
(User user) boolean
Only meaningfull for the default language for which all required fields must be filledboolean
mayAnnotate
(User user, String pi) check if the user is allowed to annotate the given pi for this campaignboolean
check if the user is allowed to review the given pi for this campaignvoid
void
setBreadcrumbParentCmsPageId
(String breadcrumbParentCmsPageId) Setter for the fieldbreadcrumbParentCmsPageId
.void
setDateCreated
(LocalDateTime dateCreated) Setter for the fielddateCreated
.void
setDateEnd
(LocalDateTime dateEnd) Setter for the fielddateEnd
.void
setDateEndString
(String dateEndString) Deprecated.void
setDateOnlyEnd
(LocalDate dateEnd) void
setDateOnlyStart
(LocalDate dateStart) void
setDateStart
(LocalDateTime dateStart) Setter for the fielddateStart
.void
setDateStartString
(String dateStartString) Deprecated.void
setDateUpdated
(LocalDateTime dateUpdated) Setter for the fielddateUpdated
.void
setDescription
(String description) setDescription.void
Setter for the fieldid
.void
setLimitToGroup
(boolean limitToGroup) void
setMediaItem
(CMSMediaItem item) setMediaItem.void
setMenuTitle
(String menuTitle) setMenuTitle.void
setPermalink
(String permalink) Setter for the fieldpermalink
.void
setQuestions
(List<Question> questions) Setter for the fieldquestions
.void
setRecordPageStatus
(String pi, int page, CrowdsourcingStatus status, Optional<User> user) void
setRecordStatus
(String pi, CrowdsourcingStatus status, Optional<User> user) Updates record status in the campaign statistics.void
setRestrictAnnotationAccess
(boolean restrictAnnotationAccess) void
setReviewerUserGroup
(UserGroup reviewerUserGroup) void
setReviewMode
(Campaign.ReviewMode reviewMode) void
setSelectedLocale
(Locale selectedLocale) Setter for the fieldselectedLocale
.void
setShowLog
(boolean showLog) void
setSolrQuery
(String solrQuery) Setter for the fieldsolrQuery
.void
setStatisticMode
(Campaign.StatisticMode statisticMode) void
setStatistics
(Map<String, CampaignRecordStatistic> statistics) Setter for the fieldstatistics
.void
setTimePeriodEnabled
(boolean timePeriodEnabled) void
setTitle.void
setTranslations
(List<CampaignTranslation> translations) Setter for the fieldtranslations
.void
setUserGroup
(UserGroup userGroup) void
setVisibility
(Campaign.CampaignVisibility visibility) Setter for the fieldvisibility
.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.goobi.viewer.model.translations.IPolyglott
getLocales, isDefaultLocaleSelected, isSelected, setSelectedLocale
-
Constructor Details
-
Campaign
public Campaign()Empty constructor. -
Campaign
Locale constructor.- Parameters:
selectedLocale
- aLocale
object.
-
Campaign
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getCampaignVisibilityValues
getCampaignVisibilityValues.
- Returns:
- available values of the CampaignVisibility enum
-
getNumRecords
getNumRecords.
- Returns:
- total number of records encompassed by the configured solrQuery
- Throws:
IndexUnreachableException
- if any.
-
getNumRecordsForStatus
getNumRecordsForStatus.
- Parameters:
status
- aString
object.- Returns:
- number of records with the given status
-
getNumRecordsToAnnotate
getNumRecordsToAnnotate.
- Returns:
- Number of records whose status is neither REVIEW nor FINISHED
- Throws:
IndexUnreachableException
- if any.
-
getContributorCount
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
-
getProgress
FINISHED records in percent- Returns:
- percentage of records marked as finished relative to the total number or records
- Throws:
IndexUnreachableException
- if any.PresentationException
- if any.
-
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
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
-
isUserAllowedAction
public boolean isUserAllowedAction(User user, CrowdsourcingStatus status) throws PresentationException, IndexUnreachableException, DAOException Checks whether the given user may annotate or review records based on the given status.- Parameters:
user
- aUser
object.status
- aCrowdsourcingStatus
object.- Returns:
- true if the given user is allowed to perform the action associated with the given status; false otherwise
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.DAOException
- if any.
-
isUserMayEdit
- Parameters:
user
- User for whom to check access- Returns:
- true if given
User
has permission to edit thisCampaign
; false otherwise - Throws:
DAOException
-
getName
- Specified by:
getName
in interfaceILicenseType
-
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
setTitle.
- Parameters:
title
- aString
object.
-
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
getMenuTitleOrElseTitle.
- Returns:
- a
String
object.
-
getMenuTitleOrElseTitle
getMenuTitleOrElseTitle.
-
setMenuTitle
setMenuTitle.
- Parameters:
menuTitle
- aString
object.
-
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
setDescription.
- Parameters:
description
- aString
object.
-
getTitle
getTitle.
-
getTitle
getTitle.
- Parameters:
lang
- aString
object.useFallback
- a boolean.- Returns:
- the title of the given language or if it doesn't exist the title of the default language
-
getDescription
getDescription.
-
getDescription
getDescription.
-
getMenuTitle
getMenuTitle.
-
getMenuTitle
getMenuTitle.
-
getDisplayTitle
-
getDisplayDescription
-
getId
Getter for the field
id
.- Returns:
- the id
-
getId
Getter for the field
id
. -
getIdAsURI
getIdAsURI.
- Returns:
- a
URI
object.
-
setId
Setter for the field
id
.- Parameters:
id
- the id to set
-
getDateCreated
Getter for the field
dateCreated
.- Returns:
- the dateCreated
-
setDateCreated
Setter for the field
dateCreated
.- Parameters:
dateCreated
- the dateCreated to set
-
getDateUpdated
Getter for the field
dateUpdated
.- Returns:
- the dateUpdated
-
setDateUpdated
Setter for the field
dateUpdated
.- Parameters:
dateUpdated
- the dateUpdated to set
-
getVisibility
Getter for the field
visibility
.- Returns:
- the visibility
-
setVisibility
Setter for the field
visibility
.- Parameters:
visibility
- the visibility to set
-
getDateOnlyStart
- Returns:
LocalDate
-
setDateOnlyStart
- Parameters:
dateStart
-
-
getDateStart
Getter for the field
dateStart
.- Returns:
- the dateStart
-
setDateStart
Setter for the field
dateStart
.- Parameters:
dateStart
- the dateStart to set
-
getDateStartString
Deprecated.getDateStartString.
- Returns:
- formatted ISO string representation of stateStart
-
setDateStartString
Deprecated.setDateStartString.
- Parameters:
dateStartString
- aString
object.
-
getDateOnlyEnd
- Returns:
LocalDate
-
setDateOnlyEnd
- Parameters:
dateEnd
-
-
getDateEnd
Getter for the field
dateEnd
.- Returns:
- the dateEnd
-
setDateEnd
Setter for the field
dateEnd
.- Parameters:
dateEnd
- the dateEnd to set
-
getDateEndString
Deprecated.getDateEndString.
- Returns:
- formatted ISO string representation of dateEnd
-
setDateEndString
Deprecated.setDateEndString.
- Parameters:
dateEndString
- aString
object.
-
getSolrQuery
Getter for the field
solrQuery
.- Returns:
- the solrQuery
-
setSolrQuery
Setter for the field
solrQuery
.- Parameters:
solrQuery
- the solrQuery to set
-
getPermalink
Getter for the field
permalink
.- Returns:
- the permalink
-
setPermalink
Setter for the field
permalink
.- Parameters:
permalink
- the permalink to set
-
getBreadcrumbParentCmsPageId
Getter for the field
breadcrumbParentCmsPageId
.- Returns:
- the breadcrumbParentCmsPageId
-
setBreadcrumbParentCmsPageId
Setter for the field
breadcrumbParentCmsPageId
.- Parameters:
breadcrumbParentCmsPageId
- the breadcrumbParentCmsPageId to set
-
getTranslations
Getter for the field
translations
.- Returns:
- the translations
-
setTranslations
Setter for the field
translations
.- Parameters:
translations
- the translations to set
-
getQuestions
Getter for the field
questions
.- Returns:
- the questions
-
setQuestions
Setter for the field
questions
.- Parameters:
questions
- the questions to set
-
getStatistics
Getter for the field
statistics
.- Returns:
- the statistics
-
setStatistics
Setter for the field
statistics
.- Parameters:
statistics
- the statistics to set
-
getSelectedLocale
Getter for the field
selectedLocale
.- Specified by:
getSelectedLocale
in interfaceIPolyglott
- Returns:
- the selectedLocale
-
setSelectedLocale
Setter for the field
selectedLocale
.- Specified by:
setSelectedLocale
in interfaceIPolyglott
- 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- Returns:
- a boolean
-
isComplete
Description copied from interface:IPolyglott
If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)
also returns true- Specified by:
isComplete
in interfaceIPolyglott
- Returns:
- true if
IPolyglott.isValid(Locale)
returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale,IPolyglott.isComplete(Locale)
andIPolyglott.isValid(Locale)
are identical. For implementations with only one field, both methods are also always identical
-
isValid
Description copied from interface:IPolyglott
Only meaningfull for the default language for which all required fields must be filled- Specified by:
isValid
in interfaceIPolyglott
- Returns:
- true if the title is not empty for the given locale
-
isEmpty
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 interfaceIPolyglott
- Returns:
- true if no fields are filled for the given locale
-
getRandomizedTarget
public String getRandomizedTarget(CrowdsourcingStatus status, String piToIgnore, User user) throws PresentationException, IndexUnreachableException Get the targetIdentifier to a random PI from the Solr query result list.- Parameters:
status
- aCrowdsourcingStatus
object.piToIgnore
- aString
object.user
-- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getNextTarget
public String getNextTarget(CrowdsourcingStatus status, String currentPi, User user) throws PresentationException, IndexUnreachableException Get the targetIdentifier to a random PI from the Solr query result list.- Parameters:
status
- aCrowdsourcingStatus
object.currentPi
- aString
object.user
-- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
resetSolrQueryResults
public void resetSolrQueryResults() -
isEligibleToEdit
Check if the given user may annotate/review (depending on status) a specific pi within this campaign- Parameters:
status
- aCrowdsourcingStatus
object.user
- aUser
object.pi
- aString
object.- Returns:
- true if
-
hasRecordsToReview
public boolean hasRecordsToReview(User user) throws PresentationException, IndexUnreachableException check if the given user is eligible to review any records- Parameters:
user
- aUser
object.- Returns:
- true if there are any records in review status for which
isEligibleToEdit(String, CrowdsourcingStatus, User)
returns true - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
hasRecordsToAnnotate
public boolean hasRecordsToAnnotate(User user) throws PresentationException, IndexUnreachableException check if the given user is eligible to annotate any records- Parameters:
user
- aUser
object.- Returns:
- true if there are any records in annotate status for which
isEligibleToEdit(String, CrowdsourcingStatus, User)
returns true - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
mayAnnotate
public boolean mayAnnotate(User user, String pi) throws PresentationException, IndexUnreachableException check if the user is allowed to annotate the given pi for this campaign- Parameters:
user
- aUser
object.pi
- aString
object.- Returns:
- true if the pi is ready for annotation and the user hasn't reviewed it or is a superuser
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
mayReview
public boolean mayReview(User user, String pi) throws PresentationException, IndexUnreachableException check if the user is allowed to review the given pi for this campaign- Parameters:
user
- aUser
object.pi
- aString
object.- Returns:
- true if the pi is ready for review and the user hasn't annotated it or is a superuser
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getRecordStatus
getRecordStatus.
- Parameters:
pi
- aString
object.- Returns:
- record status for the given pi
-
getPageStatus
-
isGroupLimitActive
public boolean isGroupLimitActive() -
isReviewGroupLimitActive
public boolean isReviewGroupLimitActive() -
isReviewModeActive
public boolean isReviewModeActive() -
setRecordStatus
Updates record status in the campaign statistics.- Parameters:
pi
- aString
object.status
- aCrowdsourcingStatus
object.user
- aOptional
object.
-
setRecordPageStatus
public void setRecordPageStatus(String pi, int page, CrowdsourcingStatus status, Optional<User> user) - Parameters:
pi
-page
-status
-user
-
-
setMediaItem
setMediaItem.
- Specified by:
setMediaItem
in interfaceCMSMediaHolder
- Parameters:
item
- aCMSMediaItem
object.
-
getMediaItem
getMediaItem.
- Specified by:
getMediaItem
in interfaceCMSMediaHolder
- Returns:
- a
CMSMediaItem
object.
-
getMediaFilter
A regular expression determining which filenames are shown in the media list and may be uploaded
- Specified by:
getMediaFilter
in interfaceCMSMediaHolder
- Returns:
- a
String
object.
-
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 interfaceCMSMediaHolder
- Returns:
String
-
hasMediaItem
public boolean hasMediaItem()hasMediaItem.
- Specified by:
hasMediaItem
in interfaceCMSMediaHolder
- 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
-
getReviewMode
- Returns:
- the reviewMode
-
setReviewMode
- Parameters:
reviewMode
- the reviewMode to set
-
getStatisticMode
- Returns:
- the statisticMode
-
setStatisticMode
- Parameters:
statisticMode
- the statisticMode to set
-
getUserGroup
- Returns:
- the userGroup
-
setUserGroup
- Parameters:
userGroup
- the userGroup to set
-
getReviewerUserGroup
- Returns:
- the reviewerUserGroup
-
setReviewerUserGroup
- Parameters:
reviewerUserGroup
- the reviewerUserGroup to set
-
isTimePeriodEnabled
public boolean isTimePeriodEnabled()- Returns:
- the timePeriodEnabled
-
isRestrictAnnotationAccess
public boolean isRestrictAnnotationAccess()- Returns:
- the
restrictAnnotationAccess
-
setRestrictAnnotationAccess
public void setRestrictAnnotationAccess(boolean restrictAnnotationAccess) - Parameters:
restrictAnnotationAccess
- therestrictAnnotationAccess
to set
-
setTimePeriodEnabled
public void setTimePeriodEnabled(boolean timePeriodEnabled) - Parameters:
timePeriodEnabled
- the timePeriodEnabled to set
-
getLogMessages
- Returns:
- the logMessages
-
addLogMessage
-
deleteLogMessage
- Parameters:
messageId
-
-
getMediaItemWrapper
getMediaItemWrapper.
- Specified by:
getMediaItemWrapper
in interfaceCMSMediaHolder
- Returns:
- a
CategorizableTranslatedSelectable
object.
-
toString
-
getAccessConditionValue
- Returns:
String
-