return category1.compareTo(category2);
}
+ /**
+ * Copies all data from source category to target category
+ * <p>
+ * @param sourceCategory Source category instance
+ * @param targetCategory Target category instance
+ */
+ public static void copyCategoryData (final Category sourceCategory, final Category targetCategory) {
+ // Category should be valid
+ if (null == sourceCategory) {
+ // Throw NPE
+ throw new NullPointerException("sourceCategory is null"); //NOI18N
+ } else if (null == targetCategory) {
+ // Throw NPE
+ throw new NullPointerException("targetCategory is null"); //NOI18N
+ } else if (Objects.equals(sourceCategory, targetCategory)) {
+ // Is exactly the same!
+ throw new IllegalArgumentException("sourcerCategory and targetCategory are the same."); //NOI18N
+ }
+
+ // Copy all:
+ targetCategory.setCategoryEntryCreated(sourceCategory.getCategoryEntryCreated());
+ targetCategory.setCategoryEntryUpdated(sourceCategory.getCategoryEntryUpdated());
+ targetCategory.setCategoryI18nKey(sourceCategory.getCategoryI18nKey());
+ targetCategory.setCategoryId(sourceCategory.getCategoryId());
+ targetCategory.setCategoryShownInStatistics(sourceCategory.getCategoryShownInStatistics());
+ }
+
/**
* Utility classes should have no instances
*/