Hi, everybody! How is it possible to use entity-auto? I tried to use it, created service according to begiiner's guide my service <service name="updatePracticePerson" default-entity-name="Person" engine="entity-auto" invoke="update" auth="true"> <description>update a Person</description> <permission-service service-name="basePermissionCheck" main-action="UPDATE"/> <auto-attributes include="pk" mode="IN" optional="false"/> <attribute name="salutation" mode="IN" type="String" optional="true"/> <attribute name="firstName" mode="IN" type="String" optional="false"/> <attribute name="middleName" mode="IN" type="String" optional="true"/> <attribute name="lastName" mode="IN" type="String" optional="false"/> <attribute name="suffix" mode="IN" type="String" optional="true"/> </service> <service name="basePermissionCheck" engine="simple" location="component://rt/script/PracticeServices.xml" invoke="basePermissionCheck"> <description> Performs a basic security check. The user must have one of the base CRUD+ADMIN permissions. </description> <implements service="permissionInterface"/> </service> in controller I added entry <request-map uri="updatePracticePerson"> <security https="true" auth="true"/> <event type="service" invoke="updatePracticePerson"/> <response name="success" type="view" value="PersonForm"/> </request-map> I've tested it, but it doesn't work. It shows me update and delete buttons, but data were not updated. Best regards, Alexey. |
Hi Alexey,
As a test I would temporarily comment out the third line of your service "updatePracticePerson" as follows: <!-- <permission-service service-name="basePermissionCheck" main-action="UPDATE"/> --> That way temporarily you would not call the service "basePermissionCheck" and subsequently service "permissionInterface". With this modification you would truly test the "entity-auto" "UPDATE" function only. In case that with this temporary modification you would be able to perform the update of the Person data it would mean that you have an error in the service "basePermissionCheck" Only in case that the update of the Person data still could not be performed with this temporary modification you would know that your error is related to the "entity-auto" "update" functionality. This should help you to localize the error. Hope this helps. Peter |
Hi! Thanks Peter Arnold ( [hidden email] ) for help. After commenting <!-- <permission-service service-name="basePermissionCheck" main-action="UPDATE"/> --> update works, so problem was with the permission-service. But "create" doesn't work. I created special test enitity definition to test create <entity entity-name="Test" package-name="org.ofbiz.test" title="One record for each test element"> <field name="idf" type="id-ne"></field> <field name="number" type="numeric"></field> <prim-key field="idf"/> </entity> and added it to form <form name="CreateTestForm" type="single" target="createTest"> <auto-fields-service service-name="createTest"/> <field name="submitButton" title="Create" widget-style="smallSubmit"><submit button-type="button"/></field> </form> screens <screen name="TestForm"> <section> <actions> <set field="headerItem" value="personForm"/> <set field="titleProperty" value="PageTitlePracticePersonForm"/> </actions> <widgets> <decorator-screen name="CommonWarrantDecorator" location="${parameters.commonDecoratorLocation}"> <decorator-section name="body"> <label text="Test List" style="h2"/> <include-form name="CreateTestForm" location="component://rt/widget/WarrantForms.xml"></include-form> </decorator-section> </decorator-screen> </widgets> </section> </screen> and controller <request-map uri="testform"> <security https="true" auth="true"/> <event type="service" invoke="createTest"/> <response name="success" type="view" value="TestForm"/> </request-map> <request-map uri="createTest"> <security https="true" auth="true"/> <event type="service" invoke="createTest"/> <response name="success" type="view" value="TestForm"/> </request-map> Form appeared, but after clicking on create button nothing was added (I tried to view added data in webtools -> Entity Engine) Best regards, Alexey. |
Free forum by Nabble | Edit this page |