Examples of CrudController


Examples of org.crank.crud.controller.CrudController

    public Map<String, JsfCrudAdapter<? extends Serializable, ? extends Serializable>> crudControllers() throws Exception {

        DeferredResourceCreator drc = new DeferredResourceCreator(){
               public void createResource(Map map, CrudManagedObject mo) throws Exception{
                       /* Create a new crudController. */
                       CrudController crudControllerTarget = new CrudController();

                       if (mo.isTransactionalController()) {
                           crudControllerTarget = addTransactionSupport(crudControllerTarget);
                           crudControllerTarget.setTransactional(true);
                       }

                       /* Associate crudController with file upload subcontroller. */
                       crudControllerTarget.setFileUploadHandler( new TomahawkFileUploadHandler() );
                       /* Register property utils. */
                       crudControllerTarget.setPropertyUtil( new SpringBeanWrapperPropertiesUtil() );

                       /* Set the entity class into the crudController. */
                       crudControllerTarget.setEntityClass( mo.getEntityType() );

                       if (autoWireCrudToPaginators) {
                         final FilterablePageable filterablePageable = pagers().get(mo.getName());
                         if (filterablePageable != null) {
                           crudControllerTarget.addCrudControllerListener(new CrudControllerListenerAdapter() {
               
                          public void afterCreate(CrudEvent event) {
                            filterablePageable.reset();
                }

                public void afterDelete(CrudEvent event) {
                  filterablePageable.reset();
                }

                public void afterUpdate(CrudEvent event) {
                  filterablePageable.reset();
                }

                 
                });
                         }
                       }

                       /* Inject the repositories. */
                       crudControllerTarget.setDao( repos().get( mo.getName() ) );
                       JsfCrudAdapter jsfCrudAdapter = new JsfCrudAdapter(StringUtils.unCapitalize(mo.getName()),
                               pagers().get(mo.getName()), crudControllerTarget);

                       jsfCrudAdapter.setEntityName(StringUtils.unCapitalize(mo.getName()));

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.