Ejemplo n.º 1
0
 /**
  * Checks to see if there has been an override lookup declared for the maintenance field. If so,
  * the override will be used for the quickfinder and lookup utils will not be called. If no
  * override was given, LookupUtils.setFieldQuickfinder will be called to set the system generated
  * quickfinder based on the attributes relationship to the parent business object.
  *
  * @return Field with quickfinder set if one was found
  */
 public static final Field setFieldQuickfinder(
     BusinessObject businessObject,
     String attributeName,
     MaintainableFieldDefinition maintainableFieldDefinition,
     Field field,
     List<String> displayedFieldNames,
     SelectiveReferenceRefresher srr) {
   if (maintainableFieldDefinition.getOverrideLookupClass() != null
       && StringUtils.isNotBlank(maintainableFieldDefinition.getOverrideFieldConversions())) {
     field.setQuickFinderClassNameImpl(
         maintainableFieldDefinition.getOverrideLookupClass().getName());
     field.setFieldConversions(maintainableFieldDefinition.getOverrideFieldConversions());
     field.setBaseLookupUrl(LookupUtils.getBaseLookupUrl(false));
     field.setReferencesToRefresh(
         LookupUtils.convertReferencesToSelectCollectionToString(
             srr.getAffectedReferencesFromLookup(businessObject, attributeName, "")));
     return field;
   }
   if (maintainableFieldDefinition.isNoLookup()) {
     return field;
   }
   return LookupUtils.setFieldQuickfinder(
       businessObject,
       null,
       false,
       0,
       attributeName,
       field,
       displayedFieldNames,
       maintainableFieldDefinition.isNoLookup());
 }
Ejemplo n.º 2
0
  public static final Field setFieldQuickfinder(
      BusinessObject businessObject,
      String collectionName,
      boolean addLine,
      int index,
      String attributeName,
      Field field,
      List<String> displayedFieldNames,
      Maintainable maintainable,
      MaintainableFieldDefinition maintainableFieldDefinition) {
    if (maintainableFieldDefinition.getOverrideLookupClass() != null
        && StringUtils.isNotBlank(maintainableFieldDefinition.getOverrideFieldConversions())) {
      if (maintainable != null) {
        String collectionPrefix = "";
        if (collectionName != null) {
          if (addLine) {
            collectionPrefix = KRADConstants.MAINTENANCE_ADD_PREFIX + collectionName + ".";
          } else {
            collectionPrefix = collectionName + "[" + index + "].";
          }
        }
        field.setQuickFinderClassNameImpl(
            maintainableFieldDefinition.getOverrideLookupClass().getName());

        String prefixedFieldConversions =
            prefixFieldConversionsDestinationsWithCollectionPrefix(
                maintainableFieldDefinition.getOverrideFieldConversions(), collectionPrefix);
        field.setFieldConversions(prefixedFieldConversions);
        field.setBaseLookupUrl(LookupUtils.getBaseLookupUrl(false));
        field.setReferencesToRefresh(
            LookupUtils.convertReferencesToSelectCollectionToString(
                maintainable.getAffectedReferencesFromLookup(
                    businessObject, attributeName, collectionPrefix)));
      }
      return field;
    }
    if (maintainableFieldDefinition.isNoLookup()) {
      return field;
    }
    return LookupUtils.setFieldQuickfinder(
        businessObject,
        collectionName,
        addLine,
        index,
        attributeName,
        field,
        displayedFieldNames,
        maintainable);
  }