Package org.springmodules.xt.examples.domain

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


        return IEmployee.class.isAssignableFrom(aClass);
    }

    public void validate(Object object, Errors errors) {
        if (this.supports(object.getClass())) {
            IEmployee emp = (IEmployee) object;
           
            // Validate matriculation code:
            if (emp.getMatriculationCode() == null || emp.getMatriculationCode().equals("")) {
                errors.rejectValue("matriculationCode", EmployeeErrorCodes.NULL_CODE, "No Matriculation Code!");
            }
           
            // Validate password:
            if (emp.getPassword().length() < PASSWORD_MIN_LENGTH) {
                errors.rejectValue("password", EmployeeErrorCodes.SHORT_PASSWORD, new Object[]{PASSWORD_MIN_LENGTH}, "Too short password!");
            }
        }
    }
View Full Code Here


            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()) {
View Full Code Here

    private static final String OFFICE_ID = "officeId";
   
    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);
           
            AppendContentAction appendAction = new AppendContentAction("employees", new LinkedList<Component>(Arrays.asList(item, hidden)));
           
            AjaxResponse response = new AjaxResponseImpl();
            response.addAction(appendAction);
View Full Code Here

    public AjaxResponse employeeSelection(AjaxActionEvent event)
    throws Exception {
        String matriculationCode = event.getHttpRequest().getParameter(event.getElementName());
        // Get the selected employee:
        IEmployee e = store.getEmployee(matriculationCode);
       
        // Create an ajax action for setting the "value" attribute of the "firstname" html element:
        SetAttributeAction setFirstname = new SetAttributeAction("firstname", "value", e.getFirstname());
        // Create an ajax action for setting the "value" attribute of the "surname" html element:
        SetAttributeAction setSurname = new SetAttributeAction("surname", "value", e.getSurname());
       
        // Create the ajax response:
        AjaxResponse response = new AjaxResponseImpl();
        // Add the actions to the response:
        response.addAction(setFirstname);
View Full Code Here

TOP

Related Classes of org.springmodules.xt.examples.domain.IEmployee

Copyright © 2018 www.massapicom. 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.