本文整理汇总了Java中org.sakaiproject.site.api.ToolConfiguration.getPlacementConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ToolConfiguration.getPlacementConfig方法的具体用法?Java ToolConfiguration.getPlacementConfig怎么用?Java ToolConfiguration.getPlacementConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.site.api.ToolConfiguration
的用法示例。
在下文中一共展示了ToolConfiguration.getPlacementConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setToolProperties
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
private void setToolProperties(ToolConfiguration tool, String propList) {
if(propList != null) {
for(String prop : propList.split(",")) {
if(StringUtils.isNotEmpty(prop)) {
int index = prop.indexOf(":");
if(index >= 0) {
try {
String propName = prop.substring(0, index);
String propValue = prop.substring(index+1);
if(StringUtils.isNotEmpty(propValue)) {
Properties propsedit = tool.getPlacementConfig();
propsedit.setProperty(propName, propValue);
}
} catch(Exception e){
log.error("SakaiScript: setToolProperties(): " + e.getClass().getName() + " : " + e.getMessage());
}
}
}
}
}
}
示例2: archiveSynopticOptions
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* try to add synoptic options for this tool to the archive, if they exist
* @param siteId
* @param doc
* @param element
*/
public void archiveSynopticOptions(String siteId, Document doc, Element element)
{
try
{
// archive the synoptic tool options
Site site = m_siteService.getSite(siteId);
ToolConfiguration synTool = site.getToolForCommonId("sakai.synoptic." + getLabel());
Properties synProp = synTool.getPlacementConfig();
if (synProp != null && synProp.size() > 0) {
Element synElement = doc.createElement(SYNOPTIC_TOOL);
Element synProps = doc.createElement(PROPERTIES);
Set synPropSet = synProp.keySet();
Iterator propIter = synPropSet.iterator();
while (propIter.hasNext())
{
String propName = (String)propIter.next();
Element synPropEl = doc.createElement(PROPERTY);
synPropEl.setAttribute(NAME, propName);
synPropEl.setAttribute(VALUE, synProp.getProperty(propName));
synProps.appendChild(synPropEl);
}
synElement.appendChild(synProps);
element.appendChild(synElement);
}
}
catch (Exception e)
{
log.warn("archive: exception archiving synoptic options for service: " + serviceName());
}
}
示例3: addConfigPropertyToTool
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Add a property to a tool on a page in a site
*
* @param sessionid the id of a valid session
* @param siteid the id of the site to add the page to
* @param pagetitle the title of the page the tool exists in
* @param tooltitle the title of the tool to add the property to
* @param propname the name of the property
* @param propvalue the value of the property
* @return success or exception message
* <p/>
* TODO: fix for if any values (except sessionid and siteid) are blank or invalid, it is still returning success - SAK-15334
*/
@WebMethod
@Path("/addConfigPropertyToTool")
@Produces("text/plain")
@GET
public String addConfigPropertyToTool(
@WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
@WebParam(name = "siteid", partName = "siteid") @QueryParam("siteid") String siteid,
@WebParam(name = "pagetitle", partName = "pagetitle") @QueryParam("pagetitle") String pagetitle,
@WebParam(name = "tooltitle", partName = "tooltitle") @QueryParam("tooltitle") String tooltitle,
@WebParam(name = "propname", partName = "propname") @QueryParam("propname") String propname,
@WebParam(name = "propvalue", partName = "propvalue") @QueryParam("propvalue") String propvalue) {
Session session = establishSession(sessionid);
try {
Site siteEdit = siteService.getSite(siteid);
List pageEdits = siteEdit.getPages();
for (Iterator i = pageEdits.iterator(); i.hasNext(); ) {
SitePage pageEdit = (SitePage) i.next();
if (pageEdit.getTitle().equals(pagetitle)) {
List toolEdits = pageEdit.getTools();
for (Iterator j = toolEdits.iterator(); j.hasNext(); ) {
ToolConfiguration tool = (ToolConfiguration) j.next();
Tool t = tool.getTool();
if (tool.getTitle().equals(tooltitle)) {
Properties propsedit = tool.getPlacementConfig();
propsedit.setProperty(propname, propvalue);
}
}
}
}
siteService.save(siteEdit);
} catch (Exception e) {
log.error("WS addConfigPropertyToTool(): " + e.getClass().getName() + " : " + e.getMessage());
return e.getClass().getName() + " : " + e.getMessage();
}
return "success";
}
示例4: getChannels
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Helper to get the channels for a site.
* <p>
* If user site and not superuser, returns all available channels for this
* user.<br />
*
* @param siteId
* @return
*/
private List<String> getChannels(String siteId) {
List<String> channels = new ArrayList<String>();
Site site = null;
try {
site = siteService.getSite(siteId);
} catch (IdUnusedException e) {
// this should have been caught and dealt with already so just
// return empty list
return channels;
}
if (site != null) {
ToolConfiguration toolConfig = site
.getToolForCommonId("sakai.mailbox");
if (toolConfig != null) {
Properties props = toolConfig.getPlacementConfig();
if (props.isEmpty()) {
props = toolConfig.getConfig();
}
if (props != null) {
channels = Collections.singletonList(mailArchiveService
.channelReference(siteId,
SiteService.MAIN_CONTAINER));
}
}
}
return channels;
}
示例5: archiveSynopticOptions
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* try to add synoptic options for this tool to the archive, if they exist
* @param siteId
* @param doc
* @param element
*/
public void archiveSynopticOptions(String siteId, Document doc, Element element)
{
try
{
// archive the synoptic tool options
Site site = SiteService.getSite(siteId);
ToolConfiguration synTool = site.getToolForCommonId("sakai.synoptic." + getLabel());
Properties synProp = synTool.getPlacementConfig();
if (synProp != null && synProp.size() > 0) {
Element synElement = doc.createElement(SYNOPTIC_TOOL);
Element synProps = doc.createElement(PROPERTIES);
Set synPropSet = synProp.keySet();
Iterator propIter = synPropSet.iterator();
while (propIter.hasNext())
{
String propName = (String)propIter.next();
Element synPropEl = doc.createElement(PROPERTY);
synPropEl.setAttribute(NAME, propName);
synPropEl.setAttribute(VALUE, synProp.getProperty(propName));
synProps.appendChild(synPropEl);
}
synElement.appendChild(synProps);
element.appendChild(synElement);
}
}
catch (Exception e)
{
log.warn("archive: exception archiving synoptic options for service: " + serviceName());
}
}
示例6: getChannels
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Helper to get the channels for a site.
* <p>
* If user site and not superuser, returns all available channels for this user.<br />
* If user site and superuser, return all merged channels.<br />
* If normal site, returns all merged channels.<br />
* If motd site, returns the motd channel.
*
* @param siteId
* @return
*/
private List<String> getChannels(String siteId) {
List<String> channels = new ArrayList<String>();
//if motd
if(StringUtils.equals(siteId, MOTD_SITEID)) {
log.debug("is motd site, returning motd channel");
channels = Collections.singletonList(announcementService.channelReference(siteId, MOTD_CHANNEL_SUFFIX));
return channels;
}
//if user site
if(siteService.isUserSite(siteId)) {
//if not super user, get all channels this user has access to
if(!securityService.isSuperUser()){
log.debug("is user site and not super user, returning all permitted channels");
channels = Arrays.asList(new MergedList().getAllPermittedChannels(new AnnouncementChannelReferenceMaker()));
return channels;
}
}
//this is either a normal site, or we are a super user
//so get the merged announcements for this site
Site site = null;
try {
site = siteService.getSite(siteId);
} catch (IdUnusedException e) {
//this should have been caught and dealt with already so just return empty list
return channels;
}
if(site != null) {
ToolConfiguration toolConfig = site.getToolForCommonId("sakai.announcements");
if(toolConfig != null){
Properties props = toolConfig.getPlacementConfig();
if(props.isEmpty()) {
props = toolConfig.getConfig();
}
if(props != null){
String mergeProp = (String)props.get(PORTLET_CONFIG_PARAM_MERGED_CHANNELS);
if(StringUtils.isNotBlank(mergeProp)) {
log.debug("is normal site or super user, returning all merged channels in this site");
log.debug("mergeProp: {}", mergeProp);
channels = Arrays.asList(new MergedList().getChannelReferenceArrayFromDelimitedString(new AnnouncementChannelReferenceMaker().makeReference(siteId), mergeProp));
} else {
log.debug("is normal site or super user but no merged channels, using original siteId channel");
channels = Collections.singletonList(announcementService.channelReference(siteId, SiteService.MAIN_CONTAINER));
}
}
}
}
return channels;
}
示例7: BaseToolConfiguration
import org.sakaiproject.site.api.ToolConfiguration; //导入方法依赖的package包/类
/**
* Construct as a copy of another.
*
* @param other
* The other to copy.
* @param page
* The page in which this tool lives.
* @param exact
* If true, we copy ids - else we generate a new one.
*/
protected BaseToolConfiguration(BaseSiteService siteService, ToolConfiguration other, SitePage page, boolean exact)
{
this.siteService = siteService;
m_page = page;
BaseToolConfiguration bOther = (BaseToolConfiguration) other;
if (exact)
{
m_id = other.getId();
}
else
{
m_id = siteService.idManager().createUuid();
}
m_toolId = other.getToolId();
m_tool = other.getTool();
m_title = other.getTitle();
m_layoutHints = other.getLayoutHints();
m_pageId = bOther.m_pageId;
m_pageOrder = bOther.m_pageOrder;
m_custom_title = getTitleCustom(page);
m_siteId = getContainingPage().getContainingSite().getId();
m_skin = bOther.m_skin;
Hashtable h = other.getPlacementConfig();
// exact copying of ToolConfiguration items vs replacing occurence of
// site id within item value, depending on "exact" setting -zqian
if (exact)
{
m_config.putAll(other.getPlacementConfig());
}
else
{
for (Enumeration e = h.keys(); e.hasMoreElements();)
{
// replace site id string inside configuration
String pOtherConfig = (String) e.nextElement();
String pOtherConfigValue = (String) h.get(pOtherConfig);
m_config.put(pOtherConfig, pOtherConfigValue.replaceAll(bOther
.getSiteId(), m_siteId));
}
}
m_configLazy = bOther.m_configLazy;
setPageCategory();
}