Skip to content

Latest commit

 

History

History
141 lines (113 loc) · 9.19 KB

Moqui-Java-Migration.md

File metadata and controls

141 lines (113 loc) · 9.19 KB

Moqui Java Migration Notes

Notes for moving a Moqui Java deployment, or a component written for it, to MR Moqui. This guide covers names and locations. The rest is documented elsewhere:

  • The deliberate redesigns (JavaScript for scripts and templates, SearchFacade, html-print, database cluster coordination and sessions, keys as configuration): the root README.
  • Smaller deliberate differences inside ported features: Parity-Diffs. Features left out on purpose: Parity-Mapping, Excluded on purpose.
  • Converting a component's Groovy to JavaScript (moqui convert --groovy, moqui lint --groovy, hand ports): the Mantle record in ConvertProcess and the Marble one in MarbleERPMigration. Each converted component keeps its own MIGRATION-STATUS.md.
  • The JavaScript API a ported script calls, with what differs from Java's and what is not available: JS-Core-API for ec.* and JS-Globals for the helper classes; the Groovy idioms that do not carry over: JS-XML-Actions.
  • A component's native Rust code, which takes the place of a Gradle build and jars: Native-Components.
  • ./moq in place of the Gradle tasks: the root README.

Component and repository renames

The Java components that MR Moqui has ported were first forked under mr-/Mr names and kept their Java component.xml names. On 2026-10-25 they were renamed and merged so that each repository, its directory under runtime/components/addon, and its component.xml name are the same:

Moqui Java component(s) Fork repositories (until 2026-10-25) MR Moqui component and repository
mantle-udm + mantle-usl mr-mantle-udm + mr-mantle-usl mr-mantle
SimpleScreens + MarbleERP MrSimpleScreens + MrMarbleERP mr-marble
(none; new) ironstone-boss mr-boss (the IronStone BOSS application)

mr-mantle is the renamed mr-mantle-usl repository with mr-mantle-udm merged in. mr-marble is the renamed MrSimpleScreens repository with MrMarbleERP merged in. Both merges keep the commit history of the two repositories (git log --follow works on the merged-in files, whose paths did not change). The two merged-in repositories are retired. On GitHub the renamed repositories redirect from their old names. The framework repository is mr-moqui.

What changes in a component that uses them

  • depends-on: mantle-udm and mantle-usl become one <depends-on name="mr-mantle"/>. SimpleScreens and MarbleERP become <depends-on name="mr-marble"/>.
  • Locations: component://mantle-udm/… and component://mantle-usl/… become component://mr-mantle/…. The two had no paths in common, so the rest of the location is unchanged. component://SimpleScreens/… and component://MarbleERP/… become component://mr-marble/…, as in component://mr-marble/screen/SimpleScreens/Order/FindOrder.xml. This applies wherever a location is written: screen location and extends attributes, subscreens-item, include-screen, widget-template-include, form extends, script and template locations, and data files.
  • Component names in commands and files: ./moq component-get mr-mantle mr-marble mr-boss, ./moq test mr-mantle mr-marble, moqui load components=mr-mantle, a myaddons.xml entry, and the components of a test/client/suite.js server.
  • Test dependencies: a spec that needed mantle-usl and SimpleScreens selected together now needs mr-mantle and mr-marble. One component, mr-mantle, now covers what took two selections before.

What stays the same

These are names inside the components, not component names:

  • Screen paths and mounts. The Simple Screens tree is still screen/SimpleScreens/ with its root SimpleScreens.xml. The test mount is /apps/SimpleScreens. Marble ERP is still /apps/marble and /qapps/marble, and My Account is still /apps/my.
  • Data and security IDs. These include the artifact groups SimpleScreensAccounting, SimpleScreensOrder and the rest, the MarbleErp* records, and the setup file SimpleScreensSetupData.xml (Marble's is now ZmeMarbleErpSetupData.xml, so that it loads after the Simple Screens artifact groups it uses).
  • Entities and services. These are mantle.* entities and services, and the ironstone.* services of mr-boss. The exception is the services of particular external systems, now in service/mantle/ext/: the NACHA, Positive Pay, BAI and OFX services are mantle.ext.account.NachaServices (and PositivePayServices, BaiServices, OfxServices) instead of mantle.account.*, and the Google Maps services are mantle.ext.party.GooglePartyServices instead of mantle.party.GooglePartyServices.
  • Spec names. For example, SimpleScreensRender is still SimpleScreensRender.

Existing databases

Some records hold component locations, so a database loaded before the rename still names the old components. Examples:

  • moqui.security.ArtifactGroupMember.artifactName
  • moqui.screen.ScreenDocument.screenLocation
  • moqui.screen.SubscreensItem.subscreenLocation
  • moqui.basic.email.EmailTemplate screen locations
  • any location your own data stores

On a development or test database, run ./moq clean-db and load again. On a database worth keeping, update the location prefixes with SQL, as in this example:

UPDATE artifact_group_member
   SET artifact_name = regexp_replace(artifact_name, '^component://(SimpleScreens|MarbleERP)/', 'component://mr-marble/')
 WHERE artifact_name ~ '^component://(SimpleScreens|MarbleERP)/';
UPDATE artifact_group_member
   SET artifact_name = regexp_replace(artifact_name, '^component://mantle-u(sl|dm)/', 'component://mr-mantle/')
 WHERE artifact_name ~ '^component://mantle-u(sl|dm)/';

Use the same kind of update for component://ironstone-boss/ to component://mr-boss/, and run it on each table and column that holds a location. Then clear the caches (or restart).

A database moved from Moqui Java also keeps its artifact_hit and artifact_hit_bin tables. They are no longer entities here: OpenTelemetry spans and metrics replace them (Monitoring). The tables are left as they are, unused. Once you no longer need the old rows, and after a backup, drop them:

DROP TABLE IF EXISTS artifact_hit;
DROP TABLE IF EXISTS artifact_hit_bin;

The old clean_ArtifactData_daily and clean_ElasticSearch*Messages_daily job registrations are paused at start; their past runs stay.

Records also name the services moved to mantle.ext.*: moqui.service.message.SystemMessageType.consumeServiceName (the NACHA return, BAI and OFX message types) and moqui.service.job.ServiceJob.serviceName (the NACHA file and Positive Pay jobs). Reload the data that defines them, or update the names with SQL as for locations above, for example regexp_replace(consume_service_name, '^mantle\.account\.(Nacha|PositivePay|Bai|Ofx)Services\.', 'mantle.ext.account.\1Services.').

Schema files

The framework's XSDs, in runtime/components/base/framework/xsd/, are named mr-<name>.xsd with no -3 suffix, so they are not taken for Moqui Java's schemas of the same vocabulary: xml-screen-3.xsd is mr-xml-screen.xsd, moqui-conf-3.xsd is mr-moqui-conf.xsd, and so on for xml-form, xml-actions, common-types, entity-definition, entity-eca, service-definition, service-eca, email-eca and rest-api (git-eca and git-ci are MR Moqui's own). A file's schema URL is http://moqui.org/xsd/mr-xml-screen.xsd, which framework-catalog.xml maps to the local file.

A file that still names http://moqui.org/xsd/xml-screen-3.xsd loads and checks the same: moqui check and the loaders pick the schema by the root element, not by the URL. Only an IDE follows the URL. To rewrite a component's files:

git grep -lzE '[a-z-]+-3\.xsd' | xargs -0 sed -i -E \
  's#(xml-screen|xml-form|xml-actions|common-types|entity-definition|entity-eca|service-definition|service-eca|email-eca|rest-api|moqui-conf)-3\.xsd#mr-\1.xsd#g'

The conf has no repository-list: JCR content repositories are not supported. A repository-list left in a conf file is kept as an unknown element and nothing reads it, so delete it.

Files and the content entities

DbResource, DbResourceFile, DbResourceFileHistory and the git and blob storage entities are in a database of their own (Run-Deploy), so nothing can join them to other entities. A Java component that finds or writes these rows directly, or has a view-entity or type="one" relationship to them, reads and writes the files through ec.resource.getLocationReference(location) instead. The test no_service_screen_or_script_uses_the_content_entities (cargo test -p moqui-entity content_access) names any service, screen or script of the components that still does. Data files may keep their DbResource rows: the data loader writes them to the content database.