Skip to content

Migration from Portofino 4 to Portofino 5

Alessio Stalla edited this page Jan 8, 2020 · 6 revisions

Changes in Portofino 5.0

This list details the changes from Portofino 4.2.x to Portofino 5.0. Please refer to the changelog for the changes from Portofino 5.0.1 onwards. In general, on the 5.x development branch, there are no breaking API changes unless otherwise noted in the changelog, and we'll strive to keep those to a minimum.

Breaking

  • removed Stripes
  • removed own dependency injection in favor of Spring
  • reduced Module interface and changed Modules so that they are registered as Spring beans
    • Modules must be Java classes, not Groovy
  • moved dbs/db-schema-changelog.xml to portofino-model/db/schema/liquibase.changelog.xml
  • renamed page.xml to action.xml and <page>...</page> to <action>...</action>
  • renamed Page to ActionDescriptor
  • renamed PageInstance to ActionInstance
  • renamed PageAction to ResourceAction
  • removed @CssClass annotation
  • removed all PageActions (now ResourceActions) except crud, many-to-many and login
  • WEB-INF/pages is now WEB-INF/actions
  • WEB-INF/groovy is now WEB-INF/classes
  • removed @Button in Groovy actions
  • Currently it's no longer possible to edit action.groovy from the UI
  • The UI no longer uses Bootstrap and it is instead based on Angular Material
  • SessionMessages isn't used anymore because it does not work with the REST API. Instead, use RequestMessages which passes messages in a custom HTTP header (which the Angular UI knows about and can show to the user).

Additions

  • GET /api returns the OpenAPI (Swagger) descriptor of the whole application's API (JSON and YAML formats)
  • Authentication with JWT (JSON Web Token)
  • Angular UI client
  • @Operation instead of @Button to declare REST methods to the client
  • Language selector out of the box
  • Configure hidden actions from the administration UI
  • Standalone "Upstairs" app (for the administration of a Portofino application backend)

What stays the same

  • Groovy
  • the model
  • Liquibase (except the changelog file is moved)
  • configuration.xml and permissions in action.xml
  • Access levels and permissions
  • CRUD and many-to-many pages (ported to Angular)
  • the administrative interface, including the wizard (ported to Angular)
  • Security.groovy (but moved)
  • Navigation and breadcrumbs
  • Different page templates & possibility to include your own (although they are Angular templates, of course)

Migration path from Portofino 4 (latest version)

In general, a full migration requires rewriting part of the app.

Brainless migration steps

  • Ensure you're using at least Java 8 and Tomcat 8
  • Copy the model
  • Copy Groovy files from groovy to classes
  • if you have Liquibase changelogs, move dbs/db-schema-changelog.xml to portofino-model/db/schema/liquibase.changelog.xml
  • Copy pages/ to actions/
  • rename page.xml to action.xml and rename the page tag inside it to action

Migrating Groovy classes

  • replace @Inject with @Autowired
    • add @Qualified when more than one bean of that type is available
  • fix renamed packages (e.g. pageactions -> resourceactions)
  • if the class is a module, either rewrite it in Java, or arrange your build so that it compiles such class ahead of time to a Java class

Migrating actions

  • Remove all references to Resolution and other Stripes classes
  • When necessary, reimplement Stripes handler methods as JAX-RS REST methods
  • Replace @Button with @Operation when appropriate

Migrating the view

Porting JSP's to Angular is a fully manual process.