Example usage for java.lang Short toString

List of usage examples for java.lang Short toString

Introduction

In this page you can find the example usage for java.lang Short toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Short 's value.

Usage

From source file:com.jd.survey.web.survey.PrivateSurveyController.java

/**
 * Handles the post from the submit page
 * @param proceed//ww w.j a v a  2 s.  com
 * @param survey
 * @param bindingResult
 * @param uiModel
 * @param httpServletRequest
 * @return
 */
@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN", "ROLE_SURVEY_PARTICIPANT" })
@RequestMapping(value = "/submit", method = RequestMethod.POST, produces = "text/html")
public String submitSurvey(@RequestParam(value = "id", required = true) Long surveyId,
        @RequestParam(value = "_submit", required = false) String proceedAction, Principal principal,
        Model uiModel, HttpServletRequest httpServletRequest) {

    log.info("submitPost(): id= " + surveyId);

    try {

        String login = principal.getName();
        //Check if the user is authorized
        if (!surveyService.survey_findById(surveyId).getLogin().equals(login)) {
            log.warn(UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + surveyId
                    + REQUEST_PATH_WARNING_MESSAGE + httpServletRequest.getPathInfo()
                    + FROM_USER_LOGIN_WARNING_MESSAGE + principal.getName() + FROM_IP_WARNING_MESSAGE
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";

        }

        //Check that the survey was not submitted
        Survey dbSurvey = surveyService.survey_findById(surveyId);
        if (!(dbSurvey.getStatus().equals(SurveyStatus.I) || dbSurvey.getStatus().equals(SurveyStatus.R))) {
            log.warn(UNAUTHORIZED_ATTEMPT_TO_EDIT_SUBMITTED_SURVEY_WARNING_MESSAGE + surveyId
                    + REQUEST_PATH_WARNING_MESSAGE + httpServletRequest.getPathInfo()
                    + FROM_USER_LOGIN_WARNING_MESSAGE + principal.getName() + FROM_IP_WARNING_MESSAGE
                    + httpServletRequest.getLocalAddr());
            return "accessDenied";

        }

        if (proceedAction != null) { //submit button
            uiModel.asMap().clear();
            Survey survey = surveyService.survey_submit(surveyId);
            return "redirect:/private/"
                    + encodeUrlPathSegment(survey.getTypeId().toString(), httpServletRequest) + "?list";
        } else {
            uiModel.asMap().clear();
            Survey survey = surveyService.survey_findById(surveyId);
            List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyId,
                    messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale()));
            Short order = (short) surveyPages.size();
            return "redirect:/private/" + encodeUrlPathSegment(survey.getId().toString(), httpServletRequest)
                    + "/" + encodeUrlPathSegment(order.toString(), httpServletRequest);
        }

    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw (new RuntimeException(e));
    }

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWSchema.java

public static String getInt16String(Short val) {
    if (val == null) {
        return ("null");
    } else {/*  w  w w  .ja va 2 s .  c  o  m*/
        return (val.toString());
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWISOLanguageTable.java

public CFCrmCursor openISOLanguageCursorByCountryIdx(CFCrmAuthorization Authorization, Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFCrmCursor cursor = new CFCrmDb2LUWCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWISOLanguageTable.java

public CFSecurityCursor openISOLanguageCursorByCountryIdx(CFSecurityAuthorization Authorization,
        Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAsteriskCursor cursor = new CFAsteriskDb2LUWCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskPgSql.CFAsteriskPgSqlISOLanguageTable.java

public CFSecurityCursor openISOLanguageCursorByCountryIdx(CFSecurityAuthorization Authorization,
        Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAsteriskCursor cursor = new CFAsteriskPgSqlCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccDb2LUW.CFAccDb2LUWISOLanguageTable.java

public CFAccCursor openISOLanguageCursorByCountryIdx(CFAccAuthorization Authorization, Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAccCursor cursor = new CFAccDb2LUWCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccPgSql.CFAccPgSqlISOLanguageTable.java

public CFAccCursor openISOLanguageCursorByCountryIdx(CFAccAuthorization Authorization, Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAccCursor cursor = new CFAccPgSqlCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstDb2LUW.CFAstDb2LUWISOLanguageTable.java

public CFAstCursor openISOLanguageCursorByCountryIdx(CFAstAuthorization Authorization, Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAstCursor cursor = new CFAstDb2LUWCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstPgSql.CFAstPgSqlISOLanguageTable.java

public CFAstCursor openISOLanguageCursorByCountryIdx(CFAstAuthorization Authorization, Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAstCursor cursor = new CFAstPgSqlCursor(Authorization, schema, sql);
    return (cursor);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskMySql.CFAsteriskMySqlISOLanguageTable.java

public CFSecurityCursor openISOLanguageCursorByCountryIdx(CFSecurityAuthorization Authorization,
        Short ISOCountryId) {
    String sql = getSqlSelectISOLanguageBuff() + "WHERE "
            + ((ISOCountryId == null) ? "isln.iso_country_id is null "
                    : "isln.iso_country_id = " + ISOCountryId.toString() + " ")
            + "ORDER BY " + "isln.Id ASC";
    CFAsteriskCursor cursor = new CFAsteriskMySqlCursor(Authorization, schema, sql);
    return (cursor);
}