|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectplanet.survey.plugin.api.SurveyManager
Encapsulates functionality to manage folders, surveys and respondents.
Constructor Summary | |
SurveyManager()
|
Method Summary | |
static Folder |
createFolder(User user,
long parentFolderId,
java.lang.String folderName,
java.lang.String folderDescription)
Creates a folder. |
static Respondent |
createRespondent(long surveyId)
Create a new respondent object. |
static Survey |
createSurvey(User user,
long folderId)
Creates a survey. |
static void |
deleteFolder(User user,
long folderId)
Delete a folder by id. |
static void |
deleteIncompleteRespondents(User user,
long surveyId)
Removes all incomplete respondents for the survey permanently. |
static void |
deleteRespondent(User user,
long respondentId,
long surveyId)
Removes a respondent permanently. |
static void |
deleteRespondents(User user,
long surveyId)
Removes all respondents for the survey permanently. |
static void |
deleteSurvey(User user,
long surveyId)
Delete a survey by survey id. |
static Folder |
getFolder(User user,
long folderId)
Get a folder by id. |
static Respondent |
getRespondentForAdmin(long respondentId,
long surveyId)
Get a respondent by id. |
static Respondent |
getRespondentForSurvey(long respondentId,
long surveyId)
Get a respondent by id. |
static java.util.ArrayList |
getRespondentIds(User user,
long surveyId,
boolean incompleted)
Get all respondent ids for this survey. |
static Survey |
getSurvey(User user,
long surveyId)
Gets the survey by id. |
static void |
storeRespondent(long respondentId,
long surveyId)
Save respondent to the storage. |
static void |
updateSurvey(User user,
long surveyId)
Updates a survey in the storage. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SurveyManager()
Method Detail |
public static Folder getFolder(User user, long folderId) throws SurveySystemException, SurveySecurityException
user
- UserfolderId
- Folder id to get
SurveySystemException
- If an error occurs in the system.
SurveySecurityException
- Thrown if the user doesn't have read
access to the folder.public static Respondent getRespondentForAdmin(long respondentId, long surveyId) throws SurveySystemException
getRespondentForSurvey()
and
getRespondentForAdmin()
is that in the first case the
respondent will be processed by 'cleaner-thread', which saves timed-out
respondents to the storage and removes them from the cache. In the second
case, the respondent will be ignored by the cleaner.
respondentId
- Respondent idsurveyId
- Survey id
SurveySystemException
- If an error occurs in the system.public static Respondent getRespondentForSurvey(long respondentId, long surveyId) throws SurveySystemException
getRespondentForSurvey()
and
getRespondentForAdmin()
is that in the first case the
respondent will be processed by 'cleaner-thread', which saves timed-out
respondents to the storage and removes them from the cache. In the second
case, the respondent will be ignored by the cleaner.
respondentId
- Respondent idsurveyId
- Survey id
SurveySystemException
- If an error occurs in the system.public static java.util.ArrayList getRespondentIds(User user, long surveyId, boolean incompleted) throws SurveySystemException, SurveySecurityException
user
- UsersurveyId
- Survey idincompleted
- False if incompleted responses are not
included
SurveySystemException
- If an error occurs in the system.
SurveySecurityException
- If no accesspublic static Survey getSurvey(User user, long surveyId) throws SurveySecurityException, SurveySystemException
user
- UsersurveyId
- Survey id
SurveySecurityException
- Thrown if the user doesn't have read
access to the survey.
SurveySystemException
- If an error occurs in the system.public static Folder createFolder(User user, long parentFolderId, java.lang.String folderName, java.lang.String folderDescription) throws SurveySecurityException, SurveySystemException
user
- Current userparentFolderId
- Folder id where the new folder will be
placed (parent folder)folderName
- New folder namefolderDescription
- New folder description
SurveySecurityException
- If the user is unauthorized to create
folders in the parent folder.
SurveySystemException
- If any error occurs in the system.public static Respondent createRespondent(long surveyId) throws LockException, SurveySystemException
surveyId
- Survey id
LockException
- If the survey is locked
SurveySystemException
- If an error occurs in the system.public static Survey createSurvey(User user, long folderId) throws SurveySecurityException, SurveySystemException
user
- UserfolderId
- Id of the folder where the new survey
will be placed (parent folder). Main folder has id -1.
SurveySecurityException
- If the user is unauthorized to create
surveys in this folder
SurveySystemException
- If any error occurs in the system.public static void deleteFolder(User user, long folderId) throws java.lang.IllegalArgumentException, SurveySecurityException, SurveySystemException
user
- Current userfolderId
- Id of folder to be deleted.
SurveySecurityException
- If the user is not authorized to delete
the folder.
java.lang.IllegalArgumentException
- If the folder contains surveys or
sub-folders and can't be deleted.
SurveySystemException
- If any error occurs in the system.public static void deleteIncompleteRespondents(User user, long surveyId) throws SurveySecurityException, SurveySystemException
surveyId
- Survey iduser
- User
SurveySecurityException
- If the user is unauthorized to delete
respondents in the survey
SurveySystemException
- If any error occurs in the system.public static void deleteRespondent(User user, long respondentId, long surveyId) throws SurveySecurityException, SurveySystemException
respondentId
- Respondent iduser
- UsersurveyId
- Survey id
SurveySystemException
- If any error occurs in the system.
SurveySecurityException
- If the user is unauthorized to delete
respondents in the surveypublic static void deleteRespondents(User user, long surveyId) throws SurveySecurityException, SurveySystemException
user
- UsersurveyId
- Survey id
SurveySecurityException
- If the user is unauthorized to delete
respondents in the survey
SurveySystemException
- If any error occurs in the system.public static void deleteSurvey(User user, long surveyId) throws LockException, SurveySecurityException, RespondentsExistException, SurveySystemException
deleteAllRespondents()
method. Require
permission to delete the survey.
user
- Current usersurveyId
- Id of survey to be deleted.
RespondentsExistException
- If respondents exist
SurveySecurityException
- If the user is unauthorized to delete
the survey.
LockException
- If object is locked by another user
SurveySystemException
- If an error occurs in the system.public static void storeRespondent(long respondentId, long surveyId) throws SurveySystemException
Question.validate()
method).
respondentId
- Respondent idsurveyId
- Survey id
SurveySystemException
- If any error occurs in the system.public static void updateSurvey(User user, long surveyId) throws SurveySystemException, SurveySecurityException
user
- Current usersurveyId
- Id of the survey to update
SurveySystemException
- If any error occurs in the system.
SurveySecurityException
- If the user is unauthorized to update
the survey
|
Copyright © ObjectPlanet Inc. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |