diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoriesResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoriesResource.java
index ccddc281c05e..76235abb49a3 100644
--- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoriesResource.java
+++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoriesResource.java
@@ -29,13 +29,10 @@
import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.portlets.categories.business.CategoryAPI;
-import com.dotmarketing.portlets.categories.business.PaginatedCategories;
import com.dotmarketing.portlets.categories.model.Category;
-import com.dotmarketing.portlets.categories.model.HierarchyShortCategory;
import com.dotmarketing.util.ActivityLogger;
import com.dotmarketing.util.Logger;
import com.dotmarketing.util.PageMode;
-import com.dotmarketing.util.PaginatedArrayList;
import com.dotmarketing.util.UtilMethods;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -291,7 +288,7 @@ public final Response getChildren(@Context final HttpServletRequest httpRequest,
*
*
* {
- * "inodes": ["352ca17e238357ce12e9dff10afc8516", "c0ab974897f8d37c98afa4bba74ef9f1"]
+ * "keys": ["key_1", "key_2"]
* }
*
*
@@ -301,25 +298,29 @@ public final Response getChildren(@Context final HttpServletRequest httpRequest,
* {
* entity: [
* {
- * "inode": "352ca17e238357ce12e9dff10afc8516",
+ * "inode": "1",
+ * "key": "key_1",
+ * "name": "Name_1",
* "parentList": [
* {
- * 'categoryName': 'Grand Parent Name',
+ * 'name': 'Grand Parent Name',
* 'key': 'Grand Parent Key',
* 'inode': 'Grand Parent inode'
* },
* {
- * 'categoryName': 'Parent Name',
+ * 'name': 'Parent Name',
* 'key': 'Parent Key',
* 'inode': 'Parent inode'
* }
* ]
* },
* {
- * "inode": "c0ab974897f8d37c98afa4bba74ef9f1",
+ * "inode": "2",
+ * "key": "key_2",
+ * "name": "Name_2",
* "parentList": [
* {
- * 'categoryName': 'Category name value',
+ * 'name': 'Category name value',
* 'key': 'Key value',
* 'inode': 'inode value'
* }
@@ -346,15 +347,15 @@ public final Response getChildren(@Context final HttpServletRequest httpRequest,
@Produces({MediaType.APPLICATION_JSON})
public final Response getHierarchy(@Context final HttpServletRequest httpRequest,
@Context final HttpServletResponse httpResponse,
- final CategoryInodesForm form) throws DotDataException, DotSecurityException {
+ final CategoryKeysForm form) throws DotDataException, DotSecurityException {
Logger.debug(this, () -> "Getting the List of Parents for the follow categories: " +
- form.getInodes().stream().collect(Collectors.joining(",")));
+ String.join(",", form.getKeys()));
webResource.init(null, httpRequest, httpResponse, true, null);
return Response.ok(
- new HierarchyShortCategoriesResponseView(categoryAPI.findHierarchy(form.getInodes()))).build();
+ new HierarchyShortCategoriesResponseView(categoryAPI.findHierarchy(form.getKeys()))).build();
}
/**
diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryInodesForm.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryInodesForm.java
deleted file mode 100644
index 4a71b43d8f71..000000000000
--- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryInodesForm.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.dotcms.rest.api.v1.categories;
-
-import com.dotcms.repackage.javax.validation.constraints.NotNull;
-import com.dotcms.rest.api.Validated;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.util.List;
-
-/**
- * Category Input Form
- */
-@JsonDeserialize(builder = CategoryInodesForm.Builder.class)
-public class CategoryInodesForm extends Validated {
-
- private List inodes;
-
- private CategoryInodesForm(final Builder builder) {
-
- this.inodes = builder.inodes;
- }
-
- public List getInodes() {
- return inodes;
- }
-
- public static final class Builder {
-
- @JsonProperty
- private List inodes;
-
- public void setInodes(List inodes) {
- this.inodes = inodes;
- }
-
- public CategoryInodesForm build() {
-
- return new CategoryInodesForm(this);
- }
- }
-}
diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryKeysForm.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryKeysForm.java
new file mode 100644
index 000000000000..e9ac67b717fd
--- /dev/null
+++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/categories/CategoryKeysForm.java
@@ -0,0 +1,40 @@
+package com.dotcms.rest.api.v1.categories;
+
+import com.dotcms.rest.api.Validated;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.util.List;
+
+/**
+ * Category Input Form
+ */
+@JsonDeserialize(builder = CategoryKeysForm.Builder.class)
+public class CategoryKeysForm extends Validated {
+
+ private List keys;
+
+ private CategoryKeysForm(final Builder builder) {
+
+ this.keys = builder.keys;
+ }
+
+ public List getKeys() {
+ return keys;
+ }
+
+ public static final class Builder {
+
+ @JsonProperty
+ private List keys;
+
+ public void setKeys(List keys) {
+ this.keys = keys;
+ }
+
+ public CategoryKeysForm build() {
+
+ return new CategoryKeysForm(this);
+ }
+ }
+}
diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPI.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPI.java
index 44b0558d25a5..32e6f71794e4 100644
--- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPI.java
+++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPI.java
@@ -512,9 +512,11 @@ PaginatedCategories findAll(final CategorySearchCriteria searchCriteria, final U
* | 2 | Child | child | Top Category |
* | 3 | Grand Child | grand_child | Child |
*
- * And you search by inode 3 then you got:
+ * And you search by key 'grand_child' then you got:
*
* Inode: 3
+ * key: 'grand_child'
+ * categoryName: 'Grand Child'
* parentList [
* {
* 'categoryName':'Top Category',
@@ -528,9 +530,9 @@ PaginatedCategories findAll(final CategorySearchCriteria searchCriteria, final U
* }
* ]
*
- * @param inodes List of inodes to search
+ * @param keys List of keys to search
* @return
* @throws DotDataException
*/
- List findHierarchy(final Collection inodes) throws DotDataException;
+ List findHierarchy(final Collection keys) throws DotDataException;
}
diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java
index 2e30d0ff6b44..a6f54df80205 100644
--- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java
+++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java
@@ -976,15 +976,15 @@ public PaginatedCategories findAll(final CategorySearchCriteria searchCriteria,
/**
* Default implementation of {@link CategoryAPI}
*
- * @param inodes List of inodes to search
+ * @param keys List of keys to search
* @return
*
* @throws DotDataException
*/
@CloseDBIfOpened
@Override
- public List findHierarchy(final Collection inodes) throws DotDataException {
- Logger.debug(this, "Getting parentList for the follow Categories: " + inodes);
- return categoryFactory.findHierarchy(inodes);
+ public List findHierarchy(final Collection keys) throws DotDataException {
+ Logger.debug(this, "Getting parentList for the follow Categories: " + keys);
+ return categoryFactory.findHierarchy(keys);
}
}
diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactory.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactory.java
index 332376eef471..756da12f0658 100644
--- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactory.java
+++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactory.java
@@ -290,7 +290,7 @@ public abstract class CategoryFactory {
public abstract List findAll(final CategorySearchCriteria searchCriteria) throws DotDataException;
/**
- * Find Categories by inodes and calculate its Hierarchy.
+ * Find Categories by keys and calculate its Hierarchy.
*
* For Example if you have the follows categories:
*
@@ -301,9 +301,11 @@ public abstract class CategoryFactory {
* | 2 | Child | child | Top Category |
* | 3 | Grand Child | grand_child | Child |
*
- * And you search by inode 3 then you got:
+ * And you search by key 'grand_child' then you got:
*
* Inode: 3
+ * key: 'grand_child'
+ * categoryName: 'Grand Child'
* parentList [
* {
* 'categoryName':'Top Category',
@@ -317,9 +319,9 @@ public abstract class CategoryFactory {
* }
* ]
*
- * @param inodes List of inodes to search
+ * @param keys List of keys to search
* @return
* @throws DotDataException
*/
- public abstract List findHierarchy(final Collection inodes) throws DotDataException;
+ public abstract List findHierarchy(final Collection keys) throws DotDataException;
}
diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactoryImpl.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactoryImpl.java
index bdeb50c43d10..b39e864abb57 100644
--- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactoryImpl.java
+++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryFactoryImpl.java
@@ -47,6 +47,7 @@ public class CategoryFactoryImpl extends CategoryFactory {
public static final String INODE = "inode";
public static final String CATEGORY_NAME = "category_name";
+ public static final String CATEGORY_KEY = "category_key";
CategoryCache catCache;
final CategorySQL categorySQL;
@@ -670,7 +671,7 @@ private static List getShortCategories(String parentsASJsonArray)
return ((List