Package com.apress.progwt.client.domain

Examples of com.apress.progwt.client.domain.Application


        List<Application> rankings = currentUser.getSchoolRankings();

        // Utilities.reOrder(rankings, currentUser, rank)

        Application sap = null;

        School school = commandService.get(School.class, schoolID);

        for (Iterator iterator = rankings.iterator(); iterator.hasNext();) {
            Application scAndApp = (Application) iterator.next();

            if (scAndApp.getSchool().equals(school)) {
                sap = scAndApp;
            }
        }

        if (null == sap) {
            // Log.debug("\n----B-CREATE-NEW-SAP----\n");
            sap = new Application(school);
            commandService.save(sap);
            currentUser.addRanked(rank, sap);
        }

        // use this to set the orderProperty, since the list
View Full Code Here


        assertEquals(0, currentUser.getSchoolRankings().size());

        System.out.println("currentUser " + currentUser);

        Application sap = new Application(sc);
        currentUser.addRanked(sap);

        String NAME = "Mailed";
        ProcessType processType = new ProcessType(NAME);
        currentUser.getProcessTypes().add(processType);

        ProcessValue processValue = new ProcessValue();
        sap.getProcess().put(processType, processValue);

        schoolDAO.save(currentUser);

        User savedUser = userDAO.getUserByUsername(currentUser
                .getUsername());
        assertEquals(1, savedUser.getSchoolRankings().size());

        assertEquals(9, savedUser.getProcessTypes().size());

        ProcessType savedPT = null;
        // iterate to the last one
        Iterator i = currentUser.getProcessTypes().iterator();
        while (i.hasNext()) {
            savedPT = (ProcessType) i.next();
        }
        assertEquals(NAME, savedPT.getName());

        Application savedSAP = savedUser.getSchoolRankings().get(0);

        ProcessValue savedPValue = savedSAP.getProcess().get(savedPT);

        assertNotNull(savedPValue);
        assertEquals(0.0, savedPValue.getPctComplete());

    }
View Full Code Here

        assertNotNull(sc);

        User currentUser = getUser();
        assertEquals(0, currentUser.getSchoolRankings().size());

        currentUser.addRanked(new Application(sc));

        schoolDAO.save(currentUser);

        User savedUser = userDAO.getUserByUsername(currentUser
                .getUsername());
View Full Code Here

        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        Application dartApplication = savedUser.getSchoolRankings()
                .get(0);

        assertEquals(dart, dartApplication.getSchool());

        ProcessType considering = getUser().getProcessTypes().get(0);

        ProcessValue processValue = new ProcessValue();
        Calendar d = Calendar.getInstance();
        d.set(2005, 3, 10);
        processValue.setDueDate(d.getTime());
        processValue.setPctComplete(.34);

        // re-order to Harvard,Dart,Yale
        SaveProcessCommand processComm = new SaveProcessCommand(
                dartApplication, considering, processValue);
        executeWithToken(processComm, false);

        User savedUser2 = getUser();

        Application savedDart = savedUser2.getSchoolRankings().get(0);
        ProcessValue savedValue = savedDart.getProcess().get(considering);

        assertEquals(.34, savedValue.getPctComplete());
        assertEquals(2005, savedValue.getDueDate().getYear() + 1900);

    }
View Full Code Here

        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        Application dartApplication = savedUser.getSchoolRankings()
                .get(0);

        assertEquals(dart, dartApplication.getSchool());

        RatingType ratingOne = getUser().getRatingTypes().get(0);
        RatingType ratingTwo = getUser().getRatingTypes().get(1);

        SaveRatingCommand command = new SaveRatingCommand(ratingOne, 3,
                dartApplication);

        executeWithToken(command, false);

        User savedUser2 = getUser();

        Application savedDart = savedUser2.getSchoolRankings().get(0);

        assertEquals(3, savedDart.getRating(ratingOne));
        assertEquals(5, savedDart.getRating(ratingTwo));

    }
View Full Code Here

        executeWithToken(comm, false);

        User savedUser = getUser();
        assertEquals(3, savedUser.getSchoolRankings().size());

        Application harvardApplication = savedUser.getSchoolRankings()
                .get(1);

        assertEquals(harvard, harvardApplication.getSchool());
        assertEquals(1, harvardApplication.getSortOrder());

        // save pro/con and notes to the application
        harvardApplication.setNotes(TEXT);
        harvardApplication.getPros().add(A);
        harvardApplication.getPros().add(B);
        harvardApplication.getCons().add(C);

        SaveApplicationCommand command = new SaveApplicationCommand(
                harvardApplication);

        executeWithToken(command, false);

        User savedUser2 = getUser();

        Application savedHarvard = savedUser2.getSchoolRankings().get(1);

        assertEquals(1, savedHarvard.getSortOrder());
        assertEquals(harvard, savedHarvard.getSchool());

        assertEquals(TEXT, savedHarvard.getNotes());
        assertEquals(A, savedHarvard.getPros().get(0));
        assertEquals(B, savedHarvard.getPros().get(1));
        assertEquals(C, savedHarvard.getCons().get(0));

        // edit the original application and save again
        harvardApplication.getPros().clear();
        harvardApplication.getCons().add(B);
        harvardApplication.setNotes(C);

        SaveApplicationCommand command2 = new SaveApplicationCommand(
                harvardApplication);
        executeWithToken(command2, false);

        User savedUser3 = getUser();

        Application savedHarvard2 = savedUser3.getSchoolRankings().get(1);

        assertEquals(1, savedHarvard2.getSortOrder());
        assertEquals(harvard, savedHarvard2.getSchool());

        assertEquals(C, savedHarvard2.getNotes());
        assertEquals(0, savedHarvard2.getPros().size());
        assertEquals(C, savedHarvard2.getCons().get(0));
        assertEquals(B, savedHarvard2.getCons().get(1));

    }
View Full Code Here

        commandService.assertUserIsAuthenticated(loadedUser);

        List<Application> rankings = loadedUser.getSchoolRankings();

        Application toDelete = null;
        for (Iterator<Application> iterator = rankings.iterator(); iterator
                .hasNext();) {
            Application scAndApp = (Application) iterator.next();
            if (scAndApp.getSchool().equals(school)) {
                toDelete = scAndApp;
                iterator.remove();
            }
        }
View Full Code Here

    }

    public void execute(CommandService commandService)
            throws SiteException {

        Application application = commandService.get(Application.class,
                schoolAppID);

        ProcessType type = (ProcessType) commandService.get(
                ProcessType.class, processTypeID);

        assertUserIsAuthenticated(application.getUser());

        application.getProcess().put(type, value);
        commandService.save(application);

    }
View Full Code Here

    private static final String VALID_HTML = "sa<FONT style=\"BACKGROUND-COLOR: green\" color=yellow>dfs</FONT>df";
    private static final String VALID_HTML_C = "sa<font style=\"BACKGROUND-COLOR: green\" color=\"yellow\">dfs</font>df";

    public void testExecute() throws SiteException {

        Application a = new Application();
        a.setNotes(VALID_HTML);
        a.getPros().add(TITLE);

        SaveApplicationCommand command = new SaveApplicationCommand(a);

        MockCommandService commandService = new MockCommandService(
                command);

        assertNull(command.getToSave());

        command.execute(commandService);

        Application saved = command.getToSave();
        assertEquals(TITLE, saved.getPros().get(0));
        assertEquals(VALID_HTML_C, saved.getNotes());
        assertEquals(0, saved.getCons().size());

    }
View Full Code Here

    }

    public void testExecuteXSS() throws SiteException {

        Application a = new Application();
        a.setNotes(XSS_STRING);
        a.getPros().add(XSS_STRING);

        SaveApplicationCommand command = new SaveApplicationCommand(a);

        MockCommandService commandService = new MockCommandService(
                command);

        assertNull(command.getToSave());

        command.execute(commandService);

        Application saved = command.getToSave();
        assertEquals(XSS_ESCAPED, saved.getPros().get(0));
        assertEquals(XSS_FIXED, saved.getNotes());
        assertEquals(0, saved.getCons().size());

    }
View Full Code Here

TOP

Related Classes of com.apress.progwt.client.domain.Application

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.