Hi Aayush,
Please help yourself: https://ofbiz.apache.org/mailing-lists.html
Jacques
Le 30/05/2021 à 09:17, Aayush Gupta a écrit :
Hello guys
Please unsubscribe from these mails
Thanks
On Sun, 30 May 2021, 12:43 pm , <danwatf...@apache.org> wrote:
This is an automated email from the ASF dual-hosted git repository.
danwatford pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new c654d9b Improved: Convert EntitySyncServices.xml mini-lang to
groovy
c654d9b is described below
commit c654d9bbcc31f2b3ea218914a56a9569c21d0f8d
Author: Daniel Watford <dan...@watfordconsulting.com>
AuthorDate: Sun May 30 08:13:23 2021 +0100
Improved: Convert EntitySyncServices.xml mini-lang to groovy
(OFBIZ-11660)
removed: EntitySyncServices.xml
added: EntitySyncServices.groovy
modified: services.xml to reflect the change from minilang to groovy
for:
- entitySyncPermissionCheck
- resetEntitySyncStatus
modified: webtools/controller.xml to reflect changed request-map and
event type regarding reset of EntitySyncStatus
modified: webtools/widget/EntitySyncForms.xml to reflect changed
target regarding reset of EntitySyncStatus
Thanks: Pierre Smits for implementation
---
.../groovyScripts/EntitySyncServices.groovy | 32
+++++++++++++++++++
.../entityext/minilang/EntitySyncServices.xml | 36
----------------------
framework/entityext/servicedef/services.xml | 8 ++---
.../webapp/webtools/WEB-INF/controller.xml | 4 +--
framework/webtools/widget/EntitySyncForms.xml | 2 +-
5 files changed, 39 insertions(+), 43 deletions(-)
diff --git a/framework/entityext/groovyScripts/EntitySyncServices.groovy
b/framework/entityext/groovyScripts/EntitySyncServices.groovy
new file mode 100644
index 0000000..8acea4e
--- /dev/null
+++ b/framework/entityext/groovyScripts/EntitySyncServices.groovy
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def entitySyncPermissionCheck() {
+ parameters.primaryPermission = "ENTITY_SYNC"
+ Map serviceResult = run service: "genericBasePermissionCheck", with:
parameters
+ return serviceResult
+}
+
+def resetEntitySyncStatus() {
+ entitySyncRecord = from("EntitySync").where("entitySyncId",
parameters.entitySyncId).queryOne()
+ if(entitySyncRecord &&
"ESR_RUNNING".equals(entitySyncRecord.runStatusId)) {
+ entitySyncRecord.runStatusId = "ESR_NOT_STARTED"
+ entitySyncRecord.store()
+ }
+}
diff --git a/framework/entityext/minilang/EntitySyncServices.xml
b/framework/entityext/minilang/EntitySyncServices.xml
deleted file mode 100644
index a134c26..0000000
--- a/framework/entityext/minilang/EntitySyncServices.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method"
xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method
http://ofbiz.apache.org/dtds/simple-methods.xsd">
- <simple-method method-name="resetEntitySyncStatusToNotStarted"
short-description="Update a EntitySync, set the Status to ESR_NOT_STARTED,
but ONLY if running (ie in ESR_RUNNING)">
- <!-- TODO: add some code to make sure, as much as possible, that
this really isn't running -->
- <set field="lookupPKMap.entitySyncId"
from-field="parameters.entitySyncId"/>
- <find-by-primary-key entity-name="EntitySync" map="lookupPKMap"
value-field="valueToStore"/>
- <if-compare field="valueToStore.runStatusId" operator="equals"
value="ESR_RUNNING">
- <set field="valueToStore.runStatusId"
value="ESR_NOT_STARTED"/>
- <store-value value-field="valueToStore"/>
- </if-compare>
- </simple-method>
- <simple-method method-name="entitySyncPermissionCheck"
short-description="Check user permission for entity sync.">
- <set field="primaryPermission" value="ENTITY_SYNC"/>
- <call-simple-method method-name="genericBasePermissionCheck"
xml-resource="component://common/minilang/permission/CommonPermissionServices.xml"/>
- </simple-method>
-</simple-methods>
diff --git a/framework/entityext/servicedef/services.xml
b/framework/entityext/servicedef/services.xml
index 7d0951e..b95fc2d 100644
--- a/framework/entityext/servicedef/services.xml
+++ b/framework/entityext/servicedef/services.xml
@@ -224,8 +224,8 @@ under the License.
location="org.apache.ofbiz.entityext.synchronization.EntitySyncServices"
invoke="cleanSyncRemoveInfo" auth="true" transaction-timeout="600">
<description>Clean EntitySyncRemove Info - Generally should be
run asynchronously after each sync run, or periodically run on a
schedule</description>
</service>
- <service name="resetEntitySyncStatusToNotStarted" engine="simple"
-
location="component://entityext/minilang/EntitySyncServices.xml"
invoke="resetEntitySyncStatusToNotStarted" auth="true"
transaction-timeout="600">
+ <service name="resetEntitySyncStatus" engine="groovy"
+
location="component://entityext/groovyScripts/EntitySyncServices.groovy"
invoke="resetEntitySyncStatus" auth="true" transaction-timeout="600">
<description>Generally run manually to reset the status of an
EntitySync when it has "crashed". Update a EntitySync, set the Status to
ESR_NOT_STARTED, but ONLY if running (ie in ESR_RUNNING)</description>
<permission-service service-name="entitySyncPermissionCheck"
main-action="UPDATE"/>
<attribute name="entitySyncId" type="String" mode="IN"
optional="false"/>
@@ -446,8 +446,8 @@ under the License.
<description>Delete a ServerHitType</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
- <service name="entitySyncPermissionCheck" engine="simple"
-
location="component://entityext/minilang/EntitySyncServices.xml"
invoke="entitySyncPermissionCheck">
+ <service name="entitySyncPermissionCheck" engine="groovy"
+
location="component://entityext/groovyScripts/EntitySyncServices.groovy"
invoke="entitySyncPermissionCheck">
<description>Entity sync permission Checking Logic</description>
<implements service="permissionInterface"/>
</service>
diff --git a/framework/webtools/webapp/webtools/WEB-INF/controller.xml
b/framework/webtools/webapp/webtools/WEB-INF/controller.xml
index 4d39271..0f8bf4b 100644
--- a/framework/webtools/webapp/webtools/WEB-INF/controller.xml
+++ b/framework/webtools/webapp/webtools/WEB-INF/controller.xml
@@ -503,9 +503,9 @@ under the License.
<!-- EntitySync requests -->
<request-map uri="EntitySyncStatus"><security https="true"
auth="true"/><response name="success" type="view"
value="EntitySyncStatus"/></request-map>
- <request-map uri="resetEntitySyncStatusToNotStarted">
+ <request-map uri="resetEntitySyncStatus">
<security https="true" auth="true"/>
- <event type="service" path=""
invoke="resetEntitySyncStatusToNotStarted"/>
+ <event type="service" path="" invoke="resetEntitySyncStatus"/>
<response name="success" type="view" value="EntitySyncStatus"/>
<response name="error" type="view" value="EntitySyncStatus"/>
</request-map>
diff --git a/framework/webtools/widget/EntitySyncForms.xml
b/framework/webtools/widget/EntitySyncForms.xml
index 6dcca48..f78323e 100644
--- a/framework/webtools/widget/EntitySyncForms.xml
+++ b/framework/webtools/widget/EntitySyncForms.xml
@@ -36,7 +36,7 @@ under the License.
</field>
<field use-when=""ESR_RUNNING".equals(runStatusId)"
name="resetStatus" title=" " widget-style="smallSubmit">
- <hyperlink
description="${uiLabelMap.WebtoolsSyncResetRunStatus}"
target="resetEntitySyncStatusToNotStarted" also-hidden="false">
+ <hyperlink
description="${uiLabelMap.WebtoolsSyncResetRunStatus}"
target="resetEntitySyncStatus" also-hidden="false">
<parameter param-name="entitySyncId"/>
</hyperlink>
</field>