Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View CustomerBean.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
package com.example.view;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.ejb.Stateful;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
 
import org.jboss.seam.transaction.Transactional;
import org.metawidget.forge.navigation.MenuItem;
import org.metawidget.forge.persistence.PaginationHelper;
import org.metawidget.forge.persistence.PersistenceUtil;
 
import com.example.domain.Customer;
 
@Transactional
@Named
@Stateful
@RequestScoped
public class CustomerBean extends PersistenceUtil implements MenuItem
{
private static final long serialVersionUID = 1L;
private List<Customer> list = null;
private Customer customer = new Customer();
private long id = 0;
private PaginationHelper<Customer> pagination;
 
public Class<?> getItemType()
{
return Customer.class;
}
 
public String getLiteralPath()
{
return null;
}
 
public String getLabel()
{
return null;
}
 
public void load()
{
customer = findById(Customer.class, id);
}
 
public String create()
{
create(customer);
return "view?faces-redirect=true&id=" + customer.getId();
}
 
public String delete()
{
delete(customer);
return "list?faces-redirect=true";
}
 
public String save()
{
save(customer);
return "view?faces-redirect=true&id=" + customer.getId();
}
 
public long getId()
{
return id;
}
 
public void setId(final long id)
{
this.id = id;
if (id > 0) {
load();
}
}
 
public Customer getCustomer()
{
return customer;
}
 
public void setCustomer(final Customer customer)
{
this.customer = customer;
}
 
public List<Customer> getList()
{
if (list == null) {
list = getPagination().createPageDataModel();
}
return list;
}
 
public void setList(final List<Customer> list)
{
this.list = list;
}
 
public PaginationHelper<Customer> getPagination()
{
if (pagination == null) {
pagination = new PaginationHelper<Customer>(10) {
@Override
public int getItemsCount()
{
return count(Customer.class);
}
 
@Override
public List<Customer> createPageDataModel()
{
return new ArrayList<Customer>(findAll(Customer.class, getPageFirstItem(), getPageSize()));
}
};
}
return pagination;
}
 
public void setPagination(final PaginationHelper<Customer> helper)
{
pagination = helper;
}
}
View CustomerBean.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*
* JBoss, Home of Professional Open Source
* Copyright 2011, Red Hat, Inc., and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.metawidget.forge.navigation;
 
/**
* Represents an item that should be displayed in scaffolded menus.
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface MenuItem
{
/**
* Get the scaffolded entity type to which this item will navigate. (Can be overridden by {@link #getLiteralPath()}
*/
public Class<?> getItemType();
 
/**
* Get the literal view to which this item will navigate. (Overrides {@link #getItemType()})
*/
public String getLiteralPath();
 
/**
* Get the text to be displayed when this item is displayed.
*/
public String getLabel();
}
View CustomerBean.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
ejbDescriptor InternalEjbDescriptor<T> (id=421)
delegate EjbDescriptorImpl<T> (id=450)
baseName ServiceName (id=471)
ejbClass Class<T> (com.example.view.CustomerBean) (id=368)
ejbName "CustomerBean" (id=473)
localInterfaces HashSet<E> (id=474)
messageDriven false
remoteInterfaces HashSet<E> (id=475)
removeMethods Collections$UnmodifiableSet<E> (id=476)
singleton false
stateful true
stateless false
viewServices Collections$UnmodifiableMap<K,V> (id=477)
objectInterface Class<T> (org.metawidget.forge.navigation.MenuItem) (id=388)
annotations Collections$EmptyMap (id=457)
annotationType null
cachedConstructor null
classRedefinedCount 0
declaredAnnotations Collections$EmptyMap (id=457)
declaredConstructors SoftReference<T> (id=461)
declaredFields SoftReference<T> (id=463)
declaredMethods SoftReference<T> (id=465)
declaredPublicFields SoftReference<T> (id=466)
declaredPublicMethods SoftReference<T> (id=467)
enumConstantDirectory null
enumConstants null
genericInfo null
lastRedefinedCount 0
name "org.metawidget.forge.navigation.MenuItem" (id=468)
newInstanceCallerCache null
publicConstructors null
publicFields SoftReference<T> (id=469)
publicMethods SoftReference<T> (id=470)
removeMethodSignatures ArrayList<E> (id=452)
View CustomerBean.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Thread [MSC service thread 1-3] (Suspended (breakpoint at line 103 in ProxyFactory))
EnterpriseProxyFactory<T>(ProxyFactory<T>).<init>(Class<?>, Set<Type>, String, Bean<?>) line: 103
EnterpriseProxyFactory<T>(ProxyFactory<T>).<init>(Class<?>, Set<Type>, Bean<?>) line: 89
EnterpriseProxyFactory<T>.<init>(Class<T>, Bean<T>) line: 48
NewSessionBean<T>(SessionBean<T>).initProxyClass() line: 263
NewSessionBean<T>(SessionBean<T>).initialize(BeanDeployerEnvironment) line: 179
BeanDeployer(AbstractBeanDeployer<E>).deploy() line: 119
BeanDeployment.deployBeans(Environment) line: 227
WeldBootstrap.deployBeans() line: 378
WeldContainer.start() line: 81
WeldService.start(StartContext) line: 89
ServiceControllerImpl$StartTask.run() line: 1765
ServiceControllerImpl$ClearTCCLTask.run() line: 2291
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
ServiceContainerImpl$ServiceThread(Thread).run() line: 680
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.