-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#28896 Including listParents as attribute on the response of the chil…
…dren Categories Endpoint
- Loading branch information
1 parent
a30aa11
commit bb8cd6c
Showing
10 changed files
with
263 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/HierarchedCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.dotmarketing.portlets.categories.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents a {@link Category} with its hierarchy calculated. | ||
* This means traversing from the current category all the way up to the first-level category that you encounter. | ||
* | ||
* For example: | ||
* | ||
* | Name | Parent | hierarchy | | ||
* |-------------|----------------|------------------------ | | ||
* | Top Category| null | [] | | ||
* | Child | Top Category | [Top Category] | | ||
* | Grand Child | Child | [Top Category, Child] | | ||
* | ||
*/ | ||
public class HierarchedCategory extends Category{ | ||
|
||
private List<ShortCategory> parentList; | ||
|
||
public void setParentList(final List<ShortCategory> parentList) { | ||
this.parentList = parentList; | ||
} | ||
|
||
public List<ShortCategory> getParentList() { | ||
return parentList; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
dotCMS/src/main/java/com/dotmarketing/portlets/categories/model/ShortCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.dotmarketing.portlets.categories.model; | ||
|
||
/** | ||
* Represents a {@link Category}, but only contains the most important data: | ||
* | ||
* - Category's name | ||
* - Category's key | ||
* - Category's inode | ||
*/ | ||
public class ShortCategory { | ||
|
||
private String categoryName; | ||
private String inode; | ||
private String key; | ||
|
||
private ShortCategory(final Builder builder) { | ||
this.categoryName = builder.categoryName; | ||
this.inode = builder.inode; | ||
this.key = builder.key; | ||
} | ||
|
||
public String getCategoryName() { | ||
return categoryName; | ||
} | ||
|
||
public String getInode() { | ||
return inode; | ||
} | ||
|
||
public String getKey() { | ||
return key; | ||
} | ||
|
||
public static class Builder { | ||
private String categoryName; | ||
private String inode; | ||
private String key; | ||
|
||
public Builder setCategoryName(String categoryName) { | ||
this.categoryName = categoryName; | ||
return this; | ||
} | ||
|
||
public Builder setInode(String inode) { | ||
this.inode = inode; | ||
return this; | ||
} | ||
|
||
public Builder setKey(String key) { | ||
this.key = key; | ||
return this; | ||
} | ||
|
||
public ShortCategory build() { | ||
return new ShortCategory(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.