Class MCRJSONCategory

java.lang.Object
org.mycore.frontend.classeditor.json.MCRJSONCategory
All Implemented Interfaces:
MCRCategory

public class MCRJSONCategory extends Object implements MCRCategory
GSON Category abstraction.
Author:
Chi
  • Constructor Details

    • MCRJSONCategory

      public MCRJSONCategory()
    • MCRJSONCategory

      public MCRJSONCategory(MCRCategory category)
  • Method Details

    • setParent

      public void setParent(MCRCategory parent)
    • setChildren

      public void setChildren(List<MCRCategory> children)
    • getLeft

      public int getLeft()
    • getLevel

      public int getLevel()
      Description copied from interface: MCRCategory
      Returns the hierarchie level of this category.
      Specified by:
      getLevel in interface MCRCategory
      Returns:
      0 if this is the root category
    • setHasChildren

      public void setHasChildren(boolean hasChildren)
    • hasChildren

      public boolean hasChildren()
      Description copied from interface: MCRCategory
      Tells if this category has subcategories.
      Specified by:
      hasChildren in interface MCRCategory
      Returns:
      true if this category has subcategories
      See Also:
    • getChildren

      public List<MCRCategory> getChildren()
      Description copied from interface: MCRCategory
      Returns a list of subcategories. Implementors must never return null if no children are present. As this method may need a new call the underlaying persistence layer use hasChildren() if you just want to know if subcategories are present. Changes to the list may not affect the underlaying persistence layer.
      Specified by:
      getChildren in interface MCRCategory
      Returns:
      subcategories
      See Also:
    • getPositionInParent

      public int getPositionInParent()
    • setPositionInParent

      public void setPositionInParent(int positionInParent)
    • getId

      public MCRCategoryID getId()
      Specified by:
      getId in interface MCRCategory
      Returns:
      the id
    • getLabels

      public SortedSet<MCRLabel> getLabels()
      Specified by:
      getLabels in interface MCRCategory
      Returns:
      the labels
    • getRoot

      public MCRCategory getRoot()
      Description copied from interface: MCRCategory
      Returns root category (the classification).
      Specified by:
      getRoot in interface MCRCategory
      Returns:
      the root category
    • getURI

      public URI getURI()
      Description copied from interface: MCRCategory
      Returns the URI associated with this category.
      Specified by:
      getURI in interface MCRCategory
      Returns:
      the URI
    • setId

      public void setId(MCRCategoryID id)
      Specified by:
      setId in interface MCRCategory
      Parameters:
      id - the id to set
    • setURI

      public void setURI(URI uri)
      Specified by:
      setURI in interface MCRCategory
      Parameters:
      uri - the URI to set
    • getParent

      public MCRCategory getParent()
      Description copied from interface: MCRCategory
      Returns the parent element
      Specified by:
      getParent in interface MCRCategory
      Returns:
      the categories parent or null if isClassification()==true or category currently not attached
    • getCurrentLabel

      public Optional<MCRLabel> getCurrentLabel()
      Specified by:
      getCurrentLabel in interface MCRCategory
      Returns:
      the label in the current language (if available), default language (if available), any language in MCR.Metadata.Languages(if available), any other language that does not start with x- or any other language
    • setLabels

      public void setLabels(SortedSet<MCRLabel> labels)
    • getLabel

      public Optional<MCRLabel> getLabel(String lang)
      Specified by:
      getLabel in interface MCRCategory
      Returns:
      the label in the specified language (if available) or null
    • setParentID

      public void setParentID(MCRCategoryID parentID)
    • getParentID

      public MCRCategoryID getParentID()
    • isClassification

      public boolean isClassification()
      Specified by:
      isClassification in interface MCRCategory
      Returns:
      true if this is a root category
    • isCategory

      public boolean isCategory()
      Specified by:
      isCategory in interface MCRCategory
      Returns:
      true if this is not a root category
      See Also:
    • asMCRImpl

      public MCRCategoryImpl asMCRImpl()