public class ResourceLink
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ResourceLink.Group
Class to represent a group.
|
class |
ResourceLink.GroupSet
Class to represent a group set.
|
Modifier and Type | Field and Description |
---|---|
static int |
EXT_DELETE
Delete action.
|
static int |
EXT_READ
Read action.
|
static java.lang.String |
EXT_TYPE_DECIMAL
Decimal outcome type.
|
static java.lang.String |
EXT_TYPE_LETTER_AF
Letter (A-F) outcome type.
|
static java.lang.String |
EXT_TYPE_LETTER_AF_PLUS
Letter (A-F) with optional +/- outcome type.
|
static java.lang.String |
EXT_TYPE_PASS_FAIL
Pass/fail outcome type.
|
static java.lang.String |
EXT_TYPE_PERCENTAGE
Percentage outcome type.
|
static java.lang.String |
EXT_TYPE_RATIO
Ratio outcome type.
|
static java.lang.String |
EXT_TYPE_TEXT
Free text outcome type.
|
static int |
EXT_WRITE
Write (create/update) action.
|
Constructor and Description |
---|
ResourceLink(ToolConsumer consumer,
java.lang.String id)
Class constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
delete()
Delete the resource link from the database.
|
java.util.List<User> |
doMembershipsService(boolean withGroups)
Perform a Memberships service request.
|
boolean |
doOutcomesService(int action,
Outcome ltiOutcome)
Deprecated.
use
instead.
Perform an Outcomes service request. The action type parameter should be one of the pre-defined constants. |
boolean |
doOutcomesService(int action,
Outcome ltiOutcome,
User user)
Perform an Outcomes service request.
|
java.lang.String |
doSettingService(int action)
Perform a Setting service request.
|
boolean |
doSettingService(int action,
java.lang.String value)
Perform a Setting service request.
|
ToolConsumer |
getConsumer()
Returns the tool consumer for this resource link.
|
java.util.Calendar |
getCreated()
Returns the date/time when this resource link was created.
|
org.jdom.Document |
getExtDoc()
Returns the XML document for the last service response.
|
java.lang.String |
getExtRequest()
Returns the content of the last service request.
|
java.lang.String |
getExtResponse()
Returns the content of the last service response.
|
java.util.Map<java.lang.String,ResourceLink.Group> |
getGroups()
Returns the groups for the resource link.
|
java.util.Map<java.lang.String,ResourceLink.GroupSet> |
getGroupSets()
Returns the group sets for the resource link.
|
java.lang.String |
getId()
Returns the resource link ID.
|
java.lang.String |
getKey()
Returns the tool consumer key for this resource link.
|
java.lang.String |
getLtiContextId()
Returns the context ID for the resource link.
|
java.lang.String |
getLtiResourceLinkId()
Returns the resource link ID provided by the tool consumer on launch.
|
java.lang.String |
getPrimaryConsumerKey()
Returns the consumer key for the resource link with which this resource link is shared.
|
java.lang.String |
getPrimaryResourceLinkId()
Returns the resource link ID for the resource link with which this resource link is shared.
|
java.lang.String |
getSetting(java.lang.String name)
Returns a named setting value.
|
java.lang.String |
getSetting(java.lang.String name,
java.lang.String defaultValue)
Returns a named setting value or the specified default value if the setting does not exist.
|
java.util.Map<java.lang.String,java.lang.String> |
getSettings()
Returns a map of all setting values.
|
java.lang.Boolean |
getShareApproved()
Returns
true if the share with another resource link has been approved. |
java.util.List<ResourceLinkShare> |
getShares()
Returns a list of ResourceLinkShare objects for each resource link which is sharing this resource link.
|
java.lang.String |
getTitle()
Returns the resource link title.
|
java.util.Calendar |
getUpdated()
Returns the date/time when this resource link was last updated.
|
java.util.Map<java.lang.String,User> |
getUserResultSourcedIDs(boolean localOnly,
int idScope)
Returns a map of User objects for users with a result sourcedId.
|
boolean |
hasMembershipsService()
Returns
true if the Memberships service is supported for the resource link. |
boolean |
hasOutcomesService()
Returns
true if the Outcomes service is supported for the resource link (either the LTI 1.1 or extension service). |
boolean |
hasSettingService()
Returns
true if the Setting service is supported for the resource link. |
void |
initialise()
Initialise the resource link properties.
|
boolean |
save()
Save the resource link to the database.
|
boolean |
saveSettings()
Save setting values.
|
void |
setCreated(java.util.Calendar created)
Set the date/time when the resource link was created.
|
void |
setLtiContextId(java.lang.String ltiContextId)
Set the context ID for the resource link.
|
void |
setLtiResourceLinkId(java.lang.String ltiResourceLinkId)
Set the resource link ID provided by the tool consumer on launch.
|
void |
setPrimaryConsumerKey(java.lang.String primaryConsumerKey)
Set the consumer key for the resource link with which this resource link is shared.
|
void |
setPrimaryResourceLinkId(java.lang.String primaryResourceLinkId)
Set the resource link ID for the resource link with which this resource link is shared.
|
void |
setSetting(java.lang.String name,
java.lang.String value)
Set a setting value with a specified name.
|
void |
setSettings(java.util.Map<java.lang.String,java.lang.String> settings)
Sets setting values to the specified map.
|
void |
setShareApproved(java.lang.Boolean shareApproved)
Set whether the sharing arrangement is approved (active).
|
void |
setTitle(java.lang.String title)
Set the resource link title.
|
void |
setUpdated(java.util.Calendar updated)
Set the date/time when the resource link was last updated.
|
java.lang.String |
toString()
Returns a string representation of this resource link.
|
public static final int EXT_READ
public static final int EXT_WRITE
public static final int EXT_DELETE
public static final java.lang.String EXT_TYPE_DECIMAL
public static final java.lang.String EXT_TYPE_PERCENTAGE
public static final java.lang.String EXT_TYPE_RATIO
public static final java.lang.String EXT_TYPE_LETTER_AF
public static final java.lang.String EXT_TYPE_LETTER_AF_PLUS
public static final java.lang.String EXT_TYPE_PASS_FAIL
public static final java.lang.String EXT_TYPE_TEXT
public ResourceLink(ToolConsumer consumer, java.lang.String id)
consumer
- Consumer key valueid
- Resource link ID valuepublic final void initialise()
public boolean save()
true
if the resource link was successfully saved.public boolean delete()
true
if the resource link was successfully deleted.public ToolConsumer getConsumer()
public java.lang.String getKey()
public java.lang.String getId()
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- resource link titlepublic java.lang.String getLtiContextId()
public void setLtiContextId(java.lang.String ltiContextId)
ltiContextId
- context IDpublic java.lang.String getLtiResourceLinkId()
public void setLtiResourceLinkId(java.lang.String ltiResourceLinkId)
ltiResourceLinkId
- LTI resource link IDpublic java.util.Map<java.lang.String,ResourceLink.GroupSet> getGroupSets()
public java.util.Map<java.lang.String,ResourceLink.Group> getGroups()
public java.lang.String getExtRequest()
public java.lang.String getExtResponse()
public org.jdom.Document getExtDoc()
public java.lang.String getPrimaryConsumerKey()
public void setPrimaryConsumerKey(java.lang.String primaryConsumerKey)
primaryConsumerKey
- consumer keypublic java.lang.String getPrimaryResourceLinkId()
public void setPrimaryResourceLinkId(java.lang.String primaryResourceLinkId)
primaryResourceLinkId
- resource link IDpublic java.lang.Boolean getShareApproved()
true
if the share with another resource link has been approved.
If no sharing arrangement has been set up this property should have a value of null.
true
if a sharing arrangement is activepublic void setShareApproved(java.lang.Boolean shareApproved)
This value should be null if no arrangement is in place.
shareApproved
- true
if the resource link is sharedpublic java.lang.String getSetting(java.lang.String name)
name
- name of settingpublic java.lang.String getSetting(java.lang.String name, java.lang.String defaultValue)
name
- name of settingdefaultValue
- value to return if the setting does not existpublic void setSetting(java.lang.String name, java.lang.String value)
name
- name of settingvalue
- value to set, use an empty or null value to delete a settingpublic java.util.Map<java.lang.String,java.lang.String> getSettings()
public void setSettings(java.util.Map<java.lang.String,java.lang.String> settings)
settings
- map of setting valuespublic boolean saveSettings()
true
if the settings were successfully savedpublic boolean hasOutcomesService()
true
if the Outcomes service is supported for the resource link (either the LTI 1.1 or extension service).true
if Outcomes service is supportedpublic boolean hasMembershipsService()
true
if the Memberships service is supported for the resource link.true
if Memberships service is supportedpublic boolean hasSettingService()
true
if the Setting service is supported for the resource link.true
if the Setting service is supported@Deprecated public boolean doOutcomesService(int action, Outcome ltiOutcome)
doOutcomesService(int, Outcome, User)
instead.
Perform an Outcomes service request.
The action type parameter should be one of the pre-defined constants.
action
- action typeltiOutcome
- Outcome objecttrue
if the request was successfully processedEXT_READ
,
EXT_WRITE
,
EXT_DELETE
public boolean doOutcomesService(int action, Outcome ltiOutcome, User user)
The action type parameter should be one of the pre-defined constants.
action
- action typeltiOutcome
- Outcome objectuser
- User objecttrue
if the request was successfully processedEXT_READ
,
EXT_WRITE
,
EXT_DELETE
public java.util.List<User> doMembershipsService(boolean withGroups)
The user table is updated with the new list of user objects. If the groups enhancement is not supported for the resource link, then only membership data will be returned.
withGroups
- true
if group information should also be requestedpublic java.lang.String doSettingService(int action)
The current setting value can also be read by using
getSetting("ext_ims_lti_tool_setting")
action
- action typeEXT_READ
,
EXT_DELETE
,
doSettingService(int,String)
,
getSetting(String)
public boolean doSettingService(int action, java.lang.String value)
action
- action typevalue
- setting value (for write actions)true
the action was successfulEXT_READ
,
EXT_WRITE
,
EXT_DELETE
,
doSettingService(int)
public java.util.Map<java.lang.String,User> getUserResultSourcedIDs(boolean localOnly, int idScope)
The array may include users from other contexts which are sharing this resource link. It uses the user ID of the specified scope as the key.
localOnly
- true
if only users from the resource link are to be returned, not users from shared contextsidScope
- scope to use for ID valuespublic java.util.List<ResourceLinkShare> getShares()
public java.util.Calendar getCreated()
public void setCreated(java.util.Calendar created)
created
- date/time of creationpublic java.util.Calendar getUpdated()
public void setUpdated(java.util.Calendar updated)
updated
- date/time of last updatepublic java.lang.String toString()
The string representation consists of the resource link ID, title, group sets, groups and settings.
toString
in class java.lang.Object