com.jalios.jcms
Class Category

java.lang.Object
  extended by com.jalios.jstore.BasicStorable
      extended by com.jalios.jcms.Data
          extended by com.jalios.jcms.Category
All Implemented Interfaces:
DBConstants, EditableData, JcmsConstants, ImportConstants, MashupConstants, Searchable, Storable, JaliosConstants, TreeNode, Cloneable, Comparable<BasicStorable>

public class Category
extends Data
implements EditableData, TreeNode, Searchable, DBConstants

A Category object is a node of the category tree. It references a set of Publications.

Version:
$Revision: 33922 $
Author:
Olivier Dedieu

Nested Class Summary
static class Category.AuthorizedSelector
          AuthorizedSelector selects all the categories a member is authorized to read.
static class Category.DeepOrderComparator
           
static class Category.LeafSelector
           
static class Category.NameComparator
           
static class Category.NameSelector
          Select categories by their name.
static class Category.NodeSelector
           
static class Category.OrderChildrenFirstComparator
           
static class Category.OrderChildrenLastComparator
           
static class Category.OrderComparator
           
 
Nested classes/interfaces inherited from class com.jalios.jcms.Data
Data.AuthorComparator<T extends Data>, Data.AuthorSelector, Data.CdateSelector, Data.DataNameComparator<T extends Data>, Data.DeletableSelector, Data.ImportSelector, Data.MdateSelector, Data.OpAuthorComparator<T extends Data>, Data.RowIdComparator<T extends Data>, Data.StrongLockSelector
 
Nested classes/interfaces inherited from class com.jalios.jstore.BasicStorable
BasicStorable.CdateComparator<T extends Storable>, BasicStorable.IdComparator<T extends Storable>, BasicStorable.MdateComparator<T extends Storable>
 
Field Summary
static int ALPHABETICAL_ORDER
           
protected  TreeSet<Group> authorizedGroupSet
           
protected  TreeSet<Member> authorizedMemberSet
           
protected  int childrenOrder
           
protected  String color
           
static int CTRL_TOPIC_ADVANCED
           
static int CTRL_TOPIC_PARENT
           
static String CTXT_SKIP_PUBLICATIONS
           
static String CTXT_SKIP_WORKSPACE
           
static int CUSTOM_ORDER
           
protected  String description
           
protected  HashMap<String,String> descriptionML
           
static String EXPORT_CAT_SEPARATOR
           
protected  TreeSet<String> friendlyURLSet
           
protected  String icon
           
protected  HashMap<String,String> iconML
           
protected  String image
           
protected  HashMap<String,String> imageML
           
protected  boolean isExclusive
           
protected  boolean isSelectable
           
protected  String name
           
protected  HashMap<String,String> nameML
           
protected  int order
           
protected  Category parent
           
static String REVISION
           
protected  String[] synonyms
           
protected  String typeReferrer
           
protected  int typeReferrerCount
           
 
Fields inherited from class com.jalios.jcms.Data
author, authorDBID, channel, DISPLAY_URL_EXTRA_INFO, extension, extraDataMap, extraDBDataMapToSaveOnOp, importMap, opAuthor, opDelegate
 
Fields inherited from class com.jalios.jstore.BasicStorable
cdate, ddate, id, mdate, store
 
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_WORKSPACE_ID, MDATE_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKSPACE_ID_FIELD
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Fields inherited from interface com.jalios.jcms.mashup.ImportConstants
IMPORT_ALARM_MGR, IMPORT_AUTHOR_PROP, IMPORT_CATEGORY_DEFAULT, IMPORT_DC_ATTR, IMPORT_DC_STEP, IMPORT_DIR, IMPORT_ENABLED, IMPORT_JDOM_ELEMENT, IMPORT_LOG_FILE, IMPORT_LOG_MAX, IMPORT_OPTIONS, IMPORT_OPTIONS_DC_CONTEXT, IMPORT_ROOT_PROP, IMPORT_SOURCE_FILE, IMPORT_SOURCE_PREFIX_PROP, IMPORT_SOURCES_DIR, IMPORT_STEP_CLEAN, IMPORT_STEP_IMPORT, IMPORT_STEP_UPDATE_REF, IMPORT_WS_PROP
 
Fields inherited from interface com.jalios.jcms.mashup.MashupConstants
DATA_TAG, DATASET_TAG, FIELD_CLASS, FIELD_ENTRY, FIELD_ITEM, FIELD_KEY, FIELD_NAME, FIELD_TAG, FIELD_VALUE, FILE_FIELD, FILE_ID, FILE_MTIME, FILE_SIZE, FILE_TAG, FILE_TICKET, FILESET_TAG, RELATED_TAG
 
Constructor Summary
Category()
          Create a new empty Category (no parent, no name, no description, no children, no synonyms, etc).
Category(Category other)
          Category constructor by copy.
 
Method Summary
 void addAuthorizedGroup(Group grp)
          Add an authorized group
 void addAuthorizedMember(Member mbr)
          Add an authorized member.
 boolean canBeReadBy(Group group, boolean checkAncestors)
          Checks if a group can read this category.
 boolean canBeReadBy(Member member)
          This convenient method is the same that canBeReadBy(member, true, true).
 boolean canBeReadBy(Member member, boolean searchInGroups, boolean checkAncestors)
          Check if a member can read this category.
 boolean canBeUsedBy(Member member)
          Dual method of Member.canUseCategory(Category)
 ControllerStatus checkDelete(Member mbr, Map context)
          Checks if the deletion can be performed
 ControllerStatus checkIntegrity()
          Checks whether or not data integrity constraints are respected.
 ControllerStatus checkMember(int op, Member mbr, Map context)
          Checks if the given member can perform the given operation.
 boolean checkName(Category parent)
          Return true if another category exists with same name under the given parent
 ControllerStatus checkUpdate(Member mbr, Map context)
          Checks if the update can be performed
 boolean childExist(String name)
          Check if this category contains a child with the given name
 boolean containsDescendant(Category category)
          Test if a category is a descendant of this category (this method is equivalent to invoke category.hasAncestor(this))
 boolean containsUnreadPub(Member member)
          Check if this category (and all its sub-categories) contains at least one tracked publication which has not been read by the given member
 void exportXmlField(StringBuffer sb, int indentLevel)
          Fills the given StringBuffer with Xml export of fields of this data.
protected  void exportXmlRelated(StringBuffer sb, String related, int indentLevel)
           
 Set<Content> getAllContentSet()
          Return a set containing all the contents referenced by this category and all the descendant of this category
 Set<Content> getAllContentSet(boolean searchInDB)
          Return a set containing all the contents referenced by this category and all the descendant of this category
 Set<Publication> getAllPublicationSet()
          Return a set containing all the publications referenced by this category and all the descendants of this category
 Set<Publication> getAllPublicationSet(boolean searchInDB)
          Return a set containing all the publications referenced by this category and all the descendants of this category
 List<Category> getAncestorList()
          Returns the list of all the ancestors of this category, from the immediate parent to the root (root excluded).
 List<Category> getAncestorList(Category ancestor, boolean includeAncestor)
          Returns the list of all the ancestors of this category, from the immediate parent to the given ancestor.
 String getAncestorString(Category ancestor, String sep, boolean includeCat)
          Returns a String representation of the ancestor of this category, truncated according the given ancestor (eg if ancestor String is First Level > Second Level > Category Name, and given ancestor is First Level, it returns Second Level > Category Name).
 String getAncestorString(Category ancestor, String sep, boolean includeCat, String lang)
          Returns a String representation of the ancestor of this category, truncated according the given ancestor (eg if ancestor String is First Level > Second Level > Category Name, and given ancestor is First Level, it returns Second Level > Category Name).
 String getAncestorString(String sep, boolean includeCat)
          Returns a String representation of the ancestor of this category (eg First Level > Second Level > Category Name).
 String getAncestorString(String sep, boolean includeCat, String lang)
          Returns a String representation of the ancestor of this category (eg First Level > Second Level > Category Name).
 Set<Group> getAuthorizedGroupSet()
          Get the value of authorizedGroupSet.
 Set<Member> getAuthorizedMemberSet()
          Get the value of authorizedMemberSet.
static Category.AuthorizedSelector getAuthorizedSelector(Member member)
           
 String getAvailableColor()
          Find the first available color from this category to these ancestors.
 String getAvailableColor(int levelOffset)
          Find the first available color from this category to these ancestors and apply a color offset corresponding to the sub-level of this cateogy.
 Category getChild(String name)
          Return the child of this category with the given name
 int getChildrenOrder()
          Retrieves the current ordering type in use for children of this Category.
 Set<Category> getChildrenSet()
          Returns the children categories (ie categories having this category as parent)
 String getColor()
          Get the value of color.
 Set<Content> getContentSet()
          Returns the contents which use this category
 Set<Content> getContentSet(boolean searchInDB)
          Returns the contents which use this category
static String getCSVHeader(String lang)
          Returns the CSV header of this object
 String getDataImage()
          Retrieves the image path of this data in the channel's main language.
 String getDataImage(String lang, boolean useDefault)
          Retrieves the image path of this data.
 String getDataName(String language)
          Return the name of this Data, every sub class Data which will be displayed to user should implements this method already.
<T extends Publication>
int
getDBPublicationCount()
          Count the number of DB publications which belongs to this category (exact mode).
<T extends Publication>
int
getDBPublicationCount(Class<T> clazz, boolean exactCat)
          Count the number of DB publication which belongs to this category.
static Comparator<Category> getDeepOrderComparator()
          Deprecated. use getDeepOrderComparator(String) instead.
static Comparator<Category> getDeepOrderComparator(String lang)
           
 Set<Category> getDescendantSet()
          Returns all the descendant categories of this one (ie categories having this category as ancestor)
 String getDescription()
          Get the value of description.
 String getDescription(String lang)
          Get the value of description bound to the given language.
 String getDescription(String lang, boolean useDefault)
          Get the value of description bound to the given language.
 HashMap<String,String> getDescriptionML()
          Get the value of descriptionML.
 String getExportXmlDataValue()
          Returns a string representation of this data used by exportXml().
 Category getFirstCommonAncestor(Category category)
          Returns the first common ancestor (FCA) with a given category.
static Category getFirstCommonAncestor(Collection<Category> collection)
          Returns the common ancestors of the given categories
static Category getFirstNotRelatives(Set<Category> children, Set<Category> roots)
          Check if one category of the set not relatives to an other category.
static Category[] getFirstRelatives(Set<Category> rootSet)
          Check if one category of the set is relatives to an other category.
 TreeSet<String> getFriendlyURLSet()
          Get friendly urls Set.
static TreeSet<Category> getHighestLevelCategorySet(TreeSet<Category> categorySet)
          Keeps only the categories of highest level
 String getIcon()
          Get the value of icon.
 String getIcon(String lang)
          Get the value of icon bound to the given language.
 String getIcon(String lang, boolean useDefault)
          Get the value of icon bound to the given language.
 HashMap<String,String> getIconML()
          Get the value of iconML.
 String getImage()
          Get the value of image.
 String getImage(String lang)
          Get the value of image bound to the given language.
 String getImage(String lang, boolean useDefault)
          Get the value of image bound to the given language.
 HashMap<String,String> getImageML()
          Get the value of imageML.
 Date getIndexingDate()
          Retrieve the Date at which this Category was indexed in its search engine.
static Category.LeafSelector getLeafSelector()
           
 String getName()
          Get the value of name.
 String getName(String lang)
          Get the value of name bound to the given language.
 String getName(String lang, boolean useDefault)
          Get the value of name bound to the given language.
static Comparator getNameComparator(String lang)
          Retrieves a new Categories' NameComparator.
 HashMap<String,String> getNameML()
          Get the value of nameML.
static Category.NodeSelector getNodeSelector()
           
 int getOrder()
           
static Comparator<Category> getOrderChildrenFirstComparator()
           
static Comparator<Category> getOrderChildrenLastComparator()
           
static Comparator getOrderComparator(String lang)
          Retrieves a new Categories' OrderComparator.
 Category getParent()
          Get the value of parent.
 Set<Publication> getPublicationSet()
          Returns the publications which use this category
 Set<Publication> getPublicationSet(boolean searchInDB)
          Returns the publications which use this category
<T extends Publication>
Set<T>
getPublicationSet(Class<T> clazz)
          Returns a NEW Set of Publication of the given class which use this category.
<T extends Publication>
Set<T>
getPublicationSet(Class<T> clazz, Member mbr)
          Returns a NEW Set of Publication of the given class which use this category.
static Set<Category> getReadableCatSet(Set<Category> catSet, Member mbr)
          Returns a category subset the given member can read
 String getReadRightsString(int max)
          This convenient method returns a String displaying group/member read rights (eg if this category is restricted to g1, g2, m1, m2 and m3, getReadRightsString(3) will return "g1, g2, m1, ...")
 String[] getSearchStrings()
          This method gets called to get all the String to search in (typically the String attribute of the Storable).
 String[] getSynonyms()
          Get the value of synonyms.
 Collection<? extends TreeNode> getTreeChildren()
          Returns a Collection of TreeNode children of the current node
 TreeNode getTreeParent()
          Returns parent of the current node
 TreeNode getTreeRoot()
          Returns the root of the current node
 int getTypeReferrerCount()
          Returns the number of type referencing this category (through category fields and default categories).
 Set<WSTypeEntry> getWSTypeEntryReferrerSet()
          Returns a set of WSTypeEntry referencing this category.
 boolean hasAncestor(Category category)
          Test if a category is an ancestor of this category (it returns false if the received category is this category).
 boolean hasAnyReadRights()
          Tests if this category has member or group read rights.
 boolean hasNoReadRights()
          Tests if this category has NO member read rights AND NO group read rights.
protected  boolean internalCanBeReadBy(Group group)
          Check of this category can be read by the given group
protected  boolean internalCanBeReadBy(Member member, boolean searchInGroups)
          Check of this category can be read by the given member
 boolean isAlphabeticalOrder()
           
 boolean isCustomOrder()
           
 boolean isExclusive()
           
 boolean isLeaf()
          Returns true if this category is a leaf, that is if it has no child.
 boolean isLeaf(Member mbr)
          Returns true if this category is a leaf according the given member and the category read right, that is if this category has no child readable for the given member.
 boolean isNode()
          Returns true if this category is a node, that is if it has at least one child.
 boolean isNode(Member mbr)
          Returns true if this category is a node according the given member and the category read right, that is if this category has at least one child readable for the given member.
 boolean isRoot()
          Returns true if this category is the root category.
 boolean isSelectable()
           
 boolean isSibling(Category cat)
          Returns true if the given category is a sibling of this category.
 boolean isTerminalNode()
          Returns true if this category is a terminal node, that is if it has only leaf children
 boolean isTreeLeaf()
          Returns boolean true if the TreeNode is a leaf
 boolean isTreeNode()
          Returns boolean true if the TreeNode is a node
 ControllerStatus mergeWith(Category tgtCat, Member loggedMember)
          Merges this category with the given the category.
 String nameExists(Category parent)
          Check if another category exists with the same name under a given parent (skip this category).
protected  void performAfterWrite(int op, Member mbr, Map context)
          Called to perform some action after the write.
protected  void performBeforeWrite(int op, Member mbr, Map context)
          Called to perform some action before the write.
 void performDeepCopy(Member mbr, Map context)
          Performs category deep copy
 void performDelete(Member mbr, Map context)
          Performs data deletion
 ControllerStatus performImport(Member mbr, File file, String languages, String encoding)
          Parse and imports categories from the given file under this category.
 void refreshTypeReferrerCount()
          Refresh type referrer count.
 boolean removeAuthorizedGroup(Group grp)
          Remove an authorized group.
 boolean removeAuthorizedMember(Member mbr)
          Remove an authorized member.
 void setAuthorizedGroupSet(TreeSet<Group> v)
          Set the value of authorizedGroupSet.
 void setAuthorizedMemberSet(TreeSet<Member> v)
          Set the value of authorizedMemberSet.
 void setChildrenOrder(int childrenOrder)
          Define the children ordering to be used in this category
 void setColor(String v)
          Set the value of color.
 void setDescription(String v)
          Set the value of description.
 void setDescription(String lang, String value)
          Convenient method to set the value of the Description field in any language (default site language or any other).
This method will set the proper field value (setDescription(String) or setDescriptionML(HashMap)) depending on the specified language.
 void setDescriptionML(HashMap<String,String> v)
          Set the value of descriptionML.
 void setExclusive(boolean isExclusive)
           
 void setFriendlyURLSet(TreeSet<String> v)
          Set the value of friendlyURLSet.
 void setIcon(String v)
          Set the value of icon.
 void setIcon(String lang, String value)
          Convenient method to set the value of the Icon field in any language (default site language or any other).
This method will set the proper field value (setIcon(String) or setIconML(HashMap)) depending on the specified language.
 void setIconML(HashMap<String,String> v)
          Set the value of iconML.
 void setImage(String v)
          Set the value of image.
 void setImage(String lang, String value)
          Convenient method to set the value of the Image field in any language (default site language or any other).
This method will set the proper field value (setImage(String) or setImageML(HashMap)) depending on the specified language.
 void setImageML(HashMap<String,String> v)
          Set the value of imageML.
 void setName(String v)
          Set the value of name.
 void setName(String lang, String value)
          Convenient method to set the value of the Name field in any language (default site language or any other).
This method will set the proper field value (setName(String) or setNameML(HashMap)) depending on the specified language.
 void setNameML(HashMap<String,String> v)
          Set the value of nameML.
 void setOrder(int order)
           
 void setParent(Category v)
          Set the value of parent.
 void setSelectable(boolean isSelectable)
           
 void setSynonyms(String[] v)
          Set the value of synonyms.
 String toCSV(String lang)
          Returns a CSV view of this object
 String toFullString()
           
 String toString()
           
 void updateAllPublicationSet()
          Recompute the allPublicationSet/allContentSet and all the descendant's allPublicationSet/allContentSet .
protected  void updateDBPublicationIndexes()
          Update publication allCatIdSet in this Category and its childrens when the Category parent is changed Warning : as of current implementation, this method will query the database and may not be optimized for frequent use and large volumetry, use wisely.
 
Methods inherited from class com.jalios.jcms.Data
canRequestLock, checkCreate, checkCreate, checkDelete, checkIntegrity, checkLockMember, checkStrongLockMember, checkUpdate, checkWrite, clone, computeDBIDArray, exportXml, exportXml, exportXml, exportXml, exportXmlRelated, fillExportXmlFieldAttributes, getAllReferrerSet, getAllReferrerSet, getAllTypeFieldEntry, getAuthor, getAuthor, getAuthorComparator, getAuthorDBID, getAuthorId, getAuthorSelector, getBooleanFieldValue, getBooleanFieldValue, getCaddyComparator, getCategoryFieldValue, getCategoryFieldValue, getCdateSelector, getComparator, getDataImage, getDataNameComparator, getDate, getDate, getDateSelector, getDeletableSelector, getDisplayLink, getDisplayLink, getDisplayUrl, getDoubleFieldValue, getDoubleFieldValue, getExtension, getExtraData, getExtraDataMap, getExtraDBData, getExtraDBDataMap, getExtraInfo, getExtraInfoMap, getFieldStatusMap, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getGenericThumbnail, getImportAuthor, getImportBatch, getImportDate, getImportDisplayUrl, getImportId, getImportMap, getImportMdate, getImportSelector, getImportSignature, getImportSource, getImportSourceUrl, getImportUrl, getIntFieldValue, getIntFieldValue, getLinkCount, getLinkIndexedDataSet, getLinkIndexedDataSet, getLockDate, getLockInfo, getLockMember, getLongFieldValue, getLongFieldValue, getMdateSelector, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getNewDefaultExtraDBDataMap, getOpAuthor, getOpAuthorComparator, getOpDelegate, getRowId, getRowIdComparator, getStrongLock, getStrongLockDate, getStrongLockInfo, getStrongLockMember, getStrongLockSelector, getTypeEntry, getTypeFieldsEntries, getUpdateInstance, hashCode, importXml, importXmlFieldsWithReferences, importXmlFiles, importXmlReferences, initializeDBDataCollections, isDBData, isImported, isImportUpdated, isInDatabase, isLocked, isPersisted, isStrongLocked, lock, markNewImport, mergeHybridLink, performCreate, performCreate, performDelete, performUpdate, performUpdate, prepareUpdateContext, printDataName, printDisplayLinkEnd, printDisplayLinkStart, printDisplayUrl, putStrongLock, releaseStrongLock, releaseStrongLock, removeExtraData, removeExtraDBData, removeExtraInfo, setAuthor, setAuthorDBID, setAuthorId, setBooleanFieldValue, setCategoryFieldValue, setDoubleFieldValue, setExtension, setExtraData, setExtraDataMap, setExtraDBData, setExtraDBDataMap, setExtraDBDataMap, setExtraInfo, setFieldValue, setFieldValue, setImportAuthor, setImportBatch, setImportDate, setImportDisplayUrl, setImportId, setImportMap, setImportMdate, setImportSignature, setImportSource, setImportSourceUrl, setImportUpdated, setIntFieldValue, setLongFieldValue, setMdate, setOpAuthor, setOpDelegate, setRowId, unlock, unlock, unmarkNewImport, updateExtraDataMap, updateExtraDBDataMap, updateIndexTreeSet
 
Methods inherited from class com.jalios.jstore.BasicStorable
clearId, compareTo, equals, getAttribute, getAttributes, getCdate, getCdateComparator, getDdate, getId, getIdComparator, getMdate, getMdateComparator, getStore, getUrid, hasBeenUpdated, isStored, resolveAtt, resolveVal, setAttributes, setCdate, setDdate, setId, setStore, toXml
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

ALPHABETICAL_ORDER

public static final int ALPHABETICAL_ORDER
See Also:
Constant Field Values

CUSTOM_ORDER

public static final int CUSTOM_ORDER
See Also:
Constant Field Values

CTXT_SKIP_WORKSPACE

public static final String CTXT_SKIP_WORKSPACE
See Also:
Constant Field Values

CTXT_SKIP_PUBLICATIONS

public static final String CTXT_SKIP_PUBLICATIONS
See Also:
Constant Field Values

CTRL_TOPIC_PARENT

public static final int CTRL_TOPIC_PARENT
See Also:
Constant Field Values

CTRL_TOPIC_ADVANCED

public static final int CTRL_TOPIC_ADVANCED
See Also:
Constant Field Values

EXPORT_CAT_SEPARATOR

public static final String EXPORT_CAT_SEPARATOR
See Also:
Constant Field Values

name

protected String name

nameML

protected HashMap<String,String> nameML

parent

protected Category parent

description

protected String description

descriptionML

protected HashMap<String,String> descriptionML

synonyms

protected String[] synonyms

isExclusive

protected boolean isExclusive

isSelectable

protected boolean isSelectable

order

protected int order

childrenOrder

protected int childrenOrder

icon

protected String icon

iconML

protected HashMap<String,String> iconML

image

protected String image

imageML

protected HashMap<String,String> imageML

color

protected String color

friendlyURLSet

protected TreeSet<String> friendlyURLSet

authorizedMemberSet

protected TreeSet<Member> authorizedMemberSet

authorizedGroupSet

protected TreeSet<Group> authorizedGroupSet

typeReferrerCount

protected transient int typeReferrerCount

typeReferrer

protected transient String typeReferrer
Constructor Detail

Category

public Category()
Create a new empty Category (no parent, no name, no description, no children, no synonyms, etc).


Category

public Category(Category other)
Category constructor by copy.

Use this constructor to create a new Category or copy an existing one.
The newly created Category will have the same value for most of (but not all!) fields of the specified Category.

Important : DO NOT use this constructor to UPDATE Category !, instead use the getUpdateInstance() method. (This constructor by copy does not copy all fields, for example the friendly URLs of the specified category will not be copied into the new Category).

Parameters:
other -
Method Detail

toString

public String toString()
Overrides:
toString in class Data

toFullString

public String toFullString()
Overrides:
toFullString in class Data

toCSV

public String toCSV(String lang)
Returns a CSV view of this object

Overrides:
toCSV in class Data
Parameters:
lang - the output language
Returns:
a CSV view of this object
Since:
jcms-5.0.0

getCSVHeader

public static String getCSVHeader(String lang)
Returns the CSV header of this object

Parameters:
lang - the output language
Returns:
the CSV header of this object
Since:
jcms-5.0.0

getExportXmlDataValue

public String getExportXmlDataValue()
Description copied from class: Data
Returns a string representation of this data used by exportXml().

Overrides:
getExportXmlDataValue in class Data
Returns:
a string representation of this data used by exportXml().

exportXmlField

public void exportXmlField(StringBuffer sb,
                           int indentLevel)
Description copied from class: Data
Fills the given StringBuffer with Xml export of fields of this data.

Overrides:
exportXmlField in class Data
Parameters:
sb - the StringBuffer
indentLevel - the indent level

getFirstRelatives

public static Category[] getFirstRelatives(Set<Category> rootSet)
Check if one category of the set is relatives to an other category.

Parameters:
rootSet -
Returns:
a Category[2] with the 2 first relatives.

getFirstNotRelatives

public static Category getFirstNotRelatives(Set<Category> children,
                                            Set<Category> roots)
Check if one category of the set not relatives to an other category.

Parameters:
children -
roots -
Returns:
a Category[2] with the 2 first relatives.

getHighestLevelCategorySet

public static TreeSet<Category> getHighestLevelCategorySet(TreeSet<Category> categorySet)
Keeps only the categories of highest level

Parameters:
categorySet -
Returns:
a set of category
Since:
jcms-4.1

containsDescendant

public boolean containsDescendant(Category category)
Test if a category is a descendant of this category (this method is equivalent to invoke category.hasAncestor(this))

Parameters:
category - the category to test
Returns:
true if the category is a descendant of this category

hasAncestor

public boolean hasAncestor(Category category)
Test if a category is an ancestor of this category (it returns false if the received category is this category).

Parameters:
category - the category to test
Returns:
true if the category is an ancestor of this category

getAncestorList

public List<Category> getAncestorList()
Returns the list of all the ancestors of this category, from the immediate parent to the root (root excluded).

Returns:
the list of ancestors

getAncestorList

public List<Category> getAncestorList(Category ancestor,
                                      boolean includeAncestor)
Returns the list of all the ancestors of this category, from the immediate parent to the given ancestor.

Parameters:
ancestor - the ancestor (null means root)
includeAncestor - if true add the ancestor to the list
Returns:
the list of ancestors
Since:
jcms-5.0.0

getAncestorString

public String getAncestorString(String sep,
                                boolean includeCat,
                                String lang)
Returns a String representation of the ancestor of this category (eg First Level > Second Level > Category Name). Root is excluded.

Parameters:
sep - the separator
includeCat - if true, the category is included
lang - the language to use to build the String
Returns:
a String containing the ancestors concatenation.
Since:
jcms-4.0

getAncestorString

public String getAncestorString(String sep,
                                boolean includeCat)
Returns a String representation of the ancestor of this category (eg First Level > Second Level > Category Name). Root is excluded.

Parameters:
sep - the separator
includeCat - if true, the category is included
Returns:
a String containing the ancestors concatenation.
Since:
jcms-3.0

getAncestorString

public String getAncestorString(Category ancestor,
                                String sep,
                                boolean includeCat,
                                String lang)
Returns a String representation of the ancestor of this category, truncated according the given ancestor (eg if ancestor String is First Level > Second Level > Category Name, and given ancestor is First Level, it returns Second Level > Category Name). Root is excluded.

Parameters:
ancestor - the ancestor
sep - the separator
includeCat - if true, the category is included
lang - the language to use to build the String
Returns:
a String containing the ancestors concatenation.
Since:
jcms-4.0

getAncestorString

public String getAncestorString(Category ancestor,
                                String sep,
                                boolean includeCat)
Returns a String representation of the ancestor of this category, truncated according the given ancestor (eg if ancestor String is First Level > Second Level > Category Name, and given ancestor is First Level, it returns Second Level > Category Name). Root is excluded.

Parameters:
ancestor - the ancestor
sep - the separator
includeCat - if true, the category is included
Returns:
a String containing the ancestors concatenation.
Since:
jcms-3.0

isSibling

public boolean isSibling(Category cat)
Returns true if the given category is a sibling of this category. Returns true if the given category is this category.

Parameters:
cat - the category
Returns:
true if the given category is a sibling of this category. Returns true if the given category is this category.
Since:
jcms-6.1.0

getAvailableColor

public String getAvailableColor()
Find the first available color from this category to these ancestors.

Returns:
the first available color from this category to these ancestors (in all the case, return a non null value).
Since:
jcms-5.0.0
See Also:
getAvailableColor(int)

getAvailableColor

public String getAvailableColor(int levelOffset)
Find the first available color from this category to these ancestors and apply a color offset corresponding to the sub-level of this cateogy.

Parameters:
levelOffset - the offset to apply for each level
Returns:
the first available color from this category to these ancestors with the offset applied (in all the case, return a non null value).
Since:
jcms-5.5.0

getFirstCommonAncestor

public Category getFirstCommonAncestor(Category category)
Returns the first common ancestor (FCA) with a given category. The FCA of c1 and c2 is the first category which is an ancestor of c1 and c2.
If (c1 == c2) FCA = c1.parent.
If (c1 ancestor of c2) FCA = c1

Parameters:
category - the category to used when searching the first common ancestor with this category. if null, return value will be null.
Returns:
the first common ancestor Category between this and the specified category, may return null if specified category is null

getFirstCommonAncestor

public static Category getFirstCommonAncestor(Collection<Category> collection)
Returns the common ancestors of the given categories

Parameters:
collection - Collection of Category
Returns:
Category the first common ancestor
Since:
jcms-5.7.3

updateAllPublicationSet

public void updateAllPublicationSet()
Recompute the allPublicationSet/allContentSet and all the descendant's allPublicationSet/allContentSet .


getPublicationSet

public <T extends Publication> Set<T> getPublicationSet(Class<T> clazz,
                                                        Member mbr)
Returns a NEW Set of Publication of the given class which use this category. Behavior of clazz and mbr relies to underlaying behavior of Channel.getPublicationSet(Class, Member) Check rights.

Parameters:
clazz - the Publication's class to retrieve
mbr - the Member requesting publications
Returns:
Set of Publication

getPublicationSet

public <T extends Publication> Set<T> getPublicationSet(Class<T> clazz)
Returns a NEW Set of Publication of the given class which use this category. Behavior of clazz relies to underlaying behavior of Channel.getDataSet(Class). DO NOT check rights.

Parameters:
clazz - the Publication's class to retrieve
Returns:
Set of Publication

getPublicationSet

public Set<Publication> getPublicationSet()
Returns the publications which use this category

Returns:
a TreeSet of Publication

getPublicationSet

public Set<Publication> getPublicationSet(boolean searchInDB)
Returns the publications which use this category

Parameters:
searchInDB - if true the search is extended to the DB
Returns:
a TreeSet of Publication
Since:
jcms-6.2

getAllPublicationSet

public Set<Publication> getAllPublicationSet()
Return a set containing all the publications referenced by this category and all the descendants of this category

Returns:
the publication set

getAllPublicationSet

public Set<Publication> getAllPublicationSet(boolean searchInDB)
Return a set containing all the publications referenced by this category and all the descendants of this category

Parameters:
searchInDB - if true the search is extended to the DB
Returns:
the publication set
Since:
jcms-6.2

getContentSet

public Set<Content> getContentSet()
Returns the contents which use this category

Returns:
a TreeSet of Content
Since:
jcms-4.0

getContentSet

public Set<Content> getContentSet(boolean searchInDB)
Returns the contents which use this category

Parameters:
searchInDB - if true the search is extended to the DB
Returns:
a TreeSet of Content
Since:
jcms-6.2

getAllContentSet

public Set<Content> getAllContentSet()
Return a set containing all the contents referenced by this category and all the descendant of this category

Returns:
the content set
Since:
jcms-4.0

getAllContentSet

public Set<Content> getAllContentSet(boolean searchInDB)
Return a set containing all the contents referenced by this category and all the descendant of this category

Parameters:
searchInDB - if true the search is extended to the DB
Returns:
the content set
Since:
jcms-6.2

getDBPublicationCount

public <T extends Publication> int getDBPublicationCount()
Count the number of DB publications which belongs to this category (exact mode).

Warning : as of current implementation, this method will query the database and may not be optimized for frequent use and large volumetry, use wisely.

Returns:
the count of DB Publications which belongs to this Category (exactMode)
Since:
7.0.2

getDBPublicationCount

public <T extends Publication> int getDBPublicationCount(Class<T> clazz,
                                                         boolean exactCat)
Count the number of DB publication which belongs to this category.

Warning : as of current implementation, this method will query the database and may not be optimized for frequent use and large volumetry, use wisely.

Parameters:
clazz - the class to search for
exactCat - true to search for publication only in this publication, false, to search in descendants categories
Returns:
the count of DB Publications which belongs to this Category
Since:
7.0.2

updateDBPublicationIndexes

protected void updateDBPublicationIndexes()
Update publication allCatIdSet in this Category and its childrens when the Category parent is changed Warning : as of current implementation, this method will query the database and may not be optimized for frequent use and large volumetry, use wisely.

Since:
jcms-7.0.2

mergeWith

public ControllerStatus mergeWith(Category tgtCat,
                                  Member loggedMember)
Merges this category with the given the category. All the children of this category are moved to the given category. All the publications assigned tho this category are moved to the given category. The loggedMember must have the right to manage the 2 categories.

Parameters:
tgtCat - the category to merge with
loggedMember - the member.
Returns:
true if the merge has been done.
Since:
jcms-7.1

isRoot

public boolean isRoot()
Returns true if this category is the root category.

Returns:
true if the category has no child
Since:
jcms-5.0.0

isLeaf

public boolean isLeaf()
Returns true if this category is a leaf, that is if it has no child.

Returns:
true if the category has no child

isNode

public boolean isNode()
Returns true if this category is a node, that is if it has at least one child.

Returns:
true if the category has at least a child.

isLeaf

public boolean isLeaf(Member mbr)
Returns true if this category is a leaf according the given member and the category read right, that is if this category has no child readable for the given member.

Parameters:
mbr - the member to check the read right
Returns:
true if the category has no child
Since:
jcms-4.1

isNode

public boolean isNode(Member mbr)
Returns true if this category is a node according the given member and the category read right, that is if this category has at least one child readable for the given member.

Parameters:
mbr - the member to check the read right
Returns:
true if the category has at least a child.
Since:
jcms-4.1

isTerminalNode

public boolean isTerminalNode()
Returns true if this category is a terminal node, that is if it has only leaf children

Returns:
true if the category has only lead children
Since:
jcms-3.0

isAlphabeticalOrder

public boolean isAlphabeticalOrder()
Returns:
true if children of this category are alphabically ordered
Since:
jcms-3.0

isCustomOrder

public boolean isCustomOrder()
Returns:
true if children of this category are custom ordered
Since:
jcms-3.0

getChildrenSet

public Set<Category> getChildrenSet()
Returns the children categories (ie categories having this category as parent)

Returns:
a TreeSet of category

getDescendantSet

public Set<Category> getDescendantSet()
Returns all the descendant categories of this one (ie categories having this category as ancestor)

Returns:
a TreeSet of category
Since:
jcms-3.0

childExist

public boolean childExist(String name)
Check if this category contains a child with the given name

Parameters:
name - the category name to search
Returns:
true if there exists at least one child with the given name
Since:
jcms-4.0

getChild

public Category getChild(String name)
Return the child of this category with the given name

Parameters:
name - the category name to search
Returns:
the child or null if not found
Since:
jcms-4.0

containsUnreadPub

public boolean containsUnreadPub(Member member)
Check if this category (and all its sub-categories) contains at least one tracked publication which has not been read by the given member

Parameters:
member - the reader
Returns:
true if there exists at least one unread publication
Since:
jcms-4.1

getSearchStrings

public String[] getSearchStrings()
Description copied from interface: Searchable
This method gets called to get all the String to search in (typically the String attribute of the Storable). If one of those String match the query, this Storable is added in the result set.

Specified by:
getSearchStrings in interface Searchable
Returns:
an array of String corresponding to this object.

getDataName

public String getDataName(String language)
Description copied from class: Data
Return the name of this Data, every sub class Data which will be displayed to user should implements this method already.
Can be seen as a smart multi-language toString(), but never returning null.
Default behaviour is to return toFullString() of Data or empty string if toFullString is null.

Overrides:
getDataName in class Data
Parameters:
language - the language in which to return the name if multilang available for the data.
Returns:
name of Category in given language or empty String if not specified.
Since:
jcms-5.1
See Also:
getName(String), Data.getDataName(String)

getDataImage

public String getDataImage()
Description copied from class: Data
Retrieves the image path of this data in the channel's main language.

This method can (should) be implemented by subclasses to provide an image/illustration of this Data.
Default behaviour is to return empty string.

Overrides:
getDataImage in class Data
Returns:
a path relative to the webapp root.

getDataImage

public String getDataImage(String lang,
                           boolean useDefault)
Description copied from class: Data
Retrieves the image path of this data.

This method can (should) be implemented by subclasses to provide an image/illustration of this Data.
Default behaviour is to return empty string.

Overrides:
getDataImage in class Data
Parameters:
lang - the user language (ISO-639 language code)
useDefault - should the default language be used if no value is found for the specified language
Returns:
a path relative to the webapp root.

getName

public String getName(String lang)
Get the value of name bound to the given language.

Parameters:
lang - the language to get the name
Returns:
name in the given language.
Since:
jcms-4.0

getName

public String getName(String lang,
                      boolean useDefault)
Get the value of name bound to the given language.

Parameters:
lang - the language to get the name
useDefault - should main language used as default language if name does not exist in the given language
Returns:
name in the given language.
Since:
jcms-4.0

getName

public String getName()
Get the value of name.

Returns:
Value of name.

setName

public void setName(String v)
Set the value of name.

Parameters:
v - Value to assign to v.

getNameML

public HashMap<String,String> getNameML()
Get the value of nameML.

Returns:
Value of nameML.
Since:
jcms-4.0

setNameML

public void setNameML(HashMap<String,String> v)
Set the value of nameML.

Parameters:
v - Value to assign to nameML.
Since:
jcms-4.0

setName

public void setName(String lang,
                    String value)
Convenient method to set the value of the Name field in any language (default site language or any other).
This method will set the proper field value (setName(String) or setNameML(HashMap)) depending on the specified language.

Parameters:
lang - the language (ISO 639 code) in which to set the value
value - the value to set.
Since:
jcms-5.7
See Also:
setName(String), setNameML(HashMap)

getParent

public Category getParent()
Get the value of parent.

Returns:
Value of parent.

setParent

public void setParent(Category v)
Set the value of parent.

Parameters:
v - Value to assign to parent.

getDescription

public String getDescription(String lang)
Get the value of description bound to the given language.

Parameters:
lang - the language to get the description
Returns:
description in the given language.
Since:
jcms-4.0

getDescription

public String getDescription(String lang,
                             boolean useDefault)
Get the value of description bound to the given language.

Parameters:
lang - the language to get the description
useDefault - should main language used as default language if description does not exist in the given language
Returns:
description in the given language.
Since:
jcms-4.0

getDescription

public String getDescription()
Get the value of description.

Returns:
Value of description.

setDescription

public void setDescription(String v)
Set the value of description.

Parameters:
v - Value to assign to description.

getDescriptionML

public HashMap<String,String> getDescriptionML()
Get the value of descriptionML.

Returns:
Value of descriptionML.
Since:
jcms-4.0

setDescriptionML

public void setDescriptionML(HashMap<String,String> v)
Set the value of descriptionML.

Parameters:
v - Value to assign to descriptionML.
Since:
jcms-4.0

setDescription

public void setDescription(String lang,
                           String value)
Convenient method to set the value of the Description field in any language (default site language or any other).
This method will set the proper field value (setDescription(String) or setDescriptionML(HashMap)) depending on the specified language.

Parameters:
lang - the language (ISO 639 code) in which to set the value
value - the value to set.
Since:
jcms-5.7
See Also:
setDescription(String), setDescriptionML(HashMap)

getSynonyms

public String[] getSynonyms()
Get the value of synonyms.

Returns:
Value of synonyms.
Since:
jcms-4.0

setSynonyms

public void setSynonyms(String[] v)
Set the value of synonyms.

Parameters:
v - Value to assign to synonyms.
Since:
jcms-4.0

setExclusive

public void setExclusive(boolean isExclusive)

isExclusive

public boolean isExclusive()

setSelectable

public void setSelectable(boolean isSelectable)

isSelectable

public boolean isSelectable()

setOrder

public void setOrder(int order)

getOrder

public int getOrder()

setChildrenOrder

public void setChildrenOrder(int childrenOrder)
Define the children ordering to be used in this category

Parameters:
childrenOrder - an integer indicating the ordering type to be used. For alphabetical ordering, use constant Category.ALPHABETICAL_ORDER, for custom ordering (using "order" member), use constant Category.CUSTOM_ORDER
Since:
jcms-3.0

getChildrenOrder

public int getChildrenOrder()
Retrieves the current ordering type in use for children of this Category.

Returns:
the ordering type in use, Category.ALPHABETICAL_ORDER (0) for alphabetical ordering and Category.CUSTOM_ORDER (1) for custom ordering using order member
Since:
jcms-3.0

getIcon

public String getIcon(String lang)
Get the value of icon bound to the given language.

Parameters:
lang - the language to get the icon
Returns:
icon in the given language.
Since:
jcms-4.0

getIcon

public String getIcon(String lang,
                      boolean useDefault)
Get the value of icon bound to the given language.

Parameters:
lang - the language to get the icon
useDefault - should main language used as default language if icon does not exist in the given language
Returns:
icon in the given language.
Since:
jcms-4.0

getIcon

public String getIcon()
Get the value of icon.

Returns:
Value of icon.

setIcon

public void setIcon(String v)
Set the value of icon.

Parameters:
v - Value to assign to icon.

getIconML

public HashMap<String,String> getIconML()
Get the value of iconML.

Returns:
Value of iconML.
Since:
jcms-4.0

setIconML

public void setIconML(HashMap<String,String> v)
Set the value of iconML.

Parameters:
v - Value to assign to iconML.
Since:
jcms-4.0

setIcon

public void setIcon(String lang,
                    String value)
Convenient method to set the value of the Icon field in any language (default site language or any other).
This method will set the proper field value (setIcon(String) or setIconML(HashMap)) depending on the specified language.

Parameters:
lang - the language (ISO 639 code) in which to set the value
value - the value to set.
Since:
jcms-5.7
See Also:
setIcon(String), setIconML(HashMap)

getImage

public String getImage(String lang)
Get the value of image bound to the given language.

Parameters:
lang - the language to get the image
Returns:
image in the given language.
Since:
jcms-4.0

getImage

public String getImage(String lang,
                       boolean useDefault)
Get the value of image bound to the given language.

Parameters:
lang - the language to get the image
useDefault - should main language used as default language if image does not exist in the given language
Returns:
image in the given language.
Since:
jcms-4.0

getImage

public String getImage()
Get the value of image.

Returns:
Value of image.

setImage

public void setImage(String v)
Set the value of image.

Parameters:
v - Value to assign to image.

getImageML

public HashMap<String,String> getImageML()
Get the value of imageML.

Returns:
Value of imageML.
Since:
jcms-4.0

setImageML

public void setImageML(HashMap<String,String> v)
Set the value of imageML.

Parameters:
v - Value to assign to imageML.
Since:
jcms-4.0

setImage

public void setImage(String lang,
                     String value)
Convenient method to set the value of the Image field in any language (default site language or any other).
This method will set the proper field value (setImage(String) or setImageML(HashMap)) depending on the specified language.

Parameters:
lang - the language (ISO 639 code) in which to set the value
value - the value to set.
Since:
jcms-5.7
See Also:
setImage(String), setImageML(HashMap)

getColor

public String getColor()
Get the value of color.

Returns:
Value of color.
Since:
jcms-5.0.0

setColor

public void setColor(String v)
Set the value of color.

Parameters:
v - Value to assign to color.
Since:
jcms-5.0.0

getIndexingDate

public Date getIndexingDate()
Retrieve the Date at which this Category was indexed in its search engine.

Returns:
a Date or null if was not indexed.
Since:
jcms-6.0.1

getFriendlyURLSet

public TreeSet<String> getFriendlyURLSet()
Get friendly urls Set.

Returns:
a TreeSet of friendly url (String).

setFriendlyURLSet

public void setFriendlyURLSet(TreeSet<String> v)
Set the value of friendlyURLSet.

Parameters:
v - Value to assign to friendlyURLSet.

getNameComparator

public static Comparator getNameComparator(String lang)
Retrieves a new Categories' NameComparator.

Parameters:
lang - the language in which to compare categorie's name
Returns:
a new instance of NameComparator in the specified language.

getOrderComparator

public static Comparator getOrderComparator(String lang)
Retrieves a new Categories' OrderComparator.

Parameters:
lang - the language in which the alphabetical ordering will will performed if the category are ordered alphabetically.
Returns:
a new instance of OrderComparator using the default site language if using alphabetical ordering.
Since:
jcms-5.6.1

getDeepOrderComparator

@Deprecated
public static Comparator<Category> getDeepOrderComparator()
Deprecated. use getDeepOrderComparator(String) instead.

Returns:
a new instance of DeepOrderComparator in the default site language.

getDeepOrderComparator

public static Comparator<Category> getDeepOrderComparator(String lang)
Returns:
a new instance of DeepOrderComparator in the specified language.
Since:
jcms-6.0.0

getOrderChildrenFirstComparator

public static Comparator<Category> getOrderChildrenFirstComparator()

getOrderChildrenLastComparator

public static Comparator<Category> getOrderChildrenLastComparator()

getAuthorizedSelector

public static Category.AuthorizedSelector getAuthorizedSelector(Member member)
Parameters:
member - the member that will used in the authorized selector to perform selection.
Returns:
a new instance of Category.AuthorizedSelector using the given Member.
Since:
jcms-5.7.3

getNodeSelector

public static Category.NodeSelector getNodeSelector()

getLeafSelector

public static Category.LeafSelector getLeafSelector()

internalCanBeReadBy

protected boolean internalCanBeReadBy(Member member,
                                      boolean searchInGroups)
Check of this category can be read by the given member

Parameters:
member - the member to be checked
searchInGroups - if true check if one of the group this member belongs to is authorized to read this category.
Returns:
true this category can be read by the given member
Since:
jcms-4.1

internalCanBeReadBy

protected boolean internalCanBeReadBy(Group group)
Check of this category can be read by the given group

Parameters:
group - the group to be checked member belongs to is authorized to read this category.
Returns:
true this category can be read by the given group
Since:
jcms-4.1

canBeReadBy

public boolean canBeReadBy(Member member,
                           boolean searchInGroups,
                           boolean checkAncestors)
Check if a member can read this category.

Parameters:
member - the member to check
searchInGroups - if true check if one of the group this member belongs to is authorized to read this category.
checkAncestors - if true checks the read rights of the ancestors of this category.
Returns:
true if the member can read this category
Since:
jcms-4.1

canBeReadBy

public boolean canBeReadBy(Member member)
This convenient method is the same that canBeReadBy(member, true, true).

Parameters:
member - the member to check
Returns:
true if the member can read this category
Since:
jcms-4.1
See Also:
canBeReadBy(com.jalios.jcms.Member,boolean,boolean)

canBeUsedBy

public boolean canBeUsedBy(Member member)
Dual method of Member.canUseCategory(Category)

Parameters:
member - the member to check
Returns:
true if the member is not null and can use this category
Since:
jcms-6.0
See Also:
Member.canUseCategory(Category)

canBeReadBy

public boolean canBeReadBy(Group group,
                           boolean checkAncestors)
Checks if a group can read this category.

Parameters:
group - the group to check
checkAncestors - if true checks the read rights of the ancestors of this category.
Returns:
true if the group can read this category
Since:
jcms-4.1

hasAnyReadRights

public boolean hasAnyReadRights()
Tests if this category has member or group read rights.
Warning: You cannot use !hasSomeReadRights() to test if this category has no read rights, in this case, use the method hasNoReadRights().

Returns:
true if there are member or group read rights.
Since:
jcms-5.0.4

hasNoReadRights

public boolean hasNoReadRights()
Tests if this category has NO member read rights AND NO group read rights.
Warning: you cannot use !hasNoReadRights() to test if this category has some read rights, in this case, use the method hasAnyReadRights().

Returns:
true if there are NO member read rights AND NO group read rights.
Since:
jcms-5.0.4

getAuthorizedMemberSet

public Set<Member> getAuthorizedMemberSet()
Get the value of authorizedMemberSet.

Returns:
Value of authorizedMemberSet.
Since:
jcms-4.1

setAuthorizedMemberSet

public void setAuthorizedMemberSet(TreeSet<Member> v)
Set the value of authorizedMemberSet.

Parameters:
v - Value to assign to authorizedMemberSet.
Since:
jcms-4.1

addAuthorizedMember

public void addAuthorizedMember(Member mbr)
Add an authorized member.

Parameters:
mbr - the member to be added.
Since:
jcms-5.5.0

removeAuthorizedMember

public boolean removeAuthorizedMember(Member mbr)
Remove an authorized member.

Parameters:
mbr - the member to be removed.
Returns:
true if the set contained the specified member.
Since:
jcms-5.5.0

getAuthorizedGroupSet

public Set<Group> getAuthorizedGroupSet()
Get the value of authorizedGroupSet.

Returns:
Value of authorizedGroupSet.
Since:
jcms-4.1

setAuthorizedGroupSet

public void setAuthorizedGroupSet(TreeSet<Group> v)
Set the value of authorizedGroupSet.

Parameters:
v - Value to assign to authorizedGroupSet.
Since:
jcms-4.1

addAuthorizedGroup

public void addAuthorizedGroup(Group grp)
Add an authorized group

Parameters:
grp - the group to be added.
Since:
jcms-5.5.0

removeAuthorizedGroup

public boolean removeAuthorizedGroup(Group grp)
Remove an authorized group.

Parameters:
grp - the group to be removed.
Returns:
true if the set contained the specified group.
Since:
jcms-5.5.0

getReadRightsString

public String getReadRightsString(int max)
This convenient method returns a String displaying group/member read rights (eg if this category is restricted to g1, g2, m1, m2 and m3, getReadRightsString(3) will return "g1, g2, m1, ...")

Parameters:
max - how many group/member to display
Returns:
a String
Since:
jcms-4.0

getTreeChildren

public Collection<? extends TreeNode> getTreeChildren()
Description copied from interface: TreeNode
Returns a Collection of TreeNode children of the current node

Specified by:
getTreeChildren in interface TreeNode
Returns:
Collection of TreeNode

getTreeParent

public TreeNode getTreeParent()
Description copied from interface: TreeNode
Returns parent of the current node

Specified by:
getTreeParent in interface TreeNode
Returns:
TreeNode parent Node

isTreeLeaf

public boolean isTreeLeaf()
Description copied from interface: TreeNode
Returns boolean true if the TreeNode is a leaf

Specified by:
isTreeLeaf in interface TreeNode
Returns:
boolean indicating if node is leaf or node

isTreeNode

public boolean isTreeNode()
Description copied from interface: TreeNode
Returns boolean true if the TreeNode is a node

Specified by:
isTreeNode in interface TreeNode
Returns:
boolean indicating if node is leaf or node

getTreeRoot

public TreeNode getTreeRoot()
Description copied from interface: TreeNode
Returns the root of the current node

Specified by:
getTreeRoot in interface TreeNode
Returns:
TreeNode root Node

checkIntegrity

public ControllerStatus checkIntegrity()
Checks whether or not data integrity constraints are respected.

Overrides:
checkIntegrity in class Data
Returns:
a ControllerStatus
Since:
jcms-5.0.0

checkMember

public ControllerStatus checkMember(int op,
                                    Member mbr,
                                    Map context)
Checks if the given member can perform the given operation.

Overrides:
checkMember in class Data
Parameters:
op - the operation (OP_CREATE, OP_UPDATE, ...)
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)
Returns:
a ControllerStatus
Since:
jcms-5.0.0

nameExists

public String nameExists(Category parent)
Check if another category exists with the same name under a given parent (skip this category). If such a category exists return the language code (en, fr, ...) of the conflicting name. Otherwise returns null.

Parameters:
parent - the parent category to be tests
Returns:
null if no category use the same name or the language code of the conflicting name.
Since:
jcms-5.6.1

checkName

public boolean checkName(Category parent)
Return true if another category exists with same name under the given parent

Parameters:
parent - the parent category to be tests
Returns:
true if a category exists
Since:
jcms-5.0.0

checkUpdate

public ControllerStatus checkUpdate(Member mbr,
                                    Map context)
Checks if the update can be performed

Overrides:
checkUpdate in class Data
Parameters:
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)
Returns:
a ControllerStatus
Since:
jcms-5.0.0

checkDelete

public ControllerStatus checkDelete(Member mbr,
                                    Map context)
Checks if the deletion can be performed

Overrides:
checkDelete in class Data
Parameters:
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)
Returns:
a ControllerStatus
Since:
jcms-5.0.0

getTypeReferrerCount

public int getTypeReferrerCount()
Returns the number of type referencing this category (through category fields and default categories).

Returns:
the number of type referencing this category.
Since:
jcms-5.5.0

getWSTypeEntryReferrerSet

public Set<WSTypeEntry> getWSTypeEntryReferrerSet()
Returns a set of WSTypeEntry referencing this category.

Returns:
a set of WSTypeEntry referencing this category.
Since:
jcms-5.5.0

refreshTypeReferrerCount

public void refreshTypeReferrerCount()
Refresh type referrer count.

Since:
jcms-5.5.0

performDelete

public void performDelete(Member mbr,
                          Map context)
Performs data deletion

Overrides:
performDelete in class Data
Parameters:
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)
Since:
jcms-5.0.0

performBeforeWrite

protected void performBeforeWrite(int op,
                                  Member mbr,
                                  Map context)
Description copied from class: Data
Called to perform some action before the write.

Overrides:
performBeforeWrite in class Data
Parameters:
op - the operation (OP_CREATE, OP_UPDATE, ...)
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)

performAfterWrite

protected void performAfterWrite(int op,
                                 Member mbr,
                                 Map context)
Description copied from class: Data
Called to perform some action after the write.

Overrides:
performAfterWrite in class Data
Parameters:
op - the operation (OP_CREATE, OP_UPDATE, ...)
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)

performDeepCopy

public void performDeepCopy(Member mbr,
                            Map context)
Performs category deep copy

Parameters:
mbr - the member which requests the write operation
context - a map which contains context parameters (may be null)
Since:
jcms-5.0.0

getReadableCatSet

public static Set<Category> getReadableCatSet(Set<Category> catSet,
                                              Member mbr)
Returns a category subset the given member can read

Parameters:
catSet - the category set to be filtered
mbr - the reader
Returns:
a clone of catSet without categories the member cannot read
Since:
jcms-5.0.1

performImport

public ControllerStatus performImport(Member mbr,
                                      File file,
                                      String languages,
                                      String encoding)
Parse and imports categories from the given file under this category.

Parameters:
mbr - the member used for creation and update of categories
file - the categories file to parse
languages - is the comma separated list of the languages in which the translation will appear in the specified file.
For example, {"en", "fr"} if the file contains a line such as "My Category | Ma cat├ęgorie".
Or {"fr", "en"} if the file contains a line such as "Ma cat├ęgorie | My Category".
If null, the current site language will be used (Channel.getLanguageList().
encoding - the encoding of the file to import, if null, the encoding will be guessed using a CharsetDetector, and if the encoding cannot be guessed, ISO-8859-1 is used as a last resort. Therefore, you should always precise one when possible.
Returns:
a ControllerStatus indicating the operation success/failure (never return null)

exportXmlRelated

protected void exportXmlRelated(StringBuffer sb,
                                String related,
                                int indentLevel)
Overrides:
exportXmlRelated in class Data


Copyright © 2001-2010 Jalios SA. All Rights Reserved.