use of org.ligoj.app.api.SubscriptionStatusWithData in project ligoj-api by ligoj.
the class NodeResource method checkSubscriptionStatus.
/**
* Check status for a subscription.
*
* @param subscription
* Subscription entity.
* @param parameters
* Parameters of a subscription.
* @return status of given subscription.
*/
public SubscriptionStatusWithData checkSubscriptionStatus(final Subscription subscription, final Map<String, String> parameters) {
final String node = subscription.getNode().getId();
try {
log.info("Check status of a subscription attached to {}...", node);
// Find the plug-in associated to the requested node
final ToolPlugin toolPlugin = locator.getResourceExpected(node, ToolPlugin.class);
// Call service which check status
final SubscriptionStatusWithData status = toolPlugin.checkSubscriptionStatus(subscription.getId(), node, parameters);
status.setNode(node);
log.info("Check status of a subscription attached to {} succeed", node);
return status;
} catch (final Exception e) {
// NOSONAR
// Do not pollute logs with this failures
// Service is down when an exception is thrown, log the error
// without trace
log.warn("Check status of a subscription attached to {} failed : {}", node, e.getMessage());
}
return new SubscriptionStatusWithData(false);
}
use of org.ligoj.app.api.SubscriptionStatusWithData in project plugin-prov by ligoj.
the class AbstractProvResource method checkSubscriptionStatus.
@Override
public SubscriptionStatusWithData checkSubscriptionStatus(final int subscription, final String node, final Map<String, String> parameters) {
final SubscriptionStatusWithData status = new SubscriptionStatusWithData();
// Complete the tool status with the generic quote data
status.put("quote", provResource.getSusbcriptionStatus(subscription));
return status;
}
Aggregations