+ final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
+ if (!super.equals(other)) {
+ return super.compareTo(other);
+ }
+
+ return ObjectUtils.compare(toscaDefinitionsVersion, other.toscaDefinitionsVersion);
+ }
+
+ /**
+ * Validate that all data types referenced in policy types exist.
+ *
+ * @param result where the results are added
+ */
+ private void validateReferencedDataTypes(final BeanValidationResult result) {
+ if (policyTypes == null) {
+ return;
+ }
+
+ if (dataTypes != null) {
+ for (JpaToscaDataType dataType : dataTypes.getAll(null)) {
+ validateReferencedDataTypesExists(dataType.getReferencedDataTypes(), result);
+ }
+ }
+
+ for (JpaToscaPolicyType policyType : policyTypes.getAll(null)) {
+ validateReferencedDataTypesExists(policyType.getReferencedDataTypes(), result);
+ }
+ }
+
+ /**
+ * Validate that the referenced data types exist for a collection of data type keys.
+ *
+ * @param dataTypeKeyCollection the data type key collection
+ * @param result where the results are added
+ */
+ private void validateReferencedDataTypesExists(final Collection<PfConceptKey> dataTypeKeyCollection,
+ final BeanValidationResult result) {
+ for (PfConceptKey dataTypeKey : dataTypeKeyCollection) {
+ if (dataTypes == null || dataTypes.get(dataTypeKey) == null) {
+ addResult(result, "data type", dataTypeKey.getId(), NOT_FOUND);
+ }
+ }
+ }