Chapter 5. Content Type Separation

The guidelines for structuring, packaging and distributing content types are a specialization of those for general applications. This chapter will only deal with areas that are specific to content types.

5.1. Namespaces

Java

The recommendation for Java package namespaces is to use the domain name of your organization as the base, com.example. There would then follow some project or application specific namespace component, e.g. moneymachine. For content types we further recommend that you add in cms.contenttypes. Domain objects would go in this namespace, and UI components in a subpackage called ui. So the complete namespace hierarchy looks like:

  com
   |
   +- example
       |
       +- moneymachine
           |
           +- cms
               |
               +- contenttypes
                   |
                   +- BankNote.java
                   |
                   +- ui
                       |
                       +- BankNoteProperties.java
                       +- BankNoteForm.java
                       +- BankNoteStep.java

For simple content types, the Java classes can go directly within the top level contenttypes package. When doing this, the file names should be based on the name of the content type, e.g. BankNote.java, BankNoteProperties.java, BankNoteForm.java. For advanced content types which will comprise more than a handful of classes, a dedicated subpackage should be used. e.g.. com.example.moneymachine.cms.contenttypes.banknote and com.example.moneymachine.cms.contenttypes.ui.banknote.

Object Type

It is recommended that the model defined in your object's PDL file be the same as the package defined in your object's Java file. Likewise, the object type name should be the same as the class name. While not required, doing this greatly reduces the chance for confusion.

Java UI

The bare minimum required for an authoring kit is a single step to view and edit the content type's basic properties. For other steps, such as categorization, metadata, links and file attachments, one or more of the existing steps can be used. The classes should go in a ui subpackage of the main content types package.