001package org.andromda.cartridges.ejb.metafacades;
002
003import org.andromda.cartridges.ejb.EJBGlobals;
004import org.andromda.cartridges.ejb.EJBProfile;
005import org.apache.commons.lang.StringUtils;
006
007/**
008 * MetafacadeLogic implementation for org.andromda.cartridges.ejb.metafacades.EJBOperationFacade.
009 *
010 * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacade
011 */
012public class EJBOperationFacadeLogicImpl
013        extends EJBOperationFacadeLogic
014{
015    private static final long serialVersionUID = 34L;
016    // ---------------- constructor -------------------------------
017
018    /**
019     * @param metaObject
020     * @param context
021     */
022    public EJBOperationFacadeLogicImpl(Object metaObject, String context)
023    {
024        super(metaObject, context);
025    }
026
027    /**
028     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacadeLogic#handleGetTransactionType()
029     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacade#getTransactionType()
030     */
031    protected String handleGetTransactionType()
032    {
033        String transactionType = (String)this.findTaggedValue(EJBProfile.TAGGEDVALUE_EJB_TRANSACTION_TYPE, true);
034        if (StringUtils.isBlank(transactionType))
035        {
036            transactionType = String.valueOf(this.getConfiguredProperty(EJBGlobals.TRANSACTION_TYPE));
037        }
038        if (StringUtils.isBlank(transactionType))
039        {
040            transactionType = "Required";
041        }
042        return transactionType;
043    }
044
045    /**
046     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacadeLogic#handleIsBusinessOperation()
047     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacade#isBusinessOperation()
048     */
049    protected boolean handleIsBusinessOperation()
050    {
051        return !this.hasStereotype(EJBProfile.STEREOTYPE_CREATE_METHOD) &&
052                !this.hasStereotype(EJBProfile.STEREOTYPE_FINDER_METHOD) &&
053                !this.hasStereotype(EJBProfile.STEREOTYPE_SELECT_METHOD);
054    }
055
056    /**
057     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacadeLogic#handleIsSelectMethod()
058     * @see org.andromda.cartridges.ejb.metafacades.EJBOperationFacade#isSelectMethod()
059     */
060    protected boolean handleIsSelectMethod()
061    {
062        return this.hasStereotype(EJBProfile.STEREOTYPE_SELECT_METHOD);
063    }
064}