org.milyn.persistence
Class EntityUpdater
java.lang.Object
org.milyn.persistence.EntityUpdater
- All Implemented Interfaces:
- org.milyn.delivery.ContentHandler, org.milyn.delivery.dom.DOMElementVisitor, org.milyn.delivery.dom.DOMVisitAfter, org.milyn.delivery.dom.DOMVisitBefore, org.milyn.delivery.dom.DOMVisitor, org.milyn.delivery.ordering.Consumer, org.milyn.delivery.ordering.Producer, org.milyn.delivery.sax.SAXVisitAfter, org.milyn.delivery.sax.SAXVisitBefore, org.milyn.delivery.sax.SAXVisitor, org.milyn.delivery.Visitor
@VisitBeforeIf(condition="parameters.containsKey(\'updateBefore\') && parameters.updateBefore.value == \'true\'")
@VisitAfterIf(condition="!parameters.containsKey(\'updateBefore\') || parameters.updateBefore.value != \'true\'")
public class EntityUpdater
- extends Object
- implements org.milyn.delivery.dom.DOMElementVisitor, org.milyn.delivery.sax.SAXVisitBefore, org.milyn.delivery.sax.SAXVisitAfter, org.milyn.delivery.ordering.Producer, org.milyn.delivery.ordering.Consumer
DAO Updater
This DAO updater calls the update method of a DAO, using a entity bean from
the bean context as parameter.
Configuration
Namespace: http://www.milyn.org/xsd/smooks/persistence-1.2.xsd
Element: updater
Attributes:
- beanId : The id under which the entity bean is bound in the bean context. (required)
- updateOnElement : The element selector to select the element when the inserter should execute. (required)
- dao : The name of the DAO that will be used. If it is not set then the default DAO is used. (optional)
- name* : The name of the update method. Depending of the adapter this can mean different things.
For instance when using annotated DAO's you can name the methods and target them with this property, but
when using the Ibatis adapter you set the id of the Ibatis statement in this attribute. (optional)
- updatedBeanId : The bean id under which the updated bean will be stored. If not set then the object returned
by the update method will not be stored in bean context. (optional)
- updateBefore : If the updater should execute on the 'before' event. (default: false)
* This attribute is not supported by all scribe adapters.
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:updater dao="dao" name="updateIt" beanId="toUpdate" updateOnElement="root" updateBeanId="updated" updateBefore="false" />
</smooks-resource-list>
- Author:
- maurice.zeijen@smies.com
|
Method Summary |
boolean |
consumes(Object object)
|
Set<? extends Object> |
getProducts()
|
void |
initialize()
|
void |
visitAfter(Element element,
org.milyn.container.ExecutionContext executionContext)
|
void |
visitAfter(org.milyn.delivery.sax.SAXElement element,
org.milyn.container.ExecutionContext executionContext)
|
void |
visitBefore(Element element,
org.milyn.container.ExecutionContext executionContext)
|
void |
visitBefore(org.milyn.delivery.sax.SAXElement element,
org.milyn.container.ExecutionContext executionContext)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EntityUpdater
public EntityUpdater()
initialize
@Initialize
public void initialize()
throws org.milyn.cdr.SmooksConfigurationException
- Throws:
org.milyn.cdr.SmooksConfigurationException
getProducts
public Set<? extends Object> getProducts()
- Specified by:
getProducts in interface org.milyn.delivery.ordering.Producer
consumes
public boolean consumes(Object object)
- Specified by:
consumes in interface org.milyn.delivery.ordering.Consumer
visitBefore
public void visitBefore(Element element,
org.milyn.container.ExecutionContext executionContext)
throws org.milyn.SmooksException
- Specified by:
visitBefore in interface org.milyn.delivery.dom.DOMVisitBefore
- Throws:
org.milyn.SmooksException
visitAfter
public void visitAfter(Element element,
org.milyn.container.ExecutionContext executionContext)
throws org.milyn.SmooksException
- Specified by:
visitAfter in interface org.milyn.delivery.dom.DOMVisitAfter
- Throws:
org.milyn.SmooksException
visitBefore
public void visitBefore(org.milyn.delivery.sax.SAXElement element,
org.milyn.container.ExecutionContext executionContext)
throws org.milyn.SmooksException,
IOException
- Specified by:
visitBefore in interface org.milyn.delivery.sax.SAXVisitBefore
- Throws:
org.milyn.SmooksException
IOException
visitAfter
public void visitAfter(org.milyn.delivery.sax.SAXElement element,
org.milyn.container.ExecutionContext executionContext)
throws org.milyn.SmooksException,
IOException
- Specified by:
visitAfter in interface org.milyn.delivery.sax.SAXVisitAfter
- Throws:
org.milyn.SmooksException
IOException
Copyright © 2018. All rights reserved.