use of org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup in project so by onap.
the class WatchdogDistribution method executePatchAAI.
public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception {
logger.debug("Entered executePatchAAI method with distrubutionId: {} and distributionStatus: ", distributionId, distributionStatus);
try {
WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId);
String serviceModelVersionId = "";
if (lookup != null) {
serviceModelVersionId = lookup.getServiceModelVersionId();
}
logger.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: {} " + "and serviceModelVersionId: {}", distributionId, serviceModelVersionId);
logger.debug("ASDC Notification ServiceModelInvariantUUID : {}", serviceModelInvariantUUID);
if (serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) {
String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID;
logger.debug(error);
throw new Exception(error);
}
AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(serviceModelInvariantUUID).modelVer(serviceModelVersionId));
// Do not return relationships if any
aaiUri.depth(Depth.ZERO);
logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString());
Map<String, String> payload = new HashMap<>();
payload.put("distribution-status", distributionStatus);
getAaiClient().update(aaiUri, payload);
logger.debug("A&AI UPDATE MODEL Version is success!");
} catch (Exception e) {
logger.debug("Exception occurred on executePatchAAI : {}", e.getMessage());
logger.error("Exception occurred", e);
throw new Exception(e);
}
}
use of org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup in project so by onap.
the class ToscaResourceInstaller method processWatchdog.
public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification, String consumerId) {
WatchdogServiceModVerIdLookup modVerIdLookup = new WatchdogServiceModVerIdLookup(distributionId, servideUUID, distributionNotification, consumerId);
watchdogModVerIdLookupRepository.saveAndFlush(modVerIdLookup);
try {
WatchdogDistributionStatus distributionStatus = new WatchdogDistributionStatus(distributionId);
watchdogDistributionStatusRepository.saveAndFlush(distributionStatus);
} catch (ObjectOptimisticLockingFailureException e) {
logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : {} ", e);
throw e;
}
}
Aggregations