com.arsdigita.categorization
Class CategorizedObject

java.lang.Object
  extended bycom.arsdigita.categorization.CategorizedObject

public class CategorizedObject
extends Object

A wrapper for a categorized ACSObject, such as the Jaws object in this diagram.

The reason this class exists is because the ACSObject class does not know about the categorization service. Therefore, if you have a categorized ACSObject, it does not provides methods for answering questions like: What are you parents? What is your default category?, and so on. This class serves as a wrapper that provides these and other methods.

Version:
$Revision: #23 $ $DateTime: 2004/04/07 16:07:11 $
Author:
David Eison

Constructor Summary
CategorizedObject(ACSObject data)
          Initializes with the specified ACS object.
CategorizedObject(DataObject dataObject)
          Creates the appropriate type of ACS object from the passed in data object.
 
Method Summary
 boolean equals(Object o)
          Determines whether the contained objects are equal.
 Iterator getDefaultAncestors()
          Returns the default ancestor categories up to the root, with the root as the first item in the iterator.
 Category getDefaultParentCategory()
          Gets the default parent category.
 ACSObject getObject()
          Gets the contained object.
 Collection getParentCategories()
          Deprecated. use getParents()
 Collection getParentCategories(String purposeKey)
          Deprecated. the notion of "category purposes" has been deprecated. Use the use-context-based API, as explained in Category.
 long getParentCategoryCount()
          Gets the count of parent categories for this object.
 CategoryCollection getParents()
           
 int hashCode()
          Delegates hashCode generation to the contained ACS object.
 void save()
          This saves all of the changes that have been made to this object as well as saving the underlying ACSObject.
 void setDefaultParentCategory(Category parent)
          Sets the passed in category as the default parent category for this category.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CategorizedObject

public CategorizedObject(ACSObject data)
Initializes with the specified ACS object.

Parameters:
data - the ACS object

CategorizedObject

public CategorizedObject(DataObject dataObject)
Creates the appropriate type of ACS object from the passed in data object.

Throws:
IllegalArgumentException - if the data object is not an ACS object.
Method Detail

getObject

public ACSObject getObject()
Gets the contained object.

Returns:
the contained object.

getParentCategories

public Collection getParentCategories()
Deprecated. use getParents()

Returns the parent categories for this domain object.

Returns:
a collection of categories that this object is classified under.
Throws:
DataObjectNotFoundException

getParents

public CategoryCollection getParents()

getParentCategories

public Collection getParentCategories(String purposeKey)
Deprecated. the notion of "category purposes" has been deprecated. Use the use-context-based API, as explained in Category.

Returns the parent categories for this domain object that correspond to a particular CategoryPurpose.

For a category to correspond to a CategoryPurpose, the ancestor category which is a direct child of the category root must be associated with a CategoryPurpose whose key equals that passed into this method.

Parameters:
purposeKey - the Integer key for the desired CategoryPurpose
Returns:
a collection of categories that this object is classified under.
Throws:
DataObjectNotFoundException

getDefaultParentCategory

public Category getDefaultParentCategory()
Gets the default parent category.

Returns:
the default parent category.
Throws:
DataObjectNotFoundException
CategoryNotFoundException

getParentCategoryCount

public long getParentCategoryCount()
Gets the count of parent categories for this object.

Returns:
the number of times this object has been mapped to a new category.

getDefaultAncestors

public Iterator getDefaultAncestors()
Returns the default ancestor categories up to the root, with the root as the first item in the iterator.

Returns:
an interator over the default ancestor categories.
Throws:
DataObjectNotFoundException
CategorizationException

setDefaultParentCategory

public void setDefaultParentCategory(Category parent)

Sets the passed in category as the default parent category for this category. If the passed on object is not already a parent then this add the passed in object as a new parent.

Note: This clears the previous default mapping. The results are saved for the user when the transaction is committed.

Parameters:
parent - the new default category.
Throws:
DataObjectNotFoundException

save

public void save()
This saves all of the changes that have been made to this object as well as saving the underlying ACSObject.


equals

public boolean equals(Object o)
Determines whether the contained objects are equal.

Returns:
true if the two contained objects match; false otherwise.

hashCode

public int hashCode()
Delegates hashCode generation to the contained ACS object.


toString

public String toString()


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC