Package org.tsugi.basiclti
Class ContentItem
- java.lang.Object
-
- org.tsugi.basiclti.ContentItem
-
public class ContentItem extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCEPT_MEDIA_TYPESstatic StringACCEPT_MULTIPLEstatic StringBAD_CONTENT_MESSAGEstatic StringBAD_DATA_MESSAGEstatic StringCONTENT_ITEMSstatic StringCUSTOMstatic StringICONstatic StringLINEITEMstatic StringMEDIA_ALLstatic StringMEDIA_CCstatic StringMEDIA_CC_1_1static StringMEDIA_CC_1_2static StringMEDIA_CC_1_3static StringMEDIA_LTILINKITEMstatic StringNO_CONTENT_ITEMSstatic StringNO_DATA_MESSAGEstatic StringNO_GRAPH_MESSAGEstatic StringSCORE_CONSTRAINTSstatic StringSCORE_CONSTRAINTS_EXTRA_CREDIT_MAXIMUMstatic StringSCORE_CONSTRAINTS_NORMAL_MAXIMUMstatic StringSCORE_CONSTRAINTS_TOTAL_MAXIMUMstatic StringTEXTstatic StringTITLEstatic StringTYPE_CONTENTITEMstatic StringTYPE_FILEITEMstatic StringTYPE_IMPORTITEMstatic StringTYPE_LTILINKITEMstatic StringURL
-
Constructor Summary
Constructors Constructor Description ContentItem(HttpServletRequest req)We check for the fields essential for the class to operate here.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringbuildLaunch(String contentLaunch, String contentReturn, Properties contentData)Build up a ContentItem launch URL from a base url, return url and extra dataStringgetBaseString()Return the base stringorg.json.simple.JSONObjectgetContentItem()Retrieve the parsed tool_proxyPropertiesgetDataProperties()Get the data properties from the incoming requestStringgetErrorMessage()Return the error messageorg.json.simple.JSONArraygetGraph()Retrieve the @graph from the content itemorg.json.simple.JSONObjectgetItemOfType(String itemType)Retrieve a particular type from the graphstatic DoublegetScoreMaximum(org.json.simple.JSONObject lineItem)Get the maximum score from a lineItem This logic is to produce the DeepLink equivalent of maxScore from a Content ItemStringtoString()Return a stringbooleanvalidate(String oauth_consumer_key, String oauth_secret, String URL)Validate the incoming request
-
-
-
Field Detail
-
ACCEPT_MEDIA_TYPES
public static final String ACCEPT_MEDIA_TYPES
- See Also:
- Constant Field Values
-
MEDIA_LTILINKITEM
public static String MEDIA_LTILINKITEM
-
MEDIA_ALL
public static String MEDIA_ALL
-
ACCEPT_MULTIPLE
public static String ACCEPT_MULTIPLE
-
MEDIA_CC_1_1
public static final String MEDIA_CC_1_1
- See Also:
- Constant Field Values
-
MEDIA_CC_1_2
public static final String MEDIA_CC_1_2
- See Also:
- Constant Field Values
-
MEDIA_CC_1_3
public static final String MEDIA_CC_1_3
- See Also:
- Constant Field Values
-
MEDIA_CC
public static final String MEDIA_CC
- See Also:
- Constant Field Values
-
TYPE_LTILINKITEM
public static final String TYPE_LTILINKITEM
- See Also:
- Constant Field Values
-
TYPE_CONTENTITEM
public static final String TYPE_CONTENTITEM
- See Also:
- Constant Field Values
-
TYPE_FILEITEM
public static final String TYPE_FILEITEM
- See Also:
- Constant Field Values
-
TYPE_IMPORTITEM
public static final String TYPE_IMPORTITEM
- See Also:
- Constant Field Values
-
TITLE
public static final String TITLE
- See Also:
- Constant Field Values
-
TEXT
public static final String TEXT
- See Also:
- Constant Field Values
-
URL
public static final String URL
- See Also:
- Constant Field Values
-
LINEITEM
public static final String LINEITEM
- See Also:
- Constant Field Values
-
SCORE_CONSTRAINTS
public static final String SCORE_CONSTRAINTS
- See Also:
- Constant Field Values
-
SCORE_CONSTRAINTS_NORMAL_MAXIMUM
public static final String SCORE_CONSTRAINTS_NORMAL_MAXIMUM
- See Also:
- Constant Field Values
-
SCORE_CONSTRAINTS_EXTRA_CREDIT_MAXIMUM
public static final String SCORE_CONSTRAINTS_EXTRA_CREDIT_MAXIMUM
- See Also:
- Constant Field Values
-
SCORE_CONSTRAINTS_TOTAL_MAXIMUM
public static final String SCORE_CONSTRAINTS_TOTAL_MAXIMUM
- See Also:
- Constant Field Values
-
CUSTOM
public static final String CUSTOM
- See Also:
- Constant Field Values
-
ICON
public static final String ICON
- See Also:
- Constant Field Values
-
CONTENT_ITEMS
public static final String CONTENT_ITEMS
- See Also:
- Constant Field Values
-
NO_CONTENT_ITEMS
public static final String NO_CONTENT_ITEMS
- See Also:
- Constant Field Values
-
BAD_CONTENT_MESSAGE
public static final String BAD_CONTENT_MESSAGE
- See Also:
- Constant Field Values
-
NO_DATA_MESSAGE
public static final String NO_DATA_MESSAGE
- See Also:
- Constant Field Values
-
NO_GRAPH_MESSAGE
public static final String NO_GRAPH_MESSAGE
- See Also:
- Constant Field Values
-
BAD_DATA_MESSAGE
public static final String BAD_DATA_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContentItem
public ContentItem(HttpServletRequest req)
We check for the fields essential for the class to operate here.
-
-
Method Detail
-
validate
public boolean validate(String oauth_consumer_key, String oauth_secret, String URL)
Validate the incoming request- Parameters:
URL- The URL of the incoming request. If this in null, the URL is taken from the request object. Sometimes the request object can be misleading when sitting behind a load balancer or some kind of proxy.
-
getContentItem
public org.json.simple.JSONObject getContentItem()
Retrieve the parsed tool_proxy
-
getGraph
public org.json.simple.JSONArray getGraph()
Retrieve the @graph from the content item
-
getItemOfType
public org.json.simple.JSONObject getItemOfType(String itemType)
Retrieve a particular type from the graph- Parameters:
String- messageType - Which item type you are looking for
-
getDataProperties
public Properties getDataProperties()
Get the data properties from the incoming request
-
getBaseString
public String getBaseString()
Return the base string
-
getErrorMessage
public String getErrorMessage()
Return the error message
-
buildLaunch
public static String buildLaunch(String contentLaunch, String contentReturn, Properties contentData)
Build up a ContentItem launch URL from a base url, return url and extra data
-
getScoreMaximum
public static Double getScoreMaximum(org.json.simple.JSONObject lineItem)
Get the maximum score from a lineItem This logic is to produce the DeepLink equivalent of maxScore from a Content Item
-
-