/** {@inheritDoc} */ @Override public List<String> getPrimaryKeyAttributeNames() { if (primaryKeyAttributeNames != null) { return primaryKeyAttributeNames; } if (embedded != null) { return embedded.getPrimaryKeyAttributeNames(); } return Collections.emptyList(); }
/** {@inheritDoc} */ @Override public boolean isSupportsOptimisticLocking() { if (supportsOptimisticLocking != null) { return supportsOptimisticLocking; } if (embedded != null) { return embedded.isSupportsOptimisticLocking(); } return false; }
/** {@inheritDoc} */ @Override @Beta public Collection<UifAutoCreateViewType> getAutoCreateUifViewTypes() { if (autoCreateUifViewTypes != null) { return autoCreateUifViewTypes; } if (embedded != null) { return embedded.getAutoCreateUifViewTypes(); } return null; }
/** {@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(); }
/** {@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(); }
/** {@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(); }
/** {@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; }
/** {@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; }
/** {@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; }
/** {@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; }
/** {@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()); }
/** {@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; }