class ComputationalServiceImpl implements ComputationalService {

	@BudgetLimited
	@Override
	public boolean createDataEngineService(UserInfo userInfo, ComputationalCreateFormDTO formDTO,
										   UserComputationalResource computationalResource, @Project String project) {

		final ProjectDTO projectDTO = projectService.get(project);
		final UserInstanceDTO instance = exploratoryDAO.fetchExploratoryFields(userInfo.getName(), project, formDTO
				.getNotebookName());
		final Map<String, String> tags = tagService.getResourceTags(userInfo, instance.getEndpoint(), project,
				formDTO.getCustomTag());
		computationalResource.setTags(tags);
		boolean isAdded = computationalDAO.addComputational(userInfo.getName(), formDTO.getNotebookName(), project,
				computationalResource);

		if (isAdded) {
			try {
				EndpointDTO endpointDTO = endpointService.get(instance.getEndpoint());
				String uuid =
						provisioningService.post(endpointDTO.getUrl() + COMPUTATIONAL_CREATE_CLOUD_SPECIFIC,
								userInfo.getAccessToken(),
								requestBuilder.newComputationalCreate(userInfo, projectDTO, instance, formDTO, endpointDTO),
								String.class);
				requestId.put(userInfo.getName(), uuid);
				return true;
			} catch (Exception t) {
				try {
					updateComputationalStatus(userInfo.getName(), project, formDTO.getNotebookName(),
							formDTO.getName(), FAILED);
				} catch (DlabException e) {
					log.error(COULD_NOT_UPDATE_THE_STATUS_MSG_FORMAT, formDTO.getName(), userInfo.getName(), e);
				}
				throw new DlabException("Could not send request for creation the computational resource " + formDTO
						.getName() + ": " + t.getLocalizedMessage(), t);
			}
		} else {
			log.debug("Used existing computational resource {} for user {}", formDTO.getName(), userInfo.getName());
			return false;
		}
	}

	@Inject public  ComputationalServiceImpl(ProjectService projectService, ExploratoryDAO exploratoryDAO, ComputationalDAO computationalDAO,
									@Named(ServiceConsts.PROVISIONING_SERVICE_NAME) RESTService provisioningService,
									RequestBuilder requestBuilder, RequestId requestId, TagService tagService,
									EndpointService endpointService, InfrastructureTemplateService templateService);

}