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>) JsonUtil.getObjectFromJson(parentsASJsonArray, List.class)) .stream() .map(map -> new ShortCategory.Builder() - .setCategoryName(map.get("categoryName")) + .setName(map.get("categoryName")) .setKey(map.get("key")) .setInode(map.get(INODE)) .build() @@ -976,14 +977,14 @@ private void updateCache(List categories) throws DotDataExce /** * Default implementation of {@link CategoryFactory#findHierarchy(Collection)} * - * @param inodes list of inodes to search + * @param keys list of keys to search * @return * @throws DotDataException */ @Override - public List findHierarchy(final Collection inodes) throws DotDataException { + public List findHierarchy(final Collection keys) throws DotDataException { - if (inodes == null || inodes.isEmpty()) { + if (keys == null || keys.isEmpty()) { return Collections.emptyList(); } @@ -992,37 +993,45 @@ public List findHierarchy(final Collection inode "c.inode AS root_inode," + "c.category_name," + "c.category_name AS root_category_name," + + "c.category_key," + + "c.category_key AS root_category_key," + "1 AS level," + "json_build_object('inode', c.inode, 'categoryName', c.category_name, 'key', c.category_key)::varchar AS path " + "FROM Category c " + - "WHERE c.inode IN (%s) " + + "WHERE c.category_key IN (%s) " + "UNION ALL " + "SELECT " + "c.inode, " + "ch.root_inode AS root_inode, " + "c.category_name, " + "ch.root_category_name AS root_category_name, " + + "c.category_key, " + + "ch.root_category_key AS root_category_key, " + "ch.level + 1 AS level, " + "CONCAT(json_build_object('inode', c.inode, 'categoryName', c.category_name, 'key', c.category_key)::varchar, ',', ch.path) AS path " + "FROM Category c JOIN tree t ON c.inode = t.parent JOIN CategoryHierarchy ch ON t.child = ch.inode " + ")," + "MaxLevels AS (SELECT root_inode, MAX(level) AS max_level FROM CategoryHierarchy GROUP BY root_inode) " + "SELECT " + - "ch.root_inode as inode, ch.root_category_name as category_name, " + + "ch.root_inode as inode, ch.root_category_name as category_name, ch.root_category_key as category_key," + "CONCAT('[', path, ']')::jsonb as path " + "FROM CategoryHierarchy ch JOIN MaxLevels ml ON ch.root_inode = ml.root_inode AND ch.level = ml.max_level;"; final DotConnect dc = new DotConnect() - .setSQL(String.format(queryTemplate, DotConnect.createParametersPlaceholder(inodes.size()))); + .setSQL(String.format(queryTemplate, DotConnect.createParametersPlaceholder(keys.size()))); - inodes.forEach(dc::addParam); + keys.forEach(dc::addParam); return dc.loadObjectResults().stream().map(row -> { final List parentList = getShortCategories(row.get("path").toString()); - return new HierarchyShortCategory(row.get(INODE).toString(), row.get(CATEGORY_NAME).toString(), - parentList.subList(0, parentList.size() - 1)); + return new HierarchyShortCategory.Builder() + .setInode(row.get(INODE).toString()) + .setName(row.get(CATEGORY_NAME).toString()) + .setKey(row.get(CATEGORY_KEY).toString()) + .setParentList(parentList.subList(0, parentList.size() - 1)) + .build(); }).collect(Collectors.toList()); } diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/HierarchyShortCategory.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/HierarchyShortCategory.java index 045db8e09cf3..c1a861030d4e 100644 --- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/HierarchyShortCategory.java +++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/HierarchyShortCategory.java @@ -8,13 +8,15 @@ */ public class HierarchyShortCategory implements Serializable { private final String inode; - private final String categoryName; + private final String name; + private final String key; private final List parentList; - public HierarchyShortCategory(final String inode, final String categoryName, final List parentList) { - this.inode = inode; - this.parentList = parentList; - this.categoryName = categoryName; + public HierarchyShortCategory(final Builder builder) { + this.inode = builder.inode; + this.parentList = builder.parentList; + this.name = builder.name; + this.key = builder.key; } public String getInode() { @@ -25,7 +27,43 @@ public List getParentList() { return parentList; } - public String getCategoryName() { - return categoryName; + public String getName() { + return name; + } + + public String getKey() { + return key; + } + + public static class Builder { + private String inode; + private String name; + + private String key; + private List parentList; + + public Builder setInode(String inode) { + this.inode = inode; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + public Builder setParentList(List parentList) { + this.parentList = parentList; + return this; + } + + public HierarchyShortCategory build(){ + return new HierarchyShortCategory(this); + } } } diff --git a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/ShortCategory.java b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/ShortCategory.java index f6b146897e88..856e02b443af 100644 --- a/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/ShortCategory.java +++ b/dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/ShortCategory.java @@ -11,18 +11,18 @@ */ public class ShortCategory implements Serializable { - private String categoryName; + private String name; private String inode; private String key; private ShortCategory(final Builder builder) { - this.categoryName = builder.categoryName; + this.name = builder.name; this.inode = builder.inode; this.key = builder.key; } - public String getCategoryName() { - return categoryName; + public String getName() { + return name; } public String getInode() { @@ -34,12 +34,12 @@ public String getKey() { } public static class Builder { - private String categoryName; + private String name; private String inode; private String key; - public Builder setCategoryName(String categoryName) { - this.categoryName = categoryName; + public Builder setName(String name) { + this.name = name; return this; } diff --git a/dotcms-integration/src/test/java/com/dotmarketing/portlets/categories/business/CategoryFactoryTest.java b/dotcms-integration/src/test/java/com/dotmarketing/portlets/categories/business/CategoryFactoryTest.java index 92b07f52751c..db290968139e 100644 --- a/dotcms-integration/src/test/java/com/dotmarketing/portlets/categories/business/CategoryFactoryTest.java +++ b/dotcms-integration/src/test/java/com/dotmarketing/portlets/categories/business/CategoryFactoryTest.java @@ -607,20 +607,20 @@ public void hierarchyCategory() throws DotDataException { final List categories = FactoryLocator.getCategoryFactory().findAll(categorySearchCriteria); assertEquals(1, categories.size()); - assertEquals(greatGrandchildCategory.getInode(), categories.get(0).getInode()); + assertEquals(greatGrandchildCategory.getKey(), categories.get(0).getKey()); final List hierarchy = categories.get(0).getParentList(); assertEquals(3, hierarchy.size()); - assertEquals(hierarchy.get(0).getCategoryName(), topLevelCategory.getCategoryName()); + assertEquals(hierarchy.get(0).getName(), topLevelCategory.getCategoryName()); assertEquals(hierarchy.get(0).getKey(), topLevelCategory.getKey()); assertEquals(hierarchy.get(0).getInode(), topLevelCategory.getInode()); - assertEquals(hierarchy.get(1).getCategoryName(), childCategory.getCategoryName()); + assertEquals(hierarchy.get(1).getName(), childCategory.getCategoryName()); assertEquals(hierarchy.get(1).getKey(), childCategory.getKey()); assertEquals(hierarchy.get(1).getInode(), childCategory.getInode()); - assertEquals(hierarchy.get(2).getCategoryName(), grandChildCategory.getCategoryName()); + assertEquals(hierarchy.get(2).getName(), grandChildCategory.getCategoryName()); assertEquals(hierarchy.get(2).getKey(), grandChildCategory.getKey()); assertEquals(hierarchy.get(2).getInode(), grandChildCategory.getInode()); } @@ -671,20 +671,20 @@ public void findHierarchy() throws DotDataException { .nextPersisted(); final List categories = FactoryLocator.getCategoryFactory() - .findHierarchy(list(grandChildCategory.getInode(), greatGrandchildCategory.getInode())); + .findHierarchy(list(grandChildCategory.getKey(), greatGrandchildCategory.getKey())); assertEquals(2, categories.size()); for (final HierarchyShortCategory category : categories) { if (grandChildCategory.getInode().equals(category.getInode())) { assertEquals(2, category.getParentList().size()); - assertEquals("Top Level Category", category.getParentList().get(0).getCategoryName()); - assertEquals("Child Category", category.getParentList().get(1).getCategoryName()); + assertEquals("Top Level Category", category.getParentList().get(0).getName()); + assertEquals("Child Category", category.getParentList().get(1).getName()); } else if (greatGrandchildCategory.getInode().equals(category.getInode())) { assertEquals(3, category.getParentList().size()); - assertEquals("Top Level Category", category.getParentList().get(0).getCategoryName()); - assertEquals("Child Category", category.getParentList().get(1).getCategoryName()); - assertEquals("Grand Child Category", category.getParentList().get(2).getCategoryName()); + assertEquals("Top Level Category", category.getParentList().get(0).getName()); + assertEquals("Child Category", category.getParentList().get(1).getName()); + assertEquals("Grand Child Category", category.getParentList().get(2).getName()); } else { throw new AssertionError("Unexpected Category"); } diff --git a/dotcms-postman/src/main/resources/postman/Category.postman_collection.json b/dotcms-postman/src/main/resources/postman/Category.postman_collection.json index 0610e191c68d..f174f44c0d0e 100644 --- a/dotcms-postman/src/main/resources/postman/Category.postman_collection.json +++ b/dotcms-postman/src/main/resources/postman/Category.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "4aaa5f5d-78ea-498e-a1a4-3b367004de5e", + "_postman_id": "523736d4-190a-4f2f-a010-29f19ead54d5", "name": "Category", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "30436704" @@ -3273,7 +3273,8 @@ " pm.expect(jsonData.entity.categoryName).to.eql(\"Hierarchy Child 2\");", "});", "", - "pm.collectionVariables.set(\"child2CategoryInodeHierarchy\", jsonData.entity.inode);" + "pm.collectionVariables.set(\"child2CategoryInodeHierarchy\", jsonData.entity.inode);", + "pm.collectionVariables.set(\"child2CategoryKeyHierarchy\", jsonData.entity.key);" ], "type": "text/javascript", "packages": {} @@ -3295,7 +3296,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\":\"Hierarchy Child 2\",\n \"categoryName\" : \"Hierarchy Child 2\",\n \"keywords\":\"This is a child test category\",\n \"categoryVelocityVarName\" : \"Hierarchy_ChildTestKey_2\",\n \"parent\" : \"{{topCategoryInodeHierarchy}}\"\n}\n\n", + "raw": "{\n \"key\":\"Hierarchy_Child_2_key\",\n \"categoryName\" : \"Hierarchy Child 2\",\n \"keywords\":\"This is a child test category\",\n \"categoryVelocityVarName\" : \"Hierarchy_ChildTestKey_2\",\n \"parent\" : \"{{topCategoryInodeHierarchy}}\"\n}\n\n", "options": { "raw": { "language": "json" @@ -3397,6 +3398,7 @@ "});", "", "pm.collectionVariables.set(\"grantChildCategoryInodeHierarchy\", jsonData.entity.inode);", + "pm.collectionVariables.set(\"grantChildCategoryKeyHierarchy\", jsonData.entity.key);", "" ], "type": "text/javascript", @@ -3419,7 +3421,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"key\":\"Hierarchy ChiGrandchildld 1\",\n \"categoryName\" : \"Hierarchy Grandchild 1\",\n \"keywords\":\"This is a child test category\",\n \"categoryVelocityVarName\" : \"Hierarchy_GrandcßhildTestKey_1\",\n \"parent\" : \"{{child3CategoryInodeHierarchy}}\"\n}\n\n", + "raw": "{\n \"key\":\"Hierarchy_Grandchild_1_key\",\n \"categoryName\" : \"Hierarchy Grandchild 1\",\n \"keywords\":\"This is a child test category\",\n \"categoryVelocityVarName\" : \"Hierarchy_GrandcßhildTestKey_1\",\n \"parent\" : \"{{child3CategoryInodeHierarchy}}\"\n}\n\n", "options": { "raw": { "language": "json" @@ -3524,20 +3526,22 @@ " { ", "", " if (jsonData.entity[i]['inode'] === child2CategoryInodeHierarchy) {", - " pm.expect('Hierarchy Child 2').to.have.equals(jsonData.entity[i].categoryName);", + " pm.expect('Hierarchy Child 2').to.have.equals(jsonData.entity[i].name);", + " pm.expect('Hierarchy_Child_2_key').to.have.equals(jsonData.entity[i].key);", " pm.expect(1).to.have.equals(jsonData.entity[i].parentList.length);", - " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].categoryName);", + " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].name);", " pm.expect(pm.collectionVariables.get(\"topCategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[0].inode);", " pm.expect('Hierarchy_TOP_LEVEL').to.have.equals(jsonData.entity[i].parentList[0].key);", " } else if (jsonData.entity[i]['inode'] === grantChildCategoryInodeHierarchy) {", - " pm.expect('Hierarchy Grandchild 1').to.have.equals(jsonData.entity[i].categoryName);", + " pm.expect('Hierarchy Grandchild 1').to.have.equals(jsonData.entity[i].name);", + " pm.expect('Hierarchy_Grandchild_1_key').to.have.equals(jsonData.entity[i].key);", " pm.expect(2).to.have.equals(jsonData.entity[i].parentList.length);", "", - " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].categoryName);", + " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].name);", " pm.expect(pm.collectionVariables.get(\"topCategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[0].inode);", " pm.expect('Hierarchy_TOP_LEVEL').to.have.equals(jsonData.entity[i].parentList[0].key);", "", - " pm.expect(\"Hierarchy Child 3\").to.have.equals(jsonData.entity[i].parentList[1].categoryName);", + " pm.expect(\"Hierarchy Child 3\").to.have.equals(jsonData.entity[i].parentList[1].name);", " pm.expect(pm.collectionVariables.get(\"child3CategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[1].inode);", " pm.expect(\"Hierarchy_Child_3\").to.have.equals(jsonData.entity[i].parentList[1].key);", " } else {", @@ -3570,7 +3574,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"inodes\": [\"{{grantChildCategoryInodeHierarchy}}\", \"{{child2CategoryInodeHierarchy}}\"]\n}", + "raw": "{\n \"keys\": [\"{{grantChildCategoryKeyHierarchy}}\", \"{{child2CategoryKeyHierarchy}}\"]\n}", "options": { "raw": { "language": "json" @@ -3622,17 +3626,17 @@ "", " if (jsonData.entity[i]['inode'] === child2CategoryInodeHierarchy) {", " pm.expect(1).to.have.equals(jsonData.entity[i].parentList.length);", - " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].categoryName);", + " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].name);", " pm.expect(pm.collectionVariables.get(\"topCategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[0].inode);", " pm.expect('Hierarchy_TOP_LEVEL').to.have.equals(jsonData.entity[i].parentList[0].key);", " } else if (jsonData.entity[i]['inode'] === grantChildCategoryInodeHierarchy) {", " pm.expect(2).to.have.equals(jsonData.entity[i].parentList.length);", "", - " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].categoryName);", + " pm.expect('Hierarchy Top level Category').to.have.equals(jsonData.entity[i].parentList[0].name);", " pm.expect(pm.collectionVariables.get(\"topCategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[0].inode);", " pm.expect('Hierarchy_TOP_LEVEL').to.have.equals(jsonData.entity[i].parentList[0].key);", "", - " pm.expect(\"Hierarchy Child 3\").to.have.equals(jsonData.entity[i].parentList[1].categoryName);", + " pm.expect(\"Hierarchy Child 3\").to.have.equals(jsonData.entity[i].parentList[1].name);", " pm.expect(pm.collectionVariables.get(\"child3CategoryInodeHierarchy\")).to.have.equals(jsonData.entity[i].parentList[1].inode);", " pm.expect(\"Hierarchy_Child_3\").to.have.equals(jsonData.entity[i].parentList[1].key);", " } else {", @@ -3666,7 +3670,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"inodes\": [\"{{grantChildCategoryInodeHierarchy}}\", \"{{child2CategoryInodeHierarchy}}\", \"not_valid_category\"]\n}", + "raw": "{\n \"keys\": [\"{{grantChildCategoryKeyHierarchy}}\", \"{{child2CategoryKeyHierarchy}}\", \"not_valid_category\"]\n}", "options": { "raw": { "language": "json" @@ -3731,7 +3735,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\n \"inodes\": []\n}", + "raw": "{\n \"keys\": []\n}", "options": { "raw": { "language": "json" @@ -6202,6 +6206,14 @@ { "key": "grantChildCategoryInodeHierarchy", "value": "" + }, + { + "key": "child2CategoryKeyHierarchy", + "value": "" + }, + { + "key": "grantChildCategoryKeyHierarchy", + "value": "" } ] } \ No newline at end of file