Created
September 9, 2011 20:25
-
-
Save lincolnthree/1207239 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment