***  This class is subject to change.  ***

com.sas.iquery.metadata.serverprop.formats
Class SASFormatDescriptionUtil

com.sas.iquery.metadata.serverprop.formats.SASFormatDescriptionUtil

public class SASFormatDescriptionUtil

Performs a series of getters on SAS specific format description. This is a helper class.


Constructor Summary
SASFormatDescriptionUtil()
           
 
Method Summary
static SASFormatAttributes getFormatAttributes(java.lang.String formatString)
          Given a SASFormat String, this method will return a SASFormatAttributes object with the format string's attributes like the base format name, width etc.
static SASFormatDescription getFormatDescription(java.lang.String baseFormatName)
          Get a SASFormatDescription for a base format name.
static SASFormatDescription getFormatDescription(java.lang.String baseFormatName, java.util.Locale locale)
          Get a SASFormatDescription for a base format name.
static java.lang.String getFormatDescriptionString(SASFormatDescription desc)
          Returns the given format description as a String.
static java.lang.String getFormatDescriptionString(SASFormatDescription desc, int width)
          Returns the format description as a String based the SASFormatDescription and width.
static java.lang.String getFormatDescriptionString(SASFormatDescription desc, int width, int decimalWidth)
          Returns format description as a String based on the SASFormatDescription, width and decimal width.
static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName)
          Returns the format description as a String for the given base format name.
static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName, int width)
          Returns format description as a String based on the base format name and width.
static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName, int width, int decimalWidth)
          Returns format description as a String based on the base format name, width, and decimal width.
static java.util.List<SASFormatDescription> getFormatsByType(SASFormatCategory type, BusinessModel model, java.util.Locale locale)
          Visits the appropriate server for this business model and retrieves all the formats for the given type.
static java.util.List<SASFormatDescription> getUserDefinedFormats(BusinessModel model, java.util.Locale locale)
          Visits the appropriate server for this business model and retrieves all user defined formats.
static boolean isFormatUserDefined(java.lang.String format, BusinessModel model, java.util.Locale locale)
          Tests the format to see if it is user defined.
 

Constructor Detail

SASFormatDescriptionUtil

public SASFormatDescriptionUtil()
Method Detail
***  This method is subject to change.  ***

getFormatDescription

public static SASFormatDescription getFormatDescription(java.lang.String baseFormatName)
Get a SASFormatDescription for a base format name.

Parameters:
baseFormatName - base format name e.g $ASCII
Returns:
SASFormatDescription null if not found for this base format name

***  This method is subject to change.  ***

getFormatDescription

public static SASFormatDescription getFormatDescription(java.lang.String baseFormatName,
                                                        java.util.Locale locale)
Get a SASFormatDescription for a base format name.

Parameters:
baseFormatName - base format name e.g $ASCII
Returns:
SASFormatDescription null if not found for this base format name

***  This method is subject to change.  ***

getFormatAttributes

public static SASFormatAttributes getFormatAttributes(java.lang.String formatString)
                                               throws SASFormatException
Given a SASFormat String, this method will return a SASFormatAttributes object with the format string's attributes like the base format name, width etc.

Parameters:
formatString - a SASFormatString e.g. $ASCII22.2
Returns:
SASFormatAttributes containing the attributes
Throws:
SASFormatException - in case of any error

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName)
Returns the format description as a String for the given base format name.

Returns:
the format description as a String e.g $ASCII

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(SASFormatDescription desc)
Returns the given format description as a String.

Returns:
the format description as a String e.g $ASCII

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName,
                                                          int width)
Returns format description as a String based on the base format name and width.

Returns:
the format description as a String e.g $ASCII.12.0

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(SASFormatDescription desc,
                                                          int width)
Returns the format description as a String based the SASFormatDescription and width.

Returns:
the format description as a String e.g $ASCII22.0

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(java.lang.String baseFormatName,
                                                          int width,
                                                          int decimalWidth)
Returns format description as a String based on the base format name, width, and decimal width.

Returns:
the format description as a String e.g $ASCII22.2

***  This method is subject to change.  ***

getFormatDescriptionString

public static java.lang.String getFormatDescriptionString(SASFormatDescription desc,
                                                          int width,
                                                          int decimalWidth)
Returns format description as a String based on the SASFormatDescription, width and decimal width.

Returns:
the format description as a String e.g $ASCII22.2

***  This method is subject to change.  ***

isFormatUserDefined

public static boolean isFormatUserDefined(java.lang.String format,
                                          BusinessModel model,
                                          java.util.Locale locale)
                                   throws SASFormatException
Tests the format to see if it is user defined. Each time this method is called, we connect to the appropriate server for this business model and retrieves all user defined formats. Check for User defined format is done only for relational business model at this point of time, OLAP is not supported.

Parameters:
format - Input format. This can be of the form BEST or BEST12.2
model - The business model
locale - The users locale
Returns:
True if the format is a user defined format
Throws:
SASFormatException

***  This method is subject to change.  ***

getUserDefinedFormats

public static java.util.List<SASFormatDescription> getUserDefinedFormats(BusinessModel model,
                                                                         java.util.Locale locale)
                                                                  throws SASFormatException
Visits the appropriate server for this business model and retrieves all user defined formats. If an OLAP business model is given, an empty list will be returned.

Parameters:
model - The business model
locale - The users locale
Returns:
List of user defined formats. An empty list is found if none are found.
Throws:
SASFormatException

***  This method is subject to change.  ***

getFormatsByType

public static java.util.List<SASFormatDescription> getFormatsByType(SASFormatCategory type,
                                                                    BusinessModel model,
                                                                    java.util.Locale locale)
                                                             throws SASFormatException
Visits the appropriate server for this business model and retrieves all the formats for the given type.

Parameters:
model - The business model
locale - The users locale
Returns:
List of formats of that type specified. An empty list is found if none are found.
Throws:
SASFormatException

***  This class is subject to change.  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.