예제 #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);
   }
 }
예제 #2
0
파일: SshKeys.java 프로젝트: web1992/gerrit
 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());
 }