Skip to content

Instantly share code, notes, and snippets.

@os890
os890 / WeldBeanFilter.java
Last active December 16, 2015 11:29
veto beans for weld
public class WeldFilter implements Extension
{
public void vetoForWeld(@Observes ProcessAnnotatedType processAnnotatedType, BeanManager beanManager)
{
if (!beanManager.getClass().getName().contains("org.apache."))
{
processAnnotatedType.veto();
}
}
}
//nesting leads to the path of a page (-> view-id) and inheritance to meta-data-inheritance
//currently there would be no ide support to show where the meta-data comes from in case of meta-data-inheritance via nesting
//(it's easy to see in small applications but difficult in large applications)
//represents a folder
@Page(navigation = REDIRECT)
public interface Pages
{
//represents a folder
//can be referenced via @ConversationGroup, @View, @Matches,...
//for a partial integration in GlassFish3 in case of:
//java.lang.NullPointerException at com.sun.jersey.server.impl.cdi.CDIExtension.processAnnotatedField
public class JerseyAwareLoaderService extends DefaultLoaderService
{
@Override
public <T> List<T> load(Class<T> serviceType, ClassLoader classLoader)
{
List<T> result = super.load(serviceType, classLoader);
@ConversationScoped
public class ConversationAwareNoSqlTransactionProxy implements Transaction, Serializable
{
private NoSqlDb noSqlDb; //handle serialization (if needed/supported)
private Transaction transaction; //handle serialization (if needed/supported)
//required by proxy libs
protected ConversationAwareNoSqlTransactionProxy()
{
}
@ApplicationScoped
public class SimulatedViewScopeObserver
{
protected void observeNavigation(
@Observes PreViewConfigNavigateEvent preViewConfigNavigateEvent,
EditableWindowContext editableWindowContext)
{
if (!preViewConfigNavigateEvent.getFromView()
.equals(preViewConfigNavigateEvent.getToView()))
{
import org.os890.codi.addon.conversation.api.ViewConversationScoped;
import javax.annotation.PostConstruct;
import javax.inject.Named;
import java.io.Serializable;
import java.util.Date;
@Named
@ViewConversationScoped
public class ViewConversationBean implements Serializable
class ViewConversationExpirationEvaluator
implements ConversationExpirationEvaluator
{
private static final long serialVersionUID = -1298186767354202960L;
private String viewId;
private boolean expired;
ViewConversationExpirationEvaluator()
{
if(FacesContext.getCurrentInstance().getViewRoot() != null)