com.jalios.jcms
Class LinkIndexManager

java.lang.Object
  extended by com.jalios.jcms.LinkIndexManager

public class LinkIndexManager
extends Object

This class manages the Custom Type link index. It is intended to return a Set of Data targeted by a given Data that has a pointer on each of these Data. Since JCMS-3.1, these reverse links are managed at 'field-level'. That is, referencing data can be request for a given field (e.g. get all the data referrencing the given data with field 'myLink').

 TreeMap
   Key: The data which is referenced by 
   Value:
     HashMap: (classMap)
       Key: Class (the class referencing the data) 
       Value: (fieldMap)
         HashMap:
           Key: String (the name of the field referencing the data)
           Value: TreeSet containing all the referencing data
 

Version:
$Revision: 27753 $
Author:
Olivier Dedieu

Field Summary
static String ALL_FIELD_KEY
           
static String REVISION
           
 
Constructor Summary
LinkIndexManager()
           
 
Method Summary
 void checkLinkIndex()
          Check that "all" field entries are consistent with the other fields.
 TreeMap<Data,Map<Class<?>,Map<String,TreeSet<Data>>>> getIndex()
           
<T> TreeSet<T>
getIndexedDataSet(Data data, Class<T> clazz)
          Returns the Set of clazz instances referring this data (whatever the field they used for this reference)
<T> TreeSet<T>
getIndexedDataSet(Data data, Class<T> clazz, String field)
          Returns the Set of clazz instances referring this data with the given field.
 int getLinkCount(Data data)
           
 void printLinkIndex(PrintWriter pw)
          Print an XML view of the index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

ALL_FIELD_KEY

public static final String ALL_FIELD_KEY
See Also:
Constant Field Values
Constructor Detail

LinkIndexManager

public LinkIndexManager()
Method Detail

getIndex

public TreeMap<Data,Map<Class<?>,Map<String,TreeSet<Data>>>> getIndex()

getIndexedDataSet

public <T> TreeSet<T> getIndexedDataSet(Data data,
                                        Class<T> clazz)
Returns the Set of clazz instances referring this data (whatever the field they used for this reference)

Type Parameters:
T - any object type (usually something extending Data)
Parameters:
data - the data
clazz - the class to search the referring instances
Returns:
a TreeSet of Data
Since:
jcms-3.0

getIndexedDataSet

public <T> TreeSet<T> getIndexedDataSet(Data data,
                                        Class<T> clazz,
                                        String field)
Returns the Set of clazz instances referring this data with the given field.

Type Parameters:
T - any object type (usually something extending Data)
Parameters:
data - the data
clazz - the class to search the referring instances
field - the name of the field which contains the reference
Returns:
a TreeSet of Data
Since:
jcms-4.0

getLinkCount

public int getLinkCount(Data data)
Returns:
the number of instances referring this data
Since:
jcms-3.0

checkLinkIndex

public void checkLinkIndex()
Check that "all" field entries are consistent with the other fields.

Since:
jcms-5.0.5

printLinkIndex

public void printLinkIndex(PrintWriter pw)
Print an XML view of the index.

Parameters:
pw - the printWriter where the XML view must be printed.
Since:
jcms-5.0.5


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