View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.rule.service.impl;
17  
18  import org.kuali.rice.kew.rule.service.RuleDelegationCacheProcessor;
19  import org.kuali.rice.kew.service.KEWServiceLocator;
20  import org.kuali.rice.kew.util.PerformanceLogger;
21  
22  public class RuleDelegationCacheProcessorImpl implements RuleDelegationCacheProcessor {
23  
24  	private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(RuleDelegationCacheProcessorImpl.class);
25  	
26  	public void clearRuleDelegationFromCache(Long responsibilityId) {
27  		PerformanceLogger logger = new PerformanceLogger();
28  		if (responsibilityId != null) {
29  			flushListFromCache(responsibilityId);
30  		}
31  		logger.log("Time to notify cache of rule delegation change for responsibility id=" + responsibilityId);
32  	}
33  	
34  	protected void flushListFromCache(Long responsibilityId) {
35      	String responsibilityIdStr = responsibilityId.toString();
36          LOG.info("Flushing delegation rules from Cache for responsibilityId='" + responsibilityIdStr );
37          KEWServiceLocator.getCacheAdministrator().flushEntry(getRuleDlgnCacheKey(responsibilityIdStr));
38      }
39  	
40  	protected String getRuleDlgnCacheKey(String responsibilityIdStr) {
41          return "RuleDlgnCache:" + responsibilityIdStr;
42      }
43  	
44  }