コード例 #1
0
 // Updating the info from an existing user.
 public void updateUsuario(UsuarioSiar usuarioSiar) throws Exception {
   UsuarioSiar existingUser =
       siarmongoTemplate.findById(usuarioSiar.getId(), UsuarioSiar.class, "usuarioSiarTable");
   if (existingUser == null) {
     throw new Exception("User not found");
   }
   siarmongoTemplate.save(usuarioSiar, "usuarioSiarTable");
 }
コード例 #2
0
 // Removes an user from the repository.
 public void removeUsuario(String id) throws Exception {
   UsuarioSiar existingUser =
       siarmongoTemplate.findById(new ObjectId(id), UsuarioSiar.class, "usuarioSiarTable");
   if (existingUser == null) {
     throw new Exception("User not found");
   }
   siarmongoTemplate.remove(existingUser, "usuarioSiarTable");
 }
コード例 #3
0
 /**
  * retrieves the {@link Account} of given id
  *
  * @param accountId the user storage account id
  * @return the Account
  * @throws NotFoundException if Account doesn't exist
  */
 public Account findById(String accountId) throws NotFoundException {
   Account account = db.findById(accountId, Account.class);
   if (account == null) {
     logger.error("Account not found: " + accountId);
     throw new NotFoundException();
   }
   return account;
 }
  @Override
  public UniversalRecord find(String id) {
    return template.findById(id, UniversalRecord.class, docCollectionName);

    //        QUniversalRecord universalRecord = QUniversalRecord.universalRecord;
    //        List<UniversalRecord> list =
    // from(universalRecord).where(universalRecord.id.eq(id)).list(universalRecord);
    //        return list.get(0);
  }
コード例 #5
0
 /**
  * saves a new account
  *
  * @param account the user storage account to save
  * @return the account saved with id field populated
  * @throws AlreadyStoredException if account is already stored
  */
 public Account save(Account account) throws AlreadyStoredException {
   if (account.getId() != null && db.findById(account.getId(), Account.class) != null) {
     logger.error("Account already stored, " + account.getId());
     throw new AlreadyStoredException();
   }
   if (account.getId() == null || account.getId().trim().length() == 0) {
     account.setId(new ObjectId().toString());
   }
   db.save(account);
   return account;
 }
コード例 #6
0
  @Override
  public DocumentDAO findById(String id) {

    return mongoTemplate.findById(id, DocumentDAO.class);
  }
コード例 #7
0
 @Override
 public Passgrid findOne(String id) {
   Passgrid result = mongoTemplate.findById(id, Passgrid.class, COLLECTION_NAME);
   return result;
 }
コード例 #8
0
 // Finds an user by its id in the repository.
 public UsuarioSiar findUsuarioById(String id) {
   return siarmongoTemplate.findById(new ObjectId(id), UsuarioSiar.class, "usuarioSiarTable");
 }
コード例 #9
0
ファイル: BaseServiceImpl.java プロジェクト: orctom/bonsai
 public boolean exists(Serializable id) {
   return null == mongoTemplate.findById(id, entityClass);
 }
コード例 #10
0
ファイル: BaseServiceImpl.java プロジェクト: orctom/bonsai
 public T findById(Serializable id) {
   return mongoTemplate.findById(id, entityClass);
 }