@Override
public int compareTo(final PfConcept otherConcept) {
- if (otherConcept == null) {
- return -1;
- }
- if (this == otherConcept) {
- return 0;
- }
- if (getClass() != otherConcept.getClass()) {
- return getClass().getName().compareTo(otherConcept.getClass().getName());
- }
-
- final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
- if (!super.equals(other)) {
- return super.compareTo(other);
- }
-
- int result = ObjectUtils.compare(toscaDefinitionsVersion, other.toscaDefinitionsVersion);
+ int result = compareToWithoutEntities(otherConcept);
if (result != 0) {
return result;
}
+ final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
+
result = ObjectUtils.compare(dataTypes, other.dataTypes);
if (result != 0) {
return result;
return ObjectUtils.compare(topologyTemplate, other.topologyTemplate);
}
+
+ /**
+ * Compare this service template to another service template, ignoring contained entitites.
+ *
+ * @param otherConcept the other topology template
+ * @return the result of the comparison
+ */
+ public int compareToWithoutEntities(final PfConcept otherConcept) {
+ if (otherConcept == null) {
+ return -1;
+ }
+ if (this == otherConcept) {
+ return 0;
+ }
+ if (getClass() != otherConcept.getClass()) {
+ return getClass().getName().compareTo(otherConcept.getClass().getName());
+ }
+
+ final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
+ if (!super.equals(other)) {
+ return super.compareTo(other);
+ }
+
+ return ObjectUtils.compare(toscaDefinitionsVersion, other.toscaDefinitionsVersion);
+ }
}