當前位置: 首頁>>代碼示例>>Java>>正文


Java DBMissingHelperException類代碼示例

本文整理匯總了Java中eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException的典型用法代碼示例。如果您正苦於以下問題:Java DBMissingHelperException類的具體用法?Java DBMissingHelperException怎麽用?Java DBMissingHelperException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DBMissingHelperException類屬於eu.atos.sla.service.rest.helpers.exception包,在下文中一共展示了DBMissingHelperException類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTemplate

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public String createTemplate(SlaInfo slaInfo, boolean persist) throws JAXBException,
        DBMissingHelperException, DBExistsHelperException,
        InternalHelperException, ParserHelperException {
    
    TemplateGenerator g = new TemplateGenerator(slaInfo);
    Template wsagTemplate = g.generate();

    String providerUuid = wsagTemplate.getContext().getAgreementResponder();
    
    String wsagSerialized = JaxbUtils.toString(wsagTemplate);
    String id = "<random-uuid>";

    if (persist) {
        
        getOrCreateProvider(providerUuid);
        id = templateHelper.createTemplate(wsagTemplate, wsagSerialized);
    }
    return id;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:20,代碼來源:SeacloudsRest.java

示例2: createEnforcementJob

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public String createEnforcementJob(EnforcementJob enforcementJobXML)
		throws DBExistsHelperException, InternalHelperException, DBMissingHelperException {
	logger.debug("StartOf createEnforcementJob");
	IEnforcementJob enforcementJob = null;
	IEnforcementJob stored = null;

	try {
		if (enforcementJobXML != null) {
			if (!doesEnforcementExistInRepository(enforcementJobXML.getAgreementId())) {
				// the enforcement doesn't exist
				enforcementJob = modelConverter.getEnforcementJobFromEnforcementJobXML(enforcementJobXML);
				IAgreement agreement = agreementDAO.getByAgreementId(enforcementJobXML.getAgreementId());
				if (agreement == null)
					throw new DBMissingHelperException("Agreement with id:"
							+ enforcementJobXML.getAgreementId()
							+ " doesn't exists in the SLA Repository Database. No enforcement job could be started");
				stored = enforcementService.createEnforcementJob(enforcementJob);
			} else {
				throw new DBExistsHelperException("Enforcement with id:"
						+ enforcementJobXML.getAgreementId()
						+ " already exists in the SLA Repository Database");
			}
		}
	
		if (stored != null) {
			logger.debug("EndOf createEnforcementJob");
			return stored.getAgreement().getAgreementId();
		} else {
			logger.debug("EndOf createEnforcementJob");
			throw new InternalHelperException("Error when creating enforcementJob the SLA Repository Database");
		}
	} catch (ModelConversionException e) {
		logger.error("createEnforcementJob error:",e);
		throw new InternalHelperException(e.getMessage());
	}

}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:38,代碼來源:EnforcementJobHelperE.java

示例3: getAgreementStatus

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public GuaranteeTermsStatus getAgreementStatus(String id) throws DBMissingHelperException{
	logger.debug("StartOf getAgreementStatus id:{}", id);

	IAgreement agreement = agreementDAO.getByAgreementId(id);
	if (agreement == null)
		throw new DBMissingHelperException("The agreementId " + id + " doesn't exist");

	List<IGuaranteeTerm> guaranteeTerms = agreement.getGuaranteeTerms();
	GuaranteeTermsStatus guaranteeTermsStatus = getGuaranteeStatus(id, guaranteeTerms);
	logger.debug("EndOf getAgreementStatus"); 

	return  guaranteeTermsStatus;
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:14,代碼來源:AgreementHelperE.java

示例4: createEnforcementJob

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public String createEnforcementJob(EnforcementJob enforcementJobXML)
        throws DBExistsHelperException, InternalHelperException, DBMissingHelperException {
    logger.debug("StartOf createEnforcementJob");
    IEnforcementJob enforcementJob = null;
    IEnforcementJob stored = null;

    try {
        if (enforcementJobXML != null) {
            if (!doesEnforcementExistInRepository(enforcementJobXML.getAgreementId())) {
                // the enforcement doesn't exist
                enforcementJob = modelConverter.getEnforcementJobFromEnforcementJobXML(enforcementJobXML);
                IAgreement agreement = agreementDAO.getByAgreementId(enforcementJobXML.getAgreementId());
                if (agreement == null)
                    throw new DBMissingHelperException("Agreement with id:"
                            + enforcementJobXML.getAgreementId()
                            + " doesn't exists in the SLA Repository Database. No enforcement job could be started");
                stored = enforcementService.createEnforcementJob(enforcementJob);
            } else {
                throw new DBExistsHelperException("Enforcement with id:"
                        + enforcementJobXML.getAgreementId()
                        + " already exists in the SLA Repository Database");
            }
        }
    
        if (stored != null) {
            logger.debug("EndOf createEnforcementJob");
            return stored.getAgreement().getAgreementId();
        } else {
            logger.debug("EndOf createEnforcementJob");
            throw new InternalHelperException("Error when creating enforcementJob the SLA Repository Database");
        }
    } catch (ModelConversionException e) {
        logger.error("createEnforcementJob error:",e);
        throw new InternalHelperException(e.getMessage());
    }

}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:38,代碼來源:EnforcementJobHelperE.java

示例5: getAgreementStatus

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public GuaranteeTermsStatus getAgreementStatus(String id) throws DBMissingHelperException{
    logger.debug("StartOf getAgreementStatus id:{}", id);

    IAgreement agreement = agreementDAO.getByAgreementId(id);
    if (agreement == null)
        throw new DBMissingHelperException("The agreementId " + id + " doesn't exist");

    List<IGuaranteeTerm> guaranteeTerms = agreement.getGuaranteeTerms();
    GuaranteeTermsStatus guaranteeTermsStatus = getGuaranteeStatus(id, guaranteeTerms);
    logger.debug("EndOf getAgreementStatus"); 

    return  guaranteeTermsStatus;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:14,代碼來源:AgreementHelperE.java

示例6: createAgreement

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public String createAgreement(Agreement agreementXML, String originalSerializedAgreement) throws DBMissingHelperException, DBExistsHelperException, InternalHelperException, ParserHelperException {
	logger.debug("StartOf createAgreement payload:{}", originalSerializedAgreement);
	try{
		IAgreement agreementStored = null;

		if (agreementXML != null) {

			// add field AggrementId if it doesn't exist
			if (agreementXML.getAgreementId() == null) {
				String agreementId = UUID.randomUUID().toString();
				logger.debug("createAgreement agreement has no uuid, {} will be assigned", agreementId); 
				originalSerializedAgreement = setAgreementIdInSerializedAgreement(originalSerializedAgreement, agreementId);
				agreementXML.setAgreementId(agreementId);
			}

			if (!doesAgreementIdExistInRepository(agreementXML.getAgreementId())) {
				IAgreement agreement = modelConverter.getAgreementFromAgreementXML(agreementXML, originalSerializedAgreement);
				
				String providerUuid = agreement.getProvider().getUuid();
				IProvider provider = providerFromRepository(providerUuid);
				if (provider == null) {
					throw new DBMissingHelperException("Provider with id:"+ providerUuid+ " doesn't exist SLA Repository Database");
				}
				agreement.setProvider(provider);

				String templateUuid = agreement.getTemplate().getUuid();
				ITemplate template = templateFromRepository(templateUuid);
				if (template == null) {
					throw new DBMissingHelperException("Template with id:"+ templateUuid+ " doesn't exist SLA Repository Database");
				}
				agreement.setTemplate(template);

				agreementStored = this.agreementDAO.save(agreement);
				
				/* create an stopped enforcement job */
				if (!doesEnforcementExistInRepository(agreementStored.getAgreementId())) {
					// the enforcement doesn't eist
					IEnforcementJob ejob = 
							enforcementService.createEnforcementJob(agreementStored.getAgreementId());
					logger.debug("EnforcementJob {} created", ejob.getId());
				} else {
					throw new DBExistsHelperException("Enforcement with id:"
							+ agreementStored.getAgreementId()
							+ " already exists in the SLA Repository Database");
				}
				

			} else {
				throw new DBExistsHelperException("Agreement with id:"+ agreementXML.getAgreementId()+ " already exists in the SLA Repository Database");					
			}
		}

		if (agreementStored != null) {
			logger.debug("EndOf createAgreement");
			return agreementStored.getAgreementId();
		} else{
			logger.debug("EndOf createAgreement");
			throw new InternalHelperException("Error when creating agreement the SLA Repository Database");
		}
	} catch (ModelConversionException e) {
		logger.error("Error in createAgreement " , e);
		throw new ParserHelperException("Error when creating:" + e.getMessage() );
	}

}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:66,代碼來源:AgreementHelperE.java

示例7: getStatusAgreement

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
/**
 * Gets the information of the status of the different Guarantee Terms of an
 * agreement. *
 * 
 * <pre>
 * GET /agreements/{agreementId}/guaranteestatus
 *   
 * Request:
 *   GET /agreements HTTP/1.1
 *    
 * Response:
 *   HTTP/1.1 200 Ok
 *   Content-type: application/xml or application/json 
 *  
 *  In case of application/xml
 * {@code
 *   <GuaranteeStatus agreementId="$agreementId" value="FULFILLED|VIOLATED|NON_DETERMINED">
 *     <GuaranteeTermStatus name="$gt_name1" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
 *    ...
 *     <GuaranteeTermStatus name="$gt_nameN" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
 *   </GuaranteeStatus>
 * }
 * 
 *  In case of application/json
 * {@code
 * {"agreementId":"{agreementId}","value":"FULFILLED|VIOLATED|NON_DETERMINED",
 * "GuaranteeTermStatus":
 * [{"name":"{gt_name1}","value":"FULFILLED|VIOLATED|NON_DETERMINED"},
 * {"name":"{gt_name2}","value":"FULFILLED|VIOLATED|NON_DETERMINED"}]}
 * }
 *  
 * </pre>
 * 
 * Example: 
 * <li>curl -H "Content-type: application/xml" http://localhost:8080/sla-service/agreements/{agreementId}/guaranteestatus</li>
 * 
 * @return Json information with Guarantee Status
 */
@GET
@Path("{id}/guaranteestatus")
public GuaranteeTermsStatus  getStatusAgreement(@PathParam("id") String agreementId) throws NotFoundException{
	logger.debug("StartOf getStatusAgreement - REQUEST for /agreements/" + agreementId
			+ "/guaranteestatus");
	GuaranteeTermsStatus guaranteeTermsStatus = null;
	try{
		AgreementHelperE agreementRestHelper = getAgreementHelper();
		guaranteeTermsStatus =  agreementRestHelper.getAgreementStatus(agreementId);
	} catch (DBMissingHelperException e) {
		logger.info("getStatusAgreement NotFoundException:"+e.getMessage());
		throw new NotFoundException(e.getMessage()); 
	}
	logger.debug("EndOf getStatusAgreement");
	return guaranteeTermsStatus;
}
 
開發者ID:Atos-FiwareOps,項目名稱:sla-framework,代碼行數:55,代碼來源:AgreementRestEntity.java

示例8: createAgreement

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
public String createAgreement(Agreement agreementXML, String originalSerializedAgreement) 
        throws DBMissingHelperException, DBExistsHelperException, InternalHelperException, ParserHelperException {
    
    return createAgreement(agreementXML, originalSerializedAgreement, "");
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:6,代碼來源:AgreementHelperE.java

示例9: getStatusAgreement

import eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException; //導入依賴的package包/類
/**
 * Gets the information of the status of the different Guarantee Terms of an
 * agreement. *
 * 
 * <pre>
 * GET /agreements/{agreementId}/guaranteestatus
 *   
 * Request:
 *   GET /agreements HTTP/1.1
 *    
 * Response:
 *   HTTP/1.1 200 Ok
 *   Content-type: application/xml or application/json 
 *  
 *  In case of application/xml
 * {@code
 *   <GuaranteeStatus agreementId="$agreementId" value="FULFILLED|VIOLATED|NON_DETERMINED">
 *     <GuaranteeTermStatus name="$gt_name1" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
 *    ...
 *     <GuaranteeTermStatus name="$gt_nameN" value="FULFILLED|VIOLATED|NON_DETERMINED"/>
 *   </GuaranteeStatus>
 * }
 * 
 *  In case of application/json
 * {@code
 * {"agreementId":"{agreementId}","value":"FULFILLED|VIOLATED|NON_DETERMINED",
 * "GuaranteeTermStatus":
 * [{"name":"{gt_name1}","value":"FULFILLED|VIOLATED|NON_DETERMINED"},
 * {"name":"{gt_name2}","value":"FULFILLED|VIOLATED|NON_DETERMINED"}]}
 * }
 *  
 * </pre>
 * 
 * Example: 
 * <li>curl -H "Content-type: application/xml" http://localhost:8080/sla-service/agreements/{agreementId}/guaranteestatus</li>
 * 
 * @return Json information with Guarantee Status
 */
@GET
@Path("{id}/guaranteestatus")
public GuaranteeTermsStatus  getStatusAgreement(@PathParam("id") String agreementId) throws NotFoundException{
    logger.debug("StartOf getStatusAgreement - REQUEST for /agreements/" + agreementId
            + "/guaranteestatus");
    GuaranteeTermsStatus guaranteeTermsStatus = null;
    try{
        AgreementHelperE agreementRestHelper = getAgreementHelper();
        guaranteeTermsStatus =  agreementRestHelper.getAgreementStatus(agreementId);
    } catch (DBMissingHelperException e) {
        logger.info("getStatusAgreement NotFoundException:"+e.getMessage());
        throw new NotFoundException(e.getMessage()); 
    }
    logger.debug("EndOf getStatusAgreement");
    return guaranteeTermsStatus;
}
 
開發者ID:SeaCloudsEU,項目名稱:SeaCloudsPlatform,代碼行數:55,代碼來源:AgreementRestEntity.java


注:本文中的eu.atos.sla.service.rest.helpers.exception.DBMissingHelperException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。