Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

referencing bean properties not listed in my "Visible Columns" #38

@mobileWMS

Description

@mobileWMS

I referenced this on Vaadin forums here.

In my case, I am getting exceptions that are related to referencing bean properties not listed in the visible columns I give it. Why? What am I doing wrong? Is this a bug with the add-on or with my code?

Here is the code:

private ExportToExcelUtility<WrappedReplenishmentOrder> customizeExportExcelUtility(
            Object[] columns, String[] names, Grid grid, String title )
    {
        /* Configuring Components */
        ExportExcelComponentConfiguration componentConfig1;
        List<ComponentHeaderConfiguration> headerConfig = Arrays.asList(
                new ComponentHeaderConfigurationBuilder().withColumnHeaderKeys(
                names).build());
        componentConfig1 = new ExportExcelComponentConfigurationBuilder().withGrid(grid)
                .withVisibleProperties(columns)
                .withHeaderConfigs(headerConfig)
//                .withColumnConfigs(value)
                .build();

        /* Configuring Sheets */
        ArrayList<ExportExcelComponentConfiguration> componentList1 = new ArrayList<ExportExcelComponentConfiguration>();
        componentList1.add(componentConfig1);

        ExportExcelSheetConfiguration sheetConfig1;
        sheetConfig1 = new ExportExcelSheetConfigurationBuilder()
                .withReportTitle(title + " Report")
                .withSheetName(title)
                .withComponentConfigs(componentList1)
                .withIsHeaderSectionRequired(Boolean.TRUE)
                .build();

        /* Configuring Excel */
        ArrayList<ExportExcelSheetConfiguration> sheetList = new ArrayList<ExportExcelSheetConfiguration>();
        sheetList.add(sheetConfig1);
        
        String generatedBy = "Website";
        
        if( loginUser instanceof User )
        {
            String tempUser = null;
            
            if( loginUser.getUserInfo() instanceof UserResponseType )
            {
                if( loginUser.getUserInfo().getFirstName() instanceof String     &&
                        loginUser.getUserInfo().getLastName() instanceof String &&
                        !loginUser.getUserInfo().getLastName().trim().isEmpty()    &&
                        !loginUser.getUserInfo().getFirstName().trim().isEmpty())
                {
                    tempUser = loginUser.getUserInfo().getFirstName().trim() + " " +
                            loginUser.getUserInfo().getLastName().trim();
                }
            }
            
            if( tempUser instanceof String && !tempUser.trim().isEmpty() )
            {
                generatedBy = tempUser;
            }
            else if( loginUser.getUserName() instanceof String &&
                    !loginUser.getUserName().trim().isEmpty())
            {
                generatedBy = loginUser.getUserName().trim();
            }
            else if( loginUser.getUserId() instanceof String &&
                    !loginUser.getUserId().trim().isEmpty())
            {
                generatedBy = loginUser.getUserId().trim();
            }
        }
        
        ExportExcelConfiguration config1;
        config1 = new ExportExcelConfigurationBuilder()
                .withGeneratedBy(generatedBy)
                .withSheetConfigs(sheetList)
                .build();

        return new ExportToExcelUtility<WrappedReplenishmentOrder>(grid.getUI(), config1, WrappedReplenishmentOrder.class);
    }

The last line gives the exceptions/logs below:

Mar 09, 2018 6:42:07 PM org.vaadin.addons.excelexporter.ExportToExcelUtility getAllMethods
INFO: getAllMethods) throws + com.mobiwms.website.data.wrappers.WrappedReplenishmentOrder.getDateTimeFmt()
Mar 09, 2018 6:42:07 PM org.vaadin.addons.excelexporter.ExportToExcelUtility getAllMethods
INFO: getAllMethods) throws + com.mobiwms.website.data.wrappers.WrappedReplenishmentOrder.isDateTimeFmt()
java.lang.NoSuchMethodException: com.mobiwms.website.data.wrappers.WrappedReplenishmentOrder.getDateTimeFmt or com.mobiwms.website.data.wrappers.WrappedReplenishmentOrder.isDateTimeFmt not found!
    at org.vaadin.addons.excelexporter.ExportToExcelUtility.getAllMethods(ExportToExcelUtility.java:1354)
    at org.vaadin.addons.excelexporter.ExportToExcelUtility.lambda$performPreprocessing$0(ExportToExcelUtility.java:185)
    at java.lang.Thread.run(Thread.java:745)
Mar 09, 2018 6:42:07 PM org.vaadin.addons.excelexporter.ExportToExcelUtility getAllMethods
INFO: getAllMethods) throws + com.wmsvision.jaxb.SupplierPortal.impl.ReplenishmentOrderImpl.get__qName()
Mar 09, 2018 6:42:07 PM org.vaadin.addons.excelexporter.ExportToExcelUtility getAllMethods
INFO: getAllMethods) throws + com.wmsvision.jaxb.SupplierPortal.impl.ReplenishmentOrderImpl.is__qName()
java.lang.NoSuchMethodException: com.wmsvision.jaxb.SupplierPortal.impl.ReplenishmentOrderImpl.get__qName or com.wmsvision.jaxb.SupplierPortal.impl.ReplenishmentOrderImpl.is__qName not found!
    at org.vaadin.addons.excelexporter.ExportToExcelUtility.getAllMethods(ExportToExcelUtility.java:1354)
    at org.vaadin.addons.excelexporter.ExportToExcelUtility.lambda$performPreprocessing$0(ExportToExcelUtility.java:185)
    at java.lang.Thread.run(Thread.java:745)

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions