Mastering Data Modeling with Liferay Objects

Course Overview

Understanding Liferay Objects

Liferay Objects empowers developers and business users to build and deliver applications without writing code or deploying modules. With it, you can leverage low-code capabilities to model data structures and implement business logic that integrate seamlessly with Liferay's core frameworks. This approach accelerates development, reduces complexity, and enables you to focus on delivering solutions that meet your specific business needs.

Liferay Objects empowers developers and business users to build and deliver applications without writing code or deploying modules.

When working with Liferay Objects, you begin by creating an object definition. You then add fields to store data, define relationships with other objects, and implement validations and business logic. Once configured, you can publish your object definition to activate it within your Liferay instance. Then continue iterating on the definition until it suits your business requirements.

Here, you'll learn about the core concepts and features that make Liferay Objects a robust framework for developing data-driven applications within Liferay DXP. This process begins with exploring object definitions and the core problem they solve.

What are Object Definitions?

Persisting data is essential for any application. Building robust and adaptable applications requires the ability to define the specific types of data you store, from simple text and numbers to more complex structures like dates and relationships. In previous versions of Liferay, implementing custom models for persisting data required creating and deploying OSGi modules. Now, Liferay Objects provides low-code capabilities for defining and managing custom data models in Liferay DXP. This process begins with creating an object definition.

Object definitions are essentially data blueprints. They define the structure and properties of the data stored by your solution. Each definition includes a standard set of system fields along with configuration options for modifying their general details, behavior, data scope, and available features. You can add custom fields for storing different types of data. When published, Liferay creates database tables for storing the definition's entries.

Object definitions define the structure and properties of the data stored by your solution.

While object definitions serve as blueprints for your data, they encompass more than just your data structure. They also include the object’s validations, automations, and other core object capabilities.

Core Object Features

With a foundational understanding of object definitions, it's time to explore the core features that bring your Liferay Objects to life. These features provide the building blocks for structuring data, managing relationships, designing user interfaces, enforcing data integrity, and automating actions within your objects.

Picklists

Object picklists are predefined lists of string values stored as name/key pairs. Once created, you can use a picklist as a single or multiple select field in object definitions. Additionally, picklists can define custom states for governing object entries as they transition through various stages of business processes.

Fields

Fields define database columns for storing different types of values. All objects include default system fields, but you can add custom fields. These fields can receive user input, aggregate numeric values, define custom states, and more.

Relationships

Relationships add fields and tables to object definitions for relating their entries with one another. This provides access to entry data in different application contexts, which you can leverage in a variety of ways.

Layouts and Views

Layouts and views define the default administrative interface for object definitions. This includes a basic form for creating and editing object entries (layouts), as well as the table for displaying existing entries (views). All published object definitions include an auto-generated layout and view, but you can design your own. These features provide a basic, utilitarian UI and are primarily for testing or administrative use cases where user experiences are not priorities.

Validations

Object validations establish rules to determine acceptable field values. When triggered, the validation checks the value against your predefined conditions. If the input is invalid, an error message appears, ensuring that all stored data meets your specified criteria.

Actions

Actions define custom business logic that you can run manually or automatically for object entries. When using automatic triggers, Liferay listens for the specified event and executes according to your predefined conditions. When using standalone triggers, you can manually execute the action via the Liferay UI or using a dedicated headless endpoint.

Object Integrations with Liferay's Core Frameworks

In addition to these rich object features, published objects seamlessly integrate with Liferay’s core frameworks. This enables you to leverage a wider range of Liferay capabilities to build unified and robust experiences across the platform. The following table lists some of the notable framework integrations:

Framework Integration
Asset Use attachment fields to upload files to the document library and link them with object entries.
Audit Track changes to object entries via the Audit application or REST APIs.
Categorization Create vocabularies for custom objects and apply both tags and categories to object entries.
Headless Leverage automatically generated endpoints for custom objects to make REST calls for entries, relationships, and actions.
Info Use object data with page builder features, such as display page templates, fragments, navigation menus, collections, and FreeMarker templates.
Localization Enable localization for text field values to better serve global users.
Permissions Manage application and resource permissions to control access to object definitions and their data.
Search Configure whether custom objects are searchable and determine which fields appear in searches.
User Associated Data Manage user-associated data in object definitions and entries.
Workflow Manage user-associated data in object definitions and entries.

 

You’ll explore and leverage these framework integrations while building Clarity’s business apps.

Liferay Objects vs Traditional OSGi Modules

Traditionally, extending Liferay required creating and deploying custom OSGi modules. These modules are written in Java and can interact with Liferay’s core services. While this method provides a powerful and comprehensive way to extend Liferay’s functionalities, it has notable drawbacks.

  • Specialized Resources: OSGi modules require developers with Liferay expertise to build them safely and properly, which limits the pool of developer resources.

  • Increased Development Time: Since they involve intricate Java development, OSGi modules increase the time for delivering solutions.

  • Higher Risk of Breaking Changes: Since they run within Liferay and can modify its core, OSGi modules are susceptible to breaking changes in Liferay’s APIs as updates are applied to the solution.

  • Deployment Restrictions: Liferay SaaS does not support the deployment of custom OSGi modules; they are only viable for Liferay Self-Hosted and Liferay PaaS deployments.

In contrast, Liferay Objects offer a modern, low-code approach that is more efficient, accessible, and adaptable, empowering both technical and non-technical users to deliver innovative solutions. As such, Liferay Objects is the recommended approach for extending Liferay DXP. Only use OSGi modules if your requirements are not satisfied by Liferay Objects and client extensions.

Conclusion

Now that you’ve learned how Liferay Objects enables low-code development, you’ll explore the Liferay Objects UI.

  • What are Object Definitions?

  • Core Object Features

  • Liferay Objects vs Traditional OSGi Modules

  • Conclusion

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy