|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.objectplanet.survey.plugin.api.PluginUtil
public class PluginUtil
Utility class for the plugins.
| Field Summary | |
|---|---|
static int |
LOGGING_LEVEL_ERROR
Loggs only errors. |
static int |
LOGGING_LEVEL_MESSAGE
Loggs all messages, warnings and errors |
static int |
LOGGING_LEVEL_WARNING
Loggs all warnings and errors |
| Constructor Summary | |
|---|---|
PluginUtil()
|
|
| Method Summary | |
|---|---|
static void |
debug(java.lang.String txt)
log statements with level = debug. |
static void |
error(java.lang.String txt)
log statements with level <= error. |
static void |
fatal(java.lang.String txt)
log statements with level = fatal |
static java.lang.String |
getCharacterEncoding()
Gets the system character encoding (from setup screen) |
static int |
getDaysUntilExpiration()
Return days until expirations for the current license. |
static int |
getEdition()
|
static java.lang.String |
getEditionName(java.lang.String language)
Get the edition name of the current license |
static java.lang.String |
getExportFileExtension()
Gets the preferred file extension when exporting files. |
static java.lang.String |
getExportKeepFiles()
Gets the preferred keep file property. |
static java.lang.String |
getHostId()
Get the host ID for the current Opinio installation. |
static long |
getLongTime()
Get long time: return the date attribute of the SystemTime object |
static int |
getMaxUsers()
Returns max allowed users for the current license. |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.String language)
Get message from i18n resources |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.String[] params,
java.lang.String language)
Get message from i18n resources |
static java.lang.String |
getPluginVersion()
Return the version of the plugin api. |
static java.lang.String |
getSurveySystemVersion()
Return the version of the survey system. |
static java.lang.String |
getSurveyUrl(javax.servlet.http.HttpServletRequest request,
long surveyId)
Gets the url to the survey module (where respondent answer the survey). |
static java.lang.String |
getSystemHome()
Get system home: location of the opinio files. |
static java.lang.String |
getSystemUrl(javax.servlet.http.HttpServletRequest request)
Get system url: Usually looks like http://server-address/opinio |
static User |
getSystemUser()
Get system user. |
static User |
getUserFromSession(javax.servlet.http.HttpServletRequest request)
Get the user object from session. |
static void |
info(java.lang.String txt)
log statements with level <= info. |
static boolean |
isDebugEnabled()
Return true if debug is enabled. |
static boolean |
isLockedByAnotherUser(long userId,
long surveyId)
Check if survey is locked by another user. |
static boolean |
isNullOrEmpty(java.lang.String string)
Returns true if string is null or empty |
static boolean |
isUnix()
Returns true current OS is Unix or Unix-like (For example Linux). |
static boolean |
isWindows()
Returns true current OS is Windows |
static void |
log(java.lang.String logText,
int level)
Deprecated. This log method is no longer used. Will not log to any file! Use log.debug(), log.info(), log.warn(), log.error(), log.fatal() instead. |
static void |
log(java.lang.Throwable e)
Deprecated. This log method is no longer used. Will not log to any file! Use log.debug(), log.info(), log.warn(), log.error(), log.fatal() instead. |
static void |
sendEmail(Email email)
Send email. |
static void |
sendEmail(java.lang.String fromName,
java.lang.String fromEmail,
java.lang.String toEmail,
java.lang.String subject,
java.lang.String message,
java.lang.String emailType)
Send email. |
static void |
setLicenseCode(java.lang.String licenseCode)
Sets the Opinio license code. |
static boolean |
stopAllThreads()
Stop All Threads: Gets the stop all threads attribute of the System Globals object |
static void |
storeProps(java.util.Properties properties,
java.io.File file)
Stores a property object to an output stream |
static void |
warn(java.lang.String txt)
log statements with level <= warn |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LOGGING_LEVEL_ERROR
public static final int LOGGING_LEVEL_MESSAGE
public static final int LOGGING_LEVEL_WARNING
| Constructor Detail |
|---|
public PluginUtil()
| Method Detail |
|---|
public static java.lang.String getPluginVersion()
public static java.lang.String getSurveySystemVersion()
public static int getEdition()
public static java.lang.String getEditionName(java.lang.String language)
language -
public static int getMaxUsers()
public static int getDaysUntilExpiration()
public static java.lang.String getSurveyUrl(javax.servlet.http.HttpServletRequest request,
long surveyId)
throws SurveySystemException
http://server-address/opinio/s?s=surveyId (or customId)
request - Request objectsurveyId - Survey id
SurveySystemException - If any error occurs.public static User getSystemUser()
public static boolean isLockedByAnotherUser(long userId,
long surveyId)
throws SurveySystemException
userId - id of current user.surveyId - id of survey to check lock for.
SurveySystemExceptionpublic static User getUserFromSession(javax.servlet.http.HttpServletRequest request)
request - The HttpServletRequest object
public static void log(java.lang.String logText,
int level)
logText - Message to log.level - Logging level(defined above)public static void debug(java.lang.String txt)
log4j.logger.com.objectplanet.survey.plugin.api=debug
txt - The text to logpublic static void info(java.lang.String txt)
log4j.logger.com.objectplanet.survey.plugin.api=info
txt - The text to logpublic static boolean isDebugEnabled()
public static void warn(java.lang.String txt)
txt - The text to logpublic static void error(java.lang.String txt)
log4j.logger.com.objectplanet.survey.plugin.api=error
txt - The text to log.public static void fatal(java.lang.String txt)
txt - Description of the Parameterpublic static void log(java.lang.Throwable e)
e - Exception to log.
public static void sendEmail(java.lang.String fromName,
java.lang.String fromEmail,
java.lang.String toEmail,
java.lang.String subject,
java.lang.String message,
java.lang.String emailType)
throws java.lang.IllegalArgumentException,
javax.mail.internet.AddressException,
SurveySystemException
fromName - Who sends the message (name)fromEmail - Who sends the message(email address)toEmail - Recipient's addresssubject - The subject of the emailmessage - The body of the messageemailType - The type and the mmessage (text:"text/plain" or html:"text/html")
javax.mail.internet.AddressException - If invalid fromEmail or toEmail
SurveySystemException - If error occurs.
java.lang.IllegalArgumentException - If illegal parameters.
public static void sendEmail(Email email)
throws java.lang.IllegalArgumentException,
javax.mail.internet.AddressException,
SurveySystemException
Email - Email object
SurveySystemException - If error occurs.
java.lang.IllegalArgumentException
javax.mail.internet.AddressException
public static void storeProps(java.util.Properties properties,
java.io.File file)
throws java.io.IOException
properties - The property object to storefile - File to store properties to
java.io.IOException - IOExceptionpublic static java.lang.String getExportFileExtension()
public static java.lang.String getExportKeepFiles()
public static java.lang.String getSystemHome()
public static java.lang.String getSystemUrl(javax.servlet.http.HttpServletRequest request)
http://server-address/opinio
public static long getLongTime()
public static boolean stopAllThreads()
public static void setLicenseCode(java.lang.String licenseCode)
licenseCode - The new license code.public static java.lang.String getHostId()
public static java.lang.String getCharacterEncoding()
public static java.lang.String getMessage(java.lang.String key,
java.lang.String language)
message - keylanguage -
public static java.lang.String getMessage(java.lang.String key,
java.lang.String[] params,
java.lang.String language)
message - keylanguage - parameters - to the message
public static boolean isNullOrEmpty(java.lang.String string)
string - String to check
public static boolean isWindows()
public static boolean isUnix()
|
Copyright ? ObjectPlanet Inc. All Rights Reserved. | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||