This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 8ce380f616 Fixed: Mini-lang to Groovy regressions in
PortalPageServices (OFBIZ-13580)
8ce380f616 is described below
commit 8ce380f616765ad1c59c332dbcd6f420067252e4
Author: Mridul Pathak <[email protected]>
AuthorDate: Sun Sep 13 23:46:46 2026 +0530
Fixed: Mini-lang to Groovy regressions in PortalPageServices (OFBIZ-13580)
- createPortalPage: route the service through the existing Groovy
createPortalPage method instead of the generic entity-auto create engine, which
silently dropped name validation, owner assignment, and sequence numbering;
also add back the guard that skips creation entirely when portalPageName is
empty, matching the original minilang.
- movePortletToPortalPage: assign parameters.portalPageId from
parameters.newPortalPageId before checking whether the destination is a system
page needing a copy. Without it the check (and the subsequent portlet creation)
operated on the source page instead of the destination, causing a
duplicate-primary-key crash when moving a portlet.
- movePortletToPortalPage: drop the unnecessary .cache() on the source
PortalPagePortlet lookup, which returned an immutable cached entity that then
crashed when removed later in the same method; the original minilang never
cached this lookup.
- deletePortalPageColumn: guard against a missing PortalPageColumn before
dereferencing it, restoring the null-check the conversion dropped and removing
an NPE risk when the column doesn't exist.
---
framework/common/servicedef/services.xml | 3 ++-
.../org/apache/ofbiz/common/PortalPageServices.groovy | 14 ++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/framework/common/servicedef/services.xml
b/framework/common/servicedef/services.xml
index 698610395d..d23c102779 100644
--- a/framework/common/servicedef/services.xml
+++ b/framework/common/servicedef/services.xml
@@ -667,7 +667,8 @@ under the License.
</service>
<!-- Portal Page services -->
- <service name="createPortalPage" default-entity-name="PortalPage"
engine="entity-auto" auth="true" invoke="create">
+ <service name="createPortalPage" default-entity-name="PortalPage"
engine="groovy" auth="true"
+
location="component://common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy"
invoke="createPortalPage">
<description>Create a new Portal Page</description>
<auto-attributes include="pk" mode="IN" optional="true"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
diff --git
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
index 3383498514..60076f4b56 100644
---
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
+++
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
@@ -34,7 +34,8 @@ Map movePortletToPortalPage() {
if (ServiceUtil.isError(checkIsOwner)) {
return checkIsOwner
}
- GenericValue sourcePortalPagePortlet =
from('PortalPagePortlet').where(parameters).cache().queryOne()
+ GenericValue sourcePortalPagePortlet =
from('PortalPagePortlet').where(parameters).queryOne()
+ parameters.portalPageId = parameters.newPortalPageId
String idOfcopyIfRequiredSystemPage = copyIfRequiredSystemPage()
if (idOfcopyIfRequiredSystemPage) {
GenericValue targetPortalPortlet = makeValue('PortalPagePortlet', [*:
parameters,
@@ -74,10 +75,12 @@ Map deletePortalPageColumn() {
return checkIsOwner
}
GenericValue column = from('PortalPageColumn').where(parameters).queryOne()
- column.getRelated('PortalPagePortlet', null, null, false).each {
- run service: 'deletePortalPagePortlet', with: it.getAllFields()
+ if (column) {
+ column.getRelated('PortalPagePortlet', null, null, false).each {
+ run service: 'deletePortalPagePortlet', with: it.getAllFields()
+ }
+ column.remove()
}
- column.remove()
return success()
}
/**
@@ -156,6 +159,9 @@ Map getPortletAttributes() {
* @return Success response after creation with the portalPageId
*/
Map createPortalPage() {
+ if (!parameters.portalPageName) {
+ return success()
+ }
GenericValue newPortalPage = makeValue('PortalPage', parameters)
newPortalPage.portalPageId = newPortalPage.portalPageId ?:
delegator.getNextSeqId('PortalPage')
newPortalPage.ownerUserLoginId = parameters.userLogin.userLoginId