Server-side Customization

As mentioned earlier, customization is possible on the server-side by extending BaseModelResourceListener and adding a ModelResourceListener annotation which accepts a modelLevelType and/or customModelName , which are used to match with your ModelFormContainer subclass. This class should reside in the rest package of the module. Example : package com.onenetwork.platformtestmodule.rest . The BaseModelResourceListener class provides several hook points that allow you to pass extra data to the client or write additional models when the user executes an action. Here's a simple example listener whose methods are called for a Model Form page on PTA.Vehicle :

package com.onenetwork.platformtestmodule.rest;
 
/* imports not shown */
 
@ModelResourceListener(modelLevelType="PTA.Vehicle")
public class TestModelResourceListener extends BaseModelResourceListener {
 
private static final PlatformLogger LOG = PlatformLogger.get(TestModelResourceListener.class);
@Override
public void onActionScreenExecuted(String actionName, Long sysId, Model model) {
LOG.info("onActionScreenExecuted(" + actionName + ", " + sysId + ", " + model + ")");
}
@Override
public void beforeActionExecuted(String actionName, JSONObject modelJSON, Model model) {
LOG.info("beforeActionExecuted(" + actionName + ", " + modelJSON + ", " + model + ")");
}
}

See the com.onenetwork.platform.integ.rest.modelpackage in the Javadocs for more information.