@Override public void downloadTemplateToStorage(DataObject template, AsyncCompletionCallback<DownloadAnswer> callback) { if(template != null) { long templateId = template.getId(); DataStore store = template.getDataStore(); if (isTemplateUpdateable(templateId, store.getId())) { if (template.getUri() != null) { initiateTemplateDownload(template, callback); } else { s_logger.info("Template url is null, cannot download"); DownloadAnswer ans = new DownloadAnswer("Template url is null", Status.UNKNOWN); callback.complete(ans); } } else { s_logger.info("Template download is already in progress or already downloaded"); DownloadAnswer ans = new DownloadAnswer("Template download is already in progress or already downloaded", Status.UNKNOWN); callback.complete(ans); } } }
if (vmTemplateStore == null) { vmTemplateStore = new TemplateDataStoreVO(store.getId(), template.getId(), new Date(), 0, Status.NOT_DOWNLOADED, null, null, "jobid0000", null, template.getUri()); vmTemplateStore.setDataStoreRole(store.getRole()); vmTemplateStore = _vmTemplateStoreDao.persist(vmTemplateStore);