}
String binaryName = DominoUtils.escapeForFormulaString(DominoUtils.javaBinaryNameToFilePath(name, "/"));
// Check for appropriate design elements in the DB
NoteCollection notes = design_.getNoteCollection(String.format(
" @Contains($Flags; 'g') & (@Contains($Flags; '[') | @Contains($Flags; 'K')) & $ClassIndexItem='WEB-INF/classes/%s' ",
binaryName), EnumSet.of(SelectOption.MISC_FORMAT));
String noteId = notes.getFirstNoteID();
if (!noteId.isEmpty()) {
Document doc = design_.getAncestorDatabase().getDocumentByID(noteId);
JavaResource res = new JavaResource(doc);
// Load up our class queue with the data
unloadedClasses_.putAll(res.getClassData());
// Now attempt to load the named class
byte[] classData = unloadedClasses_.remove(name);
if (classData != null) {
// It's possible that an old name of the Java class is still lingering in the NSF
// In that case, we'd reach this point, but not have an actual class available to load
return defineClass(name, classData, 0, classData.length);
}
}
// It's also possible that it's stored only as a .class file (e.g. secondary, non-inner classes in a .java)
notes = design_.getNoteCollection(
String.format(" @Contains($Flags; 'g') & @Contains($Flags; 'C') & $FileNames='WEB-INF/classes/%s' ", binaryName),
EnumSet.of(SelectOption.MISC_FORMAT));
noteId = notes.getFirstNoteID();
if (!noteId.isEmpty()) {
Document doc = design_.getAncestorDatabase().getDocumentByID(noteId);
FileResource res = new FileResource(doc);
byte[] classData = res.getFileData();
return defineClass(name, classData, 0, classData.length);