Class CrowdsourcingBean
- All Implemented Interfaces:
Serializable
CrowdsourcingBean class.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for CrowdsourcingBean.CrowdsourcingBean(Configuration viewerConfig, IDAO dao) Constructor for CrowdsourcingBean. -
Method Summary
Modifier and TypeMethodDescriptionAdd a newQuestionto the selected campaignSets a newCampaignas theselectedCampaignand returns a pretty url to the view for creating a new campaigndeleteCampaignAction(Campaign campaign) Delete the givenCampaignfrom the database and the loaded list of campaignseditCampaignAction(Campaign campaign) Sets the givenCampaignas theselectedCampaignand returns a pretty url to the view for editing this campaignfilterCampaignsAction(Campaign.CampaignVisibility visibility) Filter the loaded campaigns byCampaign.CampaignVisibilityforwardToAnnotationTarget.forwardToCrowdsourcingAnnotation(Campaign campaign) forwardToCrowdsourcingAnnotation.forwardToCrowdsourcingAnnotation(Campaign campaign, String pi) forwardToCrowdsourcingAnnotation.forwardToCrowdsourcingReview(Campaign campaign) forwardToCrowdsourcingReview.forwardToCrowdsourcingReview(Campaign campaign, String pi) forwardToCrowdsourcingReview.forwardToReviewTarget.Returns a list of active campaigns for the given identifier that are visible to the current user.getAllCampaigns.getAllCampaigns(Campaign.CampaignVisibility visibility) getAllCampaigns.static Collection<Locale> getAllLocales.getAllowedCampaigns(User user) Returns the list of campaigns that are visible to the given user.getAvailableStatisticModes.longgetCampaignCount(Campaign.CampaignVisibility visibility) getCampaignCount.getCampaignsRootUrl.Getter for the fieldlazyModelCampaigns.getNextItemUrl(Campaign campaign, CrowdsourcingStatus status) getRandomItemUrl.getPossibleReviewModes.Getter for the fieldselectedCampaign.getSelectedCampaignId.Getter for the fieldtargetCampaign.getTargetCampaignId.Getter for the fieldtargetIdentifier.getTargetIdentifierForUrl.intGetter for the fieldtargetPage.getTargetRecordStatus.Getter for the fieldtargetStatus.handleInvalidTarget.voidinit()Initialize all campaigns as lazily loaded liststatic booleanCheck if the given user is allowed access to the given campaign from a rights management standpoint alone.booleanisEditMode.booleanisUserOwnsAnyCampaigns(User user) Deprecated.removeQuestionAction(Question question) Remove the givenQuestionfrom the selected campaignResets dateStart + dateEnd to null.voidremoves the target identifier (pi) from the bean, so that pi can be targeted again by random target resolutionAdds the current page to the database, if it doesn't exist or updates it otherwisevoidsetNextIdentifierForAnnotation.voidsetNextIdentifierForReview.voidsetSelectedCampaign(Campaign campaign) Set the selected campaign to a clone of the given campaignvoidSet theselectedCampaignby a String containing the campaign idvoidsetTargetCampaign(Campaign targetCampaign) Setter for the fieldtargetCampaign.voidsetTargetCampaignId.voidsetTargetIdentifier(String targetIdentifier) Setter for the fieldtargetIdentifier.voidsetTargetIdentifierForUrl.voidsetTargetPage(int targetPage) Setter for the fieldtargetPage.voidsetTargetStatus(CrowdsourcingStatus targetStatus) Setter for the fieldtargetStatus.voidsetTargetStatus(String targetStatus) Setter for the fieldtargetStatus.voidSearches for all identifiers that are encompassed by the Solr query of each active campaign and initializes and fills a map of active campaigns for each identifier.
-
Field Details
-
userBean
-
-
Constructor Details
-
CrowdsourcingBean
public CrowdsourcingBean()Constructor for CrowdsourcingBean.
-
CrowdsourcingBean
Constructor for CrowdsourcingBean.
- Parameters:
viewerConfig- aConfigurationobjectdao- aIDAOobject
-
-
Method Details
-
init
@PostConstruct public void init()Initialize all campaigns as lazily loaded list -
getCampaignCount
getCampaignCount.
- Parameters:
visibility- aCampaign.CampaignVisibilityobject.- Returns:
- The total number of campaigns of a certain
Campaign.CampaignVisibility - Throws:
DAOException- if any.
-
filterCampaignsAction
Filter the loaded campaigns byCampaign.CampaignVisibility- Parameters:
visibility- aCampaign.CampaignVisibilityobject.- Returns:
- a
Stringobject.
-
getAllLocales
getAllLocales.
- Returns:
- A list of all locales supported by this viewer application
-
createNewCampaignAction
Sets a newCampaignas theselectedCampaignand returns a pretty url to the view for creating a new campaign- Returns:
- a
Stringobject.
-
editCampaignAction
Sets the givenCampaignas theselectedCampaignand returns a pretty url to the view for editing this campaign -
deleteCampaignAction
Delete the givenCampaignfrom the database and the loaded list of campaigns- Parameters:
campaign- aCampaignobject.- Returns:
- a
Stringobject. - Throws:
DAOException- if any.
-
addNewQuestionAction
Add a newQuestionto the selected campaign- Returns:
- a
Stringobject.
-
removeQuestionAction
Remove the givenQuestionfrom the selected campaign -
resetDurationAction
Resets dateStart + dateEnd to null.- Returns:
- a
Stringobject.
-
getAllCampaigns
getAllCampaigns.
- Returns:
- All campaigns from the database
- Throws:
DAOException- if any.
-
getAllCampaigns
getAllCampaigns.
- Parameters:
visibility- aCampaign.CampaignVisibilityobject.- Returns:
- All campaigns of the given
Campaign.CampaignVisibilityfrom the database - Throws:
DAOException- if any.
-
getAllowedCampaigns
Returns the list of campaigns that are visible to the given user.- Parameters:
user- aUserobject- Returns:
- List of campaigns allowed to the given user
- Throws:
DAOException
-
isUserOwnsAnyCampaigns
Deprecated.isUserOwnsAnyCampaigns.
- Parameters:
user- aUserobject- Returns:
- true if user owns any existing campaigns; false otherwise
- Throws:
DAOException
-
isAllowed
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- aUserobject.campaign- aCampaignobject.- Returns:
- true if campaign is allowed to the given user; false otherwise
- Throws:
DAOException- if any.
-
saveSelectedCampaignAction
public String saveSelectedCampaignAction() throws DAOException, PresentationException, IndexUnreachableExceptionAdds the current page to the database, if it doesn't exist or updates it otherwise- Returns:
- Navigation outcome
- Throws:
DAOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getCampaignsRootUrl
getCampaignsRootUrl.
- Returns:
- root URL for the permalink value
-
getLazyModelCampaigns
Getter for the field
lazyModelCampaigns.- Returns:
- the lazyModelCampaigns
-
getSelectedCampaign
Getter for the field
selectedCampaign.- Returns:
- the selectedCampaign
-
setSelectedCampaign
Set the selected campaign to a clone of the given campaign- Parameters:
campaign- the campaign to set
-
getSelectedCampaignId
getSelectedCampaignId.
- Returns:
- The id of the
selectedCampaignas String
-
setSelectedCampaignId
Set theselectedCampaignby a String containing the campaign id- Parameters:
id- aStringobject.- Throws:
DAOException- if any.
-
isEditMode
public boolean isEditMode()isEditMode.
- Returns:
- the editMode
-
getTargetCampaign
Getter for the field
targetCampaign.- Returns:
- the
targetCampaign
-
setTargetCampaign
Setter for the field
targetCampaign.- Parameters:
targetCampaign- the targetCampaign to set
-
getTargetCampaignId
getTargetCampaignId.
- Returns:
- the identifier of the
targetCampaign
-
setTargetCampaignId
setTargetCampaignId.
- Parameters:
id- aStringobject.- Throws:
NumberFormatException- if any.DAOException- if any.
-
setNextIdentifierForAnnotation
public void setNextIdentifierForAnnotation() throws PresentationException, IndexUnreachableExceptionsetNextIdentifierForAnnotation.
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
setNextIdentifierForReview
setNextIdentifierForReview.
- Throws:
PresentationException- if any.IndexUnreachableException- if any.
-
resetTarget
public void resetTarget()removes the target identifier (pi) from the bean, so that pi can be targeted again by random target resolution -
forwardToAnnotationTarget
forwardToAnnotationTarget.
- Returns:
- the pretty url to annotatate the
targetIdentifierby thetargetCampaign
-
forwardToReviewTarget
forwardToReviewTarget.
- Returns:
- the pretty url to review the
targetIdentifierfor thetargetCampaign
-
getTargetIdentifier
Getter for the field
targetIdentifier.- Returns:
- the PI of a work selected for editing
-
getTargetIdentifierForUrl
getTargetIdentifierForUrl.
- Returns:
- the PI of a work selected for editing or "-" if no targetIdentifier exists
-
setTargetIdentifierForUrl
setTargetIdentifierForUrl.
- Parameters:
pi- aStringobject.
-
setTargetIdentifier
Setter for the field
targetIdentifier.- Parameters:
targetIdentifier- the targetIdentifier to set
-
getTargetPage
public int getTargetPage()Getter for the field
targetPage.- Returns:
- the targetPage
-
setTargetPage
public void setTargetPage(int targetPage) Setter for the field
targetPage.- Parameters:
targetPage- the targetPage to set
-
forwardToCrowdsourcingAnnotation
forwardToCrowdsourcingAnnotation.
-
forwardToCrowdsourcingReview
forwardToCrowdsourcingReview.
-
forwardToCrowdsourcingAnnotation
forwardToCrowdsourcingAnnotation.
-
forwardToCrowdsourcingReview
forwardToCrowdsourcingReview.
-
getNextItemUrl
getRandomItemUrl.
- Parameters:
campaign- The campaign with which to annotate/reviewstatus- ifCrowdsourcingStatus.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
getTargetRecordStatus.
- Returns:
- the
CrowdsourcingStatusof thetargetCampaignfor thetargetIdentifier
-
handleInvalidTarget
handleInvalidTarget.
- Returns:
- the pretty URL to the crowdsourcing campaigns page if
UserBean.getUser()is not eligible for viewing thetargetCampaign
-
getActiveCampaignsForRecord
public List<Campaign> getActiveCampaignsForRecord(String pi) throws DAOException, PresentationException, IndexUnreachableException Returns a list of active campaigns for the given identifier that are visible to the current user.- Parameters:
pi- aStringobject.- Returns:
- List of campaigns
- Throws:
DAOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
updateActiveCampaigns
public void updateActiveCampaigns() throws DAOException, PresentationException, IndexUnreachableExceptionSearches for all identifiers that are encompassed by the Solr query of each active campaign and initializes and fills a map of active campaigns for each identifier. Should be called once after the application first starts (or upon first access) or when a campaign has been updated.- Throws:
DAOException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getPossibleReviewModes
getPossibleReviewModes.
- Returns:
- a
Setobject
-
getAvailableStatisticModes
getAvailableStatisticModes.
- Returns:
- List of enum values
-
getTargetStatus
Getter for the field
targetStatus.- Returns:
- the targetStatus
-
setTargetStatus
Setter for the field
targetStatus.- Parameters:
targetStatus- the targetStatus to set
-
setTargetStatus
Setter for the field
targetStatus.- Parameters:
targetStatus- aStringobject
-