001package org.andromda.cartridges.jsf2.metafacades;
002
003import org.andromda.cartridges.jsf2.JSFGlobals;
004import org.andromda.utils.StringUtilsHelper;
005import org.apache.commons.lang.ObjectUtils;
006import org.apache.commons.lang.StringUtils;
007
008/**
009 * MetafacadeLogic implementation for org.andromda.cartridges.jsf2.metafacades.JSFEnumeration.
010 *
011 * @see org.andromda.cartridges.jsf2.metafacades.JSFEnumeration
012 */
013public class JSFEnumerationLogicImpl
014    extends JSFEnumerationLogic
015{
016    private static final long serialVersionUID = 34L;
017    /**
018     * @param metaObject
019     * @param context
020     */
021    public JSFEnumerationLogicImpl(Object metaObject, String context)
022    {
023        super(metaObject, context);
024    }
025
026    /**
027     * @return converterName
028     * @see org.andromda.cartridges.jsf2.metafacades.JSFEnumeration#getConverterName()
029     */
030    protected String handleGetConverterName()
031    {
032        return StringUtils.replace(
033            ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.CONVERTER_PATTERN)),
034            "{0}",
035            this.getName());
036    }
037
038    /**
039     * @return getPackageName() + "." + getConverterName()
040     * @see org.andromda.cartridges.jsf2.metafacades.JSFEnumeration#getFullyQualifiedConverterName()
041     */
042    protected String handleGetFullyQualifiedConverterName()
043    {
044        return this.getPackageName() + "." + this.getConverterName();
045    }
046
047    /**
048     * @return getFullyQualifiedConverterName().replace('.', '/')
049     * @see org.andromda.cartridges.jsf2.metafacades.JSFEnumeration#getConverterPath()
050     */
051    protected String handleGetConverterPath()
052    {
053        return this.getFullyQualifiedConverterName().replace('.', '/');
054    }
055
056    /**
057     * @return StringUtilsHelper.toResourceMessageKey(getName())
058     * @see org.andromda.cartridges.jsf2.metafacades.JSFEnumeration#getMessageKey()
059     */
060    protected String handleGetMessageKey()
061    {
062        return StringUtilsHelper.toResourceMessageKey(getName());
063    }
064}