Examples of JsfCrudAdapter


Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  public abstract JsfCrudAdapter deptCrud();

  @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION, aliases = "deptCrud")
  public JsfCrudAdapter deptCrudController() throws Exception {
    JsfCrudAdapter adapter = cruds().get("Department");
    adapter.getController().setDeleteStrategy(CrudOperations.DELETE_BY_ENTITY);
    adapter.getController().addChild("employees",
        new JsfDetailController(Employee.class, true)).addChild("tasks",
            new JsfDetailController(Task.class));
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

 
  @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter petClinicLeadCrud() throws Exception {
    /* Pull out the existing CrudAdapter. */
    JsfCrudAdapter adapter = cruds().get("PetClinicLead");
    /* Grab its filtering paginator and configure it. */
    FilterablePageable paginator = adapter.getPaginator();
    /* Call addFilterableEntityJoin padding the class we are joining to,
     * the name of the entity, the name of the alias,
     * an array of property names, and an optional join that will be added to the where clause.
     */
    paginator.addFilterableEntityJoin(PetClinicInquiry.class, //Class we are joining
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION, aliases = "empCrud")
  public JsfCrudAdapter employeeCrud() throws Exception {
       
   
    JsfCrudAdapter adapter = cruds().get("Employee");

    adapter.getController().addCrudControllerListener(new CrudControllerAdapter(){

      @Override
      public void afterUpdate(CrudEvent event) {
        //throw new RuntimeException("Don't commit crudController"); un comment this to test tran support
      }
     
    });
    /*
     * Filter out employees who do not have a manager. This will create a
     * "where employee.manager is null" to the query.
     */
    adapter.getPaginator().addCriterion(Comparison.eq("manager", null));
    adapter.getPaginator().filter();

    /* Setup tasks and contacts DetailControllers. */
    JsfDetailController taskController = new JsfDetailController(Task.class);
    adapter.getController().addChild("tasks",
        taskController);
    taskController.setForceUpdate(true);
    //taskController.setDao(repos().get("Task"));
    adapter.getController().addChild("contacts",
        new JsfDetailController(ContactInfo.class));

    adapter.getPaginator().addOrderBy(OrderBy.asc("lastName"));
    adapter.getPaginator().filter();

    /*
     * Setup directReports detail crudController. Make sure framework calls
     * add/remove methods.
     */
    JsfDetailController directReports = new JsfDetailController(
        Employee.class);
    RelationshipManager relationshipManager = directReports
        .getRelationshipManager();
    relationshipManager.setChildCollectionProperty("directReports");
    relationshipManager.setAddToParentMethodName("addDirectReport");
    relationshipManager.setRemoveFromParentMethodName("removeDirectReport");

    adapter.getController().addChild("directReports", directReports);

   
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  @Bean(scope = "view")
  public JsfCrudAdapter empRecordCrud() {
    EmployeeDataSource dataSource = new EmployeeDataSource();
    dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
    FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
    JsfCrudAdapter adapter = new JsfCrudAdapter("empRecord",filteringPaginator, (CrudOperations)empCrud().getController()){
        public Serializable getEntity() {
            Object object = ((Row)getModel().getRowData()).getObject();
            EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
            Employee employee = new Employee();
            employee.setId(employeeReportObject.getId());
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

    //Spring Security Cruds
    @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter usersCrud() throws Exception {
    JsfCrudAdapter adapter = cruds().get("Users");
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  }

  @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter authoritiesCrud() throws Exception {
    JsfCrudAdapter adapter = cruds().get("Authorities");
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  }

    @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter groupAuthoritiesCrud() throws Exception {
    JsfCrudAdapter adapter = cruds().get("GroupAuthorities");
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter


    @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter groupsCrud() throws Exception {
    JsfCrudAdapter adapter = cruds().get("Groups");
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter


    @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION)
  public JsfCrudAdapter groupMembersCrud() throws Exception {
    JsfCrudAdapter adapter = cruds().get("GroupMembers");
    return adapter;
  }
View Full Code Here

Examples of org.crank.crud.jsf.support.JsfCrudAdapter

  public abstract JsfCrudAdapter deptCrud();

  @SuppressWarnings("unchecked")
  @Bean(scope = DefaultScopes.SESSION, aliases = "deptCrud")
  public JsfCrudAdapter deptCrudController() throws Exception {
    JsfCrudAdapter adapter = cruds().get("Department");
    adapter.getController().setDeleteStrategy(CrudOperations.DELETE_BY_ENTITY);
    adapter.getController().addChild("employees",
        new JsfDetailController(Employee.class, true)).addChild("tasks",
            new JsfDetailController(Task.class));
    return adapter;
  }
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.