@Test public void process_Duplicate() throws Exception { course.setId(100L); course.setTitle("Title"); course.setSemester(null); course.setEnabled("0"); Course resultCourse = courseProcessor.process(course); assertEquals(resultCourse, course); Course duplicateCourse = courseProcessor.process(course); assertNull(duplicateCourse); }
public Course process(Course course) throws Exception { if (!CampusUtils.addIfNotAlreadyProcessed(processedIdsSet, course.getId())) { LOG.debug("This is a duplicate of this course [" + course.getId() + "]"); return null; } course.setModifiedDate(new Date()); if (course.getTitle().contains(CampusUtils.SEMICOLON_REPLACEMENT)) { course.setTitle(StringUtils.replace(course.getTitle(), CampusUtils.SEMICOLON_REPLACEMENT, CampusUtils.SEMICOLON)); } String shortSemester = buildShortSemester(course.getSemester()); if (shortSemester != null) { course.setShortSemester(shortSemester); course.setTitle(shortSemester.concat(WHITESPACE).concat(course.getTitle())); } if (enabledOrgs.isEmpty()) { if (course.getIpz().equalsIgnoreCase("X")) { course.setEnabled("1"); } } else if (enabledOrgs.contains(course.getOrg1()) || enabledOrgs.contains(course.getOrg2()) || enabledOrgs.contains(course.getOrg3()) || enabledOrgs.contains(course.getOrg4()) || enabledOrgs.contains(course.getOrg5())) { course.setEnabled("1"); } return course; }
CourseProcessor implements ItemProcessor<Course, Course> { public Course process(Course course) throws Exception { if (!CampusUtils.addIfNotAlreadyProcessed(processedIdsSet, course.getId())) { LOG.debug("This is a duplicate of this course [" + course.getId() + "]"); return null; } course.setModifiedDate(new Date()); if (course.getTitle().contains(CampusUtils.SEMICOLON_REPLACEMENT)) { course.setTitle(StringUtils.replace(course.getTitle(), CampusUtils.SEMICOLON_REPLACEMENT, CampusUtils.SEMICOLON)); } String shortSemester = buildShortSemester(course.getSemester()); if (shortSemester != null) { course.setShortSemester(shortSemester); course.setTitle(shortSemester.concat(WHITESPACE).concat(course.getTitle())); } if (enabledOrgs.isEmpty()) { if (course.getIpz().equalsIgnoreCase("X")) { course.setEnabled("1"); } } else if (enabledOrgs.contains(course.getOrg1()) || enabledOrgs.contains(course.getOrg2()) || enabledOrgs.contains(course.getOrg3()) || enabledOrgs.contains(course.getOrg4()) || enabledOrgs.contains(course.getOrg5())) { course.setEnabled("1"); } return course; } }
CourseProcessor implements ItemProcessor<Course, Course> { public Course process(Course course) throws Exception { if (!CampusUtils.addIfNotAlreadyProcessed(processedIdsSet, course.getId())) { LOG.debug("This is a duplicate of this course [" + course.getId() + "]"); return null; } course.setModifiedDate(new Date()); if (course.getTitle().contains(CampusUtils.SEMICOLON_REPLACEMENT)) { course.setTitle(StringUtils.replace(course.getTitle(), CampusUtils.SEMICOLON_REPLACEMENT, CampusUtils.SEMICOLON)); } String shortSemester = buildShortSemester(course.getSemester()); if (shortSemester != null) { course.setShortSemester(shortSemester); course.setTitle(shortSemester.concat(WHITESPACE).concat(course.getTitle())); } if (enabledOrgs.isEmpty()) { if (course.getIpz().equalsIgnoreCase("X")) { course.setEnabled("1"); } } else if (enabledOrgs.contains(course.getOrg1()) || enabledOrgs.contains(course.getOrg2()) || enabledOrgs.contains(course.getOrg3()) || enabledOrgs.contains(course.getOrg4()) || enabledOrgs.contains(course.getOrg5())) { course.setEnabled("1"); } return course; }  }
CourseProcessor implements ItemProcessor<Course, Course> { public Course process(Course course) throws Exception { if (!CampusUtils.addIfNotAlreadyProcessed(processedIdsSet, course.getId())) { LOG.debug("This is a duplicate of this course [" + course.getId() + "]"); return null; } course.setModifiedDate(new Date()); if (course.getTitle().contains(CampusUtils.SEMICOLON_REPLACEMENT)) { course.setTitle(StringUtils.replace(course.getTitle(), CampusUtils.SEMICOLON_REPLACEMENT, CampusUtils.SEMICOLON)); } String shortSemester = buildShortSemester(course.getSemester()); if (shortSemester != null) { course.setShortSemester(shortSemester); course.setTitle(shortSemester.concat(WHITESPACE).concat(course.getTitle())); } if (enabledOrgs.isEmpty()) { if (course.getIpz().equalsIgnoreCase("X")) { course.setEnabled("1"); } } else if (enabledOrgs.contains(course.getOrg1()) || enabledOrgs.contains(course.getOrg2()) || enabledOrgs.contains(course.getOrg3()) || enabledOrgs.contains(course.getOrg4()) || enabledOrgs.contains(course.getOrg5())) { course.setEnabled("1"); } return course; }  @PostConstruct void init(); @PreDestroy void cleanUp(); void setSemesterMap(Map<String, String> semesterMap); Course process(Course course); }
CourseProcessor implements ItemProcessor<Course, Course> { public Course process(Course course) throws Exception { if (!CampusUtils.addIfNotAlreadyProcessed(processedIdsSet, course.getId())) { LOG.debug("This is a duplicate of this course [" + course.getId() + "]"); return null; } course.setModifiedDate(new Date()); if (course.getTitle().contains(CampusUtils.SEMICOLON_REPLACEMENT)) { course.setTitle(StringUtils.replace(course.getTitle(), CampusUtils.SEMICOLON_REPLACEMENT, CampusUtils.SEMICOLON)); } String shortSemester = buildShortSemester(course.getSemester()); if (shortSemester != null) { course.setShortSemester(shortSemester); course.setTitle(shortSemester.concat(WHITESPACE).concat(course.getTitle())); } if (enabledOrgs.isEmpty()) { if (course.getIpz().equalsIgnoreCase("X")) { course.setEnabled("1"); } } else if (enabledOrgs.contains(course.getOrg1()) || enabledOrgs.contains(course.getOrg2()) || enabledOrgs.contains(course.getOrg3()) || enabledOrgs.contains(course.getOrg4()) || enabledOrgs.contains(course.getOrg5())) { course.setEnabled("1"); } return course; }  @PostConstruct void init(); @PreDestroy void cleanUp(); void setSemesterMap(Map<String, String> semesterMap); Course process(Course course);  }