001package org.andromda.cartridges.meta.metafacades; 002import org.andromda.metafacades.uml.OperationFacade; 003/** 004 * MetafacadeLogic implementation for 005 * org.andromda.cartridges.meta.metafacades.PSMmetaclass. 006 * 007 * @see org.andromda.cartridges.meta.metafacades.PSMmetaclass 008 * @author Bob Fields 009 */ 010public class PSMmetaclassLogicImpl extends PSMmetaclassLogic 011{ 012 private static final long serialVersionUID = 34L; 013 /** 014 * @param metaObjectIn 015 * @param context 016 */ 017 public PSMmetaclassLogicImpl(Object metaObjectIn, String context) 018 { 019 super(metaObjectIn, context); 020 } 021 /** 022 * @see org.andromda.cartridges.meta.metafacades.PSMmetaclass#isOperationsPresent() 023 */ 024 @Override 025 protected boolean handleIsOperationsPresent() 026 { 027 return !this.getOperations().isEmpty(); 028 } 029 /** 030 * @see org.andromda.cartridges.meta.metafacades.PSMmetaclassLogic#handleIsImplMustBeAbstract() 031 */ 032 @Override 033 protected boolean handleIsImplMustBeAbstract() 034 { 035 boolean result = false; 036 // if the class itself is abstract, make the impl abstract, too. 037 if (this.isAbstract()) 038 { 039 result = true; 040 } 041 else 042 { 043 // if the class contains abstract operations, the impl must be 044 // abstract, too, because the abstract operations will not be 045 // generated as methods. 046 for (OperationFacade operation : this.getOperations()) 047 { 048 if (operation.isAbstract()) 049 { 050 result = true; 051 break; 052 } 053 } 054 } 055 return result; 056 } 057}