本文整理汇总了Java中org.sakaiproject.site.api.ToolConfiguration.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ToolConfiguration.getId方法的具体用法?Java ToolConfiguration.getId怎么用?Java ToolConfiguration.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.site.api.ToolConfiguration
的用法示例。
在下文中一共展示了ToolConfiguration.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContentItemUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getContentItemUrl(Site site) {
if ( site == null ) return null;
ToolConfiguration toolConfig = site.getToolForCommonId("sakai.siteinfo");
if (toolConfig == null) return null;
// SAK-32656 For now we always show the cart.
// Un-comment these lines to make the cart only appear when tools are
// available at a cost of one SQL query per request/response cycle.
/*
// Check if we have any registered ContentItem editor tools
LTIService ltiService = (LTIService) ComponentManager.get("org.sakaiproject.lti.api.LTIService");
List<Map<String, Object>> toolsContentItem = ltiService.getToolsContentEditor(placement.getContext());
if ( toolsContentItem.size() < 1 ) return null;
*/
// Now we are in good shape, make the URL
String helper_url = "/portal/tool/"+toolConfig.getId()+"/sakai.basiclti.admin.helper.helper?panel=CKEditor";
return helper_url;
}
示例2: getUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getUrl() {
Site site = null;
ToolConfiguration siteTool = null;
try {
site = SiteService.getSite(ToolManager.getCurrentPlacement().getContext());
siteTool = site.getToolForCommonId("sakai.mneme");
} catch (Exception e) {
return null;
}
if (siteTool == null)
return null;
return ServerConfigurationService.getToolUrl()+ "/" + siteTool.getId() + "/enter/" + id;
}
示例3: toolPlacementInSite
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
private String toolPlacementInSite(String siteId, String toolId) throws Exception{
Site thisSite = null;
String placementId = null;
try {
thisSite = siteService.getSite(siteId);
} catch (IdUnusedException e) {
throw e;
}
List thisSitePages = thisSite.getPages();
boolean toolNotFound = true;
Iterator pageIterator = thisSitePages.iterator();
while(pageIterator.hasNext() && toolNotFound){
SitePage thisPage = (SitePage) pageIterator.next();
List sitePageTools = thisPage.getTools();
Iterator sitePageToolIterator = sitePageTools.iterator();
while(sitePageToolIterator.hasNext() && toolNotFound){
ToolConfiguration thisToolConfiguration = (ToolConfiguration) sitePageToolIterator.next();
if(thisToolConfiguration.getToolId().equalsIgnoreCase(toolId)){
toolNotFound = false;
placementId = thisToolConfiguration.getId();
}
}
}
if(toolNotFound){
throw new Exception("tool not placed in:"+siteId);
}else{
return placementId;
}
}
示例4: getCommonsToolId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getCommonsToolId(String siteId) {
try {
Site site = siteService.getSite(siteId);
ToolConfiguration tc = site.getToolForCommonId("sakai.commons");
return tc.getId();
} catch (Exception e) {
return "";
}
}
示例5: getPlacementId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Get the placement ID for a given tool in the given site
*
* @param sessionid valid session
* @param siteId ID of the site we are looking at
* @param toolId tool id eg. "sakai.gradebook.gwt.rpc", we are looking for
* @return first placement id found in the site for the given tool. If the tool/site is not found, the response will be empty.
* @
*/
@WebMethod
@Path("/getPlacementId")
@Produces("text/plain")
@GET
public String getPlacementId(
@WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
@WebParam(name = "siteId", partName = "siteId") @QueryParam("siteId") String siteId,
@WebParam(name = "toolId", partName = "toolId") @QueryParam("toolId") String toolId) {
// register the session with presence
Session s = establishSession(sessionid);
try {
Site site = siteService.getSite(siteId);
// log.warn("found site" + siteId);
if (site != null) {
ToolConfiguration toolConfiguration = site.getToolForCommonId(toolId);
if (toolConfiguration != null) {
return toolConfiguration.getId();
}
}
} catch (Throwable t) {
log.warn(this + "getPlacementId(): Error encountered: " + t.getMessage(), t);
}
return "";
}
示例6: getInlineRenderingForTool
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Renders the content of a tool into a {@link BufferedContentRenderResult}
* @param res {@link HttpServletResponse}
* @param req {@link HttpServletRequest}
* @param placement {@link ToolConfiguration}
* @return {@link BufferedContentRenderResult} with a head and body representing the appropriate bits for the tool or null if unable to render.
*/
RenderResult getInlineRenderingForTool(HttpServletResponse res, HttpServletRequest req, ToolConfiguration placement) {
RenderResult rval = null;
// allow a final chance for a tool to be inlined, based on it's tool configuration
// set renderInline = true to enable this
boolean renderInline = BooleanUtils.toBoolean(placement.getConfig().getProperty("renderInline"));
if(renderInline) {
//build tool context path directly to the tool
String toolContextPath = req.getContextPath() + req.getServletPath() + "/site/" + placement.getSiteId() + "/tool/" + placement.getId();
// setup the rest of the params
String[] parts = getParts(req);
String toolPathInfo = Web.makePath(parts, 5, parts.length);
Session session = SessionManager.getCurrentSession();
// get the buffered content
Object buffer = this.siteHandler.bufferContent(req, res, session, placement.getId(), toolContextPath, toolPathInfo, placement);
if (buffer instanceof Map) {
Map<String,String> bufferMap = (Map<String,String>) buffer;
rval = new BufferedContentRenderResult(placement, bufferMap.get("responseHead"), bufferMap.get("responseBody"));
}
}
return rval;
}
示例7: getUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getUrl() {
if (simplePageBean != null) {
return ServerConfigurationService.getToolUrl() + "/" + simplePageBean.getCurrentTool("sakai.assignment2") +
"/student-submit/" + id;
}
Site site = null;
try {
site = SiteService.getSite(ToolManager.getCurrentPlacement().getContext());
} catch (Exception impossible) {
return null;
}
ToolConfiguration tool = site.getToolForCommonId("sakai.assignment2");
if(tool == null) {
return null;
}
String placement = tool.getId();
return ServerConfigurationService.getToolUrl()+ "/" + placement + "/student-submit/" + id;
// following is broken in 2.8.1
// return "/direct/assignment2/" + id;
}
示例8: getCurrentTool
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getCurrentTool(String commonToolId) {
try {
String currentSiteId = toolManager.getCurrentPlacement().getContext();
Site site = siteService.getSite(currentSiteId);
ToolConfiguration toolConfig = site.getToolForCommonId(commonToolId);
if (toolConfig == null) return null;
return toolConfig.getId();
} catch (Exception e) {
return null;
}
}
示例9: getUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getUrl() {
if (url != null)
return url;
String siteId = toolManager.getCurrentPlacement().getContext();
Site site = null;
try {
site = SiteService.getSite(siteId);
} catch (Exception impossible) {
return null;
}
ToolConfiguration siteTool = site.getToolForCommonId("sakai.jforum.tool");
// LSNBLDR-21. If the tool is not in the current site we shouldn't return a url
if(siteTool == null) {
return null;
}
String prefix = null;
try {
// String toolid = "8f83cd4b-74ca-4428-0055-85ddd19a8d00";
prefix = ServerConfigurationService.getToolUrl() + "/" + siteTool.getId();
// String toolid = "8f83cd4b-74ca-4428-0055-85ddd19a8d00";
} catch (Exception e) {
log.info("tool problem " + e);
return null;
}
if (type == TYPE_JFORUM_TOPIC)
url = prefix + "/posts/list/" + id + ".page";
else if (type == TYPE_JFORUM_CATEGORY)
url = prefix + "/forums/list.page"; // no way to go directly to a category
else // forum
url = prefix + "/forums/show/" + id + ".page";
return url;
}
示例10: getUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getUrl() {
if (simplePageBean != null) {
return ServerConfigurationService.getToolUrl() + "/" + simplePageBean.getCurrentTool("sakai.assignment.grades") +
"?assignmentReference=/assignment/a/" + simplePageBean.getCurrentSiteId() + "/" + id + "&panel=Main&sakai_action=doView_submission";
}
Site site = null;
try {
site = SiteService.getSite(ToolManager.getCurrentPlacement().getContext());
} catch (Exception impossible) {
return null;
}
ToolConfiguration tool = site.getToolForCommonId("sakai.assignment.grades");
if(tool == null) {
return null;
}
String placement = tool.getId();
// https://sakai-test2.oirt.rutgers.edu/portal/tool/6b328952-cbcb-494b-0035-3c07120e4499?assignmentReference=/assignment/a/0aaae6ef-cb01-4578-0099-888d344b524b/0e52c5f6-ba73-40d2-961c-286533d59148&panel=Main&sakai_action=doView_submission
return ServerConfigurationService.getToolUrl() + "/" + placement + "?assignmentReference=/assignment/a/" + site.getId() + "/" + id + "&panel=Main&sakai_action=doView_submission";
// following was broken in 2.8.1
// return "/direct/assignment/" + id;
}
示例11: getUrl
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getUrl() {
if (type == TYPE_FORUM_TOPIC) {
if (topic == null)
topic = getTopicById(true, id);
if (topic == null)
return "javascript:alert('" + messageLocator.getMessage("simplepage.forumdeleted") + "')";
} else {
if (forum == null)
forum = getForumById(true, id);
if (forum == null)
return "javascript:alert('" + messageLocator.getMessage("simplepage.forumdeleted") + "')";
}
Site site = null;
try {
site = SiteService.getSite(ToolManager.getCurrentPlacement().getContext());
} catch (Exception impossible) {
return null;
}
ToolConfiguration tool = site.getToolForCommonId("sakai.forums");
// LSNBLDR-21. If the tool is not in the current site we shouldn't return a url
if(tool == null) {
return null;
}
String placement = tool.getId();
if (type == TYPE_FORUM_TOPIC)
// if /direct doesn't work, but that was only in one beta release
// return "/messageforums-tool/jsp/discussionForum/message/dfAllMessagesDirect.jsf?topicId=" + id + "&placementId=" + placement;
return "/direct/forum_topic/" + id;
else
return "/direct/forum/" + id;
}
示例12: saveToolConfigTx
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* The transactino code for saving a tool config.
*/
protected void saveToolConfigTx(ToolConfiguration tool)
{
// delete this tool and tool properties
Object fields[] = new Object[2];
fields[0] = caseId(tool.getSiteId());
fields[1] = caseId(tool.getId());
String statement = siteServiceSql.getDeleteToolPropertySql();
m_sql.dbWrite(statement, fields);
statement = siteServiceSql.getDeleteToolSql();
m_sql.dbWrite(statement, fields);
// write the tool
statement = siteServiceSql.getInsertToolSql();
fields = new Object[7];
fields[0] = tool.getId();
fields[1] = tool.getPageId();
fields[2] = caseId(tool.getSiteId());
fields[3] = tool.getToolId();
fields[4] = Integer.valueOf(tool.getPageOrder());
fields[5] = tool.getTitle();
fields[6] = tool.getLayoutHints();
m_sql.dbWrite(statement, fields);
// write the tool's properties
writeProperties("SAKAI_SITE_TOOL_PROPERTY", "TOOL_ID", tool.getId(), "SITE_ID", caseId(tool.getSiteId()), tool.getPlacementConfig());
}
示例13: getMessagesPlacementId
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
public String getMessagesPlacementId(){
if(site == null)
return "";
String messagesPlacementId = "";
ToolConfiguration tc = site.getToolForCommonId("sakai.messages");
if(tc != null){
messagesPlacementId = tc.getId();
}
return messagesPlacementId;
}
示例14: getMCPageURL
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Returns the URL using a helper to go to MC home page directly.
*
* @return String A URL so the user can click to go to Message Center.
* Needed since tool could possibly by in MyWorkspace
*/
private String getMCPageURL(String siteId) {
ToolConfiguration mcTool = null;
String url = null;
try {
String toolId = "";
final Site site = getSite(siteId);
if (isMessageForumsPageInSite(site)) {
toolId = DiscussionForumService.MESSAGE_CENTER_ID;
}
else if (isForumsPageInSite(site)) {
toolId = DiscussionForumService.FORUMS_TOOL_ID;
}
else if (isMessagesPageInSite(site)) {
toolId = DiscussionForumService.MESSAGES_TOOL_ID;
}
mcTool = site.getToolForCommonId(toolId);
if (mcTool != null) {
if (toolId == DiscussionForumService.MESSAGE_CENTER_ID) {
url = ServerConfigurationService.getPortalUrl() + "/directtool/"
+ mcTool.getId() + "/sakai.messageforums.helper.helper/main";
}
else if (toolId == DiscussionForumService.FORUMS_TOOL_ID) {
url = ServerConfigurationService.getPortalUrl() + "/directtool/"
+ mcTool.getId() + "/sakai.messageforums.helper.helper/discussionForum/forumsOnly/dfForums";
}
else if (toolId == DiscussionForumService.MESSAGES_TOOL_ID) {
url = ServerConfigurationService.getPortalUrl() + "/directtool/"
+ mcTool.getId() + "/sakai.messageforums.helper.helper/privateMsg/pvtMsgHpView";
}
}
}
catch (IdUnusedException e) {
// Weirdness since site ids used gotten from SiteService
log.error("IdUnusedException while trying to check if site has MF tool.");
}
return url;
}
示例15: getDeepLinkWithPermissions
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
@Override
public String getDeepLinkWithPermissions(String context, String assignmentId, boolean allowReadAssignment, boolean allowAddAssignment, boolean allowSubmitAssignment) throws Exception {
Assignment a = getAssignment(assignmentId);
String assignmentContext = a.getContext(); // assignment context
if (allowReadAssignment && a.getOpenDate().isBefore(ZonedDateTime.now().toInstant())) {
// this checks if we want to display an assignment link
try {
Site site = siteService.getSite(assignmentContext);
// site id
ToolConfiguration fromTool = site.getToolForCommonId("sakai.assignment.grades");
// Three different urls to be rendered depending on the
// user's permission
if (allowAddAssignment) {
return serverConfigurationService.getPortalUrl()
+ "/directtool/"
+ fromTool.getId()
+ "?assignmentId=" + assignmentId + "&assignmentReference="
+ AssignmentReferenceReckoner.reckoner().context(context).id(assignmentId).reckon().getReference()
+ "&panel=Main&sakai_action=doView_assignment";
} else if (allowSubmitAssignment) {
return serverConfigurationService.getPortalUrl()
+ "/directtool/"
+ fromTool.getId()
+ "?assignmentId=" + assignmentId + "&assignmentReference="
+ AssignmentReferenceReckoner.reckoner().context(context).id(assignmentId).reckon().getReference()
+ "&panel=Main&sakai_action=doView_submission";
} else {
// user can read the assignment, but not submit, so
// render the appropriate url
return serverConfigurationService.getPortalUrl()
+ "/directtool/"
+ fromTool.getId()
+ "?assignmentId=" + assignmentId + "&assignmentReference="
+ AssignmentReferenceReckoner.reckoner().context(context).id(assignmentId).reckon().getReference()
+ "&panel=Main&sakai_action=doView_assignment_as_student";
}
} catch (IdUnusedException e) {
// No site found
throw new IdUnusedException("No site found while creating assignment url");
}
}
return "";
}