Page History
Code Block |
---|
public void testHistory() {
String NCIt = "NCI Thesaurus";
String NCIm = "NCI Metathesaurus";
try {
System.out.println("***********************");
System.out.println("Testing History");
System.out.println("***********************");
HistoryService hs = lbSvc.getHistoryService(NCIt);
// Test getBaselines
SystemReleaseList srl = hs.getBaselines(null, null);
if (srl.getSystemReleaseCount() > 10) {
System.out
.println("Success : NCI Thesaurus history baselines retrieved");
} else {
System.out
.println("FAILURE : NCI Thesaurus history baselines not found");
}
//The hold is just a bin to demonstrate the different calls that can be made.
String hold = srl.getSystemRelease(0).getReleaseURI();
hold = srl.getSystemRelease(28).getReleaseURI();
SystemRelease sr = hs.getEarliestBaseline();
hold = sr.getEntityDescription().getContent();
long time = sr.getReleaseDate().getTime();
CodingSchemeVersion csv = hs.getConceptCreationVersion(Constructors.createConceptReference("C49239", null));
hold = csv.getReleaseURN();
hold = csv.getVersion();
time = csv.getVersionDate().getTime();
hold = csv.getEntityDescription().getContent();
// Test get edit actions
NCIChangeEventList ncel = hs.getEditActionList(
Constructors.createConceptReference("C7696", null), null,
null);
if (ncel.getEntryCount() > 5) {
System.out
.println("Success : NCI Thesaurus history edits retrieved");
} else {
System.out
.println("FAILURE : NCI Thesaurus history edits not found");
}
//C41330 and C71027 were merged, with C71027 being retired and C41330 remaining active
//getAncestors checks to see if any concepts have contributed to C41330.
ncel = hs.getAncestors(Constructors.createConceptReference("C41330", null));
NCIChangeEvent[] nce = ncel.getEntry();
//getDescendants checks to see if this concepts has contributed to any other concept.
//The getDescendants method is useful if the concept you have is retired and you want to
//see what other concept should be used.
ncel = hs.getDescendants(Constructors.createConceptReference("C71027", null));
nce = ncel.getEntry();
//Test Metathesaurus History
hs = lbSvc.getHistoryService(NCIm);
srl = hs.getBaselines(null, null);
if (srl.getSystemReleaseCount() > 10) {
System.out
.println("Success : Metathesaurus history baselines retrieved");
} else {
System.out
.println("FAILURE : MetaThesaurus history baselines not found");
}
ncel = hs.getEditActionList(
Constructors.createConceptReference("C0359583", null),
null, null);
if (ncel.getEntryCount() > 0) {
System.out
.println("Success : Metathesaurus history edits retrieved");
} else {
System.out
.println("FAILURE : Metathesaurus history edits not found");
}
} catch (Exception e) {
e.printStackTrace();
}
} |