com.sap.mdm.valuetypes.format
Class MdmValueFormatter

java.lang.Object
  extended bycom.sap.mdm.valuetypes.format.MdmValueFormatter

public class MdmValueFormatter
extends Object

Utility class supplying methods for formatting MDM values


Constructor Summary
MdmValueFormatter()
           
 
Method Summary
static String concatenateDisplayValues(String[] displayVaues)
          Concatenates several display values to a single string where the values are separated by ';'.
static String concatenateDisplayValues(String[] displayVaues, String delimiter)
          Concatenates several display values to a single string where the values are separated by the specified delimeter.
static String[] formatAttributeValue(AttributeProperties attr, MdmValue value, RegionInheritanceProperties regionInheritance, int regionalLayer, DimensionsManager dimensionsManager)
          Formats attribute value (or multi-values) based on the attribute properties definitions and regional layer mode.
static String[] formatAttributeValue(AttributeProperties attr, MdmValue value, RegionInheritanceProperties regionInheritance, int regionalLayer, DimensionsManager dimensionsManager, String nullString, String naString)
          Formats attribute value (or multi-values) based on the attribute properties definitions and regional layer mode.
static String[] formatAttributeValue(AttributeProperties attr, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager)
          Formats attribute value (or multi-values) based on the attribute properties definitions.
static String[] formatAttributeValue(AttributeProperties attr, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager, String nullString, String naString)
          Formats attribute value (or multi-values) based on the attribute properties definitions.
static String formatCurrency(double value, MdmCurrencyFormatInfo currencyFormat)
          Formats the currency value
static String formatDateTime(Date value, MdmDateTimeFormatInfo dateTimeFormat)
          Formats the date/time value
static String[] formatFieldValue(FieldProperties field, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager)
          Formats the field value (or multi-values) based on the field properties definitions.
static String[] formatFieldValue(FieldProperties field, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager, String nullString, String naString)
          Formats the field value (or multi-values) based on the field properties definitions.
static String[] formatLocalizedAttributeValue(AttributeProperties attr, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager, Locale formatLocale)
          Formats attribute value (or multi-values) based on the attribute properties definitions.
static String[] formatLocalizedFieldValue(FieldProperties field, MdmValue value, RegionProperties region, DimensionsManager dimensionsManager, Locale formatLocale)
          Formats the field value (or multi-values) based on the field properties definitions and format locale.
static String formatMeasurement(double value, MdmMeasurementFormatInfo measurementFormat, DimensionsManager dimensionsManager)
          Formats the measurement value
static String formatRealNumber(double number, MdmNumberFormatInfo numberFormat)
          Formats the number value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MdmValueFormatter

public MdmValueFormatter()
Method Detail

formatFieldValue

public static String[] formatFieldValue(FieldProperties field,
                                        MdmValue value,
                                        RegionProperties region,
                                        DimensionsManager dimensionsManager,
                                        String nullString,
                                        String naString)
                                 throws MdmValueFormatException
Formats the field value (or multi-values) based on the field properties definitions.

Parameters:
field - the field properties
value - the field value
region - the region properties. If Null, the first region will be used for multi-regional values and default locale will be used for formatting
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
nullString - the presentation of Null value
naString - the presentation of N/A value
Returns:
array of formatted values
Throws:
MdmValueFormatException

formatFieldValue

public static String[] formatFieldValue(FieldProperties field,
                                        MdmValue value,
                                        RegionProperties region,
                                        DimensionsManager dimensionsManager)
                                 throws MdmValueFormatException
Formats the field value (or multi-values) based on the field properties definitions.

Parameters:
field - the field properties
value - the field value
region - the region properties. If Null, the first region will be used for multi-regional values and default locale will be used for formatting
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
Returns:
array of formatted values
Throws:
MdmValueFormatException

formatAttributeValue

public static String[] formatAttributeValue(AttributeProperties attr,
                                            MdmValue value,
                                            RegionProperties region,
                                            DimensionsManager dimensionsManager,
                                            String nullString,
                                            String naString)
                                     throws MdmValueFormatException
Formats attribute value (or multi-values) based on the attribute properties definitions.

Parameters:
attr - the attribute properties
value - the attribute value
region - the region properties. If Null, the first region will be used for multi-regional values and default locale will be used for formatting
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
nullString - presentation of Null value
naString - presentation of N/A value
Returns:
array of formatted values
Throws:
MdmValueFormatException

formatAttributeValue

public static String[] formatAttributeValue(AttributeProperties attr,
                                            MdmValue value,
                                            RegionProperties region,
                                            DimensionsManager dimensionsManager)
                                     throws MdmValueFormatException
Formats attribute value (or multi-values) based on the attribute properties definitions.

Parameters:
attr - the attribute properties
value - the attribute value
region - the region properties. If Null, the first region will be used for multi-regional values and default locale will be used for formatting
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
Returns:
array of formatted values
Throws:
MdmValueFormatException

formatRealNumber

public static String formatRealNumber(double number,
                                      MdmNumberFormatInfo numberFormat)
                               throws MdmValueFormatException
Formats the number value

Parameters:
number - the number value
numberFormat - the number format definition
Returns:
formatted value
Throws:
MdmValueFormatException

formatMeasurement

public static String formatMeasurement(double value,
                                       MdmMeasurementFormatInfo measurementFormat,
                                       DimensionsManager dimensionsManager)
                                throws MdmValueFormatException
Formats the measurement value

Parameters:
value - the measurement value
measurementFormat - the measurement format definition
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
Returns:
formatted value
Throws:
MdmValueFormatException

formatCurrency

public static String formatCurrency(double value,
                                    MdmCurrencyFormatInfo currencyFormat)
                             throws MdmValueFormatException
Formats the currency value

Parameters:
value - the currency value
currencyFormat - the currency format definition
Returns:
formatted value
Throws:
MdmValueFormatException

formatDateTime

public static String formatDateTime(Date value,
                                    MdmDateTimeFormatInfo dateTimeFormat)
                             throws MdmValueFormatException
Formats the date/time value

Parameters:
value - the date/time value
dateTimeFormat - the date/time format definition
Returns:
formatted value
Throws:
MdmValueFormatException

concatenateDisplayValues

public static String concatenateDisplayValues(String[] displayVaues)
Concatenates several display values to a single string where the values are separated by ';'.

Parameters:
displayVaues - array of display values that should be concatenated.
Returns:
concatenated string

concatenateDisplayValues

public static String concatenateDisplayValues(String[] displayVaues,
                                              String delimiter)
Concatenates several display values to a single string where the values are separated by the specified delimeter.

Parameters:
displayVaues - array of display values that should be concatenated.
delimiter - the delimeter separated display values
Returns:
concatenated string

formatAttributeValue

public static String[] formatAttributeValue(AttributeProperties attr,
                                            MdmValue value,
                                            RegionInheritanceProperties regionInheritance,
                                            int regionalLayer,
                                            DimensionsManager dimensionsManager)
                                     throws MdmValueFormatException
Formats attribute value (or multi-values) based on the attribute properties definitions and regional layer mode.

Parameters:
attr - the attribute properties
value - the attribute value
regionInheritance - the inheritance of the regions. Used only for text attribute, put null in another case.
regionalLayer - regional layer mode. Used only for text attribute, put -1 in another case. If regionalLayer is CURRENT - current session language text value is returned (empty string if there is no value). If regionalLayer is PRIMARY_INHERITED - check the value for current session language, if exists return it, else check the primary inherited languages if exists return it else return empty string. If regionalLayer is INHERITED check the value for current session language, return the value if exists, else check the text value in primary inherited languages, return it if exists and if not check the value in secondary inherited languages.
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
Returns:
array of formatted values
Throws:
MdmValueFormatException
Since:
MDM 7.1
See Also:
RegionalLayer, GetRepositoryInheritedRegionListCommand

formatAttributeValue

public static String[] formatAttributeValue(AttributeProperties attr,
                                            MdmValue value,
                                            RegionInheritanceProperties regionInheritance,
                                            int regionalLayer,
                                            DimensionsManager dimensionsManager,
                                            String nullString,
                                            String naString)
                                     throws MdmValueFormatException
Formats attribute value (or multi-values) based on the attribute properties definitions and regional layer mode.

Parameters:
attr - the attribute properties
value - the attribute value
regionInheritance - the inheritance of the regions. Used only for text attribute, put null in another case.
regionalLayer - regional layer mode. Used only for text attribute, put -1 in another case. If regionalLayer is CURRENT - current session language text value is returned (empty string if there is no value). If regionalLayer is PRIMARY_INHERITED - check the value for current session language, if exists return it, else check the primary inherited languages if exists return it else return empty string. If regionalLayer is INHERITED check the value for current session language, return the value if exists, else check the text value in primary inherited languages, return it if exists and if not check the value in secondary inherited languages.
dimensionsManager - the DimensionsManager instance. Used only for attribute of NUMERIC_TYPE. If Null then only build-in dimensions will be used.
nullString - presentation of Null value
naString - presentation of N/A value
Returns:
array of formatted values
Throws:
MdmValueFormatException
Since:
MDM 7.1
See Also:
RegionalLayer, GetRepositoryInheritedRegionListCommand

formatLocalizedAttributeValue

public static String[] formatLocalizedAttributeValue(AttributeProperties attr,
                                                     MdmValue value,
                                                     RegionProperties region,
                                                     DimensionsManager dimensionsManager,
                                                     Locale formatLocale)
                                              throws MdmValueFormatException
Formats attribute value (or multi-values) based on the attribute properties definitions.

Parameters:
attr - the attribute properties
value - the attribute value
region - the region properties. If Null, the first region will be used for multi-regional values and default locale will be used for formatting
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
formatLocale - format locale parameter is used for formatting the value, in case format locale is null the formatting is performed using the region parameter. If the region parameter is null also then formatting is done using the default locale.
Returns:
array of formatted values
Throws:
MdmValueFormatException
Since:
7.2

formatLocalizedFieldValue

public static String[] formatLocalizedFieldValue(FieldProperties field,
                                                 MdmValue value,
                                                 RegionProperties region,
                                                 DimensionsManager dimensionsManager,
                                                 Locale formatLocale)
                                          throws MdmValueFormatException
Formats the field value (or multi-values) based on the field properties definitions and format locale.

Parameters:
field - the field properties
value - the field value
region - the region properties. If Null, the first region will be used for multi-regional values
dimensionsManager - the DimensionsManager instance. If Null then only build-in dimensions will be used.
formatLocale - format locale parameter is used for formatting the value, in case format locale is null the formatting is performed using the region parameter. If the region parameter is null also then formatting is done using the default locale.
Returns:
array of formatted values
Throws:
MdmValueFormatException
Since:
7.2


Copyright 2004-2007 by SAP AG. All Rights Reserved.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.