@Override public Long getInstanceId() { return getId(); }
@Override public long getEntityOwnerId() { VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, getId()); if (template != null) { return template.getAccountId(); } // bad id given, parent this command to SYSTEM so ERROR events are tracked return Account.ACCOUNT_ID_SYSTEM; }
@Override public String getEventDescription() { StringBuilder descBuilder = new StringBuilder(); if (getDestinationZoneIds() != null) { for (Long destId : getDestinationZoneIds()) { descBuilder.append(", "); descBuilder.append(this._uuidMgr.getUuid(DataCenter.class, destId)); } if (descBuilder.length() > 0) { descBuilder.deleteCharAt(0); } } return "copying template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) +((getSourceZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getSourceZoneId()) : "") + ((descBuilder.length() > 0) ? " to zones: " + descBuilder.toString() : ""); }
@Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_COPY, eventDescription = "copying template", async = true) public VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd) throws StorageUnavailableException, ResourceAllocationException { Long templateId = cmd.getId(); Long userId = CallContext.current().getCallingUserId(); Long sourceZoneId = cmd.getSourceZoneId();