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


Java ModelConversionException类代码示例

本文整理汇总了Java中eu.atos.sla.util.ModelConversionException的典型用法代码示例。如果您正苦于以下问题:Java ModelConversionException类的具体用法?Java ModelConversionException怎么用?Java ModelConversionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModelConversionException类属于eu.atos.sla.util包,在下文中一共展示了ModelConversionException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEnforcementJob

import eu.atos.sla.util.ModelConversionException; //导入依赖的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

示例2: getAgreementContextByID

import eu.atos.sla.util.ModelConversionException; //导入依赖的package包/类
public Context getAgreementContextByID(String id) throws InternalHelperException {
	logger.debug("StartOf getAgreementContextByID id:{}", id);
	IAgreement agreement = agreementDAO.getByAgreementId(id);
	Context context = null;
	try {
		if (agreement!= null)
			context = modelConverter.getContextFromAgreement(agreement);
	} catch (ModelConversionException e) {
		logger.error("Error getAgreementContextByID ",e);
		throw new InternalHelperException(e.getMessage());
	}
	logger.debug("EndOf getAgreementContextByID");
	return context;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:15,代码来源:AgreementHelperE.java

示例3: createEnforcementJob

import eu.atos.sla.util.ModelConversionException; //导入依赖的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

示例4: getAgreementContextByID

import eu.atos.sla.util.ModelConversionException; //导入依赖的package包/类
public Context getAgreementContextByID(String id) throws InternalHelperException {
    logger.debug("StartOf getAgreementContextByID id:{}", id);
    IAgreement agreement = agreementDAO.getByAgreementId(id);
    Context context = null;
    try {
        if (agreement!= null)
            context = modelConverter.getContextFromAgreement(agreement);
    } catch (ModelConversionException e) {
        logger.error("Error getAgreementContextByID ",e);
        throw new InternalHelperException(e.getMessage());
    }
    logger.debug("EndOf getAgreementContextByID");
    return context;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:15,代码来源:AgreementHelperE.java

示例5: createAgreement

import eu.atos.sla.util.ModelConversionException; //导入依赖的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

示例6: createAgreement

import eu.atos.sla.util.ModelConversionException; //导入依赖的package包/类
public String createAgreement(Agreement agreementXML, String originalSerializedAgreement, String agreementId) 
        throws DBMissingHelperException, DBExistsHelperException, InternalHelperException, ParserHelperException {
    logger.debug("StartOf createAgreement payload:{}", originalSerializedAgreement);
    try{
        IAgreement agreementStored = null;

        String serializedAgreement = Utils.removeXmlHeader(originalSerializedAgreement);
        if (agreementXML != null) {

            boolean setId = agreementId != null && !"".equals(agreementId);
            // add field AggrementId if it doesn't exist or agreement must have wsag:AgreementId=agreementId
            if (agreementXML.getAgreementId() == null || setId) {
                if (!setId) {
                    agreementId = UUID.randomUUID().toString();
                }
                logger.debug("createAgreement agreement has no uuid, {} will be assigned", agreementId); 
                serializedAgreement = setAgreementIdInSerializedAgreement(serializedAgreement, agreementId);
                agreementXML.setAgreementId(agreementId);
            }

            if (!doesAgreementIdExistInRepository(agreementXML.getAgreementId())) {
                IAgreement agreement = modelConverter.getAgreementFromAgreementXML(agreementXML, serializedAgreement);
                
                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);

                if (agreement.getTemplate() != null) {
                    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:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:73,代码来源:AgreementHelperE.java


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