Пример #1
0
 /**
  * This method gets the list of Sponsor Term Types from the database.
  *
  * @param
  */
 protected List<KeyValue> getSponsorTermTypesFromDatabase() {
   PersistableBusinessObjectValuesFinder persistableBusinessObjectValuesFinder =
       new PersistableBusinessObjectValuesFinder();
   persistableBusinessObjectValuesFinder.setBusinessObjectClass(SponsorTermType.class);
   persistableBusinessObjectValuesFinder.setKeyAttributeName(SPONSOR_TERM_TYPE_CODE);
   persistableBusinessObjectValuesFinder.setLabelAttributeName(DESCRIPTION);
   return persistableBusinessObjectValuesFinder.getKeyValues();
 }
  /**
   * Creates the ProtocolSpecialReviewValuesFinder setting any internal dependencies to defaults.
   */
  public SpecialReviewExemptionValuesFinder() {
    PersistableBusinessObjectValuesFinder boFinder = new PersistableBusinessObjectValuesFinder();
    boFinder.setBusinessObjectClass(ExemptionType.class);
    boFinder.setKeyAttributeName("exemptionTypeCode");
    boFinder.setLabelAttributeName("description");

    this.finder = new SortedValuesFinder(boFinder);
  }
Пример #3
0
 /**
  * This method prepares a finder
  *
  * @return
  */
 KeyValuesFinder getFinder() {
   if (finder == null) {
     PersistableBusinessObjectValuesFinder extendedFinder =
         new PersistableBusinessObjectValuesFinder();
     extendedFinder.setBusinessObjectClass(FandaRateType.class);
     extendedFinder.setKeyAttributeName("fandaRateTypeCode");
     extendedFinder.setLabelAttributeName("description");
     finder = extendedFinder;
   }
   return finder;
 }
 @Test
 public void testGetKeyValues() throws Exception {
   PersistableBusinessObjectValuesFinder persistableBusinessObjectValuesFinder =
       (PersistableBusinessObjectValuesFinder) getValuesFinderClass().newInstance();
   persistableBusinessObjectValuesFinder.setBusinessObjectClass(getBusinessObjectClass());
   persistableBusinessObjectValuesFinder.setIncludeKeyInDescription(isIncludeKeyInDescription());
   persistableBusinessObjectValuesFinder.setKeyAttributeName(getKeyAttributeName());
   persistableBusinessObjectValuesFinder.setLabelAttributeName(getLabelAttributeName());
   persistableBusinessObjectValuesFinder.getKeyValues();
   assertEquals(
       "expected:\n"
           + testKeyValues
           + "\nactual:\n"
           + persistableBusinessObjectValuesFinder.getKeyValues(),
       testKeyValues.size(),
       persistableBusinessObjectValuesFinder.getKeyValues().size());
   for (int i = 0; i < testKeyValues.size(); i++) {
     assertEquals(
         testKeyValues.get(i).getValue(),
         persistableBusinessObjectValuesFinder.getKeyLabel(
             testKeyValues.get(i).getKey().toString()));
   }
 }