Hi Miguel, I think your comment "low-code platforms is not to enable citizen developers, but to empower professional developers" is very interesting. It takes away all the magic from Low-Code but it's nearer to reality.I created an unsuccessful No-Code platform (Noobeek) and learn that there are two types of people, final users that want an application ready-to-use and developers that like to write code. Final users with the skills and motivation to create (or even customize) their applications (the citizen developer) are very scarce but exist. Indeed, I have several success stories of my Java-based code platform (OpenXava) where final users have created their own applications (yes, final users learning Java), though this is not the more common case.
Learn OpenXava By 29
Download Zip: https://3bromagatempdo.blogspot.com/?zx=2vEZd9
3 iii About the book This book is meant to teach you how to develop Java Enterprise applications with OpenXava as well as other Java related technologies, tools and frameworks. Together we will develop step by step a complete application from scratch. Why a book about OpenXava? There is already plenty of free documentation available, which is very exhaustive and always up to date. However, some members of the OpenXava community kept asking me for a book, so eventually I was convinced that writing one would be a good idea. The OpenXava documentation describes all syntax and associated semantics of OpenXava precisely. Without a doubt, it's an essential tool, and allows you to learn all the OpenXava secrets. But, if you are a newcomer to the Java Enterprise world, you might need more than reference documentation. You want a lot of code examples as well as a means to learn the other related technologies which are needed to create an advanced application. In this book you'll learn not only about OpenXava, but JPA, Eclipse, PostgreSQL, JUnit, HtmlUnit, Hibernate Validator framework, Liferay, etc. as well. And even more important: you're going to learn techniques to fulfill the common and advanced requirements you will be facing in typical business applications. Don't hesitate to contact me if you have any suggestions about the book at javierpaniza@yahoo.com. A very special thanks to Amitabh Sinha, Franklin J. Alier López de Haro, Hans-Jöerg Bauer, Olle Nilsson, Stephan Rusch and Sudharsanan Selvaraj for their proofreading work.
12 Chapter 1: Architecture & philosophy 2 OpenXava is a framework for rapid development of business applications using Java. It is easy to learn and one can have an application up in no time. At the same time, OpenXava is extensible, customizable and the application code is structured in a very pure object oriented way, allowing you to develop arbitrarily complex applications. The OpenXava approach for rapid development differs from those that use visual environments (like Visual Basic or Delphi) or scripting (like PHP). Instead, OpenXava uses a model-driven development approach, where the core of your application are Java classes that model your problem. This means you can stay productive while still maintaining a high level of encapsulation. This chapter will show you the concepts behind OpenXava as well as an overview of its architecture. 1.1 The OpenXava concepts Though OpenXava takes a very pragmatic approach to development, it is based on the refinement of two well known ideas: The very popular methodology of Model-Driven Development (MDD) and the concept of Business Component. Ideas from MDD are borrowed in a rather lightweight way. The Business Component, however, is at the very heart of OpenXava. Let's look at these concepts in closer detail Lightweight Model-Driven Development Basically, MDD states that only the model of an application needs to be developed, and that the rest is automatically generated. This is illustrated in figure 1.1. Model (UML/DSL) MDD tools Application Code generation Figure 1.1 Model-Driven Development In the context of MDD the model is the means of representing the data and the logic of the application. It can be either a graphical notation, such as UML, or a
18 Application architecture Project layout We have seen the concepts behind OpenXava as well as what it looks like to the end user. But what does OpenXava look like for the developer? Figure 1.8 shows the structure of a typical OpenXava project. Only classes in the model package, the Business Components, are required. This is a bird's-eye view of an OpenXava project. You'll learn more details in the rest of the book. 1.3 Flexibility OX configuration JPA configuration List of modules of this application Labels and messages Figure 1.8 Structure of a typical OpenXava project Classes with logic to perform when user clicks on a link or button Reusable logic to be used from business components (declared there using annotations) Business components: Java classes with metadata Reusable validations to be used from business component (declared there using annotations) Controllers are related to classes of actions package. Only needed if you define custom editors Used by OX to generate the web application You do not need to touch it Model is the only required part. The rest is optional, Good default values are always applied As we have seen, OpenXava takes Java classes, annotated with metadata, and produces a complete application. This includes the automatic generation of the user interface. This might seem too automatic, and that it is quite likely that the resulting user interface will not be rich enough. Especially if your application has very specific requirements. This is not true. OpenXava annotations are flexible enough to generate very powerful user interfaces for most real world problems. Nevertheless, OpenXava provides mechanisms to customize the user interface.
20 Flexibility 10 Business Components, but you always have the option of doing it yourself. 1.4 Summary OpenXava uses a model-driven approach to rapid development, in which you produce a model and obtain a full application from it. The distinguishing feature of OpenXava is that the model consists of a Business Component. The Business Component approach allows you to structure the application around business concepts. In OpenXava a plain annotated Java class defines the Business Component, making application development highly declarative. Apart from business components an OpenXava application has modules, controllers, validators, calculators, etc. that you can optionally use to customize your application. You can even customize the way OpenXava generates the user interface using editors and custom views. OpenXava is a pragmatic solution to Enterprise Java development. It generates a lot of automatic stuff, but it is flexible enough to be useful developing real life business applications. At the end of the day you can develop applications just using simple Java classes with annotations. In the next two chapters, you'll learn more details about the annotations you can use with OpenXava.
23 13 Chapter 2: Java Persistence API Customer entity is saved in the table GSTCST of the database. From now on, JPA will store and retrieve the data between Customer objects in the application and the GSTCST table in the database, as shown in figure 2.1. In OpenXava it is enough to mark Customer annotation to JPA recognize the object as a business component. In fact in OpenXava entity is Figure 2.1 JPA maps classes to tables synonymous to business component Properties The basic state of an entity is represented using properties. Entity properties are plain Java properties, with their respective getter and setter 2 methods (listing 2.2). Listing 2.2 Entity property definition private String name; public String getname() { return name; public void setname(string name) { this.name = name; By default properties are persistent that is, JPA assumes that the property name (listing 2.2) is stored in a column named 'name' in the database table. If you do not want a property to be saved in the database you have to mark it (listing 2.3). Note that we can not only annotate the field, but we can also annotate the getter if we want (listing 2.4). This rule applies to all JPA annotations. You can annotate the field (field-base access) or the getter (property-base access). Do not mix the two styles in the same entity. Listing 2.3 Transient // Marked as transient, it is not stored in the database private String name; public String getname() { return name; 2 To learn more options about properties and fields look at section of JPA 1.0 Specification
25 15 Chapter 2: Java Persistence API (shown as 2). The length is used by the JPA engine for schema generation. It's also used by OpenXava to know the size of the user interface editor. From the Customer entity of listing 2.5 OpenXava generates the user interface you can see in figure 2.2. Now, you know how to define basic properties in your entity. Let's learn how to declare relationships between entities using references and collections References An entity can reference another entity. You only have to define a regular Java reference annotated with JPA annotation, just as in listing 2.6. Listing 2.6 A reference to another public class Invoice // The reference is persisted as a database relationship (1) fetch=fetchtype.lazy, // The reference is loaded on demand (2) optional=false) // The reference must always have a // INVCST is the foreign key column (3) private Customer customer; // A regular Java reference (4) // Getter and setter for customer Figure 2.2 User interface for Customer entity with 2 properties As you can see in listing 2.6 we declare a reference to Customer inside Invoice in a plain Java style (shown as 4). The (shown as 1) is to indicate that this reference is stored as a many-to-one database relationship between the table for Invoice and the table for Customer, using the INVCST (shown as 3) column as foreign key. The (shown as 3) is optional. JPA assumes default values for join column (CUSTOMER_NUMBER in this case). If you use fetch=fetchtype.lazy (shown as 2) the customer data is not loaded until you use it once. That is at the given moment that you use the customer reference, for example if you call the method invoice.getcustomer().getname() the data for the customer is loaded from the database at this point in time. It's advisable to always use lazy fetching. 2ff7e9595c
Comments