本文整理汇总了Java中eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum类的典型用法代码示例。如果您正苦于以下问题:Java GuaranteeTermStatusEnum类的具体用法?Java GuaranteeTermStatusEnum怎么用?Java GuaranteeTermStatusEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GuaranteeTermStatusEnum类属于eu.atos.sla.datamodel.IGuaranteeTerm包,在下文中一共展示了GuaranteeTermStatusEnum类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAgreementStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private GuaranteeTermStatusEnum getAgreementStatus(
List<IGuaranteeTerm> guaranteeTerms) {
GuaranteeTermStatusEnum result = GuaranteeTermStatusEnum.FULFILLED;
if (guaranteeTerms.size() == 0) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else {
result = GuaranteeTermStatusEnum.FULFILLED;
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatusEnum termStatus = guaranteeTerm.getStatus();
if (termStatus == null
|| termStatus == GuaranteeTermStatusEnum.NON_DETERMINED) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else if (termStatus == GuaranteeTermStatusEnum.VIOLATED) {
result = GuaranteeTermStatusEnum.VIOLATED;
}
}
}
return result;
}
示例2: getGuaranteeStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private GuaranteeTermsStatus getGuaranteeStatus(String agreementId, List<IGuaranteeTerm> guaranteeTerms) {
// Pojo GuaranteeTermsStatus
GuaranteeTermsStatus guaranteeTermsStatus = new GuaranteeTermsStatus();
List<GuaranteeTermStatus> guaranteeTermStatusList = new ArrayList<GuaranteeTermStatus>();
// Status GuaranteTerm
GuaranteeTermStatusEnum agreementStatus = AgreementStatusCalculator.getStatus(guaranteeTerms);
guaranteeTermsStatus.setAgreementId(agreementId);
guaranteeTermsStatus.setValue(agreementStatus.toString());
// Fill GuaranteeTermsStatus pojo
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatus guaranteeTermStatus = new GuaranteeTermStatus();
guaranteeTermStatus.setName(guaranteeTerm.getName());
guaranteeTermStatus.setValue(guaranteeTerm.getStatus().toString());
guaranteeTermStatusList.add(guaranteeTermStatus);
}
guaranteeTermsStatus.setGuaranteeTermsStatus(guaranteeTermStatusList);
return guaranteeTermsStatus;
}
示例3: getStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
public static GuaranteeTermStatusEnum getStatus(List<IGuaranteeTerm> guaranteeTerms) {
GuaranteeTermStatusEnum result = GuaranteeTermStatusEnum.FULFILLED;
if (guaranteeTerms.size() == 0) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else {
result = GuaranteeTermStatusEnum.FULFILLED;
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatusEnum termStatus = guaranteeTerm.getStatus();
if (termStatus == null
|| termStatus == GuaranteeTermStatusEnum.NON_DETERMINED) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else if (termStatus == GuaranteeTermStatusEnum.VIOLATED) {
result = GuaranteeTermStatusEnum.VIOLATED;
break;
}
}
}
return result;
}
示例4: getAgreementStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private GuaranteeTermStatusEnum getAgreementStatus(
List<IGuaranteeTerm> guaranteeTerms) {
GuaranteeTermStatusEnum result = GuaranteeTermStatusEnum.FULFILLED;
if (guaranteeTerms.size() == 0) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else {
result = GuaranteeTermStatusEnum.FULFILLED;
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatusEnum termStatus = guaranteeTerm.getStatus();
if (termStatus == null
|| termStatus == GuaranteeTermStatusEnum.NON_DETERMINED) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else if (termStatus == GuaranteeTermStatusEnum.VIOLATED) {
result = GuaranteeTermStatusEnum.VIOLATED;
}
}
}
return result;
}
示例5: getGuaranteeStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private GuaranteeTermsStatus getGuaranteeStatus(String agreementId, List<IGuaranteeTerm> guaranteeTerms) {
// Pojo GuaranteeTermsStatus
GuaranteeTermsStatus guaranteeTermsStatus = new GuaranteeTermsStatus();
List<GuaranteeTermStatus> guaranteeTermStatusList = new ArrayList<GuaranteeTermStatus>();
// Status GuaranteTerm
GuaranteeTermStatusEnum agreementStatus = AgreementStatusCalculator.getStatus(guaranteeTerms);
guaranteeTermsStatus.setAgreementId(agreementId);
guaranteeTermsStatus.setValue(agreementStatus.toString());
// Fill GuaranteeTermsStatus pojo
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatus guaranteeTermStatus = new GuaranteeTermStatus();
guaranteeTermStatus.setName(guaranteeTerm.getName());
guaranteeTermStatus.setValue(guaranteeTerm.getStatus().toString());
guaranteeTermStatusList.add(guaranteeTermStatus);
}
guaranteeTermsStatus.setGuaranteeTermsStatus(guaranteeTermStatusList);
return guaranteeTermsStatus;
}
示例6: getStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
public static GuaranteeTermStatusEnum getStatus(List<IGuaranteeTerm> guaranteeTerms) {
GuaranteeTermStatusEnum result = GuaranteeTermStatusEnum.FULFILLED;
if (guaranteeTerms.size() == 0) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else {
result = GuaranteeTermStatusEnum.FULFILLED;
for (IGuaranteeTerm guaranteeTerm : guaranteeTerms) {
GuaranteeTermStatusEnum termStatus = guaranteeTerm.getStatus();
if (termStatus == null
|| termStatus == GuaranteeTermStatusEnum.NON_DETERMINED) {
result = GuaranteeTermStatusEnum.NON_DETERMINED;
} else if (termStatus == GuaranteeTermStatusEnum.VIOLATED) {
result = GuaranteeTermStatusEnum.VIOLATED;
break;
}
}
}
return result;
}
示例7: startEnforcement
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
@Override
public boolean startEnforcement(String agreementId) {
logger.debug("startEnforcement({})", agreementId);
IEnforcementJob job = enforcementJobDAO.getByAgreementId(agreementId);
if (job == null) {
return false;
}
job.setEnabled(true);
enforcementJobDAO.save(job);
IAgreement agreement = agreementDAO.getByAgreementId(agreementId);
for (IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
if (term.getStatus() == null || GuaranteeTermStatusEnum.NON_DETERMINED.equals(term.getStatus())) {
term.setStatus(GuaranteeTermStatusEnum.FULFILLED);
}
guaranteeTermDAO.save(term);
}
return true;
}
示例8: buildTerms
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private List<IGuaranteeTerm> buildTerms(GuaranteeTermStatusEnum... termsStatus) {
List<IGuaranteeTerm> result = new ArrayList<IGuaranteeTerm>();
for (GuaranteeTermStatusEnum status: termsStatus) {
GuaranteeTerm term = new GuaranteeTerm();
term.setStatus(status);
result.add(term);
}
return result;
}
示例9: buildTerms
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private List<IGuaranteeTerm> buildTerms(GuaranteeTermStatusEnum... termsStatus) {
List<IGuaranteeTerm> result = new ArrayList<IGuaranteeTerm>();
for (GuaranteeTermStatusEnum status: termsStatus) {
GuaranteeTerm term = new GuaranteeTerm();
term.setStatus(status);
result.add(term);
}
return result;
}
示例10: saveEnforcementResult
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
@Override
public void saveEnforcementResult(IAgreement agreement,
Map<IGuaranteeTerm, GuaranteeTermEvaluationResult> enforcementResult) {
for (IGuaranteeTerm gterm : enforcementResult.keySet()) {
IGuaranteeTerm dbTerm = guaranteeTermDAO.getById(gterm.getId());
GuaranteeTermEvaluationResult gttermResult = enforcementResult.get(gterm);
for (IViolation violation : gttermResult.getViolations()) {
dbTerm.getViolations().add(violation);
violationDAO.save(violation);
}
for (ICompensation compensation : gttermResult.getCompensations()) {
if (compensation instanceof IPenalty) {
IPenalty penalty = (IPenalty)compensation;
penaltyDAO.save(penalty);
dbTerm.getPenalties().add(penalty);
}
else if (compensation instanceof IReward) {
logger.warn("Saving a Reward is not implemented");
}
else {
throw new AssertionError("Unexpected compensation type: " + compensation.getClass().getName());
}
}
dbTerm.setStatus( dbTerm.getViolations().size() > 0?
GuaranteeTermStatusEnum.VIOLATED : GuaranteeTermStatusEnum.FULFILLED);
try{
guaranteeTermDAO.update(dbTerm);
}catch(Exception e){
// sometimes the update failes, for example in the test cases.
//in such a case
guaranteeTermDAO.save(dbTerm);
}
}
IEnforcementJob job = getEnforcementJobByAgreementId(agreement.getAgreementId());
job.setLastExecuted(new Date());
if (job.getFirstExecuted() == null) job.setFirstExecuted(job.getLastExecuted());
enforcementJobDAO.save(job);
logger.info("saved enforcement result(agreement=" + agreement.getAgreementId()+")");
}
示例11: saveEnforcementResult
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
@Override
public void saveEnforcementResult(IAgreement agreement,
Map<IGuaranteeTerm, GuaranteeTermEvaluationResult> enforcementResult) {
for (IGuaranteeTerm gterm : enforcementResult.keySet()) {
IGuaranteeTerm dbTerm = guaranteeTermDAO.getById(gterm.getId());
GuaranteeTermEvaluationResult gttermResult = enforcementResult.get(gterm);
for (IViolation violation : gttermResult.getViolations()) {
dbTerm.getViolations().add(violation);
violationDAO.save(violation);
}
for (ICompensation compensation : gttermResult.getCompensations()) {
if (compensation instanceof IPenalty) {
IPenalty penalty = (IPenalty)compensation;
penaltyDAO.save(penalty);
dbTerm.getPenalties().add(penalty);
}
else if (compensation instanceof IReward) {
logger.warn("Saving a Reward is not implemented");
}
else {
throw new AssertionError("Unexpected compensation type: " + compensation.getClass().getName());
}
}
dbTerm.setStatus( dbTerm.getViolations().size() > 0?
GuaranteeTermStatusEnum.VIOLATED : GuaranteeTermStatusEnum.FULFILLED);
try{
guaranteeTermDAO.update(dbTerm);
}catch(Exception e){
// sometimes the update failes, for example in the test cases.
//in such a case
guaranteeTermDAO.save(dbTerm);
}
}
IEnforcementJob job = getEnforcementJobByAgreementId(agreement.getAgreementId());
job.setLastExecuted(new Date());
if (job.getFirstExecuted() == null) job.setFirstExecuted(job.getLastExecuted());
enforcementJobDAO.save(job);
logger.info("saved enforcement result(agreement=" + agreement.getAgreementId()+")");
}
示例12: testStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private void testStatus(GuaranteeTermStatusEnum expected, GuaranteeTermStatusEnum... termsStatus) {
List<IGuaranteeTerm> terms = buildTerms(termsStatus);
GuaranteeTermStatusEnum current = AgreementHelperE.AgreementStatusCalculator.getStatus(terms);
assertEquals(expected, current);
}
示例13: testStatus
import eu.atos.sla.datamodel.IGuaranteeTerm.GuaranteeTermStatusEnum; //导入依赖的package包/类
private void testStatus(GuaranteeTermStatusEnum expected, GuaranteeTermStatusEnum... termsStatus) {
List<IGuaranteeTerm> terms = buildTerms(termsStatus);
GuaranteeTermStatusEnum current = AgreementHelperE.AgreementStatusCalculator.getStatus(terms);
assertEquals(expected, current);
}