@Override public GuestOSHypervisorVO getGuestOsHypervisor(final Long guestOsHypervisorId) { return _guestOSHypervisorDao.findById(guestOsHypervisorId); }
@Override @DB @ActionEvent(eventType = EventTypes.EVENT_GUEST_OS_MAPPING_UPDATE, eventDescription = "updating guest OS mapping", async = true) public GuestOSHypervisor updateGuestOsMapping(final UpdateGuestOsMappingCmd cmd) { final Long id = cmd.getId(); final String osNameForHypervisor = cmd.getOsNameForHypervisor(); //check if mapping exists final GuestOSHypervisor guestOsHypervisorHandle = _guestOSHypervisorDao.findById(id); if (guestOsHypervisorHandle == null) { throw new InvalidParameterValueException("Guest OS Mapping not found. Please specify a valid ID for the Guest OS Mapping"); } if (!guestOsHypervisorHandle.getIsUserDefined()) { throw new InvalidParameterValueException("Unable to modify system defined Guest OS mapping"); } final GuestOSHypervisorVO guestOsHypervisor = _guestOSHypervisorDao.createForUpdate(id); guestOsHypervisor.setGuestOsName(osNameForHypervisor); if (_guestOSHypervisorDao.update(id, guestOsHypervisor)) { return _guestOSHypervisorDao.findById(id); } else { return null; } }
@Override @DB @ActionEvent(eventType = EventTypes.EVENT_GUEST_OS_MAPPING_REMOVE, eventDescription = "removing guest OS mapping", async = true) public boolean removeGuestOsMapping(final RemoveGuestOsMappingCmd cmd) { final Long id = cmd.getId(); //check if mapping exists final GuestOSHypervisor guestOsHypervisorHandle = _guestOSHypervisorDao.findById(id); if (guestOsHypervisorHandle == null) { throw new InvalidParameterValueException("Guest OS Mapping not found. Please specify a valid ID for the Guest OS Mapping"); } if (!guestOsHypervisorHandle.getIsUserDefined()) { throw new InvalidParameterValueException("Unable to remove system defined Guest OS mapping"); } return _guestOSHypervisorDao.removeGuestOsMapping(id); }