當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。