Implemented: New implementation of Birt. Easier user possibility of

report creation
(OFBIZ-6919)

This are a non functional changes not yet used OOTB. 
They are only intended to ease the sync between the svn trunk repo and 
the github branch (using a fork)

So still a WIP...


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1777586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2017-01-06 10:54:20 +00:00
parent 6c88ed0ab9
commit 25e965cb2e
5 changed files with 70 additions and 7 deletions
@@ -1,6 +1,5 @@
<?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
@@ -3209,4 +3208,8 @@
<value xml:lang="zh">发布点</value>
<value xml:lang="zh-TW">發佈點</value>
</property>
<property key="Content.description.CTNT_MASTER_EXAMPLE">
<value xml:lang="en">Example</value>
<value xml:lang="fr">Exemple</value>
</property>
</resource>
@@ -98,6 +98,23 @@ under the License.
Not that this service does not now do permission checking.
-->
<simple-method method-name="createElectronicTextForm" short-description="Create Electronic Text with Form code">
<make-value entity-name="ElectronicText" value-field="newEntity"/>
<set-nonpk-fields map="parameters" value-field="newEntity"/>
<set-pk-fields map="parameters" value-field="newEntity"/>
<create-value value-field="newEntity"/>
<field-to-result result-name="dataResourceId" field="newEntity.dataResourceId"/>
</simple-method>
<simple-method method-name="updateElectronicTextForm" short-description="Update Electronic Text with Form code">
<make-value entity-name="ElectronicText" value-field="lookupKeyValue"/>
<set-pk-fields map="parameters" value-field="lookupKeyValue"/>
<find-by-primary-key entity-name="ElectronicText" map="lookupKeyValue" value-field="lookedUpValue"/>
<set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
<store-value value-field="lookedUpValue"/>
<field-to-result result-name="dataResourceId" field="lookedUpValue.dataResourceId"/>
</simple-method>
<simple-method method-name="getElectronicText" short-description="Get Electronic Text" login-required="false">
<set field="userLogin" from-field="parameters.userLogin"/>
@@ -117,6 +117,25 @@
<attribute name="contentId" mode="INOUT" optional="true" type="String"/><!-- to optionaly know where this text is belonging to -->
<override name="textData" allow-html="any"/>
</service>
<service name="createElectronicTextForm" default-entity-name="ElectronicText" engine="simple"
location="component://content/minilang/data/DataServices.xml" invoke="createElectronicTextForm" auth="true">
<description>Create a ElectronicText with Form code</description>
<permission-service service-name="genericDataResourcePermission" main-action="CREATE"/>
<implements service="createDataResource"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<override name="dataResourceTypeId" default-value="ELECTRONIC_TEXT"/>
<override name="textData" allow-html="any"/>
</service>
<service name="updateElectronicTextForm" default-entity-name="ElectronicText" engine="simple"
location="component://content/minilang/data/DataServices.xml" invoke="updateElectronicTextForm" auth="true">
<description>Update a ElectronicText with Form code</description>
<permission-service service-name="genericDataResourcePermission" main-action="UPDATE"/>
<auto-attributes include="pk" mode="INOUT" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<attribute name="contentId" mode="INOUT" optional="true" type="String"/><!-- to optionaly know where this text is belonging to -->
<override name="textData" allow-html="any"/>
</service>
<service name="removeElectronicText" default-entity-name="ElectronicText" engine="entity-auto" invoke="delete" auth="true">
<description>Remove ElectronicText</description>
<permission-service service-name="genericDataResourcePermission" main-action="DELETE"/>
@@ -747,13 +747,38 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data
} else {
throw new GeneralException("The dataResource file [" + dataResourceId + "] could not be found");
}
} catch (SAXException e) {
throw new GeneralException("Error rendering Screen template", e);
} catch (ParserConfigurationException e) {
} catch (SAXException | ParserConfigurationException e) {
throw new GeneralException("Error rendering Screen template", e);
} catch (TemplateException e) {
throw new GeneralException("Error creating Screen renderer", e);
}
} else if ("FORM_COMBINED".equals(dataTemplateTypeId)){
try {
Map<String, Object> context = UtilGenerics.checkMap(templateContext.get("globalContext"));
context.put("locale", locale);
context.put("simpleEncoder", UtilCodec.getEncoder(UtilProperties.getPropertyValue("widget", "screen.encoder")));
HttpServletRequest request = (HttpServletRequest) context.get("request");
HttpServletResponse response = (HttpServletResponse) context.get("response");
ModelForm modelForm = null;
ModelReader entityModelReader = delegator.getModelReader();
String formText = getDataResourceText(dataResource, targetMimeTypeId, locale, templateContext, delegator, cache);
Document formXml = UtilXml.readXmlDocument(formText, true, true);
Map<String, ModelForm> modelFormMap = FormFactory.readFormDocument(formXml, entityModelReader, dispatcher.getDispatchContext(), null);
if (UtilValidate.isNotEmpty(modelFormMap)) {
Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next(); // get first entry, only one form allowed per file
modelForm = entry.getValue();
}
MacroFormRenderer renderer = new MacroFormRenderer(formrenderer, request, response);
FormRenderer formRenderer = new FormRenderer(modelForm, renderer);
formRenderer.render(out, context);
} catch (SAXException | ParserConfigurationException e) {
throw new GeneralException("Error rendering Screen template", e);
} catch (TemplateException e) {
throw new GeneralException("Error creating Screen renderer", e);
} catch (Exception e) {
throw new GeneralException("Error rendering Screen template", e);
}
} else {
throw new GeneralException("The dataTemplateTypeId [" + dataTemplateTypeId + "] is not yet supported");
}
@@ -148,6 +148,7 @@ under the License.
<entity entity-name="Content"
package-name="org.apache.ofbiz.content.content"
default-resource-name="ContentEntityLabels"
title="Content Entity">
<field name="contentId" type="id-ne"></field>
<field name="contentTypeId" type="id"></field>
@@ -159,9 +160,7 @@ under the License.
<field name="dataSourceId" type="id"></field>
<field name="statusId" type="id"></field>
<field name="privilegeEnumId" type="id"></field>
<field name="serviceName" type="long-varchar">
<description>Deprecated : use customMethod pattern instead of. Kept for backward compatibility</description>
</field>
<field name="serviceName" type="long-varchar"><description>Deprecated : use customMethod pattern instead. Kept for backward compatibility</description></field>
<field name="customMethodId" type="id"></field>
<field name="contentName" type="value"></field>
<field name="description" type="description"></field>