Package org.cyclos.impl.utils.sms
Class SmsOperationFormatterImpl
- java.lang.Object
-
- org.cyclos.model.utils.AbstractFormatter
-
- org.cyclos.impl.utils.formatting.FormatterImpl
-
- org.cyclos.impl.utils.sms.SmsOperationFormatterImpl
-
- All Implemented Interfaces:
Formatter
public class SmsOperationFormatterImpl extends FormatterImpl
Wraps aFormatterImpltruncating the result of some format methods
-
-
Field Summary
Fields Modifier and Type Field Description static intUSER_NAME_MAX_LENMax length to be shown for formatted user.-
Fields inherited from interface org.cyclos.utils.Formatter
VARIABLE_SCALE
-
-
Constructor Summary
Constructors Constructor Description SmsOperationFormatterImpl(FormatterImpl delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(Boolean bool)Formats a booleanStringformat(Integer number)Formats an integer numberStringformat(Long number)Formats a long numberStringformat(Object object)Tests the object type, invoking one of the specific format methodsStringformat(BigDecimal number, int scale)Formats a number with the given scaleStringformat(Collection<?> list)Formats a collection as a comma-separated string, invokingFormatter.format(Object)for each elementStringformat(Date date)Stringformat(Token token)Stringformat(Account account)Stringformat(Trans trans)Stringformat(CustomFieldValue<?,?,?,?> fieldValue)Stringformat(BasicUser basicUser)Stringformat(Phone phone)Stringformat(Record record)Stringformat(DatePeriod period)Stringformat(DecimalRange range)Stringformat(IntegerRange range)Stringformat(FormattedDate formattedDate)Stringformat(ShortFormat sf)Stringformat(AccountOwner accountOwner)Formats an account ownerStringformat(FormattableTimeBasedRate rate)Formats a time based rateStringformat(IBinaryFile file)Formats a binary fileStringformat(INamedEntity namedEntity)Formats a named entityStringformat(ICustomFieldPossibleValue<?> possibleValue)Formats a custom field possible valueStringformat(ICustomFieldValue<?,?,?,?> customFieldValue)Formats a custom field valueStringformat(IImage image)Formats an imageStringformat(ProfileField profileField)Formats a user profile fieldStringformat(HasDisplay hasDisplay)Formats the given object as the display valueStringformat(ICurrencyAmount currencyAmount)Formats a currency amountStringformat(ICurrencyAmountRange range)Formats a currency amount rangeStringformat(IDatePeriod period)Formats a periodStringformat(IDecimalRange range, int scale)Formats a decimal range with the given scaleStringformat(IDimensions dimensions)Formats a dimensionsStringformat(IFileSize fileSize)Formats a file sizeStringformat(ILatLong latLong)Formats a geographical coordinateStringformat(ITimeInterval timeInterval)Formats a time intervalStringformat(Range<?> range)Formats a rangeStringformat(HasMessageKey hasKey)Formats an object that has a mapping to the translation message key.Stringformat(IDate date)Formats a date as date and timeStringformat(TranslationMessageSpecification tms)Formats a translation messageStringformatAsDate(Date date)StringformatAsDate(IDatePeriod period)Formats a period as dateStringformatAsDate(IDate date)Formats an IDate as dateStringformatAsDiff(Date date)StringformatAsTime(Date date)StringformatAsTime(IDate date)Formats an IDate as timeStringformatDuration(Long duration)Formats a duration (given in milliseconds) in a string like: 1h 12m 31sStringformatId(IEntity entity)Formats the entity identifierStringformatPercentage(Double number)Formats a percentage with variable scaleStringformatPercentage(Double number, int scale)Formats a percentage with the given decimal digitsStringformatPercentage(Integer value, Integer total)Formats a percentage without decimal fieldsStringformatPercentage(Integer value, Integer total, int scale)Formats a percentage with the given decimal digitsStringformatPercentage(BigDecimal number)Formats a percentage with variable scaleStringformatPercentage(BigDecimal number, int scale)Formats a percentage with the given decimal fieldsStringformatShort(Date date)Includes the date part in the formatted result only if the difference between the date and the current date is less than 24 hours.StringformatVariables(String text, Map<String,?> variables)Formats variables in form #name# with values retrieved from the given Map, keyed by the name (without #'s)CalendargetCalendar()It gets a calendar using the configuration's time zoneConfigurationAccessorgetConfiguration()ConversionHandlergetConversionHandler()DataTranslationHandlergetDataTranslationHandler()StringgetDatePattern()Returns the date patternEntityManagerHandlergetEntityManagerHandler()StringgetTimePattern()Returns the time patternTranslationHandlergetTranslationHandler()DateparseDate(String text)BigDecimalparseDecimal(String text, int scale)DateparseTime(String text)DateparseTimestamp(String text)-
Methods inherited from class org.cyclos.impl.utils.formatting.FormatterImpl
format, format, format, getCyclosProperties, message
-
Methods inherited from class org.cyclos.model.utils.AbstractFormatter
fixSignIfZero, format, format, format, formatPeriod, formatRange, message, roundHour, splitDecimal
-
-
-
-
Field Detail
-
USER_NAME_MAX_LEN
public static final int USER_NAME_MAX_LEN
Max length to be shown for formatted user.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SmsOperationFormatterImpl
public SmsOperationFormatterImpl(FormatterImpl delegate)
-
-
Method Detail
-
format
public String format(Account account)
- Overrides:
formatin classFormatterImpl
-
format
public String format(AccountOwner accountOwner)
Description copied from interface:FormatterFormats an account owner- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(BasicUser basicUser)
- Overrides:
formatin classFormatterImpl
-
format
public String format(BigDecimal number, int scale)
Description copied from interface:FormatterFormats a number with the given scale- Specified by:
formatin interfaceFormatter- Overrides:
formatin classFormatterImpl
-
format
public String format(Boolean bool)
Description copied from interface:FormatterFormats a boolean- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(Collection<?> list)
Description copied from interface:FormatterFormats a collection as a comma-separated string, invokingFormatter.format(Object)for each element- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(CustomFieldValue<?,?,?,?> fieldValue)
- Overrides:
formatin classFormatterImpl
-
format
public String format(Date date)
- Overrides:
formatin classFormatterImpl
-
format
public String format(DatePeriod period)
- Overrides:
formatin classFormatterImpl
-
format
public String format(DecimalRange range)
- Overrides:
formatin classFormatterImpl
-
format
public String format(FormattableTimeBasedRate rate)
Description copied from interface:FormatterFormats a time based rate- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(FormattedDate formattedDate)
- Overrides:
formatin classFormatterImpl
-
format
public String format(HasDisplay hasDisplay)
Description copied from interface:FormatterFormats the given object as the display value- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(HasMessageKey hasKey)
Description copied from interface:FormatterFormats an object that has a mapping to the translation message key.- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IBinaryFile file)
Description copied from interface:FormatterFormats a binary file- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(ICurrencyAmount currencyAmount)
Description copied from interface:FormatterFormats a currency amount- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(ICurrencyAmountRange range)
Description copied from interface:FormatterFormats a currency amount range- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(ICustomFieldPossibleValue<?> possibleValue)
Description copied from interface:FormatterFormats a custom field possible value- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(ICustomFieldValue<?,?,?,?> customFieldValue)
Description copied from interface:FormatterFormats a custom field value- Specified by:
formatin interfaceFormatter- Overrides:
formatin classFormatterImpl
-
format
public String format(IDate date)
Description copied from interface:FormatterFormats a date as date and time- Specified by:
formatin interfaceFormatter- Overrides:
formatin classFormatterImpl
-
format
public String format(IDatePeriod period)
Description copied from interface:FormatterFormats a period- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IDecimalRange range, int scale)
Description copied from interface:FormatterFormats a decimal range with the given scale- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IDimensions dimensions)
Description copied from interface:FormatterFormats a dimensions- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IFileSize fileSize)
Description copied from interface:FormatterFormats a file size- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IImage image)
Description copied from interface:FormatterFormats an image- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(ILatLong latLong)
Description copied from interface:FormatterFormats a geographical coordinate- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(INamedEntity namedEntity)
Description copied from interface:FormatterFormats a named entity- Specified by:
formatin interfaceFormatter- Overrides:
formatin classFormatterImpl
-
format
public String format(Integer number)
Description copied from interface:FormatterFormats an integer number- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(IntegerRange range)
- Overrides:
formatin classFormatterImpl
-
format
public String format(ITimeInterval timeInterval)
Description copied from interface:FormatterFormats a time interval- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(Long number)
Description copied from interface:FormatterFormats a long number- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(Object object)
Description copied from interface:FormatterTests the object type, invoking one of the specific format methods- Specified by:
formatin interfaceFormatter- Overrides:
formatin classFormatterImpl
-
format
public String format(Phone phone)
- Overrides:
formatin classFormatterImpl
-
format
public String format(ProfileField profileField)
Description copied from interface:FormatterFormats a user profile field- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(Range<?> range)
Description copied from interface:FormatterFormats a range- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
format
public String format(Record record)
- Overrides:
formatin classFormatterImpl
-
format
public String format(ShortFormat sf)
- Overrides:
formatin classFormatterImpl
-
format
public String format(Token token)
- Overrides:
formatin classFormatterImpl
-
format
public String format(Trans trans)
- Overrides:
formatin classFormatterImpl
-
format
public String format(TranslationMessageSpecification tms)
Description copied from interface:FormatterFormats a translation message- Specified by:
formatin interfaceFormatter- Overrides:
formatin classAbstractFormatter
-
formatAsDate
public String formatAsDate(Date date)
- Overrides:
formatAsDatein classFormatterImpl
-
formatAsDate
public String formatAsDate(IDate date)
Description copied from interface:FormatterFormats an IDate as date- Specified by:
formatAsDatein interfaceFormatter- Overrides:
formatAsDatein classFormatterImpl
-
formatAsDate
public String formatAsDate(IDatePeriod period)
Description copied from interface:FormatterFormats a period as date- Specified by:
formatAsDatein interfaceFormatter- Overrides:
formatAsDatein classAbstractFormatter
-
formatAsDiff
public String formatAsDiff(Date date)
- Overrides:
formatAsDiffin classFormatterImpl
-
formatAsTime
public String formatAsTime(Date date)
- Overrides:
formatAsTimein classFormatterImpl
-
formatAsTime
public String formatAsTime(IDate date)
Description copied from interface:FormatterFormats an IDate as time- Specified by:
formatAsTimein interfaceFormatter- Overrides:
formatAsTimein classFormatterImpl
-
formatDuration
public String formatDuration(Long duration)
Description copied from interface:FormatterFormats a duration (given in milliseconds) in a string like: 1h 12m 31s- Specified by:
formatDurationin interfaceFormatter- Overrides:
formatDurationin classAbstractFormatter
-
formatId
public String formatId(IEntity entity)
Description copied from interface:FormatterFormats the entity identifier- Specified by:
formatIdin interfaceFormatter- Overrides:
formatIdin classFormatterImpl
-
formatPercentage
public String formatPercentage(BigDecimal number)
Description copied from interface:FormatterFormats a percentage with variable scale- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatPercentage
public String formatPercentage(BigDecimal number, int scale)
Description copied from interface:FormatterFormats a percentage with the given decimal fields- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatPercentage
public String formatPercentage(Double number)
Description copied from interface:FormatterFormats a percentage with variable scale- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatPercentage
public String formatPercentage(Double number, int scale)
Description copied from interface:FormatterFormats a percentage with the given decimal digits- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatPercentage
public String formatPercentage(Integer value, Integer total)
Description copied from interface:FormatterFormats a percentage without decimal fields- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatPercentage
public String formatPercentage(Integer value, Integer total, int scale)
Description copied from interface:FormatterFormats a percentage with the given decimal digits- Specified by:
formatPercentagein interfaceFormatter- Overrides:
formatPercentagein classAbstractFormatter
-
formatShort
public String formatShort(Date date)
Description copied from class:FormatterImplIncludes the date part in the formatted result only if the difference between the date and the current date is less than 24 hours.- Overrides:
formatShortin classFormatterImpl
-
formatVariables
public String formatVariables(String text, Map<String,?> variables)
Description copied from interface:FormatterFormats variables in form #name# with values retrieved from the given Map, keyed by the name (without #'s)- Specified by:
formatVariablesin interfaceFormatter- Overrides:
formatVariablesin classAbstractFormatter
-
getCalendar
public Calendar getCalendar()
Description copied from class:FormatterImplIt gets a calendar using the configuration's time zone- Overrides:
getCalendarin classFormatterImpl
-
getConfiguration
public ConfigurationAccessor getConfiguration()
- Overrides:
getConfigurationin classFormatterImpl
-
getConversionHandler
public ConversionHandler getConversionHandler()
- Overrides:
getConversionHandlerin classFormatterImpl
-
getDataTranslationHandler
public DataTranslationHandler getDataTranslationHandler()
- Overrides:
getDataTranslationHandlerin classFormatterImpl
-
getDatePattern
public String getDatePattern()
Description copied from interface:FormatterReturns the date pattern- Specified by:
getDatePatternin interfaceFormatter- Overrides:
getDatePatternin classFormatterImpl
-
getEntityManagerHandler
public EntityManagerHandler getEntityManagerHandler()
- Overrides:
getEntityManagerHandlerin classFormatterImpl
-
getTimePattern
public String getTimePattern()
Description copied from interface:FormatterReturns the time pattern- Specified by:
getTimePatternin interfaceFormatter- Overrides:
getTimePatternin classFormatterImpl
-
getTranslationHandler
public TranslationHandler getTranslationHandler()
- Overrides:
getTranslationHandlerin classFormatterImpl
-
parseDate
public Date parseDate(String text)
- Overrides:
parseDatein classFormatterImpl
-
parseDecimal
public BigDecimal parseDecimal(String text, int scale)
- Overrides:
parseDecimalin classFormatterImpl
-
parseTime
public Date parseTime(String text)
- Overrides:
parseTimein classFormatterImpl
-
parseTimestamp
public Date parseTimestamp(String text)
- Overrides:
parseTimestampin classFormatterImpl
-
-