Coverage Report - org.kuali.rice.kns.service.impl.BusinessObjectMetaDataServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
BusinessObjectMetaDataServiceImpl
0%
0/181
0%
0/150
4.913
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.kns.service.impl;
 17  
 
 18  
 import java.lang.reflect.InvocationTargetException;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.HashMap;
 22  
 import java.util.Iterator;
 23  
 import java.util.List;
 24  
 import java.util.Map;
 25  
 
 26  
 import org.apache.commons.lang.StringUtils;
 27  
 import org.kuali.rice.kns.bo.BusinessObject;
 28  
 import org.kuali.rice.kns.bo.BusinessObjectRelationship;
 29  
 import org.kuali.rice.kns.bo.PersistableBusinessObject;
 30  
 import org.kuali.rice.kns.datadictionary.DataDictionaryEntry;
 31  
 import org.kuali.rice.kns.datadictionary.FieldDefinition;
 32  
 import org.kuali.rice.kns.datadictionary.InquirySectionDefinition;
 33  
 import org.kuali.rice.kns.datadictionary.PrimitiveAttributeDefinition;
 34  
 import org.kuali.rice.kns.datadictionary.RelationshipDefinition;
 35  
 import org.kuali.rice.kns.datadictionary.SupportAttributeDefinition;
 36  
 import org.kuali.rice.kns.lookup.valuefinder.ValueFinder;
 37  
 import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
 38  
 import org.kuali.rice.kns.service.BusinessObjectMetaDataService;
 39  
 import org.kuali.rice.kns.service.DataDictionaryService;
 40  
 import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
 41  
 import org.kuali.rice.kns.service.ModuleService;
 42  
 import org.kuali.rice.kns.service.PersistenceStructureService;
 43  
 import org.kuali.rice.kns.util.ObjectUtils;
 44  
 
 45  
 /**
 46  
  * 
 47  
  * Implementation of the <code>BusinessObjectMetaDataService</code> which uses
 48  
  * the following services to gather its meta data:
 49  
  * 
 50  
  * @see BusinessObjectDictionaryService
 51  
  * @see DataDictionaryService
 52  
  * @see PersistenceStructureService
 53  
  */
 54  0
 public class BusinessObjectMetaDataServiceImpl extends DataObjectMetaDataServiceImpl implements BusinessObjectMetaDataService {
 55  0
         private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger
 56  
                         .getLogger(BusinessObjectMetaDataServiceImpl.class);
 57  
 
 58  
         private BusinessObjectDictionaryService businessObjectDictionaryService;
 59  
 
 60  
         public Collection<String> getCollectionNames(BusinessObject bo) {
 61  0
                 return getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(bo.getClass().getName())
 62  
                                 .getCollectionNames();
 63  
         }
 64  
 
 65  
         public Collection<String> getInquirableFieldNames(Class boClass, String sectionTitle) {
 66  0
                 return businessObjectDictionaryService.getInquiryFieldNames(boClass, sectionTitle);
 67  
         }
 68  
 
 69  
         public List<String> getLookupableFieldNames(Class boClass) {
 70  0
                 return businessObjectDictionaryService.getLookupFieldNames(boClass);
 71  
         }
 72  
 
 73  
         public String getLookupFieldDefaultValue(Class businessObjectClass, String attributeName) {
 74  0
                 return businessObjectDictionaryService.getLookupFieldDefaultValue(businessObjectClass, attributeName);
 75  
         }
 76  
 
 77  
         public Class getLookupFieldDefaultValueFinderClass(Class businessObjectClass, String attributeName) {
 78  0
                 return businessObjectDictionaryService
 79  
                                 .getLookupFieldDefaultValueFinderClass(businessObjectClass, attributeName);
 80  
         }
 81  
 
 82  
         /** {@inheritDoc} */
 83  
         public String getLookupFieldQuickfinderParameterString(Class businessObjectClass, String attributeName) {
 84  0
                 return businessObjectDictionaryService.getLookupFieldQuickfinderParameterString(businessObjectClass,
 85  
                                 attributeName);
 86  
         }
 87  
 
 88  
         /** {@inheritDoc} */
 89  
         public Class<? extends ValueFinder> getLookupFieldQuickfinderParameterStringBuilderClass(Class businessObjectClass,
 90  
                         String attributeName) {
 91  0
                 return businessObjectDictionaryService.getLookupFieldQuickfinderParameterStringBuilderClass(
 92  
                                 businessObjectClass, attributeName);
 93  
         }
 94  
 
 95  
         public boolean isAttributeInquirable(Class boClass, String attributeName, String sectionTitle) {
 96  0
                 Collection sections = businessObjectDictionaryService.getInquirySections(boClass);
 97  0
                 boolean isInquirable = true;
 98  
 
 99  0
                 Iterator iter = sections.iterator();
 100  
 
 101  0
                 while (iter.hasNext()) {
 102  0
                         InquirySectionDefinition def = (InquirySectionDefinition) iter.next();
 103  0
                         for (FieldDefinition field : def.getInquiryFields()) {
 104  0
                                 if (field.getAttributeName().equalsIgnoreCase(attributeName)) {
 105  0
                                         isInquirable = !field.isNoInquiry();
 106  
                                 }
 107  
                         }
 108  0
                 }
 109  0
                 if (isInquirable) {
 110  0
                         Object obj = null;
 111  0
                         if (boClass != null && BusinessObject.class.isAssignableFrom(boClass)) {
 112  0
                                 obj = ObjectUtils.createNewObjectFromClass(boClass);
 113  
                         }
 114  
 
 115  0
                         if (obj != null) {
 116  0
                                 BusinessObject bo = (BusinessObject) obj;
 117  0
                                 Class clazz = getNestedBOClass(bo, attributeName);
 118  0
                                 if (clazz != null && BusinessObject.class.isAssignableFrom(clazz)) {
 119  0
                                         return businessObjectDictionaryService.isInquirable(clazz);
 120  
                                 }
 121  
                                 else {
 122  0
                                         return false;
 123  
                                 }
 124  
                         }
 125  
                         else {
 126  0
                                 return false;
 127  
                         }
 128  
 
 129  
                 }
 130  
 
 131  0
                 return isInquirable;
 132  
         }
 133  
 
 134  
         public boolean isInquirable(Class boClass) {
 135  0
                 boolean inquirable = false;
 136  0
                 ModuleService moduleService = getKualiModuleService().getResponsibleModuleService(boClass);
 137  0
                 if (moduleService != null && moduleService.isExternalizable(boClass)) {
 138  0
                         inquirable = moduleService.isExternalizableBusinessObjectInquirable(boClass);
 139  
                 }
 140  
                 else {
 141  0
                         Boolean isLookupable = businessObjectDictionaryService.isInquirable(boClass);
 142  0
                         if (isLookupable != null) {
 143  0
                                 inquirable = isLookupable.booleanValue();
 144  
                         }
 145  
                 }
 146  0
                 return inquirable;
 147  
         }
 148  
 
 149  
         public boolean isAttributeLookupable(Class boClass, String attributeName) {
 150  0
                 Object obj = null;
 151  0
                 if (boClass != null && BusinessObject.class.isAssignableFrom(boClass)) {
 152  0
                         obj = ObjectUtils.createNewObjectFromClass(boClass);
 153  
                 }
 154  0
                 if (obj != null) {
 155  0
                         BusinessObject bo = (BusinessObject) obj;
 156  0
                         BusinessObjectRelationship relationship = getBusinessObjectRelationship(bo, attributeName);
 157  
 
 158  0
                         if (relationship != null && relationship.getRelatedClass() != null
 159  
                                         && BusinessObject.class.isAssignableFrom(relationship.getRelatedClass())) {
 160  0
                                 return isLookupable(relationship.getRelatedClass());
 161  
                         }
 162  
                         else {
 163  0
                                 return false;
 164  
                         }
 165  
                 }
 166  
                 else {
 167  0
                         return false;
 168  
                 }
 169  
         }
 170  
 
 171  
         public boolean isLookupable(Class boClass) {
 172  0
                 boolean lookupable = false;
 173  0
                 ModuleService moduleService =  getKualiModuleService().getResponsibleModuleService(boClass);
 174  0
                 if (moduleService != null && moduleService.isExternalizable(boClass)) {
 175  0
                         lookupable = moduleService.isExternalizableBusinessObjectLookupable(boClass);
 176  
                 }
 177  
                 else {
 178  0
                         Boolean isLookupable = businessObjectDictionaryService.isLookupable(boClass);
 179  0
                         if (isLookupable != null) {
 180  0
                                 lookupable = isLookupable.booleanValue();
 181  
                         }
 182  
                 }
 183  0
                 return lookupable;
 184  
         }
 185  
 
 186  
         public BusinessObjectRelationship getBusinessObjectRelationship(BusinessObject bo, String attributeName) {
 187  0
                 return getBusinessObjectRelationship(bo, bo.getClass(), attributeName, "", true);
 188  
         }
 189  
 
 190  
         // TODO: four different exit points?!
 191  
         public BusinessObjectRelationship getBusinessObjectRelationship(RelationshipDefinition ddReference,
 192  
                         BusinessObject bo, Class boClass, String attributeName, String attributePrefix, boolean keysOnly) {
 193  
 
 194  0
                 BusinessObjectRelationship relationship = null;
 195  
 
 196  
                 // if it is nested then replace the bo and attributeName with the
 197  
                 // sub-refs
 198  0
                 if (ObjectUtils.isNestedAttribute(attributeName)) {
 199  0
                         if (ddReference != null) {
 200  0
                                 relationship = new BusinessObjectRelationship(boClass, ddReference.getObjectAttributeName(),
 201  
                                                 ddReference.getTargetClass());
 202  0
                                 for (PrimitiveAttributeDefinition def : ddReference.getPrimitiveAttributes()) {
 203  0
                                         if (StringUtils.isNotBlank(attributePrefix)) {
 204  0
                                                 relationship.getParentToChildReferences().put(attributePrefix + "." + def.getSourceName(),
 205  
                                                                 def.getTargetName());
 206  
                                         }
 207  
                                         else {
 208  0
                                                 relationship.getParentToChildReferences().put(def.getSourceName(), def.getTargetName());
 209  
                                         }
 210  
                                 }
 211  0
                                 if (!keysOnly) {
 212  0
                                         for (SupportAttributeDefinition def : ddReference.getSupportAttributes()) {
 213  0
                                                 if (StringUtils.isNotBlank(attributePrefix)) {
 214  0
                                                         relationship.getParentToChildReferences().put(attributePrefix + "." + def.getSourceName(),
 215  
                                                                         def.getTargetName());
 216  0
                                                         if (def.isIdentifier()) {
 217  0
                                                                 relationship.setUserVisibleIdentifierKey(attributePrefix + "." + def.getSourceName());
 218  
                                                         }
 219  
                                                 }
 220  
                                                 else {
 221  0
                                                         relationship.getParentToChildReferences().put(def.getSourceName(), def.getTargetName());
 222  0
                                                         if (def.isIdentifier()) {
 223  0
                                                                 relationship.setUserVisibleIdentifierKey(def.getSourceName());
 224  
                                                         }
 225  
                                                 }
 226  
                                         }
 227  
                                 }
 228  0
                                 return relationship;
 229  
                         }
 230  
                         // recurse down to the next object to find the relationship
 231  
 
 232  0
                         String localPrefix = StringUtils.substringBefore(attributeName, ".");
 233  0
                         String localAttributeName = StringUtils.substringAfter(attributeName, ".");
 234  0
                         if (bo == null) {
 235  0
                                 bo = (BusinessObject) ObjectUtils.createNewObjectFromClass(boClass);
 236  
                         }
 237  0
                         Class nestedClass = ObjectUtils.getPropertyType(bo, localPrefix, getPersistenceStructureService());
 238  0
                         String fullPrefix = localPrefix;
 239  0
                         if (StringUtils.isNotBlank(attributePrefix)) {
 240  0
                                 fullPrefix = attributePrefix + "." + localPrefix;
 241  
                         }
 242  0
                         if (BusinessObject.class.isAssignableFrom(nestedClass)) {
 243  0
                                 relationship = getBusinessObjectRelationship(null, nestedClass, localAttributeName, fullPrefix,
 244  
                                                 keysOnly);
 245  
                         }
 246  0
                         return relationship;
 247  
                 }
 248  0
                 int maxSize = Integer.MAX_VALUE;
 249  
                 // try persistable reference first
 250  0
                 if (PersistableBusinessObject.class.isAssignableFrom(boClass)
 251  
                                 && getPersistenceStructureService().isPersistable(boClass)) {
 252  0
                         Map<String, BusinessObjectRelationship> rels = getPersistenceStructureService().getRelationshipMetadata(boClass,
 253  
                                         attributeName, attributePrefix);
 254  0
                         if (rels.size() > 0) {
 255  0
                                 for (BusinessObjectRelationship rel : rels.values()) {
 256  0
                                         if (rel.getParentToChildReferences().size() < maxSize && isLookupable(rel.getRelatedClass())) {
 257  0
                                                 maxSize = rel.getParentToChildReferences().size();
 258  0
                                                 relationship = rel;
 259  
                                         }
 260  
                                 }
 261  
                         }
 262  0
                 }
 263  
                 else {
 264  0
                         ModuleService moduleService = KNSServiceLocatorWeb.getKualiModuleService()
 265  
                                         .getResponsibleModuleService(boClass);
 266  0
                         if (moduleService != null && moduleService.isExternalizable(boClass)) {
 267  0
                                 relationship = getRelationshipMetadata(boClass, attributeName, attributePrefix);
 268  
                                 // relationship =
 269  
                                 // moduleService.getBusinessObjectRelationship(boClass,
 270  
                                 // attributeName, attributePrefix);
 271  0
                                 if (relationship != null) {
 272  0
                                         return relationship;
 273  
                                 }
 274  
                         }
 275  
                 }
 276  
 
 277  
                 // then check the DD for relationships defined there
 278  
                 // TODO move out to a separate method
 279  
                 // so that the logic for finding the relationships is similar to
 280  
                 // primitiveReference
 281  0
                 if (ddReference != null && isLookupable(ddReference.getTargetClass()) && bo != null
 282  
                                 && ddReference.getPrimitiveAttributes().size() < maxSize) {
 283  0
                         relationship = new BusinessObjectRelationship(boClass, ddReference.getObjectAttributeName(),
 284  
                                         ddReference.getTargetClass());
 285  0
                         for (PrimitiveAttributeDefinition def : ddReference.getPrimitiveAttributes()) {
 286  0
                                 relationship.getParentToChildReferences().put(def.getSourceName(), def.getTargetName());
 287  
                         }
 288  0
                         if (!keysOnly) {
 289  0
                                 for (SupportAttributeDefinition def : ddReference.getSupportAttributes()) {
 290  0
                                         relationship.getParentToChildReferences().put(def.getSourceName(), def.getTargetName());
 291  
                                 }
 292  
                         }
 293  
                 }
 294  
 
 295  0
                 return relationship;
 296  
 
 297  
         }
 298  
 
 299  
 
 300  
 
 301  
         public RelationshipDefinition getBusinessObjectRelationshipDefinition(Class c, String attributeName) {
 302  0
                 return getDictionaryRelationship(c, attributeName);
 303  
         }
 304  
 
 305  
         public RelationshipDefinition getBusinessObjectRelationshipDefinition(BusinessObject bo, String attributeName) {
 306  0
                 return getBusinessObjectRelationshipDefinition(bo.getClass(), attributeName);
 307  
         }
 308  
 
 309  
         public BusinessObjectRelationship getBusinessObjectRelationship(BusinessObject bo, Class boClass,
 310  
                         String attributeName, String attributePrefix, boolean keysOnly) {
 311  0
                 RelationshipDefinition ddReference = getBusinessObjectRelationshipDefinition(boClass, attributeName);
 312  0
                 return getBusinessObjectRelationship(ddReference, bo, boClass, attributeName, attributePrefix, keysOnly);
 313  
         }
 314  
 
 315  
         /**
 316  
          * Gets the businessObjectDictionaryService attribute.
 317  
          * 
 318  
          * @return Returns the businessObjectDictionaryService.
 319  
          */
 320  
         public BusinessObjectDictionaryService getBusinessObjectDictionaryService() {
 321  0
                 return businessObjectDictionaryService;
 322  
         }
 323  
 
 324  
         /**
 325  
          * Sets the businessObjectDictionaryService attribute value.
 326  
          * 
 327  
          * @param businessObjectDictionaryService
 328  
          *            The BusinessObjectDictionaryService to set.
 329  
          */
 330  
         public void setBusinessObjectDictionaryService(BusinessObjectDictionaryService businessObjectDictionaryService) {
 331  0
                 this.businessObjectDictionaryService = businessObjectDictionaryService;
 332  0
         }
 333  
 
 334  
         /**
 335  
          * 
 336  
          * This method retrieves the business object class for a specific attribute
 337  
          * 
 338  
          * @param bo
 339  
          * @param attributeName
 340  
          * @return a business object class for a specific attribute
 341  
          */
 342  
         private Class getNestedBOClass(BusinessObject bo, String attributeName) {
 343  
 
 344  0
                 String[] nestedAttributes = StringUtils.split(attributeName, ".");
 345  0
                 String attributeRefName = "";
 346  0
                 Class clazz = null;
 347  0
                 if (nestedAttributes.length > 1) {
 348  0
                         String attributeStringSoFar = "";
 349  0
                         for (int i = 0; i < nestedAttributes.length - 1; i++) {
 350  
                                 try {
 351  
                                         // we need to build a string of the attribute names
 352  
                                         // depending on which iteration we're in.
 353  
                                         // so if the original attributeName string we're using is
 354  
                                         // "a.b.c.d.e", then first iteration would use
 355  
                                         // "a", 2nd "a.b", 3rd "a.b.c", etc.
 356  0
                                         if (i != 0) {
 357  0
                                                 attributeStringSoFar = attributeStringSoFar + ".";
 358  
                                         }
 359  0
                                         attributeStringSoFar = attributeStringSoFar + nestedAttributes[i];
 360  0
                                         clazz = ObjectUtils.easyGetPropertyType(bo, attributeStringSoFar);
 361  
                                 }
 362  0
                                 catch (InvocationTargetException ite) {
 363  0
                                         LOG.info(ite);
 364  0
                                         return null;
 365  
                                 }
 366  0
                                 catch (NoSuchMethodException nsme) {
 367  0
                                         LOG.info(nsme);
 368  0
                                         return null;
 369  
                                 }
 370  0
                                 catch (IllegalAccessException iae) {
 371  0
                                         LOG.info(iae);
 372  0
                                         return null;
 373  0
                                 }
 374  
                         }
 375  
                 }
 376  0
                 return clazz;
 377  
         }
 378  
 
 379  
         public List<BusinessObjectRelationship> getBusinessObjectRelationships(BusinessObject bo) {
 380  0
                 if (bo == null) {
 381  0
                         return null;
 382  
                 }
 383  0
                 return getBusinessObjectRelationships(bo.getClass());
 384  
         }
 385  
 
 386  
         @SuppressWarnings("unchecked")
 387  
         public List<BusinessObjectRelationship> getBusinessObjectRelationships(Class<? extends BusinessObject> boClass) {
 388  0
                 if (boClass == null) {
 389  0
                         return null;
 390  
                 }
 391  
 
 392  0
                 Map<String, Class> referenceClasses = null;
 393  0
                 if (PersistableBusinessObject.class.isAssignableFrom(boClass)
 394  
                                 && getPersistenceStructureService().isPersistable(boClass)) {
 395  0
                         referenceClasses = getPersistenceStructureService().listReferenceObjectFields(boClass);
 396  
                 }
 397  0
                 DataDictionaryEntry ddEntry = getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry(
 398  
                                 boClass.getName());
 399  0
                 List<RelationshipDefinition> ddRelationships = (ddEntry == null ? new ArrayList<RelationshipDefinition>()
 400  
                                 : ddEntry.getRelationships());
 401  0
                 List<BusinessObjectRelationship> relationships = new ArrayList<BusinessObjectRelationship>();
 402  
 
 403  
                 // loop over all relationships
 404  0
                 if (referenceClasses != null) {
 405  0
                         for (Map.Entry<String, Class> entry : referenceClasses.entrySet()) {
 406  0
                                 if (isLookupable(entry.getValue())) {
 407  0
                                         Map<String, String> fkToPkRefs = getPersistenceStructureService().getForeignKeysForReference(boClass,
 408  
                                                         entry.getKey());
 409  0
                                         BusinessObjectRelationship rel = new BusinessObjectRelationship(boClass, entry.getKey(),
 410  
                                                         entry.getValue());
 411  0
                                         for (Map.Entry<String, String> ref : fkToPkRefs.entrySet()) {
 412  0
                                                 rel.getParentToChildReferences().put(ref.getKey(), ref.getValue());
 413  
                                         }
 414  0
                                         relationships.add(rel);
 415  0
                                 }
 416  
                         }
 417  
                 }
 418  
 
 419  0
                 for (RelationshipDefinition rd : ddRelationships) {
 420  0
                         if (isLookupable(rd.getTargetClass())) {
 421  0
                                 BusinessObjectRelationship rel = new BusinessObjectRelationship(boClass, rd.getObjectAttributeName(),
 422  
                                                 rd.getTargetClass());
 423  0
                                 for (PrimitiveAttributeDefinition def : rd.getPrimitiveAttributes()) {
 424  0
                                         rel.getParentToChildReferences().put(def.getSourceName(), def.getTargetName());
 425  
                                 }
 426  0
                                 relationships.add(rel);
 427  0
                         }
 428  
                 }
 429  
 
 430  0
                 return relationships;
 431  
         }
 432  
 
 433  
         /***************************************************************************
 434  
          * @see org.kuali.rice.kns.service.BusinessObjectMetaDataService#getReferencesForForeignKey(java.lang.Class,
 435  
          *      java.lang.String)
 436  
          */
 437  
         public Map<String, Class> getReferencesForForeignKey(BusinessObject bo, String attributeName) {
 438  0
                 List<BusinessObjectRelationship> businessObjectRelationships = getBusinessObjectRelationships(bo);
 439  0
                 Map<String, Class> referencesForForeignKey = new HashMap<String, Class>();
 440  0
                 for (BusinessObjectRelationship businessObjectRelationship : businessObjectRelationships) {
 441  0
                         if (businessObjectRelationship != null && businessObjectRelationship.getParentToChildReferences() != null
 442  
                                         && businessObjectRelationship.getParentToChildReferences().containsKey(attributeName)) {
 443  0
                                 referencesForForeignKey.put(businessObjectRelationship.getParentAttributeName(),
 444  
                                                 businessObjectRelationship.getRelatedClass());
 445  
                         }
 446  
                 }
 447  0
                 return referencesForForeignKey;
 448  
         }
 449  
 
 450  
         public String getForeignKeyFieldName(Class businessObjectClass, String attributeName, String targetName) {
 451  
 
 452  0
                 String fkName = "";
 453  
 
 454  
                 // first try DD-based relationships
 455  0
                 RelationshipDefinition relationshipDefinition = getDictionaryRelationship(businessObjectClass, attributeName);
 456  
 
 457  0
                 if (relationshipDefinition != null) {
 458  0
                         List<PrimitiveAttributeDefinition> primitives = relationshipDefinition.getPrimitiveAttributes();
 459  0
                         for (PrimitiveAttributeDefinition primitiveAttributeDefinition : primitives) {
 460  0
                                 if (primitiveAttributeDefinition.getTargetName().equals(targetName)) {
 461  0
                                         fkName = primitiveAttributeDefinition.getSourceName();
 462  0
                                         break;
 463  
                                 }
 464  
                         }
 465  
                 }
 466  
 
 467  
                 // if we can't find anything in the DD, then try the persistence service
 468  0
                 if (StringUtils.isBlank(fkName) && PersistableBusinessObject.class.isAssignableFrom(businessObjectClass)
 469  
                                 && getPersistenceStructureService().isPersistable(businessObjectClass)) {
 470  0
                         fkName = getPersistenceStructureService().getForeignKeyFieldName(businessObjectClass, attributeName,
 471  
                                         targetName);
 472  
                 }
 473  0
                 return fkName;
 474  
         }
 475  
 }