org.milyn.persistence
Class EntityLocator

java.lang.Object
  extended by org.milyn.persistence.EntityLocator
All Implemented Interfaces:
ContentHandler, DOMElementVisitor, DOMVisitAfter, DOMVisitBefore, DOMVisitor, Consumer, Producer, SAXVisitAfter, SAXVisitBefore, SAXVisitor, Visitor

public class EntityLocator
extends Object
implements DOMElementVisitor, SAXVisitBefore, SAXVisitAfter, Producer, Consumer

DAO Locator

This DAO locator uses lookup methods or methods that accept a query to lookup entities from a data source. In case of a query it depends on the DAO or the Scribe adapter what the query language is.

Configuration

Namespace: http://www.milyn.org/xsd/smooks/persistence-1.2.xsd
Element: locator
Attributes: Take a look at the schema for all the information on the configurations parameters.

Configuration Example

 <?xml version="1.0"?>
 <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
    xmlns:dao="http://www.milyn.org/xsd/smooks/persistence-1.2.xsd">
      <dao:locator beanId="entity" lookup="something" lookupOnElement="b">
      <dao:params>
         <dao:value name="arg1" decoder="Integer" data="c" />
         <dao:expression name="arg2">dAnde.d + dAnde.e</dao:expression>
         <dao:wiring name="arg3" beanIdRef="dAnde" wireOnElement="e" />
         <dao:value name="arg4" data="f/@name" />
         <dao:value name="arg5" decoder="Date" data="g" >
            <dao:decodeParam name="format">yyyy-MM-dd HH:mm:ss</dao:decodeParam>
         </dao:value>
      </dao:params>
  </dao:locator>

  <dao:locator beanId="customer" lookupOnElement="b">
     <dao:query>from Customer c where c.id = :arg1</dao:query>
     <dao:params>
        <dao:value name="arg1" decoder="Integer" data="c" />
     </dao:params>
  </dao:locator>
 </smooks-resource-list>
 

Author:
maurice.zeijen@smies.com

Constructor Summary
EntityLocator()
           
 
Method Summary
 boolean consumes(Object object)
           
 Set<? extends Object> getProducts()
           
 void initialize()
           
 void initParameterContainer(ExecutionContext executionContext)
           
 void lookup(ExecutionContext executionContext, Fragment source)
           
 Object lookup(Object dao, ExecutionContext executionContext)
           
 void visitAfter(Element element, ExecutionContext executionContext)
           
 void visitAfter(SAXElement element, ExecutionContext executionContext)
           
 void visitBefore(Element element, ExecutionContext executionContext)
           
 void visitBefore(SAXElement element, ExecutionContext executionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityLocator

public EntityLocator()
Method Detail

initialize

@Initialize
public void initialize()
                throws SmooksConfigurationException
Throws:
SmooksConfigurationException

getProducts

public Set<? extends Object> getProducts()
Specified by:
getProducts in interface Producer

consumes

public boolean consumes(Object object)
Specified by:
consumes in interface Consumer

visitBefore

public void visitBefore(Element element,
                        ExecutionContext executionContext)
                 throws SmooksException
Specified by:
visitBefore in interface DOMVisitBefore
Throws:
SmooksException

visitBefore

public void visitBefore(SAXElement element,
                        ExecutionContext executionContext)
                 throws SmooksException,
                        IOException
Specified by:
visitBefore in interface SAXVisitBefore
Throws:
SmooksException
IOException

visitAfter

public void visitAfter(Element element,
                       ExecutionContext executionContext)
                throws SmooksException
Specified by:
visitAfter in interface DOMVisitAfter
Throws:
SmooksException

visitAfter

public void visitAfter(SAXElement element,
                       ExecutionContext executionContext)
                throws SmooksException,
                       IOException
Specified by:
visitAfter in interface SAXVisitAfter
Throws:
SmooksException
IOException

initParameterContainer

public void initParameterContainer(ExecutionContext executionContext)

lookup

public void lookup(ExecutionContext executionContext,
                   Fragment source)

lookup

public Object lookup(Object dao,
                     ExecutionContext executionContext)


Copyright © 2011. All Rights Reserved.