当前位置: 首页>>代码示例>>Java>>正文


Java FeedTaskProcessor类代码示例

本文整理汇总了Java中org.alfresco.repo.activities.feed.FeedTaskProcessor的典型用法代码示例。如果您正苦于以下问题:Java FeedTaskProcessor类的具体用法?Java FeedTaskProcessor怎么用?Java FeedTaskProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FeedTaskProcessor类属于org.alfresco.repo.activities.feed包,在下文中一共展示了FeedTaskProcessor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFeedTaskProcessor

import org.alfresco.repo.activities.feed.FeedTaskProcessor; //导入依赖的package包/类
public void setFeedTaskProcessor(FeedTaskProcessor feedTaskProcessor)
{
    this.feedTaskProcessor = feedTaskProcessor;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:LocalFeedGridJob.java

示例2: executeImpl

import org.alfresco.repo.activities.feed.FeedTaskProcessor; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status)
{
    // retrieve requested format
    String format = req.getFormat();
    if (format == null || format.length() == 0)
    {
        format = getDescription().getDefaultFormat();
    }
    
    String extensionPath = req.getExtensionPath();
    String[] extParts = extensionPath == null ? new String[1] : extensionPath.split("/");
    
    String siteId = null;
    if (extParts.length == 1)
    {
       siteId = extParts[0];
    }
    else
    {
        throw new AlfrescoRuntimeException("Unexpected extension: " + extensionPath);
    }
    
    // map feed collection format to feed entry format (if not the same), eg.
    //     atomfeed -> atomentry
    //     atom     -> atomentry
    if (format.equals("atomfeed") || format.equals("atom"))
    {
       format = "atomentry";
    }
    
    Map<String, Object> model = new HashMap<String, Object>();
    
    try
    {
        List<String> feedEntries = activityService.getSiteFeedEntries(siteId);
        
        
        if (format.equals(FeedTaskProcessor.FEED_FORMAT_JSON))
        { 
            model.put("feedEntries", feedEntries);
            model.put("siteId", siteId);
        }
        else
        {
            List<Map<String, Object>> activityFeedModels = new ArrayList<Map<String, Object>>();
            try
            { 
                for (String feedEntry : feedEntries)
                {
                    activityFeedModels.add(JSONtoFmModel.convertJSONObjectToMap(feedEntry));
                }
            }
            catch (JSONException je)
            {    
                throw new AlfrescoRuntimeException("Unable to get user feed entries: " + je.getMessage());
            }
            
            model.put("feedEntries", activityFeedModels);
            model.put("siteId", siteId);
        }
    }
    catch (AccessDeniedException ade)
    {
        // implies that site either does not exist or is private (and current user is not admin or a member) - hence return 401 (unauthorised)
        String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
        status.setCode(Status.STATUS_UNAUTHORIZED);
        logger.warn("Unable to get site feed entries for '" + siteId + "' (site does not exist or is private) - currently logged in as '" + currentUser +"'");
        
        model.put("feedEntries", null);
        model.put("siteId", "");
    }
    
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:76,代码来源:SiteFeedRetrieverWebScript.java


注:本文中的org.alfresco.repo.activities.feed.FeedTaskProcessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。