Author: jleroux
Date: Fri Jan 6 10:54:20 2017 New Revision: 1777586 URL: http://svn.apache.org/viewvc?rev=1777586&view=rev Log: 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... Modified: ofbiz/trunk/applications/content/config/ContentEntityLabels.xml ofbiz/trunk/applications/content/minilang/data/DataServices.xml ofbiz/trunk/applications/content/servicedef/services_data.xml ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml Modified: ofbiz/trunk/applications/content/config/ContentEntityLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentEntityLabels.xml?rev=1777586&r1=1777585&r2=1777586&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/ContentEntityLabels.xml (original) +++ ofbiz/trunk/applications/content/config/ContentEntityLabels.xml Fri Jan 6 10:54:20 2017 @@ -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> Modified: ofbiz/trunk/applications/content/minilang/data/DataServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/minilang/data/DataServices.xml?rev=1777586&r1=1777585&r2=1777586&view=diff ============================================================================== --- ofbiz/trunk/applications/content/minilang/data/DataServices.xml (original) +++ ofbiz/trunk/applications/content/minilang/data/DataServices.xml Fri Jan 6 10:54:20 2017 @@ -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"/> Modified: ofbiz/trunk/applications/content/servicedef/services_data.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_data.xml?rev=1777586&r1=1777585&r2=1777586&view=diff ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services_data.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services_data.xml Fri Jan 6 10:54:20 2017 @@ -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"/> Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java?rev=1777586&r1=1777585&r2=1777586&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java Fri Jan 6 10:54:20 2017 @@ -747,12 +747,37 @@ public class DataResourceWorker impleme } else { throw new GeneralException("The dataResource file [" + dataResourceId + "] could not be found"); } - } catch (SAXException e) { + } catch (SAXException | ParserConfigurationException e) { throw new GeneralException("Error rendering Screen template", e); - } catch (ParserConfigurationException 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"); Modified: ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml?rev=1777586&r1=1777585&r2=1777586&view=diff ============================================================================== --- ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml (original) +++ ofbiz/trunk/applications/datamodel/entitydef/content-entitymodel.xml Fri Jan 6 10:54:20 2017 @@ -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> |
Free forum by Nabble | Edit this page |