private List<ICategorialClassRecord> createInput1() { CategorialClass ts = getTissueSpecimen(); CategorialClass reviewEventParams = getReviewEventParameters(); CategorialClass scg = getSCG(); CategorialClass participant = getParticipant(); ts.addChildCategorialClass(reviewEventParams); ts.addChildCategorialClass(scg); scg.addChildCategorialClass(participant); List<ICategorialClassRecord> scgRecs = createRecord(scg, 1); scgRecs.get(0).addCategorialClassRecords(participant, createRecord(participant, 2)); List<ICategorialClassRecord> tsRecs = createRecord(ts, 2); tsRecs.get(0).addCategorialClassRecords(scg, scgRecs); tsRecs.get(0).addCategorialClassRecords(reviewEventParams, createRecord(reviewEventParams, 1)); List<ICategorialClassRecord> scgRecsMore = createRecord(scg, 2); scgRecsMore.get(1).addCategorialClassRecords(participant, createRecord(participant, 3)); scgRecsMore.get(0).addCategorialClassRecords(participant, createRecord(participant, 2)); tsRecs.get(1).addCategorialClassRecords(scg, scgRecsMore); tsRecs.get(1).addCategorialClassRecords(reviewEventParams, createRecord(reviewEventParams, 1)); return tsRecs; }
/** * Mock method for creating category records. * * @param catClass * @param howMany * @return */ private List<ICategorialClassRecord> createRecord(CategorialClass catClass, int howMany) { List<ICategorialClassRecord> records = new ArrayList<ICategorialClassRecord>(howMany); Collection<AttributeInterface> collection = catClass.getCategorialClassEntity().getAttributeCollection(); Set<AttributeInterface> set = new HashSet<AttributeInterface>(collection); for (int i = 0; i < howMany; i++) { ICategorialClassRecord record = QueryResultFactory.createCategorialClassRecord( catClass, set, new RecordId(recordId++ + "", "")); for (AttributeInterface attr : record.getAttributes()) { record.putStringValueForAttribute(attr, attr.getName() + "_R_" + counter); } records.add(record); counter++; } return records; }
/* * Creating record structure like * * p0 | |-->cpr0-->cp0 |-->cpr1-->cp1 |-->scg0 |-->ts0 |-->ts1 | |-->ms0 * |-->ms1 |-->ms2 * * p1 | |-->cpr2-->cp2 |-->scg1 |-->ts2 |-->ts3 | |-->ms3 |-->ms4 * * p0 cpr0 cp0 scg0 ts0 ms0 p0 cpr0 cp0 scg0 ts0 ms1 p0 cpr0 cp0 scg0 ts0 * ms2 p0 cpr0 cp0 scg0 ts1 ms0 p0 cpr0 cp0 scg0 ts1 ms1 p0 cpr0 cp0 scg0 * ts1 ms2 * * p0 cpr1 cp1 scg0 ts0 ms0 p0 cpr1 cp1 scg0 ts0 ms1 p0 cpr1 cp1 scg0 ts0 * ms2 p0 cpr1 cp1 scg0 ts1 ms0 p0 cpr1 cp1 scg0 ts1 ms1 p0 cpr1 cp1 scg0 * ts1 ms2 * * p1 cpr2 cp2 scg1 ts2 ms3 p1 cpr2 cp2 scg1 ts2 ms4 p1 cpr2 cp2 scg1 ts3 * ms3 p1 cpr2 cp2 scg1 ts3 ms4 * * * @return List<ICategorialClassRecord> */ private List<ICategorialClassRecord> createInput2() { CategorialClass participant = getParticipant(); CategorialClass cpr = getCPR(); CategorialClass cp = getCP(); CategorialClass scg = getSCG(); CategorialClass ts = getTissueSpecimen(); CategorialClass ms = getMs(); participant.addChildCategorialClass(cpr); participant.addChildCategorialClass(scg); cpr.addChildCategorialClass(cp); scg.addChildCategorialClass(ts); scg.addChildCategorialClass(ms); List<ICategorialClassRecord> cprRecs1 = createRecord(cpr, 1); cprRecs1.get(0).addCategorialClassRecords(cp, createRecord(cp, 1)); List<ICategorialClassRecord> cprRecs = createRecord(cpr, 2); cprRecs.get(0).addCategorialClassRecords(cp, createRecord(cp, 1)); cprRecs.get(1).addCategorialClassRecords(cp, createRecord(cp, 1)); List<ICategorialClassRecord> scgRec = createRecord(scg, 1); scgRec.get(0).addCategorialClassRecords(ts, createRecord(ts, 2)); scgRec.get(0).addCategorialClassRecords(ms, createRecord(ms, 3)); List<ICategorialClassRecord> scgRec1 = createRecord(scg, 1); scgRec1.get(0).addCategorialClassRecords(ts, createRecord(ts, 2)); scgRec1.get(0).addCategorialClassRecords(ms, createRecord(ms, 2)); List<ICategorialClassRecord> participantRecs = createRecord(participant, 2); participantRecs.get(0).addCategorialClassRecords(cpr, cprRecs); participantRecs.get(0).addCategorialClassRecords(scg, scgRec); participantRecs.get(1).addCategorialClassRecords(cpr, cprRecs1); participantRecs.get(1).addCategorialClassRecords(scg, scgRec1); return participantRecs; }
/** * Mock Method for getting object for given class name. * * @param className * @param attributes * @return CategorialClass */ private CategorialClass get(String className, String... attributes) { CategorialClass categorialClass = new CategorialClass(); EntityInterface entity = createEntity(className, attributes); categorialClass.setCategorialClassEntity(entity); return categorialClass; }