Class Campaign
- All Implemented Interfaces:
CMSMediaHolder,ILicenseType,IPolyglott,Serializable
Questions contained in this Campaign- Author:
- florian
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe visibility of the campaign to other usersstatic enumstatic enumStatistics calculation mode (status per record or per record page). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLogMessage(LogMessage message, String pi) voiddeleteLogMessage(Long messageId) booleanGetter for the fieldbreadcrumbParentCmsPageId.getCampaignVisibilityValues.longDetermines 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.longReturns the number of whole days between today and the starting date for this campaign.longReturns 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 LongGetter 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.longgetNumRecords.longgetNumRecordsForStatus(String status) getNumRecordsForStatus.longgetNumRecordsToAnnotate.getPageStatus(String pi, int page) Getter for the fieldpermalink.intFINISHED 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.inthashCode()booleanhasMediaItem.booleanhasRecordsToAnnotate(User user) check if the given user is eligible to annotate any recordsbooleanhasRecordsToReview(User user) check if the given user is eligible to review any recordsbooleanisComplete(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 truebooleanisEligibleToEdit(String pi, CrowdsourcingStatus status, User user) Check if the given user may annotate/review (depending on status) a specific pi within this campaignbooleanIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' classbooleanbooleanbooleanisHasEnded.booleanisHasStarted.booleanbooleanisReady()Return true if the campaign is ready for use.booleanbooleanbooleanbooleanbooleanbooleanisUserAllowedAction(User user, CrowdsourcingStatus status) Checks whether the given user may annotate or review records based on the given status.booleanisUserMayEdit(User user) booleanOnly meaningful for the default language for which all required fields must be filledbooleanmayAnnotate(User user, String pi) check if the user is allowed to annotate the given pi for this campaignbooleancheck if the user is allowed to review the given pi for this campaignvoidvoidsetBreadcrumbParentCmsPageId(String breadcrumbParentCmsPageId) Setter for the fieldbreadcrumbParentCmsPageId.voidsetDateCreated(LocalDateTime dateCreated) Setter for the fielddateCreated.voidsetDateEnd(LocalDateTime dateEnd) Setter for the fielddateEnd.voidsetDateEndString(String dateEndString) Deprecated.voidsetDateOnlyEnd(LocalDate dateEnd) voidsetDateOnlyStart(LocalDate dateStart) voidsetDateStart(LocalDateTime dateStart) Setter for the fielddateStart.voidsetDateStartString(String dateStartString) Deprecated.voidsetDateUpdated(LocalDateTime dateUpdated) Setter for the fielddateUpdated.voidsetDescription(String description) setDescription.voidSetter for the fieldid.voidsetLimitToGroup(boolean limitToGroup) voidsetMediaItem(CMSMediaItem item) setMediaItem.voidsetMenuTitle(String menuTitle) setMenuTitle.voidsetPermalink(String permalink) Setter for the fieldpermalink.voidsetQuestions(List<Question> questions) Setter for the fieldquestions.voidsetRecordPageStatus(String pi, int page, CrowdsourcingStatus status, Optional<User> user) voidsetRecordStatus(String pi, CrowdsourcingStatus status, Optional<User> user) Updates record status in the campaign statistics.voidsetRestrictAnnotationAccess(boolean restrictAnnotationAccess) voidsetReviewerUserGroup(UserGroup reviewerUserGroup) voidsetReviewMode(Campaign.ReviewMode reviewMode) voidsetSelectedLocale(Locale selectedLocale) Setter for the fieldselectedLocale.voidsetShowLog(boolean showLog) voidsetSolrQuery(String solrQuery) Setter for the fieldsolrQuery.voidsetStatisticMode(Campaign.StatisticMode statisticMode) voidsetStatistics(Map<String, CampaignRecordStatistic> statistics) Setter for the fieldstatistics.voidsetTimePeriodEnabled(boolean timePeriodEnabled) voidsetTitle.voidsetTranslations(List<CampaignTranslation> translations) Setter for the fieldtranslations.voidsetUserGroup(UserGroup userGroup) voidsetVisibility(Campaign.CampaignVisibility visibility) Setter for the fieldvisibility.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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- aLocaleobject.
-
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- aStringobject.- 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- aUserobject.status- aCrowdsourcingStatusobject.- 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
Userhas permission to edit thisCampaign; false otherwise - Throws:
DAOException
-
getName
- Specified by:
getNamein 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
Stringobject.
-
setTitle
setTitle.
- Parameters:
title- aStringobject.
-
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
Stringobject.
-
getMenuTitleOrElseTitle
getMenuTitleOrElseTitle.
- Returns:
- a
Stringobject.
-
getMenuTitleOrElseTitle
getMenuTitleOrElseTitle.
-
setMenuTitle
setMenuTitle.
- Parameters:
menuTitle- aStringobject.
-
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- aStringobject.
-
getTitle
getTitle.
-
getTitle
getTitle.
- Parameters:
lang- aStringobject.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
URIobject.
-
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- aStringobject.
-
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- aStringobject.
-
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:
getSelectedLocalein interfaceIPolyglott- Returns:
- the selectedLocale
-
setSelectedLocale
Setter for the field
selectedLocale.- Specified by:
setSelectedLocalein 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:IPolyglottIf 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:
isCompletein interfaceIPolyglott- Parameters:
locale-- 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:IPolyglottOnly meaningful for the default language for which all required fields must be filled- Specified by:
isValidin interfaceIPolyglott- Parameters:
locale-- Returns:
- true if the title is not empty for the given locale
-
isEmpty
Description copied from interface:IPolyglottIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class- Specified by:
isEmptyin interfaceIPolyglott- Parameters:
locale-- 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- aCrowdsourcingStatusobject.piToIgnore- aStringobject.user-- Returns:
- a
Stringobject. - 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- aCrowdsourcingStatusobject.currentPi- aStringobject.user-- Returns:
- a
Stringobject. - 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:
pi- aStringobject.status- aCrowdsourcingStatusobject.user- aUserobject.- 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- aUserobject.- 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- aUserobject.- 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- aUserobject.pi- aStringobject.- 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- aUserobject.pi- aStringobject.- 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- aStringobject.- 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- aStringobject.status- aCrowdsourcingStatusobject.user- aOptionalobject.
-
setRecordPageStatus
public void setRecordPageStatus(String pi, int page, CrowdsourcingStatus status, Optional<User> user) - Parameters:
pi-page-status-user-
-
setMediaItem
setMediaItem.
- Specified by:
setMediaItemin interfaceCMSMediaHolder- Parameters:
item- aCMSMediaItemobject.
-
getMediaItem
getMediaItem.
- Specified by:
getMediaItemin interfaceCMSMediaHolder- Returns:
- a
CMSMediaItemobject.
-
getMediaFilter
A regular expression determining which filenames are shown in the media list and may be uploaded
- Specified by:
getMediaFilterin interfaceCMSMediaHolder- Returns:
- a
Stringobject.
-
getMediaTypes
Description copied from interface:CMSMediaHolderA string representing the allowed media formates for a user. Should be a comma separated list of format names or filename suffixes- Specified by:
getMediaTypesin interfaceCMSMediaHolder- Returns:
String
-
hasMediaItem
public boolean hasMediaItem()hasMediaItem.
- Specified by:
hasMediaItemin 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- therestrictAnnotationAccessto 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:
getMediaItemWrapperin interfaceCMSMediaHolder- Returns:
- a
CategorizableTranslatedSelectableobject.
-
toString
-
getAccessConditionValue
- Returns:
String
-