Difference between revisions of "Working with the Domain Driven Architecture"

From Opentaps Wiki
Jump to navigationJump to search
Line 29: Line 29:
 
     */
 
     */
 
</pre>
 
</pre>
 +
 +
====Working with Entity Field Names====

Revision as of 18:23, 10 December 2008

Here are some tips for working with the Domain Driven Architecture:

Instantiating Services and Repositories

If you have a domain, the easiest way to instantiate a Service or Repository from your domain is to use the instantiateService or instantiateRepository methods, like this:

    public OrderInventoryService getOrderInventoryService() throws ServiceException {
        return instantiateService(OrderInventoryService.class);
    }

This will automatically set up the Infrastructure and User for your Service or Repository.

Documenting your Services

Since your domain Services do not have to be routed through the ofbiz service engine, you should put the documentation in the Java method so that they would show up in the Java docs as well. For example:

   /**
    * Adds a <code>LockboxBatchItemDetail</code> to an existing
<code>LockboxBatchItem</code>.
    * @throws ServiceException if an error occurs
    * @see #setLockboxBatchId required input <code>lockboxBatchId</code>
    * @see #setItemSeqId required input <code>itemSeqId</code>
    * @see #setAmountToApply required input <code>amountToApply</code>
    * @see #setCashDiscount required input <code>cashDiscount</code>
    * @see #setPartyId optional input <code>partyId</code>
    * @see #setInvoiceId optional input <code>invoiceId</code>
    */

Working with Entity Field Names