本文整理汇总了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;
}
示例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;
}