Examples of Enrollment


Examples of org.eurekastreams.server.domain.Enrollment

    @Test
    public void testInsert()
    {
        final long personId = 142L;
        Person person = jpaPersonMapper.findById(personId);
        Enrollment enrollment = new Enrollment(person, "school name", "degree", null, null, null, "desc");
        jpaEnrollmentMapper.insert(enrollment);
        long enrollmentId = enrollment.getId();
        jpaEnrollmentMapper.getEntityManager().clear();

        assertTrue("Inserting a Enrollment did not get a positive id.", jpaEnrollmentMapper.findById(enrollmentId)
                .getId() > 0);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

     */
    @Test
    public void testUpdateEnrollmentCollections()
    {
        final long enrollmentId = 2042L;
        Enrollment enrollment = jpaEnrollmentMapper.findById(enrollmentId);
        ArrayList<BackgroundItem> activities = new ArrayList<BackgroundItem>(3);
        activities.add(new BackgroundItem("a", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        activities.add(new BackgroundItem("b", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        activities.add(new BackgroundItem("c", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        enrollment.setActivities(activities);

        ArrayList<BackgroundItem> areasOfStudy = new ArrayList<BackgroundItem>(3);
        areasOfStudy.add(new BackgroundItem("d", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("e", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("f", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("g", BackgroundItemType.AREA_OF_STUDY));
        enrollment.setAreasOfStudy(areasOfStudy);

        jpaEnrollmentMapper.flush();
        jpaEnrollmentMapper.getEntityManager().clear();

        enrollment = jpaEnrollmentMapper.findById(enrollmentId);

        assertEquals("Expected enrollment to contain activity", 3, enrollment.getActivities().size());
        assertEquals("Expected enrollment to contain area of study", 4, enrollment.getAreasOfStudy().size());

    }
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

     */
    @Test
    public void voidTestFlushAndIndex()
    {
        final long enrollmentId = 2042L;
        Enrollment enrollment = jpaEnrollmentMapper.findById(enrollmentId);
        ArrayList<BackgroundItem> activities = new ArrayList<BackgroundItem>(3);
        activities.add(new BackgroundItem("a", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        activities.add(new BackgroundItem("b", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        activities.add(new BackgroundItem("c", BackgroundItemType.ACTIVITY_OR_SOCIETY));
        enrollment.setActivities(activities);

        ArrayList<BackgroundItem> areasOfStudy = new ArrayList<BackgroundItem>(3);
        areasOfStudy.add(new BackgroundItem("d", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("e", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("f", BackgroundItemType.AREA_OF_STUDY));
        areasOfStudy.add(new BackgroundItem("g", BackgroundItemType.AREA_OF_STUDY));
        enrollment.setAreasOfStudy(areasOfStudy);

        jpaEnrollmentMapper.flush("2d359911-0977-418a-9490-57e8252b1142");
       
        jpaEnrollmentMapper.getEntityManager().clear();

        enrollment = jpaEnrollmentMapper.findById(enrollmentId);

        assertEquals("Expected enrollment to contain activity", 3, enrollment.getActivities().size());
        assertEquals("Expected enrollment to contain area of study", 4, enrollment.getAreasOfStudy().size());       
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

     * @param inEnrollmentId
     *            The id of the Enrollment to delete.
     */
    public void delete(final long inEnrollmentId)
    {
        Enrollment enrollment = findById(inEnrollmentId);
        getEntityManager().remove(enrollment);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

            String additionalDetails = jsonObject.getString(ADDITIONAL_DETAILS_KEY);

            Date gradDate = getDateObjectFromDateString(jsonObject.getString(GRADDATE_KEY));

            Enrollment enrollment = new Enrollment(
                    person,
                    schoolName,
                    degree,
                    areasOfStudy,
                    gradDate,
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

     *             on error
     */
    @Override
    public Representation represent(final Variant variant) throws ResourceException
    {
        Enrollment enrollment = null;
       
        try
        {
            enrollment = getEnrollmentMapper().findById(enrollmentId);
        }
View Full Code Here

Examples of org.eurekastreams.server.domain.Enrollment

    @Override
    public void storeRepresentation(final Representation entity) throws ResourceException
    {       
        try
        {
            Enrollment enrollment = getEnrollmentMapper().findById(enrollmentId);
            if (null == enrollment)
            {
                throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND);
            }
           
            JSONObject jsonObject = JSONObject.fromObject(entity.getText());
           
            log.debug("EnrollmentsEntryResource storeRepresentation: json = " + jsonObject.toString());
           
            validateEnrollment(jsonObject);
           
            enrollment.setSchoolName(jsonObject.getString(SCHOOL_NAME_KEY));
            enrollment.setDegree(jsonObject.getString(DEGREE_KEY));
           
            enrollment.setAreasOfStudy(
                    convertJSONArrayToBackgroundItems(jsonObject.getJSONArray(AREAS_OF_STUDY_KEY),
                            BackgroundItemType.AREA_OF_STUDY));
           
            enrollment.setActivities(
                    convertJSONArrayToBackgroundItems(jsonObject.getJSONArray(ACTIVITIES_KEY),
                            BackgroundItemType.ACTIVITY_OR_SOCIETY));
           
            enrollment.setGradDate(getDateObjectFromDateString(
                    jsonObject.getString(GRADDATE_KEY)));                     
           
            enrollment.setAdditionalDetails(jsonObject.getString(ADDITIONAL_DETAILS_KEY));
           
            getEnrollmentMapper().flush(uuid);

            getAdaptedResponse().setEntity(convertEnrollmentToJSONObject(enrollment).toString(),
                    MediaType.APPLICATION_JSON);
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.