BLOG

Archive for the ‘HotWax Media’ Category

The HotWax Media Way: Infrastructure and Tools to Support OFBiz Open Source eCommerce and ERP Development

Friday, March 5th, 2010

Tools OFBiz Development

In my first set of posts, I had the opportunity to describe a bit about what has been going on at HotWax Media – with a focus on our involvement in the OFBiz development community and the impact it made during 2009. While I’m looking forward to getting back to discussing what HotWax will be championing in OFBiz in 2010, I’d like to take a break from OFBiz and tell you a bit about HotWax Media and what makes us and our process different from the other options out there.

To kick things off, I’d like to discuss something near and dear to my heart – the partnerships that we make and the people we choose to make them with. Over the past few years, we have made decisions that have provided us with the ability to focus on running our business and serving our customers instead of trying to become the masters of all things in all spaces. Focus, in other words.

For many years, along with the help of a choice system administrator or two, I spent a chunk of time, every day, maintaining and upgrading our IT infrastructure. As we merged companies and grew our staff of OFBiz developers, this became increasingly difficult for me to manage – all the while wishing I was spending more time with our customers. At that time, we had migrated all of our customers’ hosted solutions over to Contegix, and one of the companies we merged with was using them to run their organization already – so it seemed like a natural fit. The rest is history! Contegix has simplified our business by making hosting and infrastructure first class and very easy.

While I will spend more time focusing on the intricacies of our partnership with Contegix in subsequent posts, by becoming our source for infrastructure decision making, and by modeling processes that we respect and appreciate, Contegix has helped us to acquire partnerships that have made additional efficiency gains. They brought their other partners to the table in order to help us focus and realize the potential of our business. From working with the Atlassian collaboration to helping us maximize that software by bringing in the experts on integration and collaboration at CustomWare, we have been able to refine our processes to reflect the level of quality all customers deserve.

Stay tuned to the next set of posts to learn more about the our processes, our partners, and how they work together to provide solutions for our customers. Here are the high level points to take away:

1. Contegix – Beyond Managed Hosting and Infrastructure Support.
2. Atlassian - Amazing Efficiency Tools.
3. CustomWare - Integration and Collaboration Solutions.
4. Our Process – Agile Development Processes Honed to Work in a Distributed, Multi-Cultural, Development Environment.

- Tim

Tim Ruppert is Chief Operating Officer at HotWax Media as well as an OFBiz project committer and active community member. Tim will join other HotWax Media employees and advisors in periodically posting thoughts here related to OFBiz, eCommerce, ERP, and related topics.

OFBiz Tutorial – Implementing a Product PDF export

Tuesday, February 23rd, 2010

In our last post of the tutorial series OFBiz Tutorial – Implementing a Product CSV export we have learned how to quickly implement a CSV export of a list of rows.

In this post we will perform similar steps in order to create a PDF version of the “Product List” screen.
PDF exports are supported out of the box by the OFBiz widgets.
In this excercise we will:

  1. add to the product list screen a link, close to the CSV export link we have created in our last post, that will generate the PDF export
  2. add to the controller.xml file the request and view entries for the new PDF export screen
  3. implement the new screen definition for the PDF export screen; the screen will reuse the same form used by html screen but with a different decorator (more suited for PDF output)

Adding a link element

We have already learned how to create a link in a screen. We add it after the “CSV Export” link:

1
2
3
4
<container style="button-bar">
    <link target="ProductListExport" text="CSV Export" style="buttontext"/>
    <link target="ProductListPDF" text="PDF Export" style="buttontext"/>
</container>
  • the new link is inside of the same “container” element of the “CSV Export” link; we want the two links rendered close to each other
  • the link element is defined in the same way we have defined the other link

Controller entries for a PDF export screen

1
2
3
4
5
6
<request-map uri="ProductListPDF">  
    <security https="true" auth="true"/> 
    <response name="success" type="view" value="ProductListPDFScreen"/>
</request-map> 
... 
<view-map name="ProductListPDFScreen" type="screenfop" content-type="application/pdf" page="component://hwm/widget/HwmScreens.xml#ProductListPDF"/>

The entries are very similar to the ones we have implemented in a previous post for the product list screen. There are just a couple of things to notice:

  • as usual, the request-map uri must match with the target of the link element in the screen (”ProductListPDF”)
  • in the view-map, the type is now “screenfop” (instead of “screen”) because we have to invoke the “fop screen renderer” to generate a PDF output
  • in the view-map we have also set the content-type to “application/pdf” as useful metadata information for the browser

Screen definition for PDF export screens

There isn’t anything special in a screen definition for a PDF export; the screen is defined in the same way of a normal screen, except for a couple of details:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<screen name="ProductListPDF">  
    <section>  
        <actions>  
            <set field="viewSize" value="10000"/>  
            <set field="pageLayoutName" value="main-page-landscape"/>  
            <entity-condition entity-name="Product" list="products">  
                <order-by field-name="productId"/>  
            </entity-condition>  
        </actions>  
        <widgets>  
            <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">  
                <decorator-section name="body">  
                    <container>  
                        <label text="Finished Products" style="h1"/>  
                    </container>  
                    <include-form name="ListProducts" location="component://hwm/widget/HwmForms.xml"/>  
                </decorator-section>  
            </decorator-screen>  
        </widgets>  
    </section> 
</screen>
  • the screen definition is mostly identical to the “product list screen” except for the decorator element: we are now using the FoReportDecorator that is one of the screen decorators available out of the box in OFBiz (it renders simple PDF reports with a page-of-pages footer, logo etc.)
  • in particular, the entity-condition element is the same and it is used to select the list of products for the export
  • the form that is included is the same of the “product list screen”: we will not have to re-implement it because the widget renderer will take care of rendering it into the proper output (PDF or CSV or html)
  • as we already did for the CSV screen, the “set” field operation, where we set “viewSize” to “10000″, is an easy way to “disable” pagination; we actually define the top limit of our product export to 10000 records here, but of course we can use a different value
  • there is an additional set operation here (for “pageLayoutName”), to set the PDF layout to landscape

Conclusion

The exercise is complete and we can test the product PDF by clicking the “PDF Export” link (there is no need to restart OFBiz).

Implementing the PDF report ended up being very similar to implementing the CSV export (or HTML screen): in OFBiz the same patterns, tools and languages can be reused to dramatically improve productivity.

- Jacopo

Jacopo Cappellato is VP of Technology at HotWax Media and has been involved with the OFBiz project since 2003. He is an OFBiz Project Committer and a member of both the OFBiz Project Management Committee and the Apache Software Foundation.Jacopo Cappellato - OFBiz Developer - OFBiz Expert