DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.standards
Class CATServiceHelper

java.lang.Object
  extended by org.dlese.dpc.schemedit.standards.CATServiceHelper
All Implemented Interfaces:
SuggestionServiceHelper
Direct Known Subclasses:
AsnSuggestionServiceHelper, CommCoreServiceHelper, DleseSuggestionServiceHelper, TeachersDomainServiceHelper

public abstract class CATServiceHelper
extends Object
implements SuggestionServiceHelper

Run-time support for CAT suggestion service, which acts as intermediary between CAT Service client and Form bean/JSP pages.

The CAT service UI involves extraction of several values from the item record being edited for each framework, such as selected keywords, selected graderanges, etc. The functionality to extract these values is delegated to the framework-specific plug-in, which implments CATHelperPlugin.

Author:
ostwald

Field Summary
static String ALL_CONTENT
          NOT YET DOCUMENTED
static String BOTH_CONTENT
          NOT YET DOCUMENTED
static String LIST_MODE
          NOT YET DOCUMENTED
static String SELECTED_CONTENT
          NOT YET DOCUMENTED
static String SUGGESTIONS_CONTENT
          NOT YET DOCUMENTED
static String TREE_MODE
          NOT YET DOCUMENTED
 
Constructor Summary
CATServiceHelper(SchemEditForm sef, CATHelperPlugin frameworkPlugin)
          Constructor for the CATServiceHelper object
 
Method Summary
 void displaySuggestions(List standardsList)
          Debugging
 SchemEditForm getActionForm()
          Gets the actionForm attribute of the CATServiceHelper object
 String getAuthor()
          Resolves author from the asnDocument (which it gets from the StandardsDocument)
 List getAvailableDocs()
          Gets the availableDocs attribute of the CATServiceHelper object
protected  CATRequestConstraints getConstraints()
          Build a MetadataContraint instance from current CATServiceHelper attributes, including keywords, description, gradeRanges (when the corresponding "use" attributes return true).
 String getCurrentDoc()
          Gets the currentDoc attribute of the CATServiceHelper object
 String getDerivedCATEndGrade()
          Gets the gradeRangeOptionValue corresponding to the highest selected gradeRange in the current instance document.
 String getDerivedCATStartGrade()
          Gets the gradeRangeOptionValue corresponding to the lowest selected gradeRange in the current instance document.
 String getDisplayContent()
          Determines what standards to display (SUGGESTED_CONTENT, STANDARDS_CONTENT, BOTH, ALL)
 String getDisplayMode()
          Determines whether standards are displayed as a heirarchical tree or flat list.
protected  MetaDataFramework getFramework()
          Gets the framework attribute of the CATServiceHelper object
 CATHelperPlugin getFrameworkPlugin()
          Gets the frameworkPlugin attribute of the SuggestionServiceHelper object
 List getGradeRangeOptions()
          Gets the gradeRanges corresponding to the grades searchable in the current framework
protected abstract  String getIdFromCATStandard(CATStandard std)
          Gets the idFromCATStandard attribute of the CATServiceHelper object
static CATServiceHelper getInstance(SchemEditForm sef)
          Gets the instance attribute of the CATServiceHelper class
protected  Document getInstanceDocument()
          Gets the document attribute of the CATServiceHelper object
 int getKeywordWeighting()
           
 int getNumSelectedStandards()
          Gets the numSelectedStandards attribute of the CATServiceHelper object
 List getOptionalCatUIFields()
          Gets a list specifying what optional fields (e.g., "subject", "keyword") is exported by this framework.
 Map getOtherSelectedStandards()
          Gets the otherSelectedStandards attribute of the CATServiceHelper object
 String getRecordDescription()
          Gets the value of the description field of the current metadata record
 String[] getRecordGradeRanges()
          Gets the gradeRanges assigned for the current record
 String[] getRecordKeywords()
          Gets the value of the description field of the current metadata record
 String[] getRecordSubjects()
          Gets the recordSubjects attribute of the CATServiceHelper object
 String getRecordUrl()
          Gets the recordUrl specified in the instance document (via the SchemEditForm).
 StandardsNode getRootStandardNode()
          Gets the rootStandardNode attribute of the CATServiceHelper object
 String[] getSelectedGradeRanges()
          Gets the GradeRanges curently selected in the CAT UI.
 String getSelectedKeywords()
          Gets the keywords currently selected in the service controls.
 List getSelectedStandards()
          Retrieves a list of selected standards that can be fed into the "moreLikeThis" method.
protected  List getSelectedStandards(Document doc)
          Retrieves a list of selected standards from the provided instance document that can be fed into the "moreLikeThis" method.
 boolean getServiceIsActive()
          Gets the serviceIsActive attribute of the CATServiceHelper object
abstract  StandardsDocument getStandardsDocument()
          Gets the standardsDocument from which suggestions are requested and received.
abstract  String getStandardsFormat()
          Gets the standardsFormat attribute of the CATServiceHelper object
 StandardsManager getStandardsManager()
          Gets the standardsManager attribute of the CATServiceHelper object
 List getStandardsNodes()
          Gets a list of all standardsNodes in the current StandardsDocument in standards document order.
 List getSuggestedStandards()
          Gets the suggested Standards represented in ADN format.
 String getTopic()
          Resolves topic for this asnDocument asnDocument (which it gets from the StandardsDocument)
 String getUrl()
          Gets the url attribute of the CATServiceHelper object
 boolean getUseDescription()
          Specifies whether user has chosen to constrain suggestion service using current value of description field in the current metadata record.
 boolean getUseGradeRanges()
          Specifies whether user has chosen to constrain suggestion service using current value of gradeRange checkboxes in the suggestion service interface.
 boolean getUseKeywords()
          Specifies whether user has chosen to constrain suggestion service using current value of keywords box in the suggestion service interface.
 boolean getUseSubjects()
          Specifies whether user has chosen to constrain suggestion service using current value of keywords box in the suggestion service interface.
 String getXmlFormat()
          Gets the xmlFormat attribute of the CATServiceHelper object
 String getXpath()
          Gets the xpath of the metadata element containing the managedStandards
 void moreLikeThis()
          Update the suggestions based on the currently selected standards and the current suggestionConstraints.
 void setDisplayContent(String content)
          Sets the displayContent attribute of the CATServiceHelper object
 void setDisplayMode(String mode)
          Sets the displayMode attribute to either TREE_MODE (to display all standards) or LIST_MODE (to display either suggested or selected standards);
protected  void setFrameworkPlugin(CATHelperPlugin plugin)
          Sets the frameworkPlugin attribute of the CATServiceHelper object
 void setKeywordWeighting(int weight)
          Keywordweighting specifies how many times the keyword contents are repeated before they are inserted into the keyword field of the Contraint instance.
 void setSelectedGradeRanges(String[] grs)
          Sets the selectedGradeRanges attribute of the CATServiceHelper object
 void setSelectedKeywords(String kws)
          Sets the selectedKeywords attribute of the CATServiceHelper object
 void setServiceIsActive(boolean b)
          Sets the serviceIsActive attribute of the CATServiceHelper object
 void setSuggestedStandards(List stds)
          Sets the suggestedStandards attribute of the CATServiceHelper object
 void setUrl(String url)
          Sets the url attribute of the CATServiceHelper object
 void setUseDescription(boolean useIt)
          Sets the useDescription attribute of the CATServiceHelper object
 void setUseGradeRanges(boolean useIt)
          Sets the useGradeRanges attribute of the CATServiceHelper object
 void setUseKeywords(boolean useIt)
          Sets the useKeywords attribute of the CATServiceHelper object
 void setUseSubjects(boolean useIt)
          Sets the useSubjects attribute of the CATServiceHelper object
 void updateDisplayControls(HttpServletRequest request)
          Sets various control attributes from the information contained in the request, such as displayMode, displayContent, and whether description, grade ranges, subjects, keywords, will be used in the CAT Service request.
 void updateStandardsDisplay(String displayContent)
          Initialize the collapse bean to show selected and suggested standards nodes in the display specified by "displayContent".
 void updateSuggestions()
          Description of the Method
 void updateSuggestions(List feedbackStandards)
          Performs a query on the suggestion server using the current contraints, and updates the suggestedStandards attribute of the CATServiceHelper with the results, which is a list of standards IDS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TREE_MODE

public static final String TREE_MODE
NOT YET DOCUMENTED

See Also:
Constant Field Values

LIST_MODE

public static final String LIST_MODE
NOT YET DOCUMENTED

See Also:
Constant Field Values

SELECTED_CONTENT

public static final String SELECTED_CONTENT
NOT YET DOCUMENTED

See Also:
Constant Field Values

SUGGESTIONS_CONTENT

public static final String SUGGESTIONS_CONTENT
NOT YET DOCUMENTED

See Also:
Constant Field Values

BOTH_CONTENT

public static final String BOTH_CONTENT
NOT YET DOCUMENTED

See Also:
Constant Field Values

ALL_CONTENT

public static final String ALL_CONTENT
NOT YET DOCUMENTED

See Also:
Constant Field Values
Constructor Detail

CATServiceHelper

public CATServiceHelper(SchemEditForm sef,
                        CATHelperPlugin frameworkPlugin)
Constructor for the CATServiceHelper object

Parameters:
sef - Description of the Parameter
frameworkPlugin - NOT YET DOCUMENTED
Method Detail

getStandardsDocument

public abstract StandardsDocument getStandardsDocument()
Gets the standardsDocument from which suggestions are requested and received.

Returns:
The standardsDocument value

getStandardsFormat

public abstract String getStandardsFormat()
Gets the standardsFormat attribute of the CATServiceHelper object

Returns:
The standardsFormat value (e.g., "dlese", "asn")

getFrameworkPlugin

public CATHelperPlugin getFrameworkPlugin()
Gets the frameworkPlugin attribute of the SuggestionServiceHelper object

Returns:
The frameworkPlugin value

setFrameworkPlugin

protected void setFrameworkPlugin(CATHelperPlugin plugin)
Sets the frameworkPlugin attribute of the CATServiceHelper object

Parameters:
plugin - The new frameworkPlugin value

getStandardsManager

public StandardsManager getStandardsManager()
Gets the standardsManager attribute of the CATServiceHelper object

Specified by:
getStandardsManager in interface SuggestionServiceHelper
Returns:
The standardsManager value

getRootStandardNode

public StandardsNode getRootStandardNode()
Gets the rootStandardNode attribute of the CATServiceHelper object

Returns:
The rootStandardNode value

getStandardsNodes

public List getStandardsNodes()
Gets a list of all standardsNodes in the current StandardsDocument in standards document order.

Returns:
The standardsNodes value

getAuthor

public String getAuthor()
Resolves author from the asnDocument (which it gets from the StandardsDocument)

Returns:
The author value

getTopic

public String getTopic()
Resolves topic for this asnDocument asnDocument (which it gets from the StandardsDocument)

Returns:
The topic value

getAvailableDocs

public List getAvailableDocs()
Gets the availableDocs attribute of the CATServiceHelper object

Returns:
The availableDocs value

getCurrentDoc

public String getCurrentDoc()
Gets the currentDoc attribute of the CATServiceHelper object

Specified by:
getCurrentDoc in interface SuggestionServiceHelper
Returns:
The currentDoc value

getInstance

public static CATServiceHelper getInstance(SchemEditForm sef)
                                    throws Exception
Gets the instance attribute of the CATServiceHelper class

Parameters:
sef - Description of the Parameter
Returns:
The instance value
Throws:
Exception - Description of the Exception

getActionForm

public SchemEditForm getActionForm()
Gets the actionForm attribute of the CATServiceHelper object

Returns:
The actionForm value

getFramework

protected MetaDataFramework getFramework()
Gets the framework attribute of the CATServiceHelper object

Returns:
The framework value

getInstanceDocument

protected Document getInstanceDocument()
Gets the document attribute of the CATServiceHelper object

Returns:
The document value

getServiceIsActive

public boolean getServiceIsActive()
Gets the serviceIsActive attribute of the CATServiceHelper object

Specified by:
getServiceIsActive in interface SuggestionServiceHelper
Returns:
true if the SuggestionService is available

setServiceIsActive

public void setServiceIsActive(boolean b)
Sets the serviceIsActive attribute of the CATServiceHelper object

Parameters:
b - The new serviceIsActive value

getXpath

public String getXpath()
Gets the xpath of the metadata element containing the managedStandards

Specified by:
getXpath in interface SuggestionServiceHelper
Returns:
The xpath value

getXmlFormat

public String getXmlFormat()
Gets the xmlFormat attribute of the CATServiceHelper object

Specified by:
getXmlFormat in interface SuggestionServiceHelper
Returns:
The xmlFormat value

getSuggestedStandards

public List getSuggestedStandards()
Gets the suggested Standards represented in ADN format.

Specified by:
getSuggestedStandards in interface SuggestionServiceHelper
Returns:
The suggestedStandards value

getNumSelectedStandards

public int getNumSelectedStandards()
Gets the numSelectedStandards attribute of the CATServiceHelper object

Specified by:
getNumSelectedStandards in interface SuggestionServiceHelper
Returns:
The numSelectedStandards value

getSelectedStandards

public List getSelectedStandards()
Retrieves a list of selected standards that can be fed into the "moreLikeThis" method.

Specified by:
getSelectedStandards in interface SuggestionServiceHelper
Returns:
The selectedStandards value

getSelectedStandards

protected List getSelectedStandards(Document doc)
Retrieves a list of selected standards from the provided instance document that can be fed into the "moreLikeThis" method.

NOTE: used to support asyncronous calls, in which the instance document of the formBean may not reflect the most recent values.

Parameters:
doc - the instance document
Returns:
The selectedStandards as a list of standards IDS

getOtherSelectedStandards

public Map getOtherSelectedStandards()
Gets the otherSelectedStandards attribute of the CATServiceHelper object

Returns:
The otherSelectedStandards value

setSuggestedStandards

public void setSuggestedStandards(List stds)
Sets the suggestedStandards attribute of the CATServiceHelper object

Specified by:
setSuggestedStandards in interface SuggestionServiceHelper
Parameters:
stds - The new suggestedStandards value

getUseDescription

public boolean getUseDescription()
Specifies whether user has chosen to constrain suggestion service using current value of description field in the current metadata record.

Returns:
true if description contstraint is to be used.

setUseDescription

public void setUseDescription(boolean useIt)
Sets the useDescription attribute of the CATServiceHelper object

Parameters:
useIt - The new useDescription value

getUseKeywords

public boolean getUseKeywords()
Specifies whether user has chosen to constrain suggestion service using current value of keywords box in the suggestion service interface.

Returns:
The useKeywords value

setUseKeywords

public void setUseKeywords(boolean useIt)
Sets the useKeywords attribute of the CATServiceHelper object

Parameters:
useIt - The new useKeywords value

getUseSubjects

public boolean getUseSubjects()
Specifies whether user has chosen to constrain suggestion service using current value of keywords box in the suggestion service interface.

Returns:
The useSubjects value

setUseSubjects

public void setUseSubjects(boolean useIt)
Sets the useSubjects attribute of the CATServiceHelper object

Parameters:
useIt - The new useSubjects value

getUseGradeRanges

public boolean getUseGradeRanges()
Specifies whether user has chosen to constrain suggestion service using current value of gradeRange checkboxes in the suggestion service interface.

Returns:
The useGradeRanges value

setUseGradeRanges

public void setUseGradeRanges(boolean useIt)
Sets the useGradeRanges attribute of the CATServiceHelper object

Parameters:
useIt - The new useGradeRanges value

getDisplayMode

public String getDisplayMode()
Determines whether standards are displayed as a heirarchical tree or flat list.

Specified by:
getDisplayMode in interface SuggestionServiceHelper
Returns:
LIST_MODE for list mode, TREE_MODE for tree mode.

setDisplayMode

public void setDisplayMode(String mode)
Sets the displayMode attribute to either TREE_MODE (to display all standards) or LIST_MODE (to display either suggested or selected standards);

Parameters:
mode - The new displayMode value

getDisplayContent

public String getDisplayContent()
Determines what standards to display (SUGGESTED_CONTENT, STANDARDS_CONTENT, BOTH, ALL)

Specified by:
getDisplayContent in interface SuggestionServiceHelper
Returns:
The displayContent value

setDisplayContent

public void setDisplayContent(String content)
Sets the displayContent attribute of the CATServiceHelper object

Parameters:
content - The new displayContent value

getUrl

public String getUrl()
Gets the url attribute of the CATServiceHelper object

Specified by:
getUrl in interface SuggestionServiceHelper
Returns:
The url value

setUrl

public void setUrl(String url)
Sets the url attribute of the CATServiceHelper object

Parameters:
url - The new url value

getOptionalCatUIFields

public List getOptionalCatUIFields()
Gets a list specifying what optional fields (e.g., "subject", "keyword") is exported by this framework. The UI controls for these fields will be active.

Returns:
The optionalCatUIFields value

getRecordGradeRanges

public String[] getRecordGradeRanges()
Gets the gradeRanges assigned for the current record

Returns:
The recordGradeRanges value

getSelectedGradeRanges

public String[] getSelectedGradeRanges()
Gets the GradeRanges curently selected in the CAT UI.

Returns:
The selectedGradeRanges value

getDerivedCATStartGrade

public String getDerivedCATStartGrade()
Gets the gradeRangeOptionValue corresponding to the lowest selected gradeRange in the current instance document.

NOTE: this requires converting from possible gradeRange metadata values to the values supplied for gradeRangeOptions.

Specified by:
getDerivedCATStartGrade in interface SuggestionServiceHelper
Returns:
The startGradeOptionValue value

getDerivedCATEndGrade

public String getDerivedCATEndGrade()
Gets the gradeRangeOptionValue corresponding to the highest selected gradeRange in the current instance document.

NOTE: this requires converting from possible gradeRange metadata values to the values supplied for gradeRangeOptions.

Specified by:
getDerivedCATEndGrade in interface SuggestionServiceHelper
Returns:
The endGrade value

setSelectedGradeRanges

public void setSelectedGradeRanges(String[] grs)
Sets the selectedGradeRanges attribute of the CATServiceHelper object

Parameters:
grs - The new selectedGradeRanges value

getKeywordWeighting

public int getKeywordWeighting()
Returns:
The keywordWeighting value

setKeywordWeighting

public void setKeywordWeighting(int weight)
Keywordweighting specifies how many times the keyword contents are repeated before they are inserted into the keyword field of the Contraint instance.

Parameters:
weight - The new keywordWeighting value

getGradeRangeOptions

public List getGradeRangeOptions()
Gets the gradeRanges corresponding to the grades searchable in the current framework

Returns:
The gradeRanges value

getRecordDescription

public String getRecordDescription()
Gets the value of the description field of the current metadata record

Returns:
The description

getRecordKeywords

public String[] getRecordKeywords()
Gets the value of the description field of the current metadata record

Returns:
The keywords

getRecordSubjects

public String[] getRecordSubjects()
Gets the recordSubjects attribute of the CATServiceHelper object

Returns:
The recordSubjects value

getSelectedKeywords

public String getSelectedKeywords()
Gets the keywords currently selected in the service controls.

Returns:
The selectedKeywords value

setSelectedKeywords

public void setSelectedKeywords(String kws)
Sets the selectedKeywords attribute of the CATServiceHelper object

Parameters:
kws - The new selectedKeywords value

getRecordUrl

public String getRecordUrl()
Gets the recordUrl specified in the instance document (via the SchemEditForm).

Note: this method depends on the url path being defined in the framework configuration.

Specified by:
getRecordUrl in interface SuggestionServiceHelper
Returns:
The recordUrl value

updateSuggestions

public void updateSuggestions()
                       throws Exception
Description of the Method

Specified by:
updateSuggestions in interface SuggestionServiceHelper
Throws:
Exception - Description of the Exception

updateSuggestions

public void updateSuggestions(List feedbackStandards)
                       throws Exception
Performs a query on the suggestion server using the current contraints, and updates the suggestedStandards attribute of the CATServiceHelper with the results, which is a list of standards IDS.

Parameters:
feedbackStandards - Description of the Parameter
Throws:
Exception - NOT YET DOCUMENTED

moreLikeThis

public void moreLikeThis()
                  throws Exception
Update the suggestions based on the currently selected standards and the current suggestionConstraints.

Throws:
Exception - NOT YET DOCUMENTED

getConstraints

protected CATRequestConstraints getConstraints()
Build a MetadataContraint instance from current CATServiceHelper attributes, including keywords, description, gradeRanges (when the corresponding "use" attributes return true).

NOTE: Author and Topic hardcoded to "National Science Education Standards (NSES)" and "Science", respectively

Returns:
A contraint for a SuggestionService Search request.

getIdFromCATStandard

protected abstract String getIdFromCATStandard(CATStandard std)
Gets the idFromCATStandard attribute of the CATServiceHelper object

Parameters:
std - NOT YET DOCUMENTED
Returns:
The idFromCATStandard value

updateDisplayControls

public void updateDisplayControls(HttpServletRequest request)
                           throws Exception
Sets various control attributes from the information contained in the request, such as displayMode, displayContent, and whether description, grade ranges, subjects, keywords, will be used in the CAT Service request.

Parameters:
request - NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

updateStandardsDisplay

public void updateStandardsDisplay(String displayContent)
                            throws Exception
Initialize the collapse bean to show selected and suggested standards nodes in the display specified by "displayContent".

Specified by:
updateStandardsDisplay in interface SuggestionServiceHelper
Parameters:
displayContent - Description of the Parameter
Throws:
Exception - NOT YET DOCUMENTED

displaySuggestions

public void displaySuggestions(List standardsList)
Debugging

Parameters:
standardsList - A list of StandardsWrapper instances to display.

DLESE Tools
v1.6.0