Example usage for javax.ejb FinderException printStackTrace

List of usage examples for javax.ejb FinderException printStackTrace

Introduction

In this page you can find the example usage for javax.ejb FinderException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:is.idega.idegaweb.egov.cases.presentation.OpenCases.java

@Override
public boolean actionPerformed(IWContext iwc) {
    if (iwc.isParameterSet(PARAMETER_CASE_PK)) {
        Object casePK = iwc.getParameter(PARAMETER_CASE_PK);

        try {/*  www . ja  va2 s . c o m*/
            getCasesBusiness(iwc).takeCase(casePK, iwc.getCurrentUser(), iwc);
            return true;
        } catch (RemoteException re) {
            throw new IBORuntimeException(re);
        } catch (FinderException fe) {
            fe.printStackTrace();
        }
    }
    return false;
}

From source file:is.idega.idegaweb.egov.cases.presentation.HandlerCases.java

@Override
protected void save(IWContext iwc) throws RemoteException {
    Object casePK = iwc.getParameter(PARAMETER_CASE_PK);
    Object caseCategoryPK = iwc.getParameter(PARAMETER_CASE_CATEGORY_PK);
    Object subCaseCategoryPK = iwc.getParameter(PARAMETER_SUB_CASE_CATEGORY_PK);
    Object caseTypePK = iwc.getParameter(PARAMETER_CASE_TYPE_PK);
    String status = iwc.getParameter(PARAMETER_STATUS);
    String reply = iwc.getParameter(PARAMETER_REPLY);

    try {//from  ww  w . j a v a2  s  . co m
        getCasesBusiness().handleCase(casePK, subCaseCategoryPK != null ? subCaseCategoryPK : caseCategoryPK,
                caseTypePK, status, iwc.getCurrentUser(), reply, iwc);
    } catch (FinderException fe) {
        fe.printStackTrace();
    }
}

From source file:is.idega.idegaweb.egov.cases.presentation.OpenCases.java

@Override
protected void showProcessor(IWContext iwc, Object casePK) throws RemoteException {

    Form form = new Form();
    form.setStyleClass("adminForm");
    form.setStyleClass("overview");
    form.setEventListener(this.getClass());
    if (this.iMyCasesPage != null) {
        form.setPageToSubmitTo(this.iMyCasesPage);
    }/*  w w  w .  j  a v  a2s. c  o  m*/
    form.addParameter(UserCases.PARAMETER_ACTION, "");
    form.maintainParameter(PARAMETER_CASE_PK);

    GeneralCase theCase = null;
    try {
        theCase = getCasesBusiness().getGeneralCase(casePK);
    } catch (FinderException fe) {
        fe.printStackTrace();
        throw new IBORuntimeException(fe);
    }
    CaseCategory category = theCase.getCaseCategory();
    CaseCategory parentCategory = category.getParent();
    CaseType type = theCase.getCaseType();
    ICFile attachment = theCase.getAttachment();
    User owner = theCase.getOwner();
    IWTimestamp created = new IWTimestamp(theCase.getCreated());

    form.add(getPersonInfo(iwc, owner));

    Heading1 heading = new Heading1(
            getResourceBundle().getLocalizedString(getPrefix() + "case_overview", "Case overview"));
    heading.setStyleClass("subHeader");
    heading.setStyleClass("topSubHeader");
    form.add(heading);

    Layer section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    if (theCase.isPrivate()) {
        section.add(getAttentionLayer(getResourceBundle().getLocalizedString(getPrefix() + "case.is_private",
                "The sender wishes that this case be handled as confidential.")));
    }

    Layer caseType = new Layer(Layer.SPAN);
    caseType.add(new Text(type.getName()));

    Layer caseCategory = new Layer(Layer.SPAN);
    caseCategory.add(new Text(category.getLocalizedCategoryName(iwc.getCurrentLocale())));

    Layer message = new Layer(Layer.SPAN);
    message.add(new Text(theCase.getMessage()));

    Layer createdDate = new Layer(Layer.SPAN);
    createdDate.add(new Text(
            created.getLocaleDateAndTime(iwc.getCurrentLocale(), IWTimestamp.SHORT, IWTimestamp.SHORT)));

    Layer formItem = new Layer(Layer.DIV);
    formItem.setStyleClass("formItem");
    Label label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("case_nr", "Case nr"));
    formItem.add(label);
    formItem.add(new Span(new Text(theCase.getPrimaryKey().toString())));
    section.add(formItem);

    if (getCasesBusiness().useTypes()) {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("case_type", "Case type"));
        element.add(label);
        element.add(caseType);
        section.add(element);
    }

    if (parentCategory != null) {
        Layer parentCaseCategory = new Layer(Layer.SPAN);
        parentCaseCategory.add(new Text(parentCategory.getLocalizedCategoryName(iwc.getCurrentLocale())));

        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("case_category", "Case category"));
        element.add(label);
        element.add(parentCaseCategory);
        section.add(element);

        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("sub_case_category", "Sub case category"));
        element.add(label);
        element.add(caseCategory);
        section.add(element);
    } else {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("case_category", "Case category"));
        element.add(label);
        element.add(caseCategory);
        section.add(element);
    }

    Layer element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("created_date", "Created date"));
    element.add(label);
    element.add(createdDate);
    section.add(element);

    if (attachment != null) {
        Link link = new Link(new Text(attachment.getName()));
        link.setFile(attachment);
        link.setTarget(Link.TARGET_BLANK_WINDOW);

        Layer attachmentSpan = new Layer(Layer.SPAN);
        attachmentSpan.add(link);

        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("attachment", "Attachment"));
        element.add(label);
        element.add(attachmentSpan);
        section.add(element);
    }

    if (theCase.getSubject() != null) {
        formItem = new Layer(Layer.DIV);
        formItem.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("regarding", "Regarding"));
        formItem.add(label);
        formItem.add(new Span(new Text(theCase.getSubject())));
        section.add(formItem);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("message", "Message"));
    element.add(label);
    element.add(message);
    section.add(element);

    Layer clear = new Layer(Layer.DIV);
    clear.setStyleClass("Clear");
    section.add(clear);

    Collection<CaseLog> logs = getCasesBusiness(iwc).getCaseLogs(theCase);
    if (!logs.isEmpty()) {
        for (CaseLog log : logs) {
            form.add(getHandlerLayer(iwc, this.getResourceBundle(), theCase, log));
        }
    }

    Layer bottom = new Layer(Layer.DIV);
    bottom.setStyleClass("bottom");
    form.add(bottom);

    Link back = getButtonLink(getResourceBundle().getLocalizedString("back", "Back"));
    back.setStyleClass("homeButton");
    back.addParameter(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_VIEW));
    bottom.add(back);

    Link pdf = getDownloadButtonLink(getResourceBundle().getLocalizedString("fetch_pdf", "Fetch PDF"),
            CaseWriter.class);
    pdf.addParameter(getCasesBusiness().getSelectedCaseParameter(), theCase.getPrimaryKey().toString());
    bottom.add(pdf);

    if (iwc.getAccessController().hasRole(CasesConstants.ROLE_CASES_SUPER_ADMIN, iwc)) {
        Link next = getButtonLink(
                getResourceBundle().getLocalizedString(getPrefix() + "allocate_case", "Allocate case"));
        next.addParameter(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_ALLOCATION_FORM));
        next.maintainParameter(PARAMETER_CASE_PK, iwc);
        bottom.add(next);
    }

    Link next = getButtonLink(theCase.getCaseStatus().equals(getCasesBusiness().getCaseStatusPending())
            ? getResourceBundle().getLocalizedString(getPrefix() + "take_over_case", "Take over case")
            : getResourceBundle().getLocalizedString(getPrefix() + "take_case", "Take case"));
    next.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_PROCESS));
    next.setToFormSubmit(form);
    bottom.add(next);

    add(form);
}

From source file:is.idega.idegaweb.egov.gumbo.bpm.violation.ViolationDataProviderRealWebservice.java

private PersonData getCompany(String personalId, boolean combineAddressAndPostal) {
    if (StringUtil.isEmpty(personalId)) {
        return null;
    }/*  w  ww.  j a v a2  s.c o m*/

    if (SocialSecurityNumber.isCompanySocialSecurityNumber(personalId, LocaleUtil.getIcelandicLocale())) {
        CompanyBusiness companyBusiness = null;
        try {
            companyBusiness = getCompanyBusiness();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        if (companyBusiness == null) {
            return null;
        }

        String useWS = IWMainApplication.getDefaultIWApplicationContext().getApplicationSettings()
                .getProperty(USE_WEBSERVICE_FOR_COMPANY_LOOKUP, "false");

        Company company = null;

        if (!"false".equals(useWS)) {
            try {
                company = companyBusiness.getCompany(personalId);
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (FinderException e) {
                company = null;
            }

            if (company == null) {
                CompanyHolder holder = getSkyrrClient().getCompany(personalId);
                if (holder != null) {
                    try {
                        getCompanyRegisterBusiness().updateEntry(holder.getPersonalID(), null,
                                holder.getPostalCode(), null, null, holder.getName(), holder.getAddress(), null,
                                "", null, holder.getVatNumber(), holder.getAddress(), "", null, null, null,
                                null, null, "", null);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        try {
            if (company == null) {
                company = companyBusiness.getCompany(personalId);
            }
            Address address = company.getAddress();

            PersonData data = new PersonData(company.getPersonalID());
            data.setName(company.getName());
            if (address != null) {
                if (combineAddressAndPostal) {
                    data.setAddress(address.getStreetAddress() + ", " + address.getPostalAddress());
                } else {
                    data.setAddress(address.getStreetAddress());
                    data.setPostalCode(address.getPostalAddress());
                }
            }

            return data;
        } catch (FinderException fe) {
            fe.printStackTrace();
        } catch (RemoteException re) {
            re.printStackTrace();
        }
    }

    PersonData data = new PersonData(personalId);
    data.setName(getLocalizedString("no_company_found", "No company found with personal ID"));
    data.setAddress("");
    data.setPostalCode("");

    return data;
}

From source file:is.idega.idegaweb.egov.gumbo.bpm.violation.ViolationDataProviderRealWebservice.java

private PersonData getUser(String personalId, boolean combineAddressAndPostal) {
    if (StringUtil.isEmpty(personalId)) {
        return null;
    }//from ww w. j  a  v  a  2  s  .co  m

    if (SocialSecurityNumber.isIndividualSocialSecurityNumber(personalId, LocaleUtil.getIcelandicLocale())) {
        UserBusiness userBusiness = null;
        try {
            userBusiness = getUserBusiness();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        if (userBusiness == null) {
            return null;
        }

        String useWS = IWMainApplication.getDefaultIWApplicationContext().getApplicationSettings()
                .getProperty(USE_WEBSERVICE_FOR_COMPANY_LOOKUP, "false");

        User user = null;

        if (!"false".equals(useWS)) {
            try {
                user = userBusiness.getUser(personalId);
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (FinderException e) {
                user = null;
            }

            if (user == null) {
                UserHolder holder = getSkyrrClient().getUser(personalId);
                if (holder != null) {
                    IWTimestamp t = new IWTimestamp();

                    String day = holder.getPersonalID().substring(0, 2);
                    String month = holder.getPersonalID().substring(2, 4);
                    String year = holder.getPersonalID().substring(4, 6);

                    int iDay = Integer.parseInt(day);
                    int iMonth = Integer.parseInt(month);
                    int iYear = Integer.parseInt(year);
                    if (holder.getPersonalID().substring(9).equals("9")) {
                        iYear += 1900;
                    } else if (holder.getPersonalID().substring(9).equals("0")) {
                        iYear += 2000;
                    } else if (holder.getPersonalID().substring(9).equals("8")) {
                        iYear += 1800;
                    }
                    t.setHour(0);
                    t.setMinute(0);
                    t.setSecond(0);
                    t.setMilliSecond(0);
                    t.setDay(iDay);
                    t.setMonth(iMonth);
                    t.setYear(iYear);
                    try {
                        user = userBusiness.createUserByPersonalIDIfDoesNotExist(holder.getName(),
                                holder.getPersonalID(), null, t);
                        StringBuilder address = new StringBuilder(holder.getAddress());
                        address.append(";");
                        address.append(holder.getPostalCode());
                        address.append(" ");
                        address.append(";Iceland:is_IS;N/A");
                        userBusiness.updateUsersMainAddressByFullAddressString(user, address.toString());
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    } catch (CreateException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        try {
            if (user == null) {
                user = userBusiness.getUser(personalId);
            }

            Address address = userBusiness.getUsersMainAddress(user);

            PersonData data = new PersonData(user.getPersonalID());
            data.setName(user.getName());
            if (address != null) {
                if (combineAddressAndPostal) {
                    data.setAddress(address.getStreetAddress() + ", " + address.getPostalAddress());
                } else {
                    data.setAddress(address.getStreetAddress());
                    data.setPostalCode(address.getPostalAddress());
                }
            }

            return data;
        } catch (FinderException fe) {
            fe.printStackTrace();
        } catch (RemoteException re) {
            re.printStackTrace();
        }
    }

    PersonData data = new PersonData(personalId);
    data.setName(getLocalizedString("no_user_found", "No user found with personal ID..."));
    data.setAddress("");
    data.setPostalCode("");

    return data;
}

From source file:is.idega.idegaweb.egov.cases.presentation.MyCases.java

@Override
protected void showProcessor(IWContext iwc, Object casePK) throws RemoteException {
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, jQuery.getBundleURIToJQueryLib());
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_ENGINE_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_UTIL_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, "/dwr/interface/CasesBusiness.js");
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc,
            getBundle().getVirtualPathWithFileNameString("javascript/egov_cases.js"));

    Form form = new Form();
    form.setStyleClass("adminForm");
    form.setStyleClass("overview");
    form.maintainParameter(PARAMETER_CASE_PK);
    form.addParameter(UserCases.PARAMETER_ACTION, "");

    HiddenInput localeInput = new HiddenInput("current_locale",
            iwc.getCurrentLocale().getCountry().toLowerCase());
    localeInput.setID("casesLocale");
    form.add(localeInput);/* www . j  av a  2 s .c o  m*/

    boolean useSubCategories = getCasesBusiness(iwc).useSubCategories();

    GeneralCase theCase = null;
    try {
        theCase = getCasesBusiness().getGeneralCase(casePK);
    } catch (FinderException fe) {
        fe.printStackTrace();
        throw new IBORuntimeException(fe);
    }
    CaseCategory category = theCase.getCaseCategory();
    CaseCategory parentCategory = category.getParent();
    CaseType type = theCase.getCaseType();
    ICFile attachment = theCase.getAttachment();
    User owner = theCase.getOwner();
    IWTimestamp created = new IWTimestamp(theCase.getCreated());

    form.add(getPersonInfo(iwc, owner));

    Heading1 heading = new Heading1(
            getResourceBundle().getLocalizedString(getPrefix() + "case_overview", "Case overview"));
    heading.setStyleClass("subHeader");
    heading.setStyleClass("topSubHeader");
    form.add(heading);

    Layer section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    if (theCase.isPrivate()) {
        section.add(getAttentionLayer(getResourceBundle().getLocalizedString(getPrefix() + "case.is_private",
                "The sender wishes that this case be handled as confidential.")));
    }

    Layer clear = new Layer(Layer.DIV);
    clear.setStyleClass("Clear");

    SelectorUtility util = new SelectorUtility();
    DropdownMenu categories = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_CATEGORY_PK), getCasesBusiness().getCaseCategories(), "getName");
    categories.setID("casesParentCategory");
    categories.keepStatusOnAction(true);
    categories.setSelectedElement(parentCategory != null ? parentCategory.getPrimaryKey().toString()
            : category.getPrimaryKey().toString());
    categories.setStyleClass("caseCategoryDropdown");

    DropdownMenu subCategories = new DropdownMenu(PARAMETER_SUB_CASE_CATEGORY_PK);
    subCategories.setID("casesSubCategory");
    subCategories.keepStatusOnAction(true);
    subCategories.setSelectedElement(category.getPrimaryKey().toString());
    subCategories.setStyleClass("subCaseCategoryDropdown");

    if (parentCategory != null) {
        @SuppressWarnings("unchecked")
        Collection<CaseCategory> collection = getCasesBusiness(iwc).getSubCategories(parentCategory);

        if (collection.isEmpty())
            subCategories.addMenuElement(category.getPrimaryKey().toString(),
                    getResourceBundle().getLocalizedString("case_creator.no_sub_category", "no sub category"));
        else
            for (CaseCategory subCategory : collection)
                subCategories.addMenuElement(subCategory.getPrimaryKey().toString(),
                        subCategory.getLocalizedCategoryName(iwc.getCurrentLocale()));
    }

    DropdownMenu types = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_TYPE_PK), getCasesBusiness().getCaseTypes(), "getName");
    types.keepStatusOnAction(true);
    types.setSelectedElement(type.getPrimaryKey().toString());
    types.setStyleClass("caseTypeDropdown");

    HiddenInput hiddenType = new HiddenInput(PARAMETER_CASE_TYPE_PK, type.getPrimaryKey().toString());

    DropdownMenu statuses = new DropdownMenu(PARAMETER_STATUS);
    statuses.addMenuElement(getCasesBusiness().getCaseStatusPending().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusPending(), iwc.getCurrentLocale()));
    statuses.addMenuElement(getCasesBusiness().getCaseStatusWaiting().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusWaiting(), iwc.getCurrentLocale()));
    statuses.addMenuElement(getCasesBusiness().getCaseStatusReady().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusReady(), iwc.getCurrentLocale()));
    statuses.setSelectedElement(theCase.getStatus());
    statuses.setStyleClass("caseStatusDropdown");

    Layer message = new Layer(Layer.SPAN);
    if (theCase.getMessage() != null) {
        message.add(new Text(TextSoap.formatText(theCase.getMessage())));
    } else {
        message.add(Text.getNonBrakingSpace());
    }

    Layer createdDate = new Layer(Layer.SPAN);
    createdDate.add(new Text(
            created.getLocaleDateAndTime(iwc.getCurrentLocale(), IWTimestamp.SHORT, IWTimestamp.SHORT)));

    TextArea reply = new TextArea(PARAMETER_REPLY);
    reply.setStyleClass("textarea");
    reply.keepStatusOnAction(true);

    Layer formItem = new Layer(Layer.DIV);
    formItem.setStyleClass("formItem");
    Label label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("case_nr", "Case nr"));
    formItem.add(label);
    formItem.add(new Span(new Text(theCase.getPrimaryKey().toString())));
    section.add(formItem);

    if (getCasesBusiness().useTypes()) {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("case_type", "Case type"), types);
        element.add(label);
        element.add(types);
        section.add(element);
    } else {
        form.add(hiddenType);
    }

    Layer element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("case_category", "Case category"), categories);
    element.add(label);
    element.add(categories);
    section.add(element);

    if (useSubCategories) {
        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("sub_case_category", "Sub case category"),
                subCategories);
        element.add(label);
        element.add(subCategories);
        section.add(element);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("created_date", "Created date"));
    element.add(label);
    element.add(createdDate);
    section.add(element);

    if (attachment != null) {
        Link link = new Link(new Text(attachment.getName()));
        link.setFile(attachment);
        link.setTarget(Link.TARGET_BLANK_WINDOW);

        Layer attachmentSpan = new Layer(Layer.SPAN);
        attachmentSpan.add(link);

        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("attachment", "Attachment"));
        element.add(label);
        element.add(attachmentSpan);
        section.add(element);
    }

    if (theCase.getSubject() != null) {
        formItem = new Layer(Layer.DIV);
        formItem.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("regarding", "Regarding"));
        formItem.add(label);
        formItem.add(new Span(new Text(theCase.getSubject())));
        section.add(formItem);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    element.setStyleClass("informationItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString(getPrefix() + "message", "Message"));
    element.add(label);
    element.add(message);
    section.add(element);

    section.add(clear);

    heading = new Heading1(getResourceBundle().getLocalizedString("handler_overview", "Handler overview"));
    heading.setStyleClass("subHeader");
    form.add(heading);

    section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("status", "status"), statuses);
    element.add(label);
    element.add(statuses);
    section.add(element);

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("reply", "Reply"), reply);
    element.add(label);
    element.add(reply);
    section.add(element);

    section.add(clear);

    @SuppressWarnings("unchecked")
    Collection<CaseLog> logs = getCasesBusiness(iwc).getCaseLogs(theCase);
    if (!logs.isEmpty()) {
        for (CaseLog log : logs) {
            form.add(getHandlerLayer(iwc, this.getResourceBundle(), theCase, log));
        }
    }

    Layer bottom = new Layer(Layer.DIV);
    bottom.setStyleClass("bottom");
    form.add(bottom);

    Link back = getButtonLink(getResourceBundle().getLocalizedString("back", "Back"));
    back.setStyleClass("homeButton");
    back.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_VIEW));
    back.setToFormSubmit(form);
    bottom.add(back);

    Link pdf = getDownloadButtonLink(getResourceBundle().getLocalizedString("fetch_pdf", "Fetch PDF"),
            CaseWriter.class);
    pdf.addParameter(getCasesBusiness().getSelectedCaseParameter(), theCase.getPrimaryKey().toString());
    bottom.add(pdf);

    Link next = getButtonLink(getResourceBundle().getLocalizedString("process", "Process"));
    next.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_SAVE));
    next.setToFormSubmit(form);
    bottom.add(next);

    add(form);
}

From source file:is.idega.idegaweb.egov.cases.presentation.CasesProcessor.java

protected void showAllocationForm(IWContext iwc, Object casePK) throws RemoteException {
    Form form = new Form();
    form.setStyleClass("adminForm");
    form.maintainParameter(PARAMETER_CASE_PK);
    form.addParameter(UserCases.PARAMETER_ACTION, "");

    boolean useSubCategories = getCasesBusiness(iwc).useSubCategories();

    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_ENGINE_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_UTIL_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, "/dwr/interface/CasesBusiness.js");
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc,
            getBundle().getVirtualPathWithFileNameString("js/navigation.js"));

    Layer section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);/*from w ww.j a  va2  s.  c  o m*/

    Layer helpLayer = new Layer(Layer.DIV);
    helpLayer.setStyleClass("helperText");
    helpLayer.add(new Text(getResourceBundle().getLocalizedString("allocate_case_help",
            "Please select the user to allocate the case to and write a message that will be sent to the user selected.")));
    section.add(helpLayer);

    Layer clear = new Layer(Layer.DIV);
    clear.setStyleClass("Clear");

    GeneralCase theCase = null;
    try {
        theCase = getCasesBusiness().getGeneralCase(casePK);
    } catch (FinderException fe) {
        fe.printStackTrace();
        throw new IBORuntimeException(fe);
    }
    CaseCategory category = theCase.getCaseCategory();
    CaseCategory parentCategory = category.getParent();
    CaseType type = theCase.getCaseType();
    Group handlerGroup = category.getHandlerGroup();

    SelectorUtility util = new SelectorUtility();
    DropdownMenu categories = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_CATEGORY_PK), getCasesBusiness().getCaseCategories(), "getName");
    categories.setID(PARAMETER_CASE_CATEGORY_PK);
    categories.setSelectedElement(parentCategory != null ? parentCategory.getPrimaryKey().toString()
            : category.getPrimaryKey().toString());
    categories.setStyleClass("caseCategoryDropdown");
    if (useSubCategories) {
        categories.setOnChange("changeSubCategories('" + PARAMETER_CASE_CATEGORY_PK + "', '"
                + iwc.getCurrentLocale().getCountry() + "')");
    }
    categories.setOnChange("changeUsers('" + PARAMETER_CASE_CATEGORY_PK + "')");

    DropdownMenu subCategories = new DropdownMenu(PARAMETER_SUB_CASE_CATEGORY_PK);
    subCategories.setID(PARAMETER_SUB_CASE_CATEGORY_PK);
    subCategories.setSelectedElement(category.getPrimaryKey().toString());
    subCategories.setStyleClass("subCaseCategoryDropdown");
    subCategories.setOnChange("changeUsers('" + PARAMETER_SUB_CASE_CATEGORY_PK + "')");

    @SuppressWarnings("unchecked")
    Collection<CaseCategory> collection = getCasesBusiness(iwc)
            .getSubCategories(parentCategory != null ? parentCategory : category);
    if (collection.isEmpty()) {
        subCategories.addMenuElement(category.getPrimaryKey().toString(),
                getResourceBundle().getLocalizedString("case_creator.no_sub_category", "no sub category"));
    } else {
        subCategories.addMenuElement(category.getPrimaryKey().toString(), getResourceBundle()
                .getLocalizedString("case_creator.select_sub_category", "Select sub category"));
        Iterator<CaseCategory> iter = collection.iterator();
        while (iter.hasNext()) {
            CaseCategory subCategory = iter.next();
            subCategories.addMenuElement(subCategory.getPrimaryKey().toString(),
                    subCategory.getLocalizedCategoryName(iwc.getCurrentLocale()));
        }
    }

    DropdownMenu types = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_TYPE_PK), getCasesBusiness().getCaseTypes(), "getName");
    types.keepStatusOnAction(true);
    types.setSelectedElement(type.getPrimaryKey().toString());
    types.setStyleClass("caseTypeDropdown");

    HiddenInput hiddenType = new HiddenInput(PARAMETER_CASE_TYPE_PK, type.getPrimaryKey().toString());

    Collection<User> handlers = getUserBusiness().getUsersInGroup(handlerGroup);
    DropdownMenu users = new DropdownMenu(PARAMETER_USER);
    users.setID(PARAMETER_USER);

    for (User handler : handlers)
        users.addMenuElement(handler.getPrimaryKey().toString(), handler.getName());

    TextArea message = new TextArea(PARAMETER_MESSAGE);
    message.setStyleClass("textarea");
    message.keepStatusOnAction(true);

    if (getCasesBusiness().useTypes()) {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        Label label = new Label(getResourceBundle().getLocalizedString("case_type", "Case type"), types);
        element.add(label);
        element.add(types);
        section.add(element);
    } else {
        form.add(hiddenType);
    }

    Layer element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    Label label = new Label(getResourceBundle().getLocalizedString("case_category", "Case category"),
            categories);
    element.add(label);
    element.add(categories);
    section.add(element);

    if (useSubCategories) {
        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("sub_case_category", "Sub case category"),
                subCategories);
        element.add(label);
        element.add(subCategories);
        section.add(element);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("handler", "Handler"), users);
    element.add(label);
    element.add(users);
    section.add(element);

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("allocation_message", "Message"), message);
    element.add(label);
    element.add(message);
    section.add(element);

    section.add(clear);

    Layer bottom = new Layer(Layer.DIV);
    bottom.setStyleClass("bottom");
    form.add(bottom);

    Link back = getButtonLink(getResourceBundle().getLocalizedString("back", "Back"));
    back.setStyleClass("homeButton");
    back.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_PROCESS));
    back.setToFormSubmit(form);
    bottom.add(back);

    Link next = getButtonLink(getResourceBundle().getLocalizedString("allocate", "Allocate"));
    next.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_SAVE));
    next.setToFormSubmit(form);
    bottom.add(next);
    add(form);
}

From source file:com.idega.builder.business.IBXMLPage.java

/**
 * <p>/*  www  .j a v  a 2 s.  com*/
 * TODO tryggvil describe method preloadIcObject
 * </p>
 */
private void preloadIcObjectInstance() {

    ICObjectInstanceHome icoHome = getICObjectInstanceHome();
    try {
        /*Collection icos = */icoHome.findByPageKey(getPageKey());
        /*for (Iterator iter = icos.iterator(); iter.hasNext();) {
           ICObjectInstance instance = (ICObjectInstance) iter.next();
           //just caching the instance in beancache
        }*/
    } catch (FinderException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:is.idega.idegaweb.egov.cases.presentation.HandlerCases.java

@Override
protected void showProcessor(IWContext iwc, Object casePK) throws RemoteException {
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, getJQuery().getBundleURIToJQueryLib());
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_ENGINE_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, CoreConstants.DWR_UTIL_SCRIPT);
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc, "/dwr/interface/CasesBusiness.js");
    PresentationUtil.addJavaScriptSourceLineToHeader(iwc,
            getBundle().getVirtualPathWithFileNameString("javascript/egov_cases.js"));

    Form form = new Form();
    form.setStyleClass("adminForm");
    form.setStyleClass("overview");
    form.maintainParameter(PARAMETER_CASE_PK);
    form.addParameter(UserCases.PARAMETER_ACTION, "");

    HiddenInput localeInput = new HiddenInput("current_locale",
            iwc.getCurrentLocale().getCountry().toLowerCase());
    localeInput.setID("casesLocale");
    form.add(localeInput);/*from  w w  w .j  a va 2 s .  c  o m*/

    boolean useSubCategories = getCasesBusiness(iwc).useSubCategories();

    GeneralCase theCase = null;
    try {
        theCase = getCasesBusiness().getGeneralCase(casePK);
    } catch (FinderException fe) {
        fe.printStackTrace();
        throw new IBORuntimeException(fe);
    }
    CaseCategory category = theCase.getCaseCategory();
    CaseCategory parentCategory = category.getParent();
    CaseType type = theCase.getCaseType();
    ICFile attachment = theCase.getAttachment();
    User owner = theCase.getOwner();
    IWTimestamp created = new IWTimestamp(theCase.getCreated());

    form.add(getPersonInfo(iwc, owner));

    Heading1 heading = new Heading1(
            getResourceBundle().getLocalizedString(getPrefix() + "case_overview", "Case overview"));
    heading.setStyleClass("subHeader");
    heading.setStyleClass("topSubHeader");
    form.add(heading);

    Layer section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    if (theCase.isPrivate()) {
        section.add(getAttentionLayer(getResourceBundle().getLocalizedString(getPrefix() + "case.is_private",
                "The sender wishes that this case be handled as confidential.")));
    }

    Layer clear = new Layer(Layer.DIV);
    clear.setStyleClass("Clear");

    SelectorUtility util = new SelectorUtility();
    DropdownMenu categories = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_CATEGORY_PK), getCasesBusiness().getCaseCategories(), "getName");
    categories.setID("casesParentCategory");
    categories.keepStatusOnAction(true);
    categories.setSelectedElement(parentCategory != null ? parentCategory.getPrimaryKey().toString()
            : category.getPrimaryKey().toString());
    categories.setStyleClass("caseCategoryDropdown");

    DropdownMenu subCategories = new DropdownMenu(PARAMETER_SUB_CASE_CATEGORY_PK);
    subCategories.setID("casesSubCategory");
    subCategories.keepStatusOnAction(true);
    subCategories.setSelectedElement(category.getPrimaryKey().toString());
    subCategories.setStyleClass("subCaseCategoryDropdown");

    if (parentCategory != null) {
        @SuppressWarnings("unchecked")
        Collection<CaseCategory> collection = getCasesBusiness(iwc).getSubCategories(parentCategory);

        if (collection.isEmpty())
            subCategories.addMenuElement(category.getPrimaryKey().toString(),
                    getResourceBundle().getLocalizedString("case_creator.no_sub_category", "no sub category"));
        else
            for (CaseCategory subCategory : collection)
                subCategories.addMenuElement(subCategory.getPrimaryKey().toString(),
                        subCategory.getLocalizedCategoryName(iwc.getCurrentLocale()));
    }

    DropdownMenu types = (DropdownMenu) util.getSelectorFromIDOEntities(
            new DropdownMenu(PARAMETER_CASE_TYPE_PK), getCasesBusiness().getCaseTypes(), "getName");
    types.keepStatusOnAction(true);
    types.setSelectedElement(type.getPrimaryKey().toString());
    types.setStyleClass("caseTypeDropdown");

    HiddenInput hiddenType = new HiddenInput(PARAMETER_CASE_TYPE_PK, type.getPrimaryKey().toString());

    DropdownMenu statuses = new DropdownMenu(PARAMETER_STATUS);
    statuses.addMenuElement(getCasesBusiness().getCaseStatusPending().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusPending(), iwc.getCurrentLocale()));
    statuses.addMenuElement(getCasesBusiness().getCaseStatusWaiting().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusWaiting(), iwc.getCurrentLocale()));
    statuses.addMenuElement(getCasesBusiness().getCaseStatusReady().getStatus(),
            getCasesBusiness().getLocalizedCaseStatusDescription(theCase,
                    getCasesBusiness().getCaseStatusReady(), iwc.getCurrentLocale()));
    statuses.setSelectedElement(theCase.getStatus());
    statuses.setStyleClass("caseStatusDropdown");

    Layer message = new Layer(Layer.SPAN);
    if (theCase.getMessage() != null) {
        message.add(new Text(TextSoap.formatText(theCase.getMessage())));
    } else {
        message.add(Text.getNonBrakingSpace());
    }

    Layer createdDate = new Layer(Layer.SPAN);
    createdDate.add(new Text(
            created.getLocaleDateAndTime(iwc.getCurrentLocale(), IWTimestamp.SHORT, IWTimestamp.SHORT)));

    TextArea reply = new TextArea(PARAMETER_REPLY);
    reply.setStyleClass("textarea");
    reply.keepStatusOnAction(true);

    Layer formItem = new Layer(Layer.DIV);
    formItem.setStyleClass("formItem");
    Label label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("case_nr", "Case nr"));
    formItem.add(label);
    formItem.add(new Span(new Text(theCase.getPrimaryKey().toString())));
    section.add(formItem);

    if (getCasesBusiness().useTypes()) {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("case_type", "Case type"), types);
        element.add(label);
        element.add(types);
        section.add(element);
    } else {
        form.add(hiddenType);
    }

    Layer element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("case_category", "Case category"), categories);
    element.add(label);
    element.add(categories);
    section.add(element);

    if (useSubCategories) {
        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("sub_case_category", "Sub case category"),
                subCategories);
        element.add(label);
        element.add(subCategories);
        section.add(element);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString("created_date", "Created date"));
    element.add(label);
    element.add(createdDate);
    section.add(element);

    if (attachment != null) {
        Link link = new Link(new Text(attachment.getName()));
        link.setFile(attachment);
        link.setTarget(Link.TARGET_BLANK_WINDOW);

        Layer attachmentSpan = new Layer(Layer.SPAN);
        attachmentSpan.add(link);

        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("attachment", "Attachment"));
        element.add(label);
        element.add(attachmentSpan);
        section.add(element);
    }

    if (theCase.getSubject() != null) {
        formItem = new Layer(Layer.DIV);
        formItem.setStyleClass("formItem");
        label = new Label();
        label.setLabel(getResourceBundle().getLocalizedString("regarding", "Regarding"));
        formItem.add(label);
        formItem.add(new Span(new Text(theCase.getSubject())));
        section.add(formItem);
    }

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    element.setStyleClass("informationItem");
    label = new Label();
    label.setLabel(getResourceBundle().getLocalizedString(getPrefix() + "message", "Message"));
    element.add(label);
    element.add(message);
    section.add(element);

    section.add(clear);

    heading = new Heading1(getResourceBundle().getLocalizedString("handler_overview", "Handler overview"));
    heading.setStyleClass("subHeader");
    form.add(heading);

    section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("status", "status"), statuses);
    element.add(label);
    element.add(statuses);
    section.add(element);

    element = new Layer(Layer.DIV);
    element.setStyleClass("formItem");
    label = new Label(getResourceBundle().getLocalizedString("reply", "Reply"), reply);
    element.add(label);
    element.add(reply);
    section.add(element);

    section.add(clear);

    @SuppressWarnings("unchecked")
    Collection<CaseLog> logs = getCasesBusiness(iwc).getCaseLogs(theCase);
    if (!logs.isEmpty()) {
        for (CaseLog log : logs) {
            form.add(getHandlerLayer(iwc, this.getResourceBundle(), theCase, log));
        }
    }

    Layer bottom = new Layer(Layer.DIV);
    bottom.setStyleClass("bottom");
    form.add(bottom);

    Link back = getButtonLink(getResourceBundle().getLocalizedString("back", "Back"));
    back.setStyleClass("homeButton");
    back.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_VIEW));
    back.setToFormSubmit(form);
    bottom.add(back);

    Link pdf = getDownloadButtonLink(getResourceBundle().getLocalizedString("fetch_pdf", "Fetch PDF"),
            CaseWriter.class);
    pdf.addParameter(getCasesBusiness().getSelectedCaseParameter(), theCase.getPrimaryKey().toString());
    bottom.add(pdf);

    Link next = getButtonLink(getResourceBundle().getLocalizedString("process", "Process"));
    next.setValueOnClick(UserCases.PARAMETER_ACTION, String.valueOf(ACTION_SAVE));
    next.setToFormSubmit(form);
    bottom.add(next);

    add(form);
}

From source file:is.idega.idegaweb.egov.cases.presentation.CasesStatistics.java

@Override
protected void present(IWContext iwc) throws Exception {
    boolean useSubCats = super.getCasesBusiness(iwc).useSubCategories();
    boolean useTypes = super.getCasesBusiness(iwc).useTypes();

    IWResourceBundle iwrb = getResourceBundle(iwc);
    Collection<CaseStatus> statuses = null;
    if (visibleStatuses == null) {
        if (ListUtil.isEmpty(cases)) {
            statuses = getCasesBusiness().getCaseStatuses();
        } else {//from w  w w. j a  va2s  .  c  o m
            //   Will be used statuses provided by cases
            statuses = new ArrayList<CaseStatus>();
            CaseStatus status = null;
            for (CasePresentation theCase : cases) {
                status = theCase.getCaseStatus();
                if (status != null && !statuses.contains(status)) {
                    statuses.add(status);
                }
            }
        }
    } else {
        statuses = new ArrayList<CaseStatus>();
        StringTokenizer tok = new StringTokenizer(visibleStatuses, CoreConstants.COMMA);
        while (tok.hasMoreTokens()) {
            String status = tok.nextToken().trim();
            try {
                CaseStatus cStat = getCaseStatusHome().findByPrimaryKey(status);
                statuses.add(cStat);
            } catch (FinderException f) {
                f.printStackTrace();
            }
        }
    }

    String localizedStatus = null;
    Collection<CaseStatus> statusesToUse = new ArrayList<CaseStatus>();
    if (!ListUtil.isEmpty(statuses)) {
        for (CaseStatus status : statuses) {
            if (!statusesToUse.contains(status)) {
                localizedStatus = getCasesBusiness().getLocalizedCaseStatusDescription(null, status,
                        iwc.getCurrentLocale());

                if (!StringUtil.isEmpty(localizedStatus) && !localizedStatus.equals(status.getStatus())) {
                    statusesToUse.add(status);
                }
            }
        }
    }

    Form form = new Form();
    form.setID("casesStatistics");
    form.setStyleClass("adminForm");
    add(form);
    boolean addDateIntervalChooser = isShowDateRange();
    if (addDateIntervalChooser) {
        if (CoreUtil.isSingleComponentRenderingProcess(iwc)) {
            try {
                int pageId = iwc.getCurrentIBPageID();
                ICPageHome pageHome = (ICPageHome) IDOLookup.getHome(ICPage.class);
                ICPage page = pageHome.findByPrimaryKey(pageId);
                form.setAction(CoreConstants.PAGES_URI_PREFIX.concat(page.getDefaultPageURI()));
            } catch (Exception e) {
                e.printStackTrace();
                addDateIntervalChooser = false;
            }
        }
    }

    Layer section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    form.add(section);

    IWDatePicker from = new IWDatePicker(PARAMETER_FROM_DATE);
    from.setUseCurrentDateIfNotSet(false);
    from.setShowMonthChange(true);
    from.setShowYearChange(true);
    from.keepStatusOnAction(true);

    IWDatePicker to = new IWDatePicker(PARAMETER_TO_DATE);
    to.setUseCurrentDateIfNotSet(false);
    to.setShowMonthChange(true);
    to.setShowYearChange(true);
    to.keepStatusOnAction(true);

    if (addDateIntervalChooser) {
        Layer element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        Label label = new Label(getResourceBundle().getLocalizedString("cases_fetcher.from_date", "From date"),
                from);
        element.add(label);
        element.add(from);
        section.add(element);

        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        label = new Label(getResourceBundle().getLocalizedString("cases_fetcher.to_date", "To date"), to);
        element.add(label);
        element.add(to);
        section.add(element);

        SubmitButton fetch = new SubmitButton(
                getResourceBundle().getLocalizedString("cases_fetcher.fetch", "Fetch"));
        fetch.setStyleClass("indentedButton");
        fetch.setStyleClass("button");
        element = new Layer(Layer.DIV);
        element.setStyleClass("formItem");
        element.add(fetch);
        section.add(element);
    }

    section = new Layer(Layer.DIV);
    section.setStyleClass("formSection");
    section.setStyleClass("statisticsLayer");
    form.add(section);

    Heading1 heading = new Heading1(iwrb.getLocalizedString("case.statistics", "Case statistics"));
    section.add(heading);

    IWTimestamp fromDate = null;
    if (iwc.isParameterSet(PARAMETER_FROM_DATE)) {
        fromDate = new IWTimestamp(IWDatePickerHandler.getParsedDate(iwc.getParameter(PARAMETER_FROM_DATE),
                iwc.getCurrentLocale()));
    }

    IWTimestamp toDate = null;
    if (iwc.isParameterSet(PARAMETER_TO_DATE)) {
        toDate = new IWTimestamp(
                IWDatePickerHandler.getParsedDate(iwc.getParameter(PARAMETER_TO_DATE), iwc.getCurrentLocale()));
    }

    Collection<Result> resultsByCaseCategories = getResults(iwc, useSubCats, -1, true, fromDate, toDate);
    addResults(null, null, null, iwc, iwrb, section, resultsByCaseCategories, statusesToUse,
            iwrb.getLocalizedString("case.cases_by_category", "Cases by category"), useSubCats, false, 0,
            fromDate, toDate);
    section.add(new CSSSpacer());

    Collection<Result> resultsByUsers = getResultsUsers(iwc, fromDate, toDate);
    addResults(null, null, null, iwc, iwrb, section, resultsByUsers, statusesToUse,
            iwrb.getLocalizedString("case.cases_by_handler", "Cases by handler"), false, false, 0, fromDate,
            toDate);
    section.add(new CSSSpacer());

    if (useStatisticsByCaseType != null) {
        useTypes = useStatisticsByCaseType;
    }
    if (useTypes) {
        Collection<Result> resultsByCaseTypes = getResultsCode(iwc, fromDate, toDate);
        addResults(null, null, null, iwc, iwrb, section, resultsByCaseTypes, statusesToUse,
                iwrb.getLocalizedString("case.cases_by_type", "Cases by type"), false, false, 0, fromDate,
                toDate);
        section.add(new CSSSpacer());
    }
}