method2testcases stringlengths 118 6.63k |
|---|
### Question:
LanguageListConverter { public List<String> convert(LanguageList languageList) { if (languageList == null) { return null; } return toSliLanguageList(languageList.getLanguages()); } List<String> convert(LanguageList languageList); }### Answer:
@Test public void testNullObject() { List<String> result = co... |
### Question:
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterCon... |
### Question:
MockZis { public String createAckString() { SIF_Message message = new SIF_Message(); SIF_Ack ack = message.ackStatus(0); return sifElementToString(ack); } void parseSIFMessage(String sifString); void broadcastMessage(String xmlMessage); @PostConstruct void setup(); String createAckString(); void getAgent... |
### Question:
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[... |
### Question:
SifEntityGenerator { public static StudentLEARelationship generateTestStudentLeaRelationship() { StudentLEARelationship retVal = new StudentLEARelationship(); retVal.setRefId(TEST_STUDENTLEARELATIONSHIP_REFID); retVal.setStudentPersonalRefId(TEST_STUDENTPERSONAL_REFID); retVal.setLEAInfoRefId(TEST_LEAINFO... |
### Question:
PropertyUtils { public static Properties getProperties(String[] args) throws ParseException { Properties props = new Properties(); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(OPTIONS, args); String zoneUrl = cmd.getOptionValue(FLAG_ZONE_URL, DEFAULT_ZONE_URL); String zoneI... |
### Question:
EventReporterAgent extends Agent { public void startAgent() throws Exception { super.initialize(); setProperties(); Zone[] allZones = getZoneFactory().getAllZones(); zoneConfigurator.configure(allZones); } EventReporterAgent(); EventReporterAgent(String id); EventReporterAgent(String id, ZoneConfigurato... |
### Question:
DatelessExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { return true; } @Override boolean shouldExtract(Entity entity, DateTime upToDate); }### Answer:
@Test public void testshouldExtract() { Entity student = Mockito.mock(Entity.clas... |
### Question:
EventReporter implements Publisher { public List<Event> runReportScript(String script, long waitTime) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { List<Event> eventsSent = new ArrayList<Event>(); LOG.info("Wait time (ms): " + waitTime); String[] eventDescriptors = s... |
### Question:
EventReporter implements Publisher { public Event reportLeaInfoEvent(EventAction action) throws ADKException { LOG.info("LeaInfo " + action.toString()); LEAInfo leaInfo = SifEntityGenerator.generateTestLEAInfo(); if (action == EventAction.CHANGE) { leaInfo.setChanged(); leaInfo.setLEAURL("http: } Event ev... |
### Question:
EventReporter implements Publisher { public Event reportSchoolInfoEvent(EventAction action) throws ADKException { LOG.info("SchoolInfo " + action.toString()); SchoolInfo schoolInfo = SifEntityGenerator.generateTestSchoolInfo(); if (action == EventAction.CHANGE) { schoolInfo.setChanged(); schoolInfo.setSch... |
### Question:
EventReporter implements Publisher { public Event reportStudentPersonalEvent(EventAction action) throws ADKException { LOG.info("StudentPersonal " + action.toString()); StudentPersonal studentPersonal = SifEntityGenerator.generateTestStudentPersonal(); if (action == EventAction.CHANGE) { studentPersonal.s... |
### Question:
EventReporter implements Publisher { public Event reportStudentLeaRelationshipEvent(EventAction action) throws ADKException { LOG.info("StudentLeaRelationship " + action.toString()); StudentLEARelationship studentLeaRelationship = SifEntityGenerator.generateTestStudentLeaRelationship(); if (action == Even... |
### Question:
EventReporter implements Publisher { public Event reportStudentSchoolEnrollmentEvent(EventAction action) throws ADKException { LOG.info("StudentSchoolEnrollment " + action.toString()); StudentSchoolEnrollment studentSchoolEnrollment = SifEntityGenerator.generateTestStudentSchoolEnrollment(); if (action ==... |
### Question:
EventReporter implements Publisher { public Event reportStaffPersonalEvent(EventAction action) throws ADKException { LOG.info("StaffPersonal " + action.toString()); StaffPersonal staffPersonal = SifEntityGenerator.generateTestStaffPersonal(); if (action == EventAction.CHANGE) { staffPersonal.setChanged();... |
### Question:
EventReporter implements Publisher { public Event reportEmployeePersonalEvent(EventAction action) throws ADKException { LOG.info("EmployeePersonal " + action.toString()); EmployeePersonal employeePersonal = SifEntityGenerator.generateTestEmployeePersonal(); if (action == EventAction.CHANGE) { employeePers... |
### Question:
EventReporter implements Publisher { public Event reportStaffAssignmentEvent(EventAction action) throws ADKException { LOG.info("StaffAssignment " + action.toString()); StaffAssignment staffAssignment = SifEntityGenerator.generateTestStaffAssignment(); if (action == EventAction.CHANGE) { staffAssignment.s... |
### Question:
EventReporter implements Publisher { public Event reportEmploymentRecordEvent(EventAction action) throws ADKException { LOG.info("EmploymentRecord " + action.toString()); EmploymentRecord employmentRecord = SifEntityGenerator.generateTestEmploymentRecord(); if (action == EventAction.CHANGE) { employmentRe... |
### Question:
AttendanceExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { String schoolYear = null; if (entity.getBody().containsKey("schoolYearAttendance")) { schoolYear = (String) ((List<Map<String, Object>>) entity.getBody().get("schoolYearAttenda... |
### Question:
EventReporter implements Publisher { public Event reportEmployeeAssignmentEvent(EventAction action) throws ADKException { LOG.info("EmployeeAssignment " + action.toString()); EmployeeAssignment employeeAssignment = SifEntityGenerator.generateTestEmployeeAssignment(); if (action == EventAction.CHANGE) { em... |
### Question:
EventReporter implements Publisher { public Event reportEvent(String messageFile, String eventAction) throws ADKException { Event event = CustomEventGenerator.generateEvent(messageFile, EventAction.valueOf(eventAction)); if (event == null) { LOG.error("Null event can not be reported"); return null; } if (... |
### Question:
CharacterBlacklistStrategy extends AbstractBlacklistStrategy { @Override public boolean isValid(String context, String input) { if (input == null) { return false; } for (char c : input.toCharArray()) { if (characterSet.contains(c)) { return false; } } return true; } CharacterBlacklistStrategy(); @Override... |
### Question:
RegexBlacklistStrategy extends AbstractBlacklistStrategy { @Override public boolean isValid(String context, String input) { if (input == null) { return false; } for (Pattern pattern : patternList) { Matcher matcher = pattern.matcher(input); if (matcher.find()) { return false; } } return true; } RegexBlack... |
### Question:
SelfReferenceExtractor { public String getSelfReferenceFields(Entity entity) { String selfReferenceField = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { selfReferenceField = getSelfReferenc... |
### Question:
TokenSchema extends NeutralSchema { @Override protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { return addError(this.matchesToken(entity), fieldName, entity, getQuotedTokens(), ErrorType.ENUMERATION_MISMATCH, errors); } TokenSchema(); Tok... |
### Question:
EntityDateHelper { public static String retrieveDate(Entity entity) { return (String) entity.getBody().get(EntityDates.ENTITY_DATE_FIELDS.get(entity.getType())); } static boolean shouldExtract(Entity entity, DateTime upToDate); static String retrieveDate(Entity entity); static boolean isPastOrCurrentDate... |
### Question:
IDMapper extends Mapper<T, BSONWritable, T, BSONWritable> { @Override public void map(T id, BSONWritable entity, Context context) throws IOException, InterruptedException { for (String field : idFields.values()) { BSONUtilities.removeField(entity, field); } context.write(id, entity); } @Override void map... |
### Question:
ReferenceSchema extends NeutralSchema { @Override protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { boolean isValidReference = isValidReference(entity); if (!addError(isValidReference, fieldName, entity, "String", ErrorType.INVALID_DATATYP... |
### Question:
LongSchema extends PrimitiveNumericSchema<Long> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).longValue(); } else if (value instanceof Long) { return (Long) value; } else if (value instanceof String) { try { return Long.parseLong((String) value)... |
### Question:
DateTimeSchema extends NeutralSchema { protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { boolean isValid; try { javax.xml.bind.DatatypeConverter.parseDateTime((String) entity); isValid = true; } catch (IllegalArgumentException e2) { isVali... |
### Question:
NaturalKeyExtractor implements INaturalKeyExtractor { @Override public Map<String, Boolean> getNaturalKeyFields(Entity entity) throws NoNaturalKeysDefinedException { Map<String, Boolean> naturalKeyFields = null; NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) {... |
### Question:
NaturalKeyExtractor implements INaturalKeyExtractor { @Override public NaturalKeyDescriptor getNaturalKeyDescriptor(Entity entity) throws NoNaturalKeysDefinedException { Map<String, String> map = getNaturalKeys(entity); if (map == null) { NaturalKeyDescriptor naturalKeyDescriptor = new NaturalKeyDescripto... |
### Question:
EntityDateHelper { protected static boolean isBeforeOrEqualYear(String yearSpan, int upToYear) { int fromYear = Integer.parseInt(yearSpan.split("-")[0]); int toYear = Integer.parseInt(yearSpan.split("-")[1]); return ((upToYear >= toYear) && (upToYear > fromYear)); } static boolean shouldExtract(Entity en... |
### Question:
NaturalKeyExtractor implements INaturalKeyExtractor { public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.er... |
### Question:
IntegerSchema extends PrimitiveNumericSchema<Integer> { @Override public Object convert(Object value) { if (value instanceof Integer) { return (Integer) value; } else if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException nfe) { throw (IllegalArgumentE... |
### Question:
SecurityEventUtil implements MessageSourceAware { public SecurityEvent createSecurityEvent(String loggingClass, String actionDesc, LogLevelType logLevel, String appId, BEMessageCode code, Object... args) { SecurityEvent event = new SecurityEvent(); String seAppId = (appId == null) ? "BulkExtract" : "BulkE... |
### Question:
BooleanSchema extends PrimitiveSchema { @Override public Object convert(Object value) { if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { String stringData = (String) value; stringData = stringData.toLowerCase(); if (stringData.equals("true")) { return Boolean.T... |
### Question:
DateSchema extends NeutralSchema { @Override protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { boolean isValid; try { javax.xml.bind.DatatypeConverter.parseDate((String) entity); isValid = true; } catch (IllegalArgumentException e2) { isVa... |
### Question:
ListSchema extends NeutralSchema { public List<NeutralSchema> getList() { return list; } ListSchema(); ListSchema(String xsdType); @Override NeutralSchemaType getSchemaType(); @Override boolean isPrimitive(); void setList(List<NeutralSchema> list); List<NeutralSchema> getList(); @Override boolean isSimpl... |
### Question:
ListSchema extends NeutralSchema { @Override protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { boolean isValid = true; Object convertedEntity = convert(entity); if (convertedEntity instanceof Set) { convertedEntity = new ArrayList<Object>(... |
### Question:
EdOrgExtractHelper implements InitializingBean { @SuppressWarnings("unchecked") public Set<String> getBulkExtractApps() { TenantContext.setIsSystemCall(true); Iterable<Entity> apps = repository.findAll("application", new NeutralQuery()); TenantContext.setIsSystemCall(false); Set<String> appIds = new HashS... |
### Question:
TimeSchema extends NeutralSchema { protected boolean validate(String fieldName, Object entity, List<ValidationError> errors, Repository<Entity> repo) { boolean isValid = false; try { javax.xml.bind.DatatypeConverter.parseTime((String) entity); isValid = true; } catch (IllegalArgumentException e2) { isVali... |
### Question:
ApiNeutralSchemaValidator extends NeutralSchemaValidator { protected Object getValue(String path, Map<String, Object> data) { Object retValue = null; Map<?, ?> values = new HashMap<String, Object>(data); String[] keys = path.split("\\."); for (String key : keys) { Object value = values.get(key); if (Map.c... |
### Question:
DoubleSchema extends PrimitiveNumericSchema<Double> { @Override public Object convert(Object value) { if (value instanceof Integer) { return ((Integer) value).doubleValue(); } else if (value instanceof Long) { return ((Long) value).doubleValue(); } else if (value instanceof Float) { return ((Float) value)... |
### Question:
EdOrgExtractHelper implements InitializingBean { public Map<String, Set<String>> getBulkExtractEdOrgsPerApp() { NeutralQuery appQuery = new NeutralQuery(new NeutralCriteria("applicationId", NeutralCriteria.CRITERIA_IN, getBulkExtractApps())); Iterable<Entity> apps = repository.findAll("applicationAuthoriz... |
### Question:
Launcher { public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { ... |
### Question:
SelfReferenceValidator { public boolean validate(Entity entity, List<ValidationError> errors) { String selfReferencePath = selfReferenceExtractor.getSelfReferenceFields(entity); if (selfReferencePath != null) { Map<String, Object> body = entity.getBody(); if (body != null) { String property = (String) bod... |
### Question:
NeutralQuery { @Override public String toString() { return "NeutralQuery [includeFields=" + includeFields + ", excludeFields=" + excludeFields + ", offset=" + offset + ", limit=" + limit + ", sortBy=" + sortBy + ", sortOrder=" + sortOrder + ", queryCriteria=" + queryCriteria + ", orQueries=" + orQueries +... |
### Question:
NeutralCriteria { @Override public boolean equals(Object o) { if (o instanceof NeutralCriteria) { NeutralCriteria nc = (NeutralCriteria) o; boolean keysMatch = this.valuesMatch(this.key, nc.key); boolean operatorsMatch = this.valuesMatch(this.operator, nc.operator); boolean valuesMatch = this.valuesMatch(... |
### Question:
EdOrgHierarchyHelper { public Set<Entity> getAncestorsOfEdOrg(Entity entity) { if (isSEA(entity)) { return null; } Set<String> visitedIds = new HashSet<String>(); Set<Entity> ancestors = new HashSet<Entity>(); List<Entity> stack = new ArrayList<Entity>(10); ancestors.add(entity); stack.add(entity); while ... |
### Question:
TypeResolver { public Set<String> resolveType(String type) { if (typeMaps.containsKey(type)) { return typeMaps.get(type); } return new HashSet<String>(Arrays.asList(type)); } Set<String> resolveType(String type); }### Answer:
@Test public void educationOrganzationCollectionAlsoContainsSchools() { Set<St... |
### Question:
EdOrgContextResolverFactory { public ContextResolver getResolver(String entityType) { return resolverMap.get(entityType); } ContextResolver getResolver(String entityType); }### Answer:
@Test public void test() { assertNull(factory.getResolver("doesn't exist")); ContextResolver resolver = factory.getReso... |
### Question:
StaffTeacherDirectRelatedContextResolver extends RelatedContextResolver { @Override protected String getReferenceProperty(String entityType) { if (EntityNames.TEACHER_SCHOOL_ASSOCIATION.equals(entityType) || EntityNames.TEACHER_SECTION_ASSOCIATION.equals(entityType)) { return ParameterConstants.TEACHER_ID... |
### Question:
StudentCompetencyContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity == null) { return Collections.emptySet(); } String studentSectionAssociationId = (String) entity.getBody().get(ParameterConstants.STUDENT_SECTION_ASSOCIATION_ID); Enti... |
### Question:
CourseTranscriptContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); if (entity == null) { return edOrgs; } String studentId = (String) entity.getBody().get(STUDENT_ID); if (studentId != null) { edOrgs.ad... |
### Question:
GradebookEntryContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> studentGradebookEntries = repo.findEach(EntityNames.STUDENT_GRADEBOOK_ENTRY, Query.query(Criteria.where("body.gradebookE... |
### Question:
ParentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> leas = new HashSet<String>(); Iterator<Entity> kids = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(PATH_TO_PARENT).is(entity.getEntityId()))); while(kids.hasNex... |
### Question:
LongValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new LongWritable(Long.parseLong(value.toString())); } } catch (Numbe... |
### Question:
RelatedContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { if (entity.getBody() == null) { return Collections.emptySet(); } String referredId = getReferredId(entity.getType(), entity.getBody()); if (referredId == null) { return Collections.emptySe... |
### Question:
RelatedContextResolver implements ContextResolver { protected String getReferredId(String type, Map<String, Object> body) { String reference = getReferenceProperty(type); if (reference == null) { return null; } String referredId = (String) body.get(reference); return referredId; } RelatedContextResolver()... |
### Question:
DisciplineIncidentContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); Iterator<Entity> students = repo.findEach(EntityNames.STUDENT, Query.query(Criteria.where(DISCIPLINE_INCIDENT_ID).is(entity.getEntity... |
### Question:
DisciplineActionContextResolver implements ContextResolver { @Override public Set<String> findGoverningEdOrgs(Entity entity) { Set<String> edOrgs = new HashSet<String>(); List<String> studentIds = (List<String>) entity.getBody().get(ParameterConstants.STUDENT_ID); for(String studentId: studentIds){ edOrgs... |
### Question:
AllPublicDataExtractor implements PublicDataExtractor { @Override public void extract(ExtractFile file) { extractor.setExtractionQuery(new NeutralQuery()); for (PublicEntityDefinition entity : PublicEntityDefinition.values()) { extractor.extractEntities(file, entity.getEntityName(), new Predicate<Entity>(... |
### Question:
PublicDataFactory { public PublicDataExtractor buildAllPublicDataExtractor(EntityExtractor extractor) { return new AllPublicDataExtractor(extractor); } PublicDataExtractor buildAllPublicDataExtractor(EntityExtractor extractor); List<PublicDataExtractor> buildPublicDataExtracts(EntityExtractor extractor);... |
### Question:
PublicDataFactory { public List<PublicDataExtractor> buildPublicDataExtracts(EntityExtractor extractor) { List<PublicDataExtractor> list = new ArrayList<PublicDataExtractor>(); list.add(buildAllPublicDataExtractor(extractor)); return list; } PublicDataExtractor buildAllPublicDataExtractor(EntityExtractor... |
### Question:
SectionEmbeddedDocsExtractor implements EntityDatedExtract { @SuppressWarnings("unchecked") @Override public void extractEntities(final EntityToEdOrgDateCache gradebookEntryCache) { Iterator<Entity> sections = this.repository.findEach(EntityNames.SECTION, new NeutralQuery()); while (sections.hasNext()) { ... |
### Question:
StudentGradebookEntryExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache studentCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STUDENT_GRADEBOOK_ENTRY, this.getClass().getName()); Iterator<Entity> studentGradebookEntries = repo.... |
### Question:
ParentExtractor implements EntityExtract { @Override public void extractEntities(EntityToEdOrgCache entityToEdorgCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.PARENT, this.getClass().getName()); Iterator<Entity> parents = repo.findEach(EntityNames.PARENT, new NeutralQuery()); S... |
### Question:
StaffExtractor implements EntityDatedExtract { @Override public void extractEntities(EntityToEdOrgDateCache staffToEdorgDateCache) { edOrgExtractHelper.logSecurityEvent(map.getEdOrgs(), EntityNames.STAFF, this.getClass().getName()); Iterator<Entity> staffs = repo.findEach(EntityNames.STAFF, new NeutralQue... |
### Question:
EnumValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { value = Enum.valueOf(enumClass, value).toString(); rval = new Text(value); ... |
### Question:
ExtractorFactory { public ExtractFile buildEdOrgExtractFile(String path, String edOrg, String archiveName, Map<String, PublicKey> appPublicKeys, SecurityEventUtil securityEventUtil) { File directory = new File(path, edOrg); directory.mkdirs(); return new ExtractFile(directory, archiveName, appPublicKeys, ... |
### Question:
ExtractorFactory { public EntityDatedExtract buildAttendanceExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new AttendanceExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityE... |
### Question:
ExtractorFactory { public StudentExtractor buildStudentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentExtractor(extractor, map, repo, new ExtractorHelper(edOrgExtractHelper), edOrgExtractHelper); } StudentExtrac... |
### Question:
ExtractorFactory { public EntityDatedExtract buildStudentAssessmentExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StudentAssessmentExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExt... |
### Question:
ExtractorFactory { public EntityDatedExtract buildStaffExtractor(EntityExtractor extractor, ExtractFileMap map, Repository<Entity> repo, EdOrgExtractHelper edOrgExtractHelper) { return new StaffExtractor(extractor, map, repo, edOrgExtractHelper); } StudentExtractor buildStudentExtractor(EntityExtractor e... |
### Question:
ExtractorHelper { public Set<String> fetchCurrentParentsFromStudent(Entity student) { Set<String> parents = new TreeSet<String>(); if (student.getEmbeddedData().containsKey(EntityNames.STUDENT_PARENT_ASSOCIATION)) { for (Entity assoc : student.getEmbeddedData().get(EntityNames.STUDENT_PARENT_ASSOCIATION))... |
### Question:
ExtractorHelper { public Map<String, Collection<String>> buildSubToParentEdOrgCache(EntityToEdOrgCache edOrgCache) { Map<String, String> result = new HashMap<String, String>(); HashMultimap<String, String> map = HashMultimap.create(); for(String lea : edOrgCache.getEntityIds()) { for (String child : edOrg... |
### Question:
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 NeutralQu... |
### Question:
DoubleValueMapper extends ValueMapper { @Override public Writable getValue(BSONWritable entity) { Writable rval = NullWritable.get(); String value = null; try { value = BSONUtilities.getValue(entity, fieldName); if (value != null) { rval = new DoubleWritable(Double.parseDouble(value.toString())); } } catc... |
### Question:
DisciplineExtractor implements EntityDatedExtract { @Override @SuppressWarnings("unchecked") public void extractEntities(final EntityToEdOrgDateCache diCache) { extract(EntityNames.DISCIPLINE_INCIDENT, new Function<Entity, Set<String>>() { @Override public Set<String> apply(Entity input) { String id = inp... |
### Question:
LogUtil { public static void audit(SecurityEvent event) { if (entityRepository != null) { Map<String, Object> metadata = new HashMap<String, Object>(); metadata.put("tenantId", event.getTenantId()); entityRepository.create("securityEvent", event.getProperties(), metadata, "securityEvent"); } else { LOG.er... |
### Question:
ExtractFile { public boolean generateArchive() { boolean success = true; TarArchiveOutputStream tarArchiveOutputStream = null; MultiOutputStream multiOutputStream = new MultiOutputStream(); try { for(String app : clientKeys.keySet()){ SecurityEvent event = securityEventUtil.createSecurityEvent(this.getCla... |
### Question:
ErrorFile { public ErrorFile(File parent) { errorFile = new File(parent, ERROR_FILE_NAME); } ErrorFile(File parent); void logEntityError(Entity entity); File getFile(); static final String ERROR_FILE_NAME; }### Answer:
@Test public void testErrorFile() throws IOException { File parentDir = new File("./");... |
### Question:
EntityWriterManager { public Entity write(Entity entity, ExtractFile archiveFile) { writeEntityFile(entity, archiveFile); writerCollectionFile(entity, archiveFile); return entity; } Entity write(Entity entity, ExtractFile archiveFile); void writeDeleteFile(Entity entity, ExtractFile archiveFile); void se... |
### Question:
EntityWriter { public Entity write(Entity entity, JsonFileWriter file, ErrorFile errors) { Entity treated = applicator.apply(entity); try { file.write(treated); } catch (JsonProcessingException e) { LOG.error("Error while extracting from " + entity.getType(), e); errors.logEntityError(entity); } catch (IO... |
### Question:
BulkExtract { @GET @Path("extract") @RightsAllowed({ Right.BULK_EXTRACT }) public Response get(@Context HttpServletRequest request) throws Exception { LOG.info("Received request to stream sample bulk extract..."); logSecurityEvent("Received request to stream sample bulk extract"); validateRequestCertifica... |
### Question:
BulkExtract { @GET @Path("extract/list") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getBulkExtractList(@Context HttpServletRequest request, @Context HttpContext context) throws Exception { LOG.info("Received request for list of links for all edOrgs and public data for this user/app"); logSecur... |
### Question:
IdFieldEmittableKey extends EmittableKey { @Override public BSONObject toBSON() { BSONObject rval = new BasicBSONObject(); rval.put(getIdField().toString(), getId().toString()); return rval; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void s... |
### Question:
BulkExtract { @GET @Path("extract/public") @RightsAllowed({ Right.BULK_EXTRACT }) public Response getPublicExtract(@Context HttpContext context, @Context HttpServletRequest request) { logSecurityEvent("Received request to stream public data"); validateRequestCertificate(request); return getPublicExtractRe... |
### Question:
ResourceUtil { public static String getApiVersion(final UriInfo uriInfo) { if (uriInfo != null) { String uriPath = uriInfo.getPath(); if (uriPath != null) { int indexOfSlash = uriPath.indexOf("/"); if (indexOfSlash >= 0) { String version = uriPath.substring(0, indexOfSlash); return version; } else { retur... |
### Question:
ResourceUtil { public static EmbeddedLink getSelfLinkForEntity(final UriInfo uriInfo, final String entityId, final EntityDefinition defn) { return new EmbeddedLink(ResourceConstants.SELF, getURI(uriInfo, getApiVersion(uriInfo), PathConstants.TEMP_MAP.get(defn.getResourceName()), entityId).toString()); } ... |
### Question:
InProcessDateQueryEvaluator { public boolean entitySatisfiesDateQuery(EntityBody entity, NeutralQuery query) { for (NeutralCriteria andCriteria : query.getCriteria()) { String fieldName = andCriteria.getKey(); String operator = andCriteria.getOperator(); if (NeutralCriteria.CRITERIA_EXISTS.equals(operator... |
### Question:
IdFieldEmittableKey extends EmittableKey { public Text getIdField() { return super.getFieldName(); } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Override void readFields(DataInput data); @Override void write(Data... |
### Question:
SecuritySessionResource { @GET @Path("check") public Object sessionCheck() { final Map<String, Object> sessionDetails = new TreeMap<String, Object>(); if (isAuthenticated(SecurityContextHolder.getContext())) { sessionDetails.put("authenticated", true); SLIPrincipal principal = (SLIPrincipal) SecurityConte... |
### Question:
RealmResource { protected Response validateArtifactResolution(String artifactResolutionEndpoint, String sourceId) { if (artifactResolutionEndpoint == null && sourceId == null) { return null; } Map<String, String> res = new HashMap<String, String>(); if (artifactResolutionEndpoint != null && sourceId != nu... |
### Question:
RealmResource { @GET @Path("{realmId}") @RightsAllowed({ Right.ADMIN_ACCESS }) public Response readRealm(@PathParam("realmId") String realmId) { EntityBody result = service.get(realmId); return Response.ok(result).build(); } @PostConstruct void init(); void setService(EntityService service); @PUT @Path("... |
### Question:
SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } @GET @Path("metadata") @Produces({ "text/xml" }) Response getMetadata()... |
### Question:
SamlFederationResource { @GET @Path("sso/artifact") public Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo) { String artifact = request.getParameter("SAMLart"); String realmId = request.getParameter("RelayState"); if (artifact == null) { throw new APIAccessDen... |
### Question:
IdFieldEmittableKey extends EmittableKey { @Override public String toString() { return "IdFieldEmittableKey [" + getIdField() + "=" + getId().toString() + "]"; } IdFieldEmittableKey(); IdFieldEmittableKey(final String mongoFieldName); Text getIdField(); Text getId(); void setId(final Text value); @Overri... |
### Question:
CustomRoleResource { @GET @Path("{id}") @RightsAllowed({Right.CRUD_ROLE }) public Response read(@PathParam("id") String id, @Context final UriInfo uriInfo) { EntityBody customRole = service.get(id); String realmId = (String)customRole.get("realmId"); if (!realmHelper.getAssociatedRealmIds().contains(realm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.