Пример #1
0
 /** {@inheritDoc} */
 @Override
 public List<String> getPrimaryKeyAttributeNames() {
   if (primaryKeyAttributeNames != null) {
     return primaryKeyAttributeNames;
   }
   if (embedded != null) {
     return embedded.getPrimaryKeyAttributeNames();
   }
   return Collections.emptyList();
 }
Пример #2
0
 /** {@inheritDoc} */
 @Override
 public boolean isSupportsOptimisticLocking() {
   if (supportsOptimisticLocking != null) {
     return supportsOptimisticLocking;
   }
   if (embedded != null) {
     return embedded.isSupportsOptimisticLocking();
   }
   return false;
 }
Пример #3
0
 /** {@inheritDoc} */
 @Override
 @Beta
 public Collection<UifAutoCreateViewType> getAutoCreateUifViewTypes() {
   if (autoCreateUifViewTypes != null) {
     return autoCreateUifViewTypes;
   }
   if (embedded != null) {
     return embedded.getAutoCreateUifViewTypes();
   }
   return null;
 }
Пример #4
0
 /** {@inheritDoc} */
 @Override
 public List<DataObjectRelationship> getRelationships() {
   // We have a local list and no overrides - return the existing list
   if (relationships != null && embedded == null) {
     return relationships;
   }
   if (embedded != null) {
     return mergeLists(embedded.getRelationships(), relationships);
   }
   return Collections.emptyList();
 }
Пример #5
0
 /** {@inheritDoc} */
 @Override
 public List<DataObjectCollection> getCollections() {
   // We have a local list and no overrides - return the existing list
   if (collections != null && embedded == null) {
     return collections;
   }
   if (embedded != null) {
     return mergeLists(embedded.getCollections(), collections);
   }
   return Collections.emptyList();
 }
Пример #6
0
 /** {@inheritDoc} */
 @Override
 public List<String> getBusinessKeyAttributeNames() {
   // If we have business keys, use that
   if (businessKeyAttributeNames != null) {
     return businessKeyAttributeNames;
   }
   // Otherwise, if we have an explicit PK, use that
   if (primaryKeyAttributeNames != null) {
     return primaryKeyAttributeNames;
   }
   // If neither has been set, go up the chain
   if (embedded != null) {
     return embedded.getBusinessKeyAttributeNames();
   }
   return Collections.emptyList();
 }
Пример #7
0
 /** {@inheritDoc} */
 @Override
 public DataObjectRelationship getRelationshipByLastAttributeInRelationship(String attributeName) {
   // this returns a single record, so we can just use the first matching one we find
   if (StringUtils.isBlank(attributeName)) {
     return null;
   }
   DataObjectRelationship relationship = null;
   // Look locally
   if (lastAttributeToRelationshipMap != null) {
     relationship = lastAttributeToRelationshipMap.get(attributeName);
   }
   // if nothing found local, recurse into the embedded provider
   if (relationship == null && embedded != null) {
     relationship = embedded.getRelationshipByLastAttributeInRelationship(attributeName);
   }
   return relationship;
 }
Пример #8
0
 /** {@inheritDoc} */
 @Override
 public DataObjectRelationship getRelationship(String relationshipName) {
   if (relationshipName == null) {
     return null;
   }
   DataObjectRelationship relationship = null;
   // attempt to get it from the local attribute map (if any attributed defined locally)
   if (relationships != null) {
     relationship = relationshipMap.get(relationshipName);
   }
   // if we don't find one, but we have an embedded metadata object, check it
   if (relationship == null && embedded != null) {
     relationship = embedded.getRelationship(relationshipName);
     // but, ensure it's not on the removed attribute list
     if (relationship != null
         && removedRelationshipNames != null
         && removedRelationshipNames.contains(relationship.getName())) {
       relationship = null;
     }
   }
   return relationship;
 }
Пример #9
0
 /** {@inheritDoc} */
 @Override
 public DataObjectCollection getCollection(String collectionName) {
   if (collectionName == null) {
     return null;
   }
   DataObjectCollection collection = null;
   // attempt to get it from the local attribute map (if any attributed defined locally)
   if (collections != null) {
     collection = collectionMap.get(collectionName);
   }
   // if we don't find one, but we have an embedded metadata object, check it
   if (collection == null && embedded != null) {
     collection = embedded.getCollection(collectionName);
     // but, ensure it's not on the removed attribute list
     if (collection != null
         && removedCollectionNames != null
         && removedCollectionNames.contains(collection.getName())) {
       collection = null;
     }
   }
   return collection;
 }
Пример #10
0
 /** {@inheritDoc} */
 @Override
 public DataObjectAttribute getAttribute(String attributeName) {
   if (attributeName == null) {
     return null;
   }
   DataObjectAttribute attribute = null;
   // attempt to get it from the local attribute map (if any attributed defined locally)
   if (attributes != null) {
     attribute = attributeMap.get(attributeName);
   }
   // if we don't find one, but we have an embedded metadata object, check it
   if (attribute == null && embedded != null) {
     attribute = embedded.getAttribute(attributeName);
     // but, ensure it's not on the removed attribute list
     if (attribute != null
         && removedAttributeNames != null
         && removedAttributeNames.contains(attribute.getName())) {
       attribute = null;
     }
   }
   return attribute;
 }
Пример #11
0
 /** {@inheritDoc} */
 @Override
 public List<DataObjectRelationship> getRelationshipsInvolvingAttribute(String attributeName) {
   // somewhat complex, since it returns a list of all possible relationships
   //
   if (StringUtils.isBlank(attributeName)) {
     return null;
   }
   Map<Object, DataObjectRelationship> relationships =
       new HashMap<Object, DataObjectRelationship>();
   // Look locally
   if (attributeToRelationshipMap != null
       && attributeToRelationshipMap.containsKey(attributeName)) {
     for (DataObjectRelationship rel : attributeToRelationshipMap.get(attributeName)) {
       Object mergeKey = rel.getName();
       if (rel instanceof MetadataCommonInternal) {
         mergeKey = ((MetadataCommonInternal) rel).getUniqueKeyForMerging();
       }
       relationships.put(mergeKey, rel);
     }
   }
   // now, if we have an embedded object, look for matching ones, but exclude if the relationship
   // is the same
   // as that means it was overridden by this bean
   if (embedded != null) {
     for (DataObjectRelationship rel :
         embedded.getRelationshipsInvolvingAttribute(attributeName)) {
       Object mergeKey = rel.getName();
       if (rel instanceof MetadataCommonInternal) {
         mergeKey = ((MetadataCommonInternal) rel).getUniqueKeyForMerging();
       }
       if (!relationships.containsKey(mergeKey)) {
         relationships.put(mergeKey, rel);
       }
     }
   }
   return new ArrayList<DataObjectRelationship>(relationships.values());
 }
Пример #12
0
 /** {@inheritDoc} */
 @Override
 public List<DataObjectAttribute> getAttributes() {
   // We have a local list and no overrides - return the existing list
   if (attributes != null && embedded == null) {
     return orderAttributesByDefinedOrder(attributes);
   }
   if (embedded != null) {
     return orderAttributesByDefinedOrder(mergeLists(embedded.getAttributes(), attributes));
   }
   return Collections.emptyList();
   // if (mergedAttributes != null) {
   // return mergedAttributes;
   // }
   // // We have a local list and no overrides - return the existing list
   // if (attributes != null && embedded == null) {
   // mergedAttributes = orderAttributesByDefinedOrder(attributes);
   // } else if (embedded != null) {
   // mergedAttributes = orderAttributesByDefinedOrder(mergeLists(embedded.getAttributes(),
   // attributes));
   // } else {
   // mergedAttributes = Collections.emptyList();
   // }
   // return mergedAttributes;
 }