Jmix v 1.4.4
I am just beginning to work with the Email Templates add on. It appears as if the add on assumes your entity parameters will always have an ID that is a UUID type. My entities have integer IDs. Also, one of my parameters is an AppSettingsEntity
which always has an integer ID of 1.
The error I receive when I try to preview an email template is:
java.lang.IllegalArgumentException: Invalid UUID string: 1
at java.base/java.util.UUID.fromString1(UUID.java:280)
at java.base/java.util.UUID.fromString(UUID.java:258)
at io.jmix.reports.libintegration.JmixObjectToStringConverter.convertFromString(JmixObjectToStringConverter.java:69)
at io.jmix.emailtemplates.TemplateParametersExtractor.convertFromString(TemplateParametersExtractor.java:192)
at io.jmix.emailtemplatesui.screen.emailtemplate.parameters.EmailTemplateParametersFragment.createComponent(EmailTemplateParametersFragment.java:242)
at io.jmix.emailtemplatesui.screen.emailtemplate.parameters.EmailTemplateParametersFragment.createComponents(EmailTemplateParametersFragment.java:162)
at io.jmix.emailtemplatesui.screen.emailtemplate.send.EmailTemplateSendScreen.onAfterInit(EmailTemplateSendScreen.java:155)
at io.jmix.core.common.event.EventHub.publish(EventHub.java:170)
at io.jmix.ui.screen.Screen.fireEvent(Screen.java:124)
at io.jmix.ui.screen.UiControllerUtils.fireEvent(UiControllerUtils.java:58)
at io.jmix.ui.sys.ScreensImpl.fireScreenAfterInitEvent(ScreensImpl.java:1359)
at io.jmix.ui.sys.ScreensImpl.createScreen(ScreensImpl.java:232)
at io.jmix.ui.sys.ScreensImpl.create(ScreensImpl.java:133)
at io.jmix.emailtemplatesui.screen.emailtemplate.browse.EmailTemplateBrowse.onSendEmailClick(EmailTemplateBrowse.java:119)
This seems to be supported by the code in JmixObjectToStringConverter:
public Object convertFromString(Class parameterClass, @Nullable String paramValueStr) {
if (paramValueStr == null) {
return null;
} else if (String.class.isAssignableFrom(parameterClass)) {
return paramValueStr;
} else if (Entity.class.isAssignableFrom(parameterClass)) {
UUID id = UUID.fromString(paramValueStr);
Optional entityOpt = dataManager.load(parameterClass)
.id(id)
.fetchPlan(FetchPlan.BASE)
.optional();
return entityOpt.isPresent() ? entityOpt.get() : null;
I cannot see any workaround from my end.