本文整理汇总了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());
}
}
示例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;
}
示例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());
}
}
示例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;
}
示例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() );
}
}
示例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() );
}
}