public class ModelHelper
extends java.lang.Object
CurrencyAmountDTOs| Constructor and Description |
|---|
ModelHelper() |
| Modifier and Type | Method and Description |
|---|---|
static AccountOwnerLocator |
accountOwnerLocator(java.lang.String principal)
Creates a new
AccountOwnerLocator. |
static AmountSummaryVO |
amountSummary(java.math.BigDecimal sum,
java.math.BigDecimal average,
int count,
CurrencyVO currency)
Creates an amount summary
|
static void |
clearIds(java.lang.Iterable<? extends EntityModel> models)
Sets the ids of all models to null
|
static <VO extends EntityVO> |
collectVOs(java.lang.Class<VO> voClass,
java.util.Collection<java.lang.String> values,
java.util.Collection<VO> vos)
Converts each value to a VO, using
voFromString(Class, String), then adds the resulting VO (if not null)
to the given collection |
static CurrencyAmountDTO |
currencyAmount(CurrencyVO currency,
java.math.BigDecimal amount)
Creates a new
CurrencyAmountDTO. |
static CurrencyAmountRangeDTO |
currencyRange(CurrencyVO currency,
java.math.BigDecimal min,
java.math.BigDecimal max)
Creates a new
CurrencyAmountRangeDTO. |
static DatePeriodDTO |
datePeriod(DateTime begin,
DateTime end)
Creates a new
DatePeriodDTO |
static DecimalRangeDTO |
decimalRange(java.math.BigDecimal min,
java.math.BigDecimal max)
Creates a new
DecimalRangeDTO |
static DictionaryVO |
dictionary(java.lang.String dictionary,
java.lang.String label)
Creates a new
DictionaryVO. |
static DimensionsDTO |
dimensions(int width,
int height)
Creates a new
DimensionsDTO |
static boolean |
equals(LatLongDTO first,
LatLongDTO second)
Check if both coordinates are the same
|
static java.lang.String |
getEmailValidationMesssage(UserValidationResult result,
MessageProducer mProducer) |
static java.lang.String |
getPublicRegistrationMesssage(UserRegistrationResult result,
MessageProducer mProducer) |
static java.util.Comparator<UserLocatorVO> |
getUserLocatorComparator() |
static IntegerRangeDTO |
integerRange(java.lang.Integer min,
java.lang.Integer max)
Creates a new
IntegerRangeDTO |
static boolean |
isValid(DistanceDTO distance)
Returns whether the given latitude / longitude is valid
|
static boolean |
isValid(LatLongDTO latLong)
Returns whether the given latitude / longitude is valid
|
static boolean |
isValid(UserLocatorVO user)
Returns whether the given user locator is valid
|
static LatLongDTO |
latLong(java.math.BigDecimal latitude,
java.math.BigDecimal longitude)
Creates a new
LatLongDTO |
static LatLongDTO |
latLong(double latitude,
double longitude)
Creates a new
LatLongDTO |
static java.lang.String |
locatorText(java.lang.String text)
Prepares the given text to be used as locator.
|
static ImageNature |
resolveImageNature(ImageVO image)
Returns the image nature for the given
ImageVO |
static TimeIntervalDTO |
timeInterval(int amount,
TimeField field)
Creates a new
TimeIntervalDTO |
static java.lang.String |
unqualifyInternalName(IInternalNamedEntity entity)
Returns the unqualified internal name of the given entity.
|
static java.lang.String |
unqualifyInternalName(java.lang.String internalName)
Returns the unqualified internal name, for example, "a.b.c" returns "c".
|
static Property<?,? super UserWithFieldsVO> |
userWithFieldsProperty(BasicProfileField profileField)
Returns the property from
UserWithFieldsVO which matches the given profile field, or null if not
applicable |
static <VO extends EntityVO> |
voFromString(java.lang.Class<VO> voClass,
java.lang.String value)
Converts a textual value to a VO.
|
static <VO extends EntityVO> |
vosFromString(java.lang.Class<VO> voClass,
java.util.Collection<java.lang.String> values)
Returns each string element as a VO in a new set.
|
public static AccountOwnerLocator accountOwnerLocator(java.lang.String principal)
AccountOwnerLocator.public static AmountSummaryVO amountSummary(java.math.BigDecimal sum, java.math.BigDecimal average, int count, CurrencyVO currency)
public static void clearIds(java.lang.Iterable<? extends EntityModel> models)
public static <VO extends EntityVO> void collectVOs(java.lang.Class<VO> voClass, java.util.Collection<java.lang.String> values, java.util.Collection<VO> vos)
voFromString(Class, String), then adds the resulting VO (if not null)
to the given collectionpublic static CurrencyAmountDTO currencyAmount(CurrencyVO currency, java.math.BigDecimal amount)
CurrencyAmountDTO.public static CurrencyAmountRangeDTO currencyRange(CurrencyVO currency, java.math.BigDecimal min, java.math.BigDecimal max)
CurrencyAmountRangeDTO.public static DatePeriodDTO datePeriod(DateTime begin, DateTime end)
DatePeriodDTOpublic static DecimalRangeDTO decimalRange(java.math.BigDecimal min, java.math.BigDecimal max)
DecimalRangeDTOpublic static DictionaryVO dictionary(java.lang.String dictionary, java.lang.String label)
DictionaryVO.public static DimensionsDTO dimensions(int width, int height)
DimensionsDTOpublic static boolean equals(LatLongDTO first, LatLongDTO second)
public static java.lang.String getEmailValidationMesssage(UserValidationResult result, MessageProducer mProducer)
public static java.lang.String getPublicRegistrationMesssage(UserRegistrationResult result, MessageProducer mProducer)
public static java.util.Comparator<UserLocatorVO> getUserLocatorComparator()
public static IntegerRangeDTO integerRange(java.lang.Integer min, java.lang.Integer max)
IntegerRangeDTOpublic static boolean isValid(DistanceDTO distance)
public static boolean isValid(LatLongDTO latLong)
public static boolean isValid(UserLocatorVO user)
public static LatLongDTO latLong(java.math.BigDecimal latitude, java.math.BigDecimal longitude)
LatLongDTOpublic static LatLongDTO latLong(double latitude, double longitude)
LatLongDTOpublic static java.lang.String locatorText(java.lang.String text)
public static ImageNature resolveImageNature(ImageVO image)
ImageVOpublic static TimeIntervalDTO timeInterval(int amount, TimeField field)
TimeIntervalDTOpublic static java.lang.String unqualifyInternalName(IInternalNamedEntity entity)
unqualifyInternalName(String)public static java.lang.String unqualifyInternalName(java.lang.String internalName)
public static Property<?,? super UserWithFieldsVO> userWithFieldsProperty(BasicProfileField profileField)
UserWithFieldsVO which matches the given profile field, or null if not
applicablepublic static <VO extends EntityVO> VO voFromString(java.lang.Class<VO> voClass, java.lang.String value)
public static <VO extends EntityVO> java.util.Set<VO> vosFromString(java.lang.Class<VO> voClass, java.util.Collection<java.lang.String> values)
voFromString(Class, String)