Examples of IOffice


Examples of org.springmodules.xt.examples.domain.IOffice

       
        return result;
    }
   
    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        IOffice office = (IOffice) command;
       
        if (store.getOffice(office.getOfficeId()) != null) {
            errors.rejectValue("officeId", OfficeErrorCodes.DUPLICATED_ID, "Duplicated Office Id!");
            return this.showForm(request, response, errors);
        }
        else {
            try {
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

   
    private DynamicBeanIntroductor introductor =  new DynamicBeanIntroductor();
    private MemoryRepository store;
   
    protected Object formBackingObject(HttpServletRequest request) throws Exception {
        IOffice office = store.getOffice(request.getParameter("officeId"));
        OfficeView view = null;
        if (office != null) {
            IntroductorSet set = new IntroductorSet(office.getEmployees(), new Class[]{EmployeeView.class}, new Class[]{IEmployee.class}, this.introductor);
            view = (OfficeView) this.introductor.introduceInterfaces(office, new Class[]{OfficeView.class}, new Class[]{IOffice.class});
            view.setSelectableEmployees(set);
        } else {
            throw new RuntimeException("No office.");
        }
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

    }
   
    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        OfficeView view = (OfficeView) command;
        Collection<EmployeeView> empsList = view.getSelectableEmployees();
        IOffice office = (IOffice) this.introductor.getTarget(view);
       
        for (Iterator it = empsList.iterator(); it.hasNext();) {
            EmployeeView emp = (EmployeeView) it.next();
            if (emp.getSelected() != null && emp.getSelected().booleanValue() == true) {
                it.remove();
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

        return IOffice.class.isAssignableFrom(aClass);
    }

    public void validate(Object object, Errors errors) {
        if (this.supports(object.getClass())) {
            IOffice office = (IOffice) object;
           
            // Validate office id:
            if (office.getOfficeId() == null || office.getOfficeId().equals("")) {
                errors.rejectValue("officeId", OfficeErrorCodes.NULL_ID, "No Office Id!");
            }
            if (! this.officeIdSpecification.isSatisfiedBy(office)) {
                errors.rejectValue("officeId", OfficeErrorCodes.WRONG_ID, "Wrong Office Id!");
            }
           
            // Validate office name:
            if (office.getName() == null || office.getName().equals("")) {
                errors.rejectValue("name", OfficeErrorCodes.NULL_NAME, "No office name!");
            }
           
            // Is office full?
            if (this.fullOfficeSpecification.isSatisfiedBy(office)) {
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

        return result;
    }

    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        EmployeeView view = (EmployeeView) command;
        IOffice office = view.getOffice();
       
        if (store.getEmployee(view.getMatriculationCode()) != null) {
            errors.rejectValue("matriculationCode", EmployeeErrorCodes.DUPLICATED_CODE, "Duplicated Matriculation Code!");
            return this.showForm(request, response, errors);
        }
        if (office == null) {
            errors.rejectValue("office", OfficeErrorCodes.NOT_FOUND, "No office found!");
            return this.showForm(request, response, errors);
        }
        else {
            try {
                IEmployee employee = (IEmployee) this.introductor.getTarget(view);
                office.addEmployee(employee);
                store.addOffice(office);
            }
            catch(BusinessException ex) {
                for (Error error : ex.getErrors()) {
                    errors.reject(error.getCode(), error.getMessage());
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

    private MemoryRepository store;
   
    public AjaxResponse listEmployees(AjaxSubmitEvent event) {
        EmployeesListForm form = (EmployeesListForm) event.getCommandObject();
        Map model = event.getModel();
        IOffice office = form.getOffice();
        Collection<IEmployee> employees = (Collection) model.get("employees");
       
        // Create the simple text message:
        SimpleText message = new SimpleText(new StringBuilder("Selected office: ").append(office.getName()).toString());
        // Create an ajax action for setting the message and hi:
        ReplaceContentAction setMessageAction = new ReplaceContentAction("message", message);
        // Create an highlighting effect action for the appearing message:
        Effect highlightAction = new Effect("Highlight", "message");
        highlightAction.addOption("duration", 0.5);
View Full Code Here

Examples of org.springmodules.xt.examples.domain.IOffice

   
    private MemoryRepository store;
   
    public AjaxResponse dragEmployee(AjaxActionEvent event) {
        IEmployee draggedEmployee = store.getEmployee(event.getParameters().get(EMPLOYEE_ID));
        IOffice droppableOffice = store.getOffice(event.getHttpRequest().getParameter(OFFICE_ID));
       
        if (! droppableOffice.getEmployees().contains(draggedEmployee)) {
            BindStatusHelper helper = new BindStatusHelper("command.employees");
           
            ListItem item = new ListItem(new SimpleText(draggedEmployee.getFirstname() + " " + draggedEmployee.getSurname()));
            InputField hidden = new InputField(helper.getStatusExpression(), draggedEmployee.getMatriculationCode(), InputField.InputType.HIDDEN);
           
View Full Code Here

Examples of org.springmodules.xt.test.domain.IOffice

    public void testEvaluate() {
        AvailableOfficeSpecification spec = new AvailableOfficeSpecification();
        CompositeSpecification<BaseSpecification, IOffice> composite = new CompositeSpecificationImpl<BaseSpecification, IOffice>(BaseSpecification.class, "isSatisfiedBy");
        PredicateCompositeAdapter adapter = new PredicateCompositeAdapter(composite);
       
        IOffice office1 = new Office();
        IEmployee emp1 = new Employee();
       
        office1.setOfficeId("o1");
        emp1.setMatriculationCode("1");
        office1.addEmployee(emp1);
       
        composite.compose(spec);
        assertTrue(composite.evaluate(office1));
        assertTrue(adapter.evaluate(office1));
    }
View Full Code Here

Examples of org.springmodules.xt.test.domain.IOffice

     */
    public void testEvaluate() {
        AvailableOfficeSpecification spec = new AvailableOfficeSpecification();
        PredicateGenericAdapter adapter = new PredicateGenericAdapter(spec, "isSatisfiedBy");
       
        IOffice office1 = new Office();
        IEmployee emp1 = new Employee();
       
        office1.setOfficeId("o1");
        emp1.setMatriculationCode("1");
        office1.addEmployee(emp1);
       
        assertTrue(spec.isSatisfiedBy(office1));
        assertTrue(adapter.evaluate(office1));
    }
View Full Code Here

Examples of org.springmodules.xt.test.domain.IOffice

    /**
     * Test of single specification composition.
     */
    public void testCompose() {
        OfficeIdSpecification spec = new OfficeIdSpecification();
        IOffice office1 = new Office();
       
        office1.setOfficeId("o1");
        assertTrue(this.compositeSpecification.compose(spec).evaluate(office1));
       
        office1.setOfficeId("aaa");
        assertFalse(this.compositeSpecification.compose(spec).evaluate(office1));
    }
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.