@Override
 public void rollback(Change change) {
   OperationType operationType = change.getOperationType();
   try {
     switch (operationType) {
       case CREATE:
         {
           Object targetObject = change.getNewObject();
           Query removeQuery = createFindQuery(targetObject);
           Object removedObject = mongoOperations.findOne(removeQuery, targetObject.getClass());
           if (removedObject != null) {
             mongoOperations.remove(removedObject);
           }
           break;
         }
       case UPDATE:
       case DELETE:
         {
           mongoOperations.save(change.getOldObject());
           break;
         }
     }
   } catch (Exception exc) {
     exc.printStackTrace();
   }
 }
 @Override
 public void inserirTemplate(Template template) throws ColetorMongoException {
   try {
     mongoOperations.save(template);
   } catch (Exception e) {
     mongoOperations.remove(template);
     throw new ColetorMongoException(e);
   }
 }
Пример #3
0
  @Override
  public boolean removeCharacter(String characterId) {
    Query q = new Query();
    q.addCriteria(Criteria.where("id").is(characterId));

    WriteResult w = mongoOp.remove(q, Character.class);
    if (w.isUpdateOfExisting()) return true;
    else return false;
  }
 /** {@link RepositoryOperations#deleteAll} */
 public void deleteAll() {
   mongoOperations.remove(new Query(), model);
 }
 public boolean removeCreditTransaction(CreditTransaction transaction)
     throws UnknownHostException {
   transactionMongoOps.remove(transaction);
   return exists(transaction) == false;
 }
Пример #6
0
 @Override
 public void delete(String id) {
   Query searchSeasonQuery = new Query(Criteria.where("id").is(id));
   mongoOperation.remove(searchSeasonQuery, Season.class);
 }
 public void deleteArticle(Article article) {
   operations.remove(article);
 }
Пример #8
0
 @Override
 public void supprimerCompte(Compte compte) {
   mongoOperations.remove(compte);
 }
Пример #9
0
 @Override
 public void removeCharacters(List<String> idCharacters) {
   Query q = new Query();
   q.addCriteria(Criteria.where("id").in(idCharacters));
   mongoOp.remove(q, Character.class);
 }
Пример #10
0
 @Override
 public void remove(String id) {
   mongoOperations.remove(Query.query(Criteria.where("id").is(id)), User.class);
 }