Overview

This document highlights major changes in CUBA Platform and Studio version 6.6.

Platform

Breaking Changes

  1. All Java code is now compiled with UTF-8 encoding (PL-9042). If you have source code files in different encodings, you may get unreadable messages in your application.

  2. Due to the reworked mechanism of exporting properties by application components (PL-9048), there is no need to include cuba-app.properties and cuba-web-app.properties in the application’s lists of property files anymore. When migration is done by Studio, it automatically removes these entries from your web.xml files. Otherwise, remove them manually.

  3. Previously, if an external authentication (LDAP or SSO) was on, a user could bypass it if he or she had a valid password set in the application security subsystem. Now it is possible only if the user’s login is also listed in the cuba.web.standardAuthenticationUsers application property (PL-9314).

  4. Previously, scripts of security constraints of CREATE, UPDATE and DELETE types that are checked on the middleware accepted a copied instance before the merge() operation for safety. Now they accept a managed instance of the entity to be able to traverse the whole object graph (PL-9150). Be careful not to modify the instance in constraint scripts, otherwise the changes will be saved to the database.

  5. Settings of a visual component are saved only if the component’s id is set (PL-9167).

  6. ExcludeAction now unlinks entities with many-to-many relation (PL-7515).

  7. CollectionDatasource.sort() always triggers the sorting even if the sortInfos array is the same as before (PL-9273).

  8. Removed question marks for the description component’s property in Havana theme (PL-7118). The description property is now always shown as a tooltip on mouse hover.

  9. Grid.focusCell() method now has default access level. New public Grid.focusBodyCell() method has been added (PL-9305).

Deployment

Single Uber JAR

The buildUberJar Gradle task can now be configured to build a single all-in-one JAR file including all application blocks.

All you have to do is to set to true the singleJar parameter (it is false by default to preserve existing configurations), for example:

task buildUberJar(type: CubaUberJarBuilding) {
    singleJar = true
    coreJettyEnvPath = 'modules/core/web/META-INF/jetty-env.xml'
    appProperties = ['cuba.automaticDatabaseUpdate' : true]
}

After building, you can run your application with a single command:

java -jar app.jar

See the documentation on how to provide different options when building and running your application.

Polymer UI in Single WAR

If your project contains Polymer UI and you use single WAR deployment, the UI will be available at <app-name>/front URL, for example:

http://localhost:8080/app/front

Health Check URL

Every application block deployed as a web application provides a health check URL, for example http://localhost:8080/app/rest/health. An HTTP GET request of this URL returns ok if the block is ready to work. See details in the documentation.

Generic UI

One-to-One Composition

A one-to-one relationship can now be marked as @Composition. In this case, the standard OpenAction and ClearAction of the PickerField component provide the ability to create and edit the referenced entity with saving it only together with the master entity. See an example in the documentation.

Image Component

The new Image component greatly simplifies displaying of images from different sources:

  • from an entity attribute of FileDescriptor or byte array types

  • from a classpath resource

  • from a file

  • from an input stream

  • from a theme resource

  • from a URL

The component can also be bound to a datasource and configured declaratively.

Actions API

BaseAction (and all its subclasses) can be configured via a fluent interface and receive a handler as a lambda expression, for example:

pickerField.addAction(new BaseAction("hello")
        .withCaption(null)
        .withDescription("some description"))
        .withIcon("icons/hello.png")
        .withHandler(e -> showNotification("Hello", NotificationType.TRAY)));

The standard collection actions: CreateAction, EditAction, AddAction and RefreshAction now have set{XYZ}ParamsSupplier() methods that allow you to compute provided parameter values right before the action is executed. For example:

action.setWindowParamsSupplier(() -> ParamsMap.of("customer", getItem()));

Previously it could be achieved only by extending the action class and overriding its get{XYZ}Params() methods.

Miscellaneous

REST API Custom Authentication

You can implement additional authentication mechanisms for REST API, e.g. login-by-link, social login (Facebook, Twitter, etc.) or LDAP. It can be done using the new REST API component: OAuthTokenIssuer.

The process is as follows:

  • Implement custom Spring MVC controller that performs custom authentication.

  • Register this controller in REST API Spring context using a custom Spring XML file and cuba.restSpringContextConfig application property.

  • If a user is authenticated, the controller creates OAuth2 Access token using the OAuthTokenIssuer bean.

  • Created OAuth2 token is returned to the user.

  • After that, the REST API client can use the OAuth2 token as usual passing it to REST API.

See details in the documentation.

JMX Asynchronous Execution

The @JmxRunAsync annotation allows you to denote long JMX operations. When such operation is launched using the built-in JMX console, the application displays a special dialog and a user can close it and continue to work with the application by pressing Cancel or if the operation has timed out. See details in the documentation.

User Session Log

It’s a new platform feature that allows administrators to track user sessions, particularly the login, logout and user substitution events. The log is available on the Administration > User Session Log screen.

Build Info

The buildInfo task is automatically added to your global module configuration by the CUBA Gradle plugin. It writes the build-info.properties file with the information about your application into the global artifact. This information is read by the BuildInfo bean at runtime and is displayed on the Help > About window.

Reporting

If the reporting.useBackgroundReportProcessing application property is set to true and reports are executed in a background thread, they can be aborted if the user clicks Cancel button or by a timeout. When a report is cancelled or timed out, the execution is aborted both on the middleware and in the database. See documentation for details.

Updated Dependencies

Java libraries:

ch.qos.logback/logback-classic = 1.2.3
com.fasterxml.jackson = 2.8.8.1
com.fasterxml.jackson.dataformat/jackson-dataformat-yaml = 2.8.8
com.google.code.findbugs/jsr305 = 3.0.2
com.vaadin = 7.7.10.cuba.0
commons-collections/commons-collections = 3.2.2
mysql/mysql-connector-java = 5.1.41
org.apache.commons/commons-compress = 1.13
org.apache.tomcat/tomcat-servlet-api = 8.0.43
org.codehaus.groovy/groovy-all = 2.4.10
org.hibernate/hibernate-validator = 5.4.1.Final
org.slf4j/log4j-over-slf4j = 1.7.25
org.springframework = 4.3.8.RELEASE
org.springframework.ldap/spring-ldap-core = 2.3.1.RELEASE
org.springframework.security = 4.2.2.RELEASE
org.springframework.security.oauth/spring-security-oauth2 = 2.1.0.RELEASE
org.thymeleaf = 3.0.5.RELEASE
org.thymeleaf.extras/thymeleaf-extras-springsecurity4 = 3.0.2.RELEASE
tomcat = 8.5.14

JavaScript libraries:

node.js = 8.1.2
npm = 5.0.3

Studio

Breaking Changes

  1. Hot deploy mapping settings has been moved to project settings located in studio-settings.xml (STUDIO-3605). It means that they are now shared between all developers working on the project, provided that studio-settings.xml is under a version control system. The hot deploy on/off flag has been kept in the user settings.

  2. Due to changes in STUDIO-3680 for HSQL database, Studio may generate database update scripts to map Date attributes to date SQL type and Time attributes to time SQL type. These scripts will erase data in the changed columns, so you may want to avoid them. Just change the entity attributes to DateTime type and Studio will not generate any updates.

Repository Configuration

The artifact repository is now configured on per-project level. The Repository field has been moved from the Studio server window to the Project properties page:

repository 1

You can select from two default repositories or add your own after setting it up as described in the documentation. This repository will be scanned by Studio to discover available platform versions. Your build.gradle file can also contain any number of other repositories containing application components if needed.

Modules Management

You can easily remove an optional module from your project:

modules 1

REST API Services and Queries

Studio now contains UI for configuring REST API queries and service methods.

In order to create a named REST query, select an entity and click New > REST query. After that, define the query as on the example below:

rest query 1

Service methods can be exposed through the REST API on the REST Methods tab of the service designer:

rest service 1

Pages History

The Ctrl+Shift+H shortcut opens a dialog that contains the list of pages recently opened in Studio. It allows you to go to these pages again without looking them up in the left panel or in Search dialog:

pages history 1

Browser and Editor Template

Now you can create standard browser and editor screens by selecting a single template:

browser and editor 1

Frame Template

We have added a simple template for creating blank frames:

frame 1

Mapping Database Views

Now database views can be mapped to entities when generating model from an existing database. The only restriction is that the view must contain a column or a set of columns suitable for the entity identifier.

Views are shown together with tables in the same list. If you select a view for mapping, on the next screen its status will be Choose primary key for DB view. Click the Choose PK button at the bottom and select columns for the primary key:

view 1

Table DDL Generation

You can explicitly turn off generation of create/update scripts for a table in the entity designer:

generate ddl 1

By default, the generation is enabled if the table has a prefix equal to the project namespace or if it has an arbitrary name but mapped by the model generator (has the @DesignSupport("{'imported':true}") annotation).

Column DDL

The Column definition field in the entity designer allows you to specify a custom definition for the column type, for example:

column definition 1

If the field is not empty, Studio will insert its value as is into the column’s DDL right after the column name.

Test Infrastructure

If you create a new project based on the platform 6.6+, Studio will generate the integration test infrastructure in its core module. See created classes in the modules/core/test folder. You can run the tests from the IDE or from the command line (provided that you have created the Gradle wrapper):

gradlew test
. . .