001package org.andromda.metafacades.uml14; 002 003import org.andromda.metafacades.uml.Entity; 004import org.andromda.metafacades.uml.UMLMetafacadeProperties; 005import org.apache.commons.lang.StringUtils; 006 007/** 008 * MetafacadeLogic implementation for org.andromda.metafacades.uml.ManageableEntityAttribute. 009 * 010 * @see org.andromda.metafacades.uml.ManageableEntityAttribute 011 * @author Bob Fields 012 */ 013public class ManageableEntityAttributeLogicImpl 014 extends ManageableEntityAttributeLogic 015{ 016 private static final long serialVersionUID = 34L; 017 /** 018 * @param metaObject 019 * @param context 020 */ 021 public ManageableEntityAttributeLogicImpl( 022 Object metaObject, 023 String context) 024 { 025 super(metaObject, context); 026 } 027 028 /** 029 * @see org.andromda.metafacades.uml.ManageableEntityAttribute#isDisplay() 030 */ 031 @Override 032 protected boolean handleIsDisplay() 033 { 034 boolean display = true; 035 036 // only identifiers might be hidden 037 if (this.isIdentifier()) 038 { 039 final String displayStrategy = 040 StringUtils.trimToNull( 041 (String)this.getConfiguredProperty(UMLMetafacadeProperties.MANAGEABLE_ID_DISPLAY_STRATEGY)); 042 043 // never display identifiers 044 if ("never".equalsIgnoreCase(displayStrategy)) 045 { 046 display = false; 047 } 048 049 // always display identifiers 050 else if ("always".equalsIgnoreCase(displayStrategy)) 051 { 052 display = true; 053 } 054 055 // only display identifiers when explicitly modeled 056 else // if ("auto".equalsIgnoreCase(displayStrategy)) 057 { 058 display = ((Entity)this.getOwner()).isUsingAssignedIdentifier(); 059 } 060 } 061 062 return display; 063 } 064 065 /** 066 * @see org.andromda.metafacades.uml.ManageableEntityAttribute#isManageableGetterAvailable() 067 */ 068 @Override 069 protected boolean handleIsManageableGetterAvailable() 070 { 071 return this.getType() != null && this.getType().isBlobType(); 072 } 073}