package gw.rating.rtm.valueprovider uses gw.api.locale.DisplayKey uses gw.rating.rtm.domain.PersistenceAdapter uses java.util.Map /** * Value provider implementation for rate table columns of boolean type. * Provides a list of 2 choices representing true and false. */ class BooleanValueProvider extends RateTableCellValueProvider { construct(column : RateTableColumn) { super(column) } override function getValueMap(args : String[]) : Map { return {"true" -> DisplayKey.get("Web.Rating.RateFactors.Boolean.True"), "false" -> DisplayKey.get("Web.Rating.RateFactors.Boolean.False") } } /** * Returns a string array containing 2 values: "true" and "false". * * @param bean is not used * @returns an array with 2 strings */ override function getValues(adapter : PersistenceAdapter) : String[] { return {"true", "false"} } /** * If code is "true", returns Web.Rating.RateFactors.Boolean.True * display key, and Web.Rating.RateFactors.Boolean.False otherwise. * bean parameter is ignored. * * @param bean is not used * @param code either "true" or "false" */ override function valueByCode(adapter : PersistenceAdapter, code : String) : String { switch (code) { case "true" : return DisplayKey.get("Web.Rating.RateFactors.Boolean.True") case "false": default : return DisplayKey.get("Web.Rating.RateFactors.Boolean.False") } } /** * Always returns false. */ override property get HasCodedValue() : boolean { return false } }