}
/**
- * Find all the ancestors of an entity type.
+ * getLatestPolicyTypeVersion Find all the ancestors of an entity type.
*
* @param entityTypes the set of entity types that exist
* @param entityType the entity type for which to get the parents
return CollectionUtils.emptyCollection();
}
+ if (entityType.getKey().equals(parentEntityTypeKey)) {
+ result.addValidationMessage(new PfValidationMessage(entityType.getKey(), ToscaUtils.class,
+ ValidationResult.INVALID, "entity cannot be an ancestor of itself"));
+ throw new PfModelRuntimeException(Response.Status.CONFLICT, result.toString());
+ }
+
@SuppressWarnings("unchecked")
Set<JpaToscaEntityType<ToscaEntity>> ancestorEntitySet = (Set<JpaToscaEntityType<ToscaEntity>>) entityTypes
.getAll(parentEntityTypeKey.getName(), parentEntityTypeKey.getVersion());