use of org.wso2.carbon.lcm.core.exception.LifecycleException in project carbon-apimgt by wso2.
the class APIPublisherImpl method updateCheckListItem.
/**
* This method used to Update the lifecycle checklist of API
*
* @param apiId UUID of the API
* @param status Current API lifecycle status.
* @param checkListItemMap Check list item values.
* @throws APIManagementException If failed to update checklist item values.
*/
@Override
public void updateCheckListItem(String apiId, String status, Map<String, Boolean> checkListItemMap) throws APIManagementException {
API api = getApiDAO().getAPI(apiId);
try {
API.APIBuilder apiBuilder = new API.APIBuilder(api);
apiBuilder.lastUpdatedTime(LocalDateTime.now());
apiBuilder.updatedBy(getUsername());
apiBuilder.lifecycleState(getApiLifecycleManager().getLifecycleDataForState(apiBuilder.getLifecycleInstanceId(), apiBuilder.getLifeCycleStatus()));
for (Map.Entry<String, Boolean> checkListItem : checkListItemMap.entrySet()) {
getApiLifecycleManager().checkListItemEvent(api.getLifecycleInstanceId(), api.getLifeCycleStatus(), checkListItem.getKey(), checkListItem.getValue());
}
} catch (LifecycleException e) {
String errorMsg = "Couldn't get the lifecycle status of api ID " + apiId;
log.error(errorMsg, e);
throw new APIManagementException(errorMsg, e, ExceptionCodes.APIMGT_LIFECYCLE_EXCEPTION);
}
}
Aggregations