@Override public void execute() { executeWithView(ResponseView.Restricted); } }
@Override public String getEventDescription() { return "Deleting ISO " + getId(); }
@Override @ActionEvent(eventType = EventTypes.EVENT_ISO_EXTRACT, eventDescription = "extracting ISO", async = true) public String extract(ExtractIsoCmd cmd) { Account account = CallContext.current().getCallingAccount(); Long templateId = cmd.getId(); Long zoneId = cmd.getZoneId(); String url = cmd.getUrl(); String mode = cmd.getMode(); Long eventId = cmd.getStartEventId(); return extract(account, templateId, url, zoneId, mode, eventId, true); }
public boolean listInReadyState() { Account account = CallContext.current().getCallingAccount(); // It is account specific if account is admin type and domainId and accountName are not null boolean isAccountSpecific = (account == null || _accountService.isAdmin(account.getId())) && (getAccountName() != null) && (getDomainId() != null); // Show only those that are downloaded. TemplateFilter templateFilter = TemplateFilter.valueOf(getIsoFilter()); boolean onlyReady = (templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.selfexecutable) || (templateFilter == TemplateFilter.sharedexecutable) || (templateFilter == TemplateFilter.executable && isAccountSpecific) || (templateFilter == TemplateFilter.community); if (!onlyReady) { if (isReady() != null && isReady().booleanValue() != onlyReady) { onlyReady = isReady().booleanValue(); } } return onlyReady; }
@Override public void execute() { CallContext.current().setEventDetails("ISO Id: " + getId()); boolean result = _templateService.deleteIso(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete ISO"); } } }
@Override public Long getInstanceId() { return getId(); }
@Override public String getEventDescription() { return "attaching ISO: " + getId() + " to VM: " + getVirtualMachineId(); }
@Override public void execute() { ListResponse<TemplateResponse> response = _queryService.listIsos(this); response.setResponseName(getCommandName()); setResponseObject(response); } }
@Override public void execute() { VirtualMachineTemplate result = _templateService.updateTemplate(this); if (result != null) { TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update ISO"); } } }
@Override public void execute() throws ResourceAllocationException { VirtualMachineTemplate template = _templateService.registerIso(this); if (template != null) { ListResponse<TemplateResponse> response = new ListResponse<TemplateResponse>(); List<TemplateResponse> templateResponses = _responseGenerator.createIsoResponses(ResponseView.Restricted, template, zoneId, false); response.setResponses(templateResponses); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register ISO"); } } }
@Override public String getEventDescription() { return "detaching ISO from VM: " + getVirtualMachineId(); }
@Override public long getEntityOwnerId() { UserVm vm = _entityMgr.findById(UserVm.class, getVirtualMachineId()); if (vm == null) { throw new InvalidParameterValueException("Unable to find virtual machine by ID " + getVirtualMachineId()); } return vm.getAccountId(); }
@Override public long getEntityOwnerId() { VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId()); if (template != null) { return template.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked } }
@Override public long getEntityOwnerId() { VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId()); if (template != null) { return template.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public void execute() { boolean result = _templateService.detachIso(virtualMachineId); if (result) { UserVm userVm = _entityMgr.findById(UserVm.class, virtualMachineId); UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", userVm).get(0); response.setResponseName(DeployVMCmd.getResultObjectName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach ISO"); } } }
@Override public Long getInstanceId() { return getId(); }
@Override public long getEntityOwnerId() { VirtualMachineTemplate iso = _entityMgr.findById(VirtualMachineTemplate.class, getId()); if (iso != null) { return iso.getAccountId(); } // invalid id, parent this command to SYSTEM so ERROR events are tracked return Account.ACCOUNT_ID_SYSTEM; }
@Override public long getEntityOwnerId() { UserVm vm = _entityMgr.findById(UserVm.class, getVirtualMachineId()); if (vm != null) { return vm.getAccountId(); } else { throw new InvalidParameterValueException("Unable to find VM by ID " + getVirtualMachineId()); } }
@Override public long getEntityOwnerId() { VirtualMachineTemplate iso = _entityMgr.findById(VirtualMachineTemplate.class, getId()); if (iso != null) { return iso.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; }