當前位置: 首頁>>代碼示例>>Java>>正文


Java CacheKeyUtils類代碼示例

本文整理匯總了Java中org.kuali.rice.core.api.cache.CacheKeyUtils的典型用法代碼示例。如果您正苦於以下問題:Java CacheKeyUtils類的具體用法?Java CacheKeyUtils怎麽用?Java CacheKeyUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CacheKeyUtils類屬於org.kuali.rice.core.api.cache包,在下文中一共展示了CacheKeyUtils類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRoleIdsForPermissionTemplate

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
protected List<String> getRoleIdsForPermissionTemplate(String namespaceCode,
        String permissionTemplateName,
        Map<String, String> permissionDetails) {
    String cacheKey =  new StringBuilder("{getRoleIdsForPermissionTemplate}")
            .append("namespaceCode=").append(namespaceCode).append("|")
            .append("permissionTemplateName=").append(permissionTemplateName).append("|")
            .append("permissionDetails=").append(CacheKeyUtils.mapKey(permissionDetails)).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<String>)cachedValue.get());
    }
	// get all the permission objects whose name match that requested
	List<Permission> permissions = getPermissionsByTemplateName(namespaceCode, permissionTemplateName);
	// now, filter the full list by the detail passed
	List<Permission> applicablePermissions = getMatchingPermissions(permissions, permissionDetails);
	List<String> roleIds = getRoleIdsForPermissions(applicablePermissions);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, roleIds);
    return roleIds;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:20,代碼來源:PermissionServiceImpl.java

示例2: getRoleIdsForPermissionIds

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
private List<String> getRoleIdsForPermissionIds(Collection<String> permissionIds) {
    if (CollectionUtils.isEmpty(permissionIds)) {
        return Collections.emptyList();
    }
    String cacheKey =  new StringBuilder("{getRoleIdsForPermissionIds}")
            .append("permissionIds=").append(CacheKeyUtils.key(permissionIds)).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<String>)cachedValue.get());
    }
    QueryByCriteria query = QueryByCriteria.Builder.fromPredicates(equal("active", Boolean.TRUE), in("permissionId", permissionIds.toArray(new String[]{})));
    QueryResults<RolePermissionBo> results = dataObjectService.findMatching(RolePermissionBo.class, query);
    List<String> roleIds = new ArrayList<String>();
    for (RolePermissionBo bo : results.getResults()) {
        roleIds.add(bo.getRoleId());
    }
    roleIds = Collections.unmodifiableList(roleIds);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, roleIds);
    return roleIds;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:21,代碼來源:PermissionServiceImpl.java

示例3: getRoleIdsForPermissionIds

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
private List<String> getRoleIdsForPermissionIds(Collection<String> permissionIds) {
    if (CollectionUtils.isEmpty(permissionIds)) {
        return Collections.emptyList();
    }
    String cacheKey =  new StringBuilder("{getRoleIdsForPermissionIds}")
            .append("permissionIds=").append(CacheKeyUtils.key(permissionIds)).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<String>)cachedValue.get());
    }
    QueryByCriteria query = QueryByCriteria.Builder.fromPredicates(equal("active", "true"), in("permissionId", permissionIds.toArray(new String[]{})));
    GenericQueryResults<RolePermissionBo> results = criteriaLookupService.lookup(RolePermissionBo.class, query);
    List<String> roleIds = new ArrayList<String>();
    for (RolePermissionBo bo : results.getResults()) {
        roleIds.add(bo.getRoleId());
    }
    roleIds = Collections.unmodifiableList(roleIds);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, roleIds);
    return roleIds;
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:21,代碼來源:PermissionServiceImpl.java

示例4: getMatchingPermissions

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
/**
 * Compare each of the passed in permissions with the given permissionDetails.  Those that
 * match are added to the result list.
 */
protected List<Permission> getMatchingPermissions( List<Permission> permissions, Map<String, String> permissionDetails ) {
    List<String> permissionIds = new ArrayList<String>(permissions.size());
    for (Permission permission : permissions) {
        permissionIds.add(permission.getId());
    }
    String cacheKey =  new StringBuilder("{getMatchingPermissions}")
            .append("permissionIds=").append(CacheKeyUtils.key(permissionIds)).append("|")
            .append("permissionDetails=").append(CacheKeyUtils.mapKey(permissionDetails)).toString();
    Cache.ValueWrapper cachedValue = cacheManager.getCache(Permission.Cache.NAME).get(cacheKey);
    if (cachedValue != null && cachedValue.get() instanceof List) {
        return ((List<Permission>)cachedValue.get());
    }

	List<Permission> applicablePermissions = new ArrayList<Permission>();    	
	if ( permissionDetails == null || permissionDetails.isEmpty() ) {
		// if no details passed, assume that all match
		for ( Permission perm : permissions ) {
			applicablePermissions.add(perm);
		}
	} else {
		// otherwise, attempt to match the permission details
		// build a map of the template IDs to the type services
		Map<String,PermissionTypeService> permissionTypeServices = getPermissionTypeServicesByTemplateId(permissions);
		// build a map of permissions by template ID
		Map<String, List<Permission>> permissionMap = groupPermissionsByTemplate(permissions);
		// loop over the different templates, matching all of the same template against the type
		// service at once
		for ( Map.Entry<String,List<Permission>> entry : permissionMap.entrySet() ) {
			PermissionTypeService permissionTypeService = permissionTypeServices.get( entry.getKey() );
			List<Permission> permissionList = entry.getValue();
applicablePermissions.addAll( permissionTypeService.getMatchingPermissions( permissionDetails, permissionList ) );    				
		}
	}
    applicablePermissions = Collections.unmodifiableList(applicablePermissions);
    cacheManager.getCache(Permission.Cache.NAME).put(cacheKey, applicablePermissions);
    return applicablePermissions;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:42,代碼來源:PermissionServiceImpl.java

示例5: buildPrincipalHasRoleCacheKey

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
private String buildPrincipalHasRoleCacheKey(String principalId, String roleId, Map<String, String> qualification, boolean checkDelegations) {
    return new StringBuilder("{principalHasRole}")
            .append("principalId=").append(principalId).append("|")
            .append("roleId=").append(roleId).append("|")
            .append("qualification=").append(CacheKeyUtils.mapKey(qualification)).append("|")
            .append("checkDelegations=").append(checkDelegations).toString();
}
 
開發者ID:aapotts,項目名稱:kuali_rice,代碼行數:8,代碼來源:RoleServiceImpl.java

示例6: buildPrincipalHasRoleCacheKey

import org.kuali.rice.core.api.cache.CacheKeyUtils; //導入依賴的package包/類
private String buildPrincipalHasRoleCacheKey(String principalId, String roleId, Map<String, String> qualification,
        boolean checkDelegations) {
    return new StringBuilder("{principalHasRole}").append("principalId=").append(principalId).append("|").append(
            "roleId=").append(roleId).append("|").append("qualification=").append(CacheKeyUtils.mapKey(
            qualification)).append("|").append("checkDelegations=").append(checkDelegations).toString();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:7,代碼來源:RoleServiceImpl.java


注:本文中的org.kuali.rice.core.api.cache.CacheKeyUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。