Esempio n. 1
0
  /**
   * Performs additional indexing based on the view type associated with the view instance. The
   * {@code ViewTypeService} associated with the view type name on the instance is invoked to
   * retrieve the parameter key/value pairs from the configured property values, which are then used
   * to build up an index used to key the entry
   *
   * @param propertyValues - property values configured on the view bean definition
   * @param id - id (or bean name if id was not set) for the view
   */
  protected void indexViewForType(PropertyValues propertyValues, String id) {
    String viewTypeName = ViewModelUtils.getStringValFromPVs(propertyValues, "viewTypeName");
    if (StringUtils.isBlank(viewTypeName)) {
      return;
    }

    UifConstants.ViewType viewType = ViewType.valueOf(viewTypeName);

    ViewTypeService typeService =
        KRADServiceLocatorWeb.getViewService().getViewTypeService(viewType);
    if (typeService == null) {
      // don't do any further indexing
      return;
    }

    // invoke type service to retrieve it parameter name/value pairs
    Map<String, String> typeParameters =
        typeService.getParametersFromViewConfiguration(propertyValues);

    // build the index string from the parameters
    String index = buildTypeIndex(typeParameters);

    // get the index for the type and add the view entry
    ViewTypeDictionaryIndex typeIndex = getTypeIndex(viewType);

    typeIndex.put(index, id);
  }
 protected ViewService getViewService() {
   return KRADServiceLocatorWeb.getViewService();
 }