atg.svc.ui.util
Class PropertyFormatter

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.svc.ui.util.PropertyFormatter
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class PropertyFormatter
extends atg.nucleus.GenericService

Formats property data for display. The formatProperty method takes a property name and property value. The property name is used to lookup a FieldDefinition for the property. If one is found the type is used to lookup a formatter for the property value. Otherwise, the propertyValue class type is used to lookup a formatter. If both these checks do not match a formatter the text formatter is used by default. The text formatter simply calls toString on the property value object.


Nested Class Summary
protected  class PropertyFormatter.BooleanValueFormatter
          Renders an object value as a boolean (true/false).
protected  class PropertyFormatter.DateValueFormatter
          Renders an object value as a Date.
protected  class PropertyFormatter.DecimalValueFormatter
           
protected  class PropertyFormatter.ListValueFormatter
           
protected  class PropertyFormatter.NumberValueFormatter
           
protected  class PropertyFormatter.OrganizationValueFormatter
           
protected  class PropertyFormatter.StatementValueFormatter
           
protected static class PropertyFormatter.TextValueFormatter
           
protected  class PropertyFormatter.UserValueFormatter
           
protected static interface PropertyFormatter.ValueFormatter
          Formats an Object into a String that can be displayed.
 
Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
PropertyFormatter()
           
 
Method Summary
 java.lang.String formatProperty(java.lang.String pPropertyName, java.lang.Object pPropertyValue)
          Formats the given property value for the given property name.
 atg.svc.repository.service.util.AttachmentUtils getAttachmentUtils()
          Gets the AttachmentUtils component.
 int getMaximumFractionDigits()
          Sets the maximum number of digits to display to the right of the decimal point.
 int getMinimumFractionDigits()
          Sets the minimum number of digits to display to the right of the decimal point.
 ProfileService getProfileService()
          Gets the ProfileService business component.
 SolutionMetadataService getSolutionMetadataService()
          Gets the SolutionMetadataService business component.
 SolutionService getSolutionService()
          Gets the SolutionService business component.
 java.lang.String getUserNameDisplayPattern()
          Gets the format to use to display a user name.
 java.lang.String getUserNameDisplayProperties()
          Gets a comma separated list of profile properties to use when displaying a username using the userNameDisplayFormat string.
 boolean isFormatNumbers()
          Returns true if numbers should be formatted using the user's locale.
 void setAttachmentUtils(atg.svc.repository.service.util.AttachmentUtils pAttachmentUtils)
          Sets the AttachmentUtils component.
 void setFormatNumbers(boolean pFormatNumbers)
          Set true if numbers should be formatted using the user's locale.
 void setMaximumFractionDigits(int pMaximumFractionDigits)
          Gets the maximum number of digits to display to the right of the decimal point.
 void setMinimumFractionDigits(int pMinimumFractionDigits)
          Gets the minimum number of digits to display to the right of the decimal point.
 void setProfileService(ProfileService pProfileService)
          Sets the ProfileService business component.
 void setSolutionMetadataService(SolutionMetadataService pSolutionMetadataService)
          Sets the SolutionMetadataService business component.
 void setSolutionService(SolutionService pSolutionService)
          Sets the SolutionService business component.
 void setUserNameDisplayPattern(java.lang.String pUserNameDisplayPattern)
          Sets the format to use to display a user name.
 void setUserNameDisplayProperties(java.lang.String pUserNameDisplayProperties)
          Sets a comma separated list of profile properties to use when displaying a username using the userNameDisplayFormat string.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

PropertyFormatter

public PropertyFormatter()
Method Detail

getSolutionService

public SolutionService getSolutionService()
Gets the SolutionService business component.

Returns:
The SolutionService business component.

setSolutionService

public void setSolutionService(SolutionService pSolutionService)
Sets the SolutionService business component.

Parameters:
pSolutionService - The SolutionService business component.

getSolutionMetadataService

public SolutionMetadataService getSolutionMetadataService()
Gets the SolutionMetadataService business component.

Returns:
The SolutionMetadataService business component.

setSolutionMetadataService

public void setSolutionMetadataService(SolutionMetadataService pSolutionMetadataService)
Sets the SolutionMetadataService business component.

Parameters:
pSolutionMetadataService - The SolutionMetadataService business component.

getProfileService

public ProfileService getProfileService()
Gets the ProfileService business component.

Returns:
The ProfileService business component.

setProfileService

public void setProfileService(ProfileService pProfileService)
Sets the ProfileService business component.

Parameters:
pProfileService - The ProfileService business component.

getAttachmentUtils

public atg.svc.repository.service.util.AttachmentUtils getAttachmentUtils()
Gets the AttachmentUtils component.

Returns:
The AttachmentUtils component.

setAttachmentUtils

public void setAttachmentUtils(atg.svc.repository.service.util.AttachmentUtils pAttachmentUtils)
Sets the AttachmentUtils component.

Parameters:
pAttachmentUtils - The AttachmentUtils component.

getUserNameDisplayPattern

public java.lang.String getUserNameDisplayPattern()
Gets the format to use to display a user name. The format is the standard message format. Example: {0}, {1} to display one profile property, a comma and another profile property. The profile properties are defined in the userDisplayProperties property.

Returns:
The format to use when displaying a user name.

setUserNameDisplayPattern

public void setUserNameDisplayPattern(java.lang.String pUserNameDisplayPattern)
Sets the format to use to display a user name. The format is the standard message format. Example: {0}, {1} to display one profile property, a comma and another profile property. The profile properties are defined in the userDisplayProperties property.

Parameters:
pUserNameDisplayPattern - The format to use when displaying a user name.

getUserNameDisplayProperties

public java.lang.String getUserNameDisplayProperties()
Gets a comma separated list of profile properties to use when displaying a username using the userNameDisplayFormat string. The string must contain the name of properties known to be in the user profile and match the number of properties expected in the userNameDisplayFormat property. Example: lastName,firstName would use the values in the profile lastName and firstName properties to fill in the parameters specified in the userNameDisplayFormat property.

Returns:
A comma separated string list of profile properties.

setUserNameDisplayProperties

public void setUserNameDisplayProperties(java.lang.String pUserNameDisplayProperties)
Sets a comma separated list of profile properties to use when displaying a username using the userNameDisplayFormat string. The string must contain the name of properties known to be in the user profile and match the number of properties expected in the userNameDisplayFormat property. Example: lastName,firstName would use the values in the profile lastName and firstName properties to fill in the parameters specified in the userNameDisplayFormat property.

Parameters:
pUserNameDisplayProperties - A comma separated string list of profile properties.

getMaximumFractionDigits

public int getMaximumFractionDigits()
Sets the maximum number of digits to display to the right of the decimal point.

Returns:
The maximum number of digits to display to the right of the decimal point.

setMaximumFractionDigits

public void setMaximumFractionDigits(int pMaximumFractionDigits)
Gets the maximum number of digits to display to the right of the decimal point.

Parameters:
pMaximumFractionDigits - The maximum number of digits to display to the right of the decimal point.

getMinimumFractionDigits

public int getMinimumFractionDigits()
Sets the minimum number of digits to display to the right of the decimal point.

Returns:
The minimum number of digits to display to the right of the decimal point.

setMinimumFractionDigits

public void setMinimumFractionDigits(int pMinimumFractionDigits)
Gets the minimum number of digits to display to the right of the decimal point.

Parameters:
pMinimumFractionDigits - The minimum number of digits to display to the right of the decimal point.

isFormatNumbers

public boolean isFormatNumbers()
Returns true if numbers should be formatted using the user's locale. Otherwise, toString() is used.

Returns:
True if numbers should be formatted.

setFormatNumbers

public void setFormatNumbers(boolean pFormatNumbers)
Set true if numbers should be formatted using the user's locale. Otherwise, toString() is used.

Parameters:
pFormatNumbers - True if numbers should be formatted.

formatProperty

public java.lang.String formatProperty(java.lang.String pPropertyName,
                                       java.lang.Object pPropertyValue)
Formats the given property value for the given property name. The property name is used to lookup the FieldDefinition that defines the property type and a mapping to a property type renderer. If the property doesnt have a FieldDefinition the rendering is based on the property value type.

Parameters:
pPropertyName - The name of the property to render. If the name is null or does not correspond to a field definition then the type of the pPropertyValue parameter determines the formatter to use.
pPropertyValue - The value of the property the render. If the value is null an empty string is returned.
Returns:
The value rendered as a String.