@Test public void testWriteOneAttendance() { Mockito.when(mockRepo.findEach(Mockito.eq("attendance"), Mockito.eq(new NeutralQuery()))).thenReturn( Arrays.asList(mockEntity).iterator()); entityBody.put("studentId", "student"); entityBody.put(ParameterConstants.SCHOOL_YEAR, "2010-2011"); extractor.extractEntities(mockCache); Mockito.verify(mockExtractor).extractEntity(Mockito.eq(mockEntity), Mockito.eq(mockFile), Mockito.eq("attendance")); }
@Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attendances.next(); Map<String, DateTime> studentEdOrgDate = studentCache.getEntriesById((String) attendance.getBody().get("studentId")); for (Map.Entry<String, DateTime> entry: studentEdOrgDate.entrySet()) { DateTime upToDate = entry.getValue(); if (EntityDateHelper.shouldExtract(attendance, upToDate)) { extractor.extractEntity(attendance, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.ATTENDANCE); } } } }
AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attendances.next(); Map<String, DateTime> studentEdOrgDate = studentCache.getEntriesById((String) attendance.getBody().get("studentId")); for (Map.Entry<String, DateTime> entry: studentEdOrgDate.entrySet()) { DateTime upToDate = entry.getValue(); if (EntityDateHelper.shouldExtract(attendance, upToDate)) { extractor.extractEntity(attendance, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.ATTENDANCE); } } } } }
AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attendances.next(); Map<String, DateTime> studentEdOrgDate = studentCache.getEntriesById((String) attendance.getBody().get("studentId")); for (Map.Entry<String, DateTime> entry: studentEdOrgDate.entrySet()) { DateTime upToDate = entry.getValue(); if (EntityDateHelper.shouldExtract(attendance, upToDate)) { extractor.extractEntity(attendance, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.ATTENDANCE); } } } } AttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); }
AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attendances.next(); Map<String, DateTime> studentEdOrgDate = studentCache.getEntriesById((String) attendance.getBody().get("studentId")); for (Map.Entry<String, DateTime> entry: studentEdOrgDate.entrySet()) { DateTime upToDate = entry.getValue(); if (EntityDateHelper.shouldExtract(attendance, upToDate)) { extractor.extractEntity(attendance, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.ATTENDANCE); } } } } AttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache studentCache); }
AttendanceExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.ATTENDANCE, this.getClass().getName()); Iterator<Entity> attendances = repo.findEach("attendance", new NeutralQuery()); while (attendances.hasNext()) { Entity attendance = attendances.next(); Map<String, DateTime> studentEdOrgDate = studentCache.getEntriesById((String) attendance.getBody().get("studentId")); for (Map.Entry<String, DateTime> entry: studentEdOrgDate.entrySet()) { DateTime upToDate = entry.getValue(); if (EntityDateHelper.shouldExtract(attendance, upToDate)) { extractor.extractEntity(attendance, map.getExtractFileForEdOrg(entry.getKey()), EntityNames.ATTENDANCE); } } } } AttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo,
            EdOrgExtractHelper edOrgExtractHelper); @Override void extractEntities(EntityToEdOrgDateCache studentCache);  }