The com.dwl.datastewardship.data.CodeTablesData class within the Data Stewardship UI API model retrieves and caches all of the data for code tables.
In the following example, retrieves, sorts, and caches data for the CdGroupingTp code table:
private static final String CD_GROUPING_TP = "CdGroupingTp";
private Collection allGroupingTypeCodes;
public Collection getAllGroupingTypeCodes() throws DataStewardshipException {
if (allGroupingTypeCodes == null) {
allGroupingTypeCodes = AdminServices.getAllAdminCodeTypesByLocale(
getLocale(), getUserId(), CD_GROUPING_TP);
//set the Name tag to <no name> if is null
Iterator it = allGroupingTypeCodes.iterator();
while (it.hasNext()) {
DWLEObjCdGroupingTpType eobj = (DWLEObjCdGroupingTpType) it
.next();
if (eobj.getName() == null) {
eobj.setName(NO_NAME);
}
}
}
//sort the type codes by name
EmfObjectSorter emfObjectSorter = new EmfObjectSorter();
emfObjectSorter.sortLexical((List) allGroupingTypeCodes,
AdminPackage.eINSTANCE.getDWLEObjCdGroupingTpType_Name(),
getRequesterLocale());
return allGroupingTypeCodes;
}
public void setAllGroupingTypeCodes(Collection collection) {
allGroupingTypeCodes = collection;
}