|
||||||||
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
public class SurveyManager
Encapsulates functionality to manage surveys, survey folders, and survey 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 |
deleteRespondentFromCache(User user,
long surveyId,
long respondentId)
Removes a respondent from cache. |
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 void |
exportCSV(CSVExportParameters parameters)
Exports survey data to a CSV file. |
static Folder |
getFolder(User user,
long folderId)
Get a folder by id. |
static Respondent |
getNotCachedRespondent(long respondentId,
long surveyId)
Get a respondent without adding it to the cache |
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 Survey |
getSurvey(User user,
long surveyId,
java.lang.String languageCode)
Get a survey, by survey id and language code. |
static Survey |
getSurvey(User user,
java.lang.String surveyId)
Gets a survey by custom survey id. |
static java.lang.String |
getSurveyPreviewKey(long surveyId)
Get preview key for the survey |
static long |
getSurveysCreatedCount(long userId,
long fromDate)
Gets the number of surveys created by a user from a specified fromDate to now |
static long |
getSurveysCreatedCount(long userId,
long fromDate,
long toDate)
Gets the number of surveys created by a user from a specified fromDate to a specified toDate |
static void |
releaseLock(long surveyId)
Releases a lock on a survey. |
static void |
removeSurveyFromCache(long surveyId)
This method will remove the survey from cache if survey has been loaded and cached in the system. |
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 getNotCachedRespondent(long respondentId, long surveyId) throws SurveySystemException
data.getSurveyProxy()
- Survey proxy associated with respondentrespondentId
- Respondent id
SurveySystemException
- Survey System Exceptionpublic static java.lang.String getSurveyPreviewKey(long surveyId) throws SurveySystemException
surveyId
-
SurveySystemException
- If an error occurs in the system.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 uncompleted 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 Survey getSurvey(User user, java.lang.String surveyId) throws SurveySecurityException, SurveySystemException
user
- UsersurveyId
- The custom survey id
SurveySecurityException
- Thrown if the user doesn't have read access to the survey.
SurveySystemException
- If error occurs.public static Survey getSurvey(User user, long surveyId, java.lang.String languageCode) throws SurveySecurityException, SurveySystemException
null
.
user
- UsersurveyId
- Id of survey to getsurveyId
- The language code
com.objectplanet.survey.persistence.PersistenceException
- Persistence exception
SurveySecurityException
- If unauthorized
SurveySystemException
public static long getSurveysCreatedCount(long userId, long fromDate, long toDate) throws SurveySystemException
userId
- The user idfromDate
- The specified fromDatetoDate
- The specified toDate
SurveySystemException
- If any error occurs in the system.public static long getSurveysCreatedCount(long userId, long fromDate) throws SurveySystemException
userId
- The user idfromDate
- The specified fromDate
SurveySystemException
- If any 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 deleteRespondentFromCache(User user, long surveyId, long respondentId) throws SurveySystemException
respondentId
- id of respondent to be removeduser
- UsersurveyId
- Survey id
SurveySystemException
- If any error occurs in the system.
SurveySecurityException
- If the user is unauthorized to delete respondents in the
cachepublic 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 removeSurveyFromCache(long surveyId)
surveyId
- 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 surveypublic static void releaseLock(long surveyId) throws SurveySystemException
surveyId
- Id of the survey to release the lock on.
SurveySystemException
- If any error occurs in the system.public static void exportCSV(CSVExportParameters parameters) throws SurveySystemException
parameters
- The additional settings used for the report. See
SurveySystemException
for details of available parameters.
|
Copyright ? ObjectPlanet Inc. All Rights Reserved. | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |