/**
   * Creates an DataElementAttributes with the given ROM report parameter.
   *
   * @param paramHandle the ROM report parameter.
   * @return the created DataElementAttributes
   */
  private DataElementAttributes updateDataElementAttrs(
      DataElementAttributes dataAttrs, AbstractScalarParameterHandle paramHandle) {
    DataElementAttributes retDataAttrs = dataAttrs;

    if (retDataAttrs == null) retDataAttrs = designFactory.createDataElementAttributes();

    // retDataAttrs.setNullability( DataSetParameterAdapter
    // .newElementNullability( paramHandle.allowNll( ) ) );

    retDataAttrs.setNullability(
        DataSetParameterAdapter.newElementNullability(
            getReportParamAllowMumble(paramHandle, ALLOW_NULL_PROP_NAME)));

    DataElementUIHints uiHints = designFactory.createDataElementUIHints();

    String text = paramHandle.getPromptText();
    String textKey = paramHandle.getPromptTextID();

    if (text != null || textKey != null) {
      uiHints.setDisplayName(text);
      uiHints.setDisplayNameKey(textKey);
    }

    text = paramHandle.getHelpText();
    textKey = paramHandle.getHelpTextKey();

    if (text != null || textKey != null) {
      uiHints.setDescription(text);
      uiHints.setDescriptionKey(textKey);
    }

    retDataAttrs.setUiHints(uiHints);

    return retDataAttrs;
  }
Beispiel #2
0
  /**
   * Updates hint-related information on the ODA <code>columnDefn</code>.
   *
   * @param columnDefn
   * @param hint
   */
  private void updateOdaColumnHint(ColumnDefinition columnDefn, ColumnHintHandle hint) {
    DataElementAttributes dataAttrs = columnDefn.getAttributes();

    DataElementUIHints uiHints = null;
    // update display name

    String displayName = hint.getDisplayName();
    String displayNameKey = hint.getDisplayNameKey();

    if (displayName != null || displayNameKey != null) {
      uiHints = designFactory.createDataElementUIHints();

      uiHints.setDisplayName(displayName);
      uiHints.setDisplayNameKey(displayNameKey);
    }

    // description maps to the description in data element UI hints.
    // String desc = hint.getDescription( );
    // String descKey = hint.getDescriptionKey( );
    /*
     * if ( desc != null || descKey != null ) { if ( uiHints == null )
     * uiHints = designFactory.createDataElementUIHints( );
     *
     * uiHints.setDescription( desc ); uiHints.setDescriptionKey( descKey );
     * }
     */

    dataAttrs.setUiHints(uiHints);

    // update usage hints.

    OutputElementAttributes outputAttrs = null;

    String helpText = hint.getHelpText();
    String helpTextKey = hint.getHelpTextKey();

    if (helpText != null || helpTextKey != null) {
      outputAttrs = designFactory.createOutputElementAttributes();
      if (helpText != null || helpTextKey != null) {
        outputAttrs.setHelpText(helpText);
        outputAttrs.setHelpTextKey(helpTextKey);
      }
    }

    // heading maps to m_label

    String heading = hint.getHeading();
    String headingKey = hint.getHeadingKey();
    if (heading != null || headingKey != null) {
      if (outputAttrs == null) outputAttrs = designFactory.createOutputElementAttributes();
      if (heading != null || headingKey != null) {
        outputAttrs.setLabel(heading);
        outputAttrs.setLabelKey(headingKey);
      }
    }

    // formatting related.

    FormatValue format = hint.getValueFormat();
    // int displayLength = hint.getDisplayLength( );
    // boolean wordWrap = hint.wordWrap( );
    String horizontalAlign = hint.getHorizontalAlign();

    if ((format != null && format.getPattern() != null) || horizontalAlign != null) {
      if (outputAttrs == null) outputAttrs = designFactory.createOutputElementAttributes();

      ValueFormatHints formatHint = designFactory.createValueFormatHints();

      if (format != null) formatHint.setDisplayFormat(format.getPattern());
      // formatHint.setDisplaySize( displayLength );
      formatHint.setHorizontalAlignment(convertToOdaHorizontalAlignment(horizontalAlign));
      // formatHint.setTextWrapType( convertToROMWordWrap( wordWrap ) );

      // cannot handle text format since two objects in ODA and ROM are
      // different.

      outputAttrs.setFormattingHints(formatHint);
    }

    columnDefn.setUsageHints(outputAttrs);

    // update axis attributes

    AxisAttributes axisAttrs = null;

    String analysisType = hint.getAnalysis();
    AxisType axisType = convertAnalysisTypeToAxisType(analysisType);

    if (axisType != null) {
      axisAttrs = designFactory.createAxisAttributes();
      axisAttrs.setAxisType(axisType);
      axisAttrs.setOnColumnLayout(hint.isOnColumnLayout());
      String analysisColumnName = hint.getAnalysisColumn();
      if (!StringUtil.isBlank(analysisColumnName)) {
        ResultSubset relatedColumns = designFactory.createResultSubset();
        relatedColumns.addColumnIdentifier(analysisColumnName);
        axisAttrs.setRelatedColumns(relatedColumns);
      }
    }

    columnDefn.setMultiDimensionAttributes(axisAttrs);
  }