001package org.andromda.cartridges.hibernate.metafacades; 002 003import java.text.MessageFormat; 004import java.util.Collection; 005import org.andromda.cartridges.hibernate.HibernateProfile; 006import org.apache.commons.lang.ObjectUtils; 007import org.apache.commons.lang.StringUtils; 008 009/** 010 * MetafacadeLogic implementation for 011 * org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue. 012 * 013 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue 014 * @author Klaus Schultz 015 */ 016public class HibernateEmbeddedValueLogicImpl 017 extends HibernateEmbeddedValueLogic 018{ 019 private static final long serialVersionUID = 34L; 020 // ---------------- constructor ------------------------------- 021 /** 022 * @param metaObject 023 * @param context 024 */ 025 public HibernateEmbeddedValueLogicImpl( 026 Object metaObject, 027 String context) 028 { 029 super(metaObject, context); 030 } 031 032 /** 033 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#isImmutable() 034 */ 035 @Override 036 protected boolean handleIsImmutable() 037 { 038 boolean immutable = false; 039 Object value = this.findTaggedValue(HibernateProfile.TAGGEDVALUE_PERSISTENCE_IMMUTABLE); 040 if (value != null) 041 { 042 immutable = Boolean.valueOf(ObjectUtils.toString(value)).booleanValue(); 043 } 044 return immutable; 045 } 046 047 /** 048 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue#getImplementationName() 049 */ 050 @Override 051 protected String handleGetImplementationName() 052 { 053 final String implNamePattern = 054 String.valueOf(this.getConfiguredProperty(HibernateGlobals.EMBEDDED_VALUE_IMPLEMENTATION_NAME_PATTERN)); 055 return MessageFormat.format( 056 implNamePattern, 057 StringUtils.trimToEmpty(this.getName())); 058 } 059 060 /** 061 * @return formatted Entity Name 062 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEntity#getEntityName() 063 */ 064 protected String handleGetEntityName() 065 { 066 final String entityNamePattern = (String)this.getConfiguredProperty(HibernateGlobals.ENTITY_NAME_PATTERN); 067 return MessageFormat.format( 068 entityNamePattern, 069 StringUtils.trimToEmpty(this.getName())); 070 } 071 072 /** 073 * analogy of HibernateEntityLogicImpl 074 * @return getFullyQualifiedName 075 * 076 * @see org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValue 077 */ 078 protected String handleGetFullyQualifiedEntityName() 079 { 080 return HibernateMetafacadeUtils.getFullyQualifiedName( 081 this.getPackageName(), 082 this.getName(), 083 null); 084 } 085 086 /** 087 * see HibernateEntityLogicImpl 088 * @return filterBusinessOperations(this.getOperations()) 089 */ 090 protected Collection handleGetBusinessOperations() 091 { 092 return HibernateMetafacadeUtils.filterBusinessOperations(this.getOperations()); 093 } 094}