Example usage for org.apache.commons.lang StringUtils rightPad

List of usage examples for org.apache.commons.lang StringUtils rightPad

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils rightPad.

Prototype

public static String rightPad(String str, int size) 

Source Link

Document

Right pad a String with spaces (' ').

Usage

From source file:pagecode.jsp.actions.scheduling.CountAppealReOpeningAction.java

public static void executeUpdate(CountAppealReOpeningManagedBean countAppealReOpeningManagedBean,
        Map sessionScope) throws Exception {

    logger.info("In CountAppealReOpeningAction::doButtonUpdateAction");
    try {//w ww.j  a v a 2s .c  om

        String returnMessage = "";

        // Update Appeals Data
        ISAPLCountAppealPostData_Access iSAPLCountAppealPostData = new ISAPLCountAppealPostData_Access();

        iSAPLCountAppealPostData.setAppeal(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getAppealOrReOpening().trim(), 2));
        iSAPLCountAppealPostData.setTransferDate1(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getTransfrDate1().trim(), 2));
        iSAPLCountAppealPostData.setTransferDate2(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getTransfrDate2().trim(), 2));
        iSAPLCountAppealPostData.setTransferDate3(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getTransfrDate3().trim(), 2));
        iSAPLCountAppealPostData
                .setAppealInd(StringUtils.rightPad(countAppealReOpeningManagedBean.getAppealInd().trim(), 2));
        iSAPLCountAppealPostData.setRecognizance(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getRecognizance().trim(), 2));
        iSAPLCountAppealPostData
                .setFiledBy(StringUtils.rightPad(countAppealReOpeningManagedBean.getFiledBy().trim(), 2));
        iSAPLCountAppealPostData.setNextAppearanceDate1(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprnce1().trim(), 2));
        iSAPLCountAppealPostData.setNextAppearanceDate2(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprnce2().trim(), 2));
        iSAPLCountAppealPostData.setNextAppearanceDate3(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprnce3().trim(), 2));
        iSAPLCountAppealPostData.setCourt(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprncecourt().trim(), 4));
        iSAPLCountAppealPostData.setCourtTime1(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprncetime1().trim(), 2));
        iSAPLCountAppealPostData.setCourtTime2(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprncetime2().trim(), 2));
        iSAPLCountAppealPostData
                .setRoom(StringUtils.rightPad(countAppealReOpeningManagedBean.getNextApprnceroom().trim(), 4));
        iSAPLCountAppealPostData
                .setAppearanceType(StringUtils.rightPad(countAppealReOpeningManagedBean.getType().trim(), 2));
        iSAPLCountAppealPostData
                .setLang(StringUtils.rightPad(countAppealReOpeningManagedBean.getLang().trim(), 1));
        iSAPLCountAppealPostData
                .setInterp(StringUtils.rightPad(countAppealReOpeningManagedBean.getInterp().trim(), 4));
        iSAPLCountAppealPostData
                .setJudgement(StringUtils.rightPad(countAppealReOpeningManagedBean.getJudgement().trim(), 2));
        iSAPLCountAppealPostData.setJudgementDate1(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getJudgementDate1().trim(), 2));
        iSAPLCountAppealPostData.setJudgementDate2(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getJudgementDate2().trim(), 2));
        iSAPLCountAppealPostData.setJudgementDate3(
                StringUtils.rightPad(countAppealReOpeningManagedBean.getJudgementDate3().trim(), 2));

        PageCodeBase.executeEJB(iSAPLCountAppealPostData, sessionScope);
        String col = iSAPLCountAppealPostData.getLastCursorColLocation();
        String row = iSAPLCountAppealPostData.getLastCursorRowLocation();
        System.out.println("col,row:" + col + "," + row);
        GetReturnMessageInAnyScreen_Access getReturnMessage = new GetReturnMessageInAnyScreen_Access();
        PageCodeBase.executeEJB(getReturnMessage, sessionScope);
        returnMessage = getReturnMessage.getReturnMessage().trim();

        if (!returnMessage.equals("")) {
            handleICONDataValidationException(returnMessage, iSAPLCountAppealPostData, "ISAPL");
            throw new Exception(returnMessage);
        }

    } catch (Exception e) {
        throw e;
    } finally {

    }

}

From source file:pagecode.jsp.actions.scheduling.RequestForTrialAction.java

public static void executeSearch(RequestForTrialManagedBean requestForTrialManagedBean, Map sessionScope)
        throws Exception {
    logger.info("In RequestForTrialAction::executeSearch");

    //FIRST clear existing list
    //TODO fix this
    //enforcementOfficerIndexManagedBean.getEnforcementOfficerIndexList().clear();

    try {//from  w w  w. j  a v a  2 s  .c o m
        //First go to ICON main screen
        BackToMenu_Access backToMenu_Access = new BackToMenu_Access();
        PageCodeBase.executeEJB(backToMenu_Access, sessionScope);

        String returnMessage = "";

        RequestForTrial_Access requestForTrial_Access = new RequestForTrial_Access();

        requestForTrial_Access.setCrt(StringUtils.rightPad(requestForTrialManagedBean.getCrt().trim(), 4));

        requestForTrial_Access.setJur(StringUtils.rightPad(requestForTrialManagedBean.getJur().trim(), 4));

        requestForTrial_Access.setYr(StringUtils.rightPad(requestForTrialManagedBean.getYr().trim(), 4));

        requestForTrial_Access
                .setInf(StringUtils.rightPad(requestForTrialManagedBean.getInfoPart1().trim(), 4));

        requestForTrial_Access
                .setSuffix(StringUtils.rightPad(requestForTrialManagedBean.getInfoPart2().trim(), 4));

        PageCodeBase.executeEJB(requestForTrial_Access, sessionScope);

        String screenAcronym = requestForTrial_Access.getScreenAcronym().trim();
        if ("ISRFT".equalsIgnoreCase(screenAcronym)) {
            //get screen data
            getRequestForTrialScreenData(requestForTrialManagedBean, sessionScope);
        }

        returnMessage = requestForTrial_Access.getReturnMessage().trim();

        if (!returnMessage.equals("")) {
            //handleICONDataValidationException(returnMessage, archivesSearch_Access, "IAPIX");
            throw new Exception(returnMessage);
        }

    } catch (Exception e) {
        throw e;
    } finally {
    }

}

From source file:pagecode.jsp.actions.scheduling.RequestForTrialAction.java

public static void executeProcess(RequestForTrialManagedBean requestForTrialManagedBean, Map sessionScope)
        throws ICONDataValidationException, Exception {
    logger.info("In RequestForTrialAction::executeProcess");
    boolean isValidationException = false;
    String returnMessage = "";

    try {//from  w  w  w .ja v  a 2 s .  c om
        RequestForTrialProcess_Access requestForTrialProcess_Access = new RequestForTrialProcess_Access();

        requestForTrialProcess_Access.setAppearanceType(
                StringUtils.rightPad(requestForTrialManagedBean.getAppearanceType().trim(), 2));

        requestForTrialProcess_Access.setPreferredCourt(
                StringUtils.rightPad(requestForTrialManagedBean.getPreferredCourt().trim(), 4));

        requestForTrialProcess_Access.setPreferredRoom(
                StringUtils.rightPad(requestForTrialManagedBean.getPreferredRoom().trim(), 4));

        requestForTrialProcess_Access
                .setDatesAfter(StringUtils.rightPad(requestForTrialManagedBean.getDatesAfter().trim(), 3));

        requestForTrialProcess_Access
                .setDayOrNight(StringUtils.rightPad(requestForTrialManagedBean.getDayOrNight().trim(), 1));

        requestForTrialProcess_Access
                .setLanguage(StringUtils.rightPad(requestForTrialManagedBean.getLanguage().trim(), 1));

        requestForTrialProcess_Access
                .setJudiciary(StringUtils.rightPad(requestForTrialManagedBean.getJudiciary().trim(), 4));

        requestForTrialProcess_Access
                .setCrown(StringUtils.rightPad(requestForTrialManagedBean.getCrown().trim(), 4));

        requestForTrialProcess_Access
                .setIgnoreBadge(StringUtils.rightPad(requestForTrialManagedBean.getIgnoreBadge().trim(), 1));

        requestForTrialProcess_Access.setDatesRequested(
                StringUtils.rightPad(requestForTrialManagedBean.getDatesRequested().trim(), 1));

        requestForTrialProcess_Access.setEstimatedDurationHour(
                StringUtils.rightPad(requestForTrialManagedBean.getEstimatedDurationHour().trim(), 1));

        requestForTrialProcess_Access.setEstimatedDurationMinute(
                StringUtils.rightPad(requestForTrialManagedBean.getEstimatedDurationMinute().trim(), 2));

        requestForTrialProcess_Access.setEstimatedDurationDay(
                StringUtils.rightPad(requestForTrialManagedBean.getEstimatedDurationDay().trim(), 4));

        requestForTrialProcess_Access
                .setInterpreter(StringUtils.rightPad(requestForTrialManagedBean.getInterpreter().trim(), 4));

        requestForTrialProcess_Access
                .setUsageCode(StringUtils.rightPad(requestForTrialManagedBean.getUsageCode().trim(), 2));

        String selectOptions = "";
        for (int i = 0; i <= requestForTrialManagedBean.getSelectedRecordIndex(); i++) {
            if (i == requestForTrialManagedBean.getSelectedRecordIndex()) {
                selectOptions += "S";
                //selectOptions += actionType; //possible values: S, A, D, C
                break;
            } else {
                selectOptions += " ";
            }
        }
        logger.info("selectOption: " + selectOptions);

        requestForTrialProcess_Access.setSelectOptions(selectOptions);

        requestForTrialProcess_Access.setAdditionalCases(
                StringUtils.rightPad(requestForTrialManagedBean.getAdditionalCases().trim(), 1));

        requestForTrialProcess_Access.setAdditionalCaseNumber1(
                requestForTrialManagedBean.getAdditionalCaseNumber1().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber2(
                requestForTrialManagedBean.getAdditionalCaseNumber2().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber3(
                requestForTrialManagedBean.getAdditionalCaseNumber3().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber4(
                requestForTrialManagedBean.getAdditionalCaseNumber4().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber5(
                requestForTrialManagedBean.getAdditionalCaseNumber5().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber6(
                requestForTrialManagedBean.getAdditionalCaseNumber6().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber7(
                requestForTrialManagedBean.getAdditionalCaseNumber7().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber8(
                requestForTrialManagedBean.getAdditionalCaseNumber8().getPaddedNumber());

        requestForTrialProcess_Access.setAdditionalCaseNumber9(
                requestForTrialManagedBean.getAdditionalCaseNumber9().getPaddedNumber());

        PageCodeBase.executeEJB(requestForTrialProcess_Access, sessionScope);

        returnMessage = requestForTrialProcess_Access.getReturnMessage().trim();

        //must clear all "select" values to prevent duplicate entries
        //when TRANSACTION COMPLETED.
        if (-1 != returnMessage.indexOf("TRANSACTION COMPLETED")) {
            for (Iterator iter = requestForTrialManagedBean.getPossibleAppearanceDatesList().iterator(); iter
                    .hasNext();) {
                RequestForTrialAppearanceDateRecord element = (RequestForTrialAppearanceDateRecord) iter.next();
                element.setSelect(null);
            }
        }

        if (!returnMessage.equals("")) {
            handleICONDataValidationException(returnMessage, requestForTrialProcess_Access, "ISRFT");
            throw new Exception(returnMessage);
        }

    } catch (ICONDataValidationException iCONDataValidationException) {
        isValidationException = true;
        throw iCONDataValidationException;
    } catch (Exception e) {
        throw e;
    } finally {
        //logger.info("returnMessage: " + returnMessage);
        if (!"TRANSACTION COMPLETED.".equalsIgnoreCase(returnMessage) && !isValidationException) {

            getRequestForTrialScreenData(requestForTrialManagedBean, sessionScope);

            //try { executePFCommand("[pf5]", sessionScope); } catch (Exception e) { }

            //            try { 
            //               CourtRoomAvailabilityClearSelect_Access courtRoomAvailabilityClearSelect_Access = new CourtRoomAvailabilityClearSelect_Access();
            //               PageCodeBase.executeEJB(courtRoomAvailabilityClearSelect_Access, sessionScope);
            //            } catch (Exception e) { }

        } else {
            //getEnforcementOfficerAvailabilityList(enforcementOfficerAvailabilityManagedBean, sessionScope);
            //TRANSACTION COMPLETED. == true

        }
    }
}

From source file:pagecode.jsp.actions.scheduling.TrialDateListInquiryAction.java

private static void navigate(TrialDateListInquiryManagedBean trialDateListInquiryManagedBean, Map sessionScope)
        throws Exception {

    try {/* w ww .  j a  va2  s  .  c  o  m*/

        String returnMessage = "";

        // first go to ICON main screen
        BackToMenu_Access backToMenu_Access = new BackToMenu_Access();
        PageCodeBase.executeEJB(backToMenu_Access, sessionScope);

        // Navigate to Trial Date List and enter search criteria
        TrialDateList_Access trialDateListAccessBean = new TrialDateList_Access();
        trialDateListAccessBean.setCrt(StringUtils.rightPad(trialDateListInquiryManagedBean.getCaseNum1(), 4));
        trialDateListAccessBean.setJur(StringUtils.rightPad(trialDateListInquiryManagedBean.getCaseNum2(), 3));
        trialDateListAccessBean.setYr(StringUtils.rightPad(trialDateListInquiryManagedBean.getCaseNum3(), 2));
        trialDateListAccessBean.setInf(StringUtils.rightPad(trialDateListInquiryManagedBean.getCaseNum4(), 8));
        trialDateListAccessBean
                .setSuffix(StringUtils.rightPad(trialDateListInquiryManagedBean.getCaseNum5(), 2));
        trialDateListAccessBean
                .setSurName(StringUtils.rightPad(trialDateListInquiryManagedBean.getSurname(), 35));
        trialDateListAccessBean.setGiven(StringUtils.rightPad(trialDateListInquiryManagedBean.getGiven(), 12));
        trialDateListAccessBean.setDob(StringUtils.rightPad(trialDateListInquiryManagedBean.getDobDay(), 2));
        trialDateListAccessBean.setMob(StringUtils.rightPad(trialDateListInquiryManagedBean.getDobMonth(), 2));
        trialDateListAccessBean.setYob(StringUtils.rightPad(trialDateListInquiryManagedBean.getDobYear(), 2));
        trialDateListAccessBean
                .setSex(StringUtils.rightPad(trialDateListInquiryManagedBean.getSex().trim(), 1));
        trialDateListAccessBean.setAgency(StringUtils.rightPad(trialDateListInquiryManagedBean.getAgency(), 6));
        trialDateListAccessBean.setBadge(StringUtils.rightPad(trialDateListInquiryManagedBean.getBadge(), 6));

        PageCodeBase.executeEJB(trialDateListAccessBean, sessionScope);
        returnMessage = trialDateListAccessBean.getReturnMessage().trim();

        if (!returnMessage.equals("")) {
            throw new Exception(returnMessage);
        }

    } catch (Exception e) {
        throw e;
    } finally {

    }

}

From source file:pagecode.RPTs.OffenceUtil.java

private void processOffenceInfo() {
    logger.info("In OffenceUtil::processOffenceInfo");

    if (true == isOffenceNumberValid()) {
        //TODO fix this to throw Exception
        if (this.request == null) {
            return;
        }//from ww  w. j  a  v  a2 s  .co m
        HttpSession session = this.request.getSession();

        try {
            //Map session = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();

            BackToMenu_Access backToMenu_Access = new BackToMenu_Access();
            PageCodeBase.executeEJB(backToMenu_Access, session);

            OffenceInfo_am_Integrated_Access offenceInfo_am_Integrated_Access = new OffenceInfo_am_Integrated_Access();

            offenceInfo_am_Integrated_Access.setCrt(StringUtils.rightPad(courtOfficeId.trim(), 4));
            offenceInfo_am_Integrated_Access.setJur(StringUtils.rightPad(jurisdictionNumber.trim(), 3));
            offenceInfo_am_Integrated_Access.setYr(StringUtils.rightPad(infoYear.trim(), 2));
            offenceInfo_am_Integrated_Access.setInfPart1(StringUtils.rightPad(infoPrefix.trim(), 8));
            offenceInfo_am_Integrated_Access.setInfPart2(StringUtils.rightPad(infoSuffix.trim(), 2));

            if (null != countNumber && !countNumber.equals("")) {
                if (countNumber.trim().length() < 4) {
                    countNumber = StringUtils.leftPad(countNumber.trim(), 4, "0");
                }
                offenceInfo_am_Integrated_Access.setOther(StringUtils.rightPad(countNumber, 20));
            }

            PageCodeBase.executeEJB(offenceInfo_am_Integrated_Access, session);

            if (!offenceInfo_am_Integrated_Access.getReturnMessage().trim().equals("")) {
                throw new Exception(offenceInfo_am_Integrated_Access.getReturnMessage().trim());
            }

            paramOffenceNumber = courtOfficeId + " " + jurisdictionNumber + " " + infoYear + " " + infoPrefix
                    + " " + infoSuffix;

            //Always sssume  English
            isEnglish = true;
            if ("F".equalsIgnoreCase(offenceInfo_am_Integrated_Access.getLanguageCode().trim())) {
                isEnglish = false;
            }
            //NOTE: if runAsStandAlone == true then assume it is always French
            if (true == runAsStandAlone) {
                isEnglish = false;
            }

            paramInterpreterLanguage = offenceInfo_am_Integrated_Access.getInterpreterLangCode().trim();
            if (!paramInterpreterLanguage.equals("")) {
                InterpreterLanguageUtil interpreterLanguageUtil = new InterpreterLanguageUtil();
                interpreterLanguageUtil.setIsEnglish(isEnglish);
                interpreterLanguageUtil.setInterpreterLanguageUtil(paramInterpreterLanguage);
                paramInterpreterLanguage = interpreterLanguageUtil.getInterpreterLanguageDesc();
            }

            IconDateUtil offenceDateUtil = new IconDateUtil();
            offenceDateUtil.setIsEnglish(isEnglish);

            paramOffenceDate = ""; //YYMMDD
            if (!offenceInfo_am_Integrated_Access.getOffenceDateYear().trim().equals("")
                    && !offenceInfo_am_Integrated_Access.getOffenceDateMonth().trim().equals("")
                    && !offenceInfo_am_Integrated_Access.getOffenceDateDay().trim().equals("")) {

                offenceDateUtil.setIconDate(offenceInfo_am_Integrated_Access.getOffenceDateYear().trim()
                        + offenceInfo_am_Integrated_Access.getOffenceDateMonth().trim()
                        + offenceInfo_am_Integrated_Access.getOffenceDateDay().trim());

                paramOffenceDate = offenceDateUtil.getDateWithSlashes();
            }

            paramOfficerNumber = offenceInfo_am_Integrated_Access.getOfficerNumber().trim();

            paramDriversLicenseNumber = offenceInfo_am_Integrated_Access.getDriversLicense().trim();

            paramPlateNumber = offenceInfo_am_Integrated_Access.getPlateNumber().trim();

            paramEnforcementAgency = offenceInfo_am_Integrated_Access.getEnforcementAgency().trim();

            paramSex = offenceInfo_am_Integrated_Access.getSex().trim();

            paramDateOfBirth = ""; //YYMMDD
            IconDateUtil dateOfBirthUtil = new IconDateUtil();
            dateOfBirthUtil.setIsEnglish(isEnglish);

            if (!offenceInfo_am_Integrated_Access.getDateOfBirthYear().trim().equals("")
                    && !offenceInfo_am_Integrated_Access.getDateOfBirthMonth().trim().equals("")
                    && !offenceInfo_am_Integrated_Access.getDateOfBirthDay().trim().equals("")) {

                dateOfBirthUtil.setIconDate(offenceInfo_am_Integrated_Access.getDateOfBirthYear().trim()
                        + offenceInfo_am_Integrated_Access.getDateOfBirthMonth().trim()
                        + offenceInfo_am_Integrated_Access.getDateOfBirthDay().trim());

                paramDateOfBirth = dateOfBirthUtil.getDateWithSlashes();
            }

            paramCVOR = offenceInfo_am_Integrated_Access.getCvor().trim();

            paramUnit = offenceInfo_am_Integrated_Access.getUnit().trim();

            paramOffenderFullName = offenceInfo_am_Integrated_Access.getFirstName().trim();
            paramOffenderFullName += " " + offenceInfo_am_Integrated_Access.getInitial().trim();
            paramOffenderFullName += " " + offenceInfo_am_Integrated_Access.getLastName().trim();

            paramAddressLine1 = offenceInfo_am_Integrated_Access.getAddressStreet().trim();

            paramAddressLine2 = offenceInfo_am_Integrated_Access.getAddressCity().trim();
            paramAddressLine2 += ", " + offenceInfo_am_Integrated_Access.getAddressProvince().trim();

            paramAddressLine3 = offenceInfo_am_Integrated_Access.getAddressPostal().trim();

            //Modified 2008-02-28 per Janes request
            //paramOffenceDay = offenceDateUtil.getStrDay();
            paramOffenceDay = offenceDateUtil.getDayNonFormatted();
            paramOffenceMonth = offenceDateUtil.getStrMonth();
            paramOffenceYear = offenceDateUtil.getStrYear();

            paramOffenceTime = "";
            if (!offenceInfo_am_Integrated_Access.getOffenceDateTimeHour().trim().equals("")
                    && !offenceInfo_am_Integrated_Access.getOffenceDateTimeMinute().trim().equals("")) {

                offenceDateUtil.setIconTime(offenceInfo_am_Integrated_Access.getOffenceDateTimeHour().trim()
                        + offenceInfo_am_Integrated_Access.getOffenceDateTimeMinute().trim());
                paramOffenceTime = offenceDateUtil.getFormatedTime();
            }

            paramOffenceLocation = offenceInfo_am_Integrated_Access.getOffenceLocation().trim();

            //Feb 16, 2009 - Anan
            paramTrialDay = offenceInfo_am_Integrated_Access.getTrialDay().trim();
            paramTrialMonth = offenceInfo_am_Integrated_Access.getTrialMonth().trim();
            paramTrailYear = offenceInfo_am_Integrated_Access.getTrailYear().trim();
            paramTrailTimeHour = offenceInfo_am_Integrated_Access.getTrailTimeHour().trim();
            paramTrailTimeMinute = offenceInfo_am_Integrated_Access.getTrailTimeMinute().trim();
            paramTrailRoom = offenceInfo_am_Integrated_Access.getTrailRoom().trim();
            paramTrailLocationCourtId = offenceInfo_am_Integrated_Access.getTrailLocationCourtId().trim();

            //Added Mar 2, 2009 - Anan
            paramSentenceDateDay = offenceInfo_am_Integrated_Access.getSentenceDateDay().trim();
            paramSentenceDateMonth = offenceInfo_am_Integrated_Access.getSentenceDateMonth().trim();
            paramSentenceDateYear = offenceInfo_am_Integrated_Access.getSentenceDateYear().trim();

            OffenceStatuteDescriptionUtil offenceStatuteDescriptionUtil = new OffenceStatuteDescriptionUtil();

            offenceStatuteDescriptionUtil.setIsEnglish(this.isEnglish);
            //            logger.info("Before setOffenceStatuteDescriptionUtil(...)\n" + 
            //                  this.OCNT_STATU_CD + " " +
            //                  this.OCNT_SCTN_ID + " " +
            //                  this.OCNT_SUB_SCTN_ID + " " +
            //                  this.OCNT_PARA_ID + " " +
            //                  this.OCNT_OFNC_CLAS_ID + " " + 
            //                  this.OCNT_BYLAW_CD
            //            );
            //            offenceStatuteDescriptionUtil.setOffenceStatuteDescriptionUtil(
            //               this.OCNT_STATU_CD,
            //               this.OCNT_SCTN_ID,
            //               this.OCNT_SUB_SCTN_ID,
            //               this.OCNT_PARA_ID,
            //               this.OCNT_OFNC_CLAS_ID,
            //               this.OCNT_BYLAW_CD, offenceDateUtil
            //            );
            //            Modified by Anan
            //            January 14, 2009
            //            To integrate the French NoT into ICON v2.2            
            offenceStatuteDescriptionUtil.setOffenceStatuteDescriptionUtil(
                    offenceInfo_am_Integrated_Access.getOffenceStatute().trim(),
                    offenceInfo_am_Integrated_Access.getOffenceSection().trim(),
                    offenceInfo_am_Integrated_Access.getOffenceSubSection().trim(),
                    offenceInfo_am_Integrated_Access.getOffenceParagraph().trim(),
                    offenceInfo_am_Integrated_Access.getOffenceClause().trim(),
                    offenceInfo_am_Integrated_Access.getOffenceByLaw().trim(), offenceDateUtil);

            paramOffenceDesc = offenceStatuteDescriptionUtil.getOffenceDescription();
            paramOffenceStatue = offenceStatuteDescriptionUtil.getStatuteDescription();

            paramOffenceSection = offenceInfo_am_Integrated_Access.getOffenceSection().trim();

            if (!offenceInfo_am_Integrated_Access.getOffenceSubSection().trim().equals("")) {
                paramOffenceSection += "(" + offenceInfo_am_Integrated_Access.getOffenceSubSection().trim()
                        + ")";
            }
            if (!offenceInfo_am_Integrated_Access.getOffenceParagraph().trim().equals("")) {
                paramOffenceSection += "(" + offenceInfo_am_Integrated_Access.getOffenceParagraph().trim()
                        + ")";
            }
            if (!offenceInfo_am_Integrated_Access.getOffenceClause().trim().equals("")) {
                paramOffenceSection += "(" + offenceInfo_am_Integrated_Access.getOffenceClause().trim() + ")";
            }

            paramOffenceTotalPayable = "";
            BigDecimal totalPayable;
            String tempAmount;
            tempAmount = offenceInfo_am_Integrated_Access.getOutstandingFineAmount().trim();
            BigDecimal outstandingFineAmount = new BigDecimal(
                    (null != tempAmount && !tempAmount.equals("") ? tempAmount : "0.0"));
            tempAmount = offenceInfo_am_Integrated_Access.getOutstandingCostAmount().trim();
            BigDecimal outstandingCostAmount = new BigDecimal(
                    (null != tempAmount && !tempAmount.equals("") ? tempAmount : "0.0"));
            totalPayable = outstandingFineAmount.add(outstandingCostAmount);

            NumberFormat formatUS = NumberFormat.getCurrencyInstance(Locale.US);
            paramOffenceTotalPayable = formatUS.format(totalPayable.doubleValue());

            //Added Sep 13, 2011 to screenscrap appearance type
            paramAppearanceType = offenceInfo_am_Integrated_Access.getAppearanceType().trim();

        } catch (Exception e) {
            paramOffenceNumber = "";
            paramOffenceDate = "";
            paramOfficerNumber = "";
            paramDriversLicenseNumber = "";
            paramPlateNumber = "";
            paramEnforcementAgency = "";
            paramSex = "";
            paramDateOfBirth = "";
            paramCVOR = "";
            paramUnit = "";
            paramOffenderFullName = "";
            paramAddressLine1 = "";
            paramAddressLine2 = "";
            paramAddressLine3 = "";
            paramOffenceDay = "";
            paramOffenceMonth = "";
            paramOffenceYear = "";
            paramOffenceTime = "";
            paramOffenceLocation = "";
            paramOffenceDesc = "";
            paramOffenceStatue = "";
            paramOffenceSection = "";
            paramOffenceTotalPayable = "";
            paramInterpreterLanguage = "";

            //Feb 16, 2009 - Anan
            paramTrialDay = "";
            paramTrialMonth = "";
            paramTrailYear = "";
            paramTrailTimeHour = "";
            paramTrailTimeMinute = "";
            paramTrailRoom = "";
            paramTrailLocationCourtId = "";

            //Added Mar 2, 2009 - Anan
            paramSentenceDateDay = "";
            paramSentenceDateMonth = "";
            paramSentenceDateYear = "";

            //Added Sep 13, 2011 - Anan
            paramAppearanceType = "";

            returnMessage = e.getMessage();
            e.printStackTrace();
        } finally {
            BackToMenu_Access backToMenu_Access = new BackToMenu_Access();
            PageCodeBase.executeEJB(backToMenu_Access, session);
        }
    } //if(true == isOffenceNumberValid())

}

From source file:patientlinkage.Util.Util.java

public static String resizeString(String str, int len) {
    if (str.length() < len) {
        return StringUtils.rightPad(str, len);
    } else if (str.length() > len) {
        return StringUtils.substring(str, 0, len);
    } else {/* ww w.j  a v a2s.c  om*/
        return str;
    }
}

From source file:raptor.alias.AliasHelpAlias.java

@Override
public RaptorAliasResult apply(ChatConsoleController controller, String command) {
    if (StringUtils.startsWithIgnoreCase(command, "aliashelp")) {
        RaptorStringTokenizer tok = new RaptorStringTokenizer(command, " ", true);
        tok.nextToken();//from w w w .ja va2  s. c om
        String aliasName = null;
        if (tok.hasMoreTokens()) {
            aliasName = tok.getWhatsLeft();
        }

        if (StringUtils.isBlank(aliasName)) {
            StringBuilder aliasHelp = new StringBuilder(2000);
            aliasHelp.append("Raptor aliases (Type \"aliashelp aliasName\" for a description and usage.):\n");
            RaptorAlias[] aliases = AliasService.getInstance().getAliases();
            int count = 0;
            for (RaptorAlias alias : aliases) {
                if (!alias.isHidden) {
                    aliasHelp.append(StringUtils.rightPad(alias.getName(), 20));
                    count++;
                    if (count == 3) {
                        aliasHelp.append("\n");
                        count = 0;
                    }
                }
            }
            return new RaptorAliasResult(null, aliasHelp.toString());
        } else {
            RaptorAlias alias = AliasService.getInstance().getAlias(aliasName);
            if (alias == null) {
                return new RaptorAliasResult(null, "Alias '" + aliasName + " 'not found.");
            } else {
                StringBuilder aliasHelp = new StringBuilder(2000);
                aliasHelp.append("Alias '").append(aliasName).append("':\n");
                aliasHelp.append("    Description: ").append(alias.getDescription()).append("\n");
                aliasHelp.append("\n");
                aliasHelp.append("    Usage: ").append(alias.getUsage()).append("\n");
                return new RaptorAliasResult(null, aliasHelp.toString());
            }
        }
    } else {
        return null;
    }
}

From source file:raptor.alias.ShowExtendedCensor.java

@Override
public RaptorAliasResult apply(ChatConsoleController controller, String command) {
    if (StringUtils.startsWith(command, "=extcensor")) {
        String[] users = controller.getConnector().getPeopleOnExtendedCensor();

        StringBuilder output = new StringBuilder(2000);
        output.append("Extended Censor List: (").append(users.length).append(" user(s)):\n");
        int count = 0;
        for (int i = 0; i < users.length; i++) {
            output.append(StringUtils.rightPad(users[i], 20));
            count++;//from   w  w  w  .  j  a  v a2s.  co  m
            if (count == 3) {
                output.append("\n");
                count = 0;
            }
        }
        return new RaptorAliasResult(null, output.toString());

    } else {
        return null;
    }
}

From source file:raptor.alias.ShowTagsAlias.java

@Override
public RaptorAliasResult apply(ChatConsoleController controller, String command) {
    if (command.equalsIgnoreCase("=tag")) {
        StringBuilder builder = new StringBuilder(1000);

        String[] tags = UserTagService.getInstance().getTags();
        Arrays.sort(tags);//from w  ww .ja  va  2s . c o m

        builder.append("Available Tags: ");
        for (String tag : tags) {
            builder.append(tag).append(" ");
        }

        builder.append("\n\nTagged users:\n");
        for (String tag : tags) {
            String[] users = UserTagService.getInstance().getUsersInTag(tag);
            if (users.length > 0) {
                builder.append(tag).append(":\n");
                Arrays.sort(users);
                int counter = 0;
                for (int i = 0; i < users.length; i++) {
                    builder.append(StringUtils.rightPad(users[i], 20));
                    counter++;
                    if (counter == 3) {
                        counter = 0;
                        builder.append("\n");
                    }
                }
                builder.append("\n\n");
            }
        }
        return new RaptorAliasResult(null, builder.toString().trim());
    }
    return null;
}

From source file:raptor.swt.chat.ChatConsoleController.java

public boolean processOutputTextKeystroke(Event event) {
    lastCommandLineKeystrokeTime = System.currentTimeMillis();

    if (ChatUtils.processHotkeyActions(this, event)) {
        return true;
    }//  w  w w  . j  a  v a  2 s.  com
    if (event.keyCode == SWT.ESC) {
        // Clear output text.
        chatConsole.outputText.setText("");

        // Clear premoves.
        RaptorWindowItem[] items = Raptor.getInstance().getWindow().getWindowItems(ChessBoardWindowItem.class);
        for (RaptorWindowItem item : items) {
            ChessBoardWindowItem chessBoardItem = (ChessBoardWindowItem) item;
            if (chessBoardItem.getController() instanceof PlayingController) {
                ((PlayingController) chessBoardItem.getController()).onClearPremoves();
            }
        }
        return true;
    } else if (event.keyCode == SWT.ARROW_UP) {
        if (sentTextIndex >= 0) {
            if (sentTextIndex > 0) {
                sentTextIndex--;
            }
            if (!sentText.isEmpty()) {
                chatConsole.outputText.setText("");
                chatConsole.outputText.append(sentText.get(sentTextIndex));
                chatConsole.outputText.setCaretOffset(chatConsole.outputText.getCharCount());
                onSpellCheck();
            }
        }
        return true;
    } else if (event.keyCode == SWT.ARROW_DOWN) {
        if (sentTextIndex < sentText.size() - 1) {
            sentTextIndex++;
            chatConsole.outputText.setText("");
            chatConsole.outputText.append(sentText.get(sentTextIndex));
            chatConsole.outputText.setCaretOffset(chatConsole.outputText.getCharCount());
            onSpellCheck();
        } else {
            chatConsole.outputText.setText("");
        }
        return true;
    } else if (event.character == '\r') {
        if (sentText.size() > 50) {
            sentText.remove(0);
        }
        sentText.add(chatConsole.outputText.getText().substring(0, chatConsole.outputText.getText().length()));
        sentTextIndex = sentText.size();

        onSendOutputText();
        return true;

    } else if (isAutoCompleteTrigger(event)) {
        int endIndex = chatConsole.getOutputText().getCaretOffset();
        int startIndex = endIndex - 1;
        for (; startIndex >= 0; startIndex--) {
            if (chatConsole.getOutputText().getContent().getTextRange(startIndex, 1).equals(" ")) {
                startIndex++;
                break;
            }
        }
        if (startIndex < 0) {
            startIndex = 0;
        }

        String wordToAutoComplete = chatConsole.getOutputText().getContent()
                .getTextRange(startIndex, endIndex - startIndex).trim();
        if (wordToAutoComplete.length() > 0) {

            String[] autoComplete = connector.autoComplete(wordToAutoComplete);

            if (autoComplete.length == 0) {
                onAppendChatEventToInputText(
                        new ChatEvent(null, ChatType.INTERNAL, local.getString("chatConsCont10")));
            } else if (autoComplete.length == 1) {
                chatConsole.getOutputText().insert(autoComplete[0].substring(wordToAutoComplete.length()));
                chatConsole.getOutputText().setCaretOffset(startIndex + autoComplete[0].length());
            } else {
                StringBuilder matchesBuilder = new StringBuilder(100);
                matchesBuilder.append(local.getString("chatConsCont11"));
                int counter = 0;
                for (int i = 0; i < autoComplete.length; i++) {
                    matchesBuilder.append(StringUtils.rightPad(autoComplete[i], 20));
                    counter++;
                    if (counter == 3) {
                        matchesBuilder.append("\n");
                        counter++;
                    }
                }
                onAppendChatEventToInputText(new ChatEvent(null, ChatType.INTERNAL, matchesBuilder.toString()));
            }
        } else {
            Raptor.getInstance().getDisplay().beep();
        }
        event.doit = false;
        return true;
    }
    return false;
}