本文整理汇总了Java中eu.atos.sla.service.rest.helpers.exception.InternalHelperException类的典型用法代码示例。如果您正苦于以下问题:Java InternalHelperException类的具体用法?Java InternalHelperException怎么用?Java InternalHelperException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternalHelperException类属于eu.atos.sla.service.rest.helpers.exception包,在下文中一共展示了InternalHelperException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProvider
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的package包/类
public String createProvider(Provider providerXML) throws DBExistsHelperException, InternalHelperException {
logger.debug("StartOf createProvider");
IProvider stored = null;
if (providerXML != null) {
if (!doesProviderExistsInRepository(providerXML.getUuid(), providerXML.getName())) {
IProvider provider = modelConverter.getProviderFromProviderXML(providerXML);
stored = providerDAO.save(provider);
} else {
throw new DBExistsHelperException("Provider with id:"
+ providerXML.getUuid() +" or name:"+providerXML.getName()
+ " already exists in the SLA Repository Database");
}
}
if (stored != null) {
logger.debug("EndOf createProvider");
return stored.getUuid();
} else
logger.debug("EndOf createProvider");
throw new InternalHelperException("Error when creating provider the SLA Repository Database");
}
示例2: createProvider
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的package包/类
public String createProvider(Provider providerXML) throws DBExistsHelperException, InternalHelperException {
logger.debug("StartOf createProvider");
IProvider stored = null;
if (providerXML != null) {
if (!doesProviderExistsInRepository(providerXML.getUuid(), providerXML.getName())) {
IProvider provider = modelConverter.getProviderFromProviderXML(providerXML);
stored = providerDAO.save(provider);
} else {
throw new DBExistsHelperException("Provider with id:"
+ providerXML.getUuid() +" or name:"+providerXML.getName()
+ " already exists in the SLA Repository Database");
}
}
if (stored != null) {
logger.debug("EndOf createProvider");
return stored.getUuid();
} else
logger.debug("EndOf createProvider");
throw new InternalHelperException("Error when creating provider the SLA Repository Database");
}
示例3: createTemplate
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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;
}
示例4: createEnforcementJob
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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());
}
}
示例5: getAgreementContextByID
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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;
}
示例6: createEnforcementJob
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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());
}
}
示例7: getAgreementContextByID
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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;
}
示例8: createAgreement
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的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() );
}
}
示例9: getAgreementContextById
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的package包/类
/**
* Gets the context information of an specific agreement.
*
*
* <pre>
* GET /agreements/{id}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
*
*
*
* Example: <li>curl
* http://localhost:8080/sla-service/agreements/context/agreement04</li>
*
*
* @param id of the agreement
* @return XML information with the different details of the context
* @throws NotFoundException
* @throws InternalException
*/
@GET
@Path("{id}/context")
public eu.atos.sla.parser.data.wsag.Context getAgreementContextById(@PathParam("id") String agreementId) throws NotFoundException, InternalException {
logger.debug("StartOf getAgreementContextById REQUEST for /agreements/{}/context", agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
eu.atos.sla.parser.data.wsag.Context context;
try {
context = agreementRestHelper.getAgreementContextByID(agreementId);
} catch (InternalHelperException e) {
logger.error("getAgreementContextById InternalException", e);
throw new InternalException(e.getMessage());
}
if (context==null){
logger.info("getAgreementContextById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementContextById");
return context;
}
示例10: createAgreement
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的package包/类
public String createAgreement(Agreement agreementXML, String originalSerializedAgreement)
throws DBMissingHelperException, DBExistsHelperException, InternalHelperException, ParserHelperException {
return createAgreement(agreementXML, originalSerializedAgreement, "");
}
示例11: getAgreementContextById
import eu.atos.sla.service.rest.helpers.exception.InternalHelperException; //导入依赖的package包/类
/**
* Gets the context information of an specific agreement.
*
*
* <pre>
* GET /agreements/{id}
*
* Request:
* GET /agreements HTTP/1.1
*
* Response:
* HTTP/1.1 200 OK
* Content-type: application/xml
*
*
*
* Example: <li>curl
* http://localhost:8080/sla-service/agreements/context/agreement04</li>
*
*
* @param id of the agreement
* @return XML information with the different details of the context
* @throws NotFoundException
* @throws InternalException
*/
@GET
@Path("{id}/context")
public eu.atos.sla.parser.data.wsag.Context getAgreementContextById(@PathParam("id") String agreementId) throws NotFoundException, InternalException {
logger.debug("StartOf getAgreementContextById REQUEST for /agreements/{}/context", agreementId);
AgreementHelperE agreementRestHelper = getAgreementHelper();
eu.atos.sla.parser.data.wsag.Context context;
try {
context = agreementRestHelper.getAgreementContextByID(agreementId);
} catch (InternalHelperException e) {
logger.error("getAgreementContextById InternalException", e);
throw new InternalException(e.getMessage());
}
if (context==null){
logger.info("getAgreementContextById NotFoundException: There is no agreement with id " + agreementId + " in the SLA Repository Database");
throw new NotFoundException("There is no agreement with id " + agreementId + " in the SLA Repository Database");
}
logger.debug("EndOf getAgreementContextById");
return context;
}