当前位置: 首页>>代码示例>>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;未经允许,请勿转载。