001package org.andromda.cartridges.jsf.metafacades; 002 003import java.util.Collection; 004import org.andromda.metafacades.uml.DependencyFacade; 005import org.andromda.metafacades.uml.ModelElementFacade; 006import org.andromda.metafacades.uml.UseCaseFacade; 007 008/** 009 * MetafacadeLogic implementation for org.andromda.cartridges.jsf.metafacades.JSFPortletPreferences. 010 * 011 * @see org.andromda.cartridges.jsf.metafacades.JSFPortletPreferences 012 */ 013public class JSFPortletPreferencesLogicImpl 014 extends JSFPortletPreferencesLogic 015{ 016 private static final long serialVersionUID = 34L; 017 /** 018 * @param metaObject 019 * @param context 020 */ 021 public JSFPortletPreferencesLogicImpl(Object metaObject, String context) 022 { 023 super(metaObject, context); 024 } 025 /** 026 * @return useCase 027 * @see org.andromda.cartridges.jsf.metafacades.JSFPortletPreferences#getUseCase() 028 */ 029 protected Object handleGetUseCase() 030 { 031 UseCaseFacade useCase = null; 032 final Collection<DependencyFacade> dependencies = this.getTargetDependencies(); 033 if (dependencies != null && !dependencies.isEmpty()) 034 { 035 for (final DependencyFacade dependency : dependencies) 036 { 037 final ModelElementFacade source = dependency.getSourceElement(); 038 if (source instanceof UseCaseFacade) 039 { 040 useCase = (UseCaseFacade)source; 041 break; 042 } 043 } 044 } 045 return useCase; 046 } 047}