You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2016/01/29 13:52:34 UTC

svn commit: r1727570 - in /ofbiz/trunk/framework: common/data/ service/data/ service/entitydef/ service/servicedef/ service/src/org/ofbiz/service/job/ webtools/config/ webtools/data/ webtools/webapp/webtools/ webtools/webapp/webtools/WEB-INF/ webtools/...

Author: nmalin
Date: Fri Jan 29 12:52:34 2016
New Revision: 1727570

URL: http://svn.apache.org/viewvc?rev=1727570&view=rev
Log:
Add the possibility to set a blackout period for job manager service. During this time all async and scheduled service are put on hold.
This improvement add a entity JobManagerLock, a new screen to add/edit job manager lock and an information for end user on FindJob and ScheduleJob screen.
See more information on issue OFBIZ-6790. Thanks to Jacques for sharing on this improvement.

Modified:
    ofbiz/trunk/framework/common/data/CommonTypeData.xml
    ofbiz/trunk/framework/service/data/ServiceSeedData.xml
    ofbiz/trunk/framework/service/entitydef/entitymodel.xml
    ofbiz/trunk/framework/service/servicedef/services.xml
    ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
    ofbiz/trunk/framework/webtools/data/WebtoolsSecurityGroupDemoData.xml
    ofbiz/trunk/framework/webtools/data/WebtoolsSecurityPermissionSeedData.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
    ofbiz/trunk/framework/webtools/webapp/webtools/main.ftl
    ofbiz/trunk/framework/webtools/widget/CommonScreens.xml
    ofbiz/trunk/framework/webtools/widget/Menus.xml
    ofbiz/trunk/framework/webtools/widget/ServiceForms.xml
    ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml

Modified: ofbiz/trunk/framework/common/data/CommonTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/CommonTypeData.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/data/CommonTypeData.xml (original)
+++ ofbiz/trunk/framework/common/data/CommonTypeData.xml Fri Jan 29 12:52:34 2016
@@ -138,4 +138,8 @@ under the License.
     <StatusValidChange statusId="KW_PENDING" statusIdTo="KW_APPROVED" transitionName="Review Approved"/>
     <StatusValidChange statusId="KW_PENDING" statusIdTo="KW_DISAPPROVED" transitionName="Review Disapproved"/>
 
+    <!-- OFBiz Instance -->
+    <EnumerationType enumTypeId="JM_OFBIZ_INSTANCE" hasTable="N" description="OFBiz Instance"/>
+    <Enumeration enumId="JM_OFBIZ_INS_0" enumTypeId="JM_OFBIZ_INSTANCE" enumCode="_NA_" sequenceId="00" description="ALL instance"/>
+    <Enumeration enumId="JM_OFBIZ_INS_1" enumTypeId="JM_OFBIZ_INSTANCE" enumCode="ofbiz1" sequenceId="01" description="OFBiz instance 1"/>
 </entity-engine-xml>

Modified: ofbiz/trunk/framework/service/data/ServiceSeedData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/data/ServiceSeedData.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/data/ServiceSeedData.xml (original)
+++ ofbiz/trunk/framework/service/data/ServiceSeedData.xml Fri Jan 29 12:52:34 2016
@@ -198,4 +198,10 @@ under the License.
         [9] Integer: 0 to 59
     -->
 
+    <!-- JobSandbox lock reason Enum -->
+    <EnumerationType enumTypeId="JS_LOCK_REASON" hasTable="N" description="JobSandbox lock reason"/>
+    <Enumeration enumId="JS_LOCK_REASON_0" enumTypeId="JS_LOCK_REASON" enumCode="0" sequenceId="00" description="Instance updating"/>
+    <Enumeration enumId="JS_LOCK_REASON_1" enumTypeId="JS_LOCK_REASON" enumCode="1" sequenceId="01" description="Instance surcharge"/>
+    <Enumeration enumId="JS_LOCK_REASON_2" enumTypeId="JS_LOCK_REASON" enumCode="2" sequenceId="02" description="Instance maintenance"/>
+
 </entity-engine-xml>

Modified: ofbiz/trunk/framework/service/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/entitydef/entitymodel.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/service/entitydef/entitymodel.xml Fri Jan 29 12:52:34 2016
@@ -186,6 +186,23 @@ under the License.
       </view-link>
     </view-entity>
 
+    <entity entity-name="JobManagerLock" package-name="org.ofbiz.service.schedule" title="Lock Job Manager Scheduler">
+        <field name="instanceId" type="id"/>
+        <field name="fromDate" type="date-time"/>
+        <field name="thruDate" type="date-time"/>
+        <field name="reasonEnumId" type="id"/>
+        <field name="comments" type="comment"/>
+        <field name="createdDate" type="date-time"/>
+        <field name="createdByUserLogin" type="id-vlong"/>
+        <field name="lastModifiedDate" type="date-time"/>
+        <field name="lastModifiedByUserLogin" type="id-vlong"/>
+        <prim-key field="instanceId"/>
+        <prim-key field="fromDate"/>
+        <relation type="one" fk-name="JOBLK_ENUM_REAS" rel-entity-name="Enumeration" title="Reason">
+            <key-map field-name="reasonEnumId" rel-field-name="enumId"/>
+        </relation>
+    </entity>
+
   <!-- ========================================================= -->
   <!-- org.ofbiz.service.semaphore -->
   <!-- ========================================================= -->

Modified: ofbiz/trunk/framework/service/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/servicedef/services.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/service/servicedef/services.xml Fri Jan 29 12:52:34 2016
@@ -128,4 +128,20 @@ under the License.
         <attribute name="fromDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
         <attribute name="thruDate" mode="IN" type="java.sql.Timestamp" optional="true"/>
     </service>
+
+    <!-- JobManagerLock Services -->
+    <service name="createJobManagerLock" default-entity-name="JobManagerLock" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a Job Manager Lock</description>
+        <permission-service service-name="commonGenericPermission" main-action="CREATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+
+    <service name="updateJobManagerLock" default-entity-name="JobManagerLock" engine="entity-auto" invoke="update" auth="true">
+        <description>Cancel a Job Sandbox Lock</description>
+        <permission-service service-name="commonGenericPermission" main-action="UPDATE"/>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
+
 </services>

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Fri Jan 29 12:52:34 2016
@@ -40,6 +40,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityJoinOperator;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.serialize.SerializeException;
 import org.ofbiz.entity.serialize.XmlSerializer;
@@ -135,6 +136,28 @@ public final class JobManager {
         return JobPoller.getInstance().getPoolState();
     }
 
+    /**
+     * Return true if the jobManager can run job.
+     * 
+     * @return boolean.
+     */
+    public boolean isAvailable() {
+        try {
+            //check if a lock is enable for the period on entity JobManagerLock
+            EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(
+                    EntityCondition.makeConditionDate("fromDate", "thruDate"),
+                    EntityCondition.makeCondition(UtilMisc.toList(
+                            EntityCondition.makeCondition("instanceId", instanceId),
+                            EntityCondition.makeCondition("instanceId", "_NA_"))
+                            , EntityJoinOperator.OR)
+                    ), EntityJoinOperator.AND);
+            return delegator.findCountByCondition("JobManagerLock", condition, null, null) == 0;
+        } catch (GenericEntityException e) {
+            Debug.logWarning(e, "Exception thrown while check lock on JobManager : " + instanceId, module);
+            return false;
+        }
+    }
+
     private static List<String> getRunPools() throws GenericConfigException {
         List<RunFromPool> runFromPools = ServiceConfigUtil.getServiceEngine().getThreadPool().getRunFromPools();
         List<String> readPools = new ArrayList<String>(runFromPools.size());

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java Fri Jan 29 12:52:34 2016
@@ -220,6 +220,10 @@ public final class JobPoller implements
                         Collection<JobManager> jmCollection = jobManagers.values();
                         List<Iterator<Job>> pollResults = new ArrayList<Iterator<Job>>();
                         for (JobManager jm : jmCollection) {
+                            if (!jm.isAvailable()) {
+                                if (Debug.infoOn()) Debug.logInfo("The job manager is locked.", module);
+                                continue;
+                            }
                             jm.reloadCrashedJobs();
                             pollResults.add(jm.poll(remainingCapacity).iterator());
                         }

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.xml Fri Jan 29 12:52:34 2016
@@ -679,6 +679,10 @@
         <value xml:lang="zh">运行服务</value>
         <value xml:lang="zh-TW">執行服務</value>
     </property>
+    <property key="PageTitleJobManagerLockList">
+        <value xml:lang="en">Job manager locks list</value>
+        <value xml:lang="fr">Blocage du gestionnaire de service</value>
+    </property>
     <property key="PageTitleScheduleJob">
         <value xml:lang="de">Job anlegen</value>
         <value xml:lang="en">Schedule Job</value>
@@ -1399,6 +1403,10 @@
         <value xml:lang="zh">创建/删除主键</value>
         <value xml:lang="zh-TW">新建/刪除主鍵</value>
     </property>
+    <property key="WebtoolsCurrentJobManagerLock">
+        <value xml:lang="en">Current job manager locks</value>
+        <value xml:lang="fr">Blocages actuels du gestionnaire de service</value>
+    </property>
     <property key="WebtoolsDaemon">
         <value xml:lang="de">Daemon</value>
         <value xml:lang="en">Daemon</value>
@@ -2878,6 +2886,10 @@
         <value xml:lang="zh">日志文件</value>
         <value xml:lang="zh-TW">日誌檔</value>
     </property>
+    <property key="WebtoolsJobManagerLockEnable">
+        <value xml:lang="en">Job manager locks enabled</value>
+        <value xml:lang="fr">Blocages actifs sur le gestionnaire de service</value>
+    </property>
     <property key="WebtoolsLHSMapName">
         <value xml:lang="de">Name der LHS-Map</value>
         <value xml:lang="en">LHS map name</value>
@@ -3668,6 +3680,10 @@
         <value xml:lang="zh">名称或角色</value>
         <value xml:lang="zh-TW">名稱或角色</value>
     </property>
+    <property key="WebtoolsNextJobManagerLock">
+        <value xml:lang="en">Next job manager locks</value>
+        <value xml:lang="fr">Prochains blocages du gestionnaire de service</value>
+    </property>
     <property key="WebtoolsNoEntitiesRead">
         <value xml:lang="de">Keine Entität eingelesen</value>
         <value xml:lang="en">No entities read</value>
@@ -4691,6 +4707,10 @@
         <value xml:lang="zh">选择执行程序</value>
         <value xml:lang="zh-TW">選擇執行程式</value>
     </property>
+    <property key="WebtoolsJobManagerLockList">
+        <value xml:lang="en">Job manager locks List</value>
+        <value xml:lang="fr">Liste des blocages du gest. service</value>
+    </property>
     <property key="WebtoolsServerHitStatisticsTools">
         <value xml:lang="de">Statistik-Tools für Server-Besuche</value>
         <value xml:lang="en">Server Hit Statistics Tools</value>

Modified: ofbiz/trunk/framework/webtools/data/WebtoolsSecurityGroupDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/data/WebtoolsSecurityGroupDemoData.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/data/WebtoolsSecurityGroupDemoData.xml (original)
+++ ofbiz/trunk/framework/webtools/data/WebtoolsSecurityGroupDemoData.xml Fri Jan 29 12:52:34 2016
@@ -44,7 +44,9 @@ under the License.
 
     <!-- Service Maintenance security -->
     <SecurityGroupPermission groupId="FULLADMIN" permissionId="SERVICE_MAINT"/>
+    <SecurityGroupPermission groupId="FULLADMIN" permissionId="SERVICE_JM_LOCK"/>
     <SecurityGroupPermission groupId="FLEXADMIN" permissionId="SERVICE_MAINT"/>
+    <SecurityGroupPermission groupId="FLEXADMIN" permissionId="SERVICE_JM_LOCK"/>
 
     <!-- Period Maintenance security -->
     <SecurityGroupPermission groupId="FULLADMIN" permissionId="PERIOD_MAINT"/>

Modified: ofbiz/trunk/framework/webtools/data/WebtoolsSecurityPermissionSeedData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/data/WebtoolsSecurityPermissionSeedData.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/data/WebtoolsSecurityPermissionSeedData.xml (original)
+++ ofbiz/trunk/framework/webtools/data/WebtoolsSecurityPermissionSeedData.xml Fri Jan 29 12:52:34 2016
@@ -35,6 +35,7 @@ under the License.
 
     <!-- Service Maintenance security -->
     <SecurityPermission description="Use the Service Maintenance pages." permissionId="SERVICE_MAINT"/>
+    <SecurityPermission description="Edit the job manager lock on the Service Maintenance pages." permissionId="SERVICE_JM_LOCK"/>
 
     <!-- Period Maintenance security -->
     <SecurityPermission description="Use the Period Maintenance pages." permissionId="PERIOD_MAINT"/>
@@ -64,6 +65,7 @@ under the License.
     <SecurityGroupPermission groupId="SUPER" permissionId="DATAFILE_MAINT"/>
     <SecurityGroupPermission groupId="SUPER" permissionId="DATAFILE_MAINT"/>
     <SecurityGroupPermission groupId="SUPER" permissionId="SERVICE_MAINT"/>
+    <SecurityGroupPermission groupId="SUPER" permissionId="SERVICE_JM_LOCK"/>
     <SecurityGroupPermission groupId="SUPER" permissionId="PERIOD_MAINT"/>
     <SecurityGroupPermission groupId="SUPER" permissionId="ENUM_STATUS_MAINT"/>
     <SecurityGroupPermission groupId="SUPER" permissionId="ENTITY_MAINT"/>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Fri Jan 29 12:52:34 2016
@@ -327,6 +327,20 @@ under the License.
         <response name="success" type="view" value="runService"/>
         <response name="error" type="view" value="error"/>
     </request-map>
+    <request-map uri="AddJobManagerLock"><security https="true" auth="true"/><response name="success" type="view" value="AddJobManagerLock"/></request-map>
+    <request-map uri="FindJobManagerLock"><security https="true" auth="true"/><response name="success" type="view" save-current-view="false" value="FindJobManagerLock"/></request-map>
+    <request-map uri="createJobManagerLock">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="createJobManagerLock"/>
+        <response name="success" type="request" value="json"/>
+        <response name="error" type="request" value="json"/>
+    </request-map>
+    <request-map uri="updateJobManagerLock">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updateJobManagerLock"/>
+        <response name="success" type="view" value="FindJobManagerLock"/>
+        <response name="error" type="view" value="FindJobManagerLock"/>
+    </request-map>
 
     <!-- Available services requests -->
     <request-map uri="serviceEcaDetail">
@@ -648,6 +662,8 @@ under the License.
     <view-map name="setServiceParameters" type="screen" page="component://webtools/widget/ServiceScreens.xml#setServiceParameters"/>
     <view-map name="setSyncServiceParameters" type="screen" page="component://webtools/widget/ServiceScreens.xml#setSyncServiceParameters"/>
     <view-map name="serviceEcaDetail" type="screen" page="component://webtools/widget/AvailableServicesScreens.xml#ServiceEcaDetail"/>
+    <view-map name="AddJobManagerLock" type="screen" page="component://webtools/widget/ServiceScreens.xml#AddJobManagerLock"/>
+    <view-map name="FindJobManagerLock" type="screen" page="component://webtools/widget/ServiceScreens.xml#FindJobManagerLock"/>
 
     <view-map name="printStart" type="screen" page="component://webtools/widget/CommonScreens.xml#printStart"/>
     <view-map name="printDone" type="screen" page="component://webtools/widget/CommonScreens.xml#printDone"/>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/main.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/main.ftl?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/main.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/main.ftl Fri Jan 29 12:52:34 2016
@@ -88,6 +88,7 @@ under the License.
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.PageTitleRunService}</a></li>
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.PageTitleJobList}</a></li>
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.PageTitleThreadList}</a></li>
+          <li><a href="<@o...@ofbizUrl>">${uiLabelMap.PageTitleJobManagerLockList}</a></li>
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.WebtoolsServiceLog}</a></li>
         </#if>
         <#if security.hasPermission("DATAFILE_MAINT", session)>

Modified: ofbiz/trunk/framework/webtools/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/CommonScreens.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/CommonScreens.xml Fri Jan 29 12:52:34 2016
@@ -108,6 +108,20 @@ under the License.
         </section>
     </screen>
 
+    <screen name="PopUpDecorator">
+        <section>
+            <actions>
+                <property-map resource="TemporalExpressionUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="SecurityUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+            </actions>
+            <widgets>
+                <include-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml"/>
+            </widgets>
+        </section>
+    </screen>
+
     <screen name="CommonEntityDecorator">
         <section>
             <actions>

Modified: ofbiz/trunk/framework/webtools/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/Menus.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/Menus.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/Menus.xml Fri Jan 29 12:52:34 2016
@@ -111,6 +111,9 @@ under the License.
         <menu-item name="threadList" title="${uiLabelMap.WebtoolsThreadList}">
             <link target="threadList"/>
         </menu-item>
+        <menu-item name="FindJobManagerLock" title="${uiLabelMap.WebtoolsJobManagerLockList}">
+            <link target="FindJobManagerLock"/>
+        </menu-item>
         <menu-item name="scheduleJob" title="${uiLabelMap.WebtoolsScheduleJob}">
             <link target="scheduleJob"/>
         </menu-item>

Modified: ofbiz/trunk/framework/webtools/widget/ServiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceForms.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/ServiceForms.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/ServiceForms.xml Fri Jan 29 12:52:34 2016
@@ -138,4 +138,92 @@ under the License.
         <field name="startTime" title="${uiLabelMap.CommonStartDateTime}" sort-field="true"><display/></field>
         <field name="endTime" title="${uiLabelMap.CommonEndDateTime}" sort-field="true"><display default-value="${uiLabelMap.WebtoolsStatusRunning}"/></field>
     </form>
+    <form name="FindJobManagerLock" type="single" target="FindJobManagerLock" default-entity-name="JobManagerLock">
+        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
+        <field name="instanceId">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="Enumeration" key-field-name="enumCode" description="${enumCode} - ${description}">
+                   <entity-constraint name="enumTypeId" value="JM_OFBIZ_INSTANCE"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="fromDate"><date-find/></field>
+        <field name="thruDate"><date-find/></field>
+        <field name="reasonEnumId" title="${uiLabelMap.CommonReason}">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="Enumeration" key-field-name="enumId" description="[${enumCode}] - ${description}">
+                   <entity-constraint name="enumTypeId" value="JS_LOCK_REASON"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="searchButton"><submit/></field>
+    </form>
+    <form name="ListJobManagerLock" type="list" list-name="listIt" paginate-target="FindJobManagerLock" default-entity-name="JobManagerLock" separate-columns="true"
+        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+        <actions>
+            <service service-name="performFind" result-map="result" result-map-list="listIt">
+                <field-map field-name="inputFields" from-field="parameters"/>
+                <field-map field-name="entityName" value="JobManagerLock"/>
+                <field-map field-name="orderBy" from-field="parameters.sortField"/>
+            </service>
+        </actions>
+        <row-actions>
+            <set field="editable" value="${groovy: security.hasPermission('SERVICE_JM_LOCK', userLogin) }" type="Boolean"/>
+            <set field="cancelable" value="${groovy: thruDate == null || thruDate.compareTo(nowTimestamp) > 0}" type="Boolean"/>
+        </row-actions>
+        <field name="instanceId" sort-field="true"><display/></field>
+        <field name="fromDate" sort-field="true"><display/></field>
+        <field name="thruDate" sort-field="true"><display/></field>
+        <field name="createdDate" sort-field="true"><display/></field>
+        <field name="createdByUserLogin" sort-field="true"><display/></field>
+        <field name="reasonEnumId" sort-field="true" title="${uiLabelMap.CommonReason}"><display-entity entity-name="Enumeration" key-field-name="enumId" description="[${enumCode}] ${description}"/></field>
+        <field name="comments"><display/></field>
+        <field name="cancelButton" title=" " use-when="editable &amp;&amp; cancelable" widget-style="buttontext">
+            <hyperlink also-hidden="false" description="${uiLabelMap.CommonCancel}" target="updateJobManagerLock">
+                <parameter param-name="instanceId"/>
+                <parameter param-name="fromDate"/>
+                <parameter param-name="thruDate" value="${nowTimestamp}"/>
+            </hyperlink>
+        </field>
+    </form>
+    <form name="AddJobManagerLock" type="single" target="createJobManagerLock" default-entity-name="JobManagerLock">
+        <field name="instanceId">
+            <drop-down>
+                <entity-options entity-name="Enumeration" key-field-name="enumCode" description="${enumCode} - ${description}">
+                   <entity-constraint name="enumTypeId" value="JM_OFBIZ_INSTANCE"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="fromDate"><date-time/></field>
+        <field name="thruDate"><date-time/></field>
+        <field name="reasonEnumId" title="${uiLabelMap.CommonReason}">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="Enumeration" key-field-name="enumId" description="[${enumCode}] - ${description}">
+                   <entity-constraint name="enumTypeId" value="JS_LOCK_REASON"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="comments"><text/></field>
+        <field name="addButton"><submit/></field>
+        <on-event-update-area area-target="FindJobManagerLock" event-type="submit" area-id="window"/>
+    </form>
+    <grid name="JobManagerLockEnable" list-name="jobManagerLocks"
+          odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
+        <row-actions>
+            <set field="editable" value="${groovy: security.hasPermission('SERVICE_JM_LOCK', userLogin) }" type="Boolean"/>
+            <set field="cancelable" value="${groovy: thruDate == null || thruDate.compareTo(nowTimestamp) > 0}" type="Boolean"/>
+        </row-actions>
+        <field name="instanceId"><display/></field>
+        <field name="fromDate" title="${uiLabelMap.CommonFrom}" red-when="never"><display type="date-time"/></field>
+        <field name="thruDate" title="${uiLabelMap.CommonThru}" red-when="never"><display type="date-time"/></field>
+        <field name="createdByUserLogin" title="${uiLabelMap.CommonBy}"><display/></field>
+        <field name="reasonEnumId" title="${uiLabelMap.CommonReason}"><display-entity entity-name="Enumeration" key-field-name="enumId" description="[${enumCode}] ${description}"/></field>
+        <field name="cancelButton" title=" " use-when="editable &amp;&amp; cancelable" widget-style="buttontext">
+            <hyperlink also-hidden="false" description="${uiLabelMap.CommonCancel}" target="updateJobManagerLock">
+                <parameter param-name="instanceId"/>
+                <parameter param-name="fromDate"/>
+                <parameter param-name="thruDate" value="${nowTimestamp}"/>
+            </hyperlink>
+        </field>
+    </grid>
 </forms>

Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=1727570&r1=1727569&r2=1727570&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Fri Jan 29 12:52:34 2016
@@ -55,6 +55,7 @@ under the License.
             <widgets>
                 <decorator-screen name="CommonServiceDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
+                        <include-screen name="JobManagerLockEnable"/>
                         <section>
                             <widgets>
                                 <platform-specific><html><html-template location="component://common/webcommon/includes/ServerHour24HourFormatJs.ftl"/></html></platform-specific>
@@ -130,6 +131,7 @@ under the License.
             <widgets>
                 <decorator-screen name="CommonServiceDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
+                        <include-screen name="JobManagerLockEnable"/>
                         <screenlet title="${uiLabelMap.WebtoolsStep1ServiceAndRecurrenceInfo}">
                             <include-form name="scheduleJob" location="component://webtools/widget/ServiceForms.xml"/>
                         </screenlet>
@@ -220,4 +222,107 @@ under the License.
             </widgets>
         </section>
     </screen>
+
+    <screen name="FindJobManagerLock">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleJobManagerLockList"/>
+                <set field="tabButtonItem" value="FindJobManagerLock"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonServiceDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container style="page-title"><label text="${uiLabelMap[titleProperty]}"></label></container>
+                        <section>
+                            <condition><if-has-permission permission="SERVICE_JM_LOCK"/></condition>
+                            <widgets>
+                                <container style="button-bar">
+                                     <link target="AddJobManagerLock" text="${uiLabelMap.CommonAdd}" style="buttontext create" link-type="layered-modal"/>
+                                </container>
+                            </widgets>
+                        </section>
+                        <screenlet id="searchOptions" name="findScreenlet" collapsible="true" title="${uiLabelMap.CommonSearchOptions}">
+                            <container id="search-options">
+                                <include-form name="FindJobManagerLock" location="component://webtools/widget/ServiceForms.xml"/>
+                            </container>
+                        </screenlet>
+                        <screenlet padded="false">
+                            <label style="h3" text="${uiLabelMap.CommonSearchResults}"/>
+                            <container id="search-results">
+                                <include-form name="ListJobManagerLock" location="component://webtools/widget/ServiceForms.xml"/>
+                            </container>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="AddJobManagerLock">
+        <section>
+            <widgets>
+                <decorator-screen name="PopUpDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <include-form name="AddJobManagerLock" location="component://webtools/widget/ServiceForms.xml"/>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="JobManagerLockEnable">
+        <section>
+            <actions>
+                <entity-condition list="currentJobManagerLocks" entity-name="JobManagerLock" filter-by-date="true">
+                    <order-by field-name="fromDate"/>
+                </entity-condition>
+                <entity-condition list="nextJobManagerLocks" entity-name="JobManagerLock" filter-by-date="false">
+                    <condition-list>
+                        <condition-expr field-name="fromDate" operator="greater" from-field="nowTimestamp"/>
+                        <condition-list combine="or">
+                            <condition-expr field-name="thruDate" operator="greater" from-field="nowTimestamp"/>
+                            <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/>
+                        </condition-list>
+                    </condition-list>
+                    <order-by field-name="fromDate"/>
+                </entity-condition>
+            </actions>
+            <widgets>
+                <section>
+                    <condition>
+                        <or>
+                            <not><if-empty field="currentJobManagerLocks"/></not>
+                            <not><if-empty field="nextJobManagerLocks"/></not>
+                        </or>
+                    </condition>
+                    <widgets>
+                        <screenlet title="${uiLabelMap.WebtoolsJobManagerLockEnable}">
+                            <section>
+                                 <condition>
+                                     <not><if-empty field="currentJobManagerLocks"/></not>
+                                 </condition>
+                                 <actions>
+                                     <set field="jobManagerLocks" from-field="currentJobManagerLocks"/>
+                                 </actions>
+                                 <widgets>
+                                     <label style="h3">${uiLabelMap.WebtoolsCurrentJobManagerLock}</label>
+                                     <include-grid location="component://webtools/widget/ServiceForms.xml" name="JobManagerLockEnable"/>
+                                 </widgets>
+                             </section>
+                             <section>
+                                 <condition>
+                                     <not><if-empty field="nextJobManagerLocks"/></not>
+                                 </condition>
+                                 <actions>
+                                     <set field="jobManagerLocks" from-field="nextJobManagerLocks"/>
+                                 </actions>
+                                 <widgets>
+                                     <label style="h3">${uiLabelMap.WebtoolsNextJobManagerLock}</label>
+                                     <include-grid location="component://webtools/widget/ServiceForms.xml" name="JobManagerLockEnable"/>
+                                 </widgets>
+                             </section>
+                         </screenlet>
+                    </widgets>
+                </section>
+            </widgets>
+        </section>
+    </screen>
 </screens>