001package org.andromda.cartridges.hibernate.metafacades;
002
003import org.andromda.cartridges.hibernate.HibernateProfile;
004import org.apache.commons.lang.StringUtils;
005
006/**
007 * MetafacadeLogic implementation for
008 * org.andromda.cartridges.hibernate.metafacades.HibernateServiceOperation.
009 *
010 * @see org.andromda.cartridges.hibernate.metafacades.HibernateServiceOperation
011 */
012public class HibernateServiceOperationLogicImpl
013    extends HibernateServiceOperationLogic
014{
015    private static final long serialVersionUID = 34L;
016    /**
017     * @param metaObject
018     * @param context
019     */
020    public HibernateServiceOperationLogicImpl(
021        Object metaObject,
022        String context)
023    {
024        super(metaObject, context);
025    }
026
027    /**
028     * Stores the default transaction type for service operations.
029     */
030    private static final String SERVICE_OPERATION_TRANSACTION_TYPE = "serviceOperationTransactionType";
031
032    /**
033     * @see org.andromda.cartridges.hibernate.metafacades.HibernateServiceOperationLogic#handleGetTransactionType()
034     * @see org.andromda.cartridges.hibernate.metafacades.HibernateServiceOperation#getTransactionType()
035     */
036    public String handleGetTransactionType()
037    {
038        String transactionType = (String)this.findTaggedValue(HibernateProfile.TAGGEDVALUE_EJB_TRANSACTION_TYPE);
039        if (StringUtils.isBlank(transactionType))
040        {
041            transactionType = String.valueOf(this.getConfiguredProperty(SERVICE_OPERATION_TRANSACTION_TYPE));
042        }
043        return transactionType;
044    }
045}