Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/script/org/ofbiz/product/product/ProductServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/script/org/ofbiz/product/product/ProductServices.xml?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/script/org/ofbiz/product/product/ProductServices.xml Mon Oct 6 08:07:22 2014 @@ -352,21 +352,6 @@ under the License. </simple-method> <!-- Product Keyword Services --> - <simple-method method-name="createProductKeyword" short-description="create a ProductKeyword"> - <make-value entity-name="ProductKeyword" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductKeyword" short-description="update a ProductKeyword"> - <entity-one entity-name="ProductKeyword" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductKeyword" short-description="delete a ProductKeyword"> - <entity-one entity-name="ProductKeyword" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> <simple-method method-name="forceIndexProductKeywords" short-description="induce all the keywords of a product"> <entity-one entity-name="Product" value-field="product"/> <call-class-method class-name="org.ofbiz.product.product.KeywordIndex" method-name="forceIndexKeywords"> @@ -489,78 +474,6 @@ under the License. </if-not-empty> </simple-method> - <!-- GoodIdentification methods --> - <simple-method method-name="createGoodIdentification" short-description="Create an GoodIdentification"> - <set value="createGoodIdentification" field="callingMethodName"/> - <set value="CREATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="newEntity" entity-name="GoodIdentification"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateGoodIdentification" short-description="Update an GoodIdentification"> - <set value="updateGoodIdentification" field="callingMethodName"/> - <set value="UPDATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value entity-name="GoodIdentification" value-field="lookupPKMap"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteGoodIdentification" short-description="Delete an GoodIdentification"> - <set value="deleteGoodIdentification" field="callingMethodName"/> - <set value="DELETE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value entity-name="GoodIdentification" value-field="lookupPKMap"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> - - <!-- ProductGlAccount methods --> - <simple-method method-name="createProductGlAccount" short-description="Create an ProductGlAccount"> - <set value="createProductGlAccount" field="callingMethodName"/> - <set value="CREATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="newEntity" entity-name="ProductGlAccount"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductGlAccount" short-description="Update an ProductGlAccount"> - <set value="updateProductGlAccount" field="callingMethodName"/> - <set value="UPDATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value entity-name="ProductGlAccount" value-field="lookupPKMap"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key entity-name="ProductGlAccount" map="lookupPKMap" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductGlAccount" short-description="Delete an ProductGlAccount"> - <set value="deleteProductGlAccount" field="callingMethodName"/> - <set value="DELETE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value entity-name="ProductGlAccount" value-field="lookupPKMap"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key entity-name="ProductGlAccount" map="lookupPKMap" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="createProductReview" short-description="Create a ProductReview" login-required="false"> <make-value value-field="newEntity" entity-name="ProductReview"/> <set-nonpk-fields map="parameters" value-field="newEntity"/> @@ -753,125 +666,6 @@ under the License. </iterate> </simple-method> - <!-- for managing product to product associations --> - <simple-method method-name="createProductAssoc" short-description="Create an association between two products"> - <set value="createProductAssoc" field="callingMethodName"/> - <set value="CREATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="newEntity" entity-name="ProductAssoc"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductAssoc" short-description="Update an association between two products"> - <set value="updateProductAssoc" field="callingMethodName"/> - <set value="UPDATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="lookupPKMap" entity-name="ProductAssoc"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key entity-name="ProductAssoc" map="lookupPKMap" value-field="productAssocInstance"/> - <set-nonpk-fields map="parameters" value-field="productAssocInstance"/> - <store-value value-field="productAssocInstance"/> - </simple-method> - <simple-method method-name="deleteProductAssoc" short-description="Delete an association between two products"> - <set value="deleteProductAssoc" field="callingMethodName"/> - <set value="DELETE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="lookupPKMap" entity-name="ProductAssoc"/> - <set-pk-fields map="parameters" value-field="lookupPKMap"/> - <find-by-primary-key entity-name="ProductAssoc" map="lookupPKMap" value-field="productAssocInstance"/> - <remove-value value-field="productAssocInstance"/> - </simple-method> - - <!-- Create/Update/Delete Product Maint Record --> - <simple-method method-name="createProductMaint" short-description="Create an Product Maintenance"> - <set value="createProductMaint" field="callingMethodName"/> - <set value="CREATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="newEntity" entity-name="ProductMaint"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <make-next-seq-id value-field="newEntity" seq-field-name="productMaintSeqId"/> <!-- this finds the next sub-sequence ID --> - <field-to-result field="newEntity.productMaintSeqId" result-name="productMaintSeqId"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductMaint" short-description="Update an existing Product Maintenance"> - <set value="updateProductMaint" field="callingMethodName"/> - <set value="UPDATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <entity-one entity-name="ProductMaint" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductMaint" short-description="Delete Product Maint from PRODUCT_MAINT"> - <set value="deleteProductMaint" field="callingMethodName"/> - <set value="DELETE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <entity-one entity-name="ProductMaint" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> - <!-- Create/Update/Delete Product Meter Record --> - <simple-method method-name="createProductMeter" short-description="Create an Product Meter"> - <set value="createProductMeter" field="callingMethodName"/> - <set value="CREATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <make-value value-field="newEntity" entity-name="ProductMeter"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductMeter" short-description="Update an existing Product Meter"> - <set value="updateProductMeter" field="callingMethodName"/> - <set value="UPDATE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <entity-one entity-name="ProductMeter" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductMeter" short-description="Delete an existing Product Meter"> - <set value="deleteProductMeter" field="callingMethodName"/> - <set value="DELETE" field="checkAction"/> - <call-simple-method method-name="checkProductRelatedPermission"/> - <check-errors/> - - <entity-one entity-name="ProductMeter" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> - - <!-- ProductGeo Services --> - <simple-method method-name="createProductGeo" short-description="Create an Product Geo"> - <make-value value-field="newEntity" entity-name="ProductGeo"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductGeo" short-description="Update an existing Product Geo"> - <entity-one entity-name="ProductGeo" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductGeo" short-description="Delete an existing Product Geo"> - <entity-one entity-name="ProductGeo" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> - <!-- a method to centralize product security code, meant to be called in-line with call-simple-method, and the checkAction and callingMethodName attributes should be in the method context --> <simple-method method-name="checkProductRelatedPermission" short-description="Check Product Related Permission"> @@ -913,8 +707,9 @@ under the License. </not> </condition> <then> + <set field="checkActionLabel" value="${groovy: 'ProductCatalog' + checkAction.charAt(0) + checkAction.substring(1).toLowerCase() + 'PermissionError'}"/> <add-error> - <fail-property resource="ProductUiLabels" property="ProductCatalogCreatePermissionError"/> + <fail-property resource="ProductUiLabels" property="${checkActionLabel}"/> </add-error> </then> </if> @@ -944,22 +739,6 @@ under the License. </else> </if-empty> </simple-method> - <!-- Product Attribute Services --> - <simple-method method-name="createProductAttribute" short-description="create a ProductAttribute"> - <make-value entity-name="ProductAttribute" value-field="newEntity"/> - <set-pk-fields map="parameters" value-field="newEntity"/> - <set-nonpk-fields map="parameters" value-field="newEntity"/> - <create-value value-field="newEntity"/> - </simple-method> - <simple-method method-name="updateProductAttribute" short-description="update a ProductAttribute"> - <entity-one entity-name="ProductAttribute" value-field="lookedUpValue"/> - <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> - <store-value value-field="lookedUpValue"/> - </simple-method> - <simple-method method-name="deleteProductAttribute" short-description="delete a ProductAttribute"> - <entity-one entity-name="ProductAttribute" value-field="lookedUpValue"/> - <remove-value value-field="lookedUpValue"/> - </simple-method> <!-- ================================================================ --> <!-- ProductRole Services -->
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/servicedef/services.xml?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/servicedef/services.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/servicedef/services.xml Mon Oct 6 08:07:22 2014 @@ -127,22 +127,19 @@ under the License. </service> <!-- Product Keyword Services --> - <service name="createProductKeyword" default-entity-name="ProductKeyword" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductKeyword" auth="true"> + <service name="createProductKeyword" default-entity-name="ProductKeyword" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductKeyword</description> <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="updateProductKeyword" default-entity-name="ProductKeyword" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductKeyword" auth="true"> + <service name="updateProductKeyword" default-entity-name="ProductKeyword" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductKeyword</description> <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductKeyword" default-entity-name="ProductKeyword" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductKeyword" auth="true"> + <service name="deleteProductKeyword" default-entity-name="ProductKeyword" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductKeyword</description> <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> @@ -228,21 +225,18 @@ under the License. <!-- Product Association Services --> - <service name="createProductAssoc" default-entity-name="ProductAssoc" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" - invoke="createProductAssoc" auth="true"> + <service name="createProductAssoc" default-entity-name="ProductAssoc" engine="entity-auto" invoke="create" auth="true"> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="updateProductAssoc" default-entity-name="ProductAssoc" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" - invoke="updateProductAssoc" auth="true"> + <service name="updateProductAssoc" default-entity-name="ProductAssoc" engine="entity-auto" invoke="update" auth="true"> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductAssoc" default-entity-name="ProductAssoc" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" - invoke="deleteProductAssoc" auth="true"> + <service name="deleteProductAssoc" default-entity-name="ProductAssoc" engine="entity-auto" invoke="delete" auth="true"> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> @@ -327,40 +321,40 @@ under the License. </service> <!-- GoodIdentification Services --> - <service name="createGoodIdentification" default-entity-name="GoodIdentification" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createGoodIdentification" auth="true"> + <service name="createGoodIdentification" default-entity-name="GoodIdentification" engine="entity-auto" invoke="create" auth="true"> <description>Create a GoodIdentification</description> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="false"/> </service> - <service name="updateGoodIdentification" default-entity-name="GoodIdentification" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateGoodIdentification" auth="true"> + <service name="updateGoodIdentification" default-entity-name="GoodIdentification" engine="entity-auto" invoke="update" auth="true"> <description>Update a GoodIdentification</description> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="false"/> </service> - <service name="deleteGoodIdentification" default-entity-name="GoodIdentification" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteGoodIdentification" auth="true"> + <service name="deleteGoodIdentification" default-entity-name="GoodIdentification" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a GoodIdentification</description> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> <!-- ProductGlAccount Services --> - <service name="createProductGlAccount" default-entity-name="ProductGlAccount" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductGlAccount" auth="true"> + <service name="createProductGlAccount" default-entity-name="ProductGlAccount" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductGlAccount</description> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="false"/> </service> - <service name="updateProductGlAccount" default-entity-name="ProductGlAccount" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductGlAccount" auth="true"> + <service name="updateProductGlAccount" default-entity-name="ProductGlAccount" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductGlAccount</description> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="false"/> </service> - <service name="deleteProductGlAccount" default-entity-name="ProductGlAccount" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductGlAccount" auth="true"> + <service name="deleteProductGlAccount" default-entity-name="ProductGlAccount" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductGlAccount</description> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> @@ -558,56 +552,56 @@ under the License. <attribute name="supplierProductFeatures" type="java.util.List" mode="OUT" optional="false"/> </service> - <service name="createProductMaint" default-entity-name="ProductMaint" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductMaint" auth="true"> + <service name="createProductMaint" default-entity-name="ProductMaint" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductMaint</description> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="productMaintSeqId" mode="OUT"/> <!-- make this OUT rather than IN, we will automatically generate the next sub-sequence ID --> </service> - <service name="updateProductMaint" default-entity-name="ProductMaint" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductMaint" auth="true"> + <service name="updateProductMaint" default-entity-name="ProductMaint" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductMaint</description> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductMaint" default-entity-name="ProductMaint" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductMaint" auth="true"> + <service name="deleteProductMaint" default-entity-name="ProductMaint" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductMaint</description> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> - <service name="createProductMeter" default-entity-name="ProductMeter" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductMeter" auth="true"> + <service name="createProductMeter" default-entity-name="ProductMeter" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductMeter</description> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="updateProductMeter" default-entity-name="ProductMeter" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductMeter" auth="true"> + <service name="updateProductMeter" default-entity-name="ProductMeter" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductMeter</description> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductMeter" default-entity-name="ProductMeter" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductMeter" auth="true"> + <service name="deleteProductMeter" default-entity-name="ProductMeter" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductMeter</description> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> - <service name="createProductGeo" default-entity-name="ProductGeo" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductGeo" auth="true"> + <service name="createProductGeo" default-entity-name="ProductGeo" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductGeo</description> + <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="updateProductGeo" default-entity-name="ProductGeo" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductGeo" auth="true"> + <service name="updateProductGeo" default-entity-name="ProductGeo" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductGeo</description> + <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductGeo" default-entity-name="ProductGeo" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductGeo" auth="true"> + <service name="deleteProductGeo" default-entity-name="ProductGeo" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductGeo</description> + <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> <service name="createCommunicationEventProduct" engine="simple" @@ -624,69 +618,60 @@ under the License. <!-- ======================================== --> <!-- Product Catalog Services --> <!-- ======================================== --> - <service name="createProdCatalog" default-entity-name="ProdCatalog" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="createProdCatalog" auth="true"> + <service name="createProdCatalog" default-entity-name="ProdCatalog" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="CREATE"/> <auto-attributes include="pk" mode="INOUT" optional="true"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="catalogName" optional="false"/> </service> - <service name="updateProdCatalog" default-entity-name="ProdCatalog" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="updateProdCatalog" auth="true"> + <service name="updateProdCatalog" default-entity-name="ProdCatalog" engine="entity-auto" invoke="update" auth="true"> <description>Update an ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="catalogName" optional="false"/> </service> - <service name="deleteProdCatalog" default-entity-name="ProdCatalog" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="deleteProdCatalog" auth="true"> + <service name="deleteProdCatalog" default-entity-name="ProdCatalog" engine="entity-auto" invoke="delete" auth="true"> <description>Delete an ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> - <service name="addProductCategoryToProdCatalog" default-entity-name="ProdCatalogCategory" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="addProductCategoryToProdCatalog" auth="true"> + <service name="addProductCategoryToProdCatalog" default-entity-name="ProdCatalogCategory" engine="entity-auto" invoke="create" auth="true"> <description>Add ProductCategory To ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="fromDate" optional="true"/> </service> - <service name="updateProductCategoryToProdCatalog" default-entity-name="ProdCatalogCategory" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="updateProductCategoryToProdCatalog" auth="true"> + <service name="updateProductCategoryToProdCatalog" default-entity-name="ProdCatalogCategory" engine="entity-auto" invoke="update" auth="true"> <description>Add ProductCategory To ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="prodCatalogCategoryTypeId" optional="false"/> </service> - <service name="removeProductCategoryFromProdCatalog" default-entity-name="ProdCatalogCategory" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="removeProductCategoryFromProdCatalog" auth="true"> + <service name="removeProductCategoryFromProdCatalog" default-entity-name="ProdCatalogCategory" engine="entity-auto" invoke="delete" auth="true"> <description>Remove ProductCategory From ProdCatalog</description> <permission-service service-name="catalogPermissionCheck" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> </service> - <service name="addProdCatalogToParty" default-entity-name="ProdCatalogRole" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="addProdCatalogToParty" auth="true"> + <service name="addProdCatalogToParty" default-entity-name="ProdCatalogRole" engine="entity-auto" invoke="create" auth="true"> <description>Add ProdCatalog To Party</description> <permission-service service-name="prodCatalogToPartyPermissionCheck" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> <override name="fromDate" optional="true"/> </service> - <service name="updateProdCatalogToParty" default-entity-name="ProdCatalogRole" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="updateProdCatalogToParty" auth="true"> + <service name="updateProdCatalogToParty" default-entity-name="ProdCatalogRole" engine="entity-auto" invoke="update" auth="true"> <description>Add ProdCatalog To Party</description> <permission-service service-name="prodCatalogToPartyPermissionCheck" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="removeProdCatalogFromParty" default-entity-name="ProdCatalogRole" engine="simple" - location="component://product/script/org/ofbiz/product/catalog/CatalogServices.xml" invoke="removeProdCatalogFromParty" auth="true"> + <service name="removeProdCatalogFromParty" default-entity-name="ProdCatalogRole" engine="entity-auto" invoke="delete" auth="true"> <description>Remove ProdCatalog From Party</description> <permission-service service-name="prodCatalogToPartyPermissionCheck" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> @@ -1284,22 +1269,19 @@ under the License. <attribute type="String" mode="IN" name="productCategoryId" optional="true"/> </service> <!-- Product Attribute Services --> - <service name="createProductAttribute" default-entity-name="ProductAttribute" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="createProductAttribute" auth="true"> + <service name="createProductAttribute" default-entity-name="ProductAttribute" engine="entity-auto" invoke="create" auth="true"> <description>Create a ProductAttribute</description> <permission-service service-name="productGenericPermission" main-action="CREATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="updateProductAttribute" default-entity-name="ProductAttribute" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="updateProductAttribute" auth="true"> + <service name="updateProductAttribute" default-entity-name="ProductAttribute" engine="entity-auto" invoke="update" auth="true"> <description>Update a ProductAttribute</description> <permission-service service-name="productGenericPermission" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> - <service name="deleteProductAttribute" default-entity-name="ProductAttribute" engine="simple" - location="component://product/script/org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductAttribute" auth="true"> + <service name="deleteProductAttribute" default-entity-name="ProductAttribute" engine="entity-auto" invoke="delete" auth="true"> <description>Delete a ProductAttribute</description> <permission-service service-name="productGenericPermission" main-action="DELETE"/> <auto-attributes include="pk" mode="IN" optional="false"/> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/CommonTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/CommonTypeData.xml?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/CommonTypeData.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/data/CommonTypeData.xml Mon Oct 6 08:07:22 2014 @@ -131,5 +131,7 @@ under the License. <StatusItem statusId="KW_APPROVED" statusTypeId="KEYWORD_STATUS" statusCode="APPROVED" sequenceId="01" description="Approved"/> <StatusItem statusId="KW_PENDING" statusTypeId="KEYWORD_STATUS" statusCode="PENDING" sequenceId="02" description="Pending"/> <StatusItem statusId="KW_DISAPPROVED" statusTypeId="KEYWORD_STATUS" statusCode="DISAPPROVED" sequenceId="03" description="Disapproved"/> + <StatusValidChange condition="" statusId="KW_PENDING" statusIdTo="KW_APPROVED" transitionName="Review Approved"/> + <StatusValidChange condition="" statusId="KW_PENDING" statusIdTo="KW_DISAPPROVED" transitionName="Review Disapproved"/> </entity-engine-xml> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon Oct 6 08:07:22 2014 @@ -2532,10 +2532,12 @@ public class GenericDelegator implements sequencer = this.AtomicRefSequencer.get(); } } - - // might be null, but will usually match the entity name - ModelEntity seqModelEntity = this.getModelEntity(seqName); - + ModelEntity seqModelEntity = null; + try { + seqModelEntity = getModelReader().getModelEntity(seqName); + } catch (GenericEntityException e) { + Debug.logInfo("Entity definition not found for sequence name " + seqName, module); + } Long newSeqId = sequencer == null ? null : sequencer.getNextSeqId(seqName, staggerMax, seqModelEntity); return newSeqId; } catch (Exception e) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java Mon Oct 6 08:07:22 2014 @@ -19,6 +19,7 @@ package org.ofbiz.entity.util; import java.sql.Timestamp; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -26,14 +27,12 @@ import java.util.Set; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.model.DynamicViewEntity; -import org.ofbiz.entity.util.EntityFindOptions; -import org.ofbiz.entity.util.EntityListIterator; -import org.ofbiz.entity.util.EntityUtil; /** * Used to setup various options for and subsequently execute entity queries. @@ -62,6 +61,7 @@ public class EntityQuery { private EntityCondition havingEntityCondition = null; private boolean filterByDate = false; private Timestamp filterByDateMoment; + private List<String> filterByFieldNames = null; @@ -166,7 +166,7 @@ public class EntityQuery { * @param fieldMap - A list of EntityCondition objects to be ANDed together as the WHERE clause for the query * @return this EntityQuery object, to enable chaining */ - public EntityQuery where(List<EntityCondition> andConditions) { + public <T extends EntityCondition> EntityQuery where(List<T> andConditions) { this.whereEntityCondition = EntityCondition.makeCondition(andConditions); return this; } @@ -288,6 +288,7 @@ public class EntityQuery { public EntityQuery filterByDate() { this.filterByDate = true; this.filterByDateMoment = null; + this.filterByFieldNames = null; return this; } @@ -299,6 +300,22 @@ public class EntityQuery { public EntityQuery filterByDate(Timestamp moment) { this.filterByDate = true; this.filterByDateMoment = moment; + this.filterByFieldNames = null; + return this; + } + + /** Specifies whether the query should return only values that are currently active using the specified from/thru field name pairs. + * + * @param fromThruFieldName - String pairs representing the from/thru date field names e.g. "fromDate", "thruDate", "contactFromDate", "contactThruDate" + * @return this EntityQuery object, to enable chaining + */ + public EntityQuery filterByDate(String... filterByFieldName) { + this.filterByDate = true; + this.filterByDateMoment = null; + if (filterByFieldName.length % 2 != 0) { + throw new IllegalArgumentException("You must pass an even sized array to this method, each pair should represent a from date field name and a thru date field name"); + } + this.filterByFieldNames = Arrays.asList(filterByFieldName); return this; } @@ -376,11 +393,7 @@ public class EntityQuery { result = queryIterator().getCompleteList(); } if (filterByDate && useCache) { - if (filterByDateMoment == null) { - return EntityUtil.filterByDate(result); - } else { - return EntityUtil.filterByDate(result, filterByDateMoment); - } + return EntityUtil.filterByCondition(result, this.makeDateCondition()); } return result; } @@ -405,12 +418,26 @@ public class EntityQuery { private EntityCondition makeWhereCondition(boolean usingCache) { // we don't use the useCache field here because not all queries will actually use the cache, e.g. findCountByCondition never uses the cache if (filterByDate && !usingCache) { + return EntityCondition.makeCondition(whereEntityCondition, this.makeDateCondition()); + } + return whereEntityCondition; + } + + private EntityCondition makeDateCondition() { + List<EntityCondition> conditions = new ArrayList<EntityCondition>(); + if (UtilValidate.isEmpty(this.filterByFieldNames)) { + this.filterByDate("fromDate", "thruDate"); + } + + for (int i = 0; i < this.filterByFieldNames.size();) { + String fromDateFieldName = this.filterByFieldNames.get(i++); + String thruDateFieldName = this.filterByFieldNames.get(i++); if (filterByDateMoment == null) { - return EntityCondition.makeCondition(whereEntityCondition, EntityUtil.getFilterByDateExpr()); + conditions.add(EntityUtil.getFilterByDateExpr(fromDateFieldName, thruDateFieldName)); } else { - return EntityCondition.makeCondition(whereEntityCondition, EntityUtil.getFilterByDateExpr(filterByDateMoment)); + conditions.add(EntityUtil.getFilterByDateExpr(this.filterByDateMoment, fromDateFieldName, thruDateFieldName)); } } - return whereEntityCondition; + return EntityCondition.makeCondition(conditions); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/method/serviceops/FieldToResult.java Mon Oct 6 08:07:22 2014 @@ -19,6 +19,7 @@ package org.ofbiz.minilang.method.serviceops; import org.ofbiz.base.util.collections.FlexibleMapAccessor; +import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.MiniLangValidate; import org.ofbiz.minilang.SimpleMethod; @@ -27,7 +28,7 @@ import org.ofbiz.minilang.method.MethodO import org.w3c.dom.Element; /** - * Implements the <field-to-request> element. + * Implements the <field-to-result> element. * * @see <a href="https://cwiki.apache.org/confluence/display/OFBADMIN/Mini-language+Reference#Mini-languageReference-{{%3Cfieldtoresult%3E}}">Mini-language Reference</a> */ @@ -60,7 +61,14 @@ public final class FieldToResult extends Object fieldVal = this.fieldFma.get(methodContext.getEnvMap()); if (fieldVal != null) { if (this.resultFma.containsNestedExpression()) { - String expression = (String) this.resultFma.get(methodContext.getEnvMap()); + /* + * Replace FMA nested expression functionality with our own. + * The nested expression must be evaluated once using the + * method context, [methodContext.getEnvMap()] then again to + * place the value in the result Map [methodContext.getResults()]. + */ + FlexibleStringExpander fse = FlexibleStringExpander.getInstance(this.resultFma.getOriginalName()); + String expression = fse.expandString(methodContext.getEnvMap()); FlexibleMapAccessor<Object> resultFma = FlexibleMapAccessor.getInstance(expression); resultFma.put(methodContext.getResults(), fieldVal); } else { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java Mon Oct 6 08:07:22 2014 @@ -102,7 +102,7 @@ public class MiniLangTests extends OFBiz MethodContext context = createServiceMethodContext(); String result = methodToTest.exec(context); assertEquals("testFieldToResult success result", methodToTest.getDefaultSuccessCode(), result); - assertEquals("Constant result name set", "someResultValue", context.getResult("constantResultName")); - //assertEquals("Dynamic result name set", "someResultValue", context.getResult("dynamicResultName")); This one fails! + assertEquals("Plain expression result name set", "someResultValue", context.getResult("constantResultName")); + assertEquals("Nested expression result name set", "someResultValue", context.getResult("dynamicResultName")); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ModelServiceReader.java Mon Oct 6 08:07:22 2014 @@ -272,7 +272,7 @@ public class ModelServiceReader implemen service.description = getCDATADef(serviceElement, "description"); service.nameSpace = getCDATADef(serviceElement, "namespace"); - // contruct the context + // construct the context service.contextInfo = FastMap.newInstance(); this.createNotification(serviceElement, service); this.createPermission(serviceElement, service); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Mon Oct 6 08:07:22 2014 @@ -68,7 +68,7 @@ public class ControlServlet extends Http super.init(config); if (Debug.infoOn()) { ServletContext servletContext = config.getServletContext(); - Debug.logInfo("Lading webapp [" + servletContext.getContextPath().substring(1) + "], located at " + servletContext.getRealPath("/"), module); + Debug.logInfo("Loading webapp [" + servletContext.getContextPath().substring(1) + "], located at " + servletContext.getRealPath("/"), module); } // configure custom BSF engines Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/ModelWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/ModelWidget.java Mon Oct 6 08:07:22 2014 @@ -38,7 +38,6 @@ public class ModelWidget implements Seri */ public static final String enableBoundaryCommentsParam = "widgetVerbose"; protected String name; - protected boolean enableWidgetBoundaryComments = false; private String systemId; private int startColumn; private int startLine; @@ -104,27 +103,6 @@ public class ModelWidget implements Seri } /** - * Returns true if boundary comments are enabled for this widget, otherwise - * returns false. - * @return True if boundary comments are enabled for this widget - * @deprecated Use the static <code>widgetBoundaryCommentsEnabled</code> method instead - */ - @Deprecated - public boolean boundaryCommentsEnabled() { - return enableWidgetBoundaryComments; - } - - /** - * Enables/disables boundary comments for this widget. - * @param context The screen rendering context - * @deprecated Do not use this - it is not thread-safe - */ - @Deprecated - public void setWidgetBoundaryComments(Map<String, ? extends Object> context) { - enableWidgetBoundaryComments = widgetBoundaryCommentsEnabled(context); - } - - /** * Returns <code>true</code> if widget boundary comments are enabled. Widget boundary comments are * enabled by setting <code>widget.verbose=true</code> in the <code>widget.properties</code> file. * The <code>true</code> setting can be overridden in <code>web.xml</code> or in the screen Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/FormFactory.java Mon Oct 6 08:07:22 2014 @@ -52,13 +52,7 @@ public class FormFactory { public static Map<String, ModelForm> getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext) throws IOException, SAXException, ParserConfigurationException { - /* - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = FormFactory.class.getClassLoader(); - } - */ - URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true); return readFormDocument(formFileDoc, entityModelReader, dispatchContext, resourceName); } @@ -68,13 +62,7 @@ public class FormFactory { String cacheKey = resourceName + "#" + formName; ModelForm modelForm = formLocationCache.get(cacheKey); if (modelForm == null) { - /* - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = FormFactory.class.getClassLoader(); - } - */ - URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true); if (formFileDoc == null) { throw new IllegalArgumentException("Could not find resource [" + resourceName + "]"); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Mon Oct 6 08:07:22 2014 @@ -172,9 +172,6 @@ public class ModelForm extends ModelWidg */ protected FieldGroup defaultFieldGroup; - /** Default hyperlink target. */ - public static String DEFAULT_TARGET_TYPE = "intra-app"; - /** Pagination settings and defaults. */ public static int DEFAULT_PAGE_SIZE = 10; public static int MAX_PAGE_SIZE = 10000; @@ -312,10 +309,6 @@ public class ModelForm extends ModelWidg this.useWhenFields = parent.useWhenFields; - //these are done below in a special way... - //this.fieldList = parent.fieldList; - //this.fieldMap = parent.fieldMap; - // Create this fieldList/Map from clones of parent's for (ModelFormField parentChildField: parent.fieldList) { ModelFormField childField = new ModelFormField(this); @@ -539,7 +532,6 @@ public class ModelForm extends ModelWidg } else { modelFormField = this.addUpdateField(modelFormField); } - //Debug.logInfo("Added field " + modelFormField.getName() + " from def, mapName=" + modelFormField.getMapName(), module); } // Create the default field group @@ -1516,8 +1508,6 @@ public class ModelForm extends ModelWidg getListLimits(context, obj); int listSize = ((Integer) context.get("listSize")).intValue(); - //int viewIndex = ((Integer) context.get("viewIndex")).intValue(); - //int viewSize = ((Integer) context.get("viewSize")).intValue(); int lowIndex = ((Integer) context.get("lowIndex")).intValue(); int highIndex = ((Integer) context.get("highIndex")).intValue(); @@ -3272,7 +3262,6 @@ public class ModelForm extends ModelWidg ModelFormField.HyperlinkField link = (ModelFormField.HyperlinkField) modelFormField.getFieldInfo(); String target = link.getTarget(null); String urlMode = link.getTargetType(); - // Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "] with target [" + target + "]", module); Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode); if (controllerLocAndRequestSet != null) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java Mon Oct 6 08:07:22 2014 @@ -32,8 +32,6 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; -import org.ofbiz.entity.Delegator; -import org.ofbiz.service.LocalDispatcher; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; @@ -94,24 +92,13 @@ public class MenuFactory { return modelMenuMap; } - @Deprecated - public static Map<String, ModelMenu> readMenuDocument(Document menuFileDoc, Delegator delegator, LocalDispatcher dispatcher, String menuLocation) { - return readMenuDocument(menuFileDoc, menuLocation); - } - public static ModelMenu getMenuFromLocation(String resourceName, String menuName) throws IOException, SAXException, ParserConfigurationException { Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { synchronized (MenuFactory.class) { modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = MenuFactory.class.getClassLoader(); - } - - URL menuFileUrl = null; - menuFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL menuFileUrl = FlexibleLocation.resolveLocation(resourceName); Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true); modelMenuMap = readMenuDocument(menuFileDoc, resourceName); menuLocationCache.put(resourceName, modelMenuMap); @@ -129,11 +116,4 @@ public class MenuFactory { } return modelMenu; } - - @Deprecated - public static ModelMenu getMenuFromLocation(String resourceName, String menuName, Delegator delegator, LocalDispatcher dispatcher) - throws IOException, SAXException, ParserConfigurationException { - return getMenuFromLocation(resourceName, menuName); - } - } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Mon Oct 6 08:07:22 2014 @@ -24,20 +24,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.ofbiz.base.util.BshUtil; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; -import org.ofbiz.entity.Delegator; -import org.ofbiz.service.LocalDispatcher; import org.ofbiz.widget.ModelWidget; import org.w3c.dom.Element; -import bsh.EvalError; -import bsh.Interpreter; - /** * Widget Library - Menu model class */ @@ -209,7 +203,6 @@ public class ModelMenu extends ModelWidg this.defaultCellWidth = menuElement.getAttribute("default-cell-width"); if (menuElement.hasAttribute("default-hide-if-selected")) { String val = menuElement.getAttribute("default-hide-if-selected"); - //Debug.logInfo("in ModelMenu, hideIfSelected, val:" + val, module); if (val != null && val.equalsIgnoreCase("true")) defaultHideIfSelected = Boolean.TRUE; else @@ -250,49 +243,28 @@ public class ModelMenu extends ModelWidg } } - @Deprecated - public ModelMenu(Element menuElement, Delegator delegator, LocalDispatcher dispatcher) { - this(menuElement); - } /** * add/override modelMenuItem using the menuItemList and menuItemMap * * @return The same ModelMenuItem, or if merged with an existing item, the existing item. */ public ModelMenuItem addUpdateMenuItem(ModelMenuItem modelMenuItem) { - - // not a conditional item, see if a named item exists in Map - ModelMenuItem existingMenuItem = this.menuItemMap.get(modelMenuItem.getName()); - if (existingMenuItem != null) { - // does exist, update the item by doing a merge/override - existingMenuItem.mergeOverrideModelMenuItem(modelMenuItem); - return existingMenuItem; - } else { - // does not exist, add to List and Map - this.menuItemList.add(modelMenuItem); - this.menuItemMap.put(modelMenuItem.getName(), modelMenuItem); - return modelMenuItem; - } - } - - public ModelMenuItem getModelMenuItemByName(String name) { - ModelMenuItem existingMenuItem = this.menuItemMap.get(name); + // not a conditional item, see if a named item exists in Map + ModelMenuItem existingMenuItem = this.menuItemMap.get(modelMenuItem.getName()); + if (existingMenuItem != null) { + // does exist, update the item by doing a merge/override + existingMenuItem.mergeOverrideModelMenuItem(modelMenuItem); return existingMenuItem; + } else { + // does not exist, add to List and Map + this.menuItemList.add(modelMenuItem); + this.menuItemMap.put(modelMenuItem.getName(), modelMenuItem); + return modelMenuItem; + } } - public ModelMenuItem getModelMenuItemByContentId(String contentId, Map<String, Object> context) { - - ModelMenuItem existingMenuItem = null; - if (UtilValidate.isEmpty(contentId)) - return existingMenuItem; - for (ModelMenuItem mi : this.menuItemList) { - String assocContentId = mi.getAssociatedContentId(context); - if (contentId.equals(assocContentId)) { - existingMenuItem = mi; - break; - } - } - return existingMenuItem; + public ModelMenuItem getModelMenuItemByName(String name) { + return this.menuItemMap.get(name); } /** @@ -311,19 +283,12 @@ public class ModelMenu extends ModelWidg * use the same menu definitions for many types of menu UIs */ public void renderMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { - - boolean passed = true; - - //Debug.logInfo("in ModelMenu, name:" + this.getName(), module); - if (passed) { - ModelMenuAction.runSubActions(this.actions, context); - if ("simple".equals(this.type)) { - this.renderSimpleMenuString(writer, context, menuStringRenderer); - } else { - throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName()); - } + ModelMenuAction.runSubActions(this.actions, context); + if ("simple".equals(this.type)) { + this.renderSimpleMenuString(writer, context, menuStringRenderer); + } else { + throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName()); } - //Debug.logInfo("in ModelMenu, buffer:" + buffer.toString(), module); } public int renderedMenuItemCount(Map<String, Object> context) @@ -337,21 +302,15 @@ public class ModelMenu extends ModelWidg } public void renderSimpleMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { - //Iterator menuItemIter = null; - //Set alreadyRendered = new TreeSet(); - // render menu open menuStringRenderer.renderMenuOpen(writer, context, this); // render formatting wrapper open menuStringRenderer.renderFormatSimpleWrapperOpen(writer, context, this); - //Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module); // render each menuItem row, except hidden & ignored rows - // include portal pages if specified - //menuStringRenderer.renderFormatSimpleWrapperRows(writer, context, this); for (ModelMenuItem item : this.menuItemList) { - item.renderMenuItemString(writer, context, menuStringRenderer); + item.renderMenuItemString(writer, context, menuStringRenderer); } // render formatting wrapper close menuStringRenderer.renderFormatSimpleWrapperClose(writer, context, this); @@ -360,22 +319,6 @@ public class ModelMenu extends ModelWidg menuStringRenderer.renderMenuClose(writer, context, this); } - /** - * @deprecated Use getDispatcher(Map<String, Object>) instead, this method will throw an {@link UnsupportedOperationException} if used - */ - @Deprecated - public LocalDispatcher getDispacher() { - throw new UnsupportedOperationException("This method is no longer supported, use getDispatcher(Map<String, Object>) instead."); - } - - /** - * @deprecated Use getDelegator(Map<String, Object>) instead, this method will throw an {@link UnsupportedOperationException} if used - */ - @Deprecated - public Delegator getDelegator() { - throw new UnsupportedOperationException("This method is no longer supported, use getDelegator(Map<String, Object>) instead."); - } - public String getDefaultEntityName() { return this.defaultEntityName; } @@ -388,7 +331,6 @@ public class ModelMenu extends ModelWidg return this.defaultAlignStyle; } - public String getDefaultTitleStyle() { return this.defaultTitleStyle; } @@ -450,15 +392,6 @@ public class ModelMenu extends ModelWidg return menuLocation + "#" + name; } - public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError { - Interpreter bsh = (Interpreter) context.get("bshInterpreter"); - if (bsh == null) { - bsh = BshUtil.makeInterpreter(context); - context.put("bshInterpreter", bsh); - } - return bsh; - } - /** * @param string */ Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Mon Oct 6 08:07:22 2014 @@ -39,7 +39,6 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.PortalPageWorker; import org.w3c.dom.Element; @@ -78,10 +77,6 @@ public class ModelMenuItem { protected List<ModelMenuItem> menuItemList = new LinkedList<ModelMenuItem>(); protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>(); - - public static String DEFAULT_TARGET_TYPE = "intra-app"; - - protected EntityPermissionChecker permissionChecker; protected ModelMenuItem parentMenuItem; protected ModelMenuCondition condition; protected boolean disabled = false; @@ -137,7 +132,6 @@ public class ModelMenuItem { this.cellWidth = fieldElement.getAttribute("cell-width"); dataMap.put("name", this.name); - //dataMap.put("associatedContentId", this.associatedContentId); Element subMenuElement = UtilXml.firstChildElement(fieldElement, "sub-menu"); if (subMenuElement != null) { @@ -161,21 +155,15 @@ public class ModelMenuItem { } Element linkElement = UtilXml.firstChildElement(fieldElement, "link"); - //if (Debug.infoOn()) Debug.logInfo("in ModelMenuItem, linkElement:" + linkElement, module); if (linkElement != null) { link = new Link(linkElement, this); } -// Element permissionElement = UtilXml.firstChildElement(fieldElement, "if-entity-permission"); -// if (permissionElement != null) -// permissionChecker = new EntityPermissionChecker(permissionElement); - // read in add item defs, add/override one by one using the menuItemList and menuItemMap List<? extends Element> itemElements = UtilXml.childElementList(fieldElement, "menu-item"); for (Element itemElement: itemElements) { ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this); modelMenuItem = this.addUpdateMenuItem(modelMenuItem); - //Debug.logInfo("Added item " + modelMenuItem.getName() + " from def, mapName=" + modelMenuItem.getMapName(), module); } // read condition under the "condition" element Element conditionElement = UtilXml.firstChildElement(fieldElement, "condition"); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Mon Oct 6 08:07:22 2014 @@ -350,13 +350,6 @@ public abstract class ModelScreenWidget return this.autoUpdateTargetExdr.expandString(context); } - /** - * @deprecated Use the version that takes a context parameter. - */ - public String getAutoUpdateInterval() { - return this.autoUpdateInterval.getOriginal(); - } - public String getAutoUpdateInterval(Map<String, Object> context) { return this.autoUpdateInterval.expandString(context); } @@ -584,7 +577,7 @@ public abstract class ModelScreenWidget context.put("_WIDGETTRAIL_", widgetTrail); } - // dont need the renderer here, will just pass this on down to another screen call; screenStringRenderer.renderContainerBegin(writer, context, this); + // don't need the renderer here, will just pass this on down to another screen call; screenStringRenderer.renderContainerBegin(writer, context, this); String name = this.getName(context); String location = this.getLocation(context); @@ -821,7 +814,6 @@ public abstract class ModelScreenWidget UtilGenerics.<MapStack<String>>cast(context).push(); } ModelForm modelForm = getModelForm(context); - //Debug.logInfo("before renderFormString, context:" + context, module); try { modelForm.renderFormString(writer, context, formStringRenderer); } catch (IOException e) { @@ -1081,91 +1073,8 @@ public abstract class ModelScreenWidget mimeTypeId = content.getString("mimeTypeId"); } - if (UtilValidate.isNotEmpty(mimeTypeId) - && ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0)) { - -/* - // this code is not yet working, will update it the next few weeks...(Hans) - if (mimeTypeId.equals("application/pdf")) { - TransformerFactory tfactory = TransformerFactory.newInstance(); - try { - - // - // this part is not working. If somebody can help to make it work? - // currently using only real temp files for debugging purposes. - // - // most of the code should be replaced by functions in xslTransform.java and other files. - // for debugging here mostly code using the code outside of ofbiz. - // - SAXParserFactory pfactory= SAXParserFactory.newInstance(); - pfactory.setNamespaceAware(true); - pfactory.setValidating(true); - pfactory.setXIncludeAware(true); - XMLReader reader = null; - try { - reader = pfactory.newSAXParser().getXMLReader(); - } catch (Exception e) { - throw new TransformerException("Error creating SAX parser/reader", e); - } - - // do the actual preprocessing fr includes - String fileName = "/home/hans/ofbiz/svn/applications/commonext/documents/ApacheOfbiz.xml"; - SAXSource source = new SAXSource(reader, new InputSource(fileName)); - // compile the xsl template - Transformer transformer1 = tfactory.newTransformer(new StreamSource("/home/hans/ofbiz/svn/applications/content/template/docbook/fo/docbook.xsl")); - // and apply the xsl template to the source document and save in a result string - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - transformer1.transform(source, sr); - // store into a file for debugging -// java.io.FileWriter fw = new java.io.FileWriter(new java.io.File("/tmp/file1.fo")); -// fw.write(sw.toString()); -// fw.close(); - - - FopFactory fopFactory = FopFactory.newInstance(); - FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); - // configure foUserAgent as desired - - // Setup output stream. Note: Using BufferedOutputStream - // for performance reasons (helpful with FileOutputStreams). -// OutputStream out = new FileOutputStream("/tmp/file.pdf"); -// out = new BufferedOutputStream(out); -// OutputStream outWriter = (OutputStream) writer; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); - - // Setup JAXP using identity transformer - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); // identity transformer - - // Setup input stream - Source src = new StreamSource(new ByteArrayInputStream(sw.toString().getBytes())); - - // Resulting SAX events (the generated FO) must be piped through to FOP - Result result = new SAXResult(fop.getDefaultHandler()); - - // Start XSLT transformation and FOP processing - transformer.transform(src, result); - - out.flush(); - out.close(); - // to a file for debugging - FileOutputStream fw = new FileOutputStream("/tmp/file.pdf"); - fw.write(out.toByteArray()); - fw.close(); - HttpServletResponse response = (HttpServletResponse) context.get("response"); - response.setContentType("application/pdf"); - response.setContentLength(out.size()); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - writer.append(new String(out.toByteArray())); - } catch(Exception e) { - Debug.logError("Exception converting from FO to PDF: " + e, module); - } - } else { -*/ screenStringRenderer.renderContentFrame(writer, context, this); -// } - } else { + if (!(UtilValidate.isNotEmpty(mimeTypeId) + && ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0))) { screenStringRenderer.renderContentBegin(writer, context, this); screenStringRenderer.renderContentBody(writer, context, this); screenStringRenderer.renderContentEnd(writer, context, this); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java Mon Oct 6 08:07:22 2014 @@ -113,13 +113,8 @@ public class ScreenFactory { modelScreenMap = screenLocationCache.get(resourceName); if (modelScreenMap == null) { long startTime = System.currentTimeMillis(); - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = ScreenFactory.class.getClassLoader(); - } - URL screenFileUrl = null; - screenFileUrl = FlexibleLocation.resolveLocation(resourceName, loader); + screenFileUrl = FlexibleLocation.resolveLocation(resourceName); if (screenFileUrl == null) { throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java?rev=1629587&r1=1629586&r2=1629587&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java Mon Oct 6 08:07:22 2014 @@ -23,12 +23,9 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; import javax.xml.parsers.ParserConfigurationException; import org.ofbiz.base.location.FlexibleLocation; -import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.entity.Delegator; @@ -46,7 +43,6 @@ public class TreeFactory { public static final String module = TreeFactory.class.getName(); public static final UtilCache<String, Map<String, ModelTree>> treeLocationCache = UtilCache.createUtilCache("widget.tree.locationResource", 0, 0, false); - public static final UtilCache<String, Map<String, ModelTree>> treeWebappCache = UtilCache.createUtilCache("widget.tree.webappResource", 0, 0, false); public static ModelTree getTreeFromLocation(String resourceName, String treeName, Delegator delegator, LocalDispatcher dispatcher) throws IOException, SAXException, ParserConfigurationException { @@ -76,36 +72,6 @@ public class TreeFactory { return modelTree; } - public static ModelTree getTreeFromWebappContext(String resourceName, String treeName, HttpServletRequest request) - throws IOException, SAXException, ParserConfigurationException { - String webappName = UtilHttp.getApplicationName(request); - String cacheKey = webappName + "::" + resourceName; - - - Map<String, ModelTree> modelTreeMap = treeWebappCache.get(cacheKey); - if (modelTreeMap == null) { - synchronized (TreeFactory.class) { - modelTreeMap = treeWebappCache.get(cacheKey); - if (modelTreeMap == null) { - ServletContext servletContext = (ServletContext) request.getAttribute("servletContext"); - Delegator delegator = (Delegator) request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - - URL treeFileUrl = servletContext.getResource(resourceName); - Document treeFileDoc = UtilXml.readXmlDocument(treeFileUrl, true, true); - modelTreeMap = readTreeDocument(treeFileDoc, delegator, dispatcher, cacheKey); - treeWebappCache.put(cacheKey, modelTreeMap); - } - } - } - - ModelTree modelTree = modelTreeMap.get(treeName); - if (modelTree == null) { - throw new IllegalArgumentException("Could not find tree with name [" + treeName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]"); - } - return modelTree; - } - public static Map<String, ModelTree> readTreeDocument(Document treeFileDoc, Delegator delegator, LocalDispatcher dispatcher, String treeLocation) { Map<String, ModelTree> modelTreeMap = new HashMap<String, ModelTree>(); if (treeFileDoc != null) {