method2testcases
stringlengths
118
6.63k
### Question: SamlHelper { protected boolean isAssertionEncrypted(org.opensaml.saml2.core.Response samlResponse) { if (samlResponse.getEncryptedAssertions() != null && samlResponse.getEncryptedAssertions().size() != 0) { return true; } return false; } @PostConstruct void init(); Pair<String, String> createSamlAuthnReq...
### Question: ContextValidator implements ApplicationContextAware { protected Set<String> getEntityIdsToValidateForgiving(Collection<Entity> entities, boolean isTransitive){ Set<String> entityIdsToValidate = new HashSet<String>(); for (Entity ent : entities) { if (isOrphanCreatedByUser(ent)) { LOG.debug("Entity is orph...
### Question: MongoCommander { public static String preSplit(Set<String> shardCollections, String dbName, MongoTemplate mongoTemplate) { DB dbConn = mongoTemplate.getDb().getSisterDB("admin"); List<String> shards = getShards(dbConn); if (shards.size() == 0) { return null; } String sresult = setBalancerState(dbConn, fal...
### Question: EdOrgHelper { public Set<Entity> locateNonExpiredSEOAs(String staffId) { Set<Entity> validAssociations = new HashSet<Entity>(); NeutralQuery basicQuery = new NeutralQuery(new NeutralCriteria(ParameterConstants.STAFF_REFERENCE, NeutralCriteria.OPERATOR_EQUAL, staffId)); Iterable<Entity> associations = repo...
### Question: IndexJSFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Map<String, Object> indexMap = null; File resourceFile = null; FileInputStream fstream = null; BufferedReader br = null; Set<MongoIndex> indexes = new HashSet<MongoIndex>(); try { URL resourceURL =...
### Question: EdOrgHelper { public Set<String> getDirectEdorgs() { LOG.trace(">>>EdOrgHelper.getDirectEdorgs()"); return getDirectEdorgs(SecurityUtil.getSLIPrincipal().getEntity()); } @PostConstruct void init(); List<String> getDistricts(Entity user); List<String> getDistricts(Set<String> edOrgs); List<String> getDire...
### Question: EdOrgHelper { public List<String> getDirectChildLEAsOfEdOrg(Entity edOrgEntity) { Set<String> result; if (edOrgEntity == null) { return null; } result = getDirectChildLEAsOfEdOrg(edOrgEntity.getEntityId()); if (result == null || result.isEmpty()) { return null; } return new ArrayList<String>(result); } @...
### Question: EdOrgHelper { public Set<String> getAllChildLEAsOfEdOrg(Entity edOrgEntity) { String myId; Set<String> edOrgs = new HashSet<String>(); Set<String> result = new HashSet<String>(); if (edOrgEntity == null || edOrgEntity.getEntityId() == null) { return null; } myId = edOrgEntity.getEntityId(); edOrgs.add(myI...
### Question: IndexTxtFileParser implements IndexParser<String> { @Override public Set<MongoIndex> parse(String fileName) { Set<String> indexSet = loadIndexes(fileName); return new IndexSliFormatParser().parse(indexSet); } @Override Set<MongoIndex> parse(String fileName); static Set<String> loadIndexes(String indexFil...
### Question: RealmHelper { public Set<String> getAssociatedRealmIds() { HashSet<String> toReturn = new HashSet<String>(); if (isSandboxEnabled) { toReturn.add(getSandboxRealmId()); } else { NeutralQuery realmQuery = new NeutralQuery(); String edOrg = SecurityUtil.getEdOrg(); LOG.debug("Looking up realms for edorg {}."...
### Question: PurgeProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { Stage stage = Stage.createAndStartStage(BATCH_JOB_STAGE, BATCH_JOB_STAGE_DESC); String batchJobId = getBatchJobId(exchange); if (batchJobId != null) { reportStats = new SimpleReportStats(); NewBatchJo...
### Question: ZipFileProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { WorkNote workNote = exchange.getIn().getBody(WorkNote.class); String batchJobId = workNote.getBatchJobId(); if (batchJobId == null) { handleNoBatchJobIdInExchange(exchange); } else { processZipFile(...
### Question: EdOrgOwnershipArbiter extends OwnershipArbiter { public Set<String> determineHierarchicalEdorgs(Iterable<Entity> entities, String entityType) { Set<String> hierarchicalEdorgs = new HashSet<String>(); List<Entity> edorgs = findOwner(entities, entityType, true); for (Entity edorg : edorgs) { hierarchicalEdo...
### Question: ParentAccessValidator extends AccessValidator { @Override protected boolean isReadAllowed(List<String> path, MultivaluedMap<String, String> queryParameters) { List<String> subPath = null; if (path.size() == 3) { subPath = Arrays.asList(path.get(2)); } else if (path.size() == 4) { subPath = Arrays.asList(p...
### Question: DeltaHashPurgeProcessor extends IngestionProcessor<WorkNote, Resource> { @Override public void process(Exchange exchange, ProcessorArgs<WorkNote> args) { String tenantId = TenantContext.getTenantId(); removeRecordHash(args.job, tenantId); } @Override void process(Exchange exchange, ProcessorArgs<WorkNote...
### Question: TeacherToTeacherSectionAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SECTION_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } Neutr...
### Question: GlobalEntityValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTransitive && isGlobalWrite(entityType) && !isStudentOrParent(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String...
### Question: GlobalEntityValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> entityIds) throws IllegalStateException { Set<String> result = new HashSet<String>(); if(areParametersValid(GLOBAL_WRITE_RESOURCE, entityType, entityIds)) { result = entityIds; } r...
### Question: TransitiveTeacherToStaffEdOrgAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STAFF_ED_ORG_ASSOCIATION.equals(entityType) && isTeacher() && isTransitive; } @Override boolean canValidate(String entity...
### Question: TransitiveTeacherToStaffEdOrgAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STAFF_ED_ORG_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } Ma...
### Question: StaffToTeacherValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return EntityNames.TEACHER.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean through); @Override Set<String> validate(String enti...
### Question: StaffToTeacherValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityName, Set<String> teacherIds) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER, entityName, teacherIds)) { return Collections.EMPTY_SET; } NeutralQuery basicQuery = new N...
### Question: TransitiveTeacherToStaffValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean transitive) { return transitive && EntityNames.STAFF.equals(entityType) && isTeacher(); } @Override boolean canValidate(String entityType, boolean transitive); @Override Se...
### Question: TransitiveTeacherToStaffValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityName, Set<String> staffIds) throws IllegalStateException { if (!areParametersValid(EntityNames.STAFF, entityName, staffIds)) { return Collections.EMPTY_SET; } NeutralQuery basicQuery = n...
### Question: StudentToStudentParentAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { Set<String> validIds = new HashSet<String>(); if (!areParametersValid(EntityNames.STUDENT_PARENT_ASSOCIATION, entityType, i...
### Question: GenericToGlobalClassPeriodWriteValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.CLASS_PERIOD, entityType, ids)) { return Collections.emptySet(); } Set<String> edOrgLinea...
### Question: TeacherToStudentCohortAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STUDENT_COHORT_ASSOCIATION.equals(entityType) && isTeacher(); } @Override boolean canValidate(String entityType, boolean isTrans...
### Question: LandingZoneProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { Stage stage = Stage.createAndStartStage(LZ_STAGE, LZ_STAGE_DESC); String batchJobId = null; ReportStats reportStats = new SimpleReportStats(); NewBatchJob currentJob = null; File lzFile = exchan...
### Question: StudentDenyAllValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStudentOrParent() && (STUDENT_DENIED_ENTITIES.contains(entityType) || (isTransitive && EntityNames.isPublic(entityType)) || (!isTransitive && NON_TRANSITIVE_D...
### Question: StudentDenyAllValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { return Collections.emptySet(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(Strin...
### Question: TeacherToStudentProgramAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STUDENT_PROGRAM_ASSOCIATION.equals(entityType) && isTeacher(); } @Override boolean canValidate(String entityType, boolean isTra...
### Question: TeacherToStudentProgramAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_PROGRAM_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } Neutr...
### Question: TeacherToDisciplineIncidentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTeacher() && EntityNames.DISCIPLINE_INCIDENT.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Over...
### Question: TeacherToDisciplineIncidentValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.DISCIPLINE_INCIDENT, entityType, ids)) { return Collections.EMPTY_SET; } Set<String> discInci...
### Question: StaffToSubStudentEntityValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return isStaff() && isSubEntityOfStudent(entityType); } @Override boolean canValidate(String entityType, boolean through); @SuppressWarnings("unchecked") @Overrid...
### Question: StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStudentOrParent() && EntityNames.STUDENT_COMPETENCY.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive);...
### Question: ControlFileProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { processUsingNewBatchJob(exchange); MongoTrackingAspect.aspectOf().reset(); } @Override void process(Exchange exchange); static final BatchJobStageType BATCH_JOB_STAGE; }### Answer: @Test public...
### Question: StudentToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<Strin...
### Question: TeacherToStaffEdOrgAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STAFF_ED_ORG_ASSOCIATION.equals(entityType) && isTeacher() && !isTransitive; } @Override boolean canValidate(String entityType, boo...
### Question: TeacherToStaffEdOrgAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STAFF_ED_ORG_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery...
### Question: StudentToStudentSectionAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStudentOrParent() && EntityNames.STUDENT_SECTION_ASSOCIATION.equals(entityType) && !isTransitive; } @Override boolean canValidate(String ...
### Question: StudentToStudentSectionAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_SECTION_ASSOCIATION, entityType, ids)) { return Collections.emptySet(); } Neut...
### Question: StaffToStudentCohortProgramAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return STUDENT_ASSOCIATIONS.contains(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Over...
### Question: StaffToStudentCohortProgramAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(STUDENT_ASSOCIATIONS, entityType, ids)) { return Collections.EMPTY_SET; } Map<String, Set<Stri...
### Question: TenantProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { try { createNewLandingZones(); exchange.getIn().setHeader(TENANT_POLL_HEADER, TENANT_POLL_SUCCESS); doPreloads(); } catch (Exception e) { exchange.getIn().setHeader(TENANT_POLL_HEADER, TENANT_POLL_FA...
### Question: TransitiveStaffToStaffValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean transitive) { return transitive && EntityNames.STAFF.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean transitive); @SuppressWarning...
### Question: TenantProcessor implements Processor { boolean preLoad(String landingZone, List<String> dataSets) { File landingZoneDir = new File(landingZone); if (!landingZoneDir.exists()) { try { FileUtils.forceMkdir(landingZoneDir); } catch (IOException e) { LOG.error("TenantProcessor: Failed to create landing zone: ...
### Question: GenericToGlobalBellScheduleWriteValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.BELL_SCHEDULE, entityType, ids)) { return Collections.emptySet(); } Set<String> edOrgLin...
### Question: TeacherToStudentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return EntityNames.STUDENT.equals(entityType) && isTeacher(); } @Override boolean canValidate(String entityType, boolean through); @Override Set<String> validate(String ...
### Question: EdFiParserProcessor extends IngestionProcessor<FileEntryWorkNote, IngestionFileEntry> implements RecordVisitor { @Override protected void process(Exchange exchange, ProcessorArgs<FileEntryWorkNote> args) { prepareState(exchange, args.workNote); Source source = new FileSource(args.workNote.getFileE...
### Question: EdFiParserProcessor extends IngestionProcessor<FileEntryWorkNote, IngestionFileEntry> implements RecordVisitor { @Override public void visit(RecordMeta recordMeta, Map<String, Object> record) { state.get().addToBatch(recordMeta, record, typeProvider, helper); if (state.get().getDataBatch().size() ...
### Question: StaffToSubStudentSectionAssociationEntityValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return isStaff() && isSubEntityOfStudentSectionAssociation(entityType); } @Override boolean canValidate(String entityType, boolean through); @Ov...
### Question: StudentToStudentAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStudent() && STUDENT_ASSOCIATIONS.contains(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<...
### Question: ControlFilePreProcessor implements Processor { @Override public void process(Exchange exchange) throws Exception { processUsingNewBatchJob(exchange); } @Override void process(Exchange exchange); Set<String> getShardCollections(); void setShardCollections(Set<String> shardCollections); void setBatchJobDAO...
### Question: StudentToStudentAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(STUDENT_ASSOCIATIONS, entityType, ids)) { return Collections.emptySet(); } Set<String> otherStudentIds = ...
### Question: TransitiveStudentToStudentSectionAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStudentOrParent() && EntityNames.STUDENT_SECTION_ASSOCIATION.equals(entityType) && isTransitive; } @Override boolean canValidat...
### Question: TransitiveStudentToStudentSectionAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_SECTION_ASSOCIATION, entityType, ids)) { return Collections.emptySet...
### Question: TeacherToSectionValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTeacher() && EntityNames.SECTION.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> valida...
### Question: StaffToStaffProgramAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STAFF_PROGRAM_ASSOCIATION.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive)...
### Question: StaffToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStaff() && EntityNames.TEACHER_SCHOOL_ASSOCIATION.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitiv...
### Question: GenericToCohortValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return !isStudentOrParent() && !isTransitive && EntityNames.COHORT.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Ove...
### Question: StaffToGlobalSectionValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.SECTION.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> vali...
### Question: StaffToGlobalSectionValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.SECTION, entityType, ids)) { return Collections.EMPTY_SET; } Set<String> edOrgLineage = getEdorgDesc...
### Question: TeacherToTeacherSchoolAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SCHOOL_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } Neutral...
### Question: StudentToSubStudentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return SUB_STUDENT_ENTITIES.contains(entityType) && isStudentOrParent(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<...
### Question: StudentToSubStudentValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(SUB_STUDENT_ENTITIES, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>> studentIds = ...
### Question: TeacherToStudentCompetencyValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTeacher() && EntityNames.STUDENT_COMPETENCY.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Overri...
### Question: TeacherToStudentCompetencyValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STUDENT_COMPETENCY, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery query = n...
### Question: TeacherToCourseTranscriptValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTeacher() && EntityNames.COURSE_TRANSCRIPT.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override...
### Question: TeacherToCourseTranscriptValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.COURSE_TRANSCRIPT, entityType, ids)) { return Collections.emptySet(); } Map<String, Set<String>...
### Question: StaffToDisciplineIncidentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStaff() && EntityNames.DISCIPLINE_INCIDENT.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override...
### Question: TeacherToStaffCohortAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STAFF_COHORT_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuer...
### Question: TeacherToSubStudentEntityValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean through) { return isTeacher() && isSubEntityOfStudent(entityType); } @Override boolean canValidate(String entityType, boolean through); @SuppressWarnings("unchecked") @Ove...
### Question: StaffToStudentValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STUDENT.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> getValid(S...
### Question: StaffToStaffCohortAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.STAFF_COHORT_ASSOCIATION.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive); ...
### Question: StaffToCourseTranscriptValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return EntityNames.COURSE_TRANSCRIPT.equals(entityType) && isStaff(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set...
### Question: StaffToCourseTranscriptValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.COURSE_TRANSCRIPT, entityType, ids)) { return Collections.emptySet(); } LOG.info("Validating {}'s...
### Question: TeacherToCohortValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTransitive && EntityNames.COHORT.equals(entityType) && isTeacher(); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<...
### Question: TeacherToCohortValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { Set<String> validIds = new HashSet<String>(); if (!areParametersValid(EntityNames.COHORT, entityType, ids)) { return validIds; } NeutralQuery...
### Question: GenericToProgramValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return !isStudentOrParent() && EntityNames.PROGRAM.equals(entityType) && !isTransitive; } @Override boolean canValidate(String entityType, boolean isTransitive); @O...
### Question: GenericToProgramValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.PROGRAM, entityType, ids)) { return new HashSet<String>(); } NeutralQuery nq = new NeutralQuery(new Neut...
### Question: StaffToCohortValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTransitive && isStaff() && EntityNames.COHORT.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<Stri...
### Question: GenericToEdOrgValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { if (EntityNames.SCHOOL.equals(entityType) || EntityNames.EDUCATION_ORGANIZATION.equals(entityType)) { if (isStudentOrParent()) { return !isTransitive; } return true; }...
### Question: DidSchemaParser implements ResourceLoaderAware { public Map<String, DidEntityConfig> getEntityConfigs() { return entityConfigs; } String getExtensionXsdLocation(); void setExtensionXsdLocation(String entensionXsdLocation); String getExtensionXsdParentLocation(); void setExtensionXsdParentLocation(String ...
### Question: TeacherToGradeValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isTeacher() && EntityNames.GRADE.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransitive); @Override Set<String> validate(S...
### Question: TeacherToGradeValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.GRADE, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQuery query = new NeutralQuery(new Neutr...
### Question: StaffToTeacherSectionAssociationValidator extends AbstractContextValidator { @Override public boolean canValidate(String entityType, boolean isTransitive) { return isStaff() && EntityNames.TEACHER_SECTION_ASSOCIATION.equals(entityType); } @Override boolean canValidate(String entityType, boolean isTransit...
### Question: DidSchemaParser implements ResourceLoaderAware { public Map<String, List<DidNaturalKey>> getNaturalKeys() { return naturalKeys; } String getExtensionXsdLocation(); void setExtensionXsdLocation(String entensionXsdLocation); String getExtensionXsdParentLocation(); void setExtensionXsdParentLocation(String ...
### Question: StaffToTeacherSectionAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.TEACHER_SECTION_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } Neutral...
### Question: TeacherToStaffProgramAssociationValidator extends AbstractContextValidator { @Override public Set<String> validate(String entityType, Set<String> ids) throws IllegalStateException { if (!areParametersValid(EntityNames.STAFF_PROGRAM_ASSOCIATION, entityType, ids)) { return Collections.EMPTY_SET; } NeutralQu...
### Question: SecurityEventBuilder { public SecurityEvent createSecurityEvent(String loggingClass, URI requestUri, String slMessage, boolean defaultTargetToUserEdOrg) { return createSecurityEvent( loggingClass, requestUri, slMessage, null, null,null, null, defaultTargetToUserEdOrg); } SecurityEventBuilder(); SecurityEv...
### Question: ApplicationAuthorizationValidator { @SuppressWarnings("unchecked") public boolean isAuthorizedForApp(Entity app, SLIPrincipal principal) { if (principal.isAdminRealmAuthenticated()) { return isAdminVisible(app); } else { if (isAutoAuthorized(app)) { return true; } else if (!isOperatorApproved(app)) { retu...
### Question: TokenGenerator { public static String generateToken(int length) { byte[] verifierBytes = new byte[length]; random.nextBytes(verifierBytes); return getAuthorizationCodeString(verifierBytes); } static String generateToken(int length); }### Answer: @Test public void testIdGeneratorZeroLength() { String str...
### Question: EntityDefinition { public void setSchema(NeutralSchema neutralSchema) { this.schema = neutralSchema; this.referenceFields = new LinkedHashMap<String, ReferenceSchema>(); if (this.schema != null) { addRefs("", neutralSchema); } } protected EntityDefinition(String type, String resourceName, String collecti...
### Question: SessionCache { public void put(String token, OAuth2Authentication auth) { if (auth != null) { this.sessions.put(new Element(token, auth)); replicate(token, auth); } else { LOG.warn("Attempting to cache null session!"); } } void put(String token, OAuth2Authentication auth); OAuth2Authentication get(String...
### Question: SessionCache { public void remove(String token) { this.sessions.remove(token); try { ObjectMessage msg = createMessage(token, null, REMOVE); tp.send(msg); } catch (JMSException e) { LOG.error("Failed to replicate session cache entry", e); } } void put(String token, OAuth2Authentication auth); OAuth2Authe...
### Question: DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; } @Override Li...
### Question: DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> getEmbeddedEntities(List<EntityBody> previousEntities, Type currentType) { List<EntityBody> embeddedBodyList = new ArrayList<EntityBody>(); String currType = StringUtils.lowercaseFirstLetter(currentType.getName()); for (Entit...
### Question: DefaultSelectorDocument implements SelectorDocument { protected void addChildTypesToQuery(Type currentType, SelectorQueryPlan selectorQueryPlan, NeutralQuery neutralQuery) { List<Object> childQueries = selectorQueryPlan.getChildQueryPlans(); List<String> embeddedFields = new ArrayList<String>(); for (Obje...
### Question: SemanticSelector extends HashMap<Type, List<SelectorElement>> implements SelectorQueryVisitable { public void addSelector(final Type type, final SelectorElement se) { if (this.containsKey(type)) { this.get(type).add(se); } else { this.put(type, new ArrayList<SelectorElement>(Arrays.asList(se))); } } void...