@SuppressWarnings("unchecked")
 @Override
 public List<String> listPrimaryKeyFieldNames(Class<?> type) {
   List<String> keys = new ArrayList<String>();
   if (type == null) {
     return keys;
   }
   if (isPersistable(type)) {
     keys = persistenceStructureService.listPrimaryKeyFieldNames(type);
   } else {
     ModuleService responsibleModuleService = kualiModuleService.getResponsibleModuleService(type);
     if (responsibleModuleService != null && responsibleModuleService.isExternalizable(type)) {
       keys = responsibleModuleService.listPrimaryKeyFieldNames(type);
     } else {
       // check the Data Dictionary for PK's of non PBO/EBO
       DataObjectEntry dataObjectEntry =
           dataDictionaryService.getDataDictionary().getDataObjectEntry(type.getName());
       if (dataObjectEntry != null) {
         List<String> pks = dataObjectEntry.getPrimaryKeys();
         if (pks != null) {
           keys = pks;
         }
       } else {
         LOG.warn(
             "Unable to retrieve data object entry for non-persistable KNS-managed class: "
                 + type.getName());
       }
     }
   }
   return keys;
 }
  /**
   * @see
   *     org.kuali.rice.krad.uif.service.UifDefaultingService#deriveLookupViewFromMetadata(org.kuali.rice.krad.datadictionary.DataObjectEntry)
   */
  @Override
  public LookupView deriveLookupViewFromMetadata(DataObjectEntry dataObjectEntry) {
    LookupView view = ComponentFactory.getLookupView();
    view.setHeaderText(dataObjectEntry.getObjectLabel() + " Lookup");
    view.setDataObjectClass(dataObjectEntry.getDataObjectClass());
    view.setCriteriaFields(new ArrayList<Component>());
    view.setResultFields(new ArrayList<Component>());
    view.setDefaultSortAttributeNames(dataObjectEntry.getPrimaryKeys());

    addAttributesToLookupCriteria(view, dataObjectEntry);
    addAttributesToLookupResults(view, dataObjectEntry);

    return view;
  }