You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2007/12/29 18:13:36 UTC
svn commit: r607446 - in /ofbiz/trunk/framework/webtools: config/
servicedef/ src/org/ofbiz/webtools/ webapp/webtools/service/ widget/
Author: adrianc
Date: Sat Dec 29 09:13:35 2007
New Revision: 607446
URL: http://svn.apache.org/viewvc?rev=607446&view=rev
Log:
Improved Webtools job management screen. Patch submitted by Anil Soni - https://issues.apache.org/jira/browse/OFBIZ-1553 - with additional modifications by me.
Modified:
ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
ofbiz/trunk/framework/webtools/servicedef/services.xml
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
ofbiz/trunk/framework/webtools/webapp/webtools/service/serviceTabBar.ftl
ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
ofbiz/trunk/framework/webtools/widget/WebToolsMenus.xml
Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties Sat Dec 29 09:13:35 2007
@@ -34,6 +34,7 @@
PageTitleEntitySQLProcessor=Entity SQL Processor
PageTitleFindUtilCache=Cache Maintenance Page
PageTitleFindUtilCacheElements=Cache Element Maintenance Page
+PageTitleFindJob=Find Job
PageTitleLogConfiguration=Debugging Levels
PageTitleLogView=Log View
PageTitleJobList=Job List
@@ -151,6 +152,9 @@
WebtoolsFindAllRecords=Find All Records
WebtoolsFindRecord=Find Record
WebtoolsFindValues=Find Values
+WebtoolsRunningStatus=Running status
+WebtoolsPendingStatus=Pending status
+WebtoolsFinishedStatus=Finished status
WebtoolsFkIdx=Fk-Idx
WebtoolsFKName=FK Name
WebtoolsFks=Fks
@@ -185,6 +189,7 @@
WebtoolsJavaName=Java Name
WebtoolsJavaType=Java Type
WebtoolsJob=Job
+WebtoolsJobFilterOn=Filter jobs on
WebtoolsJobList=Job List
WebtoolsLeaveAllEntriesBlank=leave all entries blank
WebtoolsLHSMapName=LHS map name
@@ -333,6 +338,7 @@
WebtoolsServiceECA=Service ECAs
WebtoolsServiceEngineThreads=Service Engine Threads
WebtoolsServiceEngineTools=Service Engine Tools
+WebtoolsServicesFound=Services Found
WebtoolsServiceList=Service List
WebtoolsServiceLog=Service Log
WebtoolsServicesListFor=Services list for
Modified: ofbiz/trunk/framework/webtools/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/servicedef/services.xml?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/webtools/servicedef/services.xml Sat Dec 29 09:13:35 2007
@@ -101,4 +101,23 @@
if the user has the ENTITY_MAINT permission.</description>
<implements service="permissionInterface"/>
</service>
+ <service name="jobList" engine="java"
+ location="org.ofbiz.webtools.WebToolsServices" invoke="findJobs" auth="true" use-transaction="false">
+ <description>Find Jobs</description>
+ <attribute name="serviceName" type="String" mode="IN" optional="true"/>
+ <attribute name="VIEW_INDEX" type="String" mode="IN" optional="true"/>
+ <attribute name="VIEW_SIZE" type="String" mode="IN" optional="true"/>
+ <attribute name="showAll" type="String" mode="IN" optional="true"/>
+ <attribute name="lookupFlag" type="String" mode="IN" optional="true"/>
+ <attribute name="viewSize" type="Integer" mode="OUT" optional="false"/>
+ <attribute name="viewIndex" type="Integer" mode="OUT" optional="false"/>
+ <attribute name="lowIndex" type="Integer" mode="OUT" optional="false"/>
+ <attribute name="highIndex" type="Integer" mode="OUT" optional="false"/>
+ <attribute name="paramList" type="String" mode="OUT" optional="false"/>
+ <attribute name="jobs" type="List" mode="OUT" optional="false"/>
+ <attribute name="jobListSize" type="Integer" mode="OUT" optional="false"/>
+ <attribute name="filterJobsWithPendingStatus" type="String" mode="INOUT" optional="true"/>
+ <attribute name="filterJobsWithRunningStatus" type="String" mode="INOUT" optional="true"/>
+ <attribute name="filterJobsWithFinishedStatus" type="String" mode="INOUT" optional="true"/>
+ </service>
</services>
Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Sat Dec 29 09:13:35 2007
@@ -71,6 +71,11 @@
import org.ofbiz.entity.model.ModelKeyMap;
import org.ofbiz.entity.model.ModelUtil;
import org.ofbiz.entity.model.ModelViewEntity;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityConditionList;
+import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityFindOptions;
import org.ofbiz.security.Security;
import org.ofbiz.service.DispatchContext;
import org.ofbiz.service.LocalDispatcher;
@@ -795,5 +800,124 @@
resultMap.put("hasPermission", false);
}
return resultMap;
+ }
+
+ public static Map findJobs(DispatchContext dctx, Map context) {
+ Map result = ServiceUtil.returnSuccess();
+ GenericDelegator delegator = dctx.getDelegator();
+ String serviceName = (String) context.get("serviceName");
+
+ // set the page parameters
+ int viewIndex = 0;
+ try {
+ viewIndex = Integer.parseInt((String) context.get("VIEW_INDEX"));
+ } catch (Exception e) {
+ viewIndex = 0;
+ }
+ result.put("viewIndex", new Integer(viewIndex));
+
+ int viewSize = 20;
+ try {
+ viewSize = Integer.parseInt((String) context.get("VIEW_SIZE"));
+ } catch (Exception e) {
+ viewSize = 20;
+ }
+ result.put("viewSize", new Integer(viewSize));
+
+// get the lookup flag
+ String lookupFlag = (String) context.get("lookupFlag");
+
+ // list to hold the parameters
+ List paramList = FastList.newInstance();
+ List conditions = FastList.newInstance();
+ List jobList = null;
+ int jobListSize = 0;
+ int lowIndex = 0;
+ int highIndex = 0;
+ EntityListIterator eli = null;
+
+ if ("Y".equals(lookupFlag)) {
+ String showAll = (context.get("showAll") != null ? (String) context.get("showAll") : "N");
+ paramList.add("showAll=" + showAll);
+ paramList.add("lookupFlag=" + lookupFlag);
+ if (UtilValidate.isNotEmpty(serviceName)) {
+ paramList.add("serviceName=" + serviceName);
+ conditions.add(new EntityExpr("serviceName", true, EntityOperator.LIKE, "%"+serviceName+"%", true));
+ }
+ List filterExprs = FastList.newInstance();
+ String filterJobPending = (String) context.get("filterJobsWithPendingStatus");
+ String filterJobRunning = (String) context.get("filterJobsWithRunningStatus");
+ String filterJobFinished = (String) context.get("filterJobsWithFinishedStatus");
+
+ if (filterJobPending == null) {
+ filterJobPending = "N";
+ }
+ if (filterJobRunning == null) {
+ filterJobRunning = "N";
+ }
+ if (filterJobFinished == null) {
+ filterJobFinished = "N";
+ }
+ if ("Y".equals(filterJobPending)) {
+ paramList.add("filterJobsWithPendingStatus=Y");
+ filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_PENDING"));
+ result.put("filterJobsWithPendingStatus", filterJobPending);
+ }
+ if ("Y".equals(filterJobRunning)) {
+ paramList.add("filterJobsWithRunningStatus=Y");
+ filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_RUNNING"));
+ result.put("filterJobsWithRunningStatus", filterJobRunning);
+ }
+ if ("Y".equals(filterJobFinished)) {
+ paramList.add("filterJobsWithFinishedStatus=Y");
+ filterExprs.add(new EntityExpr("statusId", EntityOperator.EQUALS, "SERVICE_FINISHED"));
+ result.put("filterJobsWithFinishedStatus", filterJobFinished);
+ }
+ if (filterExprs.size() > 0) {
+ conditions.add(new EntityConditionList(filterExprs, EntityOperator.OR));
+ }
+ // set distinct on so we only get one row per job
+ EntityFindOptions findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
+ List orderBy = UtilMisc.toList("serviceName");
+ EntityCondition cond = null;
+ if (conditions.size() > 0) {
+ cond = new EntityConditionList(conditions, EntityOperator.AND);
+ }
+ if (cond != null || "Y".equals(showAll)) {
+ try {
+ eli = delegator.findListIteratorByCondition("JobSandbox", cond, null, null, orderBy, findOpts);
+
+ // get the indexes for the partial list
+ lowIndex = viewIndex * viewSize + 1;
+ highIndex = (viewIndex + 1) * viewSize;
+
+ // get the partial list for this page
+ jobList = eli.getPartialList(lowIndex, viewSize);
+
+ // attempt to get the full size
+ eli.last();
+ jobListSize = eli.currentIndex();
+ if (highIndex > jobListSize) {
+ highIndex = jobListSize;
+ }
+ eli.close();
+ } catch (GenericEntityException e) {
+ String errMsg = "Failure in job find operation, rolling back transaction: " + e.toString();
+ Debug.logError(e, errMsg, module);
+ return ServiceUtil.returnError(errMsg);
+ }
+ } else {
+ jobListSize = 0;
+ }
+ }
+ // create the result map
+ if (jobList == null) jobList = FastList.newInstance();
+ String paramString = StringUtil.join(paramList, "&");
+ result.put("paramList", (paramString != null ? paramString: ""));
+ result.put("lowIndex", new Integer(lowIndex));
+ result.put("highIndex", new Integer(highIndex));
+ result.put("jobs", jobList);
+ result.put("jobListSize", new Integer(jobListSize));
+ return result;
}
}
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/service/ServiceForms.xml Sat Dec 29 09:13:35 2007
@@ -51,4 +51,40 @@
<field name="_RUN_SYNC_"><hidden value="Y"/></field>
<field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit button-type="button"/></field>
</form>
+
+ <form name="findJob" type="single" target="jobList?hideFields=Y&lookupFlag=Y" list-name="jobs">
+ <!--field name="lookupFlag"><hidden value="Y"/></field-->
+ <field name="serviceName" title="${uiLabelMap.WebtoolsServiceName}"><text/></field>
+ <field name="serviceName" title="${uiLabelMap.WebtoolsServiceName}" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ <field name="filterJobsWithRunningStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsRunningStatus}"><check/></field>
+ <field name="filterJobsWithRunningStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsRunningStatus}" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ <field name="filterJobsWithPendingStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsPendingStatus}"><check/></field>
+ <field name="filterJobsWithPendingStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsPendingStatus}" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ <field name="filterJobsWithFinishedStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsFinishedStatus}"><check/></field>
+ <field name="filterJobsWithFinishedStatus" title="${uiLabelMap.WebtoolsJobFilterOn} ${uiLabelMap.WebtoolsFinishedStatus}" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonFind}" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ <field name="" widget-style="buttontext">
+ <hyperlink target="jobList?showAll=Y&hideFields=Y&lookupFlag=Y" description="${uiLabelMap.CommonShowAllRecords}"/>
+ </field>
+ <field name="" widget-style="buttontext" use-when=""${parameters.hideFields}".equals("Y")"><ignored/></field>
+ </form>
+
+ <form name="JobList" title="" target="" type="list" list-name="jobs"
+ default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"
+ paginate-target="jobList" override-list-size="${jobListSize}">
+ <field name="jobName" title="${uiLabelMap.WebtoolsJob}"><display/></field>
+ <field name="jobId" title="${uiLabelMap.CommonId}"><display/></field>
+ <field name="poolId" title="${uiLabelMap.WebtoolsPool}"><display/></field>
+ <field name="runTime" title="${uiLabelMap.WebtoolsRunTime}"><display/></field>
+ <field name="startDateTime" title="${uiLabelMap.CommonStartDateTime}"><display/></field>
+ <field name="serviceName" title="${uiLabelMap.WebtoolsService}">
+ <hyperlink also-hidden="false" description="${serviceName}" target="availableServices?sel_service_name=${serviceName}"/>
+ </field>
+ <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" description="${description}"/></field>
+ <field name="cancelDateTime" title="${uiLabelMap.CommonEndDateTime}"><display/></field>
+ <field name="cancelButton" title="" use-when="startDateTime==null&&finishDateTime==null&&cancelDateTime==null" widget-style="buttontext">
+ <hyperlink also-hidden="false" description="${uiLabelMap.WebtoolsCancelJob}" target="cancelJob?jobId=${jobId}"/>
+ </field>
+ </form>
</forms>
Modified: ofbiz/trunk/framework/webtools/webapp/webtools/service/serviceTabBar.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/service/serviceTabBar.ftl?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/service/serviceTabBar.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/service/serviceTabBar.ftl Sat Dec 29 09:13:35 2007
@@ -18,7 +18,7 @@
-->
<#assign selected = page.tabButtonItem?default("void")>
-<div class="button-bar button-style-1">
+<div class="button-bar tab-bar">
<ul>
<li<#if selected = "ServiceList"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.WebtoolsServiceList}</a></li>
<li<#if selected = "JobList"> class="selected"</#if>><a href="<@o...@ofbizUrl>">${uiLabelMap.WebtoolsJobList}</a></li>
Modified: ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/ServiceScreens.xml Sat Dec 29 09:13:35 2007
@@ -75,17 +75,26 @@
<actions>
<set field="titleProperty" value="PageTitleJobList"/>
<set field="tabButtonItem" value="JobList"/>
- <entity-condition entity-name="JobSandbox" list-name="jobs">
- <order-by field-name="-runTime"/>
- <!--<limit-range start="0" size="100"/>-->
- </entity-condition>
+ <!--<limit-range start="0" size="100"/>-->
+ <service service-name="jobList" auto-field-map="parameters"/>
</actions>
<widgets>
<decorator-screen name="CommonServiceDecorator">
<decorator-section name="body">
- <platform-specific>
- <html><html-template location="component://webtools/webapp/webtools/service/jobs.ftl"/></html>
- </platform-specific>
+ <container style="screenlet">
+ <include-menu location="component://webtools/widget/WebToolsMenus.xml" name="FindJobsTitleBar"/>
+ <container style="screenlet-body">
+ <include-form name="findJob" location="component://webtools/webapp/webtools/service/ServiceForms.xml"/>
+ </container>
+ </container>
+ <container style="screenlet">
+ <container style="screenlet-title-bar">
+ <label style="head3">${uiLabelMap.PageTitleJobList}</label>
+ </container>
+ <container style="screenlet-body">
+ <include-form name="JobList" location="component://webtools/webapp/webtools/service/ServiceForms.xml"/>
+ </container>
+ </container>
</decorator-section>
</decorator-screen>
</widgets>
Modified: ofbiz/trunk/framework/webtools/widget/WebToolsMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/WebToolsMenus.xml?rev=607446&r1=607445&r2=607446&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/WebToolsMenus.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/WebToolsMenus.xml Sat Dec 29 09:13:35 2007
@@ -19,7 +19,7 @@
-->
<menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
+ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">
<menu name="WebtoolsAppBar" default-menu-item-name="main" default-selected-style="selected" selected-menuitem-context-field-name="appButtonItem"
menu-id="app-navigation" type="simple">
@@ -33,6 +33,26 @@
<menu-item name="stats" title="Statistics"><link target="StatsSinceStart"/></menu-item>
</menu>
+ <menu name="FindJobsTitleBar" type="simple" menu-container-style="screenlet-title-bar">
+ <menu-item name="screenletTitle" align-style="head3">
+ <link text="${uiLabelMap.PageTitleFindJob}"/>
+ </menu-item>
+ <menu-item name="hideFields" title="${uiLabelMap.CommonHideFields}">
+ <condition>
+ <or>
+ <if-compare value="N" field-name="parameters.hideFields" operator="equals" type="String"></if-compare>
+ <if-empty field-name="parameters.hideFields"/>
+ </or>
+ </condition>
+ <link target="jobList?hideFields=Y&${paramList}"/>
+ </menu-item>
+ <menu-item name="showFields" title="${uiLabelMap.CommonShowLookupFields}">
+ <condition>
+ <if-compare value="Y" field-name="parameters.hideFields" operator="equals" type="String"></if-compare>
+ </condition>
+ <link target="jobList?hideFields=N&${paramList}"/>
+ </menu-item>
+ </menu>
</menus>