Ejemplo n.º 1
0
 @Override
 public AccountApi id(String id) throws RestApiException {
   try {
     return api.create(accounts.parse(TopLevelResource.INSTANCE, IdString.fromDecoded(id)));
   } catch (OrmException e) {
     throw new RestApiException("Cannot parse change", e);
   }
 }
Ejemplo n.º 2
0
 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());
 }