|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface EffFormat
General Documentation: This interface and its supporting implementations
provide the capability of specifying formats, the effectivity statements
follow. This allows users to accurately specify how the various supported
operations are implemented, giving them a chance to customize them, if
they are not satisfactory. These include operations for comparisons,
validation and range arithmetic. These formats are further driven by
parameters, the users can specify, which are external to the format implementation
and exist to provide meta-data related to the format in question. This
is especially important, because the formats themselves are intended
to be stateless, providing mere business logic.
Technical Documentation: This is the top-level interface of all
Effectivity Format classes. It states the contract that an effectivity
format must implement. Eff. Format classes are not instantiated directly
by clients, but are created and managed by the format factory EffFormatFactory, which encapsulates the logic of creation
and looking-up Eff. Format classes.
All concrete subclasses of this class are intended to be stateless. Hence
they run as singleton objects, safely shared and managed by the EffFormatFactory.
Identity of an Eff. Format is also class based and not instance-based.
All instances of a format class, share their identities. Hence effectivity
formats do not need to implement Object's equals() and hashCode() methods.
Two Eff. Format object instances x and y are equal if and only if x and
y refer to the same object (x == y has the value true).
Documentation for Custom Effectivity Format Implementations: To
provide customized effectivity format implementations, customizers can
either implement this interface or extend any of the documented extendable
format classes, as per your needs. See the Customizer's Guide for more
information, where you will also find details on how to specify effectivity
format implementations for use by the system.
Supported API: true
Extendable: true
EffFormatService,
EffState,
EffRangeValues| Method Summary | |
|---|---|
String |
addToRangeValue(String rangeValue,
int amount,
EffState state,
Map<String,String> formatParams)
Add the amount to the effecitivity range value passed in, if the range value passed in are valid. |
int |
compareRangeValues(String leftValue,
String rightValue,
EffState state,
Map<String,String> formatParams)
This operation is used by Windchill to find whether the left and right eff. |
String |
getDisplayDescription(Locale locale)
Returns the (localizable) description of this format implementation. |
String |
getDisplayName(Locale locale)
Returns the (localizable) name of this format implementation. |
boolean |
supportsRangeArithmetic()
Determines whether this effectivity format supports range arithmetic. |
String |
validateRangeValue(String rangeValue,
EffState state,
Map<String,String> formatParams,
boolean isStartRange)
Checks whether the range value adheres to right format. |
| Method Detail |
|---|
String getDisplayName(Locale locale)
locale - the locale to be used to determine the display name
of this format
wt.eff.format#getDisplayDescription()String getDisplayDescription(Locale locale)
locale - the locale to be used to determine the description of
this format
wt.eff.format#getDisplayName()
String validateRangeValue(String rangeValue,
EffState state,
Map<String,String> formatParams,
boolean isStartRange)
String error message is returned on those occasions stating
the reasons for its invalidity. An empty String ("")
object signifies that the range value passed in is valid.
EffFormatService):
String errStr = validateRangeValue(...)
if (EffFormatHelper.isEmptyOrNull(errStr)) {
// valid
// EffFormat implementations return an empty string when the range
values are valid
} else {
// errStr details the error condition
// EffFormat implementations return a non-empty string when the
range values are invalid
}
rangeValue - the string range value to be validated. UnitEffFormat's
validate considering their format's logic. DateEffFormat's validate
it considering a string value having a pattern supported by the system's
locale. See wt.query.dateHelperResource for a list of
valid format patterns available for a particular locale. Null values
are valid values and are treated as invalid and hence an appropriate
String error message is returned.state - a wt.eff.format.EffState object recording
the the various attributes of interest to the this operationformatParams - a MapisStartRange - indicates that range passed in is start range.
null value
is never returned.
int compareRangeValues(String leftValue,
String rightValue,
EffState state,
Map<String,String> formatParams)
throws EffFormatException
leftValue - this value is expected to be a valid string
representing a unit number for UnitEffFormat's. For DateEffFormat's
this value is expected to be a valid string representation
of the time in milliseconds since January 1, 1970, 00:00:00 GMT, which
is generally obtained by calling the java.sql.Timestamp.getTime()
method to get the long time value and then converting it to a String
object by using the static java.lang.Long.toString()
method. Null values are not valid values and an EffFormatException
(unchecked) is thrown on those occasions. Also, the range value must
be a valid one.rightValue - this value is expected to be a validstring
representing a unit number for UnitEffFormat's. For DateEffFormat's
this value is expected to be a valid string representation
of the time in milliseconds since January 1, 1970, 00:00:00 GMT, which
is generally obtained by calling the java.sql.Timestamp.getTime()
method to get the long time value and then converting it to a String
object by using the static java.lang.Long.toString()
method. Null values are not valid values and an EffFormatException
(unchecked) is thrown on those occasions. Also, the range value must
be a valid one.state - a wt.eff.format.EffState object recording
the the various attributes of interest to the this operation
0 if the left effectivity value is
equal to right effectivity value; a value less than 0
if the left effectivity value is less than the right effectivity value;
and a value greater than 0 if this left effectivity value
is greater than the right effectivity value.
EffFormatException - when the range values or other required
paramters passed in are null or when the range values can not be parsed
and hence are invalid. Only valid range values are expected as arguments
and hence the range values must be first validated before calling
this operation.
EffFormatExceptionboolean supportsRangeArithmetic()
#addToRangeValue(String, int, EffState,
java.util.Map{@literal }) operation.
true value. See the
Customizer's Guide to find out more about range arithmetic operations
and how they can be used to support operations like closing off prior
effectivity ranges.
#addToRangeValue(String, int, EffState, java.util.Map{@literal
})
String addToRangeValue(String rangeValue,
int amount,
EffState state,
Map<String,String> formatParams)
throws EffFormatException
rangeValue - this value is expected to be a validstring
representing a unit number for UnitEffFormat's. For DateEffFormat's
this value is expected to be a valid string representation
of the time in milliseconds since January 1, 1970, 00:00:00 GMT, which
is generally obtained by calling the java.sql.Timestamp.getTime()
method to get the long time value and then converting it to a String
object by using the static java.lang.Long.toString()
method. Null values are not valid values and an EffFormatException
(unchecked) is thrown on those occasions. Also, the range value must
be a valid one.amount - the value to be added (if positive) or subtracted (if
negative) from the rangeValuestate - a wt.eff.format.EffState object recording
the the various attributes of interest to the this operationformatParams - a MapEffFormatException - when the range value or other required
paramters passed in are null or when the range values can not be parsed
and hence are invalid. Only valid range values are expected as arguments
and hence the range values must be first validated before calling
this operation.
EffFormatExceptionsupportsRangeArithmetic()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||