Small improvement to allow ignoring of errors in form widget action services, mostly for those used to get info to display and if they fail it's not a big deal

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@897606 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David E. Jones
2010-01-10 09:20:18 +00:00
parent 9f222d3224
commit c28791cbee
4 changed files with 23 additions and 3 deletions
+8
View File
@@ -1527,6 +1527,14 @@ under the License.
</xs:attribute>
<!-- this is deprecated and should not be used; use result-map-list-name instead: <xs:attribute type="xs:string" name="result-map-list-iterator-name"/> -->
<xs:attribute type="xs:string" name="result-map-list"/>
<xs:attribute name="ignore-error" default="false">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
<xs:element name="set" substitutionGroup="AllActions">
<xs:complexType>
@@ -2020,7 +2020,7 @@ public class MacroFormRenderer implements FormStringRenderer {
int viewIndex = modelForm.getViewIndex(context);
int viewSize = modelForm.getViewSize(context);
int listSize = modelForm.getListSize(context);
int lowIndex = modelForm.getLowIndex(context);
int highIndex = modelForm.getHighIndex(context);
int actualPageSize = modelForm.getActualPageSize(context);
@@ -304,6 +304,7 @@ public abstract class ModelFormAction {
protected FlexibleStringExpander autoFieldMapExdr;
protected FlexibleStringExpander resultMapListNameExdr;
protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
protected boolean ignoreError = false;
public Service(ModelForm modelForm, Element serviceElement) {
super (modelForm, serviceElement);
@@ -329,6 +330,7 @@ public abstract class ModelFormAction {
}
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
this.ignoreError = "true".equals(serviceElement.getAttribute("ignore-error"));
}
@Override
@@ -383,7 +385,9 @@ public abstract class ModelFormAction {
} catch (GenericServiceException e) {
String errMsg = "Error in form [" + this.modelForm.getName() + "] calling service with name [" + serviceNameExpanded + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
if (!this.ignoreError) {
throw new IllegalArgumentException(errMsg);
}
}
}
}
@@ -245,7 +245,7 @@ ${item.description}</div>
</td>
</#macro>
<#macro renderFormatHeaderRowFormCellTitleSeparator style isLast>
<#if style?has_content><sapn class="${style}"></#if> - <#if style?has_content></span></#if>
<#if style?has_content><span class="${style}"></#if> - <#if style?has_content></span></#if>
</#macro>
<#macro renderFormatItemRowOpen formName itemIndex altRowStyles evenRowStyle oddRowStyle>
@@ -429,6 +429,7 @@ ${item.description}</div>
<script language="JavaScript" type="text/javascript">ajaxAutoCompleter('${ajaxUrl}');</script><#t/>
</#if>
</#macro>
<#macro renderNextPrev paginateStyle paginateFirstStyle viewIndex highIndex listSize viewSize ajaxEnabled javaScriptEnabled ajaxFirstUrl firstUrl paginateFirstLabel paginatePreviousStyle ajaxPreviousUrl previousUrl paginatePreviousLabel pageLabel ajaxSelectUrl selectUrl ajaxSelectSizeUrl selectSizeUrl commonDisplaying paginateNextStyle ajaxNextUrl nextUrl paginateNextLabel paginateLastStyle ajaxLastUrl lastUrl paginateLastLabel paginateViewSizeLabel>
<#if listSize gt viewSize>
<div class="${paginateStyle}">&nbsp; <ul>
@@ -453,9 +454,11 @@ ${item.description}</div>
</ul></div><br/>
</#if>
</#macro>
<#macro renderFileField className alert name value size maxlength autocomplete><input type="file" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#macro>
<#macro renderPasswordField className alert name value size maxlength id autocomplete><input type="password" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/></#macro>
<#macro renderImageField value border width height event action><img<#if value?has_content> src="${value}"</#if><#if border?has_content> border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if event?has_content> ${rp.event?html}="${action}" </#if>/></#macro>
<#macro renderBanner style leftStyle rightStyle leftText text rightText>
<table width="100%"> <tr><#rt/>
<#if leftText?has_content><td align="left"><#if leftStyle?has_content><div class="${leftStyle}"></#if>${leftText}<#if leftStyle?has_content></div></#if></td><#rt/></#if>
@@ -463,6 +466,7 @@ ${item.description}</div>
<#if rightText?has_content><td align="right"><#if rightStyle?has_content><div class="${rightStyle}"></#if>${rightText}<#if rightStyle?has_content></div></#if></td><#rt/></#if>
</tr> </table>
</#macro>
<#macro renderContainerField id><div id="${id?if_exists}"/></#macro>
<#macro renderFieldGroupOpen style id title collapsed collapsibleAreaId collapsible expandToolTip collapseToolTip>
@@ -476,6 +480,7 @@ ${item.description}</div>
<div id="${collapsibleAreaId}" class="fieldgroup-body" <#if collapsed && collapsible> style="display: none;"</#if>>
</#if>
</#macro>
<#macro renderFieldGroupClose style id title><#if style?has_content || id?has_content || title?has_content></div></div></#if></#macro>
<#macro renderHyperlinkTitle name title showSelectAll="N"><#if title?has_content>${title}<br/></#if><#if showSelectAll="Y"><input type="checkbox" name="selectAll" value="Y" onclick="javascript:toggleAll(this, '${name}');"/></#if></#macro>
@@ -483,12 +488,15 @@ ${item.description}</div>
<#macro formatBoundaryComment boundaryType widgetType widgetName><!-- ${boundaryType} ${widgetType} ${widgetName} --></#macro>
<#macro renderTooltip tooltip tooltipStyle><#if tooltip?has_content><span class="<#if tooltipStyle?has_content>${tooltipStyle}<#else>tooltip</#if>">${tooltip}</span><#rt/></#if></#macro>
<#macro renderClass className="" alert="">
<#if className?has_content || (alert?has_content && alert=="true")> class="${className}<#if alert?has_content && alert=="true"> alert</#if>" </#if>
</#macro>
<#macro renderAsterisks requiredField requiredStyle>
<#if requiredField=="true"><#if !requiredStyle?has_content>*</#if></#if>
</#macro>
<#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow><form method="post" action="${actionUrl}" <#if targetWindow?has_content>target="${targetWindow}"</#if> onsubmit="javascript:submitFormDisableSubmits(this)" name="${name}"><#list parameters as parameter><input name="${parameter.name}" value="${parameter.value}" type="hidden"/></#list></form></#macro>
<#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description confirmation><a <#if linkStyle?has_content>class="${linkStyle}"</#if> href="javascript:document.${hiddenFormName}.submit()"<#if action?has_content && event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> onclick="return confirm('${confirmation}')"</#if>><#if imgSrc?has_content><img src="${imgSrc}"/></#if>${description}</a></#macro>
<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc linkUrl targetWindow description confirmation><a <#if linkStyle?has_content>class="${linkStyle}"</#if> href="${linkUrl}"<#if targetWindow?has_content> target="${targetWindow}"</#if><#if action?has_content && event?has_content> ${event}="${action}"</#if><#if confirmation?has_content> onclick="return confirm('${confirmation}')"</#if>><#if imgSrc?has_content><img src="${imgSrc}"/></#if>${description}</a></#macro>