I'm hoping to get some feedback on creating a best
practice regarding create/update/delete entity methods
and then implementing it in JIRA.

In the project supported naming convention I'm wanting
to implement the following:

Simple method names createEntityName,
updateEntityName, and deleteEntityName should be
reserved names for the basic create, update and delete
of the entity name.  Simple enough, this is pretty
much how it's currently done, just reinforcing the
maintainance of it.

In addition, methods with createEntityName,
updateEntityName and deleteEntityName should not check
permissions.  Rather simple methods that check
permission should then call the service (or the simple
method directly if there is a performance difference).

for example, in the simple method
org/ofbiz/accounting/agreement/AgreementServices.xml#createAgreementItems
should be split into two methods.

the first being
<simple-method method-name="secureCreateAgreementItem"
description="create AgreementItem with a security
check">
<check-permission permission="ACCOUNTING"
action="_CREATE"/>
<set-service-fields to-map-name="newEntity"
service-name="createAgreementItem"
map-name="parameters"/>
<call-service service-name="createAgreementItem"
in-map-name="newEntity"/>
</simple-method>

and the second being the method that exists less the
check-permission element


This would allow for easier seperation of the data
layer from the business layer and thus an easier way
of modularizing the components. And perhaps even lead
the way to creating components programatically a la
Ruby on Ofbiz?

Reply via email to