RequestScoped <ConversationScoped < SessionScoped
http://stackoverflow.com/questions/7788430/how-does-jsf-2-conversationscope-work
http://docs.oracle.com/javaee/6/api/javax/enterprise/context/ConversationScoped.html
What is CDI?
http://refcardz.dzone.com/refcardz/contexts-and-depencency?oid=hom16925
http://sfwk.org/Documentation/WhatIsThePurposeOfTheModelAnnotation
http://docs.oracle.com/javaee/6/tutorial/doc/gkhic.html
public void creditPayment(@Observes @Credit PaymentEvent event) { ... } public void debitPayment(@Observes @Debit PaymentEvent event) { ... }
Observer methods can also be conditional or transactional:
A conditional observer method is notified of an event only if an instance of the bean that defines the observer method already exists in the current context. To declare a conditional observer method, specifynotifyObserver=IF_EXISTS as an argument to @Observes:
@Observes(notifyObserver=IF_EXISTS)
To obtain the default unconditional behavior, you can specify @Observes(notifyObserver=ALWAYS).
A transactional observer method is notified of an event during the before completion or after completion phase of the transaction in which the event was fired. You can also specify that the notification is to occur only after the transaction has completed successfully or unsuccessfully. To specify a transactional observer method, use any of the following arguments to @Observes:
@Observes(during=BEFORE_COMPLETION) @Observes(during=AFTER_COMPLETION) @Observes(during=AFTER_SUCCESS) @Observes(during=AFTER_FAILURE)
To obtain the default non-transactional behavior, specify @Observes(during=IN_PROGRESS).
An observer method that is called before completion of a transaction may call the setRollbackOnlymethod on the transaction instance to force a transaction rollback.
Decorator vs. Interceptor
Decorators are outwardly similar to interceptors. However, they actually perform tasks complementary to those performed by interceptors. Interceptors perform cross-cutting tasks associated with method invocation and with the lifecycles of beans, but cannot perform any business logic. Decorators, on the other hand, do perform business logic by intercepting business methods of beans. This means that instead of being reusable for different kinds of applications as interceptors are, their logic is specific to a particular application.
If an application has both interceptors and decorators, the interceptors are invoked first. This means, in effect, that you cannot intercept a decorator.
decorator http://docs.jboss.org/cdi/spec/1.0/html/decorators.html