public AccountResource.SshKey parse(IdentifiedUser user, IdString id) throws ResourceNotFoundException, OrmException { try { int seq = Integer.parseInt(id.get(), 10); AccountSshKey sshKey = dbProvider.get().accountSshKeys().get(new AccountSshKey.Id(user.getAccountId(), seq)); if (sshKey == null) { throw new ResourceNotFoundException(id); } return new AccountResource.SshKey(user, sshKey); } catch (NumberFormatException e) { throw new ResourceNotFoundException(id); } }
@SuppressWarnings("unchecked") @Override public PutIncludedGroup create(GroupResource group, IdString id) { return new PutIncludedGroup(put, id.get()); }