-
-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAK-50756 Tags new endpoint to get assignments #13107
base: master
Are you sure you want to change the base?
Conversation
private SessionManager sessionManager = (SessionManager) ComponentManager.get("org.sakaiproject.tool.api.SessionManager"); | ||
private SessionManager sessionManager = (SessionManager) ComponentManager.get("org.sakaiproject.tool.api.SessionManager"); | ||
|
||
private AssignmentService assignmentService = (AssignmentService) ComponentManager.get("org.sakaiproject.assignment.api.AssignmentService");; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It propbably makes sense to use the entity manager vs the assignment service directly as your only retrieving assignments.
Also it would be ideal to migrate away from using the ComponentManager directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the approach deleting the use of assignment service, the endpoint could be used for other tools.
String assignmentId = wp.getString("assignmentId"); | ||
|
||
Assignment assignment = assignmentService.getAssignment(assignmentId); | ||
String siteId = assignment.getContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SiteId should be a param , this can be called from other tools too. Method should be renamed too
e5ee466
to
49096d1
Compare
try { | ||
WrappedParams wp = new WrappedParams(params); | ||
String itemId = wp.getString("itemId"); | ||
String siteId = wp.getString("siteId"); | ||
|
||
List<Tag> tagList = tagService().getAssociatedTagsForItem(siteId, itemId); | ||
|
||
return buildtagJsonOject(tagList, tagList.size()); | ||
} catch (Exception e) { | ||
log.error("Error calling getTagsByItemId:", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try { | |
WrappedParams wp = new WrappedParams(params); | |
String itemId = wp.getString("itemId"); | |
String siteId = wp.getString("siteId"); | |
List<Tag> tagList = tagService().getAssociatedTagsForItem(siteId, itemId); | |
return buildtagJsonOject(tagList, tagList.size()); | |
} catch (Exception e) { | |
log.error("Error calling getTagsByItemId:", e); | |
WrappedParams wp = new WrappedParams(params); | |
String itemId = wp.getString("itemId"); | |
String siteId = wp.getString("siteId"); | |
try { | |
List<Tag> tagList = tagService().getAssociatedTagsForItem(siteId, itemId); | |
return buildtagJsonOject(tagList, tagList.size()); | |
} catch (Exception e) { | |
log.warn("Could not get tag with itemId={} in site={}, {}", itemId, siteId, e); |
https://sakaiproject.atlassian.net/browse/SAK-50756