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 newQuestion
to the selected campaignSets a newCampaign
as theselectedCampaign
and returns a pretty url to the view for creating a new campaigndeleteCampaignAction
(Campaign campaign) Delete the givenCampaign
from the database and the loaded list of campaignseditCampaignAction
(Campaign campaign) Sets the givenCampaign
as theselectedCampaign
and returns a pretty url to the view for editing this campaignfilterCampaignsAction
(Campaign.CampaignVisibility visibility) Filter the loaded campaigns byCampaign.CampaignVisibility
forwardToAnnotationTarget.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.long
getCampaignCount
(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.int
Getter for the fieldtargetPage
.getTargetRecordStatus.Getter for the fieldtargetStatus
.handleInvalidTarget.void
init()
Initialize all campaigns as lazily loaded liststatic boolean
Check if the given user is allowed access to the given campaign from a rights management standpoint alone.boolean
isEditMode.boolean
isUserOwnsAnyCampaigns
(User user) Deprecated.removeQuestionAction
(Question question) Remove the givenQuestion
from the selected campaignResets dateStart + dateEnd to null.void
removes 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 otherwisevoid
setNextIdentifierForAnnotation.void
setNextIdentifierForReview.void
setSelectedCampaign
(Campaign campaign) Set the selected campaign to a clone of the given campaignvoid
Set theselectedCampaign
by a String containing the campaign idvoid
setTargetCampaign
(Campaign targetCampaign) Setter for the fieldtargetCampaign
.void
setTargetCampaignId.void
setTargetIdentifier
(String targetIdentifier) Setter for the fieldtargetIdentifier
.void
setTargetIdentifierForUrl.void
setTargetPage
(int targetPage) Setter for the fieldtargetPage
.void
setTargetStatus
(CrowdsourcingStatus targetStatus) Setter for the fieldtargetStatus
.void
setTargetStatus
(String targetStatus) Setter for the fieldtargetStatus
.void
Searches 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
- aConfiguration
objectdao
- aIDAO
object
-
-
Method Details
-
init
@PostConstruct public void init()Initialize all campaigns as lazily loaded list -
getCampaignCount
getCampaignCount.
- Parameters:
visibility
- aCampaign.CampaignVisibility
object.- 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.CampaignVisibility
object.- Returns:
- a
String
object.
-
getAllLocales
getAllLocales.
- Returns:
- A list of all locales supported by this viewer application
-
createNewCampaignAction
Sets a newCampaign
as theselectedCampaign
and returns a pretty url to the view for creating a new campaign- Returns:
- a
String
object.
-
editCampaignAction
Sets the givenCampaign
as theselectedCampaign
and returns a pretty url to the view for editing this campaign -
deleteCampaignAction
Delete the givenCampaign
from the database and the loaded list of campaigns- Parameters:
campaign
- aCampaign
object.- Returns:
- a
String
object. - Throws:
DAOException
- if any.
-
addNewQuestionAction
Add a newQuestion
to the selected campaign- Returns:
- a
String
object.
-
removeQuestionAction
Remove the givenQuestion
from the selected campaign -
resetDurationAction
Resets dateStart + dateEnd to null.- Returns:
- a
String
object.
-
getAllCampaigns
getAllCampaigns.
- Returns:
- All campaigns from the database
- Throws:
DAOException
- if any.
-
getAllCampaigns
getAllCampaigns.
- Parameters:
visibility
- aCampaign.CampaignVisibility
object.- Returns:
- All campaigns of the given
Campaign.CampaignVisibility
from the database - Throws:
DAOException
- if any.
-
getAllowedCampaigns
Returns the list of campaigns that are visible to the given user.- Parameters:
user
- aUser
object- Returns:
- List of campaigns allowed to the given user
- Throws:
DAOException
-
isUserOwnsAnyCampaigns
Deprecated.isUserOwnsAnyCampaigns.
- Parameters:
user
- aUser
object- 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
- aUser
object.campaign
- aCampaign
object.- 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
selectedCampaign
as String
-
setSelectedCampaignId
Set theselectedCampaign
by a String containing the campaign id- Parameters:
id
- aString
object.- 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
- aString
object.- 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
targetIdentifier
by thetargetCampaign
-
forwardToReviewTarget
forwardToReviewTarget.
- Returns:
- the pretty url to review the
targetIdentifier
for 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
- aString
object.
-
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
CrowdsourcingStatus
of thetargetCampaign
for 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
- aString
object.- 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
Set
object
-
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
- aString
object
-