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


Java Cache类代码示例

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


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

示例1: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    // get request parameters
    Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
    String name = templateVars.get("name");

    // get specified parameter constraint
    ParameterConstraint parameterConstraint = actionService.getParameterConstraint(name);

    if (parameterConstraint == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find parameter constraint with name: " + name);
    }

    model.put("actionConstraint", parameterConstraint);

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:ActionConstraintGet.java

示例2: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>();

    NodeRef nodeRef = parseRequestForNodeRef(req);
    String ratingSchemeName = parseRequestForScheme(req);
    
    Rating deletedRating = ratingService.removeRatingByCurrentUser(nodeRef, ratingSchemeName);
    if (deletedRating == null)
    {
        // There was no rating in the specified scheme to delete.
        throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Unable to delete non-existent rating: "
                + ratingSchemeName + " from " + nodeRef.toString());
    }
    
    model.put(NODE_REF, nodeRef.toString());
    model.put(AVERAGE_RATING, ratingService.getAverageRating(nodeRef, ratingSchemeName));
    model.put(RATINGS_TOTAL, ratingService.getTotalRating(nodeRef, ratingSchemeName));
    model.put(RATINGS_COUNT, ratingService.getRatingsCount(nodeRef, ratingSchemeName));
  
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:RatingDelete.java

示例3: buildModel

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)
{
    Map<String, String> params = req.getServiceMatch().getTemplateVars();

    // Get the definition id from the params
    String workflowDefinitionId = params.get(PARAM_WORKFLOW_DEFINITION_ID);
    
    WorkflowDefinition workflowDefinition = workflowService.getDefinitionById(workflowDefinitionId);

    // Workflow definition is not found, 404
    if (workflowDefinition == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, 
                    "Unable to find workflow definition with id: " + workflowDefinitionId);
    }
    
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("workflowDefinition", modelBuilder.buildDetailed(workflowDefinition));
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:WorkflowDefinitionGet.java

示例4: buildModel

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)
{
    Map<String, String> params = req.getServiceMatch().getTemplateVars();

    // getting workflow instance id from request parameters
    String workflowInstanceId = params.get("workflow_instance_id");

    boolean includeTasks = getIncludeTasks(req);

    WorkflowInstance workflowInstance = workflowService.getWorkflowById(workflowInstanceId);

    // task was not found -> return 404
    if (workflowInstance == null)
    {
        throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find workflow instance with id: " + workflowInstanceId);
    }

    Map<String, Object> model = new HashMap<String, Object>();
    // build the model for ftl
    model.put("workflowInstance", modelBuilder.buildDetailed(workflowInstance, includeTasks));

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:WorkflowInstanceGet.java

示例5: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
	LOGGER.debug("Get Monitor jobs");

	// get parameters
	final Integer limitNumberOfNodesParam = NumberUtils.acquireIntParameter(req.getParameter("limit"));
	final Integer limitNumberOfNodes = limitNumberOfNodesParam!=null?limitNumberOfNodesParam:Integer.valueOf(limit);
	String jobOperation = req.getParameter("jobOperation");
	String jobStatus = req.getParameter("jobStatus");

	final List<JobHistory> historicalJobs = monitorSearchService.getJobsHistory(limitNumberOfNodes, jobOperation, jobStatus);

	final Map<String, Object> model = new HashMap<>();
	model.put("jobs", historicalJobs);
	model.put("limit", limitNumberOfNodes);
	model.put("jobOperation", jobOperation);
	model.put("jobStatus", jobStatus);

	return model;
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:21,代码来源:JobsActionHistoryWebscript.java

示例6: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
	LOGGER.debug("Initiate run calculation");
	
	// get parameters
	int numberOfNodes = acquireIntParameter(req, "numberOfNodes");
	int hierarchyDepth = acquireIntParameter(req, "hierarchyDepth");
	
	// TODO: change company home to some custom node 
	final NodeRef jobNode = job.createNodesHierarchyJob(repositoryHelper.getCompanyHome(), numberOfNodes, hierarchyDepth);
	monitorService.runMonitorOperation(jobNode);

	final Map<String, Object> model = new HashMap<>();
	super.executeImpl(req, status, cache);
	model.put("jobNode", jobNode.toString());
	model.put("numberOfNodes", numberOfNodes);
	model.put("hierarchyDepth", hierarchyDepth);
	
	return model;
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:21,代码来源:JobNodesHierarchyWebscript.java

示例7: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
/**
 * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(WebScriptRequest, Status, Cache)
 */
@Override
protected Map<String, Object> executeImpl(WebScriptRequest request, Status status, Cache cache)
{
    Map<String, Object> result = new HashMap<String, Object>();
    
    cache.setNeverCache(true);
    
    LicenseDescriptor licenseDescriptor = descriptorService.getLicenseDescriptor();
    boolean isEnterprise = (licenseDescriptor == null ? false : (licenseDescriptor.getLicenseMode() == LicenseMode.ENTERPRISE));

    result.put(IS_ENTERPRISE, Boolean.valueOf(isEnterprise));
    result.put(RESULT_IMPORT_STATUS, bulkImporter.getStatus());
    
    return(result);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:19,代码来源:BulkFilesystemImportStatusWebScript.java

示例8: buildModel

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder, 
                                         WebScriptRequest req, Status status, Cache cache)
{
    // Which definition did they ask for?
    String replicationDefinitionName = 
       req.getServiceMatch().getTemplateVars().get("replication_definition_name");
    ReplicationDefinition replicationDefinition =
       replicationService.loadReplicationDefinition(replicationDefinitionName);
    
    // Does it exist?
    if(replicationDefinition == null) {
       throw new WebScriptException(
             Status.STATUS_NOT_FOUND, 
             "No Replication Definition found with that name"
       );
    }
   
    // Have it turned into simple models
    return modelBuilder.buildDetails(replicationDefinition);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:ReplicationDefinitionGet.java

示例9: buildModel

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(ReplicationModelBuilder modelBuilder, 
                                         WebScriptRequest req, Status status, Cache cache)
{
    // Get all the defined replication definitions
    List<ReplicationDefinition> definitions = replicationService.loadReplicationDefinitions();
    
    // How do we need to sort them?
    Comparator<Map<String,Object>> sorter = new ReplicationModelBuilder.SimpleSorterByName();
    String sort = req.getParameter("sort");
    if(sort == null) {
       // Default was set above
    } else if(sort.equalsIgnoreCase("status")) {
       sorter = new ReplicationModelBuilder.SimpleSorterByStatus();
    } else if(sort.equalsIgnoreCase("lastRun") ||
          sort.equalsIgnoreCase("lastRunTime")) {
       sorter = new ReplicationModelBuilder.SimpleSorterByLastRun();
    }
    
    // Have them turned into simple models
    return modelBuilder.buildSimpleList(definitions, sorter);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:ReplicationDefinitionsGet.java

示例10: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(SiteInfo site, NodeRef nodeRef,
      TopicInfo topic, PostInfo post, WebScriptRequest req, JSONObject json,
      Status status, Cache cache) 
{
   // Build the common model parts
   Map<String, Object> model = buildCommonModel(site, topic, post, req);
   
   // Did they want just one post, or the whole of the topic?
   if (post != null)
   {
      model.put(KEY_POSTDATA, renderPost(post, site));
   }
   else if (topic != null)
   {
      model.put(KEY_POSTDATA, renderTopic(topic, site));
   }
   else
   {
      String error = "Node was of the wrong type, only Topic and Post are supported";
      throw new WebScriptException(Status.STATUS_BAD_REQUEST, error);
   }
   
   // All done
   return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:ForumPostGet.java

示例11: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
    Map<String, Object> model = new HashMap<String, Object>(7);
    
    boolean updated = repoAdminService.updateUsage(UsageType.USAGE_ALL);
    RepoUsage repoUsage = repoAdminService.getUsage();
    
    putUsageInModel(model, repoUsage, updated);
    
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug("Result: \n\tRequest: " + req + "\n\tModel: " + model);
    }
    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:18,代码来源:RepoUsagePost.java

示例12: executeImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req,
      Status status, Cache cache) 
{
   Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
   
   // Site is optional
   SiteInfo site = null;
   String siteName = templateVars.get("site");
   if (siteName != null)
   {
      site = siteService.getSite(siteName);
      
      // MNT-3053 fix, siteName was provided in request but it doesn't exists or user has no permissions to access it.
      if (site == null)
      {
          status.setCode(HttpServletResponse.SC_NOT_FOUND, "Site '" + siteName + "' does not exist or user has no permissions to access it.");
          return null;
      }
   }
   
   return executeImpl(site, null, req, null, status, cache);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:UserCalendarEntriesGet.java

示例13: unprotectedExecuteImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
{
    try
    {
        SolrFacetProperties fp = parseRequestForFacetProperties(req);
        facetService.createFacetNode(fp);

        if (logger.isDebugEnabled())
        {
            logger.debug("Created facet node: " + fp);
        }
    }
    catch (Throwable t)
    {
        throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not save the facet configuration.", t);
    }

    return new HashMap<>(); // Needs to be mutable.
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:SolrFacetConfigAdminPost.java

示例14: unprotectedExecuteImpl

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache)
{
    // get the filterID parameter.
    Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
    String filterID = templateVars.get("filterID");

    if (filterID == null)
    {
        throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Filter id not provided");
    }
    facetService.deleteFacet(filterID);

    Map<String, Object> model = new HashMap<String, Object>(1);
    model.put("success", true);

    if (logger.isDebugEnabled())
    {
        logger.debug("Facet [" + filterID + "] has been deleted successfully");
    }

    return model;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:24,代码来源:SolrFacetConfigAdminDelete.java

示例15: buildModel

import org.springframework.extensions.webscripts.Cache; //导入依赖的package包/类
@Override
protected Map<String, Object> buildModel(WorkflowModelBuilder modelBuilder, WebScriptRequest req, Status status, Cache cache)
{
    Map<String, String> params = req.getServiceMatch().getTemplateVars();

    // getting workflow instance id from request parameters
    String workflowInstanceId = params.get("workflow_instance_id");
    
    // determine if instance should be cancelled or deleted
    boolean forced = getForced(req);

    if (canUserEndWorkflow(workflowInstanceId))
    {
        if (forced)
        {
            workflowService.deleteWorkflow(workflowInstanceId);
        }
        else
        {
            workflowService.cancelWorkflow(workflowInstanceId);
        }
        
        return null;
    }
    else
    {
        throw new WebScriptException(HttpServletResponse.SC_FORBIDDEN, "Failed to " + 
                    (forced ? "delete" : "cancel") + " workflow instance with id: " + workflowInstanceId);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:31,代码来源:WorkflowInstanceDelete.java


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