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


Java GuaranteeTermStatusEnum类代码示例

本文整理汇总了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;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:24,代码来源:AgreementHelper.java

示例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;
	}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:26,代码来源:AgreementHelperE.java

示例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;
		}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:24,代码来源:AgreementHelperE.java

示例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;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:24,代码来源:AgreementHelper.java

示例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;
    }
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:26,代码来源:AgreementHelperE.java

示例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;
        }
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:24,代码来源:AgreementHelperE.java

示例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;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:21,代码来源:EnforcementService.java

示例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;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:13,代码来源:AgreementHelperETest.java

示例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;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:13,代码来源:AgreementHelperETest.java

示例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()+")");
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:46,代码来源:EnforcementService.java

示例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()+")");
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:46,代码来源:EnforcementService.java

示例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);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:9,代码来源:AgreementHelperETest.java

示例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);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:9,代码来源:AgreementHelperETest.java


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