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


Java CompensationKind类代码示例

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


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

示例1: evaluate

import eu.atos.sla.datamodel.ICompensationDefinition.CompensationKind; //导入依赖的package包/类
@Override
public List<? extends ICompensation> evaluate(
		IAgreement agreement, IGuaranteeTerm term, List<IViolation> newViolations, Date now) {
	
	logger.debug("Evaluating business for {} new violations", newViolations.size());
	List<ICompensation> result = new ArrayList<ICompensation>();
	IBusinessValueList businessValues = term.getBusinessValueList();
	if (businessValues == null) {
		/*
		 * sanity check
		 */
		return Collections.emptyList();
	}
	for (IPenaltyDefinition penaltyDef : businessValues.getPenalties()) {
		if (penaltyDef.getKind() != CompensationKind.CUSTOM_PENALTY) {
			continue;
		}
		Date violationsBegin = new Date(now.getTime() - penaltyDef.getTimeInterval().getTime());
		/*
		 * TODO: violationsBegin should be max(violationsBegin, select last(penalty) where penalty.definition = def
		 */
		List<IViolation> oldViolations = 
				repository.getViolationsByTimeRange(agreement, term.getName(), violationsBegin, now);
		
		if (thereIsPenalty(penaltyDef, newViolations, oldViolations)) {
			
			IPenalty penalty = new Penalty(
					agreement.getAgreementId(),
					now,
					term.getKpiName(),
					penaltyDef, 
					getLastViolation(newViolations, oldViolations));
			result.add(penalty);
			logger.debug("Raised {}", penalty);
		}
	}
	return result;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:39,代码来源:SimpleBusinessValuesEvaluator.java

示例2: evaluate

import eu.atos.sla.datamodel.ICompensationDefinition.CompensationKind; //导入依赖的package包/类
@Override
public List<? extends ICompensation> evaluate(
        IAgreement agreement, IGuaranteeTerm term, List<IViolation> newViolations, Date now) {
    
    logger.debug("Evaluating business for {} new violations", newViolations.size());
    List<ICompensation> result = new ArrayList<ICompensation>();
    IBusinessValueList businessValues = term.getBusinessValueList();
    if (businessValues == null) {
        /*
         * sanity check
         */
        return Collections.emptyList();
    }
    for (IPenaltyDefinition penaltyDef : businessValues.getPenalties()) {
        if (penaltyDef.getKind() != CompensationKind.CUSTOM_PENALTY) {
            continue;
        }
        Date violationsBegin = new Date(now.getTime() - penaltyDef.getTimeInterval().getTime());
        /*
         * TODO: violationsBegin should be max(violationsBegin, select last(penalty) where penalty.definition = def
         */
        List<IViolation> oldViolations = 
                repository.getViolationsByTimeRange(agreement, term.getName(), violationsBegin, now);
        
        if (thereIsPenalty(penaltyDef, newViolations, oldViolations)) {
            
            IPenalty penalty = new Penalty(
                    agreement.getAgreementId(),
                    now,
                    term.getKpiName(),
                    penaltyDef, 
                    getLastViolation(newViolations, oldViolations));
            result.add(penalty);
            logger.debug("Raised {}", penalty);
        }
    }
    return result;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:39,代码来源:SimpleBusinessValuesEvaluator.java


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