Package mc.core.domain.base.dobj.pattern
Class PatternBean
java.lang.Object
mc.core.system.base.BaseBean
mc.core.domain.base.dobj.pattern.PatternBean
@ApplicationScoped
public class PatternBean
extends mc.core.system.base.BaseBean
handles reading, validating and writing of pattern
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclasstoken info parsed from DTPattern.pattern and DVPattern.patternValue -
Method Summary
Modifier and TypeMethodDescriptiongetBoundariesValueClass(DTPattern dtPattern) Boundaries types must have 2 numeric tokens, with formatting that makes them either both Integer or both DoublegetDisplay(DVPattern dataValue, Locale locale) getNumericValues(DVPattern dvPattern) getTokenValues(DVPattern dvPattern, Locale locale) static PatternBeaninstance()factory method for use in non-CDI classesisBoundariesType(Attribute attribute) voidsetTokens(DVPattern dataValue, List<PatternBean.TokenInfo> tokens) voidcreates the patternValue-String that holds the tokens and the dynamic values and sets it to given dvPattern.voidpatternValue matches dataType.pattern?voidvalidatePatternString(String patternString, String dtPatternDisplay) check if the given patternString (DTPattern.getPattern()) has a valid format.
-
Method Details
-
instance
factory method for use in non-CDI classes -
setTokens
-
getDisplay
-
validate
patternValue matches dataType.pattern?- Throws:
mc.core.system.validation.ValidationException
-
validatePatternString
public void validatePatternString(String patternString, String dtPatternDisplay) throws mc.core.system.validation.ValidationException check if the given patternString (DTPattern.getPattern()) has a valid format.- Parameters:
patternString- mandatorydtPatternDisplay- mandatory, display of DTPattern to which given patternString belongs, for error messages- Throws:
mc.core.system.validation.ValidationException
-
isBoundariesType
- Parameters:
attribute- mandatory- Returns:
- DTPattern if attribute's datatype is DTPattern and if it has a boundaries pattern, otherwise null
-
getBoundariesValueClass
Boundaries types must have 2 numeric tokens, with formatting that makes them either both Integer or both Double- Returns:
- Integer.class or Double.class if prerequisites are fulfilled, otherwise null
-
getTokens
- Parameters:
dtPattern- mandatory- Returns:
- the list of tokens that make up this DTPattern's pattern
-
getTokenValues
- Parameters:
dvPattern- mandatorylocale- optional, default is content locale- Returns:
- list of TokenInfo containing the token and the corresponding value. Use methods
PatternBean.TokenInfo.getValueString(),PatternBean.TokenInfo.getValueDouble()andPatternBean.TokenInfo.getValueUnit(List)to retrieve the value by type. For use in GUI
-
getNumericValues
-
setValues
public void setValues(DVPattern dvPattern, Attribute attribute, List<Object> values) throws mc.core.system.validation.ValidationException creates the patternValue-String that holds the tokens and the dynamic values and sets it to given dvPattern. Static values are only set in pattern or DTPattern.- Parameters:
dvPattern- must contain dataType DTPattern with pattern fitting with given valuesattribute- for which DVPattern is set, for display of error messagevalues- list containing the non-static values (T,N,U) in the order given by pattern. Null values are not allowed.- Throws:
mc.core.system.validation.ValidationException
-