Apache OfBiz Cookbook
By Ruth Hoffman
()
About this ebook
Related to Apache OfBiz Cookbook
Related ebooks
Fidessa A Complete Guide Rating: 0 out of 5 stars0 ratingsIntermediate Load Runner With Oracle/Apex Concepts. Rating: 0 out of 5 stars0 ratingsBeginning Laravel: Build Websites with Laravel 5.8 Rating: 0 out of 5 stars0 ratingsHow to Create a Ptc/gpt Website from Scratch: Dont Have a Clue On What to Do? Then This Is for You! Rating: 4 out of 5 stars4/5Currency Strategy: The Practitioner's Guide to Currency Investing, Hedging and Forecasting Rating: 0 out of 5 stars0 ratingsJavaServer Faces: The Complete Reference Rating: 0 out of 5 stars0 ratingsWSO2 Identity Server Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratingsEarn Money with Swagbucks Rating: 0 out of 5 stars0 ratingsYii 1.1 Application Development Cookbook Rating: 0 out of 5 stars0 ratingsWindows Server 2012 Automation with PowerShell Cookbook Rating: 0 out of 5 stars0 ratingsSoapUI Cookbook Rating: 0 out of 5 stars0 ratingsDart Cookbook Rating: 0 out of 5 stars0 ratingsYii Application Development Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsPHP 7: Real World Application Development Rating: 0 out of 5 stars0 ratingsSQL Server 2012 with PowerShell V3 Cookbook Rating: 0 out of 5 stars0 ratingsYii2 Application Development Cookbook - Third Edition Rating: 0 out of 5 stars0 ratingsMicrosoft Azure Development Cookbook Second Edition Rating: 5 out of 5 stars5/5DotNetNuke 5.4 Cookbook Rating: 5 out of 5 stars5/5SQL Server 2014 with PowerShell v5 Cookbook Rating: 0 out of 5 stars0 ratingsD Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics NAV 2009 Programming Cookbook Rating: 0 out of 5 stars0 ratingsJavaFX 1.2 Application Development Cookbook Rating: 0 out of 5 stars0 ratingsXamarin Mobile Development for Android Cookbook Rating: 0 out of 5 stars0 ratingsOdoo Development Cookbook Rating: 0 out of 5 stars0 ratingsPHP 7 Programming Cookbook Rating: 0 out of 5 stars0 ratingsWeb Development with Django Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsLaravel Application Development Cookbook Rating: 0 out of 5 stars0 ratingsOracle APEX Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsApache Maven Cookbook Rating: 0 out of 5 stars0 ratingsMooTools 1.3 Cookbook Rating: 0 out of 5 stars0 ratings
Information Technology For You
Summary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Computer Science: A Concise Introduction Rating: 4 out of 5 stars4/5ChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5How To Use Chatgpt: Using Chatgpt To Make Money Online Has Never Been This Simple Rating: 0 out of 5 stars0 ratingsWindows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5Supercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsHealth Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsLinux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5CompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsPanda3d 1.7 Game Developer's Cookbook Rating: 0 out of 5 stars0 ratingsPractical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5A Mind at Play: How Claude Shannon Invented the Information Age Rating: 4 out of 5 stars4/5Cybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratingsQuantum Computing for Programmers and Investors: with full implementation of algorithms in C Rating: 5 out of 5 stars5/5Hacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5The Programmer's Brain: What every programmer needs to know about cognition Rating: 5 out of 5 stars5/5The Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/520 Windows Tools Every SysAdmin Should Know Rating: 5 out of 5 stars5/5Computer Organization and Design: The Hardware / Software Interface Rating: 4 out of 5 stars4/5The Ultimate Guide to Landing a Network Engineering Job Rating: 0 out of 5 stars0 ratingsInkscape Beginner’s Guide Rating: 5 out of 5 stars5/5
Reviews for Apache OfBiz Cookbook
0 ratings0 reviews
Book preview
Apache OfBiz Cookbook - Ruth Hoffman
Table of Contents
Apache OFBiz Cookbook
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Getting Started
Introduction
Getting the project code
Getting ready
How to do it...
How it works...
There's more...
See also
Getting code from the Subversion repository
Getting ready
How to do it...
How it works...
See also
Fixing IP port collision errors
Getting ready
How to do it...
How it works...
There's more...
The JAVA_HOME setting
Getting ready
How to do it...
How it works...
There's more...
Class Not Found
errors
Getting ready
How to do it...
How it works...
There's more...
Installation verification
Getting ready
How to do it...
How it works...
There's more...
SSL verification
Getting ready
How to do it...
How it works...
There's more...
See also
Running JUnit tests
Getting ready
How to do it...
How it works...
There's more...
Locating an OFBiz Component
Getting ready
How to do it...
How it works...
There's more...
Locating an OFBiz Application
Getting ready
How to do it...
How it works...
There's more...
2. Java Development
Introduction
Java runtime CLASSPATH
How to do it...
How it works...
Java compile time CLASSPATH
Getting ready
How to do it...
How it works...
Naming conventions
How to do it...
Writing OFBiz Java Events
Getting ready
How to do it...
How it works...
There's more...
Writing OFBiz Java Services
Getting ready
How to do it...
How it works...
There's more...
See also
Debugging using the logfile
Getting ready
How to do it...
How it works...
Calling OFBiz Services from a Java program
Getting ready
How to do it...
How it works...
There's more...
Getting and validating request parameters (Events)
How to do it...
How it works...
There's more...
Getting and validating request parameters (Services)
How to do it...
How it works...
Managing error messages
How to do it...
There's more...
Using Java properties files
How to do it...
How it works...
See also
Sending e-mail from an OFBiz Event or Service
Getting ready
How to do it...
How it works...
There's more...
See also
Handling XML files
Getting ready
How to do it...
How it works...
3. The User Interface
Introduction
Creating HTML web pages
Getting ready
How to do it...
How it works...
There's more...
Adding actions to Screen widgets
Getting ready
How to do it...
How it works...
There's more...
HTML markup in Screen widgets
How to do it...
How it works..
There's more...
CSS styling in Screen widgets
How to do it...
How it works...
There's more...
Platform-specific widgets
How to do it...
How it works...
There's more...
OFBiz Tree widgets
How to do it...
How it works...
There's more...
OFBiz Menu widgets
How to do it...
How it works...
OFBiz Form widgets
How to do it...
How it works...
There's more..
Creating web pages using FreeMarker
Getting ready
How to do it...
How it works...
There's more
See also
Passing Screen widget parameters to FreeMarker
How to do it...
How it works
There's more
Calling Java methods from FreeMarker
How to do it...
How it works...
There's more...
Forcing FreeMarker to render HTML markup
How to do it...
How it works
Uploading files in FreeMarker forms
Getting ready
How to do it...
How it works...
There 's more...
4. OFBiz Services
Introduction
Managing existing OFBiz Services
How to do it...
How it works...
There's more...
Calling a Service from an HTML form
Getting ready
How to do it...
How it works...
Calling asynchronous Services from HTML forms
Getting ready
How to do it...
How it works...
There's more...
Calling a Service many times from an HTML form
How to do it...
How it works...
Creating a new Service definition file
How to do it...
How it works...
Creating a new Service definition
How to do it...
How it works...
See also
Implementing Services
Getting ready
How to do it...
How it works...
There's more...
Defining Service attributes (INPUT/OUTPUT)
How to do it...
How it works...
Service Event Condition Actions
Getting ready
How to do it...
How it works...
There's more...
Service groups
Getting ready
How to do it...
How it works...
See also
Handling Service errors
Getting ready
How to do it...
How it works...
See also
Writing Groovy Services
Getting ready
How to do it...
How it works...
Mail Event Condition Actions
Getting ready
How to do it...
How it works...
See also
Entity Event Condition Actions
How to do it...
How it works...
There's more...
See also
5. The OFBiz Entity Engine
Introduction
Changing the default database
Getting ready
How to do it...
How it works...
See also
Connecting to a remote database
Getting ready
How to do it...
How it works...
Connecting to multiple databases
Getting ready
How to do it...
How it works...
Creating entity groups
Getting ready
How to do it...
How it works...
Disabling automatic database checks
Getting ready
How to do it...
How it works...
Mapping database data types
Getting ready
How to do it...
How it works...
Creating a new entity definition file
How to do it...
How it works...
Creating a new entity model
Getting ready
How to do it...
How it works...
There's more...
Modifying an existing entity model
Getting ready
How to do it...
How it works...
Building a view-entity
Getting ready
How to do it...
How it works...
There's more...
See also
6. OFBiz Security
Introduction
Securing communications ports
How to do it...
How it works...
There's more...
See also
Disabling demonstration user accounts
How to do it...
How it works...
Protecting OFBiz web pages
Getting ready
How to do it...
How it works...
There's more...
Creating user accounts
How to do it...
How it works...
There's more...
Protecting applications using security groups
How to do it...
How it works...
There's more...
Protecting views (Tarpitting
)
Getting ready
How to do it...
How it works...
There's more...
Retrieving forgotten passwords
Getting ready
How to do it...
How it works...
Changing your password
How to do it...
How it works...
Adding or changing SSL certificates
Getting ready
How to do it...
How it works...
There's more...
See also
OFBiz single sign-on and the external login key
Getting ready
How to do it...
How it works...
There's more...
7. WebTools
Introduction
Cache maintenance
Getting ready
How to do it...
How it works...
There's more...
See also
Changing debug settings
Getting ready
How to do it...
How it works...
There's more...
Exporting database data to XML documents
Getting ready
How to do it...
How it works...
Loading database(s) from XML documents
Getting ready
How to do it...
How it works...
There's more...
Managing internationalization labels
Getting ready
How to do it...
How it works
There's more...
Using the SQL processor
Getting ready
How to do it...
How it works...
Exploring the entity reference tool
Getting ready
How to do it...
How it works...
Viewing OFBiz usage statistics
Getting ready
How to do it...
How it works...
Uncovering artifact information
Getting ready
How to do it...
How it works...
Working with temporal expressions
Getting ready
How to do it...
How it works...
There's more...
8. Web Services
Introduction
Requesting web services using URL parameters
Getting ready
How to do it...
How it works...
There's more...
Requesting web services using an HttpClient
Getting ready
How to do it...
How it works...
There's more...
See also
Creating HttpClients and passing XML documents
Getting ready
How to do it...
How it works...
Creating XML-RPC web service clients
Getting ready
How to do it...
How it works...
See also
Becoming an XML-RPC web service provider
Getting ready
How to do it...
How it works...
See also
OFBiz SOAP messaging clients
Getting ready
How to do it...
How it works...
There's more...
Generating a WSDL document
Getting ready
How to do it...
How it works...
Creating SOAP-compliant web services
Getting ready
How to do it...
How it works...
9. OFBiz Tips and Tricks
Introduction
Fixing Java memory allocation errors
Getting ready
How to do it...
How it works...
There's more...
Reloading OFBiz seed and demo data
Getting ready
How to do it...
How it works...
There's more...
Creating new seed data files
Getting ready
How to do it...
How it works...
There's more…
Changing the administrative user's password
Getting ready
How to do it...
How it works...
There's more…
Creating a new administrative user
Getting ready
How to do it...
How it works...
There's more...
Getting the OFBiz version number
Getting ready
How to do it...
How it works...
There's more...
Building an OFBiz instance
Getting ready
How to do it...
How it works...
There's more...
See also
Building a single OFBiz Component
Getting ready
How to do it...
How it works...
Creating a new OFBiz Component or Application
Getting ready
How to do it...
How it works...
There's more...
Creating a FreeMarker transform
How to do it...
How it works...
There's more...
Preparing data using Groovy
Getting ready
How to do it...
How it works...
There's more...
See also
Pop-up new browser windows
How to do it...
How it works...
There's more...
Installing an OFBiz Visual Theme
Getting ready
How to do it...
How it works...
There's more...
Creating an OFBiz Visual Theme
Getting ready
How to do it...
How it works...
There's more...
See also
A. Entity Engine by Example
Introduction
Putting it all together with a data model example
Sample use case
Entity diagram
New entity definitions
2-way SQL join view-entity
3-way SQL join view-entity
View-entity reports
Next steps
Reading data from an OFBiz data source
Working with large result sets (EntityListIterator)
Removing data from the database (Java)
Writing data to the database (Java)
Using the automatic sequence generator
EntityUtil
EntityUtil.getFirst()
EntityUtil.filterByDate()
EntityUtil.orderBy()
EntityUtil.getFieldListFromEntityList()
EntityUtil.getRelated()
EntityUtil.filterByCondition()
EntityOperator reference
Index
Apache OFBiz Cookbook
Apache OFBiz Cookbook
Copyright © 2010 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2010
Production Reference: 1020910
Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK.
ISBN 978-1-847199-18-8
www.packtpub.com
Cover Image by Harmeet Singh ( <singharmeet@yahoo.com> )
Credits
Author
Ruth Hoffman
Reviewers
Adrian Crum
Shi Jinghai
Acquisition Editor
Chaitanya Apte
Development Editor
Rakesh Shejwal
Technical Editor
Vanjeet D'souza
Indexer
Hemangini Bari
Editorial Team Leader
Mithun Sehgal
Project Team Leader
Ashwin Shetty
Project Coordinator
Joel Goveya
Proofreader
Jonathan Todd
Graphics
Geetanjali Sawant
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
About the Author
Ruth Hoffman is an OFBiz evangelist with over 25 years of information technology experience, including stints in software design and development, training, project management, product marketing, and software sales, She has dedicated the last few years of her eventful career to furthering the OFBiz vision. Whether it be writing about OFBiz, providing implementation and OFBiz consulting services, or just kicking the OFBiz tires
for each new release, she enjoys working with and telling the world about all that this amazing ERP software suite has to offer.
Ruth's current passion is her quest to provide high quality, cost effective OFBiz training and documentation. She has pursued this quest through multiple channels, including the OFBiz website. She invites everyone to stop by, take a gander, and give some feedback at http://www.myofbiz.com
As a long-standing supporter of OFBiz, she has authored several other OFBiz titles, including OFBiz E-Commerce Out-Of-The-Box and The OFBiz Catalog Manager. For more information, please see: http://www.myofbiz.com.
I would like to thank my partner, JC, for being so patient and understanding, my daughter for not getting too upset when I cancelled our planned Lilac Festival adventure, and my dog Sadie for sitting by me all those long hours when no one else would.
Also, my sincerest thanks go to Adrian Crum and Shi Jinghai for their dedicated efforts in providing technical reviews of this book. Thanks for keeping me honest and setting me straight on a number of occasions. Your contributions are greatly appreciated!
About the Reviewers
Adrian Crum is an IT Manager/Computer programmer for a company that builds homes. Prior to that, he owned and operated a computer retail/service/consulting business. He was Technical Editor of Coast Compute Magazine, and a contributing writer for Programmer's Journal. Adrian has been involved with the Apache OFBiz project as a contributing programmer since 2004, and he is a member of the Project Management Committee. His extensive experience in many programming languages and cross-platform development has been a key part of his contributions to the Apache OFBiz project.
Shi Jinghai graduated from Tsinghua University in 1991. In 2001, he took part in the China 2G Citizen Card Project and became an important system designer of the National Citizen Identity Information System of China. In 2004, he started his own company (Beijing Langhua Ltd.) focusing on IT services based on some excellent open source projects such as OFBiz, OpenCms, JBoss Portal, and Jasig CAS among others.
Preface
This book is designed to be read in any order, and is a collection of recipes found, by experience, to be most useful for developers working with the OFBiz project. Let it be your guide to enhancing your OFBiz productivity by saving you valuable time. Written specifically to give clear and straightforward answers to the most commonly asked OFBiz questions, this compendium of OFBiz recipes will show you everything you need to know to get things done in OFBiz.
Whether you are new to OFBiz or an old pro, you are sure to find many useful hints and handy tips here. Topics range from getting started, to configuration and system setup, security and database management, through the final stages of developing and testing new OFBiz applications. We are now Open For Business.
What this book covers
Chapter 1, Getting Started: If you already know how to get started with OFBiz then you can confidently skip this chapter. If, however, you are new to OFBiz, then you may find helpful hints in here to get you started, including getting a copy of the code from the download page or from the Subversion source code repository; fixing installation-related IP port collision errors; setting JAVA_HOME; fixing Java Class Not Found
errors; installation verification; running JUnit tests; and some basic project artifact navigation hints, including where certain special directories (folders for Windows users) and files may be found.
Chapter 2, Java Development: OFBiz Java development starts with a clear understanding of the role of the Java CLASSPATH. In this chapter, learn how the CLASSPATH enables compilation and runtime loading of OFBiz artifacts. In addition, this chapter reveals how the OFBiz Java file-naming convention is helpful in organizing and finding Java source code. Also learn how to create OFBiz Events and Services, effectively use the provided Java debugging methods, call another OFBiz Service from within a Java program, access HTTP/HTTPS request parameters, use existing tools to handle error messages, use Java properties files, send e-mail using existing OFBiz Service(s), and manipulate XML documents using provided tools.
Chapter 3, The User Interface: Users interact with OFBiz—that is, the User Interface
—through web pages often referred to within the project as screens
or screen views
. In this chapter, see how web pages are built from the OFBiz Screen widget, including how to add actions, HTML markup, CSS, and other widgets (Tree, Menu, and Form widgets) to a single screen view widget definition. If your tastes run more towards creating your own screen views, see how to use FreeMarker templates inside Screen widget definitions to build (HTML) web pages. Also discussed in this chapter: passing parameters from the Screen widget's runtime context to the FreeMarker rendering engine, writing JavaScript and including it in a FreeMarker template, calling OFBiz Java methods directly from the FreeMarker context, forcing FreeMarker to render content with HTML markup at runtime, and how to upload a file—that is, support multipart HTML forms—in FreeMarker.
Chapter 4, OFBiz Services: OFBiz Services
are reusable snippets of code that represent business processing or other logic. You write an OFBiz Service one time and invoke it anytime, anywhere and as often as needed. In this chapter, discover how to manage existing Services, invoke Services from an HTML form, and implement your own Service. Learn how Services communicate and interact during runtime operations using input and output attributes and triggers called Service Event Condition Actions, or SECAs. See best practices for handling errors within a Service and/or SECA. Also discussed are tips on implementing Services in languages other than Java, and a quick introduction to special SECA for incoming e-mail and operations on specific entities.
Chapter 5, The OFBiz Entity Engine: The OFBiz Entity Engine is the magic behind the database agnostic, data-driven tour-de-force that is OFBiz. In this chapter, see how to configure and use the Entity Engine to your advantage. Specifically, see how to change from the default Derby database to another database (note: throughout the OFBiz documentation, the term data source
is used interchangeably with database
); how to connect to remote and multiple databases; how entity groups work to help OFBiz organize access to multiple databases; and disable some system database startup checks, map new database field types, create your own entity definition file and entity definition, modify an existing entity definition—often referred to as the entity's model—and build view-entities that represent SQL join statements.
Chapter 6, OFBiz Security: What book about enterprise software would be complete without a word concerning security? In this chapter, get a quick introduction to securing your OFBiz instance, including recipes to lock down communication ports, disable demonstration accounts, protect web pages and web applications using OFBiz Security Groups, enable support for tarpitting
, retrieve forgotten passwords, change existing passwords, handle SSL certificates, and use OFBiz single sign-on support by way of the external login key
feature.
Chapter 7, WebTools: Often lost in the OFBiz shuffle is a discussion covering basic usage of the many and varied tools that come with the project to manage your OFBiz instance. Collectively called WebTools
, this chapter looks at several important tasks easily accomplished using WebTools, including managing the cache, configuring system and application log tool settings for debug and troubleshooting support; exporting and importing database data; managing localization labels, and accessing databases using the SQL processor tool. Also discussed are introductions to the immensely useful Entity Reference Tool, finding and viewing OFBiz usage statistics, tracing OFBiz artifact dependencies, and working with temporal expressions.
Chapter 8, Web Services: With service orientation at the core of the OFBiz architecture, OFBiz is uniquely qualified to act as both a web services client and service provider for any number of web service interactions. In this chapter, learn how to act as a web services client and request service using URL parameter passing, HttpClient and XML document exchanges, and XML-RPC service requests. If you wish to provide web services, see how to set up OFBiz to serve XML-RPC services, generate and serve WSDL documents, and build both SOAP-based clients and services.
Chapter 9, OFBiz Tips and Tricks: This chapter is a collection of recipes