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
diff --git a/applications/content/config/ContentEntityLabels.xml b/applications/content/config/ContentEntityLabels.xml
index 102ad85..12620fd 100644
--- a/applications/content/config/ContentEntityLabels.xml
+++ b/applications/content/config/ContentEntityLabels.xml
@@ -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>
diff --git a/applications/content/minilang/data/DataServices.xml b/applications/content/minilang/data/DataServices.xml
index 6ddd5dd..55e2fd4 100644
--- a/applications/content/minilang/data/DataServices.xml
+++ b/applications/content/minilang/data/DataServices.xml
@@ -98,6 +98,23 @@
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"/>
diff --git a/applications/content/servicedef/services_data.xml b/applications/content/servicedef/services_data.xml
index a7ae150..d16d1bf 100644
--- a/applications/content/servicedef/services_data.xml
+++ b/applications/content/servicedef/services_data.xml
@@ -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"/>
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
index eac98f2..338de6b 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
@@ -747,13 +747,38 @@
} 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");
}
diff --git a/applications/datamodel/entitydef/content-entitymodel.xml b/applications/datamodel/entitydef/content-entitymodel.xml
index 9c65095..3d72769 100644
--- a/applications/datamodel/entitydef/content-entitymodel.xml
+++ b/applications/datamodel/entitydef/content-entitymodel.xml
@@ -148,6 +148,7 @@
<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 @@
<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>